微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.osgi.framework.Constants的实例源码

项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.poolTracker = new ObjectPoolTracker<MasterItem> ( context,MasterItem.class );
    this.poolTracker.open ();

    this.mapperPoolTracker = new ObjectPoolTracker<ValueMapper> ( context,ValueMapper.class );
    this.mapperPoolTracker.open ();

    this.factory = new MapperHandlerFactoryImpl ( context,this.poolTracker,this.mapperPoolTracker,1001 /* after manual */);
    final Dictionary<String,String> properties = new Hashtable<String,String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION,"A value mapper master handler" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID,MapperHandlerFactoryImpl.FACTORY_ID );
    context.registerService ( ConfigurationFactory.class.getName (),this.factory,properties );

}
项目:patternlab-for-sling    文件ExtensionRegistryService.java   
@Reference(
        policy = ReferencePolicy.DYNAMIC,service = RuntimeExtension.class,cardinality = ReferenceCardinality.MULTIPLE
)
@SuppressWarnings("unused")
protected synchronized void bindExtensionService(RuntimeExtension extension,Map<String,Object> properties) {
    Integer newPriority = PropertiesUtil.toInteger(properties.get(Constants.SERVICE_RANKING),0);
    String extensionName = PropertiesUtil.toString(properties.get(RuntimeExtension.NAME),"");
    Integer priority = PropertiesUtil.toInteger(mappingPriorities.get(extensionName),0);
    if (newPriority > priority) {
        mapping = Collections.unmodifiableMap(add(mapping,extension,extensionName));
        mappingPriorities.put(extensionName,newPriority);
    } else {
        if (!mapping.containsKey(extensionName)) {
            mapping = Collections.unmodifiableMap(add(mapping,extensionName));
            mappingPriorities.put(extensionName,newPriority);
        }
    }

}
项目:gemini.blueprint    文件AbstractOnTheFlyBundleCreatorTests.java   
private void installAndStartBundle(BundleContext context,Resource resource) throws Exception {
    // install & start
    Bundle bundle = context.installBundle("[onTheFly-test-bundle]" + ClassUtils.getShortName(getClass()) + "["
            + hashCode() + "]",resource.getInputStream());

    String bundleString = OsgiStringUtils.nullSafeNameAndSymName(bundle);
    boolean debug = logger.isDebugEnabled();

    if (debug) {
        logger.debug("Test bundle [" + bundleString + "] successfully installed");
           logger.debug(Constants.FRAMEWORK_BOOTDELEGATION + " = " + context.getProperty(Constants.FRAMEWORK_BOOTDELEGATION));
       }
    bundle.start();
    if (debug) {
        logger.debug("Test bundle [" + bundleString + "] successfully started");
       }
}
项目:gemini.blueprint    文件OsgiSingleServiceProxyfactorybeanTest.java   
public void testGetobjectWithFilterOnly() throws Exception {
    this.servicefactorybean.setBundleContext(new MockBundleContext());
    this.servicefactorybean.setInterfaces(new Class<?>[] { Serializable.class });
    String filter = "(beanName=myBean)";
    this.servicefactorybean.setFilter(filter);

    MockServiceReference ref = new MockServiceReference();
    Dictionary dict = new Hashtable();
    dict.put(Constants.OBJECTCLASS,new String[] { Serializable.class.getName() });
    ref.setProperties(dict);

    servicefactorybean.setBeanClassLoader(getClass().getClassLoader());
    servicefactorybean.afterPropertiesSet();

    Object proxy = servicefactorybean.getobject();
    assertTrue(proxy instanceof Serializable);
    assertTrue("should be proxied",proxy instanceof SpringProxy);
}
项目:gemini.blueprint    文件OsgiServiceDynamicInterceptorListenerTest.java   
public void testStickinessWhenServiceGoesDown() throws Exception {
    interceptor.setSticky(true);
    interceptor.afterPropertiesSet();

    ServiceListener sl = (ServiceListener) bundleContext.getServiceListeners().iterator().next();

    Dictionary props = new Hashtable();
    // increase service ranking
    props.put(Constants.SERVICE_RANKING,10);

    ServiceReference higherRankingRef = new MockServiceReference(null,props,null);
    refs = new ServiceReference[] { new MockServiceReference(),higherRankingRef };

    assertTrue(Arrays.equals(bundleContext.getServiceReferences((String)null,null),refs));

    assertEquals(1,SimpleTargetSourceLifecycleListener.BIND);
    assertEquals(0,SimpleTargetSourceLifecycleListener.UNBIND);

    sl.serviceChanged(new ServiceEvent(ServiceEvent.UNREGISTERING,refs[0]));

    assertEquals(2,SimpleTargetSourceLifecycleListener.UNBIND);

    assertSame("incorrect backing reference selected",higherRankingRef,((ServiceReferenceProxy) interceptor
            .getServiceReference()).getTargetServiceReference());
}
项目:neoscada    文件ConfigurationManagerImpl.java   
@Override
public Configuration getConfiguration ()
{
    final List<ConfigurationGroup> groups = new LinkedList<ConfigurationGroup> ();

    Long lastRanking = null;
    ConfigurationGroupImpl lastGroup = null;

    for ( final Map.Entry<ServiceReference<AuthenticationService>,AuthenticationService> entry : this.tracker.getTracked ().entrySet () )
    {
        final Object o = entry.getKey ().getProperty ( Constants.SERVICE_RANKING );
        final long ranking = o instanceof Number ? ( (Number)o ).longValue () : 0;

        if ( lastRanking == null || lastRanking != ranking )
        {
            lastGroup = new ConfigurationGroupImpl ();
            groups.add ( lastGroup );
            lastRanking = ranking;
        }

        lastGroup.add ( entry.getValue () );
    }

    return new ConfigurationImpl ( groups );
}
项目:neoscada    文件Starter.java   
private Bundle readFromManifest ( final String location,final Manifest m ) throws IOException
{
    final Object sn = m.getMainAttributes ().getValue ( Constants.BUNDLE_SYMBOLICNAME );
    if ( ! ( sn instanceof String ) )
    {
        return null;
    }

    final Object version = m.getMainAttributes ().getValue ( Constants.BUNDLE_VERSION );
    if ( ! ( version instanceof String ) )
    {
        return null;
    }

    String symName = (String)sn;
    symName = symName.split ( ";",2 )[0];

    return new Bundle ( symName,new Version ( (String)version ),location );
}
项目:neoscada    文件Servicediscoverer.java   
private synchronized void setup ()
{
    try
    {
        this.context.addServiceListener ( this,String.format ( "(%s=%s)",Constants.OBJECTCLASS,ConnectionService.class.getName () ) );
        final ServiceReference<?>[] refs = this.context.getAllServiceReferences ( ConnectionService.class.getName (),null );
        if ( refs != null )
        {
            for ( final ServiceReference<?> ref : refs )
            {
                addReference ( ref );
            }
        }
    }
    catch ( final InvalidSyntaxException e )
    {
        logger.warn ( "Invalid Syntax when setting up filter",e );
        return;
    }

}
项目:neoscada    文件Activator.java   
private void registerService ( final String id,final String uri,final ConnectionService service )
{
    final Dictionary<String,Object> properties = new Hashtable<String,Object> ();
    properties.put ( Constants.SERVICE_PID,id );
    properties.put ( ConnectionService.CONNECTION_URI,uri );

    final Class<?>[] clazzes = service.getSupportedInterfaces ();

    final String[] clazzStr = new String[clazzes.length];
    for ( int i = 0; i < clazzes.length; i++ )
    {
        clazzStr[i] = clazzes[i].getName ();
    }

    final ServiceRegistration<?> handle = getBundle ().getBundleContext ().registerService ( clazzStr,service,properties );
    this.registrations.add ( handle );
}
项目:gemini.blueprint    文件OsgiPlatformDetector.java   
private static boolean determinePlatform(BundleContext context,String[] labels) {
    Assert.notNull(context);
    Assert.notNull(labels);

    String vendorProperty = context.getProperty(Constants.FRAMEWORK_vendOR);
    if (vendorProperty == null) {
        return false; // might be running outside of container
    } else {
        // code defensively here to allow for variation in vendor name over
        // time
        if (containsAnyOf(vendorProperty,labels)) {
            return true;
        }
    }
    return false;
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.executor = ExportedExecutorService.newSingleThreadExportedExecutor ( context.getBundle ().getSymbolicName () );

    this.dataSourceTracker = new ObjectPoolTracker<DataSource> ( context,DataSource.class );
    this.dataSourceTracker.open ();

    this.factory = new DeltaDataSourceFactory ( context,this.executor,this.dataSourceTracker );

    final Dictionary<String,String> ( 3 );
    properties.put ( Constants.SERVICE_DESCRIPTION,"A delta DA data source" );
    properties.put ( Constants.SERVICE_vendOR,"Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID,context.getBundle ().getSymbolicName () );

    this.registration = context.registerService ( ConfigurationFactory.class,properties );
}
项目:gemini.blueprint    文件MockBundleContext.java   
public ServiceReference[] getServiceReferences(String clazz,String filter) throws InvalidSyntaxException {
    // Some jiggery-pokery to get round the fact that we don't ever use the clazz
    if (clazz == null) {
        if (filter != null) {
            // flatten filter since the constants might be case insensitive
            String flattenFilter = filter.toLowerCase();
            int i = flattenFilter.indexOf(Constants.OBJECTCLASS.toLowerCase() + "=");
            if (i > 0) {
                clazz = filter.substring(i + Constants.OBJECTCLASS.length() + 1);
                clazz = clazz.substring(0,clazz.indexOf(")"));
            }
        } else {
            clazz = Object.class.getName();
           }
       }
    return new ServiceReference[] { new MockServiceReference(getBundle(),new String[] { clazz }) };
}
项目:neoscada    文件Activator.java   
@Override
public void serviceChange ( final ServiceReference<Service> reference,final Service service )
{
    if ( Activator.this.localHdServerServiceRegistration != null )
    {
        Activator.this.localHdServerServiceRegistration.unregister ();
    }
    if ( service != null )
    {
        final Dictionary<String,Object> props = new Hashtable<String,Object> ();
        props.put ( Constants.SERVICE_RANKING,20 );
        try
        {
            Activator.this.localHttpExporter = new LocalHttpExporter ( service );
            Activator.this.localHdServerServiceRegistration = context.registerService ( HttpExporter.class,Activator.this.localHttpExporter,props );
        }
        catch ( final Exception e )
        {
            logger.warn ( "Failed to handle service change",e );
        }
    }
}
项目:neoscada    文件ProxyDataSource.java   
private int getPriority ( final String id,final Dictionary<?,?> properties )
{
    final Object o = properties.get ( Constants.SERVICE_RANKING );

    if ( o == null )
    {
        return getDefaultPriority ( id );
    }

    if ( o instanceof Number )
    {
        return ( (Number)o ).intValue ();
    }

    try
    {
        return Integer.parseInt ( o.toString () );
    }
    catch ( final NumberFormatException e )
    {
        return getDefaultPriority ( id );
    }
}
项目:gemini.blueprint    文件AbstractOnTheFlyBundleCreatorTests.java   
/**
 * Creates the default manifest in case none if found on the disk. By
 * default,the imports are synthetised based on the test class bytecode.
 * 
 * @return default manifest for the jar created on the fly
 */
protected Manifest createDefaultManifest() {
    Manifest manifest = new Manifest();
    Attributes attrs = manifest.getMainAttributes();

    // manifest versions
    attrs.put(Attributes.Name.MANIFEST_VERSION,"1.0");
    attrs.putValue(Constants.BUNDLE_MANIFESTVERSION,"2");

    String description = getName() + "-" + getClass().getName();
    // name/description
    attrs.putValue(Constants.BUNDLE_NAME,"TestBundle-" + description);
    attrs.putValue(Constants.BUNDLE_SYMBOLICNAME,"TestBundle-" + description);
    attrs.putValue(Constants.BUNDLE_DESCRIPTION,"on-the-fly test bundle");

    // activator
    attrs.putValue(Constants.BUNDLE_ACTIVATOR,JUnitTestActivator.class.getName());

    // add Import-Package entry
    addImportPackage(manifest);

    if (logger.isDebugEnabled()) {
        logger.debug("Created manifest:" + manifest.getMainAttributes().entrySet());
       }
    return manifest;
}
项目:gemini.blueprint    文件OsgiUtils.java   
public static String getPlatformName(BundleContext bundleContext) {
    String vendorProperty = bundleContext.getProperty(Constants.FRAMEWORK_vendOR);
    String frameworkVersion = bundleContext.getProperty(Constants.FRAMEWORK_VERSION);

    // get system bundle
    Bundle bundle = bundleContext.getBundle(0);
    String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
    String version = (String) bundle.getHeaders().get(Constants.BUNDLE_VERSION);
    String symName = bundle.getSymbolicName();

    StringBuilder buf = new StringBuilder();
    buf.append(name);
    buf.append(" ");
    buf.append(symName);
    buf.append("|");
    buf.append(version);
    buf.append("{");
    buf.append(frameworkVersion);
    buf.append(" ");
    buf.append(vendorProperty);
    buf.append("}");

    return buf.toString();
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    Activator.instance = this;

    if ( !Boolean.getBoolean ( "org.eclipse.scada.core.client.ngp.disableSharedProcessor" ) )
    {
        this.processor = new SimpleIoProcessorPool<> ( NioProcessor.class );
    }
    this.factory = new DriverFactoryImpl ( this.processor );

    final Dictionary<String,String> ();
    properties.put ( org.eclipse.scada.core.client.DriverFactory.INTERFACE_NAME,"hd" );
    properties.put ( org.eclipse.scada.core.client.DriverFactory.DRIVER_NAME,"ngp" );
    properties.put ( Constants.SERVICE_DESCRIPTION,"Eclipse SCADA HD NGP Adapter" );
    properties.put ( Constants.SERVICE_vendOR,"Eclipse SCADA Project" );
    this.handle = context.registerService ( org.eclipse.scada.core.client.DriverFactory.class,properties );
}
项目:gemini.blueprint    文件OsgiServiceDynamicInterceptorListenerTest.java   
public void testStickinessWhenABetterServiceIsAvailable() throws Exception {
    interceptor.setSticky(true);
    interceptor.afterPropertiesSet();

    ServiceListener sl = (ServiceListener) bundleContext.getServiceListeners().iterator().next();

    Dictionary props = new Hashtable();
    // increase service ranking
    props.put(Constants.SERVICE_RANKING,10);

    ServiceReference ref = new MockServiceReference(null,null);
    ServiceEvent event = new ServiceEvent(ServiceEvent.REGISTERED,ref);

    assertEquals(1,SimpleTargetSourceLifecycleListener.UNBIND);

    sl.serviceChanged(event);

    assertEquals("the proxy is not sticky",1,SimpleTargetSourceLifecycleListener.UNBIND);
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.executor = ScheduledExportedExecutorService.newSingleThreadExportedScheduledExecutor ( context.getBundle ().getSymbolicName () );

    this.eventProcessor = new EventProcessor ( context );
    this.eventProcessor.open ();

    this.factory = new ScriptSourceFactory ( context,this.eventProcessor );

    final Dictionary<String,"A scripting data source" );
    properties.put ( Constants.SERVICE_vendOR,context.getBundle ().getSymbolicName () );

    context.registerService ( ConfigurationFactory.class.getName (),properties );
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    Activator.instance = this;

    if ( !Boolean.getBoolean ( "org.eclipse.scada.core.client.ngp.disableSharedProcessor" ) )
    {
        this.processor = new SimpleIoProcessorPool<> ( NioProcessor.class );
    }
    this.factory = new DriverFactoryImpl ( this.processor );

    final Dictionary<String,"ae" );
    properties.put ( org.eclipse.scada.core.client.DriverFactory.DRIVER_NAME,"Eclipse SCADA AE NGP Adapter" );
    properties.put ( Constants.SERVICE_vendOR,properties );
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    plugin = this;

    logger.info ( "Starting up..." );

    this.executor = Executors.newSingleThreadExecutor ( new NamedThreadFactory ( context.getBundle ().getSymbolicName () ) );

    this.monitorPoolTracker = new ObjectPoolTracker<MonitorService> ( context,MonitorService.class );
    this.monitorPoolTracker.open ();

    this.dataSourcePool = new ObjectPoolImpl<DataSource> ();
    this.dataSourcePoolHandler = ObjectPoolHelper.registerObjectPool ( context,this.dataSourcePool,DataSource.class );

    this.factory = new InfoServiceFactory ( context,this.monitorPoolTracker,this.dataSourcePool );
    final Dictionary<String,String> ( 2 );
    properties.put ( Constants.SERVICE_vendOR,"Eclipse SCADA Project" );
    properties.put ( Constants.SERVICE_DESCRIPTION,"An aggregator for all monitor states" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID,InfoServiceFactory.FACTORY_ID );

    this.factoryHandle = context.registerService ( ConfigurationFactory.class,properties );
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext bundleContext ) throws Exception
{
    Activator.context = bundleContext;

    this.itemPool = new ObjectPoolImpl<DataItem> ();

    this.itemPoolHandle = ObjectPoolHelper.registerObjectPool ( context,this.itemPool,DataItem.class );

    this.executor = ExportedExecutorService.newSingleThreadExportedExecutor ( context.getBundle ().getSymbolicName () );

    this.service = new ConfigurationFactoryImpl ( context,this.executor );

    {
        final Dictionary<String,Object> ();
        properties.put ( ConfigurationAdministrator.FACTORY_ID,"org.eclipse.scada.da.server.arduino.device" );
        properties.put ( Constants.SERVICE_DESCRIPTION,"Arduino Eclipse SCADA Device" );
        this.factoryHandle = context.registerService ( ConfigurationFactory.class,this.service,properties );
    }

}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.eventProcessor = new EventProcessor ( context );
    this.eventProcessor.open ();

    this.monitorServicePool = new ObjectPoolImpl<MonitorService> ();
    this.monitorServicePoolHandler = ObjectPoolHelper.registerObjectPool ( context,this.monitorServicePool,MonitorService.class );

    this.executor = ExportedExecutorService.newSingleThreadExportedExecutor ( context.getBundle ().getSymbolicName () + "/" + context.getBundle ().getBundleId () );

    // register factory
    this.factory = new EventMonitorFactory ( context,this.eventProcessor );
    final Hashtable<String,Object> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID,EventMonitorFactory.FACTORY_ID );
    properties.put ( Constants.SERVICE_DESCRIPTION,"Filter based event monitor" );
    this.factoryServiceHandle = context.registerService ( new String[] { ConfigurationFactory.class.getName (),AknHandler.class.getName () },properties );

    if ( this.manager == null )
    {
        this.manager = new EventInjectorManager ( this.factory );
        this.manager.start ();
    }
}
项目:Core    文件OsgiUtils.java   
/**
 * disable component if property "enabled" is set to false
 *
 * @param ctx component context
 */
private static void disableIfNeeded(Object obj,ComponentContext ctx) {
    OptionalComponent oc = obj.getClass().getAnnotation(OptionalComponent.class);

    if (oc == null) {
        return;
    }

    boolean enabled = PropertiesUtil.toBoolean(ctx.getProperties().get(oc.propertyName()),true);

    if (!enabled) {
        String pid = (String) ctx.getProperties().get(Constants.SERVICE_PID);
        LOG.info("disabling component {}",pid);

        // at this point this is the only way to reliably disable a component
        // it's going to show up as "unsatisfied" in Felix console.
        throw new ComponentException(format("Component %s is intentionally disabled",pid));
    }
}
项目:neoscada    文件ProxyEventQueryFactory.java   
@Override
protected Entry<ProxyEventQuery> createService ( final Userinformation userinformation,final String configurationId,final BundleContext context,final Map<String,String> parameters ) throws Exception
{
    logger.info ( "Creating new proxy query: {}",configurationId );

    final ConfigurationDataHelper cfg = new ConfigurationDataHelper ( parameters );

    final int poolSize = cfg.getIntegerChecked ( "poolSize","'poolSize' must be set" );
    if ( poolSize <= 0 )
    {
        throw new IllegalArgumentException ( "'poolSize' must be a positive integer greater zero" );
    }

    final ProxyEventQuery service = new ProxyEventQuery ( context,poolSize,parameters );

    final Hashtable<String,configurationId );
    final ServiceRegistration<EventQuery> handle = context.registerService ( EventQuery.class,properties );

    return new Entry<ProxyEventQuery> ( configurationId,handle );
}
项目:gemini.blueprint    文件BeanNameServicePropertiesResolver.java   
public Map getServiceProperties(String beanName) {
    Map p = new MapBasedDictionary();
    if (StringUtils.hasText(beanName)) {
        p.put(BEAN_NAME_PROPERTY_KEY,beanName);
        p.put(SPRING_DM_BEAN_NAME_PROPERTY_KEY,beanName);
        p.put(BLUEPRINT_COMP_NAME,beanName);
    }

    String name = getSymbolicName();
    if (StringUtils.hasLength(name)) {
        p.put(Constants.BUNDLE_SYMBOLICNAME,name);
    }
    String version = getBundLeversion();
    if (StringUtils.hasLength(version)) {
        p.put(Constants.BUNDLE_VERSION,version);
    }
    return p;
}
项目:neoscada    文件DefaultStorageHandlerFactory.java   
public DefaultStorageHandlerFactory ( final BundleContext context )
{
    this.serviceProperties.put ( Constants.SERVICE_DESCRIPTION,"Default storage handler" );
    this.serviceProperties.put ( EventHandlerFactory.FACTORY_ID,"defaultStorage" );

    this.context = context;
    this.tracker = new SingleServiceTracker<EventService> ( context,EventService.class,new SingleServiceListener<EventService> () {

        @Override
        public void serviceChange ( final ServiceReference<EventService> reference,final EventService service )
        {
            handleServiceChange ( service );
        }
    } );
    this.tracker.open ();
}
项目:gemini.blueprint    文件OsgiServicefactorybean.java   
private Dictionary mergeServiceProperties(Map serviceProperties,String beanName) {
    MapBasedDictionary props = new MapBasedDictionary();

    // add service properties
    if (serviceProperties != null)
        props.putAll(serviceProperties);

    // eliminate any property that might clash with the official ones
    props.remove(OsgiServicePropertiesResolver.BEAN_NAME_PROPERTY_KEY);
    props.remove(OsgiServicePropertiesResolver.SPRING_DM_BEAN_NAME_PROPERTY_KEY);
    props.remove(OsgiServicePropertiesResolver.BLUEPRINT_COMP_NAME);
    props.remove(Constants.SERVICE_RANKING);

    // override any user property that might clash with the official ones
    props.putAll(propertiesResolver.getServiceProperties(beanName));

    if (ranking != 0) {
        props.put(Constants.SERVICE_RANKING,Integer.valueOf(ranking));
    }

    return props;
}
项目:neoscada    文件HistoricalItemImpl.java   
public HistoricalItemImpl ( final HistoricalIteminformation iteminformation,final String masterId,final BundleContext context ) throws InvalidSyntaxException
{
    this.iteminformation = iteminformation;
    this.dataSourceId = masterId;

    this.valueBuffer = new LinkedList<DataItemValue> ();

    this.storageTracker = new SingleServiceTracker<StorageHistoricalItem> ( context,FilterUtil.createAndFilter ( StorageHistoricalItem.class.getName (),new MapBuilder<String,String> ().put ( Constants.SERVICE_PID,iteminformation.getItemId () ).getMap () ),new SingleServiceListener<StorageHistoricalItem> () {

        @Override
        public void serviceChange ( final ServiceReference<StorageHistoricalItem> reference,final StorageHistoricalItem service )
        {
            HistoricalItemImpl.this.setStorage ( service );
        }
    } );
    this.poolTracker = new ObjectPoolTracker<DataSource> ( context,DataSource.class );
}
项目:gemini.blueprint    文件OsgiPlatformDetectorTest.java   
public void testEquinoxDetection() {
    props.put(Constants.FRAMEWORK_vendOR,"Eclipse");
    BundleContext bc = new MockBundleContext(mockBundle,props);
    assertTrue("Detected as Equinox",OsgiPlatformDetector.isEquinox(bc));
    assertFalse(OsgiPlatformDetector.isKnopflerfish(bc));
    assertFalse(OsgiPlatformDetector.isFelix(bc));
}
项目:magic-bundle    文件Activator.java   
private void unsetServiceReference(ServiceReference<Object> reference) {
    String objectClass = ((String[]) reference.getProperty(Constants.OBJECTCLASS))[0]; // Todo: 16.03.2017 when will this array have more than one element?

    if (RandomStringGenerator.class.getName().equals(objectClass))
        randomStringGeneratorServiceReference = null;
    else if (RandomNumberGenerator.class.getName().equals(objectClass))
        randomNumberGeneratorServiceReference = null;
}
项目:gemini.blueprint    文件DefaultBundleContextProperties.java   
protected void initProperties() {
    put(Constants.FRAMEWORK_VERSION,getVersion());
    put(Constants.FRAMEWORK_vendOR,"SpringSource");
    put(Constants.FRAMEWORK_LANGUAGE,System.getProperty("user.language"));
    put(Constants.FRAMEWORK_OS_NAME,System.getProperty("os.name"));
    put(Constants.FRAMEWORK_OS_VERSION,System.getProperty("os.version"));
    put(Constants.FRAMEWORK_PROCESSOR,System.getProperty("os.arch"));
}
项目:incubator-netbeans    文件Activator.java   
static Set<String> provides(Dictionary<?,?> headers) {
    Set<String> deps = new TreeSet<String>(splitTokens((String) headers.get("OpenIDE-Module-Provides")));
    String name = (String) headers.get(Constants.BUNDLE_SYMBOLICNAME);
    if (name != null) {
        name = name.replaceFirst(";.+","");
        deps.add("cnb." + name);
        if (name.equals("org.openide.modules")) {
            CoreBridge.defineOsTokens(deps);
        }
    }
    return deps;
}
项目:AgentWorkbench    文件BundleEvaluator.java   
/**
 * Returns the bundle class path entries conform to the URL pattern (starting with a slash).
 * @param bundle the bundle
 * @return the bundle class path entries
 */
private Vector<String> getBundleClasspathEntries(Bundle bundle) {

    String bundleClasspath = bundle.getHeaders().get(Constants.BUNDLE_CLAsspATH);
    if (bundleClasspath==null) return null;

    Vector<String> bundleClasspathEntries = new Vector<>(Arrays.asList(bundleClasspath .split(",")));
    for (int i = 0; i < bundleClasspathEntries.size(); i++) {
        String bundleClasspathEntry = bundleClasspathEntries.get(i);
        if (bundleClasspathEntry.startsWith("/")==false) {
            bundleClasspathEntries.set(i,"/" + bundleClasspathEntry);
        }
    }
    return bundleClasspathEntries;
}
项目:neoscada    文件AbstractConfigurationAdministrator.java   
private String getDescription ( final ServiceReference<?> reference )
{
    String description;
    if ( reference.getProperty ( Constants.SERVICE_DESCRIPTION ) instanceof String )
    {
        description = (String)reference.getProperty ( Constants.SERVICE_DESCRIPTION );
    }
    else
    {
        description = null;
    }
    return description;
}
项目:neoscada    文件Console.java   
public synchronized void enableDummyAuthentication ()
{
    if ( this.authnHandle != null )
    {
        return;
    }

    final Dictionary<String,Object> ();
    properties.put ( Constants.SERVICE_DESCRIPTION,"A dummy authentication service" );
    properties.put ( Constants.SERVICE_vendOR,"Eclipse SCADA Project" );
    properties.put ( Constants.SERVICE_RANKING,this.authenticationPriority );

    System.out.println ( String.format ( "Injecting dummy authentication service with priority: %s",this.authenticationPriority ) );
    this.authnHandle = this.context.registerService ( AuthenticationService.class,this.authenticationService,properties );
}
项目:neoscada    文件Console.java   
public synchronized void enableDummyAuthorization ()
{
    if ( this.authzHandle != null )
    {
        return;
    }

    final Dictionary<String,"A dummy authorization service" );
    properties.put ( Constants.SERVICE_vendOR,this.authorizationPriority );

    System.out.println ( String.format ( "Injecting dummy authorization service with priority: %s",this.authorizationPriority ) );
    this.authzHandle = this.context.registerService ( AuthorizationManager.class,this.authorizationService,properties );
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    logger.info ( "Starting file based DS" );
    this.service = new StorageImpl ();
    final Dictionary<String,Object> ( 2 );
    properties.put ( Constants.SERVICE_vendOR,"A file based data store implemenentation" );
    context.registerService ( DataStore.class.getName (),properties );
}
项目:gemini.blueprint    文件OsgiHeaderUtilsTest.java   
public void testGetRequireBundleWithMultipleBundlesAttributesAndWhitespaces() throws Exception {
    Properties props = new Properties();
    String pkg2 = "foo.bar";
    props.setProperty(Constants.REQUIRE_BUNDLE,"  " + PKG + ";visibility:=reexport;bundle-version=\"1.0\",\t  "
            + pkg2 + "\n  ");
    Bundle bundle = new MockBundle(props);
    String[] rb = OsgiHeaderUtils.getRequireBundle(bundle);

    assertSame(rb[0],rb[0].trim());
    assertSame(rb[1],rb[1].trim());
}
项目:neoscada    文件Activator.java   
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.service = new PropertyAuthenticationService ();

    final Dictionary<String,"A plain authentication service based on a system property" );
    properties.put ( Constants.SERVICE_vendOR,this.priority );

    context.registerService ( AuthenticationService.class.getName (),properties );
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。