Package com.sun.messaging.bridge.service

Examples of com.sun.messaging.bridge.service.BridgeException


                       BridgeManagerResources bmr)
                       throws BridgeException,JMSException, Exception {

        int msgtype = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
        if (msgtype != AdminMessageType.Type.PAUSE) {
           throw new BridgeException(_bmr.getKString(_bmr.X_UNEXPECTED_ADMIN_MSG_TYPE,
                                      AdminMessageType.getString(msgtype)));
       }

       String bnameval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_NAME);
       String btypeval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_TYPE);
       String lnameval = msg.getStringProperty(AdminMessageType.PropName.LINK_NAME);

       String bname = (bnameval == null ? null: bnameval.trim());
       String btype = (btypeval == null ? null: btypeval.trim().toUpperCase());
       String lname = (lnameval == null ? null: lnameval.trim());

       if (bname != null && lname != null) {
           if (bname.length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
           }
           if (lname.trim().length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_LINK_NAME, lname));
           }
           _bsm.pauseBridge(bname, new String[]{"-ln", lname}, btype);
           parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
           return;
       }

       if (lname != null) { 
           throw new BridgeException(_bmr.getKString(_bmr.X_ADMIN_LINK_NAME_NOSUPPORT, msg));
       }

       if (bname != null && bname.length() == 0) {
           throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
       }
       _bsm.pauseBridge(bname, null, btype);
       parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
       return;
    }
View Full Code Here


                       ObjectMessage msg, ObjectMessage reply,
                       BridgeManagerResources bmr)
                       throws BridgeException, Exception {
        int msgtype = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
        if (msgtype != AdminMessageType.Type.DEBUG) {
           throw new BridgeException("Unexpected bridge admin message type "+
                                      AdminMessageType.getString(msgtype));
       }

       String debugArg = msg.getStringProperty(AdminMessageType.PropName.CMD_ARG);
       String target = msg.getStringProperty(AdminMessageType.PropName.TARGET);
       if (debugArg == null) {
           throw new BridgeException(_bmr.getKString(_bmr.X_ADMIN_DEBUG_NO_ARG));
       }
       if (!debugArg.trim().equals("fault")) {
           throw new BridgeException(_bmr.getKString(_bmr.X_ADMIN_DEBUG_UNSUPPORTED_ARG, debugArg));
       }
       if (target == null || target.trim().length() == 0) {
           throw new BridgeException(_bmr.getKString(_bmr.X_ADMIN_DEBUG_NO_NAME, debugArg));
       }
     Properties props = (Properties)msg.getObject();

       String faultName = target;
       String faultSelector = (String)props.getProperty("selector");
View Full Code Here

                       BridgeManagerResources bmr)
                       throws BridgeException,JMSException, Exception {

        int msgtype = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
        if (msgtype != AdminMessageType.Type.RESUME) {
           throw new BridgeException(_bmr.getKString(_bmr.X_UNEXPECTED_ADMIN_MSG_TYPE,
                                      AdminMessageType.getString(msgtype)));
       }

       String bnameval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_NAME);
       String btypeval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_TYPE);
       String lnameval = msg.getStringProperty(AdminMessageType.PropName.LINK_NAME);

       String bname = (bnameval == null ? null: bnameval.trim());
       String btype = (btypeval == null ? null: btypeval.trim().toUpperCase());
       String lname = (lnameval == null ? null: lnameval.trim());

       if (bname != null && lname != null) {
           if (bname.length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
           }
           if (lname.trim().length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_LINK_NAME, lname));
           }
           _bsm.resumeBridge(bname, new String[]{"-ln", lname}, btype);
           parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
           return;
       }

       if (lname != null) { 
           throw new BridgeException(_bmr.getKString(_bmr.X_ADMIN_LINK_NAME_NOSUPPORT, msg));
       }

       if (bname != null && bname.length() == 0) {
           throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
       }
       _bsm.resumeBridge(bname, null, btype);
       parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
       return;
    }
View Full Code Here

                       BridgeManagerResources bmr)
                       throws BridgeException,JMSException, Exception {

        int msgtype = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
        if (msgtype != AdminMessageType.Type.STOP) {
           throw new BridgeException(_bmr.getKString(_bmr.X_UNEXPECTED_ADMIN_MSG_TYPE,
                                      AdminMessageType.getString(msgtype)));
       }

       String bnameval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_NAME);
       String btypeval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_TYPE);
       String lnameval = msg.getStringProperty(AdminMessageType.PropName.LINK_NAME);

       String bname = (bnameval == null ? null: bnameval.trim());
       String btype = (btypeval == null ? null: btypeval.trim().toUpperCase());
       String lname = (lnameval == null ? null: lnameval.trim());

       if (bname != null && lname != null) {
           if (bname.length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
           }
           if (lname.trim().length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_LINK_NAME, lname));
           }
           _bsm.stopBridge(bname, new String[]{"-ln", lname}, btype);
           parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
           return;
       }

       if (lname != null) { 
           throw new BridgeException(_bmr.getKString(_bmr.X_ADMIN_LINK_NAME_NOSUPPORT, msg));
       }

       if (bname != null && bname.length() == 0) {
           throw new BridgeException("Invalid bridge name: "+bname);
       }
       _bsm.stopBridge(bname, null, btype);
       parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
       return;
    }
View Full Code Here

          _bc.logWarn(emsg, null);
        }
       
        Destination dest = msg.getJMSDestination();
        if (!(dest instanceof Queue)) {
            throw new BridgeException(_br.getKString(_br.X_ADMIN_MSG_NOT_QUEUE, dest));
        }
        if (!((Queue)dest).getQueueName().equals(_bsm.getAdminDestinationName())) {
            throw new BridgeException(_br.getKString(_br.X_ADMIN_MSG_UNEXPECTED_DEST, dest));
        }
       
      try {
          msgType = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
      } catch (Exception e) {
            msgType = AdminMessageType.Type.LAST;
            String emsg = _br.getKString(_br.X_EXCEPTION_PROCESSING_ADMIN_MSG, msg.toString());
          _bc.logError(emsg, e);
            throw new BridgeException(emsg, e);
      }

        AdminCmdHandler ach = null;
      try {
          ach = _handlers[msgType];
      } catch (IndexOutOfBoundsException e) {
            String emsg = _br.getKString(_br.X_UNEXPECTED_ADMIN_MSG_TYPE, AdminMessageType.getString(msgType));
            throw new BridgeException(emsg);
        }
      if (ach == null) {
            String emsg = "No bridge admin handler for message type "+AdminMessageType.getString(msgType);
            throw new BridgeException(emsg);
      }

        reply.setIntProperty(AdminMessageType.PropName.MESSAGE_TYPE, ++msgType);

        ach.handle(session, msg, reply, bmr);

        } catch (Throwable t) {

        int status = Status.ERROR;
        if (t instanceof BridgeException) {
            BridgeException be = (BridgeException)t;
            status = be.getStatus();
            if (be.getCause() == null) {//else should already logged
                _bc.logError(t.getMessage(), null);
            }
        } else {
            _bc.logError(t.getMessage(), t);
        }
View Full Code Here

                       BridgeManagerResources bmr)
                       throws BridgeException,JMSException, Exception {

        int msgtype = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
        if (msgtype != AdminMessageType.Type.HELLO) {
           throw new BridgeException("Unexpected bridge admin message type "+
                                      AdminMessageType.getString(msgtype));
       }
       throw new BridgeException("Internal Error: unexpected call "+ AdminMessageType.getString(msgtype));

       //parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
    }
View Full Code Here

                       BridgeManagerResources bmr)
                       throws BridgeException,JMSException, Exception {

        int msgtype = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
        if (msgtype != AdminMessageType.Type.LIST) {
           throw new BridgeException(_bmr.getKString(_bmr.X_UNEXPECTED_ADMIN_MSG_TYPE,
                                      AdminMessageType.getString(msgtype)));
       }

       String bnameval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_NAME);
       String btypeval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_TYPE);
       String lnameval = msg.getStringProperty(AdminMessageType.PropName.LINK_NAME);
       boolean debugMode = msg.getBooleanProperty(AdminMessageType.PropName.DEBUG);

       String bname = (bnameval == null ? null: bnameval.trim());
       String btype = (btypeval == null ? null: btypeval.trim().toUpperCase());
       String lname = (lnameval == null ? null: lnameval.trim());

       String[] args = null;
       if (bname != null && lname != null) {
           if (bname.length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
           }
           if (lname.trim().length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_LINK_NAME, lname));
           }
           if (debugMode) {
           args = new String[]{"-ln", lname, "-debug"};
           } else {
           args = new String[]{"-ln", lname};
           }
           ArrayList<BridgeCmdSharedReplyData> data = _bsm.listBridge(bname, args, btype, bmr);
           reply.setObject(data);
           parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
           return;
       }

       if (lname != null) { 
           if (bname == null) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_NO_BRIDGE_NAME));
           }
       }

       if (bname != null && bname.length() == 0) {
           throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
       }
       if (debugMode) {
           args = new String[]{"-debug"};
       } else {
           args = null;
View Full Code Here

                       BridgeManagerResources bmr)
                       throws BridgeException,JMSException, Exception {

        int msgtype = msg.getIntProperty(AdminMessageType.PropName.MESSAGE_TYPE);
        if (msgtype != AdminMessageType.Type.START) {
           throw new BridgeException(_bmr.getKString(_bmr.X_UNEXPECTED_ADMIN_MSG_TYPE,
                                      AdminMessageType.getString(msgtype)));
       }

       String bnameval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_NAME);
       String btypeval = msg.getStringProperty(AdminMessageType.PropName.BRIDGE_TYPE);
       String lnameval = msg.getStringProperty(AdminMessageType.PropName.LINK_NAME);

       String bname = (bnameval == null ? null: bnameval.trim());
       String btype = (btypeval == null ? null: btypeval.trim().toUpperCase());
       String lname = (lnameval == null ? null: lnameval.trim());

       if (bname != null && lname != null) {
           if (bname.length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
           }
           if (lname.trim().length() == 0) {
               throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_LINK_NAME, lname));
           }
           if (!_bsm.startBridge(bname, new String[]{"-ln", lname}, btype)) {
               reply.setBooleanProperty(AdminMessageType.PropName.ASYNC_STARTED, Boolean.valueOf(true));
           }
           parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
           return;
       }

       if (lname != null) { 
           throw new BridgeException(_bmr.getKString(_bmr.X_ADMIN_LINK_NAME_NOSUPPORT, msg));
       }

       if (bname != null && bname.length() == 0) {
           throw new BridgeException(_bmr.getKString(_bmr.E_ADMIN_INVALID_BRIDGE_NAME, bname));
       }
       if (!_bsm.startBridge(bname, null, btype)) {
           reply.setBooleanProperty(AdminMessageType.PropName.ASYNC_STARTED, Boolean.valueOf(true));
       }
       parent.sendReply(session, msg, reply, Status.OK, (String)null, bmr);
View Full Code Here

        }

        if (_bc.isHAEnabled()) {
           
            JMSBridgeStore store = (JMSBridgeStore)_bc.getJDBCStore();
            if (store == null) throw new BridgeException("null JDBC store");

            List jmsbridges = store.getJMSBridges(null);

            name = null;
            itr = alist.iterator();
            while (itr.hasNext()) {
                name = itr.next();
                String type = props.getProperty(
                              props.getProperty(
                              BridgeBaseContext.PROP_PREFIX)+"."+name+".type");
                if (type == null) {
                    throw new BridgeException(_bmr.getString(_bmr.X_BRIDGE_NO_TYPE, name));
                }
                if (!type.trim().toUpperCase().equals(Bridge.JMS_TYPE)) {
                    continue;
                }
                if (jmsbridges.contains(name)) {
View Full Code Here

        return (_state == State.STARTED);
    }

    public synchronized String getAdminDestinationName() throws Exception {
        if (_state != State.STARTED) {
            throw new BridgeException(_bmr.getString(_bmr.X_BRIDGE_SERVICE_MANAGER_NOT_RUNNING));
        }
        return _adminQueue.getQueueName();
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.bridge.service.BridgeException

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.