Package org.jboss.net.protocol

Examples of org.jboss.net.protocol.URLListerFactory


    */
   protected void parseXMLClasspath(DeploymentInfo di)
      throws Exception
   {
      ArrayList classpath = new ArrayList();
      URLListerFactory listerFactory = new URLListerFactory();

      NodeList children = di.document.getDocumentElement().getChildNodes();
      for (int i = 0; i < children.getLength(); i++)
      {
         if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
         {
            Element classpathElement = (Element)children.item(i);
            if (classpathElement.getTagName().equals("classpath"))
            {
               log.debug("Found classpath element: " + classpathElement);
               if (!classpathElement.hasAttribute("codebase"))
               {
                  throw new DeploymentException
                     ("Invalid classpath element missing codebase: " + classpathElement);
               }
               String codebase = classpathElement.getAttribute("codebase").trim();
               // Replace any system property references like ${x}
               codebase = StringPropertyReplacer.replaceProperties(codebase);

               String archives = null;
               if (classpathElement.hasAttribute("archives"))
               {
                  archives = classpathElement.getAttribute("archives").trim();
                  // Replace any system property references like ${x}
                  archives = StringPropertyReplacer.replaceProperties(archives);
                  if ("".equals(archives))
                  {
                     archives = null;
                  }
               }

               // Convert codebase to a URL
               // "." is resolved relative to the deployment
               // other URLs are resolved relative to SERVER_HOME
               URL codebaseUrl;
               if (".".equals(codebase))
               {
                  codebaseUrl = new URL(di.url, "./");
               }
               else
               {
                  if (archives != null && codebase.endsWith("/") == false)
                  {
                     codebase += "/";
                  }
                  codebaseUrl = new URL(serverHomeURL, codebase);
               }
               log.debug("codebase URL is " + codebaseUrl);

               if (archives == null)
               {
                  // archives not supplied so add the codebase itself
                  classpath.add(codebaseUrl);
                  log.debug("added codebase to classpath");
               }
               else
               {
                  // obtain a URLLister for the codebase and use it to obtain
                  // the list of URLs to add
                  log.debug("listing codebase for archives matching " + archives);
                  URLLister lister = listerFactory.createURLLister(codebaseUrl);
                  log.debug("URLLister class is " + lister.getClass().getName());
                  classpath.addAll(lister.listMembers(codebaseUrl, archives));
               }
            } // end of if ()

View Full Code Here


/*     */
/*     */   protected void parseXMLClasspath(DeploymentInfo di)
/*     */     throws Exception
/*     */   {
/* 494 */     ArrayList classpath = new ArrayList();
/* 495 */     URLListerFactory listerFactory = new URLListerFactory();
/*     */
/* 497 */     NodeList children = di.document.getDocumentElement().getChildNodes();
/* 498 */     for (int i = 0; i < children.getLength(); i++)
/*     */     {
/* 500 */       if (children.item(i).getNodeType() != 1)
/*     */         continue;
/* 502 */       Element classpathElement = (Element)children.item(i);
/* 503 */       if (!classpathElement.getTagName().equals("classpath"))
/*     */         continue;
/* 505 */       this.log.debug("Found classpath element: " + classpathElement);
/* 506 */       if (!classpathElement.hasAttribute("codebase"))
/*     */       {
/* 508 */         throw new DeploymentException("Invalid classpath element missing codebase: " + classpathElement);
/*     */       }
/*     */
/* 511 */       String codebase = classpathElement.getAttribute("codebase").trim();
/*     */
/* 513 */       codebase = StringPropertyReplacer.replaceProperties(codebase);
/*     */
/* 515 */       String archives = null;
/* 516 */       if (classpathElement.hasAttribute("archives"))
/*     */       {
/* 518 */         archives = classpathElement.getAttribute("archives").trim();
/*     */
/* 520 */         archives = StringPropertyReplacer.replaceProperties(archives);
/* 521 */         if ("".equals(archives))
/*     */         {
/* 523 */           archives = null;
/*     */         }
/*     */       }
/*     */       URL codebaseUrl;
/*     */       URL codebaseUrl;
/* 531 */       if (".".equals(codebase))
/*     */       {
/* 533 */         codebaseUrl = new URL(di.url, "./");
/*     */       }
/*     */       else
/*     */       {
/* 537 */         if ((archives != null) && (!codebase.endsWith("/")))
/*     */         {
/* 539 */           codebase = codebase + "/";
/*     */         }
/* 541 */         codebaseUrl = new URL(this.serverHomeURL, codebase);
/*     */       }
/* 543 */       this.log.debug("codebase URL is " + codebaseUrl);
/*     */
/* 545 */       if (archives == null)
/*     */       {
/* 548 */         classpath.add(codebaseUrl);
/* 549 */         this.log.debug("added codebase to classpath");
/*     */       }
/*     */       else
/*     */       {
/* 555 */         this.log.debug("listing codebase for archives matching " + archives);
/* 556 */         URLLister lister = listerFactory.createURLLister(codebaseUrl);
/* 557 */         this.log.debug("URLLister class is " + lister.getClass().getName());
/* 558 */         classpath.addAll(lister.listMembers(codebaseUrl, archives));
/*     */       }
/*     */
/*     */     }
View Full Code Here

/*     */
/*  70 */     this.urlList = Collections.synchronizedList(new ArrayList());
/*     */
/*  73 */     this.deployedSet = Collections.synchronizedSet(new HashSet());
/*     */
/*  76 */     this.listerFactory = new URLListerFactory();
/*     */
/*  94 */     this.doRecursiveSearch = true;
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.net.protocol.URLListerFactory

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.