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


Java ConnectionInfo类代码示例

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


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


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