Package org.jboss.deployers.spi.structure

Examples of org.jboss.deployers.spi.structure.ContextInfo


      StructureMetaData structureMetaData = unit.getAttachment(StructureMetaData.class);
      if(structureMetaData == null)
         return false;

      ContextInfo info = structureMetaData.getContext(unit.getSimpleName());
      if(info == null && unit.isTopLevel())
         info = structureMetaData.getContext("");

      if(info == null)
         return false;
View Full Code Here


   protected ContextInfo createStructureMetaData(Deployment deployment, String path, BasicVirtualAssemblyContext ctx)
   {
      List<String> metaDataLocations = ctx.getMetaDataLocations();
      List<ClassPathEntry> classPathEntries = getClassPathEntries(ctx);
     
      ContextInfo info = deploymentFactory.addContext(deployment, path, metaDataLocations, classPathEntries);
      if(ctx.getChildren() != null && ctx.getChildren().isEmpty() == false)
      {
         for(VirtualDeploymentAssemblyContext child : ctx.getChildren())
         {
            String childPath = child.getRoot().getName();
View Full Code Here

      return name.toLowerCase().endsWith(".ear");
   }

   public boolean doDetermineStructure(StructureContext structureContext) throws DeploymentException
   {
      ContextInfo context;
      boolean valid;
      boolean trace = log.isTraceEnabled();
      VirtualFile file = structureContext.getFile();
      try
      {
         if (hasValidName(file) == false)
            return false;

         context = createContext(structureContext, "META-INF");
         context.setComparatorClassName(comparatorClassName);

         VirtualFile applicationXml = getMetaDataFile(file, "META-INF/application.xml");
         VirtualFile jbossAppXml = getMetaDataFile(file, "META-INF/jboss-app.xml");
         VirtualFile lib;

         boolean scan = true;

         Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
         unmarshaller.setValidation(useValidation);
         EarMetaData specMetaData = null;
         JBossAppMetaData appMetaData = null;
         if (applicationXml != null)
         {
            InputStream in = applicationXml.openStream();
            try
            {
               specMetaData = (EarMetaData) unmarshaller.unmarshal(in, resolver);
            }
            finally
            {
               in.close();
            }
            scan = false;
         }
         if (jbossAppXml != null)
         {
            InputStream in = jbossAppXml.openStream();
            try
            {
               appMetaData = (JBossAppMetaData) unmarshaller.unmarshal(in, resolver);
            }
            finally
            {
               in.close();
            }
         }
         // Need a metadata instance and there will not be one if there are no descriptors
         if (appMetaData == null)
         {
            appMetaData = new JBossAppMetaData();
         }
         // Create the merged view
         appMetaData.merge(appMetaData, specMetaData);

         String libDir = appMetaData.getLibraryDirectory();
         if (libDir == null || libDir.length() > 0)
         {
            if (libDir == null)
               libDir = "lib";

            // Add the ear lib contents to the classpath
            if(trace)
               log.trace("Checking for ear lib directory: "+libDir);
            try
            {
               lib = file.getChild(libDir);
               if (lib.exists())
               {
                  if(trace)
                     log.trace("Found ear lib directory: "+lib);
                  List<VirtualFile> archives = lib.getChildren(earLibFilter);
                  for (VirtualFile archive : archives)
                  {
                     Automounter.mount(file, archive);
                     addClassPath(structureContext, archive, true, true, context);
                     // add any jars with persistence.xml as a deployment
                     if (archive.getChild("META-INF/persistence.xml").exists())
                     {
                        log.trace(archive.getName() + " in ear lib directory has persistence units");
                        if (structureContext.determineChildStructure(archive) == false)
                        {
                           throw new RuntimeException(archive.getName()
                                 + " in lib directory has persistence.xml but is not a recognized deployment, .ear: "
                                 + file.getName());
                        }
                     }
                     else if (trace)
                        log.trace(archive.getPathName() + " does not contain META-INF/persistence.xml");
                  }
               }
               else if (trace)
                  log.trace("No lib directory in ear archive.");
            }
            catch (IOException e)
            {
               // TODO - should we throw this fwd?
               log.warn("Exception while searching for lib dir: " + e);
            }
         }
         else if (trace)
         {
            log.trace("Ignoring library directory, got empty library-directory element.");
         }

         // Add the ear manifest locations?
         addClassPath(structureContext, file, includeEarRootInClasspath, true, context);

         // TODO: need to scan for annotationss
         if( scan )
         {
            scanEar(file, appMetaData);
         }

         // Create subdeployments for the ear modules
         ModulesMetaData modules = appMetaData.getModules();
         if(modules != null)
         {
            for (ModuleMetaData mod : modules)
            {
               String fileName = mod.getFileName();
               if (fileName != null && (fileName = fileName.trim()).length() > 0)
               {
                  if (log.isTraceEnabled())
                     log.trace("Checking application.xml module: " + fileName);

                  VirtualFile module = file.getChild(fileName);
                  if (module.exists() == false)
                  {
                     throw new RuntimeException(fileName + " module listed in application.xml does not exist within .ear " + file.toURI());


                  }
                  // Ask the deployers to analyze this
                  if(structureContext.determineChildStructure(module) == false)
                  {
                     throw new RuntimeException(fileName
                           + " module listed in application.xml is not a recognized deployment, .ear: "
                           + file.getName());
                  }
               }
            }

            if (appMetaData.getModuleOrderEnum() == ModuleOrder.STRICT)
            {
               context.setComparatorClassName(RelativeDeploymentContextComparator.class.getName());
               int i = 0;
               for (ContextInfo ctx : structureContext.getMetaData().getContexts())
               {
                  ctx.setRelativeOrder(i++);
               }
View Full Code Here

      this.includeWebInfInClasspath = includeWebInfInClasspath;
   }

   public boolean doDetermineStructure(StructureContext structureContext) throws DeploymentException
   {
      ContextInfo context = null;
      VirtualFile file = structureContext.getFile();
      try
      {
         boolean trace = log.isTraceEnabled();
View Full Code Here

      return name.endsWith(".war");
   }

   public boolean doDetermineStructure(StructureContext structureContext) throws DeploymentException
   {
      ContextInfo context = null;
      VirtualFile file = structureContext.getFile();
      try
      {
         boolean trace = log.isTraceEnabled();
View Full Code Here

      this.includeWebInfInClasspath = includeWebInfInClasspath;
   }

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

      return checkFileMatchers(file);
   }

   public boolean determineStructure(StructureContext structureContext) throws DeploymentException
   {
      ContextInfo context = null;
      VirtualFile file = structureContext.getFile();
      try
      {
         boolean trace = log.isTraceEnabled();
         if (isLeaf(file) == true)
View Full Code Here

         JarUtils.removeJarSuffix(extension);
   }

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

      if (obj == this)
         return true;
      if (obj == null || obj instanceof ContextInfo == false)
         return false;
     
      ContextInfo other = (ContextInfo) obj;
      if (getPath().equals(other.getPath()) == false)
         return false;

      List<String> thisMetaDataPath = getMetaDataPath();
      List<String> otherMetaDataPath = other.getMetaDataPath();
      if (thisMetaDataPath.equals(otherMetaDataPath) == false)
         return false;

      List<ClassPathEntry> thisClassPath = getClassPath();
      List<ClassPathEntry> otherClassPath = other.getClassPath();
      if (thisClassPath == null)
         return otherClassPath == null;
      return thisClassPath.equals(otherClassPath);
   }
View Full Code Here

      VirtualFile file = structureContext.getFile();

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

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

         if (rootClasspathEntry)
View Full Code Here

TOP

Related Classes of org.jboss.deployers.spi.structure.ContextInfo

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.