KickJava   Java API By Example, From Geeks To Geeks.

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


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.jonathan.apis.kernel.Component;
27 import org.objectweb.jonathan.apis.kernel.Context;
28 import org.objectweb.jonathan.apis.kernel.ContextFactory;
29 import org.objectweb.jonathan.apis.kernel.Element;
30 import org.objectweb.jonathan.apis.kernel.JonathanException;
31 import org.objectweb.jonathan.apis.kernel.Name;
32
33 import java.util.Enumeration JavaDoc;
34 import java.util.HashMap JavaDoc;
35
36 /**
37  * A minimal and Fractal compliant {@link ContextFactory} implementation.
38  */

39
40 public class JContextFactory implements ContextFactory {
41
42   public Context newContext () {
43     return new JContext();
44   }
45
46   public Context newContext (Context context) {
47     return new JContext();
48   }
49
50   /**
51    * A minimal implementation of the {@link Context} interface.
52    */

53
54   static class JContext extends HashMap JavaDoc implements Context {
55
56     public void acquire () {
57     }
58
59     public Element addElement (Name name, Class JavaDoc aClass, int i) {
60       throw new RuntimeException JavaDoc("Not implemented");
61     }
62
63     public Element addElement (Name name, Class JavaDoc aClass, Object JavaDoc o) {
64       throw new RuntimeException JavaDoc("Not implemented");
65     }
66
67     public Element addElement (Name name, Component component) {
68       throw new RuntimeException JavaDoc("Not implemented");
69     }
70
71     public Element addElement (String JavaDoc s, Class JavaDoc aClass, int i, char c) {
72       put(s, new Integer JavaDoc(i));
73       return null;
74     }
75
76     public Element addElement (String JavaDoc s, Class JavaDoc aClass, Object JavaDoc o, char c) {
77       put(s, o);
78       return null;
79     }
80
81     public Element addElement (String JavaDoc s, Component component, char c) {
82       throw new RuntimeException JavaDoc("Not implemented");
83     }
84
85     public Context addOrGetContext (Name name) {
86       throw new RuntimeException JavaDoc("Not implemented");
87     }
88
89     public Context addOrGetContext (String JavaDoc s, char c) {
90       throw new RuntimeException JavaDoc("Not implemented");
91     }
92
93     public Component fork () {
94       throw new RuntimeException JavaDoc("Not implemented");
95     }
96
97     public Component getComponent (Name name) {
98       throw new RuntimeException JavaDoc("Not implemented");
99     }
100
101     public Component getComponent (String JavaDoc s, char c) {
102       throw new RuntimeException JavaDoc("Not implemented");
103     }
104
105     public Element getElement (Name name) {
106       throw new RuntimeException JavaDoc("Not implemented");
107     }
108
109     public Element getElement (String JavaDoc s, char c) {
110       throw new RuntimeException JavaDoc("Not implemented");
111     }
112
113     public Enumeration JavaDoc getElements () {
114       throw new RuntimeException JavaDoc("Not implemented");
115     }
116
117     public Object JavaDoc getFactoryValue () throws JonathanException {
118       throw new RuntimeException JavaDoc("Not implemented");
119     }
120
121     public int getIntValue () {
122       throw new RuntimeException JavaDoc("Not implemented");
123     }
124
125     public int getIntValue (Name name) {
126       throw new RuntimeException JavaDoc("Not implemented");
127     }
128
129     public int getIntValue (String JavaDoc s, char c) {
130       return ((Integer JavaDoc)get(s)).intValue();
131     }
132
133     public Element getReference () {
134       throw new RuntimeException JavaDoc("Not implemented");
135     }
136
137     public Context getScope () {
138       throw new RuntimeException JavaDoc("Not implemented");
139     }
140
141     public Class JavaDoc getType () {
142       throw new RuntimeException JavaDoc("Not implemented");
143     }
144
145     public Object JavaDoc getValue () {
146       throw new RuntimeException JavaDoc("Not implemented");
147     }
148
149     public Object JavaDoc getValue (Name name) {
150       throw new RuntimeException JavaDoc("Not implemented");
151     }
152
153     public Object JavaDoc getValue (String JavaDoc s, char c) {
154       return get(s);
155     }
156
157     public void release () {
158     }
159
160     public void reset () {
161       throw new RuntimeException JavaDoc("Not implemented");
162     }
163
164     public Element setReference (Element element) {
165       throw new RuntimeException JavaDoc("Not implemented");
166     }
167
168     public Context setScope (Context context) {
169       throw new RuntimeException JavaDoc("Not implemented");
170     }
171   }
172 }
173
Popular Tags