/* * $Header: /cvshome/build/org.osgi.service.io/src/org/osgi/service/io/ConnectionFactory.java,v 1.7 2006/06/16 16:31:36 hargrave Exp $ * * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.osgi.service.io; import javax.microedition.io.*; import java.io.*; /** * A Connection Factory service is called by the implementation of the Connector * Service to create javax.microedition.io.Connection objects which * implement the scheme named by IO_SCHEME. * * When a ConnectorService.open method is called, the implementation * of the Connector Service will examine the specified name for a scheme. The * Connector Service will then look for a Connection Factory service which is * registered with the service property IO_SCHEME which matches the * scheme. The {@link #createConnection}method of the selected Connection * Factory will then be called to create the actual Connection * object. * * @version $Revision: 1.7 $ */ public interface ConnectionFactory { /** * Service property containing the scheme(s) for which this Connection * Factory can create Connection objects. This property is of * type String[]. */ public static final String IO_SCHEME = "io.scheme"; /** * Create a new Connection object for the specified URI. * * @param name The full URI passed to the ConnectorService.open * method * @param mode The mode parameter passed to the * ConnectorService.open method * @param timeouts The timeouts parameter passed to the * ConnectorService.open method * @return A new javax.microedition.io.Connection object. * @throws IOException If a javax.microedition.io.Connection * object can not not be created. */ public Connection createConnection(String name, int mode, boolean timeouts) throws IOException; }