Package org.glassfish.hk2.api

Examples of org.glassfish.hk2.api.DynamicConfigurationService


     * to any descriptors found by filter will also be removed
     */
    public static void removeFilter(ServiceLocator locator, Filter filter, boolean includeAliasDescriptors) {
        if (locator == null || filter == null) throw new IllegalArgumentException();
       
        DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
        DynamicConfiguration config = dcs.createDynamicConfiguration();
       
        config.addUnbindFilter(filter);
       
        if (includeAliasDescriptors == true) {
            List<ActiveDescriptor<?>> goingToDie = locator.getDescriptors(filter);
View Full Code Here


     */
    public static DynamicConfiguration createDynamicConfiguration(ServiceLocator locator)
        throws IllegalStateException {
        if (locator == null) throw new IllegalArgumentException();
       
        DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
        if (dcs == null) throw new IllegalStateException();
       
        return dcs.createDynamicConfiguration();
    }
View Full Code Here

     * @throws MultiException If there was a failure when populating or creating the ServiceLocator
     */
    public static ServiceLocator createAndPopulateServiceLocator(String name) throws MultiException {
        ServiceLocator retVal = ServiceLocatorFactory.getInstance().create(name);
       
        DynamicConfigurationService dcs = retVal.getService(DynamicConfigurationService.class);
        Populator populator = dcs.getPopulator();
       
        try {
            populator.populate();
        }
        catch (IOException e) {
View Full Code Here

    public void stop() throws IOException {
        ServiceLocator locator = grizzlyService.getHabitat();
        IndexedFilter removeFilter = BuilderHelper.createNameAndContractFilter(Mapper.class.getName(),
                (address.toString() + port));

        DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
        DynamicConfiguration config = dcs.createDynamicConfiguration();

        config.addUnbindFilter(removeFilter);

        config.commit();
View Full Code Here

        if (startupContext==null) {
            sc = new StartupContext(new Properties());
        }

        DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class);
        DynamicConfiguration config = dcs.createDynamicConfiguration();
        config.bind(BuilderHelper.createConstantDescriptor(sc));
        config.commit();
       
        return serviceLocator;
    }
View Full Code Here

        allPostProcessors.add(new Hk2LoaderPopulatorPostProcessor(singleClassLoader));
        if (postProcessors != null) {
          allPostProcessors.addAll(postProcessors);
        }

        DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class);
        Populator populator = dcs.getPopulator();
       
      List<ActiveDescriptor<?>> retVal = populator.populate(
                new ClasspathDescriptorFileFinder(singleClassLoader, name),
                allPostProcessors.toArray(new PopulatorPostProcessor[allPostProcessors.size()]));
     
View Full Code Here

        if (logger.isLoggable(level)) {
            logger.log(level, "Startup class : {0}", getClass().getName());
        }

        // prepare the global variables
        DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
        DynamicConfiguration config = dcs.createDynamicConfiguration();

        config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(this));
//        config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(systemRegistry));
        config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(logger));
View Full Code Here

     *                   activate/deactivate the services
     * @return false if an error occurred that required server shutdown; true otherwise
     */
    private boolean proceedTo(int runLevel, AppServerActivator activator) {
        // set up the run level listener and activator
        DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
        DynamicConfiguration config = dcs.createDynamicConfiguration();

        ActiveDescriptor<?> activatorDescriptor = config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(activator));

        config.commit();

        try {
            runLevelController.proceedTo(runLevel);
        } catch (Exception e) {
            logger.log(Level.SEVERE, KernelLoggerInfo.shutdownRequired, e);
            shutdown();
            return false;
        } finally {
            config = dcs.createDynamicConfiguration();
            config.addUnbindFilter(BuilderHelper.createSpecificDescriptorFilter(activatorDescriptor));
            config.commit();
        }
        return !activator.isShutdown();
    }
View Full Code Here

  public static List<ActiveDescriptor> populate(final ServiceLocator serviceLocator,
      DescriptorFileFinder fileFinder,
      List <? extends PopulatorPostProcessor> postProcessors) throws IOException {
      if (postProcessors == null) postProcessors = new LinkedList<PopulatorPostProcessor>();
     
      DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class);
      Populator populator = dcs.getPopulator();
     
      List<ActiveDescriptor<?>> retVal = populator.populate(fileFinder,
              postProcessors.toArray(new PopulatorPostProcessor[postProcessors.size()]));
     
      return (List<ActiveDescriptor>) ((List) retVal);
View Full Code Here

      initializeServiceLocator(serviceLocator);
        return serviceLocator;
    }

    protected void initializeServiceLocator(ServiceLocator serviceLocator) throws MultiException {
        DynamicConfigurationService dcs = serviceLocator
                .getService(DynamicConfigurationService.class);

        DynamicConfiguration config = dcs.createDynamicConfiguration();

        config.bind(BuilderHelper.createConstantDescriptor(Logger.getAnonymousLogger()));

        // default modules registry is the one that created the habitat
        config.bind(BuilderHelper.createConstantDescriptor(this));
View Full Code Here

TOP

Related Classes of org.glassfish.hk2.api.DynamicConfigurationService

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.