Examples of RequestQueue


Examples of org.apache.manifoldcf.authorities.system.RequestQueue

      if (Logging.authorityService.isDebugEnabled())
      {
        Logging.authorityService.debug("Received authority request for user '"+userID+"'");
      }

      RequestQueue queue = ManifoldCF.getRequestQueue();
      if (queue == null)
      {
        // System wasn't started; return unauthorized
        throw new ManifoldCFException("System improperly initialized");
      }

      IThreadContext itc = ThreadContextFactory.make();
      IAuthorityConnectionManager authConnManager = AuthorityConnectionManagerFactory.make(itc);

      IAuthorityConnection[] connections = authConnManager.getAllConnections();
      int i = 0;

      AuthRequest[] requests = new AuthRequest[connections.length];

      // Queue up all the requests
      while (i < connections.length)
      {
        IAuthorityConnection ac = connections[i];

        String identifyingString = ac.getDescription();
        if (identifyingString == null || identifyingString.length() == 0)
          identifyingString = ac.getName();

        AuthRequest ar = new AuthRequest(userID,ac.getClassName(),identifyingString,ac.getConfigParams(),ac.getMaxConnections());
        queue.addRequest(ar);

        requests[i++] = ar;
      }

      // Now, work through the returning answers.
View Full Code Here

Examples of org.apache.manifoldcf.authorities.system.RequestQueue

      if (Logging.authorityService.isDebugEnabled())
      {
        Logging.authorityService.debug("Received authority request for user '"+userID+"'");
      }

      RequestQueue queue = ManifoldCF.getRequestQueue();
      if (queue == null)
      {
        // System wasn't started; return unauthorized
        throw new ManifoldCFException("System improperly initialized");
      }

      IThreadContext itc = ThreadContextFactory.make();
      IAuthorityConnectionManager authConnManager = AuthorityConnectionManagerFactory.make(itc);

      IAuthorityConnection[] connections = authConnManager.getAllConnections();
      int i = 0;

      AuthRequest[] requests = new AuthRequest[connections.length];

      // Queue up all the requests
      while (i < connections.length)
      {
        IAuthorityConnection ac = connections[i];

        String identifyingString = ac.getDescription();
        if (identifyingString == null || identifyingString.length() == 0)
          identifyingString = ac.getName();

        AuthRequest ar = new AuthRequest(userID,ac.getClassName(),identifyingString,ac.getConfigParams(),ac.getMaxConnections());
        queue.addRequest(ar);

        requests[i++] = ar;
      }

      // Now, work through the returning answers.
View Full Code Here

Examples of org.apache.manifoldcf.authorities.system.RequestQueue

      if (Logging.authorityService.isDebugEnabled())
      {
        Logging.authorityService.debug("Received authority request for user '"+userID+"'");
      }

      RequestQueue queue = ManifoldCF.getRequestQueue();
      if (queue == null)
      {
        // System wasn't started; return unauthorized
        throw new ManifoldCFException("System improperly initialized");
      }

      IThreadContext itc = ThreadContextFactory.make();
      IAuthorityConnectionManager authConnManager = AuthorityConnectionManagerFactory.make(itc);

      IAuthorityConnection[] connections = authConnManager.getAllConnections();
      int i = 0;

      AuthRequest[] requests = new AuthRequest[connections.length];

      // Queue up all the requests
      while (i < connections.length)
      {
        IAuthorityConnection ac = connections[i];

        String identifyingString = ac.getDescription();
        if (identifyingString == null || identifyingString.length() == 0)
          identifyingString = ac.getName();

        AuthRequest ar = new AuthRequest(userID,ac.getClassName(),identifyingString,ac.getConfigParams(),ac.getMaxConnections());
        queue.addRequest(ar);

        requests[i++] = ar;
      }

      // Now, work through the returning answers.
View Full Code Here

Examples of org.jivesoftware.xmpp.workgroup.RequestQueue

            catch (StringprepException se) {
                errors.put("wgName", "");
            }
        }
        // do a create if there were no errors
        RequestQueue queue = null;
        if (errors.size() == 0) {
            try {
                // Create new workgroup
                Workgroup workgroup = wgManager.createWorkgroup(workgroupName);
                workgroup.setDescription(description);
View Full Code Here

Examples of org.jivesoftware.xmpp.workgroup.RequestQueue

  public boolean handleRequest(Workgroup workgroup, UserRequest request) {
        boolean success = false;
        Map<String,List<String>> metaData = request.getMetaData();
        if (metaData != null) {
            // Route to queue with most matching meta-data
            RequestQueue bestQueue = routeNoOverflow(workgroup, metaData);
            if (bestQueue != null) {
                setRoutingQueue(bestQueue.getID());
                success = true;
            }
        }
        return success;
    }
View Full Code Here

Examples of org.jivesoftware.xmpp.workgroup.RequestQueue

        }
        return success;
    }

    private RequestQueue routeNoOverflow(Workgroup workgroup, Map<String,List<String>> metaData) {
        RequestQueue bestQueue = null;
        int bestMatch = -1;
        int currentMatch;
        for (RequestQueue requestQueue : workgroup.getRequestQueues()) {
            // Skip queues that doesn't have agents at the moment
            if (!requestQueue.isOpened()) {
View Full Code Here

Examples of org.jivesoftware.xmpp.workgroup.RequestQueue

     * available, or randomly.</p>
     *
     * @param offer the offer to place in the overflow queue.
     */
    private void overflow(Offer offer) {
        RequestQueue backup = null;
        if (RequestQueue.OverflowType.OVERFLOW_BACKUP.equals(queue.getOverflowType())) {
            backup = queue.getBackupQueue();
            // Check that the backup queue has agents available otherwise discard it
            if (backup != null && !backup.getAgentSessionList().containsAvailableAgents()) {
                backup = null;
            }
        }
        else if (RequestQueue.OverflowType.OVERFLOW_RANDOM.equals(queue.getOverflowType())) {
            backup = getRandomQueue();
        }
        // If a backup queue was found then cancel this offer, remove the request from the queue
        // and add the request in the backup queue
        if (backup != null) {
            offer.cancel();
            UserRequest request = (UserRequest) offer.getRequest();
            // Remove the request from the queue since it is going to be added to another
            // queue
            queue.removeRequest(request);
            // Log debug trace
            Log.debug("RR - Overflowing request: " + request + " to queue: " +
                    backup.getAddress());
            backup.addRequest(request);
        }
    }
View Full Code Here

Examples of org.jivesoftware.xmpp.workgroup.RequestQueue

                offerAccpeted = System.currentTimeMillis();
            }
            else {
                // Invite the agent to the room by sending an offer
                Workgroup workgroup = agentSession.getWorkgroups().iterator().next();
                RequestQueue requestQueue = workgroup.getRequestQueues().iterator().next();
                // Add the requested agent as the initial target agent to get the offer
                getMetaData().put("agent", Arrays.asList(invitee.toString()));
                getMetaData().put("ignore", Arrays.asList(inviter.toBareJID()));
                // Dispatch the request
                requestQueue.getDispatcher().injectRequest(this);
            }
        }
        else if (Type.queue == type) {
            // Send offer to the best again available in the requested queue
            Workgroup targetWorkgroup = WorkgroupManager.getInstance().getWorkgroup(invitee.getNode());
            if (targetWorkgroup == null) {
                // No workgroup was found for the specified invitee. Send a Message with the error
                sendErrorMessage("Specified workgroup was not found.");
                return;
            }
            try {
                RequestQueue requestQueue = targetWorkgroup.getRequestQueue(invitee.getResource());
                getMetaData().put("ignore", Arrays.asList(inviter.toBareJID()));
                // Dispatch the request
                requestQueue.getDispatcher().injectRequest(this);
            }
            catch (NotFoundException e) {
                // No queue was found for the specified invitee. Send a Message with the error
                sendErrorMessage("Specified queue was not found.");
            }
        }
        else if (Type.workgroup == type) {
            // Select the best queue based on the original request
            Workgroup targetWorkgroup = WorkgroupManager.getInstance().getWorkgroup(invitee.getNode());
            if (targetWorkgroup != null) {
                RequestQueue requestQueue = RoutingManager.getInstance().getBestQueue(targetWorkgroup, userRequest);
                getMetaData().put("ignore", Arrays.asList(inviter.toBareJID()));
                // Send offer to the best again available in the requested queue
                requestQueue.getDispatcher().injectRequest(this);
            }
            else {
                // No workgroup was found for the specified invitee. Send a Message with the error
                sendErrorMessage("Specified workgroup was not found.");
            }
View Full Code Here

Examples of org.jivesoftware.xmpp.workgroup.RequestQueue

                offerAccepted = System.currentTimeMillis();
            }
            else {
                // Invite the agent to the room by sending an offer
                Workgroup workgroup = agentSession.getWorkgroups().iterator().next();
                RequestQueue requestQueue = workgroup.getRequestQueues().iterator().next();
                // Add the requested agent as the initial target agent to get the offer
                getMetaData().put("agent", Arrays.asList(invitee.toString()));
                getMetaData().put("ignore", Arrays.asList(inviter.toBareJID()));
                // Dispatch the request
                requestQueue.getDispatcher().injectRequest(this);
            }
        }
        else if (Type.queue == type) {
            // Send offer to the best again available in the requested queue
            Workgroup targetWorkgroup = WorkgroupManager.getInstance().getWorkgroup(invitee.getNode());
            if (targetWorkgroup == null) {
                // No workgroup was found for the specified invitee. Send a Message with the error
                sendErrorMessage("Specified workgroup was not found.");
                return;
            }
            try {
                RequestQueue requestQueue = targetWorkgroup.getRequestQueue(invitee.getResource());
                getMetaData().put("ignore", Arrays.asList(inviter.toBareJID()));
                // Dispatch the request
                requestQueue.getDispatcher().injectRequest(this);
            }
            catch (NotFoundException e) {
                // No queue was found for the specified invitee. Send a Message with the error
                sendErrorMessage("Specified queue was not found.");
            }
        }
        else if (Type.workgroup == type) {
            // Select the best queue based on the original request
            Workgroup targetWorkgroup = WorkgroupManager.getInstance().getWorkgroup(invitee.getNode());
            if (targetWorkgroup != null) {
                RequestQueue requestQueue = RoutingManager.getInstance().getBestQueue(targetWorkgroup, userRequest);
                getMetaData().put("ignore", Arrays.asList(inviter.toBareJID()));
                // Send offer to the best again available in the requested queue
                requestQueue.getDispatcher().injectRequest(this);
            }
            else {
                // No workgroup was found for the specified invitee. Send a Message with the error
                sendErrorMessage("Specified workgroup was not found.");
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.