01: /*
02: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License version
07: * 2 only, as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License version 2 for more details (a copy is
13: * included at /legal/license.txt).
14: *
15: * You should have received a copy of the GNU General Public License
16: * version 2 along with this work; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18: * 02110-1301 USA
19: *
20: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21: * Clara, CA 95054 or visit www.sun.com if you need additional
22: * information or have any questions.
23: */
24:
25: package com.sun.jumpimpl.module.lifecycle.remote;
26:
27: import com.sun.jump.executive.JUMPIsolateProxy;
28: import com.sun.jump.executive.JUMPApplicationProxy;
29: import com.sun.jump.module.JUMPModule;
30: import com.sun.jump.common.JUMPAppModel;
31: import com.sun.jump.common.JUMPProcessProxy;
32: import com.sun.jump.common.JUMPApplication;
33:
34: import com.sun.jump.module.lifecycle.JUMPApplicationLifecycleModule;
35: import com.sun.jump.module.lifecycle.remote.JUMPApplicationLifecycleModuleRemote;
36: import com.sun.jump.module.lifecycle.remote.JUMPApplicationProxyRemote;
37:
38: import com.sun.jump.module.serviceregistry.JUMPServiceRegistryModuleFactory;
39: import com.sun.jump.module.serviceregistry.JUMPServiceRegistryModule;
40:
41: import java.rmi.Remote;
42: import java.rmi.RemoteException;
43:
44: /**
45: * <code>JUMPApplicationLifecycleModuleRemote</code> is an remote module
46: * to the <code>JUMPApplicationLifecycleModule</code> module in the executive,
47: * that performs application lifecycle operations.
48: */
49: public class ApplicationLifecycleModuleRemoteImpl implements
50: JUMPApplicationLifecycleModuleRemote {
51:
52: JUMPApplicationLifecycleModule lifecycleModule;
53:
54: public ApplicationLifecycleModuleRemoteImpl(
55: JUMPApplicationLifecycleModule lifecycleModule) {
56:
57: this .lifecycleModule = lifecycleModule;
58:
59: try {
60: JUMPServiceRegistryModule registry = JUMPServiceRegistryModuleFactory
61: .getInstance().getModule();
62:
63: registry.registerService(
64: JUMPApplicationLifecycleModuleRemote.class
65: .getName(), this );
66: } catch (java.rmi.RemoteException e) { // shouldn't happen
67: e.printStackTrace();
68: } catch (java.rmi.AlreadyBoundException e) { //
69: System.err
70: .println(JUMPApplicationLifecycleModuleRemote.class
71: .getName()
72: + " already bound " + e);
73: }
74: }
75:
76: /**
77: * Launch or return a running application for an installed
78: * application, according to the lifecycle policy for this
79: * lifecycle module.
80: */
81: public JUMPApplicationProxyRemote launchApplication(
82: JUMPApplication app, String args[]) throws RemoteException {
83:
84: JUMPApplicationProxy proxy = lifecycleModule.launchApplication(
85: app, args);
86:
87: if (proxy == null) {
88: System.err.println("Launching failed, " + app);
89: return null;
90: }
91:
92: return new ApplicationProxyRemoteImpl(proxy);
93: }
94: }
|