Package org.osgi.service.cm

Examples of org.osgi.service.cm.ManagedServiceFactory


            "LogManager Configuration Admin support");
        loggingConfigurable = context.registerService(
            ManagedService.class.getName(), globalConfigurator, props);

        // register for log writer configuration
        ManagedServiceFactory msf = new LogWriterManagedServiceFactory(
            logConfigManager);
        props.put(Constants.SERVICE_PID, FACTORY_PID_WRITERS);
        props.put(Constants.SERVICE_DESCRIPTION, msf.getName());
        writerConfigurer = context.registerService(
            ManagedServiceFactory.class.getName(), msf, props);

        // register for log configuration
        msf = new LoggerManagedServiceFactory(logConfigManager);
        props.put(Constants.SERVICE_PID, FACTORY_PID_CONFIGS);
        props.put(Constants.SERVICE_DESCRIPTION, msf.getName());
        configConfigurer = context.registerService(
            ManagedServiceFactory.class.getName(), msf, props);
    }
View Full Code Here


            "LogManager Configuration Admin support");
        loggingConfigurable = context.registerService(
            ManagedService.class.getName(), globalConfigurator, props);

        // register for log writer configuration
        ManagedServiceFactory msf = new LogWriterManagedServiceFactory(
            logConfigManager);
        props.put(Constants.SERVICE_PID, FACTORY_PID_WRITERS);
        props.put(Constants.SERVICE_DESCRIPTION, msf.getName());
        writerConfigurer = context.registerService(
            ManagedServiceFactory.class.getName(), msf, props);

        // register for log configuration
        msf = new LoggerManagedServiceFactory(logConfigManager);
        props.put(Constants.SERVICE_PID, FACTORY_PID_CONFIGS);
        props.put(Constants.SERVICE_DESCRIPTION, msf.getName());
        configConfigurer = context.registerService(
            ManagedServiceFactory.class.getName(), msf, props);
    }
View Full Code Here

    public void provideConfiguration( ServiceReference<ManagedServiceFactory> reference, TargetedPID configPid,
        TargetedPID factoryPid, Dictionary<String, ?> properties, long revision, ConfigurationMap<?> configs )
    {
        // Get the ManagedServiceFactory and terminate here if already
        // unregistered from the framework concurrently
        ManagedServiceFactory service = getRealService( reference );
        if (service == 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( reference );
            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)

        if ( configs.shallTake( configPid, factoryPid, revision ) )
        {
            try
            {
                Dictionary props = getProperties( properties, reference, configPid.toString(),
                    factoryPid.toString() );
                service.updated( configPid.toString(), props );
                configs.record( configPid, factoryPid, revision );
            }
            catch ( Throwable t )
            {
                this.handleCallBackError( t, reference, configPid );
View Full Code Here

    @Override
    public void removeConfiguration( ServiceReference<ManagedServiceFactory> reference, TargetedPID configPid,
        TargetedPID factoryPid )
    {
        final ManagedServiceFactory service = this.getRealService( reference );
        final ConfigurationMap configs = this.getService( reference );
        if ( service != null && configs != null)
        {
            if ( configs.removeConfiguration( configPid, factoryPid ) )
            {
                try
                {
                    service.deleted( configPid.toString() );
                    configs.record( configPid, factoryPid, -1 );
                }
                catch ( Throwable t )
                {
                    this.handleCallBackError( t, reference, configPid );
View Full Code Here

    List<ConfigurationException> exceptions = new LinkedList<ConfigurationException>();

    for (Configuration config : configsMap.values()) {
      String factoryPid = config.getFactoryPid();
      if (factoryPid != null) {
        ManagedServiceFactory msf = msfTracker.findPid(factoryPid);
        if (msf != null) {
          try {
            msf.updated(factoryPid, config.getProperties());
          } catch (ConfigurationException e) {
            exceptions.add(e);
          }
        }
      } else {
View Full Code Here

  public Object addingService(ServiceReference reference) {
    String factoryPid = (String) reference.getProperty(Constants.SERVICE_PID);
    if (factoryPid == null)
      return null;

    ManagedServiceFactory service = (ManagedServiceFactory) context.getService(reference);
    if (service == null)
      return null;

    synchronized (configurationStore) {
      add(reference, factoryPid, service);
View Full Code Here

TOP

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

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.