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

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


            else
               file = new File(dir,licenseFile);
           
            //BUG FIX 5025985
            if(!file.exists())
              throw new BrokerException(br.getString(br.E_LOAD_LICENSE,filestr))
            //BUG FIX 5057293
            else if(!file.canRead())
              throw new BrokerException(br.getString(br.E_LICENSE_FILE_NOT_READABLE,licenseFile))
           
            fl = new FileLicense(file);
        }
        else {
            FileLicense[] licenses = loadFileLicenses();
            if(loadFileLicenses().length !=0)
            {   
              fl = (FileLicense) selectBestLicense(licenses);
              File f = fl.getLicenseFile();
              if(!f.canRead())
                throw new BrokerException(br.getString(br.E_LICENSE_FILE_NOT_READABLE,f.toString()));
             
              //BUG FIX 4996564
              LicenseBase lb = (LicenseBase)fl;
              Properties prop = lb.props;
              String datestring = prop.getProperty(lb.PROP_DATE_STRING);
View Full Code Here


        // Check the file version.
        String fileVersion = props.getProperty(PROP_FILE_VERSION);
        if (fileVersion == null ||
            ! fileVersion.equals(CURRENT_FILE_VERSION))
            throw new BrokerException(br.getString(br.E_BAD_LICENSE_DATA));

        String licenseVersion = props.getProperty(PROP_LICENSE_VERSION);

        if (licenseVersion == null ||
            ! licenseVersion.equals(CURRENT_LICENSE_VERSION))
            throw new BrokerException(br.getString(br.E_BAD_LICENSE_DATA));

        parseDateString();
        checkValidity();
    }
View Full Code Here

     * Parse the expiration date string into appropriate fields.
     */
    private void parseDateString() throws BrokerException {
        String dateString = props.getProperty(PROP_DATE_STRING);
        if (dateString == null)
            throw new BrokerException(br.getString(br.E_BAD_LICENSE_DATA));

        if (dateString.startsWith(NONE_STRING)) {
            // Do nothing.
        }
        else if (dateString.startsWith(TRY_STRING)) {
            // this license contains the number of days to try
            int oindex = dateString.indexOf(OPEN_BRACKET);
            int cindex = dateString.indexOf(CLOSE_BRACKET);
            int d = Integer.parseInt(
                dateString.substring(oindex+1, cindex));
            setDaysToTry(d);
        } else if (dateString.startsWith(VALID_STRING)) {
            // this license contains a date range
            int oindex = dateString.indexOf(OPEN_BRACKET);
            int dashindex = dateString.indexOf(DASH);
            int cindex = dateString.indexOf(CLOSE_BRACKET);

            if ((dashindex - oindex) > 1) {
                // we have a start date
                long start = Long.parseLong(
                    dateString.substring(oindex+1, dashindex));
                setStartDate(new Date(start));
            }

            if ((cindex - dashindex) > 1) {
                // we have an exipriation date
                long end = Long.parseLong(
                    dateString.substring(dashindex+1, cindex));
                setExpirationDate(new Date(end));
            }
        } else {
            // bad format
            throw new BrokerException(br.getString(br.E_BAD_LICENSE_DATA));
        }
    }
View Full Code Here

            cal.set(cal.HOUR_OF_DAY, 0);
            cal.set(cal.MINUTE, 0);
            cal.set(cal.SECOND, 0);
            cal.set(cal.MILLISECOND, 0);
            if (cal.getTime().getTime() <= (new Date()).getTime()) {
                throw new BrokerException(
                    br.getString(br.E_LICENSE_EXPIRED, cal.getTime()));
            }
        } else if (getStartDate() != null) {
            Calendar cal = Calendar.getInstance();
            cal.setTime(getStartDate());

            cal.set(cal.HOUR_OF_DAY, 0);
            cal.set(cal.MINUTE, 0);
            cal.set(cal.SECOND, 0);
            cal.set(cal.MILLISECOND, 0);

            if ((new Date()).getTime() < cal.getTime().getTime()) {
                // now is before the valid start date
                throw new BrokerException(
                    br.getString(br.E_LICENSE_NOT_VALID_YET,
                        getStartDate()));
            }
        }
    }
View Full Code Here

  ConnectorServerInfo  csInfo;

  csInfo = (ConnectorServerInfo)connectors.get(name);

  if (csInfo == null)  {
      throw new BrokerException(rb.getString(rb.W_JMX_DELETE_CONNECTOR_NON_EXISTANT,
      name));
  }

  if (csInfo.isActive())  {
      csInfo.stop();
  }

  try  {
      JMXConnectorServer cs = csInfo.getConnectorServer();
      cs.removeNotificationListener(this);
  } catch (ListenerNotFoundException le)  {
      throw new BrokerException(rb.getString(rb.W_JMX_DELETE_LISTENER_EXCEPTION,
          le.toString()));
  }

        connectors.remove(name);
    }
View Full Code Here

  ConnectorServerInfo  csInfo;

  csInfo = (ConnectorServerInfo)connectors.get(name);

  if (csInfo == null)  {
      throw new BrokerException(rb.getString(rb.W_JMX_START_CONNECTOR_NON_EXISTANT,
          name));
  }

  try  {
      csInfo.start();
View Full Code Here

  ConnectorServerInfo  csInfo;

  csInfo = (ConnectorServerInfo)connectors.get(name);

  if (csInfo == null)  {
      throw new BrokerException(rb.getString(rb.W_JMX_STOP_CONNECTOR_NON_EXISTANT, name));
  }

  if (!csInfo.isActive())  {
      throw new BrokerException(rb.getString(rb.W_JMX_STOP_CONNECTOR_NOT_ACTIVE, name));
  }

  try  {
      csInfo.stop();
            Globals.getPortMapper().removeService(name);
View Full Code Here

                            ts.setState(TransactionState.ROLLEDBACK);
                            try {
                                Globals.getStore().updateTransactionState(tid, ts,
                                                   Destination.PERSIST_SYNC);
                            } catch (IOException e) {
                                throw new BrokerException(null, e);
                            }

                             // ok we may not be done with things yet
                             // add to opentxn list
                             openTxns.add(tid);
                        } else if (ts.getType() == AutoRollbackType.NOT_PREPARED
                            &&  ts.getState() < TransactionState.PREPARED) {
                            String args[] = {
                                 tracker.getBrokerID(),
                                 String.valueOf(tid.longValue()),
                                 ts.toString(ts.getState()) };
                            logger.log(Logger.INFO,
                                BrokerResources.I_TAKEOVER_TXN_P_ROLLBACK,
                                args);
                            ts.setState(TransactionState.ROLLEDBACK);
                            try {
                                Globals.getStore().updateTransactionState(tid, ts,
                                                   Destination.PERSIST_SYNC);
                            } catch (IOException e) {
                                throw new BrokerException(null, e);
                            }
                             // ok we may not be done with things yet
                             // add to opentxn list
                             openTxns.add(tid);
                        } else {
View Full Code Here

  try  {
      Class c = Class.forName("java.lang.management.ManagementFactory");
      Method m = c.getMethod("getPlatformMBeanServer", null);
      mbeanServer = (MBeanServer)m.invoke("getPlatformMBeanServer", null);
  } catch (Exception e)  {
      throw new BrokerException(rb.getString(rb.W_JMX_GET_PLATFORM_MBEANSERVER_EXCEPTION,
            e.toString()));
  }

        return(mbeanServer);
    }
View Full Code Here

       * to create a registry.
       */
  }

  if (registryExists)  {
      throw new BrokerException(rb.getString(rb.W_JMX_RMI_REGISTRY_EXISTS,
            Integer.toString(port)));
  }

  try  {
      if (jmxHostname != null && !jmxHostname.equals(Globals.HOSTNAME_ALL))  {
          MQRMIServerSocketFactory ssf =
        new MQRMIServerSocketFactory(jmxHostname, 0, false);

          registry = LocateRegistry.createRegistry(port, null, ssf);
      } else  {
          registry = LocateRegistry.createRegistry(port);
      }

      /*
       * Call list() to force a remote call - this
       * confirms if the registry is up and running
       */
      String s[] = registry.list();
            logger.log(Logger.INFO,
    rb.getString(rb.I_JMX_RMI_REGISTRY_STARTED, Integer.toString(port)));
  } catch(RemoteException re)  {
      throw new BrokerException(
    rb.getString(rb.W_JMX_RMI_REGISTRY_STARTED_EXCEPTION,
          Integer.toString(port), re.toString()));
  }
    }
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.