Package com.sun.enterprise.module

Examples of com.sun.enterprise.module.ResolveError


     */
    public synchronized void resolve() throws ResolveError {
       
        // already resolved ?
        if (state==ModuleState.ERROR)
            throw new ResolveError("Module " + getName() + " is in ERROR state");
        if (state.compareTo(ModuleState.RESOLVED)>=0)
            return;

        if (state==ModuleState.PREPARING) {
            Utils.identifyCyclicDependency(this, Logger.getAnonymousLogger());
            throw new ResolveError("Cyclic dependency with " + getName());
        }
        state = ModuleState.PREPARING;
       
        if (moduleDef.getImportPolicyClassName()!=null) {
            try {
                Class<ImportPolicy> importPolicyClass = (Class<ImportPolicy>) getPrivateClassLoader().loadClass(moduleDef.getImportPolicyClassName());
                ImportPolicy importPolicy = importPolicyClass.newInstance();
                importPolicy.prepare(this);
            } catch(ClassNotFoundException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            } catch(java.lang.InstantiationException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            } catch(IllegalAccessException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            }
        }
        for (ModuleDependency dependency : moduleDef.getDependencies()) {
            ModuleImpl depModule = (ModuleImpl)registry.makeModuleFor(dependency.getName(), dependency.getVersion());
            if (depModule==null) {
                state = ModuleState.ERROR;               
                throw new ResolveError(dependency + " referenced from "
                        + moduleDef.getName() + " is not resolved");
            }

            //if (Utils.isLoggable(Level.INFO)) {
            //    Utils.getDefaultLogger().info("For module" + getName() + " adding new dependent " + module.getName());
View Full Code Here


            try {
                Class<LifecyclePolicy> lifecyclePolicyClass = (Class<LifecyclePolicy>) getPrivateClassLoader().loadClass(moduleDef.getLifecyclePolicyClassName());
                lifecyclePolicy = lifecyclePolicyClass.newInstance();
            } catch(ClassNotFoundException e) {
                state = ModuleState.ERROR;
                throw new ResolveError("ClassNotFound : " + e.getMessage(), e);
            } catch(java.lang.InstantiationException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            } catch(IllegalAccessException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            }
        }
        if (lifecyclePolicy!=null) {
            lifecyclePolicy.start(this);
        }
View Full Code Here

        if (module!=null && resolve) {
            try {
                module.resolve();
            } catch(Throwable e) {
                module.uninstall();
                throw new ResolveError(e);
            }
        }
        Logger.getAnonymousLogger().fine("this.makeModuleFor("+name+ ", " + version + ") returned " + module);
        return module;
    }
View Full Code Here

            if (logger.isLoggable(Level.FINE)) {
                logger.logp(Level.FINE, "OSGiModuleImpl",
                        "start", "Started bundle {0}", bundle);
            }
        } catch (BundleException e) {
            throw new ResolveError("Failed to start "+this,e);
        }

        // TODO(Sahoo): Remove this when hk2-apt generates equivalent BundleActivator
        // if there is a LifecyclePolicy, then instantiate and invoke.
        if (md.getLifecyclePolicyClassName()!=null) {
            try {
                Class<LifecyclePolicy> lifecyclePolicyClass =
                        (Class<LifecyclePolicy>) bundle.loadClass(md.getLifecyclePolicyClassName());
                lifecyclePolicy = lifecyclePolicyClass.newInstance();
            } catch(ClassNotFoundException e) {
                throw new ResolveError("ClassNotFound : " + e.getMessage(), e);
            } catch(java.lang.InstantiationException e) {
                throw new ResolveError(e);
            } catch(IllegalAccessException e) {
                throw new ResolveError(e);
            }
        }
        if (lifecyclePolicy!=null) {
            lifecyclePolicy.start(this);
        }
View Full Code Here

        if (module!=null && resolve) {
            try {
                module.resolve();
            } catch(Throwable e) {
                module.uninstall();
                throw new ResolveError(e);
            }
        }
        return module;
    }
View Full Code Here

     */
    public synchronized void resolve() throws ResolveError {
       
        // already resolved ?
        if (state==ModuleState.ERROR)
            throw new ResolveError("Module " + getName() + " is in ERROR state");
        if (state.compareTo(ModuleState.RESOLVED)>=0)
            return;

        if (state==ModuleState.PREPARING) {
            Utils.identifyCyclicDependency(this, Logger.getAnonymousLogger());
            throw new ResolveError("Cyclic dependency with " + getName());
        }
        state = ModuleState.PREPARING;
       
        if (moduleDef.getImportPolicyClassName()!=null) {
            try {
                Class<ImportPolicy> importPolicyClass = (Class<ImportPolicy>) getPrivateClassLoader().loadClass(moduleDef.getImportPolicyClassName());
                ImportPolicy importPolicy = importPolicyClass.newInstance();
                importPolicy.prepare(this);
            } catch(ClassNotFoundException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            } catch(java.lang.InstantiationException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            } catch(IllegalAccessException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            }
        }
        for (ModuleDependency dependency : moduleDef.getDependencies()) {
            ModuleImpl depModule = (ModuleImpl)registry.makeModuleFor(dependency.getName(), dependency.getVersion());
            if (depModule==null) {
                state = ModuleState.ERROR;               
                throw new ResolveError(dependency + " referenced from "
                        + moduleDef.getName() + " is not resolved");
            }

            //if (Utils.isLoggable(Level.INFO)) {
            //    Utils.getDefaultLogger().info("For module" + getName() + " adding new dependent " + module.getName());
View Full Code Here

            try {
                Class<LifecyclePolicy> lifecyclePolicyClass = (Class<LifecyclePolicy>) getPrivateClassLoader().loadClass(moduleDef.getLifecyclePolicyClassName());
                lifecyclePolicy = lifecyclePolicyClass.newInstance();
            } catch(ClassNotFoundException e) {
                state = ModuleState.ERROR;
                throw new ResolveError("ClassNotFound : " + e.getMessage(), e);
            } catch(java.lang.InstantiationException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            } catch(IllegalAccessException e) {
                state = ModuleState.ERROR;
                throw new ResolveError(e);
            }
        }
        if (lifecyclePolicy!=null) {
            lifecyclePolicy.start(this);
        }
View Full Code Here

                for( String token : new Tokenizer(importedBundles,",")) {
                    Collection<Module> modules = modulesRegistry.getModules(token);
                    if (modules.size() ==1) {
                        defs.add(modules.iterator().next().getModuleDefinition());
                    } else {
                        throw new ResolveError("Not able to locate a unique module by name " + token);
                    }
                }
            }

      // Applications can add an additional osgi repos...
View Full Code Here

TOP

Related Classes of com.sun.enterprise.module.ResolveError

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.