Package org.jboss.virtual

Examples of org.jboss.virtual.VirtualFile


      // it was not modifed & we're actually temped
      if (modified == false && root != deploymentContext.getRoot())
      {
         // check for update or delete
         UpdateDeleteVisitor udVisitor = new UpdateDeleteVisitor(tempAttributes, getCache(), synchAdapter, root);
         VirtualFile tempRoot = deploymentContext.getRoot();
         tempRoot.visit(udVisitor);
         // check for addition
         AddVisitor addVisitor = new AddVisitor(originalAttributes, getCache(), synchAdapter, tempRoot, root.getPathName().length());
         root.visit(addVisitor);
      }
      return modified;
View Full Code Here


    * @throws IOException for any error
    */
   protected boolean hasStructureBeenModifed(VirtualFile root, ContextInfo contextInfo) throws IOException
   {
      String path = contextInfo.getPath();
      VirtualFile contextRoot = root.getChild(path);
      if (contextRoot != null)
      {
         List<String> metadataPaths = contextInfo.getMetaDataPath();
         if (metadataPaths != null && metadataPaths.isEmpty() == false)
         {
            for (String metaDataPath : metadataPaths)
            {
               VirtualFile mdpVF = contextRoot.getChild(metaDataPath);
               if (mdpVF != null)
               {
                  List<VirtualFile> children = mdpVF.getChildren(filter);
                  String mdpPathName = mdpVF.getPathName();
                  Set<String> leaves = getCache().getLeaves(mdpPathName);
                  // do we have some new files or some were deleted
                  if (leaves != null && children != null && leaves.size() != children.size())
                  {
                     if (log.isTraceEnabled())
View Full Code Here

   protected void doVisit(VirtualFile file) throws Exception
   {
      String pathName = file.getPathName();
      String originalPathName = initialPath + pathName;
      VirtualFile child = originalRoot.getChild(pathName);
      if (child == null)
      {
         // original was deleted, try deleting the temp
         if (getSynchAdapter().delete(file))
         {
            getCache().removeCache(originalPathName);
         }
      }
      else
      {
         Long previous = getCache().getCacheValue(originalPathName);
         long lastModified = child.getLastModified();

         boolean updateCache = false;
         if (previous == null)
         {
            updateCache = true;
View Full Code Here

         log.warn("Deployment is not VFS or not top level.");
         return false;
      }

      VFSDeployment vfsDeployment = VFSDeployment.class.cast(deployment);
      VirtualFile root = vfsDeployment.getRoot();

      boolean result = false;

      if (checkRoot && (root.isArchive() || root.isLeaf()))
      {
         result = hasRootBeenModified(root);
      }

      if (result == false)
      {
         result = hasStructureBeenModifed(root, deploymentContext);
      }

      if (result)
      {
         String pathName = root.getPathName();
         getCache().invalidateCache(pathName);
      }
      return result;
   }
View Full Code Here

   public void doVisit(VirtualFile file) throws Exception
   {
      String originalPathName = file.getPathName();
      String pathName = originalPathName.substring(initialPathLenght);
      VirtualFile child = tempRoot.getChild(pathName);
      if (child == null)
      {
         // original was added
         long timestamp = getSynchAdapter().add(file, tempRoot, pathName);
         getCache().putCacheValue(originalPathName, timestamp);
View Full Code Here

   public void deploy(VFSDeploymentUnit unit) throws DeploymentException
   {
      try
      {
         URL dynamicClassRoot = new URL("vfsmemory", createHost(unit), "");
         VirtualFile classes = MemoryFileFactory.createRoot(dynamicClassRoot).getRoot();
         unit.addAttachment(DYNAMIC_CLASS_URL_KEY, dynamicClassRoot);
         unit.addAttachment(DYNAMIC_CLASS_KEY, classes);
         unit.prependClassPath(classes);
         log.debug("Dynamic class root for " + unit.getName() + " is " + dynamicClassRoot);
      }
View Full Code Here

   public void undeploy(VFSDeploymentUnit unit)
   {
      log.debug("Removing dynamic class root for " + unit.getName());
      try
      {
         VirtualFile classes = unit.removeAttachment(DYNAMIC_CLASS_KEY, VirtualFile.class);
         if (classes != null)
         {
            unit.removeClassPath(classes);
         }
      }
View Full Code Here

         List<VirtualFile> added = new ArrayList<VirtualFile>();
         try
         {
            for (URL integrationURL : integrationURLs)
            {
               VirtualFile integration = VFS.getRoot(integrationURL);
               unit.addClassPath(integration);
               added.add(integration);
            }
         }
         catch (Throwable t)
View Full Code Here

      {
         for (URL integrationURL : integrationURLs)
         {
            try
            {
               VirtualFile integration = VFS.getRoot(integrationURL);
               unit.removeClassPath(integration);
            }
            catch (Throwable t)
            {
               log.warn("Error removing integration from classpath: " + integrationURL, t);
View Full Code Here

      this.root = root;
   }

   public UnifiedVirtualFile findChild(String child) throws IOException
   {
      VirtualFile vf = root;
      while (child.startsWith("./"))
      {
         child = child.substring(2);
      }
      while (child.startsWith("../"))
      {
         child = child.substring(3);
         vf = vf.getParent();
      }
     
      vf = vf.findChild(child);
      return new VirtualFileAdaptor(vf);
   }
View Full Code Here

TOP

Related Classes of org.jboss.virtual.VirtualFile

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.