public String run() { return reference.getBundle().getBundleContext().getProperty("org.osgi.framework.uuid"); } });
@Override public void start(BundleContext context) throws Exception { BundleContext currentContext = CORE_BUNDLE.getAndUpdate(current -> current == null ? context : current); if (currentContext == null) { String greeting = "Detected OSGi Environment (core is in bundle: " + context.getBundle() + ")"; if ("false".equalsIgnoreCase(context.getProperty(OSGI_LOADING))) { SafeOsgi.disableOSGiServiceLoading(); LOGGER.info(greeting + ": OSGi Based Service Loading Disabled Via System/Framework Property - Extensions Outside This Bundle Will Not Be Detected"); LOGGER.debug("JDK Service Loading Sees:\n\t" + stream(spliterator(ClassLoading.servicesOfType(ServiceFactory.class).iterator(), Long.MAX_VALUE, 0), false) .map(sf -> sf.getServiceType().getName()).collect(joining("\n\t"))); } else { SafeOsgi.enableOSGiServiceLoading(); LOGGER.info(greeting + ": Using OSGi Based Service Loading"); } } else { throw new IllegalStateException("Multiple bundle instances running against the same core classes: existing bundle: " + currentContext.getBundle() + " new bundle: " + context.getBundle()); } }
/** * Returns the Roo working directory for the given OSGi component context * * @param componentContext the component context (required) * @return the path of the Roo working directory * @since 1.2.0 */ public static String getRooWorkingDirectory(final ComponentContext componentContext) { return componentContext.getBundleContext().getProperty(ROO_WORKING_DIRECTORY_PROPERTY); }
protected void activate(final ComponentContext context) { iconSetUrl = context.getBundleContext().getProperty("creator.i18n.iconset.url"); if (StringUtils.isBlank(iconSetUrl)) { iconSetUrl = ICON_SET_URL; } }
/** * Returns the value of -DdevelopmentMode property for the given OSGi component context * * @param componentContext the component context (required) * @return true if developmentMode has been specified as true * @since 2.0 */ public static boolean isDevelopmentMode(final ComponentContext componentContext) { String developmentMode = componentContext.getBundleContext().getProperty(ROO_DEVELOPMENT_MODE_PROPERTY); return "true".equals(developmentMode); }
/** * Unicode locale extensions are defined using command line parameter -nlExtensions, * or the system property "osgi.nl.extensions". */ public String getNLExtensions() { String nlExtensions = PlatformActivator.getContext().getProperty("osgi.nl.extensions"); //$NON-NLS-1$ if (nlExtensions == null) return ""; //$NON-NLS-1$ if (!nlExtensions.startsWith("@")) //$NON-NLS-1$ nlExtensions = '@' + nlExtensions; return nlExtensions; }
public Object run() { String version = context .getProperty(Constants.FRAMEWORK_VERSION); return (version == null) ? Version.emptyVersion : new Version(version); } });
public String getOSArch() { return getBundleContext().getProperty(PROP_ARCH); }
/** * Returns <code>true</code> if the platform is currently running in * debug mode. The platform is typically put in debug mode using the * "-debug" command line argument. * <p> * Clients are also able to acquire the {@link EnvironmentInfo} service and query it * to see if they are in debug mode. * </p> * @return whether or not the platform is running in debug mode * @since 3.0 */ public static boolean inDebugMode() { return PlatformActivator.getContext().getProperty("osgi.debug") != null; //$NON-NLS-1$ }
public String getOS() { return getBundleContext().getProperty(PROP_OS); }
public String getNL() { return getBundleContext().getProperty(PROP_NL); }
public String getWS() { return getBundleContext().getProperty(PROP_WS); }
/** * Returns <code>true</code> if the platform is currently running in * development mode. That is, if special procedures are to be * taken when defining plug-in class paths. The platform is typically put in * development mode using the "-dev" command line argument. * <p> * Clients are also able to acquire the {@link EnvironmentInfo} service and query it * to see if they are in development mode. * </p> * @return whether or not the platform is running in development mode * @since 3.0 */ public static boolean inDevelopmentMode() { return PlatformActivator.getContext().getProperty("osgi.dev") != null; //$NON-NLS-1$ } }
protected void activate(final ComponentContext context) { this.context = context.getBundleContext(); final String keyserver = context.getBundleContext().getProperty("pgp.keyserver.url"); if (StringUtils.isNotBlank(keyserver)) { defaultKeyServerUrl = keyserver; } trustDefaultKeysIfRequired(); // Seed the discovered keys database getTrustedKeys(); }
private void addDefaultRepositories() { // Getting wrapping repository url String wrappingRepoUrl = context.getProperty("wrapping.repository.url"); try { getRepositoryAdmin().addRepository(wrappingRepoUrl); } catch (Exception e) { LOGGER.log(Level.WARNING, "WARNING: Wrapping repository could not be installed"); } }
value = bc.getProperty(propertyName); if (value != null) { if (value instanceof String) {
private String getConfiguration(ConfigKey pKey) { // TODO: Use fragments if available. String value = getConfigurationFromConfigAdmin(pKey); if (value == null) { value = bundleContext.getProperty(CONFIG_PREFIX + "." + pKey.getKeyValue()); } if (value == null) { value = pKey.getDefaultValue(); } return value; }
public void start(final BundleContext context) throws Exception { ConfigAdminHttpConduitConfigurer conduitConfigurer = new ConfigAdminHttpConduitConfigurer(); registerService(context, ManagedServiceFactory.class, conduitConfigurer, ConfigAdminHttpConduitConfigurer.FACTORY_PID); registerService(context, HTTPConduitConfigurer.class, conduitConfigurer, "org.apache.cxf.http.conduit-configurer"); if (PropertyUtils.isTrue(context.getProperty(DISABLE_DEFAULT_HTTP_TRANSPORT))) { //TODO: Review if it also makes sense to support "http.transport.disable" // directly in the CXF_CONFIG_SCOPE properties file return; } DestinationRegistry destinationRegistry = new DestinationRegistryImpl(); HTTPTransportFactory transportFactory = new HTTPTransportFactory(destinationRegistry); HttpServiceTrackerCust customizer = new HttpServiceTrackerCust(destinationRegistry, context); httpServiceTracker = new ServiceTracker<>(context, HttpService.class, customizer); httpServiceTracker.open(); context.registerService(DestinationRegistry.class.getName(), destinationRegistry, null); context.registerService(HTTPTransportFactory.class.getName(), transportFactory, null); BlueprintNameSpaceHandlerFactory factory = new BlueprintNameSpaceHandlerFactory() { @Override public Object createNamespaceHandler() { return new HttpBPHandler(); } }; NamespaceHandlerRegisterer.register(context, factory, "http://cxf.apache.org/transports/http/configuration"); }
/** * Internal method for starting up the platform. The platform is not started with any location * and should not try to access the instance data area. * * Note: the content type manager must be initialized only after the registry has been created */ public void start(BundleContext runtimeContext) { this.context = runtimeContext; openOSGiTrackers(); splashEnded = false; processCommandLine(getEnvironmentInfoService().getNonFrameworkArgs()); initializeDebugFlags(); initialized = true; getMetaArea(); initializeAuthorizationHandler(); startServices(); // See if need to activate rest of the runtime plugins. Plugins are "gently" activated by touching // a class from the corresponding plugin(s). boolean shouldActivate = !"false".equalsIgnoreCase(context.getProperty(PROP_ACTIVATE_PLUGINS)); //$NON-NLS-1$ if (shouldActivate) { // activate Preferences plugin by creating a class from it: new org.eclipse.core.runtime.preferences.DefaultScope(); // activate Jobs plugin by creating a class from it: org.eclipse.core.runtime.jobs.Job.getJobManager(); } }
private long getServiceChangecountTimeout() { String val = bundleContext.getProperty( PROP_SERVICE_CHANGECOUNT_TIMEOUT ); if ( val == null) { return DEFAULT_SERVICE_CHANGECOUNT_TIMEOUT_MILLISECONDS; } return Long.parseLong( val ); }