[jboss-cvs] JBossAS SVN: r86979 - in branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered: local and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 8 14:13:19 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-04-08 14:13:19 -0400 (Wed, 08 Apr 2009)
New Revision: 86979

Modified:
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/ClusteredDeploymentRepository.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractContentMetadataPersister.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/ContentMetadataPersister.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManager.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManagerFactory.java
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/file/FilesystemLocalContentManagerFactory.java
Log:
[JBAS-5552] Javadoc; fix out-of-date method name; remove unused method

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/ClusteredDeploymentRepository.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/ClusteredDeploymentRepository.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/ClusteredDeploymentRepository.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -217,7 +217,7 @@
          {
             if (factory.accepts(namedURIMap.values()))
             {
-               this.localContentManager = factory.getRepositoryContentPersister(namedURIMap, getProfileKey(), this.clusteringHandler.getLocalNodeName());
+               this.localContentManager = factory.getLocalContentManager(namedURIMap, getProfileKey(), this.clusteringHandler.getLocalNodeName());
                break;
             }
          }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractContentMetadataPersister.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractContentMetadataPersister.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractContentMetadataPersister.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -29,8 +29,9 @@
 import org.jboss.system.server.profileservice.repository.clustered.metadata.RepositoryContentMetadata;
 
 /**
+ * Abstract base class for a {@link ContentMetadataPersister}.
+ * 
  * @author Brian Stansberry
- *
  */
 public abstract class AbstractContentMetadataPersister
       implements ContentMetadataPersister
@@ -39,6 +40,12 @@
    
    private final File contentMetadataDir;
    
+   /**
+    * Create a new AbstractContentMetadataPersister.
+    * 
+    * @param dir directory in which content metadata should be persisted.
+    *            Cannot be <code>null</code>.
+    */
    public AbstractContentMetadataPersister(File dir)
    {
       if(dir == null)
@@ -46,6 +53,8 @@
       this.contentMetadataDir = dir;
    }
 
+   // ------------------------------------------------ ContentMetadataPersister
+   
    public RepositoryContentMetadata load(String baseName)
    {
       File attachmentsStore = getMetadataPath(baseName);
@@ -103,12 +112,43 @@
       }
    }
    
-   public abstract File getMetadataPath(String baseName);
+   // ------------------------------------------------------------------ Public
+   
+   /**
+    * Get the file where metadata is stored.
+    * 
+    * @param storeName the name of the store; identifies which metadata is desired
+    * 
+    * @return the file. Will not be <code>null</code>
+    */
+   public abstract File getMetadataPath(String storeName);
 
-   protected abstract RepositoryContentMetadata loadMetadata(File attachmentsStore) throws Exception;
+   // --------------------------------------------------------------  Protected
    
+   /**
+    * Actually load the metadata
+    * 
+    * @param metadataStore file where metadata is stored
+    * 
+    * @return the metadata
+    */
+   protected abstract RepositoryContentMetadata loadMetadata(File metadataStore) throws Exception;
+   
+   /**
+    * Actually store the given metadata.
+    * 
+    * @param metadataStore file where metadata should be stored. Cannot be <code>null</code>
+    * @param metadata the metadata. Cannot be <code>null</code>
+    * 
+    * @throws Exception
+    */
    protected abstract void saveMetadata(File metadataStore, RepositoryContentMetadata metadata) throws Exception;
    
+   /**
+    * Get the base directory where content metadata is to be stored.
+    * 
+    * @return the directory. Will not be <code>null</code>.
+    */
    protected File getContentMetadataDir()
    {
       return contentMetadataDir;

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -32,6 +32,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.DeploymentRepository;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.system.server.profileservice.repository.clustered.metadata.RepositoryContentMetadata;
 import org.jboss.system.server.profileservice.repository.clustered.metadata.RepositoryItemMetadata;
@@ -47,8 +48,8 @@
 import org.jboss.virtual.VirtualFile;
 
 /**
+ * Abstract base class for a {@link LocalContentManager} implementation.
  *
- *
  * @author Brian Stansberry
  * 
  * @version $Revision: $
@@ -94,6 +95,16 @@
       return sb.toString();
    }
    
+   /**
+    * Create a new AbstractLocalContentManager.
+    * 
+    * @param namedURIMap Map of URIs managed by this object, keyed by a
+    *                    String identifier
+    * @param profileKey  key of the profile the content of which this
+    *                    object is managing
+    * @param localNodeName name of the local node in the cluster
+    * @param contentMetadataPersister object to use for storing/retrieving content metadata
+    */
    protected AbstractLocalContentManager(Map<String, URI> namedURIMap,
          ProfileKey profileKey, String localNodeName, 
          ContentMetadataPersister contentMetadataPersister)
@@ -492,37 +503,173 @@
    // --------------------------------------------------------------  Protected
 
 
+   /** 
+    * Create a {@link SynchronizationActionContext} for the given cluster-wide
+    * content synchronization.
+    * 
+    * @param id the id of the synchronization
+    * @param toUpdate metadata object that should be updated as synchronization
+    *                 actions are performed.
+    */
    protected abstract T createSynchronizationActionContext(SynchronizationId<?> id, RepositoryContentMetadata toUpdate);
    
+   /**
+    * Create an action to handle the local end of a node pulling content from
+    * the cluster.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createPullFromClusterAction(ContentModification mod, boolean localLed);
    
+   /**
+    * Create an action to handle the local end of a node pushing content to
+    * the cluster.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createPushToClusterAction(ContentModification mod, boolean localLed);
 
+   /**
+    * Create an action to handle the local end of a node pushing content that is
+    * read from an external-to-the-repository stream to the cluster. Used to
+    * handle installation of content to the repository via 
+    * {@link DeploymentRepository#addDeployment(String, org.jboss.profileservice.spi.ProfileDeployment)}. 
+    * <p> 
+    * This is only invoked on the node that is driving the synchronization process.
+    * </p>
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    *            
+    * @param stream the stream from which content will be read.
+    *                 
+    * @return an action that will handle both the local end of pushing the stream content to
+    *         other nodes in the cluster <b>and</b> storing the stream content
+    *         in this node's repository. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createPushStreamToClusterAction(ContentModification mod, InputStream stream);
    
+   /**
+    * Create an action to handle the local end of a node removing content that
+    * the rest of the cluster regards as invalid.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createRemoveFromClusterAction(ContentModification mod, boolean localLed);
    
+   /**
+    * Create an action to handle the local end of a node removing content from
+    * the cluster.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createRemoveToClusterAction(ContentModification mod, boolean localLed);
 
+   /**
+    * Create an action to handle the local end of a node removing a directory
+    * from the cluster.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createPrepareRmdirToClusterAction(ContentModification mod, boolean localLed);
 
 
+   protected abstract TwoPhaseCommitAction<T> createPrepareRmdirFromClusterAction(ContentModification mod, boolean localLed);
+   
+   /**
+    * Create an action to handle the local end of a node adding a directory
+    * to the cluster.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createMkdirToClusterAction(ContentModification mod,
          boolean localLed);
 
+   /**
+    * Create an action to handle the local end of a node adding a directory
+    * due to its presence on the cluster.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createMkdirFromClusterAction(
          ContentModification mod, boolean localLed);
 
+   /**
+    * Create an action to handle the local end of a node updating a directory
+    * timestamp to match the cluster.
+    * 
+    * @param mod object describing the content modification this action is
+    *            part of
+    * @param localLed <code>true</code> if this node is driving the synchronization
+    *                 process the action is part of; <code>false</code> if 
+    *                 another node is
+    *                 
+    * @return the action. Will not return <code>null</code>.
+    */
    protected abstract TwoPhaseCommitAction<T> createDirectoryTimestampMismatchAction(
          ContentModification mod, boolean localLed);
 
-   protected abstract TwoPhaseCommitAction<T> createPrepareRmdirFromClusterAction(ContentModification mod, boolean localLed);
-
+   /**
+    * Gets the current {@link SynchronizationActionContext}.
+    * 
+    * @return the current context, or <code>null</code> if there isn't one
+    */
    protected T getSynchronizationActionContext()
    {
       return currentSynchronizationActionContext;
    }
    
+   /**
+    * Gets a {@link VirtualFile} corresponding to the given URI.
+    * 
+    * @param uri the uri. Cannot be <code>null</code>.
+    * @return the virtual file
+    * 
+    * @throws IOException
+    * @throws NullPointerException if <code>uri</code> is <code>null</code>. 
+    */
    protected VirtualFile getCachedVirtualFile(URI uri) throws IOException 
    {
       VirtualFile vf = this.vfCache.get(uri.toString());
@@ -534,16 +681,23 @@
       return vf;
    }
    
+   /**
+    * Gets the URI of the repository root with which the given modification
+    * is associated.
+    * 
+    * @param mod the modification. Cannot be <code>null</code>
+    * @return the URI. May be <code>null</code> if the modification is for
+    *         an unknown root
+    *         
+    * @throws NullPointerException if <code>uri</code> is <code>null</code>.
+    * 
+    *  @see ContentModification#getRootName()
+    */
    protected URI getRootURIForModification(ContentModification mod)
    {
       return namedURIMap.get(mod.getRootName());
    }
    
-   public void clearCurrentContentMetadata()
-   {
-      this.currentContentMetadata = null;
-   }
-   
    // --------------------------------------------------------------  Private
    
    private TwoPhaseCommitAction<T> createRemovalMetadataAction(ContentModification mod,

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/ContentMetadataPersister.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/ContentMetadataPersister.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/ContentMetadataPersister.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -33,8 +33,20 @@
  */
 public interface ContentMetadataPersister
 {   
+   /**
+    * Load content metadata from the persistent store.
+    * 
+    * @param storeName name of the store. Cannot be <code>null</code>
+    * 
+    * @return the metadata
+    */
    RepositoryContentMetadata load(String storeName);
 
+   /**
+    * Store content metadata to the persistent store.
+    * 
+    * @param storeName name of the store. Cannot be <code>null</code> 
+    * @param metadata the metadata. Cannot be <code>null</code>
+    */
    void store(String storeName, RepositoryContentMetadata metadata);
-
 }
\ No newline at end of file

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/JAXBRepositoryContentMetadataPersister.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -72,9 +72,9 @@
    }
 
    @Override
-   public File getMetadataPath(String baseName)
+   public File getMetadataPath(String storeName)
    {
-      final String vfsPath = baseName + METADATA_SUFFIX;
+      final String vfsPath = storeName + METADATA_SUFFIX;
       return new File(getContentMetadataDir(), vfsPath);
    }
 

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManager.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManager.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManager.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -53,7 +53,7 @@
     * This is the version persisted to disk following synchronization
     * of changes with the cluster. 
     * 
-    * @return
+    * @return the content metadata
     */
    RepositoryContentMetadata getOfficialContentMetadata();
    
@@ -61,7 +61,9 @@
     * Scan the persistent store for the current content metadata. This
     * is not the "official" metadata that has been persisted, as any
     * changes between it and the {@link #getOfficialContentMetadata() official version}
-    * have not been synchronized with the cluster.
+    * have not been synchronized with the cluster. 
+    * 
+    * @return the content metadata
     */
    RepositoryContentMetadata getCurrentContentMetadata() throws IOException;
    
@@ -75,7 +77,7 @@
     * @param toInstall TODO
     * @param localLed <code>true</code> if this node is driving the synchronization,
     *                 <code>false</code> if another node is
-    * @return list of {@link SynchronizationAction} each of which
+    * @return list of {@link SynchronizationAction}s each of which
     *         can be executed by the caller to fulfill a portion of this node's role in
     *         the overall cluster synchronization
     *         
@@ -92,6 +94,10 @@
     * 
     * @param id id of the synchronization. Cannot be <code>null</code>
     * 
+    * @return <code>true</code> if the prepare phase was successful; 
+    *         <code>false</code> if not and the synchronization needs to be
+    *         rolled back
+    * 
     * @throws IllegalStateException if <code>id</code> is not equal to the
     *  id of an uncompleted synchronization started via 
     *  {@link #initiateSynchronization(SynchronizationId, List, RepsitoryContentMetadata, boolean)}
@@ -140,10 +146,6 @@
     * as the "official" content metadata. Intended for use during node startup
     * when the node discovers it is the only member of the cluster, and thus
     * that it's "current" content metadata is "official".
-    * 
-    * @throws IllegalStateException if {@link #initiateSynchronization(SynchronizationId, List, RepsitoryContentMetadata, boolean)
-    *  a cluster synchronization has been initiated} since the call to {@link #getCurrentContentMetadata()}
-    *  but hasn't been committed or rolled back.
     *  
     * @throws IllegalStateException if no "current" content metadata is available, either
     *                               because {@link #getCurrentContentMetadata()} 
@@ -153,8 +155,19 @@
     *
     */
    void installCurrentContentMetadata();
-
+   
+   /**
+    * Gets a {@link RepositoryItemMetadata} that will describe an item that
+    * may be added.
+    * 
+    * @param vfsPath path relative to one of this repository's root URIs
+    * 
+    * @return the item metadata
+    * 
+    * @throws IOException
+    */
    RepositoryItemMetadata getItemForAddition(String vfsPath) throws IOException;
+   
    /**
     * Generate content metadata that would reflect what the metadata would 
     * look like if an item with path vfsPath were added.
@@ -165,7 +178,25 @@
     */
    RepositoryContentMetadata getContentMetadataForAdd(RepositoryItemMetadata toAdd, InputStream contentIS) throws IOException;
 
+   /**
+    * Get a {@link VirtualFile} for the content indicated by <code>item</code>.
+    * 
+    * @param item metadata describing the content
+    * @return the virtual file
+    * 
+    * @throws IOException
+    */
    VirtualFile getVirtualFileForItem(RepositoryItemMetadata item) throws IOException;
 
+   /**
+    * Generate content metadata that would reflect what the metadata would 
+    * look like if an item with path vfsPath were removed.
+    * 
+    * @param vfsPath path relative to one of this repository's root URIs
+    * 
+    * @return the content metadata
+    * 
+    * @throws IOException
+    */
    RepositoryContentMetadata getContentMetadataForRemove(VirtualFile vf) throws IOException;
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManagerFactory.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManagerFactory.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/LocalContentManagerFactory.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -49,6 +49,15 @@
     */
    boolean accepts(Collection<URI> uris);
    
-   LocalContentManager<T> getRepositoryContentPersister(Map<String, URI> namedURIMap,
+   /**
+    * Gets a {@link LocalContentManager} for the given set of URIs.
+    * 
+    * @param namedURIMap the URIs to be managed, keyed by a unique identifier
+    * @param profileKey key of the {@link Profile} associated with the content
+    * @param localNodeName cluster-wide unique name for this node
+    * 
+    * @return the content manager
+    */
+   LocalContentManager<T> getLocalContentManager(Map<String, URI> namedURIMap,
          ProfileKey profileKey, String localNodeName);
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/file/FilesystemLocalContentManagerFactory.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/file/FilesystemLocalContentManagerFactory.java	2009-04-08 17:40:16 UTC (rev 86978)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/file/FilesystemLocalContentManagerFactory.java	2009-04-08 18:13:19 UTC (rev 86979)
@@ -84,7 +84,7 @@
       }
    }
 
-   public LocalContentManager<FileBasedSynchronizationActionContext> getRepositoryContentPersister(Map<String, URI> namedURIMap, ProfileKey profileKey,
+   public LocalContentManager<FileBasedSynchronizationActionContext> getLocalContentManager(Map<String, URI> namedURIMap, ProfileKey profileKey,
          String localNodeName)
    {
       if (this.metadataPersister == null)




More information about the jboss-cvs-commits mailing list