KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > body > ibis > ProActiveIbisMetaObjectFactory


1 /*
2 * ################################################################
3 *
4 * ProActive: The Java(TM) library for Parallel, Distributed,
5 * Concurrent computing with Security and Mobility
6 *
7 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8 * Contact: proactive-support@inria.fr
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * Initial developer(s): The ProActive Team
26 * http://www.inria.fr/oasis/ProActive/contacts.html
27 * Contributor(s):
28 *
29 * ################################################################
30 */

31 package org.objectweb.proactive.core.body.ibis;
32
33 import org.objectweb.proactive.core.ProActiveException;
34 import org.objectweb.proactive.core.ProActiveRuntimeException;
35 import org.objectweb.proactive.core.body.ProActiveMetaObjectFactory;
36 import org.objectweb.proactive.core.body.RemoteBodyFactory;
37 import org.objectweb.proactive.core.body.UniversalBody;
38
39
40 /**
41  * <p>
42  * This class provides singleton instances of all default factories
43  * creating MetaObjects used in the Body.
44  * </p>
45  * <p>
46  * One can inherit from this class in order to provide custom implementation
47  * of one or several factories. This class provide a default implementation that
48  * makes the factories a singleton. One instance of each mata object factory is
49  * created when this object is built and the same instance is returned each time
50  * somebody ask for an instance.
51  * </p>
52  * <p>
53  * In order to change one meta object factory following that singleton pattern,
54  * only the protected method <code>newXXXSingleton</code> has to be overwritten.
55  * The method <code>newXXXSingleton</code> is guarantee to be called only once at
56  * construction time of this object.
57  * </p>
58  * <p>
59  * In order to change one meta object factory that does not follow the singleton
60  * pattern, the public method <code>newXXX</code> has to be overwritten in order
61  * to return a new instance of the factory each time. The default implementation
62  * of each <code>newXXX</code> method if to return the singleton instance of the
63  * factory created from <code>newXXXSingleton</code> method call.
64  * </p>
65  * <p>
66  * Each sub class of this class should be implemented as a singleton and provide
67  * a static method <code>newInstance</code> for this purpose.
68  * </p>
69  *
70  * @author ProActive Team
71  * @version 1.0, 2002/05
72  * @since ProActive 0.9.2
73  */

74 public class ProActiveIbisMetaObjectFactory extends ProActiveMetaObjectFactory implements java.io.Serializable JavaDoc {
75
76
77 //static {
78
//IbisProperties.load();
79
//}
80
//
81
// -- PRIVATE MEMBERS -----------------------------------------------
82
//
83

84  
85   //
86
// -- PROTECTED MEMBERS -----------------------------------------------
87
//
88

89
90   //
91
// -- CONSTRUCTORS -----------------------------------------------
92
//
93

94
95
96   //
97
// -- PUBLICS METHODS -----------------------------------------------
98
//
99

100
101
102
103   //
104
// -- PROTECTED METHODS -----------------------------------------------
105
//
106

107
108   
109
110   protected RemoteBodyFactory newRemoteBodyFactorySingleton() {
111     return new RemoteIbisBodyFactoryImpl();
112   }
113
114
115
116
117   //
118
// -- INNER CLASSES -----------------------------------------------
119
//
120

121
122
123
124   protected static class RemoteIbisBodyFactoryImpl implements RemoteBodyFactory, java.io.Serializable JavaDoc {
125     public UniversalBody newRemoteBody(UniversalBody body) {
126       try {
127      // System.out.println("Creating ibis remote body adapter");
128
return new IbisRemoteBodyAdapter(body);
129       } catch (ProActiveException e) {
130           throw new ProActiveRuntimeException("Cannot create Ibis Remote body adapter ", e);
131       }
132     }
133   } // end inner class RemoteBodyFactoryImpl
134

135
136
137 }
138
Popular Tags