Examples of Inhabitant


Examples of org.jvnet.hk2.component.Inhabitant

            if (replacements.containsKey(typeName)) {
                // create a replacement instead
                Class<?> target = replacements.get(typeName);
                if(target!=null) {
                    inhabitantParser.setImplName(target.getName());
                    Inhabitant i = null;
                    try {
                      i = Inhabitants.create(target,habitat,inhabitantParser.getMetaData());
                    } catch (Exception e) {
                      log(typeName, e);
                    }
View Full Code Here

Examples of org.jvnet.hk2.component.Inhabitant

    /**
     * Obtains a {@link ConfigModel} for the given class (Which should have {@link Configured} annotation on it.)
     */
    public ConfigModel buildModel(String fullyQualifiedClassName) {
        Inhabitant i = habitat.getInhabitantByAnnotation(InjectionTarget.class, fullyQualifiedClassName);
        if(i==null)
            throw new ComponentException("ConfigInjector for %s is not found, is it annotated with @Configured",fullyQualifiedClassName);
        return buildModel(i);
    }
View Full Code Here

Examples of org.jvnet.hk2.component.Inhabitant

                        if (!caller.getClassName().contains("hk2")) {
                            break;
                        }
                    }
                    if (itr.hasNext()) {
                        Inhabitant reason = itr.next();
                        StackTraceElement caller = stack[j];
                        Module m = null;
                        try {
                            if (reason.isInstantiated()) {
                                m = registry.find(loader.loadClass(reason.typeName()));
                            }
                        } catch (ClassNotFoundException e) {
                            m = null;
                        }
                        if (m!=null && !m.getModuleDefinition().getName().equals(currentBundleName)) {
                            w.append("Looks like module " + currentBundleName + " was " + state + " because "+
                                    m.getName() + " was " + state + "\nSince " + m.getName() + " contains ");
                        } else {
                            w.append("Requested by ");
                        }
                        if (m!=null)
                            currentBundleName = m.getName();

                        w.append(reason + " called from " + caller.getClassName()
                                + "." + caller.getMethodName() + ":" + caller.getLineNumber()+" metadata \n" + reason.metadata()+"\n");
                        w.append("\n");

                    }

                }

            }
            w.append("\n");

            w.append("-----------------------------------\n");
            w.append("Inhabitants initialization stack\n");
            w.append("-----------------------------------\n");
            itr = tracing.inOrder();
            while (itr.hasNext()) {
                Inhabitant i = itr.next();
                w.append(prefix +"> requested from "+ i+"\n");
                prefix=prefix+"-";
            }

            w.append("\n");
View Full Code Here

Examples of org.jvnet.hk2.component.Inhabitant

    // Todo : take care of Deployer when unloading...
    public void stop(Logger logger)
    {
        if (getDeployer()!=null) {
            Inhabitant i = registry.habitat.getInhabitantByType(getDeployer().getClass());
            if (i!=null) {
                i.release();
            }
        }
        if (getContainer()!=null) {
            Inhabitant i = registry.habitat.getInhabitantByType(getContainer().getClass());
            if (i!=null) {
                i.release();
            }
        }
        registry.removeContainer(this);
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Container " + getContainer().getName() + " stopped");
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.