FileDocCategorySizeDatePackage
WSTCPLifeCycleModule.javaAPI DocExample5332Tue May 29 16:57:12 BST 2007com.sun.xml.ws.transport.tcp.server.glassfish

WSTCPLifeCycleModule

public final class WSTCPLifeCycleModule extends Object implements com.sun.appserv.server.LifecycleListener
GlassFish lifecycle module, which works as SOAP/TCP endpoints registry.
author
Alexey Stashok

Fields Summary
private static WSTCPLifeCycleModule
instance
private static final Logger
logger
private WSTCPConnector
connector
private WSTCPDelegate
delegate
private Properties
properties
Constructors Summary
Methods Summary
public voidfree(java.lang.String contextPath, java.util.List adapters)

        delegate.freeAdapters(contextPath, adapters);
    
public static com.sun.xml.ws.transport.tcp.server.glassfish.WSTCPLifeCycleModulegetInstance()
Method returns initialized WSTCPLifeCycleModule instance

throws
IllegalStateException if instance was not initialized

    
                     
         
        if (instance == null) {
            throw new IllegalStateException(MessagesMessages.WSTCP_0007_TRANSPORT_MODULE_NOT_INITIALIZED());
        }
        
        return instance;
    
public voidhandleEvent(com.sun.appserv.server.LifecycleEvent lifecycleEvent)

        final int eventType = lifecycleEvent.getEventType();
        if (eventType == LifecycleEvent.INIT_EVENT) {
            instance = this;
            logger.log(Level.FINE, "WSTCPLifeCycleModule.INIT_EVENT");
            properties = (Properties) lifecycleEvent.getData();
        } else if (eventType == LifecycleEvent.STARTUP_EVENT) {
            logger.log(Level.FINE, "WSTCPLifeCycleModule.STARTUP_EVENT");
            delegate = new WSTCPDelegate();
        } else if (eventType == LifecycleEvent.READY_EVENT) {
            logger.log(Level.FINE, "WSTCPLifeCycleModule.READY_EVENT");
            try {
                delegate.setCustomWSRegistry(WSTCPAdapterRegistryImpl.getInstance());
                connector = new GrizzlyTCPConnector(delegate, properties);
                connector.listen();
                
                
            } catch (Exception e) {
                logger.log(Level.SEVERE, e.getMessage(), e);
            }
        } else if (eventType == LifecycleEvent.SHUTDOWN_EVENT) {
            logger.log(Level.FINE, "WSTCPLifeCycleModule.SHUTDOWN_EVENT");
            instance = null;
            
            if (delegate != null) {
                delegate.destroy();
            }
            
            if (connector != null) {
                connector.close();
            }
            
        }
    
public voidregister(java.lang.String contextPath, java.util.List adapters)

        delegate.registerAdapters(contextPath, adapters);