org.osgi.service.io.ConnectionFactory Maven / Gradle / Ivy
/*
* Copyright (c) OSGi Alliance (2002, 2008). 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 java.io.IOException;
import javax.microedition.io.Connection;
/**
* 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: 7337 $
*/
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;
}