Package com.sun.messaging.jmq.jmsserver.service.imq

Examples of com.sun.messaging.jmq.jmsserver.service.imq.IMQService


    /**
     * Returns true when the broker is ready to start processing messages
     */
    public boolean directServiceIsUp() {
        IMQService service = (IMQService)Globals.getServiceManager().getService(name);
        if (service == null) return false;
        return service.getState() == ServiceState.RUNNING;
    }
View Full Code Here


     */
    public JMSService getJMSService(String serviceName)
        throws IllegalStateException  {
  ServiceManager sm = Globals.getServiceManager();
  Service svc;
  IMQService imqSvc;
  IMQDirectService imqDirectSvc;

  if (sm == null)  {
      return (null);
  }

  svc = sm.getService(serviceName);

  if (svc == null)  {
      return (null);
  }

  if (!(svc instanceof IMQService))  {
      return (null);
  }

  imqSvc = (IMQService)svc;

  if (!imqSvc.isDirect())  {
      return (null);
  }

  if (!(imqSvc instanceof IMQDirectService))  {
      return (null);
View Full Code Here

        if (service != null) {
            si.nConnections = cm.getNumConnections(service);
            si.state = service.getState();

            if (service instanceof IMQService) {
                IMQService ss = (IMQService)service;
                si.currentThreads = ss.getActiveThreadpool();
                si.minThreads = ss.getMinThreadpool();
                si.maxThreads = ss.getMaxThreadpool();
    // If we were configured to use dynamic ports, get the
    // port number that is acutally being used
    if (si.port == 0 && ss.getProtocol() != null) {
        si.port = ss.getProtocol().getLocalPort();
    }
            }
      if (mm != null) {
          si.metrics = mm.getMetricCounters(name);
      } else {
View Full Code Here

  }
 
    private JMSService getJMSService(String serviceName) throws IllegalStateException {
    ServiceManager sm = Globals.getServiceManager();
    Service svc;
    IMQService imqSvc;
    IMQDirectService imqDirectSvc;

    if (sm == null) {
      return (null);
    }

    svc = sm.getService(serviceName);

    if (svc == null) {
      return (null);
    }

    if (!(svc instanceof IMQService)) {
      return (null);
    }

    imqSvc = (IMQService) svc;

    if (!imqSvc.isDirect()) {
      return (null);
    }

    if (!(imqSvc instanceof IMQDirectService)) {
      return (null);
View Full Code Here

                errMsg = "Internal Error: can updated non-standard Service";
            } else {
            // XXX - really we want to do this through properties, I need
            // to repair this by fcs
                try {
                    IMQService stsvc = (IMQService)svc;
                    int port = -1;
                    int min = -1;
                    int max = -1;
                    if (info.isModified(info.PORT)) {
                        port = info.port;
                    }
                    if (info.isModified(info.MIN_THREADS)) {
                        min = info.minThreads;
                    }
                    if (info.isModified(info.MAX_THREADS)) {
                        max = info.maxThreads;
                    }
                    if (port != -1 || min !=-1 || max != -1) {
                        stsvc.updateService(port, min, max);
                    } else {
                        status = Status.ERROR;
                        errMsg = rb.getString( rb.X_NO_SERVICE_PROPS_SET,
                            info.name);
                    }
View Full Code Here

            // audit logging for successful authentication
            Globals.getAuditSession().authentication(con.getUserName(),  con.remoteHostString()true);

            if (req == null) {
                IMQService s = (IMQService)con.getService();
                String stype = ServiceType.getServiceTypeString(s.getServiceType());
                try {
                    AuthCacheData acd = s.getAuthCacheData();
                    acd.setCacheData(ac.getCacheData());
                    ac.checkConnectionPermission(s.getName(), stype);

                    // audit logging for connection authorization
                    Globals.getAuditSession().connectionAuth(con.getUserName(),  con.remoteHostString(),  stype, s.getName(), true);

                } catch (AccessControlException e) {
                    reason = "Forbidden";
                    status = Status.FORBIDDEN;
                    ac.logout();
                    logger.log(Logger.WARNING,
                        Globals.getBrokerResources().getKString(
                            BrokerResources.W_SERVICE_ACCESS_DENIED,
                            s.getName(), stype)+ " - " + e.getMessage(), e);

                    // audit logging for authentication failure
                    Globals.getAuditSession().connectionAuth(con.getUserName(), con.remoteHostString(),  stype, s.getName(), false);

                    username = con.getUserName();
                }
            }

            } catch (FailedLoginException e) {
                IMQService s = (IMQService)con.getService();

                Globals.getAuditSession().authentication(e.getUser(),con.remoteHostString(), false);

                username = e.getUser();

                status = Status.INVALID_LOGIN;
                reason = e.getMessage();
                logger.log(Logger.WARNING, BrokerResources.W_LOGIN_FAILED, e);
            } catch (OutOfMemoryError err) {
                // if we get an out of memory error, throw it
                // up so that memory is freed and the message is
                // re-processed
                throw err;
            } catch (Throwable w) {
            status = Status.FORBIDDEN;
            reason = w.getMessage();
            logger.log(Logger.ERROR, w.getMessage(), w);
            }
        }

        // XXX - for now simple returns granted authenticate reply
        Packet pkt = new Packet(con.useDirectBuffers());
        pkt.setConsumerID(msg.getConsumerID());
        Hashtable hash = new Hashtable();

        if (reason != null)
            hash.put("JMQReason", reason);

        if (resp == null) {
            pkt.setPacketType(PacketType.AUTHENTICATE_REPLY);
            hash.put("JMQStatus", new Integer(status));
            pkt.setProperties(hash);

        } else {

          if (req != null) {
              if (!con.setConnectionState(Connection.STATE_AUTH_REQUESTED)) {
                  status = Status.UNAVAILABLE;
                  req = null;
              }
          }

          if (req == null) {

            if (status == Status.OK) {
                if (!con.setConnectionState(Connection.STATE_AUTHENTICATED)) {
                status = Status.UNAVAILABLE;              
                }
            }
            pkt.setPacketType(PacketType.AUTHENTICATE_REPLY);
            hash.put("JMQStatus", new Integer(status));
            if (((IMQBasicConnection)con).getDumpPacket() ||
                ((IMQBasicConnection)con).getDumpOutPacket())
                hash.put("JMQReqID", msg.getSysMessageID().toString());
            pkt.setProperties(hash);

          } else {

            pkt.setPacketType(PacketType.AUTHENTICATE_REQUEST);
            hash.put("JMQAuthType", ac.getAuthType());
            hash.put("JMQChallenge", Boolean.valueOf(false));
            if (((IMQBasicConnection)con).getDumpPacket() ||
                ((IMQBasicConnection)con).getDumpOutPacket())
                hash.put("JMQReqID", msg.getSysMessageID().toString());
            pkt.setProperties(hash);
            pkt.setMessageBody(req);
          }

        }


        con.sendControlMessage(pkt);

        if (status != Status.OK) {
            IMQService s = (IMQService)con.getService();
      Agent agent = Globals.getAgent();
      if (agent != null)  {
          agent.notifyConnectionReject(s.getName(),
                  username,
                  con.remoteHostString());
      }

            con.closeConnection(true,
View Full Code Here

        // reset all services
        List services = Globals.getServiceManager().getAllServiceNames();
        Iterator itr = services.iterator();
        while (itr.hasNext()) {
            String name = (String)itr.next();
            IMQService service = (IMQService)Globals.getServiceManager().getService(name);
            if (service != null)
                service.resetCounters();
        }

        // reset metrics manager
        MetricManager mm = Globals.getMetricManager();
        mm.reset();
View Full Code Here

    private void updateService(int port, int min, int max)
      throws IOException, PropertyUpdateException,
      BrokerException  {
  ServiceManager sm = Globals.getServiceManager();
  Service svc = sm.getService(getName());
  IMQService stsvc;

  if (svc == null)  {
      throw new BrokerException(rb.getString(rb.X_NO_SUCH_SERVICE, getName()));
  }

  if (!(svc instanceof IMQService))  {
      throw new BrokerException("Internal Error: can updated non-standard Service");
  }

  stsvc = (IMQService)svc;

  stsvc.updateService(port, min, max);
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.service.imq.IMQService

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.