Package org.jboss.virtual

Examples of org.jboss.virtual.VirtualFile


      JarUtils.addJarSuffix(".vdb"); //$NON-NLS-1$
  
  
  @Override
  public boolean determineStructure(StructureContext structureContext) throws DeploymentException {
    VirtualFile file = structureContext.getFile();
    try {
      if (isLeaf(file) == false) {
        if (file.getName().endsWith(".vdb")) { //$NON-NLS-1$
         
          VirtualFile metainf = file.getChild("META-INF"); //$NON-NLS-1$
          if (metainf == null) {
            return false;
          }
         
          if (metainf.getChild(VdbConstants.DEPLOYMENT_FILE) == null) {
            return false;
          }
         
          List<String> scanDirs = new ArrayList<String>();
          scanDirs.add("/"); //$NON-NLS-1$
View Full Code Here


      if (f.endsWith(path)) {
        path = f;
        break;
      }
    }
    VirtualFile file =this.files.get(path);
    if (file == null) {
      throw new IOException(RuntimePlugin.Util.getString("udf_model_not_found", name)); //$NON-NLS-1$
    }
    List<FunctionMethod> udfMethods = FunctionMetadataReader.loadFunctionMethods(file.openStream());
    ActivityReport<ReportItem> report = new ActivityReport<ReportItem>("UDF load"); //$NON-NLS-1$
    FunctionMetadataValidator.validateFunctionMethods(udfMethods,report);
    if(report.hasItems()) {
        throw new QueryMetadataException(QueryPlugin.Util.getString("ERR.015.001.0005", report)); //$NON-NLS-1$
    }
View Full Code Here

      }
     
      logger.info("Deploy: "+top.getSimpleName()+" relativePath="+
          du.getRelativePath());
     
      VirtualFile root=((VFSDeploymentUnit)du).getRoot();
     
      logger.debug("Deployment descriptor file="+root);

      try {
        VirtualFile parent=((VFSDeploymentUnit)du).getRoot().getParent();
       
        logger.debug("Deployment unit dir="+parent);
     
        VirtualFile tmp=VFSUtils.explode(parent);
       
        java.net.URL url=VFSUtils.getCompatibleURL(tmp);
       
        logger.debug("Deployment exploded to dir="+tmp+" URL="+url);
View Full Code Here

   */
  public IndexMetadataFactory(URL url) throws IOException, URISyntaxException {
    VFS.init();
    ZipEntryContext context = new ZipEntryContext(url);
    VirtualFileHandler vfh = context.getRoot();
    VirtualFile vdb = new VirtualFile(vfh);
    List<VirtualFile> children = vdb.getChildrenRecursively(new VirtualFileFilter() {
      @Override
      public boolean accepts(VirtualFile file) {
        return file.getName().endsWith(IndexConstants.NAME_DELIM_CHAR+IndexConstants.INDEX_EXT);
      }
    });
View Full Code Here

    /**
     * @see org.teiid.query.metadata.BasicQueryMetadata#getBinaryVDBResource(java.lang.String)
     * @since 4.3
     */
    public byte[] getBinaryVDBResource(String resourcePath) throws TeiidComponentException, QueryMetadataException {
      final VirtualFile f = getFile(resourcePath);
      if (f == null) {
        return null;
      }
    try {
      return ObjectConverterUtil.convertToByteArray(f.openStream());
    } catch (IOException e) {
      throw new TeiidComponentException(e);
    }
    }
View Full Code Here

      throw new TeiidComponentException(e);
    }
    }
   
    public ClobImpl getVDBResourceAsClob(String resourcePath) {
      final VirtualFile f = getFile(resourcePath);
      if (f == null) {
        return null;
      }
    return new ClobImpl(new VirtualFileInputStreamFactory(f), -1);
    }
View Full Code Here

      }
    return new ClobImpl(new VirtualFileInputStreamFactory(f), -1);
    }
   
    public SQLXMLImpl getVDBResourceAsSQLXML(String resourcePath) {
      final VirtualFile f = getFile(resourcePath);
      if (f == null) {
        return null;
      }
    return new SQLXMLImpl(new VirtualFileInputStreamFactory(f));
    }
View Full Code Here

      }
    return new SQLXMLImpl(new VirtualFileInputStreamFactory(f));
    }
   
    public BlobImpl getVDBResourceAsBlob(String resourcePath) {
      final VirtualFile f = getFile(resourcePath);
      if (f == null) {
        return null;
      }
      return new BlobImpl(new VirtualFileInputStreamFactory(f));
    }
View Full Code Here

      if (deployment instanceof VFSDeployment == false)
         throw new DeploymentException("Structure can only be determined for VFSDeployments " + deployment);
     
      VFSDeployment vfsDeployment = (VFSDeployment) deployment;
     
      VirtualFile root = vfsDeployment.getRoot();
      if (root == null)
         throw new IllegalStateException("Deployment has no root " + deployment);
      StructureContext context = new StructureContext(root, structure, this);
      if (doDetermineStructure(context) == false)
         throw new DeploymentException("No deployer recognised the structure of " + deployment.getName());
View Full Code Here

   }

   public boolean determineStructure(StructureContext structureContext) throws DeploymentException
   {
      ContextInfo context = null;
      VirtualFile file = structureContext.getFile();
      try
      {
         boolean trace = log.isTraceEnabled();

         // the WEB-INF
         VirtualFile webinf = null;

         if (isLeaf(file) == false)
         {
            // We require either a WEB-INF or the name ends in .war
            if (file.getName().endsWith(".war") == false)
            {
               try
               {
                  webinf = file.getChild("WEB-INF");
                  if (webinf != null)
                  {
                     if (trace)
                        log.trace("... ok - directory has a WEB-INF subdirectory");
                  }
                  else
                  {
                     if (trace)
                        log.trace("... no - doesn't look like a war and no WEB-INF subdirectory.");
                     return false;
                  }
               }
               catch (IOException e)
               {
                  log.warn("Exception while checking if file is a war: " + e);
                  return false;
               }
            }
            else if (trace)
            {
               log.trace("... ok - name ends in .war.");
            }

            List<String> metaDataLocations = new ArrayList<String>();
            metaDataLocations.add("WEB-INF");

            // Check for WEB-INF/classes
            VirtualFile classes = null;
            try
            {
               // The classpath contains WEB-INF/classes
               classes = file.getChild("WEB-INF/classes");

               // Check for a META-INF for metadata
               if (classes != null)
                  metaDataLocations.add("WEB-INF/classes/META-INF");
            }
            catch(IOException e)
            {
               log.warn("Exception while looking for classes, " + file.getPathName() + ", " + e);
            }

            // Create a context for this war file and all its metadata locations
            context = createContext(structureContext, metaDataLocations.toArray(new String[metaDataLocations.size()]));

            // Check for jars in WEB-INF/lib
            List<VirtualFile> archives = null;
            try
            {
               VirtualFile webinfLib = file.getChild("WEB-INF/lib");
               if (webinfLib != null)
               {
                  archives = webinfLib.getChildren(webInfLibFilter);
                  // Add the jars' META-INF for metadata
                  for (VirtualFile jar : archives)
                  {
                     // either same as plain lib filter, null or accepts the jar
                     if (webInfLibMetaDataFilter == null || webInfLibMetaDataFilter == webInfLibFilter || webInfLibMetaDataFilter.accepts(jar))
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.