01: /*
02: * %W% %E%
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package com.sun.jump.isolate.jvmprocess;
28:
29: import com.sun.jump.common.JUMPAppModel;
30: import com.sun.jump.common.JUMPProcess;
31: import com.sun.jump.common.JUMPIsolate;
32: import com.sun.jump.common.JUMPProcessProxy;
33: import com.sun.jump.message.JUMPMessagingService;
34: import java.util.Map;
35: import java.rmi.Remote;
36:
37: /**
38: * <code>JVMIsolateVM</code> encapsulates an isolate that is implemented
39: * using a single JVM Process. There is only a single instance of this
40: * class, so all the methods are static. This class also hosts all the
41: * common infrastucture services (like messaging, locking etc) for both
42: * the system libraries as well as the application running within the
43: * container.
44: */
45: public abstract class JUMPIsolateProcess implements JUMPProcess,
46: JUMPIsolate, JUMPMessagingService {
47:
48: private static JUMPIsolateProcess INSTANCE = null;
49:
50: public synchronized static JUMPIsolateProcess getInstance() {
51: return INSTANCE;
52: }
53:
54: /** Creates a new instance of JUMPIsolateProcess */
55: protected JUMPIsolateProcess() {
56: synchronized (JUMPIsolateProcess.class) {
57: if (INSTANCE == null) {
58: INSTANCE = this ;
59: }
60: }
61: }
62:
63: /**
64: * Returns a module's remote object. The isolate can access
65: * JUMP modules in the executive through the remote object.
66: *
67: * <p>
68: * This method should be used to access implementation interfaces only.
69: * </p>
70: *
71: * @param name name of service to retrieve
72: * @return remote object which implements the remoteInterface.
73: */
74: public abstract Remote getRemoteService(String name);
75:
76: /**
77: * Returns the executive process interface so that the Isolate
78: * can send messages to the executive.
79: */
80: public abstract JUMPProcessProxy getExecutiveProcess();
81:
82: public int getIsolateId() {
83: return this .getProcessId();
84: }
85:
86: /**
87: * Returns configuration parameters associated with the isolate.
88: */
89: public abstract Map getConfig();
90:
91: /**
92: * Get app model running in this isolate process
93: */
94: public abstract JUMPAppModel getAppModel();
95:
96: public void initialize(JUMPAppModel appModel) {
97: }
98: }
|