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


Java Bus.getExtension方法代码示例

本文整理汇总了Java中org.apache.cxf.Bus.getExtension方法的典型用法代码示例。如果您正苦于以下问题:Java Bus.getExtension方法的具体用法?Java Bus.getExtension怎么用?Java Bus.getExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cxf.Bus的用法示例。


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

示例1: initServerLookupMap

import org.apache.cxf.Bus; //导入方法依赖的package包/类
/**
 * Iterate over all available servers registered on the bus and build a map
 * consisting of (namespace, server) pairs for later lookup, so we can
 * redirect to the version-specific implementation according to the namespace
 * of the incoming message.
 */
private void initServerLookupMap(SoapMessage message) {
    Bus bus = message.getExchange().getBus();

    ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
    if (serverRegistry == null) {
        return;
    }

    List<Server> temp = serverRegistry.getServers();
    for (Server server : temp) {
        EndpointInfo info = server.getEndpoint().getEndpointInfo();
        String address = info.getAddress();

        // exclude the 'dummy' routing server
        if (CONFIG.getRouterEndpointPath().equals(address)) {
            continue;
        }

        String serverNamespace = info.getName().getNamespaceURI();
        actualServers.put(serverNamespace, server);
    }
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:29,代码来源:MediatorInInterceptor.java

示例2: startAndStopService

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Test
public void startAndStopService() throws Exception {
    CamelContext context = new DefaultCamelContext();
    // start a server    
    context.addRoutes(new RouteBuilder() {
        public void configure() {
            from("cxf:http://localhost:" + PORT1 + "/test?serviceClass=org.apache.camel.component.cxf.HelloService")
                .to("log:endpoint");
        }
    });
    
    context.start();
    Thread.sleep(300);
    context.stop();
    Bus bus = BusFactory.getDefaultBus();
    JettyHTTPServerEngineFactory factory = bus.getExtension(JettyHTTPServerEngineFactory.class);
    JettyHTTPServerEngine engine = factory.retrieveJettyHTTPServerEngine(PORT1);
    assertNotNull("Jetty engine should be found there", engine);
    // Need to call the bus shutdown ourselves.
    String orig = System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", "false");
    bus.shutdown(true);
    System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort",
                       orig == null ? "true" : "false");
    engine = factory.retrieveJettyHTTPServerEngine(PORT1);
    assertNull("Jetty engine should be removed", engine);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:CxfCustomerStartStopTest.java

示例3: startAndStopServiceFromSpring

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Test
public void startAndStopServiceFromSpring() throws Exception {
    System.setProperty("CamelCxfConsumerContext.port2", Integer.toString(PORT2));
    
    ClassPathXmlApplicationContext applicationContext = 
        new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/CamelCxfConsumerContext.xml");
    Bus bus = applicationContext.getBean("cxf", Bus.class);
    // Bus shutdown will be called when the application context is closed.
    String orig = System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", "false");
    IOHelper.close(applicationContext);
    System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort",
                       orig == null ? "true" : "false");
    JettyHTTPServerEngineFactory factory = bus.getExtension(JettyHTTPServerEngineFactory.class);
    // test if the port is still used
    JettyHTTPServerEngine engine = factory.retrieveJettyHTTPServerEngine(PORT2);
    assertNull("Jetty engine should be removed", engine);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:CxfCustomerStartStopTest.java

示例4: testDefaultWrapperInstalled

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Test
@RunAsClient
public void testDefaultWrapperInstalled() throws Exception {
   Bus bus = BusFactory.newInstance().createBus();
   try {
      HTTPConduitFactory hcf = bus.getExtension(HTTPConduitFactory.class);
      assertNotNull(hcf);
      assertTrue(hcf instanceof DefaultHTTPConduitFactoryWrapper);
      
      URL wsdlURL = new URL(baseURL + "/ServiceOne" + "?wsdl");
      Service service = Service.create(wsdlURL, new QName("http://org.jboss.ws.jaxws.cxf/httpConduit", "ServiceOne"));
      EndpointOne port = service.getPort(new QName("http://org.jboss.ws.jaxws.cxf/httpConduit", "EndpointOnePort"), EndpointOne.class);
      assertEquals("Foo", port.echo("Foo"));
   } finally {
      bus.shutdown(true);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:18,代码来源:HTTPConduitTestCase.java

示例5: testUnsupportedPolicy

import org.apache.cxf.Bus; //导入方法依赖的package包/类
/**
 * Verifies the policy-enabled client can be configured to ignore a given policy in the wsdl contract
 * 
 * @throws Exception
 */
@Test
@RunAsClient
public void testUnsupportedPolicy() throws Exception
{
   Bus bus = BusFactory.newInstance().createBus();
   try
   {
      BusFactory.setThreadDefaultBus(bus);
      
      PolicyInterceptorProviderRegistry reg = bus.getExtension(PolicyInterceptorProviderRegistry.class);
      reg.register(new IgnorablePolicyInterceptorProvider(new QName("http://my.custom.org/policy", "MyPolicy")));
      
      URL wsdlURL = new URL(baseURL + "/jaxws-cxf-policy/PIPService/PIPEndpoint?wsdl");
      QName serviceName = new QName("http://policy.cxf.jaxws.ws.test.jboss.org/", "PIPService");
      Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
      QName portQName = new QName("http://policy.cxf.jaxws.ws.test.jboss.org/", "PIPEndpointPort");
      PIPEndpoint port = (PIPEndpoint)service.getPort(portQName, PIPEndpoint.class);

      assertEquals("foo", port.echo("foo"));
   }
   finally
   {
      bus.shutdown(true);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:31,代码来源:PolicyInterceptorProviderTestCase.java

示例6: testCustomClientLifeCycleListener

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Test
@RunAsClient
public void testCustomClientLifeCycleListener() throws Exception
{
   Bus bus = BusFactory.newInstance().createBus();
   BusFactory.setThreadDefaultBus(bus);
   try {
      URL wsdlOneURL = new URL(baseURL + "/ServiceOne/EndpointOne?wsdl");
      QName serviceOneName = new QName("http://org.jboss.ws.jaxws.cxf/jbws3098", "ServiceOne");
      Service serviceOne = Service.create(wsdlOneURL, serviceOneName, new UseThreadBusFeature());
      CustomClientLifeCycleListener listener = new CustomClientLifeCycleListener();
      ClientLifeCycleManager mgr = bus.getExtension(ClientLifeCycleManager.class);
      try {
         mgr.registerListener(listener);
         assertEquals(0, listener.getCount());
         EndpointOne portOne = (EndpointOne)serviceOne.getPort(EndpointOne.class);
         assertEquals(1, listener.getCount());
         assertEquals("Foo", portOne.echo("Foo"));
      } finally {
         mgr.unRegisterListener(listener);
      }
   } finally {
      bus.shutdown(true);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:26,代码来源:ClientServerLifeCycleTestCase.java

示例7: setBindingCustomizationOnClientSide

import org.apache.cxf.Bus; //导入方法依赖的package包/类
/**
 * Setup binding customization on client side using the JBossWSConfigurer
 *
 * @throws Exception
 */
@SuppressWarnings("unchecked")
private Bus setBindingCustomizationOnClientSide() throws Exception
{
   BindingCustomization jaxbCustomizations = new JAXBBindingCustomization();
   if (jaxbIntroUrl == null)
   {
      jaxbIntroUrl = Thread.currentThread().getContextClassLoader().getResource("jaxb-intros.xml");
   }
   BindingCustomizationFactory.populateBindingCustomization(jaxbIntroUrl.openStream(), jaxbCustomizations);

   Bus bus = BusFactory.newInstance().createBus();
   BusFactory.setThreadDefaultBus(bus);
   JBossWSConfigurer configurer = (JBossWSConfigurer)bus.getExtension(Configurer.class);
   configurer.getCustomizer().setBindingCustomization(jaxbCustomizations);
   return bus;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:22,代码来源:Helper.java

示例8: importFrom

import org.apache.cxf.Bus; //导入方法依赖的package包/类
public void importFrom(String url) {
  this.wsServices.clear();
  this.wsOperations.clear();
  this.structures.clear();

  this.wsdlLocation = url;

  try {
    Bus bus = BusFactory.getDefaultBus();
    WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
    Definition def = wsdlManager.getDefinition(url);
    WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
    List<ServiceInfo> services = builder.buildServices(def);
    
    for (ServiceInfo service : services) {
      WSService wsService = this.importService(service);
      this.wsServices.put(this.namespace + wsService.getName(), wsService);
    }
    
    this.importTypes(def.getTypes());
  } catch (WSDLException e) {
    e.printStackTrace();
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:CxfWSDLImporter.java

示例9: getTheBusInstance

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Test
public void getTheBusInstance() {
    Bus bus = ctx.getBean("cxfBus", Bus.class);
    assertNotNull("The bus should not be null", bus);
    
    bus = ctx.getBean("myBus", Bus.class);
    assertNotNull("The bus should not be null", bus);

    SoapBindingFactory soapBindingFactory = bus.getExtension(SoapBindingFactory.class);
    assertNotNull("You should find the factory here", soapBindingFactory);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:SpringBusFactoryBeanTest.java

示例10: initFrameworkServlet

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Override
protected void initFrameworkServlet() throws ServletException, BeansException {
	this.httpInvokerHandler = new KSBHttpInvokerHandler();
	
       Bus bus = KSBServiceLocator.getCXFBus();

       List<Interceptor<? extends Message>> inInterceptors = KSBServiceLocator.getInInterceptors();
       if(inInterceptors != null) {
       	List<Interceptor<? extends Message>> busInInterceptors = bus.getInInterceptors();
       	busInInterceptors.addAll(inInterceptors);
       }
      
       List<Interceptor<? extends Message>> outInterceptors = KSBServiceLocator.getOutInterceptors();
       if(outInterceptors != null) {
       	List<Interceptor<? extends Message>> busOutInterceptors = bus.getOutInterceptors();
       	busOutInterceptors.addAll(outInterceptors);
       }


	HTTPTransportFactory transportFactory = bus.getExtension(HTTPTransportFactory.class);
       if (transportFactory == null) {
           throw new IllegalStateException("Failed to locate HTTPTransportFactory extension on Apache CXF Bus");
       }

       DestinationRegistry destinationRegistry = transportFactory.getRegistry();


	this.cxfServletController = new ServletController(destinationRegistry, getCXFServletConfig(
               this.getServletConfig()), new ServiceListGeneratorServlet(destinationRegistry, bus));

	this.setPublishEvents(false);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:KSBDispatcherServlet.java

示例11: testCatalogOnClientSide

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Test
@RunAsClient
public void testCatalogOnClientSide() throws Exception
{
   Bus bus = BusFactory.newInstance().createBus();
   try {
      BusFactory.setThreadDefaultBus(bus);

      URL archiveURL =  JBossWSTestHelper.getArchiveURL("jaxws-cxf-catalog.war");

      // add archive to classpath
      ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader();
      URLClassLoader urlClassLoader
         = new URLClassLoader(new URL[]{archiveURL}, currentThreadClassLoader);
      Thread.currentThread().setContextClassLoader(urlClassLoader);

      QName serviceName = new QName(
         org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
         org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
      URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
      Service service = Service.create(wsdlURL, serviceName);

      OASISCatalogManager catalogManager = bus.getExtension(OASISCatalogManager.class);
      assertNotNull("OASISCatalogManager not provided ", catalogManager);

      String xsd = "http://org.jboss.ws/cxf/catalogclient/ws-addr.xsd";
      String resolvedSchemaLocation = catalogManager.resolveSystem(xsd);
      assertEquals("http://org.foo.bar/client/ws-addr.xsd", resolvedSchemaLocation);

   } finally {
      bus.shutdown(true);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:34,代码来源:OasisCatalogHelloWSTestCase.java

示例12: testCatalogInJbosswsCxfClientJar

import org.apache.cxf.Bus; //导入方法依赖的package包/类
@Test
@RunAsClient
public void testCatalogInJbosswsCxfClientJar() throws Exception
{
   Bus bus = BusFactory.newInstance().createBus();
   try {
      BusFactory.setThreadDefaultBus(bus);

      QName serviceName = new QName(
         org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
         org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
      URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
      Service service = Service.create(wsdlURL, serviceName);

      // jbossws-cxf-client.Jar is on the classpath by default.
      // cxf processed it during service creation.
      OASISCatalogManager catalogManager = bus.getExtension(OASISCatalogManager.class);
      assertNotNull("OASISCatalogManager not provided ", catalogManager);

      String xsd = "http://ws-i.org/profiles/basic/1.1/ws-addr.xsd";
      String resolvedSchemaLocation = catalogManager.resolveSystem(xsd);
      assertEquals("classpath:/schemas/wsdl/ws-addr.xsd", resolvedSchemaLocation);

   } finally {
      bus.shutdown(true);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:28,代码来源:OasisCatalogHelloWSTestCase.java

示例13: replaceWrapper

import org.apache.cxf.Bus; //导入方法依赖的package包/类
private DefaultHTTPConduitFactoryWrapper replaceWrapper(Map<String, Object> args, Bus bus)
{
   HTTPConduitFactory hcf = bus.getExtension(HTTPConduitFactory.class);
   //replace wrapper
   DefaultHTTPConduitFactoryWrapper w = new DefaultHTTPConduitFactoryWrapper(args, false,
         ((AbstractHTTPConduitFactoryWrapper) hcf).getDelegate());
   bus.setExtension(w, HTTPConduitFactory.class);
   return w;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:10,代码来源:HTTPConduitTestCase.java

示例14: createNewBus

import org.apache.cxf.Bus; //导入方法依赖的package包/类
private Bus createNewBus(final UnifiedServiceRefMetaData serviceRefMD)
{
   final Bus bus;
   Bus threadBus = BusFactory.getThreadDefaultBus(false);
   bus = threadBus != null ? threadBus : BusFactory.newInstance().createBus();

   Configurer configurer = bus.getExtension(Configurer.class);
   bus.setExtension(new CXFServiceRefStubPropertyConfigurer(serviceRefMD, configurer), Configurer.class);

   return bus;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:12,代码来源:CXFServiceObjectFactoryJAXWS.java

示例15: getConduitInitiator

import org.apache.cxf.Bus; //导入方法依赖的package包/类
private ConduitInitiator getConduitInitiator(String address) throws SOAPException 
{
   ConduitInitiator ci = null;
   try 
   {
      //do not use getThreadDefaultBus(true) in order to avoid getting the default bus
      Bus bus = BusFactory.getThreadDefaultBus(false);
      if (bus == null)
      {
         bus = BusFactory.newInstance().createBus();
      }
      ConduitInitiatorManager mgr = bus.getExtension(ConduitInitiatorManager.class);
        
      if (address.startsWith("http")) 
      {
         ci = mgr.getConduitInitiator("http://cxf.apache.org/transports/http");
      } 
      if (ci == null) 
      {
         ci = mgr.getConduitInitiatorForUri(address);
      }
        
   } 
   catch (Exception ex) 
   {
      throw MESSAGES.noConduitInitiatorAvailableFor2(address, ex);
   }
    
   if (ci == null) 
   {
      throw MESSAGES.noConduitInitiatorAvailableFor(address);
   }
   return ci;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:35,代码来源:SOAPConnectionImpl.java


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