CVS: jcontainer/loom/engine/src/java/org/jcontainer/loom/components/monitor DefaultDeploymentMonitor.java,1.13,1.14

Peter Donald <pdonald-yCVjj/[email protected]>
Newsgroups gmane.comp.java.jcontainer.cvs
Message-ID <[email protected]>
Update of /cvsroot/jcontainer/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/monitor
In directory hogshead.codehaus.org:/tmp/cvs-serv25270/engine/src/java/org/jcontainer/loom/components/monitor

Modified Files:
	DefaultDeploymentMonitor.java 
Log Message:
Move all deployment management into DefaultDeploymentMonitor


Index: DefaultDeploymentMonitor.java
===================================================================
RCS file: /cvsroot/jcontainer/jcontainer/loom/engine/src/java/org/jcontainer/loom/components/monitor/DefaultDeploymentMonitor.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- DefaultDeploymentMonitor.java	29 Oct 2003 22:20:42 -0000	1.13
+++ DefaultDeploymentMonitor.java	29 Oct 2003 22:46:17 -0000	1.14
@@ -89,6 +89,7 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.File;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -102,6 +103,7 @@
 import org.jcontainer.dna.ConfigurationException;
 import org.jcontainer.dna.MissingResourceException;
 import org.jcontainer.dna.ResourceLocator;
+import org.jcontainer.loom.components.util.ExtensionFileFilter;
 import org.jcontainer.loom.interfaces.Deployer;
 import org.realityforge.salt.i18n.ResourceManager;
 import org.realityforge.salt.i18n.Resources;
@@ -151,6 +153,7 @@
     public void initialize()
         throws Exception
     {
+        deployDefaultApplications();
         final DirectoryResource resource =
             new DirectoryResource( m_appsDir.getPath() );
         resource.addPropertyChangeListener( this );
@@ -320,5 +323,33 @@
         return
             !file.isDirectory() &&
             file.getName().endsWith( ".sar" );
+    }
+
+    /**
+     * The deployer is used to load the applications from the
+     * default-apps-location specified in Parameters.
+     *
+     * @throws Exception if an error occurs
+     */
+    protected void deployDefaultApplications()
+        throws Exception
+    {
+        final ExtensionFileFilter filter = new ExtensionFileFilter( ".sar" );
+        final File[] files = m_appsDir.listFiles( filter );
+        if( null != files )
+        {
+            deployFiles( files );
+        }
+    }
+
+    private void deployFiles( final File[] files )
+        throws Exception
+    {
+        Arrays.sort( files );
+        for( int i = 0; i < files.length; i++ )
+        {
+            final File file = files[ i ];
+            deployApplication( file );
+        }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.