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


Java TransportServer类代码示例

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


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

示例1: createSslTransportServer

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
/**
 * Creates a TransportServer that uses the given key and trust managers. The
 * last three parameters will be eventually passed to SSLContext.init.
 * 
 * @param brokerURI The URI to bind to.
 * @param km The KeyManager to be used.
 * @param tm The trustmanager to be used.
 * @param random The source of randomness for the generator.
 * @return A new TransportServer that uses the given managers.
 * @throws IOException If cannot handle URI.
 * @throws KeyManagementException Passed on from SSL.
 */
protected TransportServer createSslTransportServer(URI brokerURI, KeyManager[] km, TrustManager[] tm, SecureRandom random) throws IOException, KeyManagementException {

    if (brokerURI.getScheme().equals("ssl")) {
        // If given an SSL URI, use an SSL TransportFactory and configure
        // it to use the given key and trust managers.
        SslTransportFactory transportFactory = new SslTransportFactory();
        
        SslContext ctx = new SslContext(km, tm, random);
        SslContext.setCurrentSslContext(ctx);
        try {
            return transportFactory.doBind(brokerURI);
        } finally {
            SslContext.setCurrentSslContext(null);
        }
        
    } else {
        // Else, business as usual.
        return TransportFactorySupport.bind(this, brokerURI);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:33,代码来源:SslBrokerService.java

示例2: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
/**
 * Overriding to use SslTransportServer and allow for proper reflection.
 */
public TransportServer doBind(final URI location) throws IOException {
    try {
        Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));

        ServerSocketFactory serverSocketFactory = createServerSocketFactory();
        SslTransportServer server = createSslTransportServer(location, (SSLServerSocketFactory)serverSocketFactory);
        server.setWireFormatFactory(createWireFormatFactory(options));
        IntrospectionSupport.setProperties(server, options);
        Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
        server.setTransportOption(transportOptions);
        server.bind();

        return server;
    } catch (URISyntaxException e) {
        throw IOExceptionSupport.create(e);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:21,代码来源:SslTransportFactory.java

示例3: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
@Override
public TransportServer doBind(final URI location) throws IOException {
   try {
      Map<String, String> options = new HashMap<>(URISupport.parseParameters(location));

      ServerSocketFactory serverSocketFactory = createServerSocketFactory();
      TcpTransportServer server = createTcpTransportServer(location, serverSocketFactory);
      server.setWireFormatFactory(createWireFormatFactory(options));
      IntrospectionSupport.setProperties(server, options);
      Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
      server.setTransportOption(transportOptions);
      server.bind();

      return server;
   } catch (URISyntaxException e) {
      throw IOExceptionSupport.create(e);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:TcpTransportFactory.java

示例4: createLocalBroker

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
private void createLocalBroker() throws Exception {
   localBroker = new BrokerService();
   localBroker.setBrokerName("LOCAL");
   localBroker.setUseJmx(true);
   localBroker.setSchedulePeriodForDestinationPurge(5000);
   ManagementContext managementContext = new ManagementContext();
   managementContext.setCreateConnector(false);
   localBroker.setManagementContext(managementContext);
   PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/local");
   localBroker.setPersistenceAdapter(persistenceAdapter);
   List<TransportConnector> transportConnectors = new ArrayList<>();
   DebugTransportFactory tf = new DebugTransportFactory();
   TransportServer transport = tf.doBind(URI.create("nio://127.0.0.1:23539"));
   TransportConnector transportConnector = new TransportConnector(transport);
   transportConnector.setName("tc");
   transportConnector.setAuditNetworkProducers(true);
   transportConnectors.add(transportConnector);
   localBroker.setTransportConnectors(transportConnectors);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:CheckDuplicateMessagesOnDuplexTest.java

示例5: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
@Override
public TransportServer doBind(final URI location) throws IOException {
   try {
      Map<String, String> options = new HashMap<>(URISupport.parseParameters(location));

      ServerSocketFactory serverSocketFactory = createServerSocketFactory();
      TcpFaultyTransportServer server = createTcpFaultyTransportServer(location, serverSocketFactory);
      server.setWireFormatFactory(createWireFormatFactory(options));
      IntrospectionSupport.setProperties(server, options);
      Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
      server.setTransportOption(transportOptions);
      server.bind();

      return server;
   } catch (URISyntaxException e) {
      throw IOExceptionSupport.create(e);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:19,代码来源:TcpFaultyTransportFactory.java

示例6: createVmTransportServer

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
private TransportServer createVmTransportServer(final URI vmUri) {
    try {
        return new VMTransportFactory().doBind(vmUri);
    } catch (IOException e) {
        throw new IllegalStateException("Could not setup VM transport", e);
    }
}
 
开发者ID:zapodot,项目名称:embedded-jms-junit,代码行数:8,代码来源:EmbeddedJmsRuleImpl.java

示例7: TransportConnector

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
public TransportConnector(TransportServer server) {
    this();
    setServer(server);
    if (server != null && server.getConnectURI() != null) {
        URI uri = server.getConnectURI();
        if (uri != null && uri.getScheme().equals("vm")) {
            setEnableStatusMonitor(false);
        }
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:11,代码来源:TransportConnector.java

示例8: createTransportServer

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
protected TransportServer createTransportServer() throws IOException, URISyntaxException {
    if (uri == null) {
        throw new IllegalArgumentException("You must specify either a server or uri property");
    }
    if (brokerService == null) {
        throw new IllegalArgumentException(
                "You must specify the brokerService property. Maybe this connector should be added to a broker?");
    }
    return TransportFactorySupport.bind(brokerService, uri);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:11,代码来源:TransportConnector.java

示例9: bind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
/**
 * @param location
 * @return the TransportServer
 * @throws IOException
 */
private TransportServer bind(URI location, boolean dispose) throws IOException {
    String host = extractHost(location);
    LOG.debug("binding to broker: " + host);
    VMTransportServer server = new VMTransportServer(location, dispose);
    Object currentBoundValue = SERVERS.get(host);
    if (currentBoundValue != null) {
        throw new IOException("VMTransportServer already bound at: " + location);
    }
    SERVERS.put(host, server);
    return server;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:17,代码来源:VMTransportFactory.java

示例10: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
@Override
public TransportServer doBind(URI location) throws IOException {
    if (SslContext.getCurrentSslContext() != null) {
        try {
            context = SslContext.getCurrentSslContext().getSSLContext();
        } catch (Exception e) {
            throw new IOException(e);
        }
    }
    return super.doBind(location);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:12,代码来源:StompNIOSSLTransportFactory.java

示例11: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
public TransportServer doBind(URI location) throws IOException {
        throw new IOException("Invalid server URI: " + location);
// try{
//            CompositeData compositData=URISupport.parseComposite(location);
//            URI[] components=compositData.getComponents();
//            if(components.length!=1){
//                throw new IOException("Invalid location: "+location
//                                +", the location must have 1 and only 1 composite URI in it - components = "
//                                +components.length);
//            }
//            Map parameters=new HashMap(compositData.getParameters());
//            DiscoveryTransportServer server=new DiscoveryTransportServer(TransportFactory.bind(value,components[0]));
//            IntrospectionSupport.setProperties(server,parameters,"discovery");
//            DiscoveryAgent discoveryAgent=DiscoveryAgentFactory.createDiscoveryAgent(server.getDiscovery());
//            // Use the host name to configure the group of the discovery agent.
//            if(!parameters.containsKey("discovery.group")){
//                if(compositData.getHost()!=null){
//                    parameters.put("discovery.group",compositData.getHost());
//                }
//            }
//            if(!parameters.containsKey("discovery.brokerName")){
//                parameters.put("discovery.brokerName",value);
//            }
//            IntrospectionSupport.setProperties(discoveryAgent,parameters,"discovery.");
//            server.setDiscoveryAgent(discoveryAgent);
//            return server;
//        }catch(URISyntaxException e){
//            throw new IOException("Invalid location: "+location);
//        }
    }
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:31,代码来源:DiscoveryTransportFactory.java

示例12: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
public TransportServer doBind(URI location) throws IOException {
    try {
        Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));
        WSTransportServer result = new WSTransportServer(location);
        Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "");
        result.setTransportOption(transportOptions);
        return result;
    } catch (URISyntaxException e) {
        throw IOExceptionSupport.create(e);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:12,代码来源:WSTransportFactory.java

示例13: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
public TransportServer doBind(URI location) throws IOException {
    try {
        Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));
        HttpsTransportServer result = new HttpsTransportServer(location, this, SslContext.getCurrentSslContext());
        Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
        result.setTransportOption(transportOptions);
        return result;
    } catch (URISyntaxException e) {
        throw IOExceptionSupport.create(e);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:12,代码来源:HttpsTransportFactory.java

示例14: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
public TransportServer doBind(URI location) throws IOException {
    try {
        Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));
        HttpTransportServer result = new HttpTransportServer(location, this);
        Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
        result.setTransportOption(transportOptions);
        return result;
    } catch (URISyntaxException e) {
        throw IOExceptionSupport.create(e);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:12,代码来源:HttpTransportFactory.java

示例15: doBind

import org.apache.activemq.transport.TransportServer; //导入依赖的package包/类
public TransportServer doBind(URI location) throws IOException {
    try {
        Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location));
        WSSTransportServer result = new WSSTransportServer(location, SslContext.getCurrentSslContext());
        Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "");
        result.setTransportOption(transportOptions);
        return result;
    } catch (URISyntaxException e) {
        throw IOExceptionSupport.create(e);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:12,代码来源:WSSTransportFactory.java


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