Package org.jboss.vfs

Examples of org.jboss.vfs.VirtualFile


      VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
      if (scanFromTop)
         vfsUnit = vfsUnit.getTopLevel();

      VirtualFile root = vfsUnit.getRoot();
      for (int i = 0; i < sessionFactoryMetaDatas.size(); i++)
      {
         // build the hibernate bean
         BeanMetaData beanMetaData = sessionFactoryMetaDatas.get(i).getBeanMetaData(root);
         vfsUnit.addAttachment(BeanMetaData.class + "$Hibernate#" + (i + 1), beanMetaData);
View Full Code Here


               VirtualFileFilter tldFilter = new SuffixMatchFilter(".tld", VisitorAttributes.DEFAULT);
               for (URL tldJar : tldJars)
               {
                  try
                  {
                     VirtualFile virtualFile = VFS.getChild(tldJar);
                     VirtualFile metaInf = virtualFile.getChild("META-INF");
                     if (metaInf != null)
                     {
                        List<VirtualFile> tlds = metaInf.getChildren(tldFilter);
                        for (VirtualFile tld : tlds)
                        {
                           TldMetaData tldMetaData = (TldMetaData) unmarshaller.unmarshal(tld.toURL().toString(), resolver);
                           sharedTldMetaData.add(tldMetaData);
                        }
View Full Code Here

    */
   protected VirtualFile getFile() throws IOException
   {
      if (file == null)
      {
         VirtualFile root;
         try
         {
            root = VFS.getChild(rootUrl);
         }
         catch (URISyntaxException e)
         {
            throw new IOException("Unable to get Virtualfile from URL: " + rootUrl, e);
         }
         file = root.getChild(path);
        
         if (!file.exists())
         {
            throw new IOException("VirtualFile " + file + " does not exist");
         }
View Full Code Here

      return !(root.getPathName().equals(root.getPhysicalFile().getAbsolutePath()) && child.getPathName().equals(child.getPhysicalFile().getAbsolutePath()));
   }
  
   public UnifiedVirtualFile findChild(String child) throws IOException
   {
      final VirtualFile virtualFile = getFile();  
      final VirtualFile childFile = file.getChild(child);
      if(!childFile.exists())
         throw new IOException("Child '" + child + "' not found for VirtualFile " + virtualFile);
      return new VirtualFileAdaptor(childFile);
   }
View Full Code Here

      }
   }
  
   private void writeObject(ObjectOutputStream out) throws IOException, URISyntaxException
   {
      VirtualFile file = getFile();
      URL url = rootUrl;
      if (url == null)
      {
         VirtualFile parentFile = file.getParent();
         url = parentFile != null ? parentFile.toURL() : null;
      }
      String pathName = path;
      if (pathName == null)
         pathName = file.getName();

      ObjectOutputStream.PutField fields = out.putFields();
      fields.put("rootUrl", url);
      fields.put("path", pathName);
     
      VirtualFile newRoot = VFS.getChild(url);
      VirtualFile newChild = newRoot.getChild(pathName);
      fields.put("requiresMount", isMounted(newRoot, newChild));
           
      out.writeFields();
   }
View Full Code Here

         if (unit instanceof VFSDeploymentUnit)
         {
            URL expWarUrl;

            VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
            VirtualFile root = vfsUnit.getRoot();
            expWarUrl = getExplodedWarUrl(root);

            // Map
            String warPathName = root.getPathName();
            if (warPathName.endsWith("/") == false)
               warPathName += "/";
            List<VirtualFile> classpathVFs = vfsUnit.getClassPath();
            if (classpathVFs != null)
            {
               List<URL> classpath = new ArrayList<URL>();
               for (VirtualFile vf : classpathVFs)
               {
                  try
                  {
                     String path = vf.getPathName();
                     if (path.startsWith(warPathName))
                     {
                        path = path.substring(warPathName.length());
                        URL pathURL = new URL(expWarUrl, path);
                        classpath.add(pathURL);
                     }
                     else
                     {
                        log.debug("Ignoring path element: " + vf);
                     }
                  }
                  catch (Exception e)
                  {
                     log.debug("Ignoring path element: " + vf, e);
                  }
               }
               unit.addAttachment("org.jboss.web.expandedWarClasspath", classpath);
            }

            // Indicate that an expanded URL exists
            unit.addAttachment("org.jboss.web.expandedWarURL", expWarUrl, URL.class);

            // Resolve any ear relative alt-dd path to an expWarUrl/WEB-INF/alt-dd.xml file
            String altDDPath = metaData.getAlternativeDD();
            if (altDDPath != null)
            {
               // First see if this is already a war local dd
               VirtualFile altDD = vfsUnit.getMetaDataFile(altDDPath);
               if (altDD == null)
               {
                  // Pass absolute paths through
                  File file = new File(altDDPath);
                  if (!file.exists() || !file.isAbsolute())
                  {
                     // Should be an relative to the top deployment
                     VFSDeploymentUnit topUnit = vfsUnit.getTopLevel();
                     if (topUnit == unit)
                        throw new DeploymentException("Unable to resolve " + altDDPath + " as WEB-INF path");
                     altDD = topUnit.getFile(altDDPath);
                     if (altDD == null)
                        throw new DeploymentException("Unable to resolve " + altDDPath + " as a deployment path");
                    
                     VirtualFile altDDFile = root.getChild("WEB-INF/" + altDD.getName());
                     log.debug("Copying the altDD to: " + altDDFile);
                     VFSUtils.writeFile(altDDFile, altDD.openStream());
                     metaData.setAlternativeDD(altDDFile.getPathName());
                  }
               }
            }
         }
View Full Code Here

         // Delete any expanded war
         URL warURL = unit.getAttachment("org.jboss.web.expandedWarURL", URL.class);
         if (warURL != null)
         {
            // use vfs to cleanup/delete - since we created it with vfs
            VirtualFile file = VFS.getChild(warURL);
         }
      }
      catch (Exception e)
      {
         log.debug("Failed to remove expanded war", e);
View Full Code Here

      {
         for (URL jarURL : sciJars)
         {
            try
            {
               VirtualFile virtualFile = VFS.getChild(jarURL);
               VirtualFile sci = virtualFile.getChild("META-INF/services/javax.servlet.ServletContainerInitializer");
               if (sci.exists())
               {
                  ServletContainerInitializer service = loadSci(unit, sci, jarURL.getPath(), false);
                  if (service != null)
                  {
                     scis.add(service);
                  }
               }
            }
            catch (URISyntaxException e)
            {
               DeploymentException.rethrowAsDeploymentException("Deployment error processing SCI for JAR: " + jarURL, e);
            }
         }
      }
      // Find local ServletContainerInitializer services
      List<String> order =
         (List<String>) unit.getAttachment(MergedJBossWebMetaDataDeployer.WEB_ORDER_ATTACHMENT_NAME);
      Map<String, VirtualFile> localScis = (Map<String, VirtualFile>)
         unit.getAttachment(MergedJBossWebMetaDataDeployer.WEB_SCIS_ATTACHMENT_NAME);
      if (order != null && localScis != null)
      {
         for (String jar : order)
         {
            VirtualFile sci = localScis.get(jar);
            if (sci != null)
            {
               ServletContainerInitializer service = loadSci(unit, sci, jar, true);
               if (service != null)
               {
View Full Code Here

      {
         for (String file : libs)
         {
            String url = getServerHome() + file;
            url = StringPropertyReplacer.replaceProperties(url);
            VirtualFile integrationLib = VFS.getChild(new URL(url));

            if (integrationLib != null && integrationLib.exists())
            {
               integrationLibsFound = true;
               result.add(integrationLib.toURL());
            }
            else
            {
               log.debug("Could not find JAX-RPC integration lib: " + url);
            }
View Full Code Here

      }
   }

   public void testEar() throws Exception
   {
      VirtualFile ear = VFS.getChild("jar-in-ear.ear");
      createAssembledDirectory(ear)
         .addPath("/weld/jarwarinear")
         .addPackage("simple.jar", PlainJavaBean.class)
         .addPackage("simple.war/WEB-INF/classes", PlainJavaBean.class)
         .addPath("simple.war", "/weld/warwowb/web");
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.