servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r383937 - in /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi: container/ framework/ util/
Date Tue, 07 Mar 2006 17:28:33 GMT
Author: gnodet
Date: Tue Mar  7 09:28:30 2006
New Revision: 383937

URL: http://svn.apache.org/viewcvs?rev=383937&view=rev
Log:
SUs are now deployed in the SA dir (sp that updating a component will not disturb SUs)
Component workspace dir and SAs and components state files are no more versionned (upgrading
will let the component in the same state)

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitLifeCycle.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java?rev=383937&r1=383936&r2=383937&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java
Tue Mar  7 09:28:30 2006
@@ -50,7 +50,7 @@
     private File installationDir;
     private File deploymentDir;
     private File sharedLibDir;
-    private File serviceAssembiliesDirectory;
+    private File serviceAssembliesDirectory;
     private File tmpDir;
     private int statsInterval = 5;
     private Map envMap = new ConcurrentHashMap();
@@ -139,8 +139,8 @@
     /**
      * @return Returns service asseblies directory
      */
-    public File getServiceAssembiliesDirectory(){
-        return serviceAssembiliesDirectory;
+    public File getServiceAssembliesDirectory(){
+        return serviceAssembliesDirectory;
     } 
    
 
@@ -312,8 +312,6 @@
             return null;
         }
         File result = FileUtil.getDirectoryPath(getComponentsDir(), componentName);
-        // get the version directory
-        result = FileVersionUtil.getLatestVersionDirectory(result);
         return result;
     }
 
@@ -329,8 +327,20 @@
             return null;
         }
         File result = FileUtil.getDirectoryPath(getComponentsDir(), componentName);
-        // get the version directory
-        result = FileVersionUtil.createNewVersionDirectory(result);
+        return result;
+    }
+    
+    /**
+     * Get a new versionned directory for installation
+     * 
+     * @param componentName
+     * @return
+     * @throws IOException
+     */
+    public File getNewInstallationDirectory(String componentName) throws IOException {
+        File result = getComponentRootDirectory(componentName);
+        // get new version dir
+        result = FileVersionUtil.getNewVersionDirectory(result);
         return result;
     }
     
@@ -343,7 +353,8 @@
      */
     public File getInstallationDirectory(String componentName) throws IOException {
         File result = getComponentRootDirectory(componentName);
-        result = FileUtil.getDirectoryPath(result, "installation");
+        // get the version directory
+        result = FileVersionUtil.getLatestVersionDirectory(result);
         return result;
     }
     
@@ -368,10 +379,10 @@
      * @throws IOException
      */
     public File getSARootDirectory(String saName) {
-        if (getServiceAssembiliesDirectory() == null) {
+        if (getServiceAssembliesDirectory() == null) {
             return null;
         }
-        File result = FileUtil.getDirectoryPath(getServiceAssembiliesDirectory(), saName);
+        File result = FileUtil.getDirectoryPath(getServiceAssembliesDirectory(), saName);
         // get the version directory
         result = FileVersionUtil.getLatestVersionDirectory(result);
         return result;
@@ -385,10 +396,10 @@
      * @throws IOException
      */
     public File createSARootDirectory(String saName) throws IOException{
-        if(getServiceAssembiliesDirectory()==null){
+        if(getServiceAssembliesDirectory()==null){
             return null;
         }
-        File result=FileUtil.getDirectoryPath(getServiceAssembiliesDirectory(),saName);
+        File result=FileUtil.getDirectoryPath(getServiceAssembliesDirectory(),saName);
         // get the version directory
         result=FileVersionUtil.getNewVersionDirectory(result);
         return result;
@@ -402,7 +413,7 @@
      * @throws IOException
      */
     public boolean removeSARootDirectory(String saName) throws IOException{
-        File result = FileUtil.getDirectoryPath(getServiceAssembiliesDirectory(), saName);
+        File result = FileUtil.getDirectoryPath(getServiceAssembliesDirectory(), saName);
         //get the version directory
         result=FileVersionUtil.getLatestVersionDirectory(result);
         return FileUtil.deleteFile(result);
@@ -416,6 +427,7 @@
      */
     public File getServiceAssemblyStateFile(String saName) {
         File result = getSARootDirectory(saName);
+        result = result.getParentFile();
         FileUtil.buildDirectory(result);
         result = new File(result,"state.xml");
         return result;
@@ -430,7 +442,7 @@
      * @throws IOException
      */
     public File createWorkspaceDirectory(String componentName) throws IOException {
-        File result = getComponentRootDirectory(componentName);
+        File result = FileUtil.getDirectoryPath(getComponentsDir(), componentName);
         result = FileUtil.getDirectoryPath(result, "workspace");
         FileUtil.buildDirectory(result);
         return result;
@@ -440,13 +452,14 @@
      * Create a SU directory for a Component
      * @param componentName
      * @param suName
+     * @param saName
      * @return directory
      * @throws IOException
      */
-    public File getServiceUnitDirectory(String componentName,String suName) {
-        File result = getComponentRootDirectory(componentName);
-        result = FileUtil.getDirectoryPath(result, "serviceunit");
-        result = FileUtil.getDirectoryPath(result,suName);
+    public File getServiceUnitDirectory(String componentName, String suName, String saName)
{
+        File result = getSARootDirectory(saName);
+        result = FileUtil.getDirectoryPath(result, componentName);
+        result = FileUtil.getDirectoryPath(result, suName);
         FileUtil.buildDirectory(result);
         return result;
     }
@@ -455,13 +468,12 @@
      * Remove a SU directory
      * @param componentName
      * @param suName
+     * @param saName
      * @return true if successful
      * @throws IOException
      */
-    public boolean removeServiceUnitDirectory(String componentName,String suName) throws
IOException {
-        File result = FileUtil.getDirectoryPath(getComponentsDir(), componentName);
-        result = FileUtil.getDirectoryPath(result, "serviceunit");
-        result = FileUtil.getDirectoryPath(result,suName);
+    public boolean removeServiceUnitDirectory(String componentName, String suName, String
saName) throws IOException {
+        File result = getServiceUnitDirectory(componentName, suName, saName);
         return FileUtil.deleteFile(result);
     }
 
@@ -554,14 +566,14 @@
             componentsDir = FileUtil.getDirectoryPath(jbiRootDir, "components").getCanonicalFile();
             tmpDir = FileUtil.getDirectoryPath(jbiRootDir, "tmp").getCanonicalFile();
             sharedLibDir = FileUtil.getDirectoryPath(jbiRootDir, "sharedlibs").getCanonicalFile();
-            serviceAssembiliesDirectory = FileUtil.getDirectoryPath(jbiRootDir,"service-assemblies").getCanonicalFile();
+            serviceAssembliesDirectory = FileUtil.getDirectoryPath(jbiRootDir,"service-assemblies").getCanonicalFile();
             //actually create the sub directories
             FileUtil.buildDirectory(installationDir);
             FileUtil.buildDirectory(deploymentDir);
             FileUtil.buildDirectory(componentsDir);
             FileUtil.buildDirectory(tmpDir);
             FileUtil.buildDirectory(sharedLibDir);
-            FileUtil.buildDirectory(serviceAssembiliesDirectory);
+            FileUtil.buildDirectory(serviceAssembliesDirectory);
         } catch (IOException e) {
             throw new JBIException(e);
         }

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java?rev=383937&r1=383936&r2=383937&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
Tue Mar  7 09:28:30 2006
@@ -496,7 +496,7 @@
                 // Unpack SU
                 try {
                     File artifactFile = new File(saDirectory, artifact);
-                    targetDir = environmentContext.getServiceUnitDirectory(componentName,
suName);
+                    targetDir = environmentContext.getServiceUnitDirectory(componentName,
suName, assemblyName);
                     if (log.isDebugEnabled()) {
                         log.debug("Unpack service unit archive " + artifactFile + " to "
+ targetDir);
                     }
@@ -635,7 +635,7 @@
     protected void buildState() {
         log.info("Restoring service assemblies");
         // walk through deployed SA's
-        File top = environmentContext.getServiceAssembiliesDirectory();
+        File top = environmentContext.getServiceAssembliesDirectory();
         if (top != null && top.exists() && top.isDirectory()) {
             File[] files = top.listFiles();
             if (files != null) {

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java?rev=383937&r1=383936&r2=383937&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
Tue Mar  7 09:28:30 2006
@@ -473,7 +473,7 @@
             }
             File componentRoot=environmentContext.createComponentRootDirectory(name);
             // this will get the new one
-            File installationDir=environmentContext.getInstallationDirectory(name);
+            File installationDir=environmentContext.getNewInstallationDirectory(name);
             tmpDirectory.renameTo(installationDir);
             if (log.isDebugEnabled()) {
                 log.debug("Moved " + tmpDirectory + " to " + installationDir);

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitLifeCycle.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitLifeCycle.java?rev=383937&r1=383936&r2=383937&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitLifeCycle.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitLifeCycle.java
Tue Mar  7 09:28:30 2006
@@ -186,7 +186,7 @@
     protected File getServiceUnitRootPath() {
         String componentName = getComponentName();
         String suName = getName();
-        File targetDir = registry.getEnvironmentContext().getServiceUnitDirectory(componentName,
suName);
+        File targetDir = registry.getEnvironmentContext().getServiceUnitDirectory(componentName,
suName, serviceAssembly);
         return targetDir;
     }
     

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java?rev=383937&r1=383936&r2=383937&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
Tue Mar  7 09:28:30 2006
@@ -65,7 +65,7 @@
     public static File getDirectoryPath(File parent, String subDirectory) {
         File result = null;
         if (parent != null){
-            result = new File(parent.getAbsolutePath() + File.separator + subDirectory);
+            result = new File(parent, subDirectory);
         }
         return result;
     }



Mime
View raw message