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

Java Activate类代码示例

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

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



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

示例1: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
  public void activate(ComponentContext ctx) {
context = ctx.getBundleContext();
instance = this;

MThread.asynchron(new Runnable(){

	@Override
	public void run() {
		Sop.waitForApi(CherryApi.class, 10000);
		log.i("will initial deploy cherry resources");
		context.addBundleListener(CherryDeployServlet.this);
		refreshAll(SENSIVITY.CHECK);
	}
	
});
  }
 
开发者ID:mhus,项目名称:cherry-web,代码行数:18,代码来源:CherryDeployServlet.java


示例2: doActivate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public void doActivate(ComponentContext ctx) {
	log.info("Start");
	context = ctx.getBundleContext();
	context.addBundleListener(this);
	context.addServiceListener(this);
	
	// configuration
	Hashtable<String, Object> properties = new Hashtable<String, Object>();
	properties.put(Constants.SERVICE_PID, CONFIG_PID);
	configUpdaterReg = context.registerService(ManagedService.class.getName(), new ConfigUpdater(this) , properties);
	
	if (enabled) refreshAll();
	
	
}
 
开发者ID:mhus,项目名称:mhus-osgi-tools,代码行数:17,代码来源:BundleWatchImpl.java


示例3: doActivate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
	public void doActivate(ComponentContext ctx) {
		
//	    pwc = new PersistentWatchConfig();
//	    pwc.register(ctx.getBundleContext());
		
		timer = MOsgi.getTimer();
		timerTask = new TimerTask() {
			
			@Override
			public void run() {
				doTask();
			}
		};
		timer.schedule(timerTask, 10000, 60000);
	}
 
开发者ID:mhus,项目名称:mhus-osgi-tools,代码行数:17,代码来源:PersistentWatchImpl.java


示例4: doActivate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public void doActivate(ComponentContext ctx) {
	tracker = new MServiceTracker<MoManagerService>(MoManagerService.class) {
		
		@Override
		protected void removeService(ServiceReference<MoManagerService> reference, MoManagerService service) {
			MoManagerAdminImpl.this.removeService(service);
		}
		
		@Override
		protected void addService(ServiceReference<MoManagerService> reference, MoManagerService service) {
			try {
				MoManagerAdminImpl.this.addService(service);
			} catch (Exception e) {
				log().e(reference,e);
			}
		}
	};
	tracker.start();
}
 
开发者ID:mhus,项目名称:mhus-osgi-tools,代码行数:21,代码来源:MoManagerAdminImpl.java


示例5: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
  public void activate(ComponentContext ctx) {
props = new Properties();
File f = new File ("etc/rootservlet.properties");
if (f.exists()) {
	log.info("Load config file " + f);
	try {
		FileInputStream is = new FileInputStream(f);
		props.load(is);
		is.close();
	} catch (IOException e) {
		log.warning(e.toString());
	}
} else {
	log.warning("Config file not found");
}
  }
 
开发者ID:mhus,项目名称:mhus-osgi-tools,代码行数:18,代码来源:RootServlet.java


示例6: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
void activate() throws Throwable {
	try {
		RmiConfiguration rmc = new RmiConfiguration() {

			@Override
			public boolean isCorbaCompliant() {
				return false;
			}

			@Override
			public void init() throws RmiConfigurationException {
			}
		};
		jotm = new org.objectweb.jotm.Jotm(true, false, rmc);
		delegate = jotm.getTransactionManager();
	} catch (Throwable t) {
		t.printStackTrace();
		throw t;
	}
}
 
开发者ID:osgi,项目名称:bundles,代码行数:22,代码来源:JotmImpl.java


示例7: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
/**
 * Awfully simple. Just use the Data Source Factory to create a Data Source.
 * We delegate all the XA Data Source calls t this Data Source.
 * 
 * @param properties the DS properties (also from Config admin)
 * @throws Exception
 */
@Activate
void activate(BundleContext context, Map<String, Object> properties) throws Exception {
	config = Converter.cnv(Config.class, properties);
	assert config.url() != null;

	Properties props = new Properties();

	props.put(DataSourceFactory.JDBC_URL, config.url());

	if (config.user() != null && config._password() != null) {
		props.setProperty(DataSourceFactory.JDBC_USER, config.user());
		props.setProperty(DataSourceFactory.JDBC_PASSWORD, config._password());
	}

	ds = dsf.createXADataSource(props);
	if ( migrator != null) 
		migrator.migrate(config.name(), ds);
	
	if ( poolProvider != null)
		ds = poolProvider.pool(ds, properties);
	
	registration = context.registerService(XADataSource.class.getName(), ds, new Hashtable<String, Object>(
			properties));
}
 
开发者ID:osgi,项目名称:bundles,代码行数:32,代码来源:XADataSourceFactory.java


示例8: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
void activate(Map<String,Object> properties) {

	Configuration config = Configurable.createConfigurable(Configuration.class, properties);
	int coreSize = config.coreSize();
	int maxSize = config.maximumPoolSize();
	long keepAlive = config.keepAliveTime();
	int cores = Runtime.getRuntime().availableProcessors();

	if (coreSize < 10 * cores)
		coreSize = 30;

	if (maxSize <= coreSize)
		maxSize = coreSize * 4;

	if (keepAlive < 10 || keepAlive > 1000)
		keepAlive = 300;

	es = new ThreadPoolExecutor(coreSize, maxSize, keepAlive, TimeUnit.SECONDS, queue, //
			new ThreadPoolExecutor.CallerRunsPolicy());
}
 
开发者ID:osgi,项目名称:bundles,代码行数:22,代码来源:ExecutorImpl.java


示例9: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public void activate(Map<String, String> properties) {
	log.info("activating service");
	Properties dbProps = new Properties();
	dbProps.put(DataSourceFactory.JDBC_DATABASE_NAME, properties.get("dbname"));
	dbProps.put(DataSourceFactory.JDBC_USER, properties.get("user"));
	dbProps.put(DataSourceFactory.JDBC_PASSWORD, properties.get("password"));
	dbProps.put(DataSourceFactory.JDBC_SERVER_NAME, properties.get("server"));
	dbProps.put(DataSourceFactory.JDBC_PORT_NUMBER, properties.get("port"));
	try {
		dataSource = dataSourceFactory.createDataSource(dbProps);
		// Or
		// dataSourceFactory.createConnectionPoolDataSource(dbProps);
	} catch (SQLException e) {
		e.printStackTrace();
	}
	executeSQL(true, "5555555555", "foo");
	log.info("Added stuff");
}
 
开发者ID:bpedman,项目名称:osgi-jdbc-example,代码行数:20,代码来源:ServiceWithDbAccess.java


示例10: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
void activate(BundleContext bundleContext) {
	ServiceTracker logServiceTracker = new ServiceTracker(bundleContext, LogService.class.getName(), null);
	logServiceTracker.open();
	
	LogService logService = (LogService) logServiceTracker.getService();
	
	if(logService != null)
        logService.log(LogService.LOG_INFO, "[" + this.getClass().getName() + "] Testing the logServiceWritter!");

}
 
开发者ID:maldiny,项目名称:OSGI-en-Castellano,代码行数:12,代码来源:LogServiceWritter.java


示例11: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
void activate(BundleContext bundleContext) {
	ServiceTracker logServiceTracker = new ServiceTracker(bundleContext, LogService.class.getName(), null);
	logServiceTracker.open();
	
	LogService logService = (LogService) logServiceTracker.getService();
	
	ServiceReference ref = bundleContext.getServiceReference(org.osgi.service.log.LogReaderService.class.getName());
    if (ref != null)
    {
      org.osgi.service.log.LogReaderService reader = (org.osgi.service.log.LogReaderService)bundleContext.getService(ref);
      reader.addLogListener(new LogListenerImpl(logService));
    }
}
 
开发者ID:maldiny,项目名称:OSGI-en-Castellano,代码行数:15,代码来源:LogServiceReader.java


示例12: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public final void activate(final BundleContext bundleContext, final Map<String, ?> properties) {
    final SourceBean incoming = new SourceBean();

    incoming.setAge(35);
    incoming.setFirstName("Antonio Maria");
    incoming.setLastName("Sanchez");
    final TargetBean result = mapper.map(incoming, TargetBean.class);

    System.out.println("and the winner is: " + result);

}
 
开发者ID:antoniomaria,项目名称:karaf4-eclipselink-jpa,代码行数:13,代码来源:MappingHello.java


示例13: start

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public void start(BundleContext context, Map<String, Object> config) throws Exception {
    _context = context;

    Dictionary<String, Object> cmdProps = new Hashtable<>();
    cmdProps.put("osgi.command.scope", "osgidb");
    cmdProps.put("osgi.command.function", new String[]{"list", "reset", "config"});
    _context.registerService(DbActivator.class, this, cmdProps);

    updated(config);
}
 
开发者ID:kscarr73,项目名称:OsgiDb,代码行数:12,代码来源:DbActivator.java


示例14: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
void activate(final BundleContext bundleContext) throws InvalidSyntaxException {
    serviceTracker = new ServiceTracker<>(bundleContext, ComponentInstaller.class.getName(),
            new ServiceTrackerCustomizer<ComponentInstaller, ComponentInstaller>() {

                @Override
                public ComponentInstaller addingService(ServiceReference<ComponentInstaller> serviceRef) {
                    ComponentInstaller componentInstaller = bundleContext.getService(serviceRef);
                    Object nameProp = serviceRef.getProperty("component.name"); //$NON-NLS-1$
                    if (nameProp instanceof String) {
                        LOGGER.info("Registered the component: " + nameProp + "(" //$NON-NLS-1$//$NON-NLS-2$
                                + componentInstaller.getClass().getCanonicalName() + ")"); //$NON-NLS-1$
                        componentInstaller.install(DefinitionRegistryOsgi.this);
                    } else {// no name set so issue a warning
                        LOGGER.warn("Failed to register the following component because it is unnamed: " //$NON-NLS-1$
                                + serviceRef.getClass().getCanonicalName());
                    }
                    return componentInstaller;
                }

                @Override
                public void modifiedService(ServiceReference<ComponentInstaller> arg0,
                        ComponentInstaller componentInstaller) {
                    // not handled for now
                }

                @Override
                public void removedService(ServiceReference<ComponentInstaller> arg0, ComponentInstaller componentInstaller) {
                    // No any un-install yet from the service
                }
            });
    serviceTracker.open();
}
 
开发者ID:Talend,项目名称:components,代码行数:34,代码来源:DefinitionRegistryOsgi.java


示例15: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
  public void activate(ComponentContext ctx) {
  	ctx.getBundleContext().addBundleListener(this);
  	instance = this;
  	globalSession.setInvalidator(new Invalidator<String, MProperties>() {

	@Override
	public boolean isInvalid(String key, MProperties value, long time, long accessed) {
		return 
			System.currentTimeMillis() - time > sessionTimeout.value() 
			||
			globalSession.size() > sessionMaxSize.value() && accessed < 2 && System.currentTimeMillis() - time > 10000;
	}
});
  }
 
开发者ID:mhus,项目名称:cherry-web,代码行数:16,代码来源:InternalCherryApiImpl.java


示例16: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
 public void activate(ComponentContext ctx) {
 	this.context = ctx.getUsingBundle().getBundleContext();
 	customizer = new ServiceTrackerCustomizer<VaadinResourceProvider,VaadinResourceProvider>() {

@Override
public VaadinResourceProvider addingService(
		ServiceReference<VaadinResourceProvider> reference) {
	return context.getService(reference);
}

@Override
public void modifiedService(
		ServiceReference<VaadinResourceProvider> reference,
		VaadinResourceProvider service) {
}

@Override
public void removedService(
		ServiceReference<VaadinResourceProvider> reference,
		VaadinResourceProvider service) {
}
 		
 	};
 	tracker = new ServiceTracker<VaadinResourceProvider, VaadinResourceProvider>(context, VaadinResourceProvider.class, customizer);
 	tracker.open();
 }
 
开发者ID:mhus,项目名称:mhus-osgi-tools,代码行数:28,代码来源:VaadinResourcesServlet.java


示例17: doActivate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
	public void doActivate(ComponentContext ctx) {
		this.context = ctx.getBundleContext();
// no more default since using BundleWatch
//		addResource("com.vaadin.client-compiled", "/widgetsets/com.vaadin.DefaultWidgetSet");
//		addResource("com.vaadin.server", "/vaadinBootstrap.js");
//		addResource("com.vaadin.themes", new String[] {"/themes/reindeer","/themes/runo","/themes/liferay","/themes/chameleon","/themes/base"});
//		addResource("com.vaadin.push", "/vaadinPush.js");
	}
 
开发者ID:mhus,项目名称:mhus-osgi-tools,代码行数:10,代码来源:ConfigurableResourceProvider.java


示例18: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public void activate() {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(getClass());
    sf.setResourceProvider(getClass(), new SingletonResourceProvider(this));
    sf.setAddress("/entity");
    sf.setProvider(new JacksonJsonProvider());
    server = sf.create();
}
 
开发者ID:bpedman,项目名称:osgi-sample,代码行数:10,代码来源:EntityServiceRest.java


示例19: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public void activate() {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(getClass());
    sf.setResourceProvider(getClass(), new SingletonResourceProvider(this));
    sf.setAddress("/node");
    sf.setProvider(new JacksonJsonProvider());
    server = sf.create();
}
 
开发者ID:bpedman,项目名称:osgi-sample,代码行数:10,代码来源:NodeServiceRest.java


示例20: activate

import aQute.bnd.annotation.component.Activate; //导入依赖的package包/类
@Activate
public void activate(Map<String,Object> config) throws Exception {
	assert config != null;

	Configuration c = Configurable.createConfigurable(Configuration.class, config);

	//
	// Check if we need java util logging
	//

	if (c.javaUtilLogging()) {
		java.util.logging.Logger.getLogger("").addHandler(javaUtilLogging = new JavaUtilLoggingHandler());
	}

	control.level = c.level() == null ? Level.WARN : c.level();
	control.thread = null;
	control.pattern = null;
	control.stackTraces = c.traces();
	control.where = c.where();

	//
	// Make us the admin ...
	//
	assert LoggerDispatcher.dispatcher.admin == null;

	LoggerDispatcher.dispatcher.admin = this;

	this.setPriority(Thread.MIN_PRIORITY);

	start();
}
 
开发者ID:osgi,项目名称:bundles,代码行数:32,代码来源:LoggerAdminImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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