[jboss-cvs] JBossAS SVN: r82907 - in trunk/system/src/main/org/jboss/system/server/profileservice: repository and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 15 10:03:55 EST 2009


Author: emuckenhuber
Date: 2009-01-15 10:03:55 -0500 (Thu, 15 Jan 2009)
New Revision: 82907

Modified:
   trunk/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java
Log:
minor updates.

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/persistence/ManagedObjectUpdateHandler.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -45,7 +45,6 @@
 import org.jboss.metatype.api.types.CollectionMetaType;
 import org.jboss.metatype.api.types.CompositeMetaType;
 import org.jboss.metatype.api.types.EnumMetaType;
-import org.jboss.metatype.api.types.GenericMetaType;
 import org.jboss.metatype.api.types.MetaType;
 import org.jboss.metatype.api.types.Name;
 import org.jboss.metatype.api.types.SimpleMetaType;
@@ -59,7 +58,6 @@
 import org.jboss.metatype.api.values.EnumValue;
 import org.jboss.metatype.api.values.EnumValueSupport;
 import org.jboss.metatype.api.values.GenericValue;
-import org.jboss.metatype.api.values.GenericValueSupport;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.MetaValueFactory;
 import org.jboss.metatype.api.values.SimpleValue;
@@ -341,22 +339,6 @@
          MetaValue newValue = processMetaValue(i.next(), item);
          if(newValue != null)
          {
-            MetaType metaType = newValue.getMetaType();
-            
-            // FIXME unwrap a managedObject
-            if( metaType.isGeneric() )
-            {
-               ManagedObject mo = (ManagedObject) ((GenericValue) newValue).getValue();
-               // Ignore null values
-               if(mo == null)
-                  continue;
-               // Use the attachment instead of the MO, to avoid a CCE
-               newValue = new GenericValueSupport(
-                     new GenericMetaType(mo.getAttachmentName(), "mo"),
-                     mo.getAttachmentName()
-                     );
-            }
-            
             elementList.add(newValue);
          }
       }

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -91,7 +91,9 @@
    public AbstractAttachmentStore(File root)
    {
       if(root == null)
-         throw new IllegalArgumentException("Null uri");
+         throw new IllegalArgumentException("Null attachmentStoreDir");
+      if(root.exists() && root.isDirectory() == false)
+         throw new IllegalArgumentException("AttachmentStoreRoot is not a directory.");
       this.attatchmentStoreRoot = root.toURI();
    }
    

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractFileAttachmentsSerializer.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -47,7 +47,7 @@
    public AbstractFileAttachmentsSerializer(File dir)
    {
       if(dir == null)
-         throw new IllegalArgumentException("Null uri");
+         throw new IllegalArgumentException("Null store dir.");
       this.attachmentsStoreDir = dir;
    }
    

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ImmutableDeploymentRepository.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -47,7 +47,7 @@
 
    public void load() throws Exception
    {
-      for(URI uri : uris)
+      for(URI uri : getRepositoryURIs())
       {
          VirtualFile root = getCachedVirtualFile(uri);
          loadApplications(root);

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/JAXBAttachmentSerializer.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -22,7 +22,6 @@
 package org.jboss.system.server.profileservice.repository;
 
 import java.io.File;
-import java.net.URI;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -101,7 +101,7 @@
 
    public void load() throws Exception
    {
-      for(URI uri : uris)
+      for(URI uri : getRepositoryURIs())
       {
          VirtualFile root = getCachedVirtualFile(uri);
          loadApplications(root);
@@ -226,7 +226,7 @@
                // TODO: this could check metadata files modifications as well
             }
             // Now check for additions
-            for (URI applicationDir : uris)
+            for (URI applicationDir : getRepositoryURIs())
             {
                VirtualFile deployDir = getCachedVirtualFile(applicationDir);
                ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
@@ -298,6 +298,8 @@
     */
    protected boolean hasBeenModified(VFSDeploymentContext deploymentContext) throws IOException
    {
+      // hasBeenModified
+      boolean hasBeenModified = false;
       List<VirtualFile> metadataLocations = deploymentContext.getMetaDataLocations();
       if (metadataLocations != null && metadataLocations.isEmpty() == false)
       {
@@ -308,7 +310,6 @@
             {
                for(VirtualFile child : children)
                {
-                  // TODO JBAS-6360 - check if we already deployed a deployment containing the changes
                   String pathName = child.getPathName();
                   Long timestamp = lastModifiedCache.get(pathName);
                   long lastModified = child.getLastModified();
@@ -317,7 +318,7 @@
                   {
                      if (log.isTraceEnabled())
                         log.trace("Metadata location modified: " + child);
-                     return true;
+                     hasBeenModified = true;
                   }
                }
             }
@@ -331,11 +332,11 @@
             if (childContext instanceof VFSDeploymentContext)
             {
                if (hasBeenModified((VFSDeploymentContext)childContext))
-                  return true;
+                  hasBeenModified = true;
             }
          }
       }
-      return false;
+      return hasBeenModified;
    }
 
    public VFSDeployment removeDeployment(String vfsPath) throws Exception

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -64,7 +64,11 @@
 
    public DeploymentRepository getProfileDeploymentRepository(ProfileKey key) throws Exception, NoSuchProfileException
    {
-      return this.repositories.get(key);
+      DeploymentRepository repository = this.repositories.get(key);
+      if(repository == null)
+         throw new NoSuchProfileException("No such repository for profile: "  + key);
+      
+      return repository;
    }
    
    public DeploymentRepository createProfileDeploymentRepository(ProfileKey key, ProfileMetaData metaData) throws Exception
@@ -109,6 +113,7 @@
       if(factory ==  null)
          throw new IllegalStateException("No registered factory for repository type: "+ repositoryType);
       
+      // Let the factory create the repository
       return factory.createDeploymentRepository(key, metaData);
    }
 
@@ -116,11 +121,10 @@
    {
       DeploymentRepository repository = this.repositories.remove(key);
       if(repository == null)
-         throw new NoSuchProfileException("No such profile: "  + key);
-      if(repository != null)
-      {
-         repository.remove();
-      }
+         throw new NoSuchProfileException("No such repository for profile: "  + key);
+      
+      // Remove
+      repository.remove();
    }
    
    public void addRepositoryFactory(DeploymentRepositoryFactory factory)

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java	2009-01-15 13:05:46 UTC (rev 82906)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/XmlProfileFactory.java	2009-01-15 15:03:55 UTC (rev 82907)
@@ -101,11 +101,8 @@
       {
          parseProfiles(commonProfilesDir);
       }
-      if(profilesDir == null
-            && profilesDir.exists() == false 
-            && commonDir == null
-            && commonDir.exists() == false)
-         throw new IllegalArgumentException("No profile directories found.");
+      if(profilesDir == null && commonDir == null)
+         throw new IllegalArgumentException("No profile directories found.");         
    }
 
    /**
@@ -124,7 +121,7 @@
          {
             ProfilesMetaData profilesMetaData = parse(vf);
             if(profilesMetaData == null)
-               throw new IllegalStateException("Parsing returned for file: "+ vf.getPathName());
+               throw new IllegalStateException("Parsing returned null for file: "+ vf.getPathName());
             
             processProfilesMetaData(profilesMetaData);
          }




More information about the jboss-cvs-commits mailing list