本文整理汇总了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() );
}
示例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() );
}
示例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 );
}
示例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 );
}
示例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();
}
示例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);
}
示例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 );
}
示例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!" );
}
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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" );
}
示例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!" );
}
}
示例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");
}