KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > jonathan > TcpIpProtocol


1 /***
2  * Fractal RMI: a binder for remote method calls between Fractal components.
3  * Copyright (C) 2003 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: Eric.Bruneton@rd.francetelecom.com
20  *
21  * Author: Eric Bruneton
22  */

23
24 package org.objectweb.fractal.jonathan;
25
26 import org.objectweb.fractal.api.control.BindingController;
27
28 import org.objectweb.jonathan.apis.kernel.ContextFactory;
29 import org.objectweb.jonathan.apis.presentation.MarshallerFactory;
30 import org.objectweb.jonathan.apis.protocols.ip.TcpIpConnectionMgr;
31 import org.objectweb.jonathan.apis.resources.ChunkFactory;
32 import org.objectweb.jonathan.apis.resources.Scheduler;
33
34 /**
35  * A Fractal compliant {@link
36  * org.objectweb.jonathan.libs.protocols.tcpip.TcpIpProtocol} subclass.
37  */

38
39 public class TcpIpProtocol
40   extends org.objectweb.jonathan.libs.protocols.tcpip.TcpIpProtocol
41   implements BindingController
42 {
43
44   public TcpIpProtocol () {
45     super(null, null, null, null, null);
46   }
47
48   public String JavaDoc[] listFc () {
49     return new String JavaDoc[] {
50       "connection-factory",
51       "marshaller-factory",
52       "chunk-factory",
53       "scheduler",
54       "context-factory"
55     };
56   }
57
58   public Object JavaDoc lookupFc (final String JavaDoc clientItfName) {
59     if (clientItfName.equals("connection-factory")) {
60       return connection_mgr;
61     } else if (clientItfName.equals("marshaller-factory")) {
62       return marshaller_factory;
63     } else if (clientItfName.equals("chunk-factory")) {
64       return chunk_factory;
65     } else if (clientItfName.equals("scheduler")) {
66       return scheduler;
67     } else if (clientItfName.equals("context-factory")) {
68       return context_factory;
69     }
70     return null;
71   }
72
73   public void bindFc (final String JavaDoc clientItfName, final Object JavaDoc serverItf) {
74     if (clientItfName.equals("connection-factory")) {
75       connection_mgr = (TcpIpConnectionMgr)serverItf;
76     } else if (clientItfName.equals("marshaller-factory")) {
77       marshaller_factory = (MarshallerFactory)serverItf;
78     } else if (clientItfName.equals("chunk-factory")) {
79       chunk_factory = (ChunkFactory)serverItf;
80     } else if (clientItfName.equals("scheduler")) {
81       scheduler = (Scheduler)serverItf;
82     } else if (clientItfName.equals("context-factory")) {
83       context_factory = (ContextFactory)serverItf;
84     }
85   }
86
87   public void unbindFc (final String JavaDoc clientItfName) {
88     if (clientItfName.equals("connection-factory")) {
89       connection_mgr = null;
90     } else if (clientItfName.equals("marshaller-factory")) {
91       marshaller_factory = null;
92     } else if (clientItfName.equals("chunk-factory")) {
93       chunk_factory = null;
94     } else if (clientItfName.equals("scheduler")) {
95       scheduler = null;
96     } else if (clientItfName.equals("context-factory")) {
97       context_factory = null;
98     }
99   }
100 }
101
Popular Tags