Examples of ResourceFinder


Examples of org.apache.axis2.metadata.resource.ResourceFinder

    }
    private URL getURLFromJAR(URLClassLoader urlLoader, URL relativeURL) {

      URL[] urlList = null;
      ResourceFinderFactory rff =(ResourceFinderFactory)MetadataFactoryRegistry.getFactory(ResourceFinderFactory.class);
      ResourceFinder cf = rff.getResourceFinder();
      urlList = cf.getURLs(urlLoader);
      if(urlList == null){
          if(log.isDebugEnabled()){
              log.debug("No URL's found in URL ClassLoader");
          }
          ExceptionFactory.makeWebServiceException(Messages.getMessage("WSDL4JWrapperErr1"));
View Full Code Here

Examples of org.apache.axis2.metadata.resource.ResourceFinder

    }
   
    private URL getURLFromJAR(URLClassLoader urlLoader, URL relativeURL) {
        URL[] urlList = null;
        ResourceFinderFactory rff =(ResourceFinderFactory)MetadataFactoryRegistry.getFactory(ResourceFinderFactory.class);
        ResourceFinder cf = rff.getResourceFinder();
        if (log.isDebugEnabled()) {
            log.debug("ResourceFinderFactory: " + rff.getClass().getName());
            log.debug("ResourceFinder: " + cf.getClass().getName());
        }
       
        urlList = cf.getURLs(urlLoader);
        if(urlList == null){
            if(log.isDebugEnabled()){
                log.debug("No URL's found in URL ClassLoader");
            }
            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("WSDL4JWrapperErr1"));
View Full Code Here

Examples of org.apache.cayenne.conf.ResourceFinder

     * @deprecated since 3.1 {@link #loadDataMap(InputSource)} should be used.
     */
    @Deprecated
    public DataMap loadDataMap(String uri) throws CayenneRuntimeException {
        // configure resource locator
        ResourceFinder locator = createResourceFinder();
        URL url = locator.getResource(uri);
        if (url == null) {
            throw new CayenneRuntimeException("Can't find data map " + uri);
        }

        InputStream in;
View Full Code Here

Examples of org.apache.openejb.client.ResourceFinder

    public ClientVersion() {
        Properties info = new Properties();

        try {
            final ResourceFinder finder = new ResourceFinder();
            info = finder.findProperties("openejb-client-version.properties");
        } catch (final java.io.IOException e) {
            e.printStackTrace();
        }

        version = info.getProperty("version");
View Full Code Here

Examples of org.apache.openejb.finder.ResourceFinder

    private OpenEjbVersion() {
        Properties info = new Properties();

        try {
            ResourceFinder finder = new ResourceFinder();
            info = finder.findProperties("openejb-version.properties");
        } catch (java.io.IOException e) {
            e.printStackTrace();
        }

        copyright = info.getProperty("copyright");
View Full Code Here

Examples of org.apache.openejb.finder.ResourceFinder

        URL appUrl = getFileUrl(appDir);

        String appId = appDir.getAbsolutePath();
        ClassLoader tmpClassLoader = ClassLoaderUtil.createTempClassLoader(appId, new URL[]{appUrl}, OpenEJB.class.getClassLoader());

        ResourceFinder finder = new ResourceFinder("", tmpClassLoader, appUrl);

        Map<String, URL> appDescriptors;
        try {
            appDescriptors = finder.getResourcesMap("META-INF");
        } catch (IOException e) {
            throw new OpenEJBException("Unable to determine descriptors in jar: " + appUrl.toExternalForm(), e);
        }

        try {

            //
            // Find all the modules using either the application xml or by searching for all .jar, .war and .rar files.
            //

            Map<String, URL> ejbModules = new HashMap<String, URL>();
            Map<String, URL> clientModules = new HashMap<String, URL>();
            Map<String, URL> resouceModules = new HashMap<String, URL>();
            Map<String, URL> webModules = new HashMap<String, URL>();
            Map<String, String> webContextRoots = new HashMap<String, String>();

            URL applicationXmlUrl = appDescriptors.get("application.xml");

            Application application;
            if (applicationXmlUrl != null) {
                application = unmarshal(Application.class, "application.xml", applicationXmlUrl);
                for (Module module : application.getModule()) {
                    try {
                        if (module.getEjb() != null) {
                            URL url = finder.find(module.getEjb().trim());
                            ejbModules.put(module.getEjb(), url);
                        } else if (module.getJava() != null) {
                            URL url = finder.find(module.getJava().trim());
                            clientModules.put(module.getConnector(), url);
                        } else if (module.getConnector() != null) {
                            URL url = finder.find(module.getConnector().trim());
                            resouceModules.put(module.getConnector(), url);
                        } else if (module.getWeb() != null) {
                            URL url = finder.find(module.getWeb().getWebUri().trim());
                            webModules.put(module.getWeb().getWebUri(), url);
                            webContextRoots.put(module.getWeb().getWebUri(), module.getWeb().getContextRoot());
                        }
                    } catch (IOException e) {
                        throw new OpenEJBException("Invalid path to module " + e.getMessage(), e);
                    }
                }
            } else {
                application = new Application();
                HashMap<String, URL> files = new HashMap<String, URL>();
                scanDir(appDir, files, "");
                files.remove("META-INF/MANIFEST.MF");
                for (Map.Entry<String, URL> entry : files.entrySet()) {
                    if (entry.getKey().startsWith("lib/")) continue;
                    if (!entry.getKey().matches(".*\\.(jar|war|rar|ear)")) continue;

                    try {
                        ClassLoader moduleClassLoader = ClassLoaderUtil.createTempClassLoader(appId, new URL[]{entry.getValue()}, tmpClassLoader);

                        Class moduleType = discoverModuleType(entry.getValue(), moduleClassLoader, true);
                        if (EjbModule.class.equals(moduleType)) {
                            ejbModules.put(entry.getKey(), entry.getValue());
                        } else if (ClientModule.class.equals(moduleType)) {
                            clientModules.put(entry.getKey(), entry.getValue());
                        } else if (ConnectorModule.class.equals(moduleType)) {
                            resouceModules.put(entry.getKey(), entry.getValue());
                        } else if (WebModule.class.equals(moduleType)) {
                            webModules.put(entry.getKey(), entry.getValue());
                        }
                    } catch (UnsupportedOperationException e) {
                        // Ignore it as per the javaee spec EE.8.4.2 section 1.d.iiilogger.info("Ignoring unknown module type: "+entry.getKey());
                    } catch (Exception e) {
                        throw new OpenEJBException("Unable to determine the module type of " + entry.getKey() + ": Exception: " + e.getMessage(), e);
                    }
                }
            }

            //
            // Create a class loader for the application
            //

            // lib/*
            if (application.getLibraryDirectory() == null) {
                application.setLibraryDirectory("lib/");
            } else {
                String dir = application.getLibraryDirectory();
                if (!dir.endsWith("/")) application.setLibraryDirectory(dir + "/");
            }
            List<URL> extraLibs = new ArrayList<URL>();
            try {
                Map<String, URL> libs = finder.getResourcesMap(application.getLibraryDirectory());
                extraLibs.addAll(libs.values());
            } catch (IOException e) {
                logger.warning("Cannot load libs from '" + application.getLibraryDirectory() + "' : " + e.getMessage(), e);
            }

            // APP-INF/lib/*
            try {
                Map<String, URL> libs = finder.getResourcesMap("APP-INF/lib/");
                extraLibs.addAll(libs.values());
            } catch (IOException e) {
                logger.warning("Cannot load libs from 'APP-INF/lib/' : " + e.getMessage(), e);
            }

            // META-INF/lib/*
            try {
                Map<String, URL> libs = finder.getResourcesMap("META-INF/lib/");
                extraLibs.addAll(libs.values());
            } catch (IOException e) {
                logger.warning("Cannot load libs from 'META-INF/lib/' : " + e.getMessage(), e);
            }

View Full Code Here

Examples of org.apache.openejb.finder.ResourceFinder

            throw e;
        }
    }

    protected static ClientModule createClientModule(URL clientUrl, String absolutePath, ClassLoader appClassLoader, String moduleName) throws IOException, OpenEJBException {
        ResourceFinder clientFinder = new ResourceFinder(clientUrl);

        URL manifestUrl = clientFinder.find("META-INF/MANIFEST.MF");
        InputStream is = manifestUrl.openStream();
        Manifest manifest = new Manifest(is);
        String mainClass = manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);

        if (mainClass == null) throw new IllegalStateException("No Main-Class defined in META-INF/MANIFEST.MF file");
View Full Code Here

Examples of org.apache.openejb.finder.ResourceFinder

    @SuppressWarnings({"unchecked"})
    protected static void addPersistenceUnits(AppModule appModule, URL... urls) {
        try {
            // any class loader will do here since we are not calling class loading methods of resource finder
            ResourceFinder finder = new ResourceFinder("", ClassLoader.getSystemClassLoader(), urls);
            List<URL> persistenceUrls = (List<URL>) appModule.getAltDDs().get("persistence.xml");
            if (persistenceUrls == null) {
                persistenceUrls = new ArrayList<URL>();
                appModule.getAltDDs().put("persistence.xml", persistenceUrls);
            }
            persistenceUrls.addAll(finder.findAll("META-INF/persistence.xml"));
        } catch (IOException e) {
            logger.warning("Cannot load persistence-units from 'META-INF/persistence.xml' : " + e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.apache.openejb.finder.ResourceFinder

        }
    }

    private static Map<String, URL> getDescriptors(URL moduleUrl) throws OpenEJBException {
        try {
            ResourceFinder finder = new ResourceFinder(moduleUrl);

            return finder.getResourcesMap("META-INF/");

        } catch (IOException e) {
            throw new OpenEJBException("Unable to determine descriptors in jar.", e);
        }
    }
View Full Code Here

Examples of org.apache.openejb.finder.ResourceFinder

        }
    }


    public static Class<? extends DeploymentModule> discoverModuleType(URL baseUrl, ClassLoader classLoader, boolean searchForDescriptorlessApplications) throws IOException, UnknownModuleTypeException {
        ResourceFinder finder = new ResourceFinder("", classLoader, baseUrl);

        Map<String, URL> descriptors = finder.getResourcesMap("META-INF");

        String path = baseUrl.getPath();
        if (path.endsWith("/")) path = path.substring(0, path.length() - 1);

        if (descriptors.containsKey("application.xml") || path.endsWith(".ear")) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.