KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > io > ConnectionFactory


1 /*
2  * $Header: /cvshome/build/org.osgi.service.io/src/org/osgi/service/io/ConnectionFactory.java,v 1.9 2006/07/12 21:22:12 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.osgi.service.io;
19
20 import java.io.IOException JavaDoc;
21
22 import javax.microedition.io.Connection;
23
24 /**
25  * A Connection Factory service is called by the implementation of the Connector
26  * Service to create <code>javax.microedition.io.Connection</code> objects which
27  * implement the scheme named by <code>IO_SCHEME</code>.
28  *
29  * When a <code>ConnectorService.open</code> method is called, the implementation
30  * of the Connector Service will examine the specified name for a scheme. The
31  * Connector Service will then look for a Connection Factory service which is
32  * registered with the service property <code>IO_SCHEME</code> which matches the
33  * scheme. The {@link #createConnection} method of the selected Connection
34  * Factory will then be called to create the actual <code>Connection</code>
35  * object.
36  *
37  * @version $Revision: 1.9 $
38  */

39 public interface ConnectionFactory {
40     /**
41      * Service property containing the scheme(s) for which this Connection
42      * Factory can create <code>Connection</code> objects. This property is of
43      * type <code>String[]</code>.
44      */

45     public static final String JavaDoc IO_SCHEME = "io.scheme";
46
47     /**
48      * Create a new <code>Connection</code> object for the specified URI.
49      *
50      * @param name The full URI passed to the <code>ConnectorService.open</code>
51      * method
52      * @param mode The mode parameter passed to the
53      * <code>ConnectorService.open</code> method
54      * @param timeouts The timeouts parameter passed to the
55      * <code>ConnectorService.open</code> method
56      * @return A new <code>javax.microedition.io.Connection</code> object.
57      * @throws IOException If a <code>javax.microedition.io.Connection</code>
58      * object can not not be created.
59      */

60     public Connection createConnection(String JavaDoc name, int mode, boolean timeouts)
61             throws IOException JavaDoc;
62 }
63
Popular Tags