Search in sources :

Example 1 with WebServiceEngineImpl

use of org.glassfish.webservices.monitoring.WebServiceEngineImpl in project Payara by payara.

the class WebServiceEjbEndpointRegistry method registerEndpoint.

@Override
public void registerEndpoint(WebServiceEndpoint webserviceEndpoint, EjbEndpointFacade ejbContainer, Object servant, Class tieClass) {
    String uri = null;
    EjbRuntimeEndpointInfo endpoint = createEjbEndpointInfo(webserviceEndpoint, ejbContainer, servant, tieClass);
    synchronized (webServiceEjbEndpoints) {
        String uriRaw = endpoint.getEndpointAddressUri();
        if (uriRaw != null) {
            uri = (uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
            if (webServiceEjbEndpoints.containsKey(uri)) {
                logger.log(Level.SEVERE, LogUtils.ENTERPRISE_WEBSERVICE_DUPLICATE_SERVICE, uri);
            }
            webServiceEjbEndpoints.put(uri, endpoint);
            regenerateEjbContextRoots();
            if (adapterListMap.get(uri) == null) {
                ServletAdapterList list = new ServletAdapterList();
                adapterListMap.put(uri, list);
            }
        } else
            throw new WebServiceException(logger.getResourceBundle().getString(LogUtils.EJB_ENDPOINTURI_ERROR));
    }
    // notify monitoring layers that a new endpoint is being created.
    WebServiceEngineImpl engine = WebServiceEngineImpl.getInstance();
    if (hasMappingFileUri(endpoint.getEndpoint())) {
        engine.createHandler((com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate) null, endpoint.getEndpoint());
    } else {
        engine.createHandler(endpoint.getEndpoint());
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) ServletAdapterList(com.sun.xml.ws.transport.http.servlet.ServletAdapterList) WebServiceEngineImpl(org.glassfish.webservices.monitoring.WebServiceEngineImpl)

Example 2 with WebServiceEngineImpl

use of org.glassfish.webservices.monitoring.WebServiceEngineImpl in project Payara by payara.

the class WebServiceEjbEndpointRegistry method unregisterEndpoint.

@Override
public void unregisterEndpoint(String endpointAddressUri) {
    EjbRuntimeEndpointInfo endpoint = null;
    synchronized (webServiceEjbEndpoints) {
        String uriRaw = endpointAddressUri;
        String uri = (uriRaw.charAt(0) == '/') ? uriRaw.substring(1) : uriRaw;
        ServletAdapterList list = adapterListMap.get(uri);
        if (list != null) {
            // since we are using the uri in the adapterListMap
            for (ServletAdapter x : list) {
                x.getEndpoint().dispose();
                for (Handler handler : x.getEndpoint().getBinding().getHandlerChain()) {
                    try {
                        WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
                        if (wscImpl.getInvocationManager().getCurrentInvocation() != null) {
                            InjectionManager injManager = wscImpl.getInjectionManager();
                            injManager.destroyManagedObject(handler);
                        }
                    } catch (InjectionException e) {
                        logger.log(Level.WARNING, LogUtils.DESTORY_ON_HANDLER_FAILED, new Object[] { handler.getClass(), x.getEndpoint().getServiceName(), e.getMessage() });
                        continue;
                    }
                }
            }
            // Fix for issue 9523
            adapterListMap.remove(uri);
        }
        endpoint = (EjbRuntimeEndpointInfo) webServiceEjbEndpoints.remove(uri);
        regenerateEjbContextRoots();
    }
    if (endpoint == null) {
        return;
    }
    // notify the monitoring layers that an endpoint is destroyed
    WebServiceEngineImpl engine = WebServiceEngineImpl.getInstance();
    engine.removeHandler(endpoint.getEndpoint());
}
Also used : InjectionException(com.sun.enterprise.container.common.spi.util.InjectionException) ServletAdapter(com.sun.xml.ws.transport.http.servlet.ServletAdapter) Handler(javax.xml.ws.handler.Handler) ServletAdapterList(com.sun.xml.ws.transport.http.servlet.ServletAdapterList) WebServiceEngineImpl(org.glassfish.webservices.monitoring.WebServiceEngineImpl) InjectionManager(com.sun.enterprise.container.common.spi.util.InjectionManager)

Aggregations

ServletAdapterList (com.sun.xml.ws.transport.http.servlet.ServletAdapterList)2 WebServiceEngineImpl (org.glassfish.webservices.monitoring.WebServiceEngineImpl)2 InjectionException (com.sun.enterprise.container.common.spi.util.InjectionException)1 InjectionManager (com.sun.enterprise.container.common.spi.util.InjectionManager)1 ServletAdapter (com.sun.xml.ws.transport.http.servlet.ServletAdapter)1 WebServiceException (javax.xml.ws.WebServiceException)1 Handler (javax.xml.ws.handler.Handler)1