1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package com.sun.star.lib.connections.pipe; 25 26 import com.sun.star.comp.loader.FactoryHelper; 27 import com.sun.star.connection.AlreadyAcceptingException; 28 import com.sun.star.connection.ConnectionSetupException; 29 import com.sun.star.connection.XAcceptor; 30 import com.sun.star.connection.XConnection; 31 import com.sun.star.lang.XMultiServiceFactory; 32 import com.sun.star.lang.XSingleServiceFactory; 33 import com.sun.star.registry.XRegistryKey; 34 35 /** 36 * A component that implements the <code>XAcceptor</code> interface. 37 * 38 * <p>The <code>pipeAcceptor</code> is a specialized component that uses TCP 39 * pipes for communication. The <code>pipeAcceptor</code> is generally used 40 * by the <code>com.sun.star.connection.Acceptor</code> service.</p> 41 * 42 * @see com.sun.star.connections.XAcceptor 43 * @see com.sun.star.connections.XConnection 44 * @see com.sun.star.connections.XConnector 45 * @see com.sun.star.loader.JavaLoader 46 * 47 * @since UDK 1.0 48 */ 49 public final class pipeAcceptor implements XAcceptor { 50 /** 51 * The name of the service. 52 * 53 * <p>The <code>JavaLoader</code> acceses this through reflection.</p> 54 * 55 * @see com.sun.star.comp.loader.JavaLoader 56 */ 57 public static final String __serviceName 58 = "com.sun.star.connection.pipeAcceptor"; 59 60 /** 61 * Returns a factory for creating the service. 62 * 63 * <p>This method is called by the <code>JavaLoader</code>.</p> 64 * 65 * @param implName the name of the implementation for which a service is 66 * requested. 67 * @param multiFactory the service manager to be used (if needed). 68 * @param regKey the registry key. 69 * @return an <code>XSingleServiceFactory</code> for creating the component. 70 * 71 * @see com.sun.star.comp.loader.JavaLoader 72 */ __getServiceFactory( String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey)73 public static XSingleServiceFactory __getServiceFactory( 74 String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) 75 { 76 return implName.equals(pipeAcceptor.class.getName()) 77 ? FactoryHelper.getServiceFactory( 78 pipeAcceptor.class, __serviceName, multiFactory, regKey) 79 : null; 80 } 81 82 /** 83 * Accepts a connection request via the described pipe. 84 * 85 * <p>This call blocks until a connection has been established.</p> 86 * 87 * <p>The connection description has the following format: 88 * <code><var>type</var></code><!-- 89 * -->*(<code><var>key</var>=<var>value</var></code>), 90 * where <code><var>type</var></code> should be <code>pipe</code> 91 * (ignoring case). Supported keys (ignoring case) currently are 92 * <dl> 93 * <dt><code>host</code> 94 * <dd>The name or address of the accepting interface (defaults to 95 * <code>0</code>, meaning any interface). 96 * <dt><code>port</code> 97 * <dd>The TCP port number to accept on (defaults to <code>6001</code>). 98 * <dt><code>backlog</code> 99 * <dd>The maximum length of the acceptor's queue (defaults to 100 * <code>50</code>). 101 * <dt><code>tcpnodelay</code> 102 * <dd>A flag (<code>0</code>/<code>1</code>) enabling or disabling Nagle's 103 * algorithm on the resulting connection. 104 * </dl></p> 105 * 106 * @param connectionDescription the description of the connection. 107 * @return an <code>XConnection</code> to the client. 108 * 109 * @see com.sun.star.connections.XConnection 110 * @see com.sun.star.connections.XConnector 111 */ accept(String connectionDescription)112 public XConnection accept(String connectionDescription) throws 113 AlreadyAcceptingException, ConnectionSetupException, 114 com.sun.star.lang.IllegalArgumentException 115 { 116 throw new java.lang.NoSuchMethodError( "pipeAcceptor not fully implemented yet" ); 117 118 //try { return new PipeConnection( connectionDescription ); } 119 //catch ( java.io.IOException e ) { return null; } 120 } 121 122 // see com.sun.star.connection.XAcceptor#stopAccepting stopAccepting()123 public void stopAccepting() { 124 } 125 126 private static final boolean DEBUG = false; 127 } 128