KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ext > locationserver > LocationServerMetaObjectFactory


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.ext.locationserver;
32
33 import org.objectweb.proactive.core.body.MetaObjectFactory;
34 import org.objectweb.proactive.core.body.UniversalBody;
35 import org.objectweb.proactive.core.body.migration.MigrationManager;
36 import org.objectweb.proactive.core.body.migration.MigrationManagerFactory;
37 import org.objectweb.proactive.core.body.request.Request;
38 import org.objectweb.proactive.core.body.request.RequestFactory;
39 import org.objectweb.proactive.core.body.rmi.ProActiveRmiMetaObjectFactory;
40 //import org.objectweb.proactive.core.body.ProActiveMetaObjectFactory;
41
import org.objectweb.proactive.core.mop.MethodCall;
42
43
44 /**
45  * <p>
46  * This class overrides the default Factory to provide Request and MigrationManager
47  * with location server.
48  * </p>
49  *
50  * @author ProActive Team
51  * @version 1.0, 2002/05
52  * @since ProActive 0.9.2
53  */

54 public class LocationServerMetaObjectFactory
55     extends ProActiveRmiMetaObjectFactory {
56     //
57
// -- PRIVATE MEMBERS -----------------------------------------------
58
//
59
private static MetaObjectFactory instance = null;
60
61     //
62
// -- CONSTRUCTORS -----------------------------------------------
63
//
64

65     /**
66  * Constructor for LocationServerMetaObjectFactory.
67  */

68     protected LocationServerMetaObjectFactory() {
69         super();
70     }
71
72     //
73
// -- PUBLICS METHODS -----------------------------------------------
74
//
75
public static synchronized MetaObjectFactory newInstance() {
76         if (instance == null) {
77             instance = new LocationServerMetaObjectFactory();
78         }
79         return instance;
80     }
81
82     //
83
// -- PROTECTED METHODS -----------------------------------------------
84
//
85
protected RequestFactory newRequestFactorySingleton() {
86         return new RequestWithLocationServerFactory();
87     }
88
89     protected MigrationManagerFactory newMigrationManagerFactorySingleton() {
90         return new MigrationManagerFactoryImpl();
91     }
92
93     //
94
// -- INNER CLASSES -----------------------------------------------
95
//
96
protected class RequestWithLocationServerFactory implements RequestFactory,
97         java.io.Serializable JavaDoc {
98         transient private LocationServer server = LocationServerFactory.getLocationServer();
99
100         public Request newRequest(MethodCall methodCall,
101             UniversalBody sourceBody, boolean isOneWay, long sequenceID) {
102             return new RequestWithLocationServer(methodCall, sourceBody,
103                 isOneWay, sequenceID, server);
104         }
105     }
106
107     protected static class MigrationManagerFactoryImpl
108         implements MigrationManagerFactory, java.io.Serializable JavaDoc {
109         public MigrationManager newMigrationManager() {
110             return new MigrationManagerWithLocationServer(LocationServerFactory.getLocationServer());
111         }
112     }
113 }
114
Popular Tags