Package com.sun.messaging.jmq.jmsserver.util

Examples of com.sun.messaging.jmq.jmsserver.util.BrokerException


  } else {
        try {
             rmiRegHostName = MQAddress.getMQAddress(rmiRegHostName,
                                        rmiRegistryPort).getHostName();
        } catch (MalformedURLException e) {
             throw new BrokerException(e.toString(), e);
        }
    }

  /*
   * The default urlpath base is:
View Full Code Here


        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            gp.write(bos);
            bos.flush();
        } catch (Exception e) {
            throw new BrokerException(e.toString(), e);
        }
        byte[] buf = bos.toByteArray();

        ChangeRecordInfo rec = new ChangeRecordInfo((Long)null, uuid, buf, gp.getType(),
                                                    System.currentTimeMillis());
View Full Code Here

                                               records.get(i).getRecord());
                DataInputStream dis = new DataInputStream(bis);
                GPacket gp = GPacket.getInstance();
                gp.read(dis);
                if (gp.getType() != records.get(i).getType()) {
                   throw new BrokerException(Globals.getBrokerResources().getKString(
                       BrokerResources.X_SHARECC_RECORD_TYPE_CORRUPT,
                       ProtocolGlobals.getPacketTypeString(gp.getType()),
                       records.get(i).toString()));
                }

                if (gp.getType() == ProtocolGlobals.G_RESET_PERSISTENCE) {
                    String uuid = records.get(i).getUUID();
                    if (resetUUID != null && !resetUUID.equals(uuid)) {
                        throw new BrokerException(Globals.getBrokerResources().getKString(
                            BrokerResources.X_SHARECC_RESET_RECORD_UUID_CORRUPT,
                            ProtocolGlobals.getPacketTypeString(ProtocolGlobals.G_RESET_PERSISTENCE),
                            "["+resetUUID+", "+uuid+"]"));
                    } else if (resetUUID == null) {
                        resetUUID = uuid;
                    }
                }
                if (resetFlag) {
                    l.add(gp);
                } else {
                    proto.handleGPacket(mbcb, Globals.getMyAddress(), gp);
                }
            }

            if (resetFlag) {
                proto.applyPersistentStateChanges(Globals.getMyAddress(), l);
            }

            if (records.size() > 0) {
                ChangeRecordInfo rec = records.get(records.size()-1);
                cb.setLastSyncedChangeRecord(rec);
                storeLastSeq(rec.getSeq());
                if (resetFlag && resetUUID != null) {
                    rec.setResetUUID(resetUUID);
                    storeLastResetUUID(resetUUID);
                }
            }

        } catch (Throwable t) {
            Globals.getLogger().logStack(Logger.ERROR,
                Globals.getBrokerResources().getKString(
                BrokerResources.E_FAIL_PROCESS_SHARECC_RECORDS,
                t.getMessage()), t);
            if (t instanceof BrokerException) throw (BrokerException)t;
            throw new BrokerException(t.getMessage(), t);
        }
    }
View Full Code Here

            File f = new File(fileName);
            if (!f.createNewFile()) {
                String emsg = br.getKString(br.W_MBUS_CANCEL_BACKUP2, fileName);
                logger.logToAll(loglevel, emsg);
                if (throwEx) {
                    throw new BrokerException(emsg);
                }
                return;
            }

            FileOutputStream fos = new FileOutputStream(f);
            DataOutputStream dos = new DataOutputStream(fos);

            ArrayList<ChangeRecord> recordList = compressRecords(records);

            dos.writeInt(ProtocolGlobals.getCurrentVersion());
            dos.writeUTF(ProtocolGlobals.CFGSRV_BACKUP_PROPERTY); // Signature.

            // Write the RESET record here.
            ChangeRecordInfo cri = makeResetRecord(true);
            byte[] rst = cri.getRecord();
            dos.writeInt(rst.length);
            dos.write(rst, 0, rst.length);
            if (DEBUG) {
                logger.logToAll(Logger.INFO, "ChangeRecord.backupRecords backup record "+cri);
            }

            ChangeRecord cr = null;
            for (int i = 0; i < recordList.size(); i++) {
                cr = recordList.get(i);

                if (! cr.isDiscard()) {
                    byte[] rec = cr.getBytes();

                    dos.writeInt(rec.length);
                    dos.write(rec, 0, rec.length);
                    if (DEBUG) {
                        logger.logToAll(Logger.INFO, "ChangeRecord.backupRecords() backup record "+cr);
                    }
                }
            }
            dos.writeInt(0);
            logger.logToAll(Logger.INFO, br.I_CLUSTER_MB_BACKUP_SUCCESS, fileName);
        }
        catch (Exception e) {
            String emsg = br.getKString(br.W_MBUS_BACKUP_ERROR, e.getMessage());
            logger.logStack((throwEx ? Logger.ERROR:Logger.WARNING), emsg, e);
            if (throwEx) {
                throw new BrokerException(emsg);
            }
        }

        if (DEBUG) {
            logger.logToAll(Logger.INFO, "ChanageRecord.backup complete");
View Full Code Here

            // Make sure that the file does exist.
            File f = new File(fileName);
            if (! f.exists()) {
                String emsg = br.getKString(br.W_MBUS_CANCEL_RESTORE1, fileName);
                logger.log(Logger.WARNING, emsg);
                throw new BrokerException(emsg);
            }

            FileInputStream fis = new FileInputStream(f);
            DataInputStream dis = new DataInputStream(fis);

            int curversion = dis.readInt(); // Version
            String sig = dis.readUTF(); // Signature.

            if (! sig.equals(ProtocolGlobals.CFGSRV_BACKUP_PROPERTY)) {
                String emsg = br.getKString(br.W_MBUS_CANCEL_RESTORE2, fileName);
                logger.logToAll(Logger.WARNING, emsg);
                throw new BrokerException(emsg);
            }

            if (curversion < ProtocolGlobals.VERSION_350 ||
                curversion > ProtocolGlobals.getCurrentVersion()) {
                String emsg = br.getKString(br.W_MBUS_CANCEL_RESTORE3,
                                  String.valueOf(curversion),
                                  String.valueOf(ProtocolGlobals.getCurrentVersion()));
                logger.logToAll(Logger.ERROR, emsg);
                throw new BrokerException(emsg);
            }

            ArrayList<ChangeRecordInfo> records = new ArrayList<ChangeRecordInfo>();

            while (true) {
View Full Code Here

        super(getUniqueString(name,queue));
        this.name = name;
        this.isQueue = queue;
        if (isWildcard(this.name)) {
            if (isQueue)
                throw new BrokerException("Wildcards are not supported for queues",
                         Status.UNSUPPORTED_TYPE);
            String regEx= createRegExString(name);
            regExPattern = Pattern.compile(regEx);
        }
    }
View Full Code Here

        super(str);
        name = getName(str);
        isQueue = getIsQueue(str);
        if (isWildcard(this.name)) {
            if (isQueue)
                throw new BrokerException("Wildcards are not supported for queues",
                         Status.UNSUPPORTED_TYPE);
            String regEx= createRegExString(name);
            regExPattern = Pattern.compile(regEx);
        }
    }
View Full Code Here

    {
        ois.defaultReadObject();
        if (isWildcard(this.name)) {
            try {
                if (isQueue)
                    throw new BrokerException("Wildcards are not supported for queues",
                         Status.UNSUPPORTED_TYPE);
                String regEx= createRegExString(name);
                regExPattern = Pattern.compile(regEx);
            } catch (BrokerException ex) {
                // nothing we can do
View Full Code Here

            char c = str.charAt(i);
            switch (c) {
                case '*':
                    boolean doubleAsterisk = false;
                    if (i != 0 && !dot) {
                        throw new BrokerException(str+"-Wildcard should be surrounded by .", Status.NOT_ACCEPTABLE);
                    }
                    if (i != (str.length() -1)) {
                        // see if we have a following asterisk
                        if (str.charAt(i+1) == '*') {
                            doubleAsterisk = true;
                            i ++;
                        }
                        // make sure dot or wildcard is next
                        if ((i != (str.length()-1)) && str.charAt(i+1) != '.' && str.charAt(i+1) != '>') {
                            throw new BrokerException(str+"-Wildcard should be surrounded by .", Status.NOT_ACCEPTABLE);
                        }
                    }
                    if (doubleAsterisk) {
                        buffer.append("[\\S]+");
                    } else {
                        //buffer.append("[\\w]+");
                        //buffer.append("[\\p{L},\\p{Lu},_,\\o44,\\p{Digit}]+");
                        buffer.append("[\\p{L}\\p{Lu}\\x24\\x5f\\p{Digit}]+");
                    }
                    dot = false;
                    break;
                case '$':
                     //substitute hex value
                     buffer.append("\\x24");
                     break;
                case '>':
                    if (dot) {
                        throw new BrokerException(str+"-Wildcard should never be preceded by .", Status.NOT_ACCEPTABLE);
                    }
                    toEndMatch = true;
                    // ok, if the previous character was a wildcard, add a dot
                    if (i > 0 && str.charAt(i-1) == '*')
                        buffer.append("\\.[\\S]*");
                    else
                        buffer.append("(\\.|$|^)[\\S]*");
                    dot = false;
                    break;
                case '.':
                    if (i == 0) { // dot at begining
                        throw new BrokerException(str+"-Bad wildcard, name starts with .", Status.NOT_ACCEPTABLE);
                    }
                    if (i == (str.length() -1)) {
                        throw new BrokerException(str+"-Bad wildcard, name ends with .", Status.NOT_ACCEPTABLE);
                    }
                    if (dot) {
                        throw new BrokerException(str+"-Bad wildcard, name was ..", Status.NOT_ACCEPTABLE);
                    }
                    dot = true;
                    buffer.append("\\.");
                    break;
                default:
View Full Code Here

  return (connectorServer.isActive());
    }

    public void start() throws IOException, BrokerException {
  if (!configuredActive)  {
      throw new BrokerException(rb.getString(rb.W_JMX_CANNOT_START_INACTIVE_CONNECTOR,
          name));
  }

  initConnectorServer();
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.util.BrokerException

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.