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


Java URLStreamHandlerService类代码示例

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


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

示例1: stop

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
@Test
public void stop() throws Exception {
  BundleContext mockBundleContext = mock( BundleContext.class );

  final ServiceRegistration mockArtifactUrlTransformerRegistration = mock( ServiceRegistration.class );
  when( mockBundleContext
      .registerService( eq( ArtifactUrlTransformer.class ), any( ArtifactUrlTransformer.class ), any() ) )
      .thenReturn( mockArtifactUrlTransformerRegistration );

  final ServiceRegistration mockURLStreamHandlerServiceRegistration = mock( ServiceRegistration.class );
  when( mockBundleContext
      .registerService( eq( URLStreamHandlerService.class ), any( URLStreamHandlerService.class ), any() ) )
      .thenReturn( mockURLStreamHandlerServiceRegistration );

  this.activator.start( mockBundleContext );

  this.activator.stop( mockBundleContext );

  verify( mockArtifactUrlTransformerRegistration, times( 1 ) ).unregister();
  verify( mockURLStreamHandlerServiceRegistration, times( 1 ) ).unregister();
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:22,代码来源:ActivatorTest.java

示例2: registerTomcatJNDIUrlService

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
private ServiceRegistration registerTomcatJNDIUrlService() {
	Properties properties = new Properties();
	properties.put(URLConstants.URL_HANDLER_PROTOCOL, "jndi");
	final URLStreamHandler handler = new DirContextURLStreamHandler();

	return bundleContext.registerService(URLStreamHandlerService.class.getName(),
		new AbstractURLStreamHandlerService() {

			private final static String EMPTY_STRING = "";


			public URLConnection openConnection(URL u) throws IOException {
				return new URL(u, EMPTY_STRING, handler).openConnection();
			}
		}, properties);
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:17,代码来源:Activator.java

示例3: start

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
    callbacks.add(new Service(context, URLStreamHandlerService.class.getName(), new BpmnURLHandler(), props("url.handler.protocol", "bpmn")));
    callbacks.add(new Service(context, URLStreamHandlerService.class.getName(), new BarURLHandler(), props("url.handler.protocol", "bar")));
    try {
        callbacks.add(new Service(context, new String[]{ArtifactUrlTransformer.class.getName(), ArtifactListener.class.getName()}, new BpmnDeploymentListener(), null));
        callbacks.add(new Service(context, new String[]{ArtifactUrlTransformer.class.getName(), ArtifactListener.class.getName()}, new BarDeploymentListener(), null));
    } catch (NoClassDefFoundError e) {
        LOGGER.warn("FileInstall package is not available, disabling fileinstall support");
        LOGGER.debug("FileInstall package is not available, disabling fileinstall support", e);
    }
    callbacks.add(new Tracker(new Extender(context)));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:14,代码来源:Activator.java

示例4: start

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
public void start(BundleContext context) throws Exception {
    callbacks.add(new Service(
            context,
            URLStreamHandlerService.class.getName(),
            new BpmnURLHandler(),
            props("url.handler.protocol", "bpmn")));
    callbacks.add(new Service(
            context,
            URLStreamHandlerService.class.getName(),
            new BarURLHandler(),
            props("url.handler.protocol", "bar")));
    try {
        callbacks.add(new Service(
                context,
                new String[] { ArtifactUrlTransformer.class.getName(), ArtifactListener.class.getName() },
                new BpmnDeploymentListener(),
                null));
        callbacks.add(new Service(
                context,
                new String[] { ArtifactUrlTransformer.class.getName(), ArtifactListener.class.getName() },
                new BarDeploymentListener(),
                null));
    } catch (NoClassDefFoundError e) {
        LOGGER.log( Level.WARNING, "FileInstall package is not available, disabling fileinstall support" );
        LOGGER.log( Level.FINE, "FileInstall package is not available, disabling fileinstall support", e );
    }
    callbacks.add(new Tracker(new Extender(context)));
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:29,代码来源:Activator.java

示例5: start

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
public void start( BundleContext bundleContext ) {
  this.urlTransformer = new UrlTransformer();
  this.urlTransformerRegistration = bundleContext.registerService( ArtifactUrlTransformer.class, this.urlTransformer, null );

  this.urlHandler = new UrlHandler();

  Dictionary<String, String> props = new Hashtable<>();
  props.put( URLConstants.URL_HANDLER_PROTOCOL, WebPackageURLConnection.URL_PROTOCOL );

  this.urlHandlerRegistration = bundleContext.registerService( URLStreamHandlerService.class, this.urlHandler, props );
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:12,代码来源:Activator.java

示例6: start

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
@Test
public void start() throws Exception {
  BundleContext mockBundleContext = mock( BundleContext.class );

  this.activator.start( mockBundleContext );

  verify( mockBundleContext, times( 1 ) ).registerService( eq( ArtifactUrlTransformer.class ), any( ArtifactUrlTransformer.class ), any() );
  verify( mockBundleContext, times( 1 ) ).registerService( eq( URLStreamHandlerService.class ), any( URLStreamHandlerService.class ), any() );
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:10,代码来源:ActivatorTest.java

示例7: init

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
@Override
public void init(BundleContext context, DependencyManager manager) throws Exception {
  manager.add(createComponent().setInterface(new String[] { ArtifactUrlTransformer.class.getName(), ArtifactListener.class.getName() }, null)
      .setImplementation(BpmnDeploymentListener.class));
  manager.add(createComponent().setInterface(URLStreamHandlerService.class.getName(),
      new Hashtable<String, String>(Collections.singletonMap("url.handler.protocol", "bpmn"))).setImplementation(BpmnURLHandler.class));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:8,代码来源:Activator.java

示例8: activate

import org.osgi.service.url.URLStreamHandlerService; //导入依赖的package包/类
protected void activate(final ComponentContext context) {
    final Hashtable<String, String> dict = new Hashtable<String, String>();
    dict.put(URLConstants.URL_HANDLER_PROTOCOL, "httppgp");
    context.getBundleContext().registerService(
            URLStreamHandlerService.class.getName(), this, dict);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:7,代码来源:HttpPgpUrlStreamHandlerServiceImpl.java


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