incubator-kalumet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1212103 [1/3] - in /incubator/kalumet/trunk: agent/src/main/java/org/apache/kalumet/agent/updater/ common/src/main/java/org/apache/kalumet/ common/src/main/java/org/apache/kalumet/model/ common/src/test/java/org/apache/kalumet/ console/src...
Date Thu, 08 Dec 2011 20:39:00 GMT
Author: jbonofre
Date: Thu Dec  8 20:38:58 2011
New Revision: 1212103

URL: http://svn.apache.org/viewvc?rev=1212103&view=rev
Log:
Use file manipulator prototype in place of singleton.
Update the console with the JBoss 6 support.

Modified:
    incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ArchiveUpdater.java
    incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ConfigurationFileUpdater.java
    incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/J2EEApplicationServerUpdater.java
    incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SoftwareUpdater.java
    incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SqlScriptUpdater.java
    incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/FileManipulator.java
    incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Kalumet.java
    incubator/kalumet/trunk/common/src/test/java/org/apache/kalumet/FileManipulatorTest.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationGeneralPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationServerGeneralPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationServerWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationServersPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/ApplicationsPane.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/HomePageWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/PublishReleaseWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwareWindow.java
    incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/SoftwaresPane.java
    incubator/kalumet/trunk/console/src/main/resources/org/apache/kalumet/console/app/locales/Messages.properties
    incubator/kalumet/trunk/controller/jboss/src/main/java/org/apache/kalumet/controller/jboss/JBoss4Controller.java
    incubator/kalumet/trunk/controller/jboss/src/main/java/org/apache/kalumet/controller/jboss/JBoss6Controller.java
    incubator/kalumet/trunk/utils/src/main/java/org/apache/kalumet/utils/FileUtils.java

Modified: incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ArchiveUpdater.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ArchiveUpdater.java?rev=1212103&r1=1212102&r2=1212103&view=diff
==============================================================================
--- incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ArchiveUpdater.java
(original)
+++ incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ArchiveUpdater.java
Thu Dec  8 20:38:58 2011
@@ -183,10 +183,14 @@ public class ArchiveUpdater {
         FileManipulator fileManipulator = null;
         try {
             applicationCacheDir = FileManipulator.createJ2EEApplicationCacheDir(environment,
application);
-            fileManipulator = FileManipulator.getInstance();
+            fileManipulator = new FileManipulator();
         } catch (FileManipulatorException e) {
             LOGGER.error("Can't create J2EE application {} cache directory", application.getName(),
e);
             throw new UpdateException("Can't create J2EE application " + application.getName()
+ " cache directory", e);
+        } finally {
+            if (fileManipulator != null) {
+                fileManipulator.close();
+            }
         }
         // define the archive cache location
         String archiveCache = applicationCacheDir + "/" + archive.getName();
@@ -328,41 +332,48 @@ public class ArchiveUpdater {
             return client.check(environmentName, serverName, applicationName, archiveName);
         }
 
-        // initialize file manipulator
-        LOGGER.debug("Initializing file manipulator");
-        FileManipulator fileManipulator = FileManipulator.getInstance();
 
         // get J2EE application server controller
         LOGGER.debug("Getting J2EE application server controller");
         J2EEApplicationServerController controller = J2EEApplicationServerControllerFactory.getController(environment,
applicationServer);
 
-        // get application cache directory
-        LOGGER.debug("Getting application cache directory");
-        String applicationCacheDirectory = FileManipulator.createJ2EEApplicationCacheDir(environment,
application);
 
-        // construct the archive URI
-        String archiveUri = VariableUtils.replace(archive.getUri(), environment.getVariables());
-        if (!FileManipulator.protocolExists(archiveUri)) {
-            // the archive URI is relative (doesn't contain the protocol prefix), construct
the URI using the application URI
-            archiveUri = VariableUtils.replace(application.getUri(), environment.getVariables())
+ "!/" + archiveUri;
-        }
+        FileManipulator fileManipulator = null;
+        try {
+            fileManipulator = new FileManipulator();
 
-        // get the archive cache
-        String archiveCache = applicationCacheDirectory + "/" + archive.getName();
+            // get application cache directory
+            LOGGER.debug("Getting application cache directory");
+            String applicationCacheDirectory = FileManipulator.createJ2EEApplicationCacheDir(environment,
application);
+
+            // construct the archive URI
+            String archiveUri = VariableUtils.replace(archive.getUri(), environment.getVariables());
+            if (!FileManipulator.protocolExists(archiveUri)) {
+                // the archive URI is relative (doesn't contain the protocol prefix), construct
the URI using the application URI
+                archiveUri = VariableUtils.replace(application.getUri(), environment.getVariables())
+ "!/" + archiveUri;
+            }
 
-        // get the archive installation path
-        if (archive.getPath() == null || archive.getPath().trim().length() < 1) {
-            LOGGER.error("Archive {} path is not defined", archive.getName());
-            throw new KalumetException("Archive " + archive.getName() + " path is not defined");
-        }
-        String archiveInstallation = VariableUtils.replace(archive.getPath(), environment.getVariables());
+            // get the archive cache
+            String archiveCache = applicationCacheDirectory + "/" + archive.getName();
+
+            // get the archive installation path
+            if (archive.getPath() == null || archive.getPath().trim().length() < 1) {
+                LOGGER.error("Archive {} path is not defined", archive.getName());
+                throw new KalumetException("Archive " + archive.getName() + " path is not
defined");
+            }
+            String archiveInstallation = VariableUtils.replace(archive.getPath(), environment.getVariables());
 
-        if (controller.isJ2EEApplicationDeployed(archiveInstallation, archive.getName()))
{
-            // check if the archive is deployed or not
-            if (fileManipulator.checksumEquals(archiveUri, archiveCache)) {
-                // archive URI and cache are the same
-                LOGGER.debug("Archive URI and agent cache are the same");
-                return true;
+            if (controller.isJ2EEApplicationDeployed(archiveInstallation, archive.getName()))
{
+                // check if the archive is deployed or not
+                if (fileManipulator.checksumEquals(archiveUri, archiveCache)) {
+                    // archive URI and cache are the same
+                    LOGGER.debug("Archive URI and agent cache are the same");
+                    return true;
+                }
+            }
+        } finally {
+            if (fileManipulator != null) {
+                fileManipulator.close();
             }
         }
 

Modified: incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ConfigurationFileUpdater.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ConfigurationFileUpdater.java?rev=1212103&r1=1212102&r2=1212103&view=diff
==============================================================================
--- incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ConfigurationFileUpdater.java
(original)
+++ incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/ConfigurationFileUpdater.java
Thu Dec  8 20:38:58 2011
@@ -98,7 +98,7 @@ public class ConfigurationFileUpdater {
         FileManipulator fileManipulator = null;
         try {
             LOGGER.debug("Initializing file manipulator");
-            fileManipulator = FileManipulator.getInstance();
+            fileManipulator = new FileManipulator();
         } catch (FileManipulatorException fileManipulatorException) {
             LOGGER.error("Can't initialize file manipulator", fileManipulatorException);
             throw new UpdateException("Can't initialize file manipulator", fileManipulatorException);
@@ -291,7 +291,7 @@ public class ConfigurationFileUpdater {
 
         // initialize the file manipulator.
         LOGGER.debug("Initializing file manipulator");
-        FileManipulator fileManipulator = FileManipulator.getInstance();
+        FileManipulator fileManipulator = new FileManipulator();
 
         // constructs the configuration file URI.
         String configurationFileUri = VariableUtils.replace(configurationFile.getUri(), environment.getVariables());

Modified: incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/J2EEApplicationServerUpdater.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/J2EEApplicationServerUpdater.java?rev=1212103&r1=1212102&r2=1212103&view=diff
==============================================================================
--- incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/J2EEApplicationServerUpdater.java
(original)
+++ incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/J2EEApplicationServerUpdater.java
Thu Dec  8 20:38:58 2011
@@ -534,7 +534,7 @@ public class J2EEApplicationServerUpdate
             updateLog.addUpdateMessage(new UpdateMessage("info", "J2EE application server
" + server.getName() + " caches cleaning is required"));
             EventUtils.post(environment, "UPDATE", "J2EE application server " + server.getName()
+ " caches cleaning is required");
             // initializes the file manipulator instance
-            FileManipulator fileManipulator = FileManipulator.getInstance();
+            FileManipulator fileManipulator = new FileManipulator();
             for (Iterator cacheIterator = server.getCaches().iterator(); cacheIterator.hasNext();
) {
                 Cache cache = (Cache) cacheIterator.next();
                 String path = VariableUtils.replace(cache.getPath(), environment.getVariables());

Modified: incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SoftwareUpdater.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SoftwareUpdater.java?rev=1212103&r1=1212102&r2=1212103&view=diff
==============================================================================
--- incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SoftwareUpdater.java
(original)
+++ incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SoftwareUpdater.java
Thu Dec  8 20:38:58 2011
@@ -483,7 +483,7 @@ public class SoftwareUpdater {
         // get a file manipulator
         FileManipulator fileManipulator = null;
         try {
-            fileManipulator = FileManipulator.getInstance();
+            fileManipulator = new FileManipulator();
         } catch (FileManipulatorException fileManipulatorException) {
             LOGGER.error("Can't initialize file manipulator", fileManipulatorException);
             throw new UpdateException("Can't initialize file manipulator", fileManipulatorException);
@@ -638,7 +638,7 @@ public class SoftwareUpdater {
         LOGGER.debug("Initializing file manipulator");
         FileManipulator fileManipulator = null;
         try {
-            fileManipulator = FileManipulator.getInstance();
+            fileManipulator = new FileManipulator();
         } catch (FileManipulatorException fileManipulatorException) {
             LOGGER.error("Can't initialize file manipulator", fileManipulatorException);
             throw new UpdateException("Can't initialize file manipulator", fileManipulatorException);
@@ -863,7 +863,7 @@ public class SoftwareUpdater {
         LOGGER.debug("Initializing file manipulator");
         FileManipulator fileManipulator = null;
         try {
-            fileManipulator = FileManipulator.getInstance();
+            fileManipulator = new FileManipulator();
         } catch (FileManipulatorException fileManipulatorException) {
             LOGGER.error("Can't initialize file manipulator", fileManipulatorException);
             throw new UpdateException("Can't initialize file manipulator", fileManipulatorException);

Modified: incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SqlScriptUpdater.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SqlScriptUpdater.java?rev=1212103&r1=1212102&r2=1212103&view=diff
==============================================================================
--- incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SqlScriptUpdater.java
(original)
+++ incubator/kalumet/trunk/agent/src/main/java/org/apache/kalumet/agent/updater/SqlScriptUpdater.java
Thu Dec  8 20:38:58 2011
@@ -87,7 +87,7 @@ public class SqlScriptUpdater {
         // get file manipulator instance
         FileManipulator fileManipulator = null;
         try {
-            fileManipulator = FileManipulator.getInstance();
+            fileManipulator = new FileManipulator();
         } catch (FileManipulatorException fileManipulatorException) {
             LOGGER.error("Can't initialize the file manipulator", fileManipulatorException);
             throw new UpdateException("Can't initialize the file manipulator", fileManipulatorException);

Modified: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/FileManipulator.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/FileManipulator.java?rev=1212103&r1=1212102&r2=1212103&view=diff
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/FileManipulator.java (original)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/FileManipulator.java Thu
Dec  8 20:38:58 2011
@@ -69,7 +69,7 @@ public class FileManipulator {
      *
      * @throws FileManipulatorException in <code>FileManipulator</code> init
failed.
      */
-    private FileManipulator() throws FileManipulatorException {
+    public FileManipulator() throws FileManipulatorException {
         try {
             LOGGER.debug("Creating VFS file system manager ...");
             this.fileSystemManager = VFS.getManager();
@@ -83,22 +83,11 @@ public class FileManipulator {
     }
 
     /**
-     * Get a single instance of the <code>FileManipulator</code>.
-     *
-     * @return the <code>FileManipulator</code> instance.
-     * @throws FileManipulatorException in case of init failure.
+     * Cleanly close the file manipulator.
      */
-    public static FileManipulator getInstance() throws FileManipulatorException {
-        try {
-            if (_singleton == null) {
-                _singleton = new FileManipulator();
-                LOGGER.debug("File manipulator initialized");
-            }
-            return _singleton;
-        } catch (Exception e) {
-            LOGGER.error("File manipulator initialization failure", e);
-            throw new FileManipulatorException("File manipulator initialization failure",
e);
-        }
+    public void close() {
+        // nothing to do
+        // just a hook in case of custom VFS filesystem implementation
     }
 
     /**
@@ -455,8 +444,9 @@ public class FileManipulator {
      */
     public static String createEnvironmentCacheDir(Environment environment) throws FileManipulatorException
{
         String directory = FileManipulator.getBaseDir() + "/" + FileManipulator.WORKING_DIR
+ "/" + environment.getName();
-        FileManipulator fileManipulator = FileManipulator.getInstance();
+        FileManipulator fileManipulator = new FileManipulator();
         fileManipulator.createDirectory(directory);
+        fileManipulator.close();
         return directory;
     }
 
@@ -471,8 +461,9 @@ public class FileManipulator {
     public static String createJ2EEApplicationCacheDir(Environment environment, J2EEApplication
j2EEApplication) throws FileManipulatorException {
         String directory = FileManipulator.createEnvironmentCacheDir(environment);
         directory = directory + "/applications/" + j2EEApplication.getName();
-        FileManipulator fileManipulator = FileManipulator.getInstance();
+        FileManipulator fileManipulator = new FileManipulator();
         fileManipulator.createDirectory(directory);
+        fileManipulator.close();
         return directory;
     }
 
@@ -487,8 +478,9 @@ public class FileManipulator {
     public static String createSoftwareCacheDir(Environment environment, Software software)
throws FileManipulatorException {
         String directory = FileManipulator.createEnvironmentCacheDir(environment);
         directory = directory + "/softwares/" + software.getName();
-        FileManipulator fileManipulator = FileManipulator.getInstance();
+        FileManipulator fileManipulator = new FileManipulator();
         fileManipulator.createDirectory(directory);
+        fileManipulator.close();
         return directory;
     }
 



Mime
View raw message