• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConnectionInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: isEmbeddedConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
/**
 * Check if the connection is internal
 * 
 * @param context
 *            the context
 * @param info
 *            the connection info
 * @return true if the connection is embedded
 */
private boolean isEmbeddedConnection(ConnectionContext context, ConnectionInfo info) {
    if (embeddedConfiguration != null) {
        // check the username and password of the connection
        if (embeddedConfiguration.getUsername().equals(info.getUserName())
                && embeddedConfiguration.getPassword()
                        .equals(info.getPassword())) {

            // check if its local
            if (CommunoteJaasLoginModule.isAddressLocal(context
                    .getConnection().getRemoteAddress())) {

                // it is as an embedded connection
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:28,代码来源:CommunoteJaasAuthenticationBroker.java


示例2: useCertificateAuthentication

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
/**
 * Determine if a client certificate authentication should be tried.
 * 
 * @param connector
 *            the connector
 * @param info
 *            the connection info
 * @return true if the certificate authentication should be used.
 * @throws IOException
 *             in case of an error
 * @throws URISyntaxException
 *             in case of an error
 */
private boolean useCertificateAuthentication(Connector connector, ConnectionInfo info)
        throws IOException,
        URISyntaxException {
    boolean isSSL = isSslConnection(connector);

    boolean haveUsernamePassword = info.getUserName() != null && info.getPassword() != null;

    // if its as ssl request and we force a client certificate we will do the certificate
    // authentication
    if (isSSL && this.settingsDao.isForceSSLClientAuthentication()) {
        return true;
    }

    // if we have a password, use it
    if (haveUsernamePassword) {
        return false;
    }

    // finally depend on the SSL flag
    return isSSL;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:35,代码来源:CommunoteJaasAuthenticationBroker.java


示例3: addConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
/**
 * Overridden to allow for authentication using different Jaas
 * configurations depending on if the connection is SSL or not.
 *
 * @param context The context for the incoming Connection.
 * @param info The ConnectionInfo Command representing the incoming
 *                connection.
 */
@Override
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
    if (context.getSecurityContext() == null) {
        boolean isSSL;
        Connector connector = context.getConnector();
        if (connector instanceof TransportConnector) {
            TransportConnector transportConnector = (TransportConnector) connector;
            isSSL = transportConnector.getServer().isSslServer();
        } else {
            isSSL = false;
        }

        if (isSSL) {
            this.sslBroker.addConnection(context, info);
        } else {
            this.nonSslBroker.addConnection(context, info);
        }
        super.addConnection(context, info);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:29,代码来源:JaasDualAuthenticationBroker.java


示例4: removeConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
/**
 * Overriding removeConnection to make sure the security context is cleaned.
 */
@Override
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
    boolean isSSL;
    Connector connector = context.getConnector();
    if (connector instanceof TransportConnector) {
        TransportConnector transportConnector = (TransportConnector) connector;
        isSSL = (transportConnector.getServer() instanceof SslTransportServer);
    } else {
        isSSL = false;
    }
    super.removeConnection(context, info, error);
    if (isSSL) {
        this.sslBroker.removeConnection(context, info, error);
    } else {
        this.nonSslBroker.removeConnection(context, info, error);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:21,代码来源:JaasDualAuthenticationBroker.java


示例5: populateObject

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ConnectionInfo info = (ConnectionInfo) object;

   info.setConnectionId(createConnectionId("ConnectionId:1"));
   info.setClientId("ClientId:2");
   info.setPassword("Password:3");
   info.setUserName("UserName:4");
   {
      BrokerId value[] = new BrokerId[2];
      for (int i = 0; i < 2; i++) {
         value[i] = createBrokerId("BrokerPath:5");
      }
      info.setBrokerPath(value);
   }
   info.setBrokerMasterConnector(true);
   info.setManageable(false);
   info.setClientMaster(true);
   info.setFaultTolerant(false);
   info.setFailoverReconnect(true);
   info.setClientIp("ClientIp:6");
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:24,代码来源:ConnectionInfoTest.java


示例6: populateObject

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ConnectionInfo info = (ConnectionInfo) object;

   info.setConnectionId(createConnectionId("ConnectionId:1"));
   info.setClientId("ClientId:2");
   info.setPassword("Password:3");
   info.setUserName("UserName:4");
   {
      BrokerId value[] = new BrokerId[2];
      for (int i = 0; i < 2; i++) {
         value[i] = createBrokerId("BrokerPath:5");
      }
      info.setBrokerPath(value);
   }
   info.setBrokerMasterConnector(true);
   info.setManageable(false);
   info.setClientMaster(true);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:ConnectionInfoTest.java


示例7: AMQSession

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
public AMQSession(ConnectionInfo connInfo,
                  SessionInfo sessInfo,
                  ActiveMQServer server,
                  OpenWireConnection connection,
                  OpenWireProtocolManager protocolManager) {
   this.connInfo = connInfo;
   this.sessInfo = sessInfo;

   this.server = server;
   this.connection = connection;
   this.protocolManager = protocolManager;
   this.scheduledPool = protocolManager.getScheduledPool();
   OpenWireFormat marshaller = (OpenWireFormat) connection.getMarshaller();

   this.converter = new OpenWireMessageConverter(marshaller.copy());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:AMQSession.java


示例8: testAddConsumerThenSend

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
public void testAddConsumerThenSend() throws Exception {

      // Start a producer and consumer
      StubConnection connection = createConnection();
      ConnectionInfo connectionInfo = createConnectionInfo();
      SessionInfo sessionInfo = createSessionInfo(connectionInfo);
      ProducerInfo producerInfo = createProducerInfo(sessionInfo);
      connection.send(connectionInfo);
      connection.send(sessionInfo);
      connection.send(producerInfo);

      destination = createDestinationInfo(connection, connectionInfo, destinationType);

      ConsumerInfo consumerInfo = createConsumerInfo(sessionInfo, destination);
      connection.send(consumerInfo);

      connection.send(createMessage(producerInfo, destination, deliveryMode));

      // Make sure the message was delivered.
      Message m = receiveMessage(connection);
      assertNotNull(m);
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:BrokerTest.java


示例9: populateObject

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ConnectionInfo info = (ConnectionInfo) object;

   info.setConnectionId(createConnectionId("ConnectionId:1"));
   info.setClientId("ClientId:2");
   info.setPassword("Password:3");
   info.setUserName("UserName:4");
   {
      BrokerId value[] = new BrokerId[2];
      for (int i = 0; i < 2; i++) {
         value[i] = createBrokerId("BrokerPath:5");
      }
      info.setBrokerPath(value);
   }
   info.setBrokerMasterConnector(true);
   info.setManageable(false);
   info.setClientMaster(true);
   info.setFaultTolerant(false);
   info.setFailoverReconnect(true);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:ConnectionInfoTest.java


示例10: removeConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
@Override
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
    String clientId = info.getClientId();
    if (clientId == null) {
        throw new InvalidClientIDException("No clientID specified for connection disconnect request");
    }
    synchronized (clientIdSet) {
        ConnectionContext oldValue = clientIdSet.get(clientId);
        // we may be removing the duplicate connection, not the first
        // connection to be created
        // so lets check that their connection IDs are the same
        if (oldValue == context) {
            if (isEqual(oldValue.getConnectionId(), info.getConnectionId())) {
                clientIdSet.remove(clientId);
            }
        }
    }
    connections.remove(context.getConnection());
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:20,代码来源:RegionBroker.java


示例11: tightMarshal2

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
/**
 * Write a object instance to data output stream
 * 
 * @param o the instance to be marshaled
 * @param dataOut the output stream
 * @throws IOException thrown if an error occurs
 */
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
    throws IOException {
    super.tightMarshal2(wireFormat, o, dataOut, bs);

    ConnectionInfo info = (ConnectionInfo)o;
    tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConnectionId(), dataOut, bs);
    tightMarshalString2(info.getClientId(), dataOut, bs);
    tightMarshalString2(info.getPassword(), dataOut, bs);
    tightMarshalString2(info.getUserName(), dataOut, bs);
    tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
    bs.readBoolean();
    bs.readBoolean();
    bs.readBoolean();

}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:23,代码来源:ConnectionInfoMarshaller.java


示例12: looseUnmarshal

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
/**
 * Un-marshal an object instance from the data input stream
 * 
 * @param o the object to un-marshal
 * @param dataIn the data input stream to build the object from
 * @throws IOException
 */
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
    super.looseUnmarshal(wireFormat, o, dataIn);

    ConnectionInfo info = (ConnectionInfo)o;
    info.setConnectionId((org.apache.activemq.command.ConnectionId)looseUnmarsalCachedObject(wireFormat,
                                                                                             dataIn));
    info.setClientId(looseUnmarshalString(dataIn));
    info.setPassword(looseUnmarshalString(dataIn));
    info.setUserName(looseUnmarshalString(dataIn));

    if (dataIn.readBoolean()) {
        short size = dataIn.readShort();
        org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
        for (int i = 0; i < size; i++) {
            value[i] = (org.apache.activemq.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn);
        }
        info.setBrokerPath(value);
    } else {
        info.setBrokerPath(null);
    }
    info.setBrokerMasterConnector(dataIn.readBoolean());
    info.setManageable(dataIn.readBoolean());
    info.setClientMaster(dataIn.readBoolean());

}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:33,代码来源:ConnectionInfoMarshaller.java


示例13: populateObject

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ConnectionInfo info = (ConnectionInfo) object;
   info.setConnectionId(createConnectionId("ConnectionId:1"));
   info.setClientId("ClientId:2");
   info.setPassword("Password:3");
   info.setUserName("UserName:4");

   {
      BrokerId value[] = new BrokerId[2];
      for (int i = 0; i < 2; i++) {
         value[i] = createBrokerId("BrokerPath:5");
      }
      info.setBrokerPath(value);
   }
   info.setBrokerMasterConnector(true);
   info.setManageable(false);

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:ConnectionInfoTest.java


示例14: tightMarshal1

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
/**
 * Write the booleans that this object uses to a BooleanStream
 */
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {

    ConnectionInfo info = (ConnectionInfo)o;

    int rc = super.tightMarshal1(wireFormat, o, bs);
    rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConnectionId(), bs);
    rc += tightMarshalString1(info.getClientId(), bs);
    rc += tightMarshalString1(info.getPassword(), bs);
    rc += tightMarshalString1(info.getUserName(), bs);
    rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
    bs.writeBoolean(info.isBrokerMasterConnector());
    bs.writeBoolean(info.isManageable());
    bs.writeBoolean(info.isClientMaster());

    return rc + 0;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:20,代码来源:ConnectionInfoMarshaller.java


示例15: testQueueSendThenAddConsumer

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
public void testQueueSendThenAddConsumer() throws Exception {

      // Start a producer
      StubConnection connection = createConnection();
      ConnectionInfo connectionInfo = createConnectionInfo();
      SessionInfo sessionInfo = createSessionInfo(connectionInfo);
      ProducerInfo producerInfo = createProducerInfo(sessionInfo);
      connection.send(connectionInfo);
      connection.send(sessionInfo);
      connection.send(producerInfo);

      destination = createDestinationInfo(connection, connectionInfo, destinationType);

      // Send a message to the broker.
      connection.send(createMessage(producerInfo, destination, deliveryMode));

      // Start the consumer
      ConsumerInfo consumerInfo = createConsumerInfo(sessionInfo, destination);
      connection.send(consumerInfo);

      // Make sure the message was delivered.
      Message m = receiveMessage(connection);
      assertNotNull(m);

   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:BrokerTest.java


示例16: addConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
@Override
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
    SecurityContext securityContext = context.getSecurityContext();
    if (securityContext == null) {
        securityContext = authenticate(info.getUserName(), info.getPassword(), null);
        context.setSecurityContext(securityContext);
        securityContexts.add(securityContext);
    }

    try {
        super.addConnection(context, info);
    } catch (Exception e) {
        securityContexts.remove(securityContext);
        context.setSecurityContext(null);
        throw e;
    }
}
 
开发者ID:ctytgat,项目名称:amq-jdbc-security,代码行数:18,代码来源:JdbcAuthenticationBroker.java


示例17: removeConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
public void removeConnection(ConnectionInfo info, Throwable error) throws InvalidClientIDException {
   synchronized (clientIdSet) {
      String clientId = info.getClientId();
      if (clientId != null) {
         AMQConnectionContext context = this.clientIdSet.get(clientId);
         if (context != null && context.decRefCount() == 0) {
            //connection is still there and need to close
            context.getConnection().disconnect(error != null);
            this.connections.remove(context.getConnection());
            this.clientIdSet.remove(clientId);
         }
      } else {
         throw new InvalidClientIDException("No clientID specified for connection disconnect request");
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:OpenWireProtocolManager.java


示例18: reconnect

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
public void reconnect(AMQConnectionContext existingContext, ConnectionInfo info) {
   this.context = existingContext;
   WireFormatInfo wireFormatInfo = wireFormat.getPreferedWireFormatInfo();
   // Older clients should have been defaulting this field to true.. but
   // they were not.
   if (wireFormatInfo != null && wireFormatInfo.getVersion() <= 2) {
      info.setClientMaster(true);
   }
   if (info.getClientIp() == null) {
      info.setClientIp(getRemoteAddress());
   }

   state = new ConnectionState(info);
   state.reset(info);

   context.setConnection(this);
   context.setConnectionState(state);
   context.setClientMaster(info.isClientMaster());
   context.setFaultTolerant(info.isFaultTolerant());
   context.setReconnect(true);
   context.incRefCount();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:OpenWireConnection.java


示例19: testConcurrentConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
public void testConcurrentConnection() throws Exception {

      StubConnection connection1 = createConnection();
      StubConnection connection2 = createConnection();

      // reuse same connection info
      ConnectionInfo connectionInfo = createConnectionInfo();
      connection1.request(connectionInfo);
      connection2.request(connectionInfo);

      // second one should win out, verify using consumer on default session (watchAdvisories)
      ConsumerId consumerId = new ConsumerId(new SessionId(connectionInfo.getConnectionId(), -1), 1);
      ConsumerInfo consumerInfo = new ConsumerInfo(consumerId);
      consumerInfo.setDestination(AdvisorySupport.TEMP_DESTINATION_COMPOSITE_ADVISORY_TOPIC);

      connection2.request(consumerInfo);
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:ConcurrentConnectSimulationTest.java


示例20: removeConnection

import org.apache.activemq.command.ConnectionInfo; //导入依赖的package包/类
@Override
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {

    super.removeConnection(context, info, error);
    if (this.securityContexts.remove(context.getSecurityContext())) {
        context.setSecurityContext((SecurityContext) null);
    }

}
 
开发者ID:hishamaborob,项目名称:ActiveMQ-JWT-Authentication-Plugin,代码行数:10,代码来源:JWTAuthenticationBroker.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ObservableGraph类代码示例发布时间:2022-05-22
下一篇:
Java TerraFirmaCraft类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap