@Override public void destroy() { try { super.destroy(); servletConfig = null; if (tmpconfigContext.getListenerManager() != null){ tmpconfigContext.getListenerManager().destroy(); } } catch (Exception e) { e.printStackTrace(); } }
public boolean setUp() throws Exception { baseDir = new File(System.getProperty("basedir")); classesDir = new File(baseDir, "target/classes"); resourcesDir = new File(java.lang.System.getProperty("testClassesDirectory")); boolean axisDirectoryExists = configureLogging(); if (axisDirectoryExists) { configureAxis(); configurationContext.getListenerManager().start(); } log.info("configuration completed successfully"); return true; }
/** * This is NOT called at destroy time, but when the component is stopped * * The problem is that the lifecycle of a {@link Servlet} is not the same as the lifecycle of the jetty * {@link Server}: jetty considers that during its life it can start and stop (i.e. destroy, there is no "stop" for * servlet) servlets, and thus, when jetty is stopped, it stops (i.e., destroy) the servlets. * * The problem being that the {@link AxisServlet} that be extends consider that if it is stopped, it should stop * everything from the axis point of view, and we don't want that: in our point of view, they should both have the * same lifecycle. */ @Override public void destroy() { // Stop the ListenerManager (AxisServlet does not do it and we disabled the shutdowhook too) try { this.configContext.getListenerManager().stop(); } catch (final AxisFault e) { this.logger.log(Level.WARNING, "Error stopping the ListenerManager.", e); } }
/** * This is NOT called at init time, but when the component is started. See {@link #destroy()} and * {@link #realDestroy()}. */ @Override public void init(final ServletConfig config) throws ServletException { // this is used by super.init() to get the context and not create a new one! config.getServletContext().setAttribute(AxisServlet.CONFIGURATION_CONTEXT, this.configurationContext); // this is needed because init() is called multiple times if (!initCalled) { initCalled = true; super.init(config); // super.init() configured the listener manager (in initTransport()), now we can set it up! this.configContext.getListenerManager().setShutdownHookRequired(false); } else{ // start the ListenerManager (we stopped it in stop()) this.configContext.getListenerManager().start(); } }
/** * Return the configured listener manager or create and configure one with configurationContext */ public ListenerManager getListenerManager() { ListenerManager lm = configurationContext.getListenerManager(); if (lm == null) { lm = new ListenerManager(); lm.init(configurationContext); } return lm; }
/** * Return the configured listener manager or create and configure one with configurationContext */ public ListenerManager getListenerManager() { ListenerManager lm = configurationContext.getListenerManager(); if (lm == null) { lm = new ListenerManager(); lm.init(configurationContext); } return lm; }
public static synchronized void stop() throws AxisFault { if (receiver == null) { throw new IllegalStateException("Server not started"); } receiver.stop(); while (receiver.isRunning()) { try { Thread.sleep(1000); } catch (InterruptedException e1) { } } // tp.doStop(); System.out.print("Server stopped ....."); ListenerManager listenerManager = receiver.getConfigurationContext().getListenerManager(); if (listenerManager != null) { listenerManager.stop(); } receiver = null; }
Parameter paramter = transportInDescription.getParameter("AutoStart"); if (paramter != null) { configCtx.getListenerManager().addListener(transportInDescription, false); log.info("starting the transport : " + transportInDescription.getName());
private void processgetWSDLOperation(MessageContext messageContext) throws Exception { MessageContext response = null; EndpointReference gfacUrl = messageContext .getConfigurationContext() .getListenerManager() .getEPRforService(WSConstants.GFAC_SERVICE_NAME, WSConstants.GFAC_INVOKE_METHOD, WSConstants.GFAC_TRANSPORT); String serviceName = getOriginalServiceName(messageContext); String serviceEpr = gfacUrl.getAddress().split(WSConstants.GFAC_SERVICE_NAME)[0] + serviceName; ConfigurationContext context = messageContext.getConfigurationContext(); try { OMElement wsdlElement = getWSDL(context, serviceName); // create Concrete WSDL String cWSDL = WSDLUtil.createCWSDL(wsdlElement.toString(), serviceEpr); SOAPFactory sf = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope responseEnv = sf.createSOAPEnvelope(); sf.createSOAPBody(responseEnv); XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader( new StringReader(cWSDL.toString())); StAXOMBuilder builder = new StAXOMBuilder(reader); responseEnv.getBody().addChild(builder.getDocumentElement()); response = MessageContextBuilder.createOutMessageContext(messageContext); response.setEnvelope(responseEnv); response.getOperationContext().addMessageContext(response); AxisEngine.send(response); } catch (Exception fault) { log.error("Error creating response"); throw fault; } }
private void startServer(ConfigurationContext configctx) throws AxisFault { ListenerManager listenerManager = configctx.getListenerManager(); if (listenerManager == null) { listenerManager = new ListenerManager(); listenerManager.init(configctx); } Iterator iter = configctx.getAxisConfiguration(). getTransportsIn().keySet().iterator(); while (iter.hasNext()) { String trp = (String) iter.next(); TransportInDescription trsIn = configctx.getAxisConfiguration().getTransportsIn().get(trp); listenerManager.addListener(trsIn, false); } }
if (!configContext.getListenerManager().isListenerRunning(MailConstants.TRANSPORT_NAME)) { TransportInDescription mailTo = configContext.getAxisConfiguration().getTransportIn(MailConstants.TRANSPORT_NAME); MailConstants.TRANSPORT_NAME); configContext.getListenerManager().addListener(mailTo, false);
if (!configContext.getListenerManager().isListenerRunning(MailConstants.TRANSPORT_NAME)) { TransportInDescription mailTo = configContext.getAxisConfiguration().getTransportIn(MailConstants.TRANSPORT_NAME); MailConstants.TRANSPORT_NAME); configContext.getListenerManager().addListener(mailTo, false);
if (!configContext.getListenerManager().isListenerRunning(MailConstants.TRANSPORT_NAME)) { TransportInDescription mailTo = configContext.getAxisConfiguration().getTransportIn(MailConstants.TRANSPORT_NAME); MailConstants.TRANSPORT_NAME); configContext.getListenerManager().addListener(mailTo, false);
ConfigurationContext configctx = this.configContext; if (configctx != null) { ListenerManager lm = configctx.getListenerManager(); if (!lm.isListenerRunning(transport)) { TransportInDescription trsin =
ConfigurationContext configctx = this.configContext; if (configctx != null) { ListenerManager lm = configctx.getListenerManager(); if (!lm.isListenerRunning(transport)) { TransportInDescription trsin =
if (configContext.getListenerManager() == null) { ListenerManager listenerManager = new ListenerManager(); listenerManager.init(configContext);
if (configContext.getListenerManager() == null) { ListenerManager listenerManager = new ListenerManager(); listenerManager.init(configContext);
/** * Create a Axis2 Based Server Environment * * @param serverConfigurationInformation ServerConfigurationInformation instance */ private void createNewInstance(ServerConfigurationInformation serverConfigurationInformation) { try { configurationContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem( serverConfigurationInformation.getAxis2RepoLocation(), serverConfigurationInformation.getAxis2Xml()); configurationContext.setProperty( AddressingConstants.ADDR_VALIDATE_ACTION, Boolean.FALSE); startJmxAdapter(); listenerManager = configurationContext.getListenerManager(); if (listenerManager == null) { // create and initialize the listener manager but do not start listenerManager = new ListenerManager(); listenerManager.init(configurationContext); } // do not use the listener manager shutdown hook, because it clashes with the // SynapseServer shutdown hook. listenerManager.setShutdownHookRequired(false); } catch (Throwable t) { handleFatal("Failed to create a new Axis2 instance...", t); } }
/** * Create a Axis2 Based Server Environment * * @param serverConfigurationInformation ServerConfigurationInformation instance */ private void createNewInstance(ServerConfigurationInformation serverConfigurationInformation) { try { configurationContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem( serverConfigurationInformation.getAxis2RepoLocation(), serverConfigurationInformation.getAxis2Xml()); configurationContext.setProperty( AddressingConstants.ADDR_VALIDATE_ACTION, Boolean.FALSE); startJmxAdapter(); listenerManager = configurationContext.getListenerManager(); if (listenerManager == null) { // create and initialize the listener manager but do not start listenerManager = new ListenerManager(); listenerManager.init(configurationContext); } // do not use the listener manager shutdown hook, because it clashes with the // SynapseServer shutdown hook. listenerManager.setShutdownHookRequired(false); } catch (Throwable t) { handleFatal("Failed to create a new Axis2 instance...", t); } }
ListenerManager transportManager = configContext.getListenerManager(); if (transportManager == null) { transportManager = new ListenerManager();