Package org.jboss.gravia.provision

Examples of org.jboss.gravia.provision.ProvisionException


        Bundle bundle;
        try {
            String location = "resource#" + resid;
            bundle = context.installBundle(location, content.getContent());
        } catch (BundleException ex) {
            throw new ProvisionException(ex);
        }

        // Start the bundle. This relies on provision ordering.
        ThreadResourceAssociation.putResource(resource);
        try {
            bundle.start();
        } catch (BundleException ex) {
            // The start exception must be reported back to the client
            // WildFly also relies on provision ordering.
            throw new ProvisionException(ex);
        } finally {
            ThreadResourceAssociation.removeResource();
        }

        // Install the bundle as module if it has not already happened
        // A bundle that could not get resolved will not have an associated module
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        Module module = runtime.getModule(resid);
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        if (module == null && wiring != null) {
            try {
                ClassLoader classLoader = wiring.getClassLoader();
                module = runtime.installModule(classLoader, resource, null);
            } catch (ModuleException ex) {
                throw new ProvisionException(ex);
            }
        }

        // Installing a bundle does not trigger a {@link ModuleEvent#INSTALLED}
        // event because the Bundle's class loader is not (yet) available
View Full Code Here


        Bundle bundle;
        try {
            String location = "resource#" + resid;
            bundle = context.installBundle(location, content.getContent());
        } catch (BundleException ex) {
            throw new ProvisionException(ex);
        }

        // Start the bundle. This relies on provision ordering.
        ThreadResourceAssociation.putResource(resource);
        try {
            bundle.start();
        } catch (BundleException ex) {
            // The start exception must be reported back to the client
            // WildFly also relies on provision ordering.
            throw new ProvisionException(ex);
        } finally {
            ThreadResourceAssociation.removeResource();
        }

        // Install the bundle as module if it has not already happened
        // A bundle that could not get resolved will not have an associated module
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        Module module = runtime.getModule(resid);
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        if (module == null && wiring != null) {
            try {
                ClassLoader classLoader = wiring.getClassLoader();
                module = runtime.installModule(classLoader, resource, null);
            } catch (ModuleException ex) {
                throw new ProvisionException(ex);
            }
        }

        // Installing a bundle does not trigger a {@link ModuleEvent#INSTALLED}
        // event because the Bundle's class loader is not (yet) available
View Full Code Here

        Environment envclone = env.cloneEnvironment();
        ProvisionResult result = findResources(envclone, reqs);

        Set<Requirement> unsatisfied = result.getUnsatisfiedRequirements();
        if (!unsatisfied.isEmpty()) {
            throw new ProvisionException("Cannot resolve unsatisfied requirements: " + unsatisfied);
        }

        // NOTE: installing resources and updating the wiring is not an atomic operation

        // Install resources
View Full Code Here

        } catch (RuntimeException rte) {
            throw rte;
        } catch (ProvisionException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new ProvisionException("Cannot provision resource: " + resource, ex);
        }
    }
View Full Code Here

        Bundle bundle;
        try {
            String location = "resource://" + getRuntimeName(resource, false);
            bundle = context.installBundle(location, content.getContent());
        } catch (BundleException ex) {
            throw new ProvisionException(ex);
        }

        // Start the bundle. This relies on provision ordering.
        ThreadResourceAssociation.putResource(resource);
        try {
            bundle.start();
        } catch (BundleException ex) {
            // The start exception must be reported back to the client
            // WildFly also relies on provision ordering.
            throw new ProvisionException(ex);
        } finally {
            ThreadResourceAssociation.removeResource();
        }

        // Install the bundle as module if it has not already happened
        // A bundle that could not get resolved will not have an associated module
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        Module module = runtime.getModule(identity);
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        if (module == null && wiring != null) {
            try {
                ClassLoader classLoader = wiring.getClassLoader();
                module = runtime.installModule(classLoader, resource, null);
            } catch (ModuleException ex) {
                throw new ProvisionException(ex);
            }
        }

        // Installing a bundle does not trigger a {@link ModuleEvent#INSTALLED}
        // event because the Bundle's class loader is not (yet) available
View Full Code Here

        // Find resources
        ProvisionResult result = findResources(reqs);
        Set<Requirement> unsatisfied = result.getUnsatisfiedRequirements();
        if (!unsatisfied.isEmpty()) {
            throw new ProvisionException("Cannot resolve unsatisfied requirements: " + unsatisfied);
        }

        // NOTE: installing resources and updating the wiring is not an atomic operation

        // Install resources
View Full Code Here

        } catch (RuntimeException rte) {
            throw rte;
        } catch (ProvisionException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new ProvisionException("Cannot provision resource: " + resource, ex);
        }
    }
View Full Code Here

        Environment envclone = env.cloneEnvironment();
        ProvisionResult result = findResources(envclone, reqs);

        Set<Requirement> unsatisfied = result.getUnsatisfiedRequirements();
        if (!unsatisfied.isEmpty()) {
            throw new ProvisionException("Cannot resolve unsatisfied requirements: " + unsatisfied);
        }

        // NOTE: installing resources and updating the wiring is not an atomic operation

        // Install resources
View Full Code Here

        InputStream content = resource.adapt(ResourceContent.class).getContent();
        Bundle bundle;
        try {
            bundle = context.installBundle(identity.toString(), content);
        } catch (BundleException ex) {
            throw new ProvisionException(ex);
        }

        // Attempt to start the bundle. This relies on provision ordering.
        ThreadResourceAssociation.putResource(resource);
        try {
            bundle.start();
        } catch (BundleException ex) {
            // ignore
        } finally {
            ThreadResourceAssociation.removeResource();
        }

        // Install the bundle as module if it has not already happened
        // A bundle that could not get resolved will have no associated module
        Runtime runtime = RuntimeLocator.getRequiredRuntime();
        Module module = runtime.getModule(identity);
        BundleWiring wiring = bundle.adapt(BundleWiring.class);
        if (module == null && wiring != null) {
            try {
                ClassLoader classLoader = wiring.getClassLoader();
                module = runtime.installModule(classLoader, resource, null);
            } catch (ModuleException ex) {
                throw new ProvisionException(ex);
            }
        }

        // Installing a bundle does not trigger a {@link ModuleEvent#INSTALLED}
        // event because the Bundle's class loader is not (yet) available
View Full Code Here

        // Find resources
        ProvisionResult result = findResources(reqs);
        Set<Requirement> unsatisfied = result.getUnsatisfiedRequirements();
        if (!unsatisfied.isEmpty()) {
            throw new ProvisionException("Cannot resolve unsatisfied requirements: " + unsatisfied);
        }

        // NOTE: installing resources and updating the wiring is not an atomic operation

        // Install resources
View Full Code Here

TOP

Related Classes of org.jboss.gravia.provision.ProvisionException

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.