FileDocCategorySizeDatePackage
WSTCP.javaAPI DocExample5365Tue May 29 16:57:10 BST 2007com.sun.xml.ws.transport.tcp.server

WSTCP

public final class WSTCP extends Object
author
Alexey Stashok

Fields Summary
private static final Logger
logger
private static final String
JAXWS_RI_RUNTIME
private final TCPContext
context
private final ClassLoader
initClassLoader
private WSTCPDelegate
delegate
private WSTCPConnector
connector
private final String
contextPath
Constructors Summary
public WSTCP(TCPContext context, ClassLoader initClassLoader, String contextPath)

    
        
               
        
        this.context = context;
        this.initClassLoader = initClassLoader;
        this.contextPath = contextPath;
    
Methods Summary
public voidclose()

        if (connector != null) {
            connector.close();
        }
    
public WSTCPConnectorinitialize()

        final List<TCPAdapter> adapters = parseDeploymentDescriptor();
        delegate = new WSTCPDelegate();
        delegate.registerAdapters(contextPath, adapters);
        
        final TCPAdapter adapter = adapters.get(0);
        final URI uri = adapter.getEndpoint().getPort().getAddress().getURI();
        
        final WSTCPURI tcpURI = WSTCPURI.parse(uri);
        
        final WSTCPConnector connector = new GrizzlyTCPConnector(tcpURI.host,
                tcpURI.port, delegate);
        connector.listen();
        return connector;
    
public static voidmain(java.lang.String[] args)

        if (args.length != 1) {
            System.out.println(MessagesMessages.STANDALONE_RUN());
            System.exit(0);
        }
        
        final String contextPath = args[0];
        
        final ClassLoader classloader = Thread.currentThread().getContextClassLoader();
        final TCPContext context = new TCPStandaloneContext(classloader);
        
        final WSTCP wsTCP = new WSTCP(context, classloader, contextPath);
        
        try {
            wsTCP.process();
            System.out.println(MessagesMessages.STANDALONE_EXIT());
            System.in.read();
        } catch (Exception e) {
        } finally {
            wsTCP.close();
        }
    
public java.util.ListparseDeploymentDescriptor()

        final DeploymentDescriptorParser<TCPAdapter> parser = new DeploymentDescriptorParser<TCPAdapter>(
                initClassLoader, new TCPResourceLoader(context), null, TCPAdapter.FACTORY);
        final URL sunJaxWsXml = context.getResource(JAXWS_RI_RUNTIME);
        
        return parser.parse(sunJaxWsXml.toExternalForm(), sunJaxWsXml.openStream());
    
public voidprocess()

        connector = initialize();