当前位置: 首页>>代码示例>>Java>>正文


Java BundleContext类代码示例

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


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

示例1: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void start( BundleContext bundleContext ) throws Exception
{
	// Initializing log4j...
	LoggerContext dotcmsLoggerContext = Log4jUtil.getLoggerContext();

	// Initialing the log4j context of this plugin based on the dotCMS logger context
	this.pluginLoggerContext = (LoggerContext) LogManager.getContext( this.getClass().getClassLoader(), false, dotcmsLoggerContext, dotcmsLoggerContext.getConfigLocation() );

	Logger.info( this, "Got to start( BundleContext ) " + PLUGIN_NAME );

	//Initializing services...
	initializeServices( bundleContext );

	//Registering the ViewTool service
	registerViewToolService( bundleContext, new TemplateViewToolInfo() );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:18,代码来源:Activator.java

示例2: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void start( BundleContext bundleContext ) throws Exception
{
	// Initializing log4j...
	LoggerContext dotcmsLoggerContext = Log4jUtil.getLoggerContext();

	// Initialing the log4j context of this plugin based on the dotCMS logger context
	this.pluginLoggerContext = (LoggerContext) LogManager.getContext( this.getClass().getClassLoader(), false, dotcmsLoggerContext, dotcmsLoggerContext.getConfigLocation() );

	Logger.info( this, "Got to start( BundleContext ) " + PLUGIN_NAME );

	//Initializing services...
	initializeServices( bundleContext );

	//Registering the ViewTool service
	registerViewToolService( bundleContext, new SelfParsingBeanViewToolInfo() );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:18,代码来源:Activator.java

示例3: stop

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void stop( BundleContext bundleContext ) throws Exception
{
	Logger.info( this, "Got to stop( BundleContext ) " + PLUGIN_NAME );

	// Unregister the spring servlet
	if ( extHttpService != null && dispatcherServlet != null )
	{
		extHttpService.unregisterServlet( dispatcherServlet );
	}

	// Unpublish bundle services
	unpublishBundleServices();

	// Shutting down log4j in order to avoid memory leaks
	Log4jUtil.shutdown( this.pluginLoggerContext );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:18,代码来源:Activator.java

示例4: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void start( BundleContext bundleContext ) throws Exception
{
	// Initializing log4j...
	LoggerContext dotcmsLoggerContext = Log4jUtil.getLoggerContext();

	// Initialing the log4j context of this plugin based on the dotCMS logger context
	this.pluginLoggerContext = (LoggerContext) LogManager.getContext( this.getClass().getClassLoader(), false, dotcmsLoggerContext, dotcmsLoggerContext.getConfigLocation() );

	Logger.info( this, "Got to start( BundleContext ) " + PLUGIN_NAME );

	// Initializing services...
	initializeServices( bundleContext );

	Logger.info( this.getClass(), "Adding RESTful Service: " + ContentletRestServiceLight.class.getSimpleName() );
	RestServiceUtil.addResource( ContentletRestServiceLight.class );

}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:19,代码来源:Activator.java

示例5: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void start( BundleContext bundleContext ) throws Exception
{
	// Initializing log4j...
	LoggerContext dotcmsLoggerContext = Log4jUtil.getLoggerContext();

	// Initialing the log4j context of this plugin based on the dotCMS logger context
	this.pluginLoggerContext = (LoggerContext) LogManager.getContext( this.getClass().getClassLoader(), false, dotcmsLoggerContext, dotcmsLoggerContext.getConfigLocation() );

	Logger.info( this, "Got to start( BundleContext ) " + PLUGIN_NAME );

	// Initializing services...
	initializeServices( bundleContext );

	runJobScheduleReport();

	killQuartzJobs();
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:19,代码来源:Activator.java

示例6: stop

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
public void stop(BundleContext context) throws Exception {
    //Unregister the servlet
    if ( httpService != null && servlet != null ) {
        httpService.unregisterServlet( servlet );
    }

    Logger.info(this.getClass(), "Removing OSGi OAuth Servlet");
    for(Rule rule : rules){

        DotUrlRewriteFilter.getUrlRewriteFilter().removeRule(rule);
    }
    unregisterViewToolServices();

    Logger.info(this.getClass(), "We now have " + DotUrlRewriteFilter.getUrlRewriteFilter().getRules().size() + " rules");

    // close service tracker to stop tracking
    serviceTracker.close();

    //Shutting down log4j in order to avoid memory leaks
    Log4jUtil.shutdown(pluginLoggerContext);

}
 
开发者ID:dotCMS,项目名称:plugin-dotcms-oauth,代码行数:23,代码来源:Activator.java

示例7: stop

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void stop( BundleContext bundleContext ) throws Exception
{
	Logger.info( this, "Got to stop( BundleContext ) " + PLUGIN_NAME );

	unregisterViewToolServices();

	// Shutting down log4j in order to avoid memory leaks
	Log4jUtil.shutdown( this.pluginLoggerContext );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:11,代码来源:Activator.java

示例8: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@SuppressWarnings( { "unchecked", "rawtypes" } )
@Override
public void start( BundleContext bundleContext ) throws Exception
{
	Logger.info( this, "Got to start( BundleContext ) " + PLUGIN_NAME );

	// Initializing services...
	initializeServices( bundleContext );

	ServiceReference serviceReference = bundleContext.getServiceReference( ExtHttpService.class.getName() );

	if ( serviceReference != null )
	{

		ExtHttpService extHttpService = (ExtHttpService) bundleContext.getService( serviceReference );

		extHttpService.registerServlet( URL_1, this.servlet_1, null, null );
		extHttpService.registerFilter( this.filter_1, URL_FILTER_1, null, 0, null );

		extHttpService.registerServlet( URL_2, this.servlet_2, null, null );
		extHttpService.registerFilter( this.filter_2, URL_FILTER_2, null, 0, null );

		// Add Tuckey Filter rules
		// Redirect legacy URLs
		Logger.info( this, "Adding Tuckey Filter regex [" + URL_REGEX_1 + "] -> forward [" + EXCLUDE_URL_1 + "]" );
		addRewriteRule( URL_REGEX_1, EXCLUDE_URL_1, "forward", "WebFormServletForward1" );

		Logger.info( this, "Adding Tuckey Filter regex [" + URL_REGEX_2 + "] -> forward [" + EXCLUDE_URL_2 + "]" );
		addRewriteRule( URL_REGEX_2, EXCLUDE_URL_2, "forward", "WebFormServletForward2" );
	}
	else
	{
		Logger.error( this, "Failure, service reference is null!" );
	}
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:36,代码来源:Activator.java

示例9: stop

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void stop( BundleContext bundleContext ) throws Exception
{
	Logger.info( this, "Got to stop( BundleContext ) " + PLUGIN_NAME );

	// Unregister the RewriteRules
	unregisterRewriteRule();

	// Unregister the services
	unregisterServices( bundleContext );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:12,代码来源:Activator.java

示例10: stop

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void stop( BundleContext bundleContext ) throws Exception
{
	Logger.info( this, "Got to stop( BundleContext ) " + PLUGIN_NAME );

	// Unregister the RewriteRules
	unregisterRewriteRule();

	// Close the service tracker
	this.serviceTracker.close();

	// Shutting down log4j in order to avoid memory leaks
	Log4jUtil.shutdown( this.pluginLoggerContext );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:15,代码来源:Activator.java

示例11: stop

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void stop( BundleContext bundleContext ) throws Exception
{
	Logger.info( this, "Got to stop( BundleContext ) " + PLUGIN_NAME );

	Logger.info( this.getClass(), "Removing RESTful Service: " + ContentletRestServiceLight.class.getSimpleName() );
	RestServiceUtil.removeResource( ContentletRestServiceLight.class );

	// Shutting down log4j in order to avoid memory leaks
	Log4jUtil.shutdown( this.pluginLoggerContext );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:12,代码来源:Activator.java

示例12: stop

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@Override
public void stop( BundleContext bundleContext ) throws Exception
{
	Logger.info( this, "Got to stop( BundleContext ) " + PLUGIN_NAME );

	// Unpublish bundle services
	unpublishBundleServices();

	// Shutting down log4j in order to avoid memory leaks
	Log4jUtil.shutdown( this.pluginLoggerContext );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:12,代码来源:Activator.java

示例13: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@SuppressWarnings( { "unchecked", "rawtypes" } )
@Override
public void start( BundleContext bundleContext ) throws Exception
{
	// Initializing log4j...
	LoggerContext dotcmsLoggerContext = Log4jUtil.getLoggerContext();

	// Initialing the log4j context of this plugin based on the dotCMS logger context
	this.pluginLoggerContext = (LoggerContext) LogManager.getContext( this.getClass().getClassLoader(), false, dotcmsLoggerContext, dotcmsLoggerContext.getConfigLocation() );

	Logger.info( this, "Got to start( BundleContext ) " + PLUGIN_NAME );

	// Initializing services...
	initializeServices( bundleContext );

	this.serviceTracker = new ServiceTracker( bundleContext, ExtHttpService.class.getName(), null )
	{
		@Override
		public Object addingService( ServiceReference serviceReference )
		{
			Logger.info( this, "Got to addingService( ServiceReference ) " + PLUGIN_NAME );

			Object serviceObject =  super.addingService( serviceReference );
			serviceAdded( (ExtHttpService) serviceObject );
			return serviceObject;
		}

		@Override
		public void removedService( ServiceReference serviceReference, Object serviceObject )
		{
			Logger.info( this, "Got to removedService( ServiceReference, Object ) " + PLUGIN_NAME );

			serviceRemoved( (ExtHttpService) serviceObject );
			super.removedService( serviceReference, serviceObject );
		}
	};

	this.serviceTracker.open();

	// Add Tuckey Filter rule
	Logger.info( this, "Adding Tuckey Filter regex [" + URL + "] -> forward [" + EXCLUDE_URL + "]" );
	addRewriteRule( URL, EXCLUDE_URL, "forward", "IpRestrictedServletRedirect" );
}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:44,代码来源:Activator.java

示例14: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
@SuppressWarnings( { "unchecked", "rawtypes" } )
@Override
public void start( BundleContext bundleContext ) throws Exception
{
	// Initializing log4j...
	LoggerContext dotcmsLoggerContext = Log4jUtil.getLoggerContext();

	// Initialing the log4j context of this plugin based on the dotCMS logger context
	this.pluginLoggerContext = (LoggerContext) LogManager.getContext( this.getClass().getClassLoader(), false, dotcmsLoggerContext, dotcmsLoggerContext.getConfigLocation() );

	Logger.info( this, "Got to start( BundleContext ) " + PLUGIN_NAME );

	// Initializing services...
	initializeServices( bundleContext );

	// Service reference to ExtHttpService that will allow us to register servlets and filters
	ServiceReference serviceReference = bundleContext.getServiceReference( ExtHttpService.class.getName() );

	if ( serviceReference != null )
	{
		// Publish bundle services
		publishBundleServices( bundleContext );

		extHttpService = (ExtHttpService) bundleContext.getService( serviceReference );

		try
		{
			dispatcherServlet = new DispatcherServlet();
			dispatcherServlet.setContextConfigLocation( CONFIGURATION_FILE );
			extHttpService.registerServlet( URL, dispatcherServlet, null, null );
		}
		catch ( Exception exception )
		{
			Logger.error( this, "Error registering spring servlet!", exception );
		}

	}
	else
	{
		Logger.error( this, "ServiceReference is null!" );
	}

}
 
开发者ID:nkeiter,项目名称:generic-dotCMS-plugin-code-examples,代码行数:44,代码来源:Activator.java

示例15: start

import com.dotcms.repackage.org.osgi.framework.BundleContext; //导入依赖的package包/类
public void start(BundleContext bundleContext) throws Exception {
	// Initializing services...
	initializeServices(bundleContext);

	// Registering the ViewTool service
	registerViewToolService(bundleContext, new XmlAuthToolInfo());

	Logger.info(this.getClass(), "Starting XmlAuthTool");

}
 
开发者ID:dotCMS,项目名称:plugin-xmltool-with-auth,代码行数:11,代码来源:Activator.java


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