Examples of ResourceFinder


Examples of org.apache.xbean.finder.ResourceFinder

        public ServiceFinder(String basePath) {
            this(basePath, Thread.currentThread().getContextClassLoader());
        }

        public ServiceFinder(String basePath, ClassLoader classLoader) {
            this.resourceFinder = new ResourceFinder(basePath, classLoader);
            this.classLoader = classLoader;
        }
View Full Code Here

Examples of org.apache.xbean.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.xbean.finder.ResourceFinder

            // doesn't exist, don't bother
            return;
        }

        try {
            ResourceFinder finder = new ResourceFinder("");
            String defaultProperties = finder.findString("default.instantdb.properties");
            IO.copy(defaultProperties.getBytes(), file);
        } catch (IOException e) {
            // TODO; Handle this
            e.printStackTrace();
        }
View Full Code Here

Examples of org.apache.xbean.finder.ResourceFinder

    public static ServicesJar readServicesJar(String providerName) throws OpenEJBException {
        InputStream in = null;
        URL url = null;
        try {
            ResourceFinder finder = new ResourceFinder("META-INF/", Thread.currentThread().getContextClassLoader());
            String resourceName = providerName + "/service-jar.xml";
            try {
                url = finder.find(resourceName);
            } catch (IOException e) {
                //Make sure the default service-jar shipped with openejb-core could be read
                finder = new ResourceFinder("META-INF/", JaxbOpenejb.class.getClassLoader());
                url = finder.find(resourceName);
            }
            in = IO.read(url);
            ServicesJar servicesJar = parseServicesJar(in);
            return servicesJar;
        } catch (MalformedURLException e) {
View Full Code Here

Examples of org.apache.xbean.finder.ResourceFinder

            for (String path : manifestcp) {
                path = path.replaceAll(" ", "%20");
                URL url = moduleBaseURI.resolve(path).toURL();
                urls[i++] = url;
            }
            ResourceFinder finder = new ResourceFinder("", null, urls);
            List<URL> knownPersistenceUrls = (List<URL>) rootGeneralData.get(PersistenceUnitBuilder.class.getName());
            if (knownPersistenceUrls == null) {
                knownPersistenceUrls = new ArrayList<URL>();
                rootGeneralData.put(PersistenceUnitBuilder.class.getName(), knownPersistenceUrls);
            }
            List<URL> persistenceUrls = finder.findAll("META-INF/persistence.xml");
            persistenceUrls.removeAll(knownPersistenceUrls);
            if (raws.length > 0 || persistenceUrls.size() > 0) {
                EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);
            }
            for (URL persistenceUrl : persistenceUrls) {
View Full Code Here

Examples of org.apache.xbean.finder.ResourceFinder

            for (String path : manifestcp) {
                path = path.replaceAll(" ", "%20");
                URL url = moduleBaseURI.resolve(path).toURL();
                urls[i++] = url;
            }
            ResourceFinder finder = new ResourceFinder("", null, urls);
            List<URL> knownPersistenceUrls = (List<URL>) rootGeneralData.get(PersistenceUnitBuilder.class.getName());
            if (knownPersistenceUrls == null) {
                knownPersistenceUrls = new ArrayList<URL>();
                rootGeneralData.put(PersistenceUnitBuilder.class.getName(), knownPersistenceUrls);
            }
            List<URL> persistenceUrls = finder.findAll("META-INF/persistence.xml");
            persistenceUrls.removeAll(knownPersistenceUrls);
            if (raws.length > 0 || persistenceUrls.size() > 0) {
                EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);
            }
            for (URL persistenceUrl : persistenceUrls) {
View Full Code Here

Examples of org.apache.xbean.finder.ResourceFinder

        XmlObject[] raws = container.selectChildren(PERSISTENCE_QNAME);
        for (XmlObject raw : raws) {
            PersistenceDocument.Persistence persistence = (PersistenceDocument.Persistence) raw.copy().changeType(PersistenceDocument.Persistence.type);
            buildPersistenceUnits(persistence, moduleContext, null, null);
        }
        ResourceFinder finder = new ResourceFinder("", moduleContext.getClassLoader(), null);
        try {
            //TODO the code that figures out the persistence unit name is incomplete
            URI baseURI = moduleContext.getBaseDir().toURI();
            String base = baseURI.toString();
            Map generalData = ((EARContext) applicationContext).getGeneralData();
            List<URL> knownPersistenceUrls = (List<URL>) generalData.get(PersistenceUnitBuilder.class.getName());
            if (knownPersistenceUrls == null) {
                knownPersistenceUrls = new ArrayList<URL>();
                generalData.put(PersistenceUnitBuilder.class.getName(), knownPersistenceUrls);
            }
            List<URL> persistenceUrls = finder.findAll("META-INF/persistence.xml");
            persistenceUrls.removeAll(knownPersistenceUrls);
            for (URL persistenceUrl: persistenceUrls) {
                String persistenceLocation;
                try {
                     persistenceLocation = persistenceUrl.toURI().toString();
View Full Code Here

Examples of org.apache.xbean.finder.ResourceFinder

            for (String path : manifestcp) {
                path = path.replaceAll(" ", "%20");
                URL url = moduleBaseURI.resolve(path).toURL();
                urls[i++] = url;
            }
            ResourceFinder finder = new ResourceFinder("", null, urls);
            List<URL> knownPersistenceUrls = (List<URL>) rootGeneralData.get(PersistenceUnitBuilder.class.getName());
            if (knownPersistenceUrls == null) {
                knownPersistenceUrls = new ArrayList<URL>();
                rootGeneralData.put(PersistenceUnitBuilder.class.getName(), knownPersistenceUrls);
            }
            List<URL> persistenceUrls = finder.findAll("META-INF/persistence.xml");
            persistenceUrls.removeAll(knownPersistenceUrls);
            if (raws.length > 0 || persistenceUrls.size() > 0) {
                EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);
            }
            for (URL persistenceUrl : persistenceUrls) {
View Full Code Here

Examples of org.apache.xbean.finder.ResourceFinder



            detectTempClassLoader = ClassLoaderUtil.createTempClassLoader(ClassLoaderUtil.createClassLoader(jarPath, libURLs.toArray(new URL[0]), OpenEJB.class.getClassLoader()));

            ResourceFinder finder = new ResourceFinder("", detectTempClassLoader, baseUrl);

            descriptors = finder.getResourcesMap(ddDir);

            // The ResourceFinder.getResourcesMap() method does not work if the jar in question
            // does not properly have "directories" and only has file entries.  So we as a backup
            // measure will explicitly look for specific known descriptor files and add them if
            // the getResourcesMap() method was unable to find them.  In this "bad jar" scenario
            // some extra features such as the openejb.altdd.prefix functionality will not work.

            String[] doubleCheck = {"ejb-jar.xml", "geronimo-openejb.xml", "openejb-jar.xml", "beans.xml", "env-entries.properties", "web.xml"};

            for (String entry : doubleCheck) {
                try {
                    final URL url = finder.find(ddDir + entry);
                    if (url == null) continue;
                    if (descriptors.containsKey(entry)) continue;
                    descriptors.put(entry, url);
                } catch (IOException descriptorNotFound) {
                    // ignore
View Full Code Here

Examples of org.apache.xbean.finder.ResourceFinder

    }

    private static void availableCiphers() {
        try {
            ResourceFinder finder = new ResourceFinder("META-INF/");
            Map<String, Class> impls = finder.mapAllImplementations(PasswordCipher.class);
            System.out.println("Available ciphers are: "+ Join.join(", ", impls.keySet()));
        } catch (Exception dontCare) {
        }
    }
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.