Package org.osgi.service.cm

Examples of org.osgi.service.cm.ManagedService


    private Object tryToCreateManagedService()
    {
        try
        {
            return new ManagedService()
            {
                public void updated( Dictionary<String, ?> properties ) throws ConfigurationException
                {
                    updateFromConfigAdmin(properties);
                }
View Full Code Here


        logConfigManager = LogConfigManager.getInstance();
        logConfigManager.setRoot(context.getProperty("sling.home"));

        // Global configuration handler and update this configuration
        // immediately
        ManagedService globalConfigurator = new GlobalConfigurator(
            logConfigManager, getBundleConfiguration(context));
        globalConfigurator.updated(null);

        // get our own logger
        log = LoggerFactory.getLogger(LogServiceFactory.class);
        log.info("LogManager: Logging set up from context");
View Full Code Here

        logConfigManager = LogConfigManager.getInstance();
        logConfigManager.setRoot(context.getProperty("sling.home"));

        // Global configuration handler and update this configuration
        // immediately
        ManagedService globalConfigurator = new GlobalConfigurator(
            logConfigManager, getBundleConfiguration(context));
        globalConfigurator.updated(null);

        // get our own logger
        log = LoggerFactory.getLogger(LogServiceFactory.class);
        log.info("LogManager: Logging set up from context");
View Full Code Here

    private void updateService( ServiceReference<ManagedService> service, final TargetedPID configPid,
        Dictionary<String, ?> properties, long revision, ConfigurationMap<?> configs)
    {
        // Get the ManagedService and terminate here if already
        // unregistered from the framework concurrently
        final ManagedService srv = this.getRealService( service );
        if (srv == null) {
            return;
        }

        // Get the Configuration-to-PID map from the parameter or from
        // the service tracker. If not available, the service tracker
        // already unregistered this service concurrently
        if ( configs == null )
        {
            configs = this.getService( service );
            if ( configs == null )
            {
                return;
            }
        }

        // Both the ManagedService to update and the Configuration-to-PID
        // are available, so the service can be updated with the
        // configuration (which may be null)

        boolean doUpdate = false;
        if ( properties == null )
        {
            doUpdate = configs.removeConfiguration( configPid, null );
        }
        else if ( properties == INITIAL_MARKER )
        {
            // initial call to ManagedService may supply null properties
            properties = null;
            revision = -1;
            doUpdate = true;
        }
        else if ( revision < 0 || configs.shallTake( configPid, null, revision ) )
        {
            // run the plugins and cause the update
            properties = getProperties( properties, service, configPid.toString(), null );
            doUpdate = true;
            revision = Math.abs( revision );
        }
        else
        {
            // new configuration is not a better match, don't update
            doUpdate = false;
        }

        if ( doUpdate )
        {
            try
            {
                srv.updated( properties );
                configs.record( configPid, null, revision );
            }
            catch ( Throwable t )
            {
                this.handleCallBackError( t, service, configPid );
View Full Code Here

          } catch (ConfigurationException e) {
            exceptions.add(e);
          }
        }
      } else {
        ManagedService ms = msTracker.findPid(config.getPid());
        if (ms != null) {
          try {
            ms.updated(config.getProperties());
          } catch (ConfigurationException e) {
            exceptions.add(e);
          }
        }
      }
View Full Code Here

    private Object tryToCreateManagedService()
    {
        try
        {
            return new ManagedService()
            {
                @Override
                public void updated( Dictionary<String, ?> properties ) throws ConfigurationException
                {
                    updateFromConfigAdmin(properties);
View Full Code Here

    };
    cam.setBeanManager(msbm);
    assertTrue(services.isEmpty());
    assertNotNull(cam.getConfiguration());

    ManagedService callback = (ManagedService) services.keySet().iterator().next();
    Dictionary props = new Properties();
    props.put("foo", "bar");
    props.put("spring", "source");

    assertTrue(holder.isEmpty());
    callback.updated(props);
    assertEquals(1, holder.size());
    assertEquals(props, holder.get(0));
  }
View Full Code Here

      throws ConfigurationException {

    // is this an update to an existing service?
    if (services.containsKey(pid)) {
      ServiceRegistration registration = services.get(pid);
      ManagedService service = (ManagedService) bundleCtx.getService(registration.getReference());
      service.updated(properties);
    }

    // Create a new cache service instance
    else {
View Full Code Here

      throws ConfigurationException {

    // is this an update to an existing service?
    if (services.containsKey(pid)) {
      ServiceRegistration registration = services.get(pid);
      ManagedService service = (ManagedService) bundleCtx.getService(registration.getReference());
      service.updated(properties);
    }

    // Create a new content repository service instance
    else {
      String className = (String) properties.get(OPT_TYPE);
View Full Code Here

TOP

Related Classes of org.osgi.service.cm.ManagedService

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.