Package org.cruxframework.crux.classpath

Examples of org.cruxframework.crux.classpath.URLResourceHandler


      URL screenURL = null;
      InputStream inputStream = null;
     
      screenId = RegexpPatterns.REGEXP_BACKSLASH.matcher(screenId).replaceAll("/").replace(".html", ".crux.xml");

      URLResourceHandler resourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(webBaseDir.getProtocol());
      screenURL = resourceHandler.getChildResource(webBaseDir, screenId);
     
      URLStreamManager manager = new URLStreamManager(screenURL);
      inputStream = manager.open();
     
      try
View Full Code Here


   */
  private String getModuleName(URL parent, URL resource) throws URISyntaxException, IOException
  {
    String fileName;
   
    URLResourceHandler handler = URLResourceHandlersRegistry.getURLResourceHandler(resource.getProtocol());
    if (handler instanceof PackageFileURLResourceHandler)
    {
      PackageFileURLResourceHandler packagehandler = (PackageFileURLResourceHandler)handler;
      fileName = packagehandler.getPackageResourceName(resource);
     
View Full Code Here

   * @return
   */
  public URL getModuleRelativeURL(Module module, String path)
    {
      URL moduleRoot = module.getDescriptorURL();
    URLResourceHandler urlResourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(moduleRoot.getProtocol());
    moduleRoot = urlResourceHandler.getParentDir(moduleRoot);
    urlResourceHandler.getChildResource(moduleRoot, path);
      return moduleRoot;
    }
View Full Code Here

     
      if (moduleId != null)
      {
        Module module = Modules.getInstance().getModule(moduleId);
        URL moduleLocation = module.getLocation();
        URLResourceHandler resourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(moduleLocation.getProtocol());
        for(String publicPath: module.getPublicPaths())
        {
          extractFolderViews(result, resourceHandler.getChildResource(moduleLocation, publicPath), handler);
        }
      }
    }
     
    return result;
View Full Code Here

          }
        }
        else
        {
          URL rootURL = Modules.getInstance().getModuleRootURL(moduleId);
          URLResourceHandler urlResourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(rootURL.getProtocol());
          FilePatternHandler handler = new FilePatternHandler(viewsLocator, null);
          for (String path : module.getPublicPaths())
              {
            URL modulePublicPath = urlResourceHandler.getChildResource(rootURL, path);
            extractFolderViews(result, modulePublicPath, handler);
              }
        }
      }
    }
View Full Code Here

   * Initialize Crux Bridge
   * @param webInf
   */
  protected void initializeCruxBridge(URL webInf)
    {
    URLResourceHandler urlResourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(webInf.getProtocol());
    URL webInfClasses = urlResourceHandler.getChildResource(webInf, "classes/");
    URL webInfLib = urlResourceHandler.getChildResource(webInf, "lib/");
   
      CruxBridge.getInstance().registerWebinfClasses(webInfClasses.toString());
      CruxBridge.getInstance().registerWebinfLib(webInfLib.toString());
    ClassPathResolverInitializer.getClassPathResolver().initialize();
    }
View Full Code Here

    }
  }

  public static List<URL> search(URL baseLocation, final Filter filter) throws IOException
  {
    final URLResourceHandler resourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(baseLocation.getProtocol());
    List<ScannerRegistration> scanners = new ArrayList<ScannerRegistration>();
   
    ScannerRegistration scanner = new ScannerRegistration(new AbstractScanner()
    {
      @Override
      public Filter getScannerFilter()
      {
        return filter;
      }
      @Override
      public ScannerCallback getScannerCallback()
      {
          return null;
      }
     
      @Override
      public void resetScanner()
      {
      }
    });
    scanners.add(scanner);
   
    scanner.setScanned();
    scanner.startScanning();

    URLIterator iterator = resourceHandler.getDirectoryIteratorFactory().create(baseLocation, scanners);
    iterator.search();

    List<URL> result = new ArrayList<URL>();
   
    for (ScannerMatch match : scanner.getAllMatches())
View Full Code Here

  protected URL next()
  {
    if (closed || (next == null && !initial)) return null;
    setNext();
    if (next == null) return null;
    URLResourceHandler handler = URLResourceHandlersRegistry.getURLResourceHandler(getProtocol());
    return handler.getChildResource(zip, next.getName());
  }
View Full Code Here

    if (webBaseDir == null)
    {
      try
      {
        URL url = findWebInfClassesPath();
        URLResourceHandler resourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(url.getProtocol());

        if(resourceHandler == null)
        {
          throw new ClassPathResolverException("Cannot find resource based in the given URL protocol: " + url.getProtocol());
        }
       
        url = resourceHandler.getParentDir(url);
        url = resourceHandler.getParentDir(url);
        webBaseDir = url;
      }
      catch (Exception e)
      {
        throw new RuntimeException(e.getMessage(), e);
View Full Code Here

TOP

Related Classes of org.cruxframework.crux.classpath.URLResourceHandler

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.