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

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


     
      for (RepositoryRootMetadata rrmd : content.getRepositories())
      {
         for (Iterator<RepositoryItemMetadata> it = rrmd.getContent().iterator(); it.hasNext(); )
         {
            RepositoryItemMetadata rimd = it.next();
            if (rimd.isRemoved() && rimd.getTimestamp() < oldest)
            {
               it.remove();
               purged = true;
            }
         }
View Full Code Here


      }
   }
  
   protected static RepositoryItemMetadata getMarkedRemovedItem(ContentModification base)
   {
      RepositoryItemMetadata result = base.getItem();
      if (result.isRemoved() == false)
      {
         result = new RepositoryItemMetadata(result);
         result.setRemoved(true);
      }
     
      return result;
   }
View Full Code Here

   @Override
   protected void updateContentMetadata()
   {
      ContentModification mod = getRepositoryContentModification();
      RepositoryItemMetadata modItem = mod.getItem();
      if (modItem.isRemoved())
      {
         // Just record it
         super.updateContentMetadata();
      }
      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

                  for (RepositoryItemMetadata existingItem : existingRoot.getContent())
                  {
                     if (existingItem.isRemoved() // but check for re-add
                           && rmd.getItemMetadata(existingItem.getRelativePathElements()) == null)
                     {
                        rimds.add(new RepositoryItemMetadata(existingItem));
                     }
                  }
               }
            }
         }
View Full Code Here

      }     
   }

   public RepositoryItemMetadata getItemForAddition(String vfsPath) throws IOException
   {
      RepositoryItemMetadata item = new RepositoryItemMetadata();
      item.setRelativePath(vfsPath);
      List<String> pathElements = item.getRelativePathElements();
      String rootName = null;
      Collection<RepositoryRootMetadata> roots = getOfficialContentMetadata().getRepositories();
      for (RepositoryRootMetadata rmd : roots)
      {
         if (rmd.getItemMetadata(pathElements) != null)
         {
            // Exact match to existing item -- done
            rootName = rmd.getName();
            break;
         }
      }
     
      if (rootName == null)
      {
         // Use the first root that can accept children
         for (RepositoryRootMetadata rmd : roots)
         {
           
            VirtualFile vf = vfCache.get(rmd.getName());
            if (isDirectory(vf))
            {
               rootName = rmd.getName();
               break;              
            }
         }
      }
     
      if (rootName == null)
      {
         throw new IllegalStateException("No roots can accept children");
      }
     
      item.setRootName(rootName);
      return item;
   }
View Full Code Here

      RepositoryRootMetadata rmd = result.getRepositoryRootMetadata(toAdd.getRootName());
      if (rmd == null)
      {
         throw new IllegalArgumentException("Unknown root name " + toAdd.getRootName());
      }
      RepositoryItemMetadata remove = rmd.getItemMetadata(toAdd.getRelativePathElements());
      if (remove != null)
      {
         Collection<RepositoryItemMetadata> content = rmd.getContent();
         if (remove.isDirectory())
         {
            for (Iterator<RepositoryItemMetadata> it = content.iterator(); it.hasNext(); )
            {
               if (it.next().isChildOf(remove))
               {
View Full Code Here

      if (root == null)
      {
         throw new IllegalArgumentException(repositoryRoot + " is not a child of any known roots");
      }
     
      RepositoryItemMetadata remove = root.getItemMetadata(RepositoryItemMetadata.getPathElements(relativePath));     
      if (remove != null)
      {
         Collection<RepositoryItemMetadata> items = root.getContent();
         if (remove.isDirectory())
         {
            for (Iterator<RepositoryItemMetadata> it = items.iterator(); it.hasNext(); )
            {
               if (it.next().isChildOf(remove))
               {
View Full Code Here

   {     
      boolean directory = isDirectory(file);
      long timestamp = file.getLastModified();
     
      List<String> pathElements = getRelativePath(file, root);
      RepositoryItemMetadata existing = existingRMD == null ? null : existingRMD.getItemMetadata(pathElements);
     
      // If there's an existing item, assume for now it's unchanged and keep existing originator
      String originator = existing == null ? this.localNodeName : existing.getOriginatingNode();     
      RepositoryItemMetadata md = new RepositoryItemMetadata(pathElements, timestamp, originator, directory, false);
      if (md.equals(existing) == false)
      {
         // above if test failing means this is a new item or
         // timestamp, removed or directory status has changed
         // In any case, this node is now the originator
         md.setOriginatingNode(this.localNodeName);
      }
     
      rmd.getContent().add(md);
     
      if (directory)
View Full Code Here

         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
         {
            // Add the new virtual file to the cache
            repositoryName = addVirtualFileCache(contentVF);
View Full Code Here

         }
         this.id = id;
         this.localActions = localActions;
         for (SynchronizationAction<?> action : localActions)
         {
            RepositoryItemMetadata item = action.getRepositoryContentModification().getItem();
            if (action instanceof SynchronizationInitiationAction<?>)
            {
               initiationActionsByItem.put(item, (SynchronizationInitiationAction<?>) action);
            }
            else if (action instanceof SynchronizationReadAction<?>)
View Full Code Here

TOP

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

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.