Examples of ConnectionInfo


Examples of org.apache.activemq.command.ConnectionInfo

        // allow anyone to login for now
        String login = headers.get(Stomp.Headers.Connect.LOGIN);
        String passcode = headers.get(Stomp.Headers.Connect.PASSCODE);
        String clientId = headers.get(Stomp.Headers.Connect.CLIENT_ID);

        final ConnectionInfo connectionInfo = new ConnectionInfo();

        IntrospectionSupport.setProperties(connectionInfo, headers, "activemq.");

        connectionInfo.setConnectionId(connectionId);
        if (clientId != null) {
            connectionInfo.setClientId(clientId);
        } else {
            connectionInfo.setClientId("" + connectionInfo.getConnectionId().toString());
        }

        connectionInfo.setResponseRequired(true);
        connectionInfo.setUserName(login);
        connectionInfo.setPassword(passcode);

        sendToActiveMQ(connectionInfo, new ResponseHandler() {
            public void onResponse(ProtocolConverter converter, Response response) throws IOException {

                final SessionInfo sessionInfo = new SessionInfo(sessionId);
                sendToActiveMQ(sessionInfo, null);

                final ProducerInfo producerInfo = new ProducerInfo(producerId);
                sendToActiveMQ(producerInfo, new ResponseHandler() {
                    public void onResponse(ProtocolConverter converter, Response response) throws IOException {

                        connected.set(true);
                        HashMap<String, String> responseHeaders = new HashMap<String, String>();

                        responseHeaders.put(Stomp.Headers.Connected.SESSION, connectionInfo.getClientId());
                        String requestId = headers.get(Stomp.Headers.Connect.REQUEST_ID);
                        if (requestId == null) {
                            // TODO legacy
                            requestId = headers.get(Stomp.Headers.RECEIPT_REQUESTED);
                        }
View Full Code Here

Examples of org.apache.activemq.command.ConnectionInfo

                return thread;
            }
        });
        // asyncConnectionThread.allowCoreThreadTimeOut(true);
        String uniqueId = CONNECTION_ID_GENERATOR.generateId();
        this.info = new ConnectionInfo(new ConnectionId(uniqueId));
        this.info.setManageable(true);
        this.info.setFaultTolerant(transport.isFaultTolerant());
        this.connectionSessionId = new SessionId(info.getConnectionId(), -1);

        this.transport.setTransportListener(this);
View Full Code Here

Examples of org.apache.activemq.command.ConnectionInfo

                    LOG.trace(configuration.getBrokerName() + " starting local Bridge, localBroker=" + localBroker);
                }
                remoteBrokerNameKnownLatch.await();

                if (!disposed.get()) {
                    localConnectionInfo = new ConnectionInfo();
                    localConnectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId()));
                    localClientId = "NC_" + remoteBrokerName + "_inbound_" + configuration.getBrokerName();
                    localConnectionInfo.setClientId(localClientId);
                    localConnectionInfo.setUserName(configuration.getUserName());
                    localConnectionInfo.setPassword(configuration.getPassword());
View Full Code Here

Examples of org.apache.activemq.command.ConnectionInfo

                    remoteBroker.oneway(brokerInfo);
                }
                if (remoteConnectionInfo != null) {
                    remoteBroker.oneway(remoteConnectionInfo.createRemoveCommand());
                }
                remoteConnectionInfo = new ConnectionInfo();
                remoteConnectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId()));
                remoteConnectionInfo.setClientId("NC_" + configuration.getBrokerName() + "_outbound");
                remoteConnectionInfo.setUserName(configuration.getUserName());
                remoteConnectionInfo.setPassword(configuration.getPassword());
                remoteBroker.oneway(remoteConnectionInfo);
View Full Code Here

Examples of org.apache.geronimo.connector.outbound.ConnectionInfo

    public void testSimpleComponentContextLifecyle() throws Exception {
        DefaultInstanceContext componentContext = new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources);
        InstanceContext oldInstanceContext = connectionTrackingCoordinator.enter(componentContext);
        assertNull("Expected old instance context to be null", oldInstanceContext);
        //give the context a ConnectionInfo
        ConnectionInfo connectionInfo = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo);
        connectionTrackingCoordinator.exit(oldInstanceContext);
        Map connectionManagerMap = componentContext.getConnectionManagerMap();
        Set infos = (Set) connectionManagerMap.get(key1);
        assertEquals("Expected one connection for key1", 1, infos.size());
View Full Code Here

Examples of org.apache.geronimo.connector.outbound.ConnectionInfo

    }

    private ConnectionInfo newConnectionInfo() {
        ManagedConnectionInfo mci = new ManagedConnectionInfo(null, null);
        mci.setConnectionEventListener(new GeronimoConnectionEventListener(this, mci));
        ConnectionInfo ci = new ConnectionInfo(mci);
        ci.setConnectionHandle(new Object());
        mci.addConnectionHandle(ci);
        return ci;
    }
View Full Code Here

Examples of org.apache.geronimo.connector.outbound.ConnectionInfo

    public void testNestedComponentContextLifecyle() throws Exception {
        DefaultInstanceContext componentContext1 = new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources);
        InstanceContext oldInstanceContext1 = connectionTrackingCoordinator.enter(componentContext1);
        assertNull("Expected old component context to be null", oldInstanceContext1);
        //give the context a ConnectionInfo
        ConnectionInfo connectionInfo1 = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo1);

        //Simulate calling another component
        DefaultInstanceContext componentContext2 = new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources);
        InstanceContext oldInstanceContext2 = connectionTrackingCoordinator.enter(componentContext2);
        assertTrue("Expected returned component context to be componentContext1", oldInstanceContext2 == componentContext1);
        //give the context a ConnectionInfo
        ConnectionInfo connectionInfo2 = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key2, connectionInfo2);

        connectionTrackingCoordinator.exit(oldInstanceContext2);
        Map connectionManagerMap2 = componentContext2.getConnectionManagerMap();
        Set infos2 = (Set) connectionManagerMap2.get(key2);
View Full Code Here

Examples of org.apache.geronimo.connector.outbound.ConnectionInfo

        ConnectorInstanceContextImpl componentContext = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext = connectionTrackingCoordinator.enter(componentContext);
        assertNull("Expected old instance context to be null", oldConnectorInstanceContext);

        // simulate create connection
        ConnectionInfo connectionInfo = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);

        // exit component context
        connectionTrackingCoordinator.exit(oldConnectorInstanceContext);
View Full Code Here

Examples of org.apache.geronimo.connector.outbound.ConnectionInfo

    }

    private ConnectionInfo newConnectionInfo() {
        ManagedConnectionInfo mci = new ManagedConnectionInfo(null, null);
        mci.setConnectionEventListener(new GeronimoConnectionEventListener(this, mci));
        ConnectionInfo ci = new ConnectionInfo(mci);
        ci.setConnectionHandle(new Object());
        mci.addConnectionHandle(ci);
        return ci;
    }
View Full Code Here

Examples of org.apache.geronimo.connector.outbound.ConnectionInfo

        ConnectorInstanceContextImpl componentContext1 = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext1 = connectionTrackingCoordinator.enter(componentContext1);
        assertNull("Expected old component context to be null", oldConnectorInstanceContext1);

        // simulate create connection
        ConnectionInfo connectionInfo1 = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(key1, connectionInfo1, false);

        // enter another (nested) component context
        ConnectorInstanceContextImpl nextedComponentContext = new ConnectorInstanceContextImpl(unshareableResources, applicationManagedSecurityResources);
        ConnectorInstanceContext oldConnectorInstanceContext2 = connectionTrackingCoordinator.enter(nextedComponentContext);
        assertTrue("Expected returned component context to be componentContext1", oldConnectorInstanceContext2 == componentContext1);

        // simulate create connection in nested context
        ConnectionInfo nestedConnectionInfo = newConnectionInfo();
        connectionTrackingCoordinator.handleObtained(nestedKey, nestedConnectionInfo, false);

        // exit nested component context
        connectionTrackingCoordinator.exit(oldConnectorInstanceContext2);
        Map nestedConnectionManagerMap = nextedComponentContext.getConnectionManagerMap();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.