Package org.jboss.gravia.repository

Examples of org.jboss.gravia.repository.DefaultRepositoryXMLReader


    }

    public RuntimeEnvironment initDefaultContent(InputStream content) {
        IllegalArgumentAssertion.assertNotNull(content, "content");
        try {
            RepositoryReader reader = new DefaultRepositoryXMLReader(content);
            Resource xmlres = reader.nextResource();
            while (xmlres != null) {
                systemStore.addResource(xmlres);
                xmlres = reader.nextResource();
            }
        } finally {
            IOUtils.safeClose(content);
        }
        return this;
View Full Code Here


        Set<ResourceIdentity> result = new HashSet<>();
        if (resurl != null) {
            InputStream input = resurl.openStream();
            RepositoryMBean repository = MBeanProxy.get(context.getMBeanServer(), RepositoryMBean.OBJECT_NAME, RepositoryMBean.class);
            try {
                RepositoryReader reader = new DefaultRepositoryXMLReader(input);
                Resource auxres = reader.nextResource();
                while (auxres != null) {
                    ResourceIdentity identity = auxres.getIdentity();
                    if (repository.getResource(identity.getCanonicalForm()) == null) {
                        repository.addResource(auxres.adapt(CompositeData.class));
                        result.add(identity);
                    }
                    auxres = reader.nextResource();
                }
            } finally {
                IOUtils.safeClose(input);
            }
        }
View Full Code Here

    }

    public RuntimeEnvironment initDefaultContent(InputStream content) {
        IllegalArgumentAssertion.assertNotNull(content, "content");
        try {
            RepositoryReader reader = new DefaultRepositoryXMLReader(content);
            Resource xmlres = reader.nextResource();
            while (xmlres != null) {
                systemStore.addResource(xmlres);
                xmlres = reader.nextResource();
            }
        } finally {
            IOUtils.safeClose(content);
        }
        return this;
View Full Code Here

    protected void setupRepositoryContent(MBeanServerConnection server, RepositoryMBean repository, Map<String, String> props) throws IOException {
        for (String name : getInitialFeatureNames()) {
            String resname = "META-INF/repository-content/" + name + ".feature.xml";
            URL resurl = getClass().getClassLoader().getResource(resname);
            InputStream input = resurl.openStream();
            RepositoryReader reader = new DefaultRepositoryXMLReader(input);
            Resource auxres = reader.nextResource();
            while (auxres != null) {
                String identity = auxres.getIdentity().toString();
                if (repository.getResource(identity) == null) {
                    repository.addResource(auxres.adapt(CompositeData.class));
                }
                auxres = reader.nextResource();
            }
        }
    }
View Full Code Here

    protected void removeRepositoryContent(MBeanServerConnection server, RepositoryMBean repository, Map<String, String> props) throws IOException {
        for (String name : getInitialFeatureNames()) {
            String resname = "META-INF/repository-content/" + name + ".feature.xml";
            URL resurl = getClass().getClassLoader().getResource(resname);
            InputStream input = resurl.openStream();
            RepositoryReader reader = new DefaultRepositoryXMLReader(input);
            Resource auxres = reader.nextResource();
            while (auxres != null) {
                String identity = auxres.getIdentity().toString();
                repository.removeResource(identity);
                auxres = reader.nextResource();
            }
        }
    }
View Full Code Here

        Set<ResourceIdentity> result = new HashSet<>();
        if (resurl != null) {
            InputStream input = resurl.openStream();
            RepositoryMBean repository = MBeanProxy.get(context.getMBeanServer(), RepositoryMBean.OBJECT_NAME, RepositoryMBean.class);
            try {
                RepositoryReader reader = new DefaultRepositoryXMLReader(input);
                Resource auxres = reader.nextResource();
                while (auxres != null) {
                    ResourceIdentity identity = auxres.getIdentity();
                    if (repository.getResource(identity.getCanonicalForm()) == null) {
                        repository.addResource(auxres.adapt(CompositeData.class));
                        result.add(identity);
                    }
                    auxres = reader.nextResource();
                }
            } finally {
                IOUtils.safeClose(input);
            }
        }
View Full Code Here

    }

    public RuntimeEnvironment initDefaultContent(InputStream content) {
        NotNullException.assertValue(content, "content");
        try {
            RepositoryReader reader = new DefaultRepositoryXMLReader(content);
            Resource xmlres = reader.nextResource();
            while (xmlres != null) {
                systemStore.addResource(xmlres);
                xmlres = reader.nextResource();
            }
        } finally {
            IOUtils.safeClose(content);
        }
        return this;
View Full Code Here

    }

    public RuntimeEnvironment initDefaultContent(InputStream content) {
        NotNullException.assertValue(content, "content");
        try {
            RepositoryReader reader = new DefaultRepositoryXMLReader(content);
            Resource xmlres = reader.nextResource();
            while (xmlres != null) {
                systemStore.addResource(xmlres);
                xmlres = reader.nextResource();
            }
        } finally {
            IOUtils.safeClose(content);
        }
        return this;
View Full Code Here

        Iterator<Resource> itres = classLoader.iterateResources("META-INF/repository-content", false);
        while(itres.hasNext()) {
            Resource res = itres.next();
            try {
                InputStream input = res.openStream();
                RepositoryReader reader = new DefaultRepositoryXMLReader(input);
                org.jboss.gravia.resource.Resource auxres = reader.nextResource();
                while (auxres != null) {
                    if (storage.getResource(auxres.getIdentity()) == null) {
                        storage.addResource(auxres);
                    }
                    auxres = reader.nextResource();
                }
            } catch (IOException e) {
                throw new IllegalStateException("Cannot install feature to repository: " + res.getName());
            }
        }
View Full Code Here

        Iterator<Resource> itres = classLoader.iterateResources("META-INF/environment-content", false);
        while(itres.hasNext()) {
            Resource modres = itres.next();
            try {
                InputStream input = modres.openStream();
                RepositoryReader reader = new DefaultRepositoryXMLReader(input);
                org.jboss.gravia.resource.Resource xmlres = reader.nextResource();
                while (xmlres != null) {
                    if (environment.getResource(xmlres.getIdentity()) == null) {
                        DefaultResourceBuilder builder = new DefaultResourceBuilder();
                        for (Capability cap : xmlres.getCapabilities(null)) {
                            builder.addCapability(cap.getNamespace(), cap.getAttributes(), cap.getDirectives());
                        }
                        for (Requirement req : xmlres.getRequirements(null)) {
                            builder.addCapability(req.getNamespace(), req.getAttributes(), req.getDirectives());
                        }
                        environment.addResource(builder.getResource());
                    }
                    xmlres = reader.nextResource();
                }
            } catch (IOException e) {
                throw new IllegalStateException("Cannot install resource to environment: " + modres.getName());
            }
        }
View Full Code Here

TOP

Related Classes of org.jboss.gravia.repository.DefaultRepositoryXMLReader

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.