You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/01/09 00:17:55 UTC

svn commit: r494243 - /incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java

Author: meerajk
Date: Mon Jan  8 15:17:54 2007
New Revision: 494243

URL: http://svn.apache.org/viewvc?view=rev&rev=494243
Log:
Move management service from spi to host-api.

Modified:
    incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java

Modified: incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java?view=diff&rev=494243&r1=494242&r2=494243
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/server.start/src/main/java/org/apache/tuscany/standalone/server/TuscanyServer.java Mon Jan  8 15:17:54 2007
@@ -24,15 +24,18 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Map;
+import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
 import javax.management.MBeanServer;
 
+import org.apache.tuscany.host.management.ManagementService;
 import org.apache.tuscany.host.runtime.InitializationException;
 import org.apache.tuscany.host.runtime.ShutdownException;
 import org.apache.tuscany.host.runtime.TuscanyRuntime;
 import org.apache.tuscany.runtime.standalone.DirectoryHelper;
 import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
-import org.apache.tuscany.runtime.standalone.jmx.info.JmxRuntimeInfoImpl;
+import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfoImpl;
+import org.apache.tuscany.runtime.standalone.jmx.management.JmxManagementService;
 import org.apache.tuscany.standalone.server.management.jmx.Agent;
 import org.apache.tuscany.standalone.server.management.jmx.RmiAgent;
 
@@ -111,9 +114,10 @@
             final File bootDirectory = DirectoryHelper.getBootDirectory(installDirectory, profileDirectory, null);
 
             final MBeanServer mBeanServer = agent.getMBeanServer();            
-            final StandaloneRuntimeInfo runtimeInfo = JmxRuntimeInfoImpl.newInstance(profileName, installDirectory, mBeanServer);
-
+            final StandaloneRuntimeInfo runtimeInfo = createRuntimeInfo(profileName);
+            final ManagementService<?> managementService = new JmxManagementService(mBeanServer, profileName);
             final TuscanyRuntime runtime = createRuntime(bootDirectory, runtimeInfo);
+            runtime.setManagementService(managementService);
             runtime.initialize();
 
             bootedRuntimes.put(profileName, runtime);
@@ -169,6 +173,31 @@
     }
 
     /**
+     * TODO Share this code with launcher.
+     * 
+     * Creates the runtime info.
+     * 
+     * @param profile profile for which runtime info is created.
+     * @return Runtime info.
+     * @throws IOException If unable to read the runtime properties.
+     */
+    private StandaloneRuntimeInfo createRuntimeInfo(String profile) throws IOException {
+        
+        File profileDir = DirectoryHelper.getProfileDirectory(installDirectory, profile);
+
+        // load properties for this runtime
+        File propFile = new File(profileDir, "etc/runtime.properties");
+        Properties props = DirectoryHelper.loadProperties(propFile, System.getProperties());
+
+        // online unless the offline property is set
+        boolean online = !Boolean.parseBoolean(props.getProperty("offline", "false"));
+
+        return new StandaloneRuntimeInfoImpl(profile, installDirectory, profileDir, null, online, props);
+    }
+
+    /**
+     * TODO Share this code with launcher.
+     * 
      * Creates the runtime.
      * 
      * @param bootDirectory Boot directory for the runtime.



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org