Package org.jboss.system.server.profileservice.repository.clustered.metadata

Examples of org.jboss.system.server.profileservice.repository.clustered.metadata.RepositoryContentMetadata


      {
         throw new RuntimeException("Cannot acquire global lock");
      }
      try
      {     
         RepositoryContentMetadata existingRCMD = new RepositoryContentMetadata(this.localContentManager.getOfficialContentMetadata());        
         RepositoryItemMetadata newRIMD = this.clusteringHandler.addDeploymentContent(vfsPath, contentIS);
         RepositoryRootMetadata existingRRMD = existingRCMD.getRepositoryRootMetadata(newRIMD.getRootName());
         boolean exists = existingRRMD != null && existingRRMD.getItemMetadata(newRIMD.getRelativePathElements()) != null;
         VirtualFile root = getCachedVirtualFile(namedURIMap.get(newRIMD.getRootName()));
         VirtualFile contentVF = root.getChild(newRIMD.getRelativePath());

         try
View Full Code Here


         log.debug("Ignoring getModifiedDeployments() call as status is " + this.loadStatus);
      }
     
      // Only acquire a local lock until we know whether we actually
      // have a modification
      RepositoryContentMetadata baseContent = null;
      RepositoryContentMetadata latestContent = null;
      if (!this.clusteringHandler.lockLocally())
      {
         // Don't throw an exception; just log error and indicate no mods
         log.error("getModifiedDeployments(): Cannot acquire local lock");
         return Collections.emptySet();
      }
     
      try
      {
         baseContent = this.localContentManager.getOfficialContentMetadata();
         latestContent = this.localContentManager.getCurrentContentMetadata();        
         boolean unmodified = latestContent.equals(baseContent);
        
         if (unmodified)
         {
            // Our metadata is in sync, so our content is in sync with the
            // cluster. However, we might have had changes made to our
View Full Code Here

      return officialContentMetadata;
   }

   public RepositoryContentMetadata createEmptyContentMetadata()
   {
      RepositoryContentMetadata md = new RepositoryContentMetadata(profileKey);
      List<RepositoryRootMetadata> roots = new ArrayList<RepositoryRootMetadata>();
      for (Map.Entry<String, URI> entry : namedURIMap.entrySet())
      {
         RepositoryRootMetadata rmd = new RepositoryRootMetadata();
         rmd.setName(entry.getKey());
         roots.add(rmd);
      }
      md.setRepositories(roots);
      return md;     
   }
View Full Code Here

   public RepositoryContentMetadata getCurrentContentMetadata() throws IOException
   {
      synchronized (this)
      {
         RepositoryContentMetadata md = new RepositoryContentMetadata(profileKey);
         List<RepositoryRootMetadata> roots = new ArrayList<RepositoryRootMetadata>();
         RepositoryContentMetadata official = getOfficialContentMetadata();
         for (Map.Entry<String, URI> entry : namedURIMap.entrySet())
         {
            RepositoryRootMetadata rmd = new RepositoryRootMetadata();
            rmd.setName(entry.getKey());
            RepositoryRootMetadata existingRmd = official == null ? null : official.getRepositoryRootMetadata(entry.getKey());
           
            VirtualFile root = getCachedVirtualFile(entry.getValue());        
            if (isDirectory(root))
            {
               for(VirtualFile child: root.getChildren())
               {
                  createItemMetadataFromScan(rmd, existingRmd, child, root);
               }
            }
            else
            {
               // The root is itself an item. Treat it as a "child" of
               // itself with no relative path
               createItemMetadataFromScan(rmd, existingRmd, root, root);
            }
           
            roots.add(rmd);
         }
         md.setRepositories(roots);
        
         // Retain any existing "removed item" metadata -- but only if
         // it wasn't re-added!!
         RepositoryContentMetadata existing = getOfficialContentMetadata();
         if (existing != null)
         {
            for (RepositoryRootMetadata existingRoot : existing.getRepositories())
            {
               RepositoryRootMetadata rmd = md.getRepositoryRootMetadata(existingRoot.getName());
               if (rmd != null)
               {
                  for (RepositoryItemMetadata existingItem : existingRoot.getContent())
View Full Code Here

      return item;
   }

   public RepositoryContentMetadata getContentMetadataForAdd(RepositoryItemMetadata toAdd, InputStream contentIS) throws IOException
   {
      RepositoryContentMetadata result = new RepositoryContentMetadata(getOfficialContentMetadata());
      RepositoryRootMetadata rmd = result.getRepositoryRootMetadata(toAdd.getRootName());
      if (rmd == null)
      {
         throw new IllegalArgumentException("Unknown root name " + toAdd.getRootName());
      }
      RepositoryItemMetadata remove = rmd.getItemMetadata(toAdd.getRelativePathElements());
View Full Code Here

  
   public RepositoryContentMetadata getContentMetadataForRemove(VirtualFile vf) throws IOException
   {
      List<String> path = null;
      RepositoryRootMetadata root = null;
      RepositoryContentMetadata cmd = new RepositoryContentMetadata(getOfficialContentMetadata());
      for (RepositoryRootMetadata rmd : cmd.getRepositories())
      {
         URI uri = namedURIMap.get(rmd.getName());
         VirtualFile vfRoot = getCachedVirtualFile(uri);
         try
         {
View Full Code Here

   protected AbstractContentMetadataMutatorAction(T context,
         ContentModification modification)
   {
      super(context, modification);
     
      RepositoryContentMetadata contentMetadata = context.getInProgressMetadata();
      RepositoryRootMetadata rmd = contentMetadata.getRepositoryRootMetadata(modification.getRootName());
      if (rmd == null)
      {
         throw new IllegalStateException("Root " + modification.getRootName() + " unknown to " + contentMetadata);
      }
      this.rollbackMetadata = rmd.getItemMetadata(modification.getItem().getRelativePathElements());
View Full Code Here

   }
  
   protected void updateContentMetadata()
   {
      ContentModification mod = getRepositoryContentModification();
      RepositoryContentMetadata contentMetadata = getContext().getInProgressMetadata();
      RepositoryRootMetadata rmd = contentMetadata.getRepositoryRootMetadata(mod.getRootName());
      rmd.addItemMetadata(mod.getItem());
   }
View Full Code Here

   }
  
   protected void rollbackContentMetadata()
   {
      ContentModification mod = getRepositoryContentModification();
      RepositoryContentMetadata contentMetadata = getContext().getInProgressMetadata();
      RepositoryRootMetadata rmd = contentMetadata.getRepositoryRootMetadata(mod.getRootName());
      if (rollbackMetadata == null)
      {
         rmd.removeItemMetadata(mod.getItem().getRelativePathElements());
      }
      else
View Full Code Here

      {
         throw new IllegalArgumentException("Null inProgressMetadata");
      }
      this.id = id;
      // Defensive copy
      this.inProgressMetadata = new RepositoryContentMetadata(inProgressMetadata);
   }
View Full Code Here

TOP

Related Classes of org.jboss.system.server.profileservice.repository.clustered.metadata.RepositoryContentMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.