Examples of NetworkConnector


Examples of org.apache.activemq.network.NetworkConnector

    public DiscoveryBrokerAgentImpl() throws Exception {
    }

    public void connectTo(BrokerAgent remoteBroker) throws Exception {
        NetworkConnector connector = getBroker().addNetworkConnector("rendezvous");
        if (isStarted()) {
            connector.start();
        }
    }
View Full Code Here

Examples of org.apache.activemq.network.NetworkConnector

   
    // Get JMS Broker
    BrokerService broker = ClusterManager.getInstance().getBrokerService();
   
    // Peer Network Connection
    NetworkConnector con = null;
   
    try {
     
      log.debug("[PeerService] Connecting with Peer Cluster on " + url);
      con = broker.addNetworkConnector(url);
     
      if (con==null) {
        throw new Exception("NetworkConnector Null");
      }
     
      // Configure Network Connection
      con.addStaticallyIncludedDestination(new ActiveMQTopic("nebula.cluster.service.topic"));
      con.setConduitSubscriptions(false);
      con.setDynamicOnly(true)// Do not forward if no consumers
      con.addExcludedDestination(new ActiveMQQueue("nebula.cluster.registration.queue"));
      con.addExcludedDestination(new ActiveMQQueue("nebula.cluster.services.facade.queue"));
      con.setNetworkTTL(128);    // Default TTL
      con.setDuplex(true);    // Full-duplex communication
      con.start();

      peers.put(url, con);
      log.info("[PeerService] Connected with Peer Cluster on " + url);
     
      // Notify Event Hooks
      ServiceMessage message = new ServiceMessage(url, ServiceMessageType.PEER_CONNECTION);
      ServiceEventsSupport.getInstance().onServiceMessage(message);
     
    } catch (Exception e) {
      log.warn("[PeerService] Unable to connect with Cluster " + url, e);
      if (con!=null) {  // If Connection was created
        try {
          // Try to Stop
          con.stop();
        } catch (Exception e1) {
          log.warn("[PeerService] Unable to Stop Connector " + url, e1);
        }
        broker.removeNetworkConnector(con);
      }
View Full Code Here

Examples of org.apache.activemq.network.NetworkConnector

  /**
   * {@inheritDoc}
   */
  public void removeCluster(String url) {
   
    NetworkConnector con = peers.get(url);
   
    if (con==null) return;
   
    log.debug("[PeerService] Disconnecting from Peer Cluster on " + url);
   
    BrokerService broker = ClusterManager.getInstance().getBrokerService();
   
    try {
      // Stop Network Connection
      con.stop();
    } catch (Exception e) {
      log.warn("[PeerService] Unable to Stop Network Connector");
    }
   
    // Remove Network Connector
View Full Code Here

Examples of org.apache.activemq.network.NetworkConnector

    BrokerService broker = (BrokerService) Grid.getApplicationContext().getBean("broker");
   
    System.out.println("Press any key to Add new Network Broker");
    System.in.read();
   
    NetworkConnector con = broker.addNetworkConnector("static://(tcp://excalibur:61616)");
   
    if (con!=null) {
      // con.addExcludedDestination(new ActiveMQQueue(">"));
      con.addStaticallyIncludedDestination(new ActiveMQTopic("nebula.cluster.service.topic"));
      con.setConduitSubscriptions(false);
      con.setDynamicOnly(true);
      con.addExcludedDestination(new ActiveMQQueue("nebula.cluster.registration.queue"));
      con.addExcludedDestination(new ActiveMQQueue("nebula.cluster.services.facade.queue"));
      con.setNetworkTTL(128);
      con.start();
    }

//    System.out.println("Press any key to Shutdown");
//    System.in.read();
//   
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.NetworkConnector

            // Get submitted values
            //todo: lots of validation
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // Identify and update the connector
            AbstractName connectorName = new AbstractName(URI.create(connectorURI));
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, connectorName);
            if(connector != null) {
                WebManager manager = PortletManager.getWebManager(actionRequest, new AbstractName(URI.create(managerURI)));
                ConnectorType connectorType = manager.getConnectorType(connectorName);
               
                // set the connector attributes from the form post
                for (ConnectorAttribute attribute : manager.getConnectorAttributes(connectorType)) {
                    String name = attribute.getAttributeName();
                    String value = actionRequest.getParameter(name);
                   
                    // handle booelan type special
                    if (attribute.getAttributeClass().equals(Boolean.class)) {
                        // browser sends value of checked checkbox as "on" or "checked"
                        if ("on".equalsIgnoreCase(value) || "checked".equalsIgnoreCase(value)) {
                            value=Boolean.toString(true);
                        } else {
                            value=Boolean.toString(false);
                        }
                    }
                    // set the string form of the attribute's value as submitted by the browser
                    if (value == null || value.trim().length()<1) {
                        // special case for KeystoreManager gbean
                        if ("trustStore".equals(attribute.getAttributeName())) {
                            setProperty(connector,name,null);
                        }
                    } else {
                        // set the string value on the ConnectorAttribute so
                        // it can handle type conversion via getValue()
                        try {
                            attribute.setStringValue(value);
                            setProperty(connector,name,attribute.getValue());
                        } catch (Exception e) {
                            log.error("Unable to set property " + attribute.getAttributeName(), e);
                        }
                    }
                }
               
                // set the keystore properties if its a secure connector
                setKeystoreProperties(actionRequest, connectorName);
            }
            actionResponse.setRenderParameter(PARM_MODE, "list");
        } else if(mode.equals("start")) {
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // work with the current connector to start it.
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).startRecursive();
                } catch (Exception e) {
                    log.error("Unable to start connector", e); //todo: get into rendered page somehow?
                }
            }
            else {
                log.error("Incorrect connector reference"); //Replace this with correct error processing
            }
            actionResponse.setRenderParameter(PARM_CONNECTOR_URI, connectorURI);
            actionResponse.setRenderParameter(PARM_MODE, "list");
        } else if(mode.equals("stop")) {
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // work with the current connector to stop it.
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).stop();
                } catch (Exception e) {
                    log.error("Unable to stop connector", e); //todo: get into rendered page somehow?
                }
            }
            else {
                log.error("Incorrect connector reference"); //Replace this with correct error processing
            }
            actionResponse.setRenderParameter(PARM_CONNECTOR_URI, connectorURI);
            actionResponse.setRenderParameter(PARM_MODE, "list");
        } else if(mode.equals("restart")) {
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // work with the current connector to restart it.
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).stop();
                    ((GeronimoManagedBean)connector).start();
                } catch (Exception e) {
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.NetworkConnector

                renderRequest.setAttribute(PARM_MODE, "add");
                populateEnumAttributes(renderRequest);
                editConnectorView.include(renderRequest, renderResponse);
            } else if(mode.equals("edit")) {
                String connectorURI = renderRequest.getParameter(PARM_CONNECTOR_URI);
                NetworkConnector connector = PortletManager.getNetworkConnector(renderRequest, new AbstractName(URI.create(connectorURI)));
                if(connector == null) {
                    doList(renderRequest, renderResponse);
                } else {
                    AbstractName connectorName = new AbstractName(URI.create(connectorURI));
                    String uniqueName = connectorName.getName().get("name").toString();
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.NetworkConnector

    // TODO: need a more generic way to handle this
    private void setKeystoreProperties(PortletRequest request, AbstractName connectorName) throws PortletException {
        String containerURI = request.getParameter(PARM_CONTAINER_URI);
        WebContainer container = PortletManager.getWebContainer(request, new AbstractName(URI.create(containerURI)));
        String server = getWebServerType(container.getClass());
        NetworkConnector connector = PortletManager.getNetworkConnector(request, connectorName);

        // return if not a secure connector
        if (!(connector instanceof SecureConnector)) {
            return;
        }
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.NetworkConnector

            // Get submitted values
            //todo: lots of validation
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // Identify and update the connector
            AbstractName connectorName = new AbstractName(URI.create(connectorURI));
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, connectorName);
            if(connector != null) {
                WebManager manager = PortletManager.getWebManager(actionRequest, new AbstractName(URI.create(managerURI)));
                ConnectorType connectorType = manager.getConnectorType(connectorName);
               
                // set the connector attributes from the form post
                for (ConnectorAttribute attribute : manager.getConnectorAttributes(connectorType)) {
                    String name = attribute.getAttributeName();
                    String value = actionRequest.getParameter(name);
                   
                    // handle booelan type special
                    if (attribute.getAttributeClass().equals(Boolean.class)) {
                        // browser sends value of checked checkbox as "on" or "checked"
                        if ("on".equalsIgnoreCase(value) || "checked".equalsIgnoreCase(value)) {
                            value=Boolean.toString(true);
                        } else {
                            value=Boolean.toString(false);
                        }
                    }
                    // set the string form of the attribute's value as submitted by the browser
                    if (value == null || value.trim().length()<1) {
                        // special case for KeystoreManager gbean
                        if ("trustStore".equals(attribute.getAttributeName())) {
                            setProperty(connector,name,null);
                        }
                    } else {
                        // set the string value on the ConnectorAttribute so
                        // it can handle type conversion via getValue()
                        try {
                            attribute.setStringValue(value);
                            setProperty(connector,name,attribute.getValue());
                        } catch (Exception e) {
                            log.error("Unable to set property " + attribute.getAttributeName(), e);
                        }
                    }
                }
               
                // set the keystore properties if its a secure connector
                setKeystoreProperties(actionRequest, connectorName);
            }
            actionResponse.setRenderParameter(PARM_MODE, "list");
        } else if(mode.equals("start")) {
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // work with the current connector to start it.
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).startRecursive();
                } catch (Exception e) {
                    log.error("Unable to start connector", e); //todo: get into rendered page somehow?
                }
            }
            else {
                log.error("Incorrect connector reference"); //Replace this with correct error processing
            }
            actionResponse.setRenderParameter(PARM_CONNECTOR_URI, connectorURI);
            actionResponse.setRenderParameter(PARM_MODE, "list");
        } else if(mode.equals("stop")) {
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // work with the current connector to stop it.
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).stop();
                } catch (Exception e) {
                    log.error("Unable to stop connector", e); //todo: get into rendered page somehow?
                }
            }
            else {
                log.error("Incorrect connector reference"); //Replace this with correct error processing
            }
            actionResponse.setRenderParameter(PARM_CONNECTOR_URI, connectorURI);
            actionResponse.setRenderParameter(PARM_MODE, "list");
        } else if(mode.equals("restart")) {
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // work with the current connector to restart it.
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, new AbstractName(URI.create(connectorURI)));
            if(connector != null) {
                try {
                    ((GeronimoManagedBean)connector).stop();
                    ((GeronimoManagedBean)connector).start();
                } catch (Exception e) {
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.NetworkConnector

                renderRequest.setAttribute(PARM_MODE, "add");
                populateEnumAttributes(renderRequest);
                editConnectorView.include(renderRequest, renderResponse);
            } else if(mode.equals("edit")) {
                String connectorURI = renderRequest.getParameter(PARM_CONNECTOR_URI);
                NetworkConnector connector = PortletManager.getNetworkConnector(renderRequest, new AbstractName(URI.create(connectorURI)));
                if(connector == null) {
                    doList(renderRequest, renderResponse);
                } else {
                    AbstractName connectorName = new AbstractName(URI.create(connectorURI));
                    String uniqueName = connectorName.getName().get("name").toString();
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.NetworkConnector

    // TODO: need a more generic way to handle this
    private void setKeystoreProperties(PortletRequest request, AbstractName connectorName) throws PortletException {
        String containerURI = request.getParameter(PARM_CONTAINER_URI);
        WebContainer container = PortletManager.getWebContainer(request, new AbstractName(URI.create(containerURI)));
        String server = getWebServerType(container.getClass());
        NetworkConnector connector = PortletManager.getNetworkConnector(request, connectorName);

        // return if not a secure connector
        if (!(connector instanceof SecureConnector)) {
            return;
        }
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.