Package org.apache.synapse

Examples of org.apache.synapse.ServerManager


        System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration",
                "org.apache.xerces.parsers.XMLGrammarCachingConfiguration");
        System.setProperty("axis2.xml", "modules/samples/target/test_repos/synapse/conf/axis2.xml");
        ServerConfigurationInformation information = new ServerConfigurationInformation();
        information.setAxis2RepoLocation(SYNAPSE_REPO);
        serverManager = new ServerManager();
        serverManager.init(information, null);
        serverManager.start();
    }
View Full Code Here


     * @throws ServletException
     */
    public void init(ServletConfig config) throws ServletException {
        ServletContext servletContext = config.getServletContext();

        ServerManager serverManager = (ServerManager) config.getServletContext().
                getAttribute(SynapseStartUpServlet.SYNAPSE_SERVER_MANAGER);
        if (serverManager != null) {
            this.configContext = (ConfigurationContext) serverManager.
                    getServerContextInformation().getServerContext();
            this.axisConfiguration = this.configContext.getAxisConfiguration();
            servletContext.setAttribute(this.getClass().getName(), this);
            this.servletConfig = config;
            agent = new ListingAgent(configContext);
View Full Code Here

        synTrsIn.getParameter("port").setValue("12100");
        startServer(synapseConfigCtx);

        ServerContextInformation contextInformation =
                new ServerContextInformation(synapseConfigCtx, information);
        ServerManager serverManager = new ServerManager();
        serverManager.init(information, contextInformation);
        serverManager.start();

        // Initializing Business Endpoint
       
        // Set a different agent name to avoid collisions between the MBeans registered
        // by the two servers.
View Full Code Here

        ServletConfig servletConfig = getServletConfig();
        ServletContext servletContext = servletConfig.getServletContext();
        if (Boolean.TRUE.equals(servletContext.getAttribute(ALREADY_INITED))) {
            return;
        }
        ServerManager serverManager = new ServerManager();
        ServerConfigurationInformation information =
                ServerConfigurationInformationFactory.
                        createServerConfigurationInformation(servletConfig);
        serverManager.init(information, null);
        serverManager.start();
        servletContext.setAttribute(ALREADY_INITED, Boolean.TRUE);

        servletContext.setAttribute(SYNAPSE_SERVER_MANAGER, serverManager);
    }
View Full Code Here

    public void destroy() {
        try {
            Object o = getServletConfig().getServletContext().getAttribute(SYNAPSE_SERVER_MANAGER);
            if (o != null && o instanceof ServerManager) {
                ServerManager serverManager = (ServerManager) o;
                serverManager.stop();
                getServletContext().removeAttribute(ALREADY_INITED);
            }
        } catch (Exception e) {
            log.error("Error stopping the Synapse listener manager", e);
        }
View Full Code Here

    private Exception processException;

    public SynapseProcessController(SynapseServerConfiguration configuration) {
        this.configuration = configuration;
        information = new ServerConfigurationInformation();
        manager = new ServerManager();
        cdLatch = new CountDownLatch(1);
        serverThread = new ServerThread();
        serverThread.setName(configuration.getServerName() + " thread");
    }
View Full Code Here

    public void init() throws ServletException {
        super.init();
    }

    public void init(ServletConfig servletConfig) throws ServletException {
        ServerManager serverManager = ServerManager.getInstance();
        ServletContext servletContext = servletConfig.getServletContext();
        if ("true".equals(servletContext.getAttribute("hasAlreadyInit"))) {
            return;
        }
        String synapseHome = resolveSynapseHome(servletConfig);
        //Setting the all required system properties
        if (synapseHome != null) {
            if (synapseHome.endsWith("/")) {
                synapseHome = synapseHome.substring(0, synapseHome.lastIndexOf("/"));
            }
            System.setProperty(SynapseConstants.SYNAPSE_HOME, synapseHome);
            //setting axis2 repository location
            String axis2Repo = System.getProperty(org.apache.axis2.Constants.AXIS2_REPO);
            if (axis2Repo == null) {
                ServerManager.getInstance().setAxis2Repolocation(synapseHome + "/WEB-INF" +
                    File.separator + "repository");
                System.setProperty(org.apache.axis2.Constants.AXIS2_REPO,
                    synapseHome + "/WEB-INF" +
                        File.separator + "repository");
            }
            //setting axis2 configuration location
            String axis2Xml = System.getProperty(org.apache.axis2.Constants.AXIS2_CONF);
            if (axis2Xml == null) {
                System.setProperty(org.apache.axis2.Constants.AXIS2_CONF,
                    synapseHome + File.separator
                        + "WEB-INF/conf"
                        + File.separator + org.apache.axis2.Constants.AXIS2_CONF);
            }
            //setting synapse configuration location
            String synapseXml = System.getProperty(org.apache.synapse.SynapseConstants.SYNAPSE_XML);
            if (synapseXml == null) {
                System.setProperty(org.apache.synapse.SynapseConstants.SYNAPSE_XML,
                    synapseHome + File.separator
                        + "WEB-INF/conf"
                        + File.separator + org.apache.synapse.SynapseConstants.SYNAPSE_XML);

            }
        } else {
            log.fatal("Can not resolve synapse home  : startup failed");
            return;
        }
        serverManager.start();
        servletContext.setAttribute("hasAlreadyInit", "true");
    }
View Full Code Here

        IOException {
    }

    public void destroy() {
        try {
            ServerManager serverManager = ServerManager.getInstance();
            serverManager.stop(); // will stop all started  listeners
        } catch (Exception ignored) {
        }
    }
View Full Code Here

      ServletContext servletContext = servletConfig.getServletContext();
        if (Boolean.TRUE.equals(servletContext.getAttribute(ALREADY_INITED))) {
            return;
        }

        ServerManager serverManager = ServerManager.getInstance();
        String synHome = loadParameter(servletConfig, SynapseConstants.SYNAPSE_HOME, false);

        if (synHome == null) {
            log.info("synapse.home not set; using web application root as default value");
            String webinfPath = servletContext.getRealPath("WEB-INF");
            if (webinfPath == null || !webinfPath.endsWith("WEB-INF")) {
                handleException("Unable to determine web application root directory");
            } else {
                synHome = webinfPath.substring(0, webinfPath.length()-7);
                log.info("Setting synapse.home to : " + synHome);
            }
        }
        serverManager.setSynapseHome(synHome);
       
        serverManager.setSynapseXMLPath(loadParameter(servletConfig, SynapseConstants.SYNAPSE_XML, true));
        String resolveRoot = loadParameter(servletConfig, SynapseConstants.RESOLVE_ROOT, false);
        if (resolveRoot != null) {
            serverManager.setResolveRoot(resolveRoot);
        }
        serverManager.setAxis2Repolocation(loadParameter(servletConfig, org.apache.axis2.Constants.AXIS2_REPO, true));
        serverManager.setAxis2Xml(loadParameter(servletConfig, org.apache.axis2.Constants.AXIS2_CONF, true));
        serverManager.setServerName(loadParameter(servletConfig, SynapseConstants.SERVER_NAME, false));

        serverManager.start();
        servletContext.setAttribute(ALREADY_INITED, Boolean.TRUE);
    }
View Full Code Here

                          HttpServletResponse response) throws ServletException, IOException {
    }

    public void destroy() {
        try {
            ServerManager serverManager = ServerManager.getInstance();
            serverManager.stop();
            getServletContext().removeAttribute(ALREADY_INITED);
        } catch (Exception e) {
            log.error("Error stopping the Synapse listener manager", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.ServerManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.