river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtra...@apache.org
Subject svn commit: r1213903 - /river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java
Date Tue, 13 Dec 2011 20:06:35 GMT
Author: gtrasuk
Date: Tue Dec 13 20:06:34 2011
New Revision: 1213903

URL: http://svn.apache.org/viewvc?rev=1213903&view=rev
Log:
Slight refactoring of StarterServiceDeployer for readability.

Modified:
    river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java

Modified: river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java?rev=1213903&r1=1213902&r2=1213903&view=diff
==============================================================================
--- river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java
(original)
+++ river/jtsk/skunk/surrogate/src/org/apache/river/container/StarterServiceDeployer.java
Tue Dec 13 20:06:34 2011
@@ -102,11 +102,27 @@ public class StarterServiceDeployer {
     }
 
     public VirtualFileSystemClassLoader createServiceClassloader(FileObject serviceRoot,
CodeSource codeSource) throws IOException, FileSystemException {
-        /* Create the service classloader. */
+
         VirtualFileSystemClassLoader cl =
-                new VirtualFileSystemClassLoader(null, systemClassLoader, codeSource);
+                createChildOfSystemClassloader(codeSource);
         /* Include platform jars from the container's lib directory. */
         String platformJarSpec = configProperties.getProperty(Strings.PLATFORM_JARS);
+        addPlatformJarsToClassloader( platformJarSpec, cl);
+        addLibDirectoryJarsToClasspath(serviceRoot, cl);
+        return cl;
+    }
+
+    protected void addLibDirectoryJarsToClasspath(FileObject serviceRoot, VirtualFileSystemClassLoader
cl) throws FileSystemException {
+        /* Add the jar files from the service's 'lib' directory. */
+        FileObject libDir = serviceRoot.resolveFile(Strings.LIB);
+        List<FileObject> jarFiles = Utils.findChildrenWithSuffix(libDir,
+                Strings.DOT_JAR);
+        for (FileObject jarFile : jarFiles) {
+            cl.addClassPathEntry(libDir, jarFile.getName().getBaseName());
+        }
+    }
+
+    protected void addPlatformJarsToClassloader(String platformJarSpec, VirtualFileSystemClassLoader
cl) throws IOException, LocalizedRuntimeException {
         if (platformJarSpec==null) {
             throw new LocalizedRuntimeException(MessageNames.BUNDLE_NAME,
                     MessageNames.MISSING_PROPERTY_ENTRY,
@@ -116,13 +132,12 @@ public class StarterServiceDeployer {
         }
         log.log(Level.FINE, MessageNames.ADDING_CLASSPATH_ENTRY, new Object[]{platformJarSpec});
         cl.addClassPathEntry(fileUtility.getLibDirectory(), platformJarSpec);
-        /* Add the jar files from the service's 'lib' directory. */
-        FileObject libDir = serviceRoot.resolveFile(Strings.LIB);
-        List<FileObject> jarFiles = Utils.findChildrenWithSuffix(libDir,
-                Strings.DOT_JAR);
-        for (FileObject jarFile : jarFiles) {
-            cl.addClassPathEntry(libDir, jarFile.getName().getBaseName());
-        }
+    }
+
+    protected VirtualFileSystemClassLoader createChildOfSystemClassloader(CodeSource codeSource)
{
+        /* Create the service classloader. */
+        VirtualFileSystemClassLoader cl =
+                new VirtualFileSystemClassLoader(null, systemClassLoader, codeSource);
         return cl;
     }
 
@@ -214,6 +229,7 @@ public class StarterServiceDeployer {
                     new Object[]{deploymentDirectory, fileUtility.getProfileDirectory()});
         }
         /* Read the maximal policy file if there is one. */
+        readMaximalPolicy();
         /* Go through the deployment directory looking for services to deploy.
          */
         List<FileObject> serviceArchives =
@@ -229,12 +245,7 @@ public class StarterServiceDeployer {
 
         }
 
-        /* TODO: Establish the interval task to monitor the deployment directory
-        for deployment candidate changes.
-         */
-        /* TODO: Establish the interval task to monitor the deployment directory
-        for deployment candidate changes.
-         */
+        establishLiveDeploymentMonitoring();
         log.log(Level.INFO, MessageNames.STARTER_SERVICE_DEPLOYER_INITIALIZED, myName);
 
     }
@@ -332,4 +343,11 @@ public class StarterServiceDeployer {
         constructor.setAccessible(true);
         return constructor.newInstance(parms, null );
     }
+    
+    private void establishLiveDeploymentMonitoring() {
+        // TODO: Write this
+    }
+    private void readMaximalPolicy() {
+        // TODO: Write this.
+    }
 }



Mime
View raw message