Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.UnprocessedChangeEvent


* @author Kohsuke Kawaguchi
*/
public class Creators {
    @SuppressWarnings("unchecked")
    public static <T> Creator<T> create(Class<T> c, Habitat habitat, MultiMap<String,String> metadata) {
        Factory f = c.getAnnotation(Factory.class);
        if (f != null) {
            return new FactoryCreator<T>(c,f.value(),habitat,metadata);
        }

        Inhabitant factory = habitat.getInhabitantByAnnotation(FactoryFor.class, c.getName());
        if (factory!=null) {
            return new FactoryCreator<T>(c,factory,habitat,metadata);
View Full Code Here


        V result;
       
        if (type.isArray()) {
            result = getArrayInjectValue(habitat, component, onBehalfOf, target, genericType, type);
        } else {
          Inject inject = target.getAnnotation(Inject.class);
          if (Types.isSubClassOf(type, Holder.class)){
              result = getHolderInjectValue(habitat, component, onBehalfOf, target, genericType, type, inject);
          } else {
              if (habitat.isContract(type)) {
                  result = getServiceInjectValue(habitat, component, onBehalfOf, target, genericType, type, inject);
View Full Code Here

        if (vi != null) {
            visibility = vi.value();
        }
       
        String classAnalysisName = null;
        Service service = constant.getClass().getAnnotation(Service.class);
        if (service != null) {
            classAnalysisName = service.analyzer();
        }
       
        return new ConstantActiveDescriptor<T>(
                constant,
                contractsAsSet,
View Full Code Here

        final ClassLoader cl = getClassLoader();
        try {
            Class<T> c = (Class<T>) cl.loadClass(typeName);
            return c;
        } catch (ClassNotFoundException e) {
            throw new ComponentException("Failed to load "+typeName+" from " + cl, e);
        }
    }
View Full Code Here

                            continue;   // comment

                        return; // found the next line
                    }
                } catch (IOException e) {
                    throw new ComponentException("Failed to parse line " + lineNumber + " of " + systemId,e);
                }
            }

            public InhabitantParser next() {
                fetch();
View Full Code Here

    public WonderlandAppServer(Server server) {
        this.server = server;

        // add a module to properly specify the classpath
        Habitat h = server.getHabitat();
        ModulesRegistry mr = h.getComponent(ModulesRegistry.class);
        mr.add(new ClasspathModuleDefinition(WebServerLauncher.getClassLoader()));
    }
View Full Code Here

    public Habitat createHabitat() throws ComponentException {
        if (null != habitatFactory) {
          return habitatFactory.newHabitat();
        }
       
        return new Habitat();
    }
View Full Code Here

            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

      assert(null != rl) : typeName + " is a problem; " + i + " has no RunLevel annotation";
      assert(!i.isInstantiated()) : "inhabitant should not be active: " + i;

      // get the appropriate RLS for this RunLevel
      RunLevelService<?> rls = runLevelServices.get(habitat, rl);
      InhabitantListener listener = InhabitantListener.class.isInstance(rls) ?
          InhabitantListener.class.cast(rls) : null;

      // wrap the inhabitant with a RunLevelInhabitant
      int runLevel = rl.value();
     
View Full Code Here

      if (scopeClass== Singleton.class) {
          return new SingletonInhabitant<T>(creator);
      }
 
      // other general case
      Scope scope = habitat.getByType(scopeClass);
      if (scope==null) {
          throw new ComponentException("Failed to look up %s", scopeClass);
      }
 
      return new ScopedInhabitant<T>(creator,scope);
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.config.UnprocessedChangeEvent

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.