Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.Element


          }
      };

      InhabitantsParsingContextGenerator ipcgen;
      try {
        InhabitantsFeed feed = InhabitantsFeed.create(habitat, ip);
        ipcgen = (USE_CACHE) ? ipcgCache.get(classpath, populator) : populator.call();
        feed.populate(ipcgen);
 
        if (logger.isLoggable(Level.FINER)) {
          Iterator<String> contracts = habitat.getAllContracts();
          while (contracts.hasNext()) {
              String contract = contracts.next();
View Full Code Here


    protected void populateHabitat(final Habitat habitat, InhabitantsParser ip) {
      final ClassPath classpath = ClassPath.create(habitat, true);
      Callable<InhabitantsParsingContextGenerator> populator = new Callable<InhabitantsParsingContextGenerator>() {
          @Override
          public InhabitantsParsingContextGenerator call() throws Exception {
            InhabitantsParsingContextGenerator ipcgen = InhabitantsParsingContextGenerator.create(habitat);
            Set<String> cpSet = classpath.getEntries();
            for (String fileName : cpSet) {
                File f = new File(fileName);
                if (f.exists()) {
                  try {
                    ipcgen.parse(f);
                  } catch (IOException e) {
                    e.printStackTrace();
                  }
                }
            }
            return ipcgen;
          }
      };

      InhabitantsParsingContextGenerator ipcgen;
      try {
        InhabitantsFeed feed = InhabitantsFeed.create(habitat, ip);
        ipcgen = (USE_CACHE) ? ipcgCache.get(classpath, populator) : populator.call();
        feed.populate(ipcgen);
 
View Full Code Here

                new CompanionSeed.Registerer(this)));
        add(new ExistingSingletonInhabitant<CageBuilder.Registerer>(CageBuilder.Registerer.class,
                new CageBuilder.Registerer(this)));

        // the default RunLevelService
        DefaultRunLevelService rls = new DefaultRunLevelService(this);
        ExistingSingletonInhabitant<RunLevelService> rlsI =
          new ExistingSingletonInhabitant<RunLevelService>(RunLevelService.class, rls);
        add(rlsI);
        addIndex(rlsI, RunLevelService.class.getName(), DefaultRunLevelService.NAME);
    }
View Full Code Here

    return filter;
  }
 
  public InhabitantTrackerContextBuilder ldapFilter(String ldapExpression)
        throws ComponentException {
    SimpleLdapMatcher matcher = SimpleLdapMatcher.create(ldapExpression);
    Set<String> classNames = matcher.getTheAndSetFor(Constants.OBJECTCLASS, true);
    if (classNames.isEmpty()) throw new IllegalArgumentException("invalid expression");
    for (String item : classNames) {
      if (hasWildcard(item)) {
        throw new ComponentException("no wilcards permitted");
      }
View Full Code Here

                Set<String> attributeNames = configBean.model.getAttributeNames();
                for (String attributeName : attributeNames) {
                    String methodName = getAttributeMethodName(attributeName);
                    try {
                        Method method = configBeanProxy.getMethod(methodName);
                        Attribute attribute = method.getAnnotation(Attribute.class);
                        if (attribute != null) {
                            ParameterMetaData parameterMetaData =
                                getParameterMetaData(attribute);

                            if (pamameterType == Constants.QUERY_PARAMETER) {
View Full Code Here

            Resource res = (Resource) configBean;
            return res.getIdentity();
        }
        Method[] methods = configBeanType.getMethods();
        for (Method method : methods) {
            Attribute attributeAnnotation = method.getAnnotation(Attribute.class);
            if ((attributeAnnotation != null) && attributeAnnotation.key()) {
                return (String) method.invoke(configBean);
            }
        }
        return null;
    }
View Full Code Here

                        if (m.getName().equalsIgnoreCase(methodName)) {
                            method = m;
                        }
                    }
                }
                Attribute attribute = method.getAnnotation(Attribute.class);
                if (attribute != null) {
                    ParameterMetaData parameterMetaData = getParameterMetaData(attribute);
                    if (method.getAnnotation(Deprecated.class) != null) {
                        parameterMetaData.putAttribute(Constants.DEPRECATED, "true");
                    }
View Full Code Here

                // Check parent interfaces
                for (int i = interfaces.size() - 1; i >= 0; i--) {
                    Class<?> intf = interfaces.get(i);
                    try {
                        Method method = intf.getMethod(methodName);
                        Attribute attribute = method.getAnnotation(Attribute.class);
                        if (attribute != null) {
                            ParameterMetaData localParam = ResourceUtil.getParameterMetaData(attribute);
                            copyParameterMetaDataAttribute(localParam, parameterMetaData, Constants.DEFAULT_VALUE);
                            copyParameterMetaDataAttribute(localParam, parameterMetaData, Constants.KEY);
                            copyParameterMetaDataAttribute(localParam, parameterMetaData, Constants.TYPE);
                            copyParameterMetaDataAttribute(localParam, parameterMetaData, Constants.OPTIONAL);
                        }
                    } catch (NoSuchMethodException e) {
                    }
                }

                // Check ConfigBean
                try {
                    Method method = configBeanProxy.getMethod(methodName);
                    Attribute attribute = method.getAnnotation(Attribute.class);
                    if (attribute != null) {
                        ParameterMetaData localParam = ResourceUtil.getParameterMetaData(attribute);
                        copyParameterMetaDataAttribute(localParam, parameterMetaData, Constants.DEFAULT_VALUE);
                        copyParameterMetaDataAttribute(localParam, parameterMetaData, Constants.KEY);
                        copyParameterMetaDataAttribute(localParam, parameterMetaData, Constants.TYPE);
View Full Code Here

            throwError(Status.FORBIDDEN, message);
        }

        if (getDeleteCommand().equals("GENERIC-DELETE")) {
            try {
                ConfigBean p = (ConfigBean) parent;
                if (parent == null) {
                    p = (ConfigBean) entity.parent();
                }
                ConfigSupport.deleteChild(p, (ConfigBean) entity);
                return ExitCode.SUCCESS;
View Full Code Here

    }

    protected ActionReportResult buildActionReportResult(boolean showEntityValues) {
        RestActionReporter ar = new RestActionReporter();
        ar.setExtraProperties(new Properties());
        ConfigBean entity = (ConfigBean) getEntity();
        if (childID != null) {
            ar.setActionDescription(childID);

        } else if (childModel != null) {
            ar.setActionDescription(childModel.getTagName());
View Full Code Here

TOP

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

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.