Java Code Examples for org.osgi.framework.BundleContext#getDataFile()
The following examples show how to use
org.osgi.framework.BundleContext#getDataFile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Activator.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
private static Path initPath ( final BundleContext context ) { try { final String dir = System.getProperty ( "package.drone.addons.dir" ); if ( dir != null ) { final Path path = Paths.get ( dir ); Files.createDirectories ( path ); return path; } final File dataDir = context.getDataFile ( "addons" ); if ( dataDir != null ) { Files.createDirectories ( dataDir.toPath () ); return dataDir.toPath (); } logger.warn ( "Unable to start addon manager. No base directory available" ); return null; } catch ( final Exception e ) { logger.error ( "Failed to initialize addons directory", e ); return null; } }
Example 2
Source File: FSPackageRegistry.java From jackrabbit-filevault with Apache License 2.0 | 5 votes |
/** * Deafult constructor for OSGi initialization (homeDir defined via activator) * @throws IOException */ @Activate public FSPackageRegistry(BundleContext context, Config config) throws IOException { this( context.getProperty(REPOSITORY_HOME) != null ? ( new File(config.homePath()).isAbsolute() ? new File(config.homePath()) : new File(context.getProperty(REPOSITORY_HOME) + "/" + config.homePath())) : context.getDataFile(config.homePath()), InstallationScope.valueOf(config.scope()), new AbstractPackageRegistry.SecurityConfig(config.authIdsForHookExecution(), config.authIdsForRootInstallation())); if (!homeDir.exists()) { homeDir.mkdirs(); } }
Example 3
Source File: ConfigDispatcher.java From openhab-core with Eclipse Public License 2.0 | 4 votes |
@Activate public void activate(BundleContext bundleContext) { exclusivePIDStore = bundleContext.getDataFile(EXCLUSIVE_PID_STORE_FILE); loadExclusivePIDList(); readDefaultConfig(); }
Example 4
Source File: ProxycacheImpl.java From osgi.enroute.examples with Apache License 2.0 | 4 votes |
@Activate void activate(BundleContext context, Config config) throws URISyntaxException { this.data = context.getDataFile("cache"); this.base = this.data.toURI(); this.remote = new URI(config.remote()); }
Example 5
Source File: FileBackend.java From osgi.enroute.examples with Apache License 2.0 | 4 votes |
@Activate void activate(BundleContext context) { root = context.getDataFile("backend-file"); root.mkdirs(); }
Example 6
Source File: ConfigDispatcher.java From smarthome with Eclipse Public License 2.0 | 4 votes |
@Activate public void activate(BundleContext bundleContext) { exclusivePIDStore = bundleContext.getDataFile(EXCLUSIVE_PID_STORE_FILE); loadExclusivePIDList(); readDefaultConfig(); }