當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。