• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AutoProcessor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.felix.main.AutoProcessor的典型用法代码示例。如果您正苦于以下问题:Java AutoProcessor类的具体用法?Java AutoProcessor怎么用?Java AutoProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AutoProcessor类属于org.apache.felix.main包,在下文中一共展示了AutoProcessor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
public BundleContext start() throws Exception {
	Map<String, String> configMap = getConfiguration();
	Felix fx = new Felix(configMap);
	fwkTemplate = new DefaultFrameworkTemplate(fx, log);

	fwkTemplate.init();
	BundleContext context = fx.getBundleContext();
	AutoProcessor.process(configMap, context);
	fwkTemplate.start();
	return context;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:FelixPlatform.java


示例2: prepareFramework

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
private void prepareFramework() {
    fileInstall = new FileInstall();
    propertiesDictionary = new Hashtable<String, String>();
    StartupProperties startupProperties = CommunoteRuntime.getInstance()
            .getConfigurationManager().getStartupProperties();
    propertiesDictionary.put(DirectoryWatcher.DIR, startupProperties.getPluginDir()
            .getAbsolutePath());
    propertiesDictionary.put(DirectoryWatcher.NO_INITIAL_DELAY, Boolean.TRUE.toString());
    propertiesDictionary.put(DirectoryWatcher.START_NEW_BUNDLES, Boolean.TRUE.toString());
    propertiesDictionary.put(DirectoryWatcher.LOG_LEVEL, Integer.toString(4));
    Properties frameworkProperties = loadFrameworkProperties();
    List<BundleActivator> activatorList = new ArrayList<BundleActivator>();
    activatorList.add(fileInstall);
    frameworkProperties.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, activatorList);
    // TODO better add a setSystemBundlesLocation method
    String pathToWebInf = CommunoteRuntime.getInstance().getApplicationInformation()
            .getApplicationRealPath()
            + "WEB-INF" + File.separator;
    initSystemBundles(frameworkProperties, pathToWebInf + "plugins");
    frameworkProperties.put(Constants.FRAMEWORK_STORAGE, OSGiHelper.getBundleBasePath()
            .getAbsolutePath() + File.separator + "bundle-cache");
    try {
        framework = new Felix(frameworkProperties);
        framework.init();
        AutoProcessor.process(frameworkProperties, framework.getBundleContext());
        framework.getBundleContext().addBundleListener(this);
    } catch (BundleException e) {
        throw new BeanCreationException(
                "Starting OSGi framework failed because of a BundleException.", e);
    }
    LOG.info("OSGi Framework initialized.");
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:33,代码来源:OSGiManagement.java


示例3: initialize

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
private void initialize() throws BundleException, URISyntaxException {

        Map<String, String> configMap = loadProperties();
        System.setProperty(LOG_CONFIG_FILE_PROPERTY, configMap.get(LOG_CONFIG_FILE_PROPERTY));
   
        System.out.println("Building OSGi Framework");
        FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator().next();
        Framework framework = frameworkFactory.newFramework(configMap);

        framework.init();
        // (9) Use the system bundle context to process the auto-deploy
        // and auto-install/auto-start properties.
        AutoProcessor.process(configMap, framework.getBundleContext());
        // (10) Start the framework.
        System.out.println("Starting OSGi Framework");
        framework.start();
     
        BundleContext context = framework.getBundleContext();
        // declarative services dependency is necessary, otherwise they won't be picked up!
        loadScrBundle(context);

        try {
            framework.waitForStop(0);
        } catch (InterruptedException e) {
        	appendToFile(e);
        	showErrorMessage();
        }
        System.exit(0);
    }
 
开发者ID:burningrain,项目名称:planetBot,代码行数:30,代码来源:Launcher.java


示例4: FelixConfig

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
public FelixConfig(String felixDeploymentDir){		
	config = new HashMap<String, String>();
	config.put(org.osgi.framework.Constants.FRAMEWORK_STORAGE,
			felixDeploymentDir.concat(File.separator).concat("felix-cache"));
	config.put(AutoProcessor.AUTO_DEPLOY_DIR_PROPERY,
			felixDeploymentDir.concat(File.separator).concat("bundle"));
	config.put(BundleCache.CACHE_ROOTDIR_PROP, felixDeploymentDir);
	config.put("felix.embedded.execution", "true");
	config.put("org.osgi.framework.bootdelegation", "*");
	config.put("felix.bootdelegation.implicit", "false");
	//config.put("felix.log.level", "3");
	config.put("felix.service.urlhandlers", "false");
	config.put("felix.auto.deploy.action", "install,start");
	config.put("org.osgi.framework.system.packages.extra", ANDROID_PACKAGES_FOR_EXPORT);			
}
 
开发者ID:myHealthAssistant-tudarmstadt,项目名称:myHealthHub,代码行数:16,代码来源:FelixConfig.java


示例5: startPluginContainer

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
private void startPluginContainer() throws BundleException, Exception {
    Map<String, String> config = new HashMap<>();
    config.put(FelixConstants.ACTIVATION_LAZY, "false");
    config.put("felix.cache.locking", "false");
    config.put("felix.auto.deploy.dir", "install");
    config.put("felix.auto.deploy.action", "install,start");
    config.put("org.osgi.framework.system.packages.extra",
            "javafx.event,"
            + "org.badvision.outlaweditor.api,"
            + "org.badvision.outlaweditor.data,"
            + "org.badvision.outlaweditor.data.xml,"
            + "org.badvision.outlaweditor.ui,"
            + "org.osgi.framework");
    // MH: Had to add these to allow plugin to access basic Java XML classes, 
    //     and other stuff you'd think would just be default.
    config.put("org.osgi.framework.bootdelegation", 
            "sun.*,"
            + "com.sun.*,"
            + "org.w3c.*,"
            + "org.xml.*,"
            + "javax.xml.*");
    felix = new Felix(config);
    felix.start();
    felix.getBundleContext().registerService(ApplicationState.class, this, null);
    tracker = new ServiceTracker(felix.getBundleContext(), MenuAction.class, null);
    tracker.open();
    Activator scrActivator = new Activator();
    scrActivator.start(felix.getBundleContext());
    AutoProcessor.process(config, felix.getBundleContext());
}
 
开发者ID:badvision,项目名称:lawless-legends,代码行数:31,代码来源:Application.java


示例6: doLaunch

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
public void doLaunch() {
    // Create a case-insensitive configuration property map.
    StringMap configMap = new StringMap(false);
    // Configure the Felix instance to be embedded.
    // configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
    // Add core OSGi packages to be exported from the class path
    // via the system bundle.
    configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "org.osgi.framework; version=1.3.0," + "org.osgi.service.packageadmin; version=1.2.0,"
                    + "org.osgi.service.startlevel; version=1.0.0," + "org.osgi.service.url; version=1.0.0");

    configMap.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);

    // Explicitly specify the directory to use for caching bundles.
    // configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");

    try {
        // Create host activator;

        List<Object> list = new ArrayList<Object>();

        // list.add(new HostActivator());
        configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.xml.sax, org.xml.sax.helpers, javax.xml.parsers, javax.naming");
        configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list);
        configMap.put("felix.log.level", "4");

        // Now create an instance of the framework with
        // our configuration properties and activator.
        felix = new Felix(configMap);
        felix.init();

        // otherProps.put(Constants.FRAMEWORK_STORAGE, "bundles");

        otherProps.put(AutoProcessor.AUTO_DEPLOY_DIR_PROPERY, AutoProcessor.AUTO_DEPLOY_DIR_VALUE);
        otherProps.put(AutoProcessor.AUTO_DEPLOY_ACTION_PROPERY, AutoProcessor.AUTO_DEPLOY_START_VALUE + "," + AutoProcessor.AUTO_DEPLOY_INSTALL_VALUE);

        BundleContext felixBudleContext = felix.getBundleContext();

        AutoProcessor.process(otherProps, felixBudleContext);
        // listen to errors
        felixBudleContext.addFrameworkListener(frameworkErrorListener);
        felixBudleContext.addBundleListener(myBundleListener);
        // Now start Felix instance.
        felix.start();
        System.out.println("felix started");

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:50,代码来源:FelixHost.java


示例7: doLaunch

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void doLaunch() {
  // Create a case-insensitive configuration property map.
  Map configMap = new StringMap(false);
  // Configure the Felix instance to be embedded.
  // configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
  // Add core OSGi packages to be exported from the class path
  // via the system bundle.
  configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
      "org.osgi.framework; version=1.3.0,"
          + "org.osgi.service.packageadmin; version=1.2.0,"
          + "org.osgi.service.startlevel; version=1.0.0,"
          + "org.osgi.service.url; version=1.0.0");

  configMap.put(Constants.FRAMEWORK_STORAGE_CLEAN,
      Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);

  // Explicitly specify the directory to use for caching bundles.
  // configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");

  try {
    // Create host activator;

    List list = new ArrayList();

    // list.add(new HostActivator());
    configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA,
        "org.xml.sax, org.xml.sax.helpers, javax.xml.parsers, javax.naming");
    configMap.put(FelixConstants.SYSTEMBUNDLE_ACTIVATORS_PROP, list);
    configMap.put("felix.log.level", "4");

    // Now create an instance of the framework with
    // our configuration properties and activator.
    felix = new Felix(configMap);
    felix.init();

    // otherProps.put(Constants.FRAMEWORK_STORAGE, "bundles");

     otherProps.put(AutoProcessor.AUTO_DEPLOY_DIR_PROPERY,
     AutoProcessor.AUTO_DEPLOY_DIR_VALUE);
    otherProps.put(AutoProcessor.AUTO_DEPLOY_ACTION_PROPERY,
        AutoProcessor.AUTO_DEPLOY_START_VALUE + ","
            + AutoProcessor.AUTO_DEPLOY_INSTALL_VALUE);

    BundleContext felixBudleContext = felix.getBundleContext();

    AutoProcessor.process(otherProps, felixBudleContext);
    // listen to errors
    felixBudleContext.addFrameworkListener(frameworkErrorListener);
    felixBudleContext.addBundleListener(myBundleListener);
    // Now start Felix instance.
    felix.start();
    System.out.println("felix started");

  } catch (Exception ex) {
    ex.printStackTrace();
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:59,代码来源:FelixHost.java


示例8: installBundle

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
public void installBundle(){
	AutoProcessor.process(configProps, bundleContext);		
}
 
开发者ID:flowingtime,项目名称:FelixServer,代码行数:4,代码来源:TCPServer.java


示例9: onCreate

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
@Override
public void onCreate() {
	super.onCreate();

	if(D) Log.d(TAG, "Setting up a thread for felix.");
	
	Thread felixThread = new Thread() {

		@Override
		public void run() {
							
			File dexOutputDir = getApplicationContext().getDir("transformationmanager", 0);
			
			// if default bundles were not installed already, install them
			File f = new File(dexOutputDir.getAbsolutePath()+"/bundle");
			if(!f.isDirectory()) {
				if(D) Log.i(TAG, "Installing default bundles...");
				unzipBundles(FelixService.this.getResources().openRawResource(R.raw.bundles),
						dexOutputDir.getAbsolutePath()+"/");					
			} 		
			
			FelixConfig felixConfig = new FelixConfig(dexOutputDir.getAbsolutePath());
			Map<String, String> configProperties = felixConfig.getProperties2();
		
			try {
				FrameworkFactory frameworkFactory = new org.apache.felix.framework.FrameworkFactory();
				
				felixFramework = frameworkFactory.newFramework(configProperties);
				felixFramework.init();
				AutoProcessor.process(configProperties,felixFramework.getBundleContext());
				felixFramework.start();

				// Registering the android context as an osgi service
				Hashtable<String, String> properties = new Hashtable<String, String>();
				properties.put("platform", "android");
				felixFramework.getBundleContext().registerService(
						Context.class.getName(), getApplicationContext(),
						properties);

			} catch (Exception ex) {					
				Log.e(TAG, "Felix could not be started", ex);
				ex.printStackTrace();
			}
		}
	};
	
	felixThread.setDaemon(true);
	felixThread.start();

	LocalBroadcastManager.getInstance(this).registerReceiver(downloadReceiver, 
			new IntentFilter(FELIX_SUCCESSFUL_WEB_REQUEST));
}
 
开发者ID:myHealthAssistant-tudarmstadt,项目名称:myHealthHub,代码行数:53,代码来源:FelixService.java


示例10: initFelixFramework

import org.apache.felix.main.AutoProcessor; //导入依赖的package包/类
private static void initFelixFramework() throws IOException, BundleException {
    Properties configProps = _loadOsgiConfigProperties();

    // configure Felix auto-deploy directory
    String sAutoDeployDir = configProps.getProperty(AutoProcessor.AUTO_DEPLOY_DIR_PROPERY);
    if (sAutoDeployDir == null) {
        throw new RuntimeException("Can not find configuration ["
                + AutoProcessor.AUTO_DEPLOY_DIR_PROPERY + "] in file "
                + OSGiSERVER_OSGI_PROPERTIES.getAbsolutePath());
    }
    File fAutoDeployDir = new File(OSGiSERVER_HOME, sAutoDeployDir);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(AutoProcessor.AUTO_DEPLOY_DIR_PROPERY + ": "
                + fAutoDeployDir.getAbsolutePath());
    }
    configProps.setProperty(AutoProcessor.AUTO_DEPLOY_DIR_PROPERY,
            fAutoDeployDir.getAbsolutePath());

    // configure Felix temp (storage) directory
    String sCacheDir = configProps.getProperty(Constants.FRAMEWORK_STORAGE);
    if (sCacheDir == null) {
        throw new RuntimeException("Can not find configuration [" + Constants.FRAMEWORK_STORAGE
                + "] in file " + OSGiSERVER_OSGI_PROPERTIES.getAbsolutePath());
    } else if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(Constants.FRAMEWORK_STORAGE + ": " + sCacheDir);
    }
    File fCacheDir = new File(OSGiSERVER_HOME, sCacheDir);
    configProps.setProperty(Constants.FRAMEWORK_STORAGE, fCacheDir.getAbsolutePath());

    // configure Felix's File Install watch directory
    final String PROP_FELIX_FILE_INSTALL_DIR = "felix.fileinstall.dir";
    String sMonitorDir = configProps.getProperty(PROP_FELIX_FILE_INSTALL_DIR);
    if (sMonitorDir != null) {
        File fMonitorDir = new File(OSGiSERVER_HOME, sMonitorDir);
        configProps.setProperty(PROP_FELIX_FILE_INSTALL_DIR, fMonitorDir.getAbsolutePath());
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(PROP_FELIX_FILE_INSTALL_DIR + ": " + fMonitorDir.getAbsolutePath());
        }
    }

    // check for Felix's Remote Shell listen IP & Port
    if (LOGGER.isDebugEnabled()) {
        String remoteShellListenIp = configProps.getProperty("osgi.shell.telnet.ip");
        String remoteShellListenPort = configProps.getProperty("osgi.shell.telnet.port");
        LOGGER.debug("Remote Shell: " + remoteShellListenIp + ":" + remoteShellListenPort);
    }

    Map<String, String> config = new HashMap<String, String>();
    for (Entry<Object, Object> entry : configProps.entrySet()) {
        config.put(entry.getKey().toString(), entry.getValue().toString());
    }
    FrameworkFactory factory = new org.apache.felix.framework.FrameworkFactory();
    framework = factory.newFramework(config);
    framework.init();
    AutoProcessor.process(configProps, framework.getBundleContext());
    _autoDeployBundles(fAutoDeployDir, framework);
    framework.start();
}
 
开发者ID:DDTH,项目名称:osgiserver,代码行数:59,代码来源:StandaloneBootstrap.java



注:本文中的org.apache.felix.main.AutoProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InMemorySessionManager类代码示例发布时间:2022-05-23
下一篇:
Java ByteBufferArray类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap