Package org.jboss.vfs

Examples of org.jboss.vfs.VirtualFile


      if (classpath == null && unit instanceof VFSDeploymentUnit)
      {
         VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
         try
         {
            VirtualFile classes = vfsUnit.getFile("WEB-INF/classes");
            // Tomcat can't handle the vfs urls yet
            URL vfsURL = classes.toURL();
            String vfsurl = vfsURL.toString();
            if (vfsurl.startsWith("vfs"))
               vfsURL = new URL(vfsurl.substring(3));
            classpath = new ArrayList<URL>();
            classpath.add(vfsURL);
View Full Code Here


               }
               URL configUrl = new URL(configPath);
               standardJBossXmlPath = new URL(configUrl, "standardjboss.xml");
            }

            VirtualFile stdJBoss = VFS.getChild(standardJBossXmlPath);
            if (stdJBoss == null && ignoreMissingStandardJBossXml == false)
            {
               throw new DeploymentException("standardjboss.xml not found in config dir: " + standardJBossXmlPath);
            }
            standardMetaData = super.parse(stdJBoss);
View Full Code Here

   public void deploy(VFSDeploymentUnit unit, JBossAppMetaData jBossAppMetaData) throws DeploymentException
   {
      try
      {
         VirtualFile root = unit.getRoot();
         String libDir = jBossAppMetaData.getLibraryDirectory();
         if (libDir == null || libDir.length() == 0) // take 'lib' even on empty
            libDir = "lib";
         VirtualFile lib = root.getChild(libDir);
         if (lib != null)
         {
            ResourceFilter recurseFilter = new UrlExcludeResourceFilter(lib.toURL());
            unit.addAttachment(ResourceFilter.class.getName() + ".recurse", recurseFilter, ResourceFilter.class);
            log.debug("Excluding ear's lib directory: " + lib);
         }
      }
      catch (Exception e)
View Full Code Here

      public boolean accepts(ResourceContext rc)
      {
         try
         {
            VirtualFile file = VFS.getChild(rc.getUrl());
            while (file != null)
            {
               if (url.equals(file.toURL())) // our parent is the lib
                  return false;

               file = file.getParent();
            }
            return true;
         }
         catch (Exception e)
         {
View Full Code Here

    }

    public Object lookup(Name name) throws NamingException {
        if (name.isEmpty())
            return this;
        VirtualFile entry = treeLookup(name);
        if (entry == null)
            throw new NamingException(sm.getString("resources.notFound", name));

        if (entry.isDirectory()) {
            return new VFSDirContext(entry);
        } else {
            return new VFSResource(entry);
        }
    }
View Full Code Here

    public NamingEnumeration list(Name name) throws NamingException {
        if (name.isEmpty()) {
            return new NamingContextEnumeration(list(base).iterator());
        }
        VirtualFile entry = treeLookup(name);
        if (entry == null)
            throw new NamingException(sm.getString("resources.notFound", name));

        return new NamingContextEnumeration(list(entry).iterator());
    }
View Full Code Here

    public NamingEnumeration listBindings(Name name) throws NamingException {
        if (name.isEmpty()) {
            return new NamingContextBindingsEnumeration(list(base).iterator(), this);
        }
        VirtualFile entry = treeLookup(name);
        if (entry == null)
            throw new NamingException(sm.getString("resources.notFound", name));

        return new NamingContextBindingsEnumeration(list(entry).iterator(), this);
    }
View Full Code Here

        return getAttributes(new CompositeName(name), attrIds);
    }

    public Attributes getAttributes(Name name, String[] attrIds) throws NamingException {

        VirtualFile entry = null;
        if (name.isEmpty()) {
            entry = base;
        } else {
            entry = treeLookup(name);
        }
        if (entry == null)
            throw new NamingException(sm.getString("resources.notFound", name));

        ResourceAttributes attrs = new ResourceAttributes();
        attrs.setCreationDate(new Date(entry.getLastModified()));
        attrs.setName(entry.getName());
        if (entry.isFile())
            attrs.setResourceType("");
        attrs.setContentLength(entry.getSize());
        attrs.setLastModified(entry.getLastModified());

        return attrs;

    }
View Full Code Here

    protected VirtualFile treeLookup(Name name) {
        if (base == null)
            return null;
        if (name.isEmpty())
            return base;
        VirtualFile currentFile = base;
        for (int i = 0; i < name.size(); i++) {
            if (name.get(i).length() == 0)
                continue;
            currentFile = currentFile.getChild(name.get(i));
            if (!currentFile.exists())
                return null;
        }
        return currentFile;
    }
View Full Code Here

        if (entry.isDirectory()) {
            Iterator<VirtualFile> children = entry.getChildren().iterator();
            NamingEntry namingEntry = null;

            while (children.hasNext()) {
                VirtualFile current = children.next();
                Object object = null;
                if (current.isDirectory()) {
                    object = new VFSDirContext(current);
                } else {
                    object = new VFSResource(current);
                }
                namingEntry = new NamingEntry(current.getName(), object, NamingEntry.ENTRY);
                entries.add(namingEntry);
            }
        }

        return entries;
View Full Code Here

TOP

Related Classes of org.jboss.vfs.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.