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

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


   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.getContent().add(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.getContent().remove(mod.getItem());
      }
      else
View Full Code Here

   @Override
   protected void doCommit()
   {
      ContentModification mod = getRepositoryContentModification();
      RepositoryContentMetadata contentMetadata = getContext().getInProgressMetadata();
      RepositoryRootMetadata rmd = contentMetadata.getRepositoryRootMetadata(mod.getRootName());
      rmd.getContent().add(getMarkedRemovedItem(mod));
     
      if (log.isTraceEnabled())
      {
         log.trace("doCommit(): added removal metadata for " + mod.getType() +
View Full Code Here

   @Override
   protected boolean doPrepare()
   {
      boolean ok = false;
      ContentModification mod = getRepositoryContentModification();
      RepositoryContentMetadata toUpdate = getContext().getInProgressMetadata();
      RepositoryRootMetadata rmd = toUpdate.getRepositoryRootMetadata(mod.getRootName());
      if (rmd != null)
      {
         replaced = rmd.getItemMetadata(mod.getItem().getRelativePathElements());
         // BES 2009/04/20 I see no reason not to do this if replaced != null
//         if (replaced == null)
View Full Code Here

   protected void doRollbackFromComplete()
   {
      if (replaced != null)
      {
         ContentModification mod = getRepositoryContentModification();
         RepositoryContentMetadata toUpdate = getContext().getInProgressMetadata();
         RepositoryRootMetadata rmd = toUpdate.getRepositoryRootMetadata(mod.getRootName());
         if (rmd != null)
         {
            rmd.getContent().add(replaced);
         }        
      }     
View Full Code Here

   @Override
   protected void doRollbackFromPrepared()
   {
      ContentModification mod = getRepositoryContentModification();
      RepositoryContentMetadata toUpdate = getContext().getInProgressMetadata();
      RepositoryRootMetadata rmd = toUpdate.getRepositoryRootMetadata(mod.getRootName());
      if (rmd != null)
      {
         rmd.getContent().remove(mod.getItem());
      }  
   }
View Full Code Here

      }
      else if (mod.getType() == Type.REMOVE_FROM_CLUSTER)
      {
         // An addition has been rejected. We don't record the item as
         // removed in the metadata, we just remove it.
         RepositoryContentMetadata contentMetadata = getContext().getInProgressMetadata();
         RepositoryRootMetadata rmd = contentMetadata.getRepositoryRootMetadata(mod.getRootName());
         rmd.getContent().remove(modItem);        
      }
      else
      {
         // Add a record of the item, marked as removed
         RepositoryItemMetadata markedRemoved = getMarkedRemovedItem(mod);
         RepositoryContentMetadata contentMetadata = getContext().getInProgressMetadata();
         RepositoryRootMetadata rmd = contentMetadata.getRepositoryRootMetadata(mod.getRootName());
         rmd.getContent().add(markedRemoved);
      }
   }
View Full Code Here

      return officialContentMetadata;
   }

   public RepositoryContentMetadata createEmptyContentMetadata()
   {
      RepositoryContentMetadata md = new RepositoryContentMetadata(profileKey);
      List<RepositoryRootMetadata> roots = new ArrayList<RepositoryRootMetadata>();
      for (String rootName : vfCache.keySet())
      {
         RepositoryRootMetadata rmd = new RepositoryRootMetadata();
         rmd.setName(rootName);
         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, VirtualFile> entry : vfCache.entrySet())
         {
            RepositoryRootMetadata rmd = new RepositoryRootMetadata();
            rmd.setName(entry.getKey());
            RepositoryRootMetadata existingRmd = official == null ? null : official.getRepositoryRootMetadata(entry.getKey());
           
            VirtualFile root = 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)
               {
                  Collection<RepositoryItemMetadata> rimds = rmd.getContent();
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.