当前位置: 首页>>代码示例>>Java>>正文


Java ListenerManager类代码示例

本文整理汇总了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;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:17,代码来源:SampleAxis2Server.java

示例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();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:UtilServer.java

示例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();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:31,代码来源:AxisServlet.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:32,代码来源:ServiceContext.java

示例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;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:12,代码来源:Axis2ServerManager.java

示例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);
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:9,代码来源:UtilsTransportServer.java

示例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();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:8,代码来源:WSDLToAllServicesBuilderTest.java

示例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();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:8,代码来源:WSDLServiceBuilderTest.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:UtilServer.java

示例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);
    }
}
 
开发者ID:apache,项目名称:airavata,代码行数:15,代码来源:XBayaClientTest.java

示例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
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:64,代码来源:SampleAxis2ServerManager.java

示例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
    }
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:54,代码来源:SampleAxis2ServerManager.java

示例13: setListenerManager

import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
protected void setListenerManager(ListenerManager listenerManager) {
    this.listenerManager = listenerManager;
    //initialize();
    //registerEventingService();
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:6,代码来源:RegistryEventingServiceComponent.java

示例14: unsetListenerManager

import org.apache.axis2.engine.ListenerManager; //导入依赖的package包/类
protected void unsetListenerManager(ListenerManager listenerManager) {
    this.listenerManager = null;
    unregisterEventingService();
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:5,代码来源:RegistryEventingServiceComponent.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:57,代码来源:ClientUtils.java


注:本文中的org.apache.axis2.engine.ListenerManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。