本文整理汇总了Java中org.apache.axis2.engine.ListenerManager类的典型用法代码示例。如果您正苦于以下问题:Java ListenerManager类的具体用法?Java ListenerManager怎么用?Java ListenerManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListenerManager类属于org.apache.axis2.engine包,在下文中一共展示了ListenerManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public void start() throws IOException {
log.info("Starting sample Axis2 server");
//To set the socket can be bound even though a previous connection is still in a timeout state.
if (System.getProperty(CoreConnectionPNames.SO_REUSEADDR) == null) {
System.setProperty(CoreConnectionPNames.SO_REUSEADDR, "true");
}
listenerManager = new ListenerManager();
listenerManager.init(cfgCtx);
listenerManager.start();
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
started = true;
}
示例2: stop
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public static synchronized void stop() throws AxisFault {
if (count == 1) {
receiver.stop();
while (receiver.isRunning()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
}
}
count = 0;
// tp.doStop();
System.out.print("Server stopped .....");
} else {
count--;
}
ListenerManager listenerManager =
receiver.getConfigurationContext().getListenerManager();
if (listenerManager != null) {
listenerManager.stop();
}
}
示例3: initTransports
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
/**
* Initialize HTTP transports
*
* @throws AxisFault If an error occurs while initializing transports
*/
protected void initTransports() throws AxisFault {
httpListener = getAxisServletListener(Constants.TRANSPORT_HTTP);
httpsListener = getAxisServletListener(Constants.TRANSPORT_HTTPS);
if (httpListener == null && httpsListener == null) {
log.warn("No transportReceiver for " + AxisServletListener.class.getName() +
" found. An instance for HTTP will be configured automatically. " +
"Please update your axis2.xml file!");
httpListener = new AxisServletListener();
TransportInDescription transportInDescription = new TransportInDescription(
Constants.TRANSPORT_HTTP);
transportInDescription.setReceiver(httpListener);
axisConfiguration.addTransportIn(transportInDescription);
} else if (httpListener != null && httpsListener != null
&& httpListener.getPort() == -1 && httpsListener.getPort() == -1) {
log.warn("If more than one transportReceiver for " +
AxisServletListener.class.getName() + " exists, then all instances " +
"must be configured with a port number. WSDL generation will be " +
"unreliable.");
}
ListenerManager listenerManager = new ListenerManager();
listenerManager.init(configContext);
listenerManager.start();
}
示例4: getMyEPR
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
/**
* To get the ERP for a given service , if the transport is present and not
* running then it will add as a listener to ListenerManager , there it will
* init that and start the listener , and finally ask the EPR from transport
* for a given service
*
* @param transport : Name of the transport
* @return
* @throws AxisFault
*/
public EndpointReference getMyEPR(String transport) throws AxisFault {
axisService.isEnableAllTransports();
ConfigurationContext configctx = this.configContext;
if (configctx != null) {
ListenerManager lm = configctx.getListenerManager();
if (!lm.isListenerRunning(transport)) {
TransportInDescription trsin =
configctx.getAxisConfiguration().getTransportIn(transport);
if (trsin != null) {
lm.addListener(trsin, false);
} else {
throw new AxisFault(Messages.getMessage("transportnotfound",
transport));
}
}
if (!lm.isStopped()) {
return lm.getEPRforService(axisService.getName(), null, transport);
}
}
return null;
}
示例5: start
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public void start() throws IOException {
log.info("Starting sample Axis2 server");
listenerManager = new ListenerManager();
listenerManager.init(cfgCtx);
listenerManager.start();
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
started = true;
}
示例6: UtilsTransportServer
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public UtilsTransportServer() throws AxisFault {
cfgCtx = ConfigurationContextFactory.
createConfigurationContext(new CustomAxisConfigurator());
// create listener manager
listnMgr = new ListenerManager();
cfgCtx.setTransportManager(listnMgr);
}
示例7: setUp
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
protected void setUp() throws Exception {
configContext =
ConfigurationContextFactory.createEmptyConfigurationContext();
lm = new ListenerManager();
lm.init(configContext);
lm.start();
}
示例8: setUp
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
protected void setUp() throws Exception {
configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
lm = new ListenerManager();
lm.init(configContext);
lm.start();
}
示例9: stop
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public static synchronized void stop() throws AxisFault {
if (receiver == null) {
throw new IllegalStateException("Server not started");
}
receiver.stop();
waitUntilStopped();
// tp.doStop();
System.out.print("Server stopped .....");
ListenerManager listenerManager =
receiver.getConfigurationContext().getListenerManager();
if (listenerManager != null) {
listenerManager.stop();
}
receiver = null;
}
示例10: axis2ServiceStarter
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
private ListenerManager axis2ServiceStarter() throws AxisFault {
try {
ConfigurationContext configContext = ConfigurationContextFactory.createBasicConfigurationContext
("axis2_default.xml");
AxisService service = AxisService.createService(EchoService.class.getName(), configContext.getAxisConfiguration());
configContext.deployService(service);
ListenerManager manager = new ListenerManager();
manager.init(configContext);
manager.start();
return manager;
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
示例11: start
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public void start(String[] args) throws Exception {
String repoLocation = null;
String confLocation = null;
CommandLineOptionParser optionsParser = new CommandLineOptionParser(args);
List invalidOptionsList = optionsParser.getInvalidOptions(new OptionsValidator() {
public boolean isInvalid(CommandLineOption option) {
String optionType = option.getOptionType();
return !("repo".equalsIgnoreCase(optionType) || "conf"
.equalsIgnoreCase(optionType));
}
});
if ((invalidOptionsList.size() > 0) || (args.length > 4)) {
printUsage();
}
Map optionsMap = optionsParser.getAllOptions();
CommandLineOption repoOption = (CommandLineOption) optionsMap
.get("repo");
CommandLineOption confOption = (CommandLineOption) optionsMap
.get("conf");
log.info("[SimpleAxisServer] Starting");
if (repoOption != null) {
repoLocation = repoOption.getOptionValue();
System.out.println("[SimpleAxisServer] Using the Axis2 Repository : "
+ new File(repoLocation).getAbsolutePath());
}
if (confOption != null) {
confLocation = confOption.getOptionValue();
System.out
.println("[SimpleAxisServer] Using the Axis2 Configuration File : "
+ new File(confLocation).getAbsolutePath());
}
try {
configctx = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(repoLocation,
confLocation);
configurePort(configctx);
// Need to initialize the cluster manager at last since we are changing the servers
// HTTP/S ports above. In the axis2.xml file, we need to set the "AvoidInitiation" param
// to "true"
ClusteringAgent clusteringAgent =
configctx.getAxisConfiguration().getClusteringAgent();
if(clusteringAgent != null) {
clusteringAgent.setConfigurationContext(configctx);
clusteringAgent.init();
}
// Finally start the transport listeners
listenerManager = new ListenerManager();
listenerManager.init(configctx);
listenerManager.start();
log.info("[SimpleAxisServer] Started");
} catch (Throwable t) {
log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);
System.exit(1); // must stop application
}
}
示例12: start
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public void start(String[] args) throws Exception {
String repoLocation = null;
String confLocation = null;
CommandLineOptionParser optionsParser = new CommandLineOptionParser(args);
List invalidOptionsList = optionsParser.getInvalidOptions(new OptionsValidator() {
public boolean isInvalid(CommandLineOption option) {
String optionType = option.getOptionType();
return !("repo".equalsIgnoreCase(optionType) || "conf"
.equalsIgnoreCase(optionType));
}
});
if ((invalidOptionsList.size() > 0) || (args.length > 4)) {
printUsage();
}
Map optionsMap = optionsParser.getAllOptions();
CommandLineOption repoOption = (CommandLineOption) optionsMap
.get("repo");
CommandLineOption confOption = (CommandLineOption) optionsMap
.get("conf");
log.info("[SimpleAxisServer] Starting");
if (repoOption != null) {
repoLocation = repoOption.getOptionValue();
System.out.println("[SimpleAxisServer] Using the Axis2 Repository : "
+ new File(repoLocation).getAbsolutePath());
}
if (confOption != null) {
confLocation = confOption.getOptionValue();
System.out
.println("[SimpleAxisServer] Using the Axis2 Configuration File : "
+ new File(confLocation).getAbsolutePath());
}
try {
configctx = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(repoLocation,
confLocation);
configurePort(configctx);
// Finally start the transport listeners
listenerManager = new ListenerManager();
listenerManager.init(configctx);
listenerManager.start();
log.info("[SimpleAxisServer] Started");
} catch (Throwable t) {
log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);
System.exit(1); // must stop application
}
}
示例13: setListenerManager
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
protected void setListenerManager(ListenerManager listenerManager) {
this.listenerManager = listenerManager;
//initialize();
//registerEventingService();
}
示例14: unsetListenerManager
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
protected void unsetListenerManager(ListenerManager listenerManager) {
this.listenerManager = null;
unregisterEventingService();
}
示例15: inferInTransport
import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
public static TransportInDescription inferInTransport(AxisConfiguration ac,
Options options,
MessageContext msgCtxt)
throws AxisFault {
String listenerTransportProtocol = options.getTransportInProtocol();
if (listenerTransportProtocol == null) {
EndpointReference replyTo = msgCtxt.getReplyTo();
if (replyTo != null) {
try {
URI uri = new URI(replyTo.getAddress());
listenerTransportProtocol = uri.getScheme();
} catch (URISyntaxException e) {
//need to ignore
}
} else {
//assume listener transport as sender transport
if (msgCtxt.getTransportOut() != null) {
listenerTransportProtocol = msgCtxt.getTransportOut().getName();
}
}
}
TransportInDescription transportIn = null;
if (options.isUseSeparateListener() || msgCtxt.getOptions().isUseSeparateListener()) {
if ((listenerTransportProtocol != null) && !"".equals(listenerTransportProtocol)) {
transportIn = ac.getTransportIn(listenerTransportProtocol);
ListenerManager listenerManager =
msgCtxt.getConfigurationContext().getListenerManager();
if (transportIn == null) {
// TODO : User should not be mandated to give an IN transport. If it is not given, we should
// ask from the ListenerManager to give any available transport for this client.
log.error(Messages.getMessage("unknownTransport",
listenerTransportProtocol));
throw new AxisFault(Messages.getMessage("unknownTransport",
listenerTransportProtocol));
}
synchronized (ClientUtils.class) {
if (!listenerManager.isListenerRunning(transportIn.getName())) {
listenerManager.addListener(transportIn, false);
}
}
}
if (msgCtxt.getAxisService() != null) {
if (!msgCtxt.isEngaged(Constants.MODULE_ADDRESSING)) {
log.error(Messages.getMessage("2channelNeedAddressing"));
throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
}
} else {
if (!ac.isEngaged(Constants.MODULE_ADDRESSING)) {
log.error(Messages.getMessage("2channelNeedAddressing"));
throw new AxisFault(Messages.getMessage("2channelNeedAddressing"));
}
}
}
return transportIn;
}