xref: /AOO41X/main/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package com.sun.star.lib.connections.pipe;
29 
30 import com.sun.star.comp.loader.FactoryHelper;
31 import com.sun.star.connection.AlreadyAcceptingException;
32 import com.sun.star.connection.ConnectionSetupException;
33 import com.sun.star.connection.XAcceptor;
34 import com.sun.star.connection.XConnection;
35 import com.sun.star.lang.XMultiServiceFactory;
36 import com.sun.star.lang.XSingleServiceFactory;
37 import com.sun.star.registry.XRegistryKey;
38 
39 /**
40  * A component that implements the <code>XAcceptor</code> interface.
41  *
42  * <p>The <code>pipeAcceptor</code> is a specialized component that uses TCP
43  * pipes for communication.  The <code>pipeAcceptor</code> is generally used
44  * by the <code>com.sun.star.connection.Acceptor</code> service.</p>
45  *
46  * @see com.sun.star.connections.XAcceptor
47  * @see com.sun.star.connections.XConnection
48  * @see com.sun.star.connections.XConnector
49  * @see com.sun.star.loader.JavaLoader
50  *
51  * @since UDK 1.0
52  */
53 public final class pipeAcceptor implements XAcceptor {
54     /**
55      * The name of the service.
56      *
57      * <p>The <code>JavaLoader</code> acceses this through reflection.</p>
58      *
59      * @see com.sun.star.comp.loader.JavaLoader
60      */
61     public static final String __serviceName
62     = "com.sun.star.connection.pipeAcceptor";
63 
64     /**
65      * Returns a factory for creating the service.
66      *
67      * <p>This method is called by the <code>JavaLoader</code>.</p>
68      *
69      * @param implName the name of the implementation for which a service is
70      *     requested.
71      * @param multiFactory the service manager to be used (if needed).
72      * @param regKey the registry key.
73      * @return an <code>XSingleServiceFactory</code> for creating the component.
74      *
75      * @see com.sun.star.comp.loader.JavaLoader
76      */
77     public static XSingleServiceFactory __getServiceFactory(
78         String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey)
79     {
80         return implName.equals(pipeAcceptor.class.getName())
81             ? FactoryHelper.getServiceFactory(
82 		pipeAcceptor.class, __serviceName, multiFactory, regKey)
83             : null;
84     }
85 
86     /**
87      * Accepts a connection request via the described pipe.
88      *
89      * <p>This call blocks until a connection has been established.</p>
90      *
91      * <p>The connection description has the following format:
92      * <code><var>type</var></code><!--
93      *     -->*(<code><var>key</var>=<var>value</var></code>),
94      * where <code><var>type</var></code> should be <code>pipe</code>
95      * (ignoring case).  Supported keys (ignoring case) currently are
96      * <dl>
97      * <dt><code>host</code>
98      * <dd>The name or address of the accepting interface (defaults to
99      *     <code>0</code>, meaning any interface).
100      * <dt><code>port</code>
101      * <dd>The TCP port number to accept on (defaults to <code>6001</code>).
102      * <dt><code>backlog</code>
103      * <dd>The maximum length of the acceptor's queue (defaults to
104      *     <code>50</code>).
105      * <dt><code>tcpnodelay</code>
106      * <dd>A flag (<code>0</code>/<code>1</code>) enabling or disabling Nagle's
107      *     algorithm on the resulting connection.
108      * </dl></p>
109      *
110      * @param connectionDescription the description of the connection.
111      * @return an <code>XConnection</code> to the client.
112      *
113      * @see com.sun.star.connections.XConnection
114      * @see com.sun.star.connections.XConnector
115      */
116     public XConnection accept(String connectionDescription) throws
117         AlreadyAcceptingException, ConnectionSetupException,
118         com.sun.star.lang.IllegalArgumentException
119     {
120 	throw new java.lang.NoSuchMethodError( "pipeAcceptor not fully implemented yet" );
121 
122 	//try { return new PipeConnection( connectionDescription ); }
123 	//catch ( java.io.IOException e ) { return null; }
124     }
125 
126     // see com.sun.star.connection.XAcceptor#stopAccepting
127     public void stopAccepting() {
128     }
129 
130     private static final boolean DEBUG = false;
131 }
132