Package com.sun.messaging.jmq.io

Examples of com.sun.messaging.jmq.io.PortMapperEntry


    public String getProperty(String key, String protocol, String type,
      String servicename) {
        int port = 25374;
  String propVal = null;
        Map table = portMapperTable.getServices();
        PortMapperEntry pme = null;

        Iterator pmeIterator = table.values().iterator();
        while (pmeIterator.hasNext()){
            pme = (PortMapperEntry) pmeIterator.next();

            if ((protocol != null) && !pme.getProtocol().equals(protocol)) {
    continue;
      }

            if ((type != null) && !pme.getType().equals(type)) {
    continue;
      }

            if ((servicename != null) && !pme.getName().equals(servicename)) {
    continue;
      }

      propVal = pme.getProperty(key);
      if (propVal != null)  {
    break;
      }

View Full Code Here


    }

    private int getPort(String protocol, String type, String servicename) {
        int port = 25374;
        Map table = portMapperTable.getServices();
        PortMapperEntry pme = null;

        Iterator pmeIterator = table.values().iterator();
        while (pmeIterator.hasNext()){
            pme = (PortMapperEntry) pmeIterator.next();
            if (pme.getProtocol().equals(protocol)){
                if (pme.getType().equals(type)){
                    if (servicename == null){
                        port = pme.getPort();
                        break;
                    } else {
                        if (pme.getName().equals(servicename)){
                            port = pme.getPort();
                            break;
                        }
                    }
                }
            }
View Full Code Here

    //bug 4959114.
    private int getPort(String protocol, String type, String servicename) {
        //int port = 25374;
        int port = -1;
        Map table = portMapperTable.getServices();
        PortMapperEntry pme = null;

        Iterator it = table.values().iterator();

        while (it.hasNext()){
            pme = (PortMapperEntry) it.next();
            if (pme.getProtocol().equals(protocol)){
                if (pme.getType().equals(type)){
                    if (servicename == null){
                        port = pme.getPort();
                        break;
                    } else {
                        if (pme.getName().equals(servicename)){
                            port = pme.getPort();
                            break;
                        }
                    }
                }
            }
View Full Code Here

     * @param serviceType The MQ Connection Service type "NORMAL" or "ADMIN"
     *
     * @return a MQ Message Service Address for this broker
     */
    public String getBrokerServiceAddress(String protocol, String serviceType) throws Exception {
        PortMapperEntry pme = null, e = null;;
        Iterator itr = Globals.getPortMapper().getServices().values().iterator();
        while (itr.hasNext()) {
            e  = (PortMapperEntry)itr.next();
            if (e.getProtocol().toLowerCase().equals(protocol.toLowerCase()) &&
                e.getType().equals(serviceType)) {
                pme = e;
                break;
            }
        }
        if (pme == null) {
            throw new Exception(
            "No available service found with protocol "+protocol+" and type "+serviceType);
        }
        String h = pme.getProperty("hostname");
        if (h == null || h.length() == 0 || h.equals(Globals.HOSTNAME_ALL)) {
            h = Globals.getMQAddress().getHostName();
            if (DEBUG) {
            logger.log(logger.INFO, "getBrokerServiceAddress:"+
                       serviceType+" "+protocol+" global hostname="+h);
            }
        } else {
            h = MQAddress.getMQAddress(h, pme.getPort()).getHostName();
            if (DEBUG) {
            logger.log(logger.INFO, "getBrokerServiceAddress:"+
                       serviceType+" "+protocol+" service hostname="+h);
            }
        }
        return "mq"+protocol.toLowerCase()+"://"+h+":"+pme.getPort()+"/"+pme.getName();
    }
View Full Code Here

                pt.read(is);

                is.close();
                os.close();
                s.close();
                PortMapperEntry pme = pt.get(PortMapper.SERVICE_NAME);

                String remotebrokerid = pme.getProperty("brokerid");

                if (mybrokerid.equals(remotebrokerid)) {
                        logger.log(Logger.ERROR, BrokerResources.E_BID_CONFLICT,
                           mybrokerid);
                        Broker.getBroker().exit(1,
View Full Code Here

     * @param   type    Service type (NORMAL, ADMIN, etc)
     * @param   port    Port service is runningon
     */
    public synchronized void addService(String name,
        String protocol, String type, int port, HashMap props) {
        PortMapperEntry pme = new PortMapperEntry();

        pme.setName(name);
        pme.setProtocol(protocol);
        pme.setType(type);
        pme.setPort(port);

        if (props != null) {
            pme.addProperties(props);
        }
        portMapTable.add(pme);

    }
View Full Code Here

     * @param   port    Port service is runningon
     */

    public synchronized void updateServicePort(String name, int port)
    {
        PortMapperEntry pme = portMapTable.get(name);
        if (pme != null) {
           pme.setPort(port);
        }
    }
View Full Code Here

     * @param   props   Properties for a service
     */

    public synchronized void updateServiceProperties(String name, HashMap props)
    {
        PortMapperEntry pme = portMapTable.get(name);
        if (pme != null) {
            pme.addProperties(props);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.io.PortMapperEntry

Copyright © 2018 www.massapicom. 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.