Package org.jboss.virtual

Examples of org.jboss.virtual.VirtualFile


         for (String path : paths)
         {
            if (path == null)
               throw new IllegalArgumentException("Null path in paths: " + paths);

            VirtualFile child = root.getChild(path);
            if (child != null)
               locations.add(child);
            else
               log.debug("Meta data path does not exist: root=" + root.getPathName() + " path=" + path);
         }
View Full Code Here


    * @param name the file name to find
    * @return found file or null if not found
    */
   protected VirtualFile searchMetaDataLocations(String name)
   {
      VirtualFile result = null;
      for(VirtualFile location : getMetaDataLocations())
      {
         try
         {
            result = location.getChild(name);
View Full Code Here

      if (metadataLocations == null)
         metadataLocations = new ArrayList<VirtualFile>();

      for (int i = locations.length-1; i >= 0; --i)
      {
         VirtualFile location = locations[i];
         if (location == null)
            throw new IllegalArgumentException("Null virtual file in " + Arrays.toString(locations));
         metadataLocations.add(0, location);
      }
      setMetaDataLocations(metadataLocations);
View Full Code Here

      if (classPath == null)
         classPath = new ArrayList<VirtualFile>();

      for (int i = files.length-1; i >= 0; --i)
      {
         VirtualFile file = files[i];
         if (file == null)
            throw new IllegalArgumentException("Null virtual file in " + Arrays.toString(files));
         classPath.add(0, file);
      }
      setClassPath(classPath);
View Full Code Here

      if (classPath == null)
         classPath = new ArrayList<VirtualFile>();

      for (int i = files.size()-1; i >= 0; --i)
      {
         VirtualFile file = files.get(i);
         if (file == null)
            throw new IllegalArgumentException("Null virtual file in " + files);
         classPath.add(0, file);
      }
      setClassPath(classPath);
View Full Code Here

      if (deployment instanceof VFSDeployment)
      {
         VFSDeployment vfsDeployment = (VFSDeployment) deployment;
         String name = deployment.getName();
         String simpleName = deployment.getSimpleName();
         VirtualFile root = applyModification(vfsDeployment.getRoot(), metaData.getContext(""));
         if (name == null)
         {
            return new AbstractVFSDeploymentContext(root, "");
         }
         else
View Full Code Here

      {
         VFSDeploymentContext vfsParent = (VFSDeploymentContext) parent;
         String path = child.getPath();
         try
         {
            VirtualFile parentFile = vfsParent.getRoot();
            @SuppressWarnings("deprecation")
            VirtualFile file = parentFile.findChild(path); // leaving the findChild usage
            return new AbstractVFSDeploymentContext(applyModification(file, child), path);
         }
         catch (Throwable t)
         {
View Full Code Here

   protected VirtualFile applyModification(VirtualFile file, ContextInfo contextInfo) throws Exception
   {
      if (contextInfo == null)
         return file;

      VirtualFile modified = file;
      ModificationType modificationType = contextInfo.getModificationType();
      if (modificationType != null)
      {
         ModificationAction action = ModificationActions.getAction(modificationType);
         if (action != null)
View Full Code Here

        
         boolean classPathHadVF = false;

         List<ClassPathEntry> classPathEntries = contextInfo.getClassPath();
         VFSDeploymentContext top = vfsContext.getTopLevel();
         VirtualFile root = top.getRoot();
         List<VirtualFile> classPath = new ArrayList<VirtualFile>();

         if (classPathEntries != null)
         {
            for (ClassPathEntry entry : classPathEntries)
            {
               if (trace)
                  log.trace("Resolving classpath entry " + entry + " for " + context.getName());
               String suffixes = entry.getSuffixes();
               VirtualFile child;
               if (entry.getPath().length() == 0)
               {
                  child = root;
               }
               else
               {
                  try
                  {
                     child = root.findChild(entry.getPath()); // leaving the findChild
                  }
                  catch (Throwable t)
                  {
                     throw DeploymentException.rethrowAsDeploymentException("Unable to find class path entry " + entry + " from " + root.getName(), t);
                  }
               }
               if (suffixes == null)
               {
                  classPath.add(child);
                  if (classPathHadVF == false)
                     classPathHadVF = child.equals(root);
               }
               else
               {
                  String[] suffs = suffixes.split(",");
                  SuffixMatchFilter filter = new SuffixMatchFilter(Arrays.asList(suffs), VisitorAttributes.DEFAULT);
                  List<VirtualFile> matches = child.getChildren(filter);
                  if( matches != null )
                  {
                     classPath.addAll(matches);
                     if (trace)
                        log.trace("Added classpath matches: " + matches);
                     // Process any Manifest Class-Path refs
                     for (VirtualFile file : matches)
                     {
                        VFSUtils.addManifestLocations(file, classPath);
                        if (classPathHadVF == false)
                           classPathHadVF = file.equals(root);
                     }
                  }
               }
            }
         }
        
         VirtualFile file = vfsContext.getRoot();
         if (classPathHadVF == false && SecurityActions.isLeaf(file) == false)
            VFSUtils.addManifestLocations(file, classPath);

         if (classPath.isEmpty() == false)
            vfsContext.setClassPath(classPath);
View Full Code Here

      setFilters(Collections.<String, VirtualFileFilter>emptyMap()); // empty filters
   }

   public boolean determineStructure(StructureContext structureContext) throws DeploymentException
   {
      VirtualFile file = structureContext.getFile();

      if (shortCircuitFileCheck(file) == false)
         return false;

      ContextInfo context = null;
      try
      {
         context = createContext(structureContext, metaDataPaths);

         if (rootClasspathEntry)
            addClassPath(structureContext, file, true, true, context);

         // add any archives in libs
         for (String lib : libs)
         {
            VirtualFile libVF = file.getChild(lib);
            if (libVF != null)
            {
               VirtualFileFilter lf = filters.get(lib);
               if (lf == null)
                  lf = libFilter;

               List<VirtualFile> archives = libVF.getChildren(lf);
               for (VirtualFile archive : archives)
                  addClassPath(structureContext, archive, true, true, context);
            }
            else
            {
               if (log.isTraceEnabled())
                  log.trace("No such lib: " + lib + ", " + file);
            }
         }

         // check only children of defined sub-dirs / groups
         for (String group : groups)
         {
            VirtualFile groupVF = file.getChild(group);
            if (groupVF != null)
            {
               VirtualFileFilter gf = filters.get(group);
               if (gf == null)
                  gf = groupFilter;

               List<VirtualFile> children = groupVF.getChildren(gf);
               for (VirtualFile child : children)
                  structureContext.determineChildStructure(child);
            }
            else
            {
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.