Package fr.dyade.aaa.agent

Examples of fr.dyade.aaa.agent.AgentId


      logger.log(BasicLevel.DEBUG, "--- " + this + " ClusterQueue.sendToCluster(" + not + ")");

    if (clusters.size() < 2) return;

    for (Iterator e = clusters.keySet().iterator(); e.hasNext();) {
      AgentId id = (AgentId) e.next();
      if (! id.equals(getId()))
        forward(id,not);
    }
  }
View Full Code Here


    super.doDeleteNot(not);
  }

  protected void doUnknownAgent(UnknownAgent uA) {
    super.doUnknownAgent(uA);
    AgentId agId = uA.agent;
    Notification not = uA.not;

    if (not instanceof ClusterJoinNot) {
      ClusterJoinNot cT = (ClusterJoinNot) not;
      logger.log(BasicLevel.ERROR, "Cluster join failed: " + uA.agent + " unknown.");
View Full Code Here

   */
  protected void setRight(SetRight request,
                       AgentId replyTo,
                       String requestMsgId,
                       String replyMsgId) {
    AgentId user = null;
    if (request.getUserProxId() != null)
      user = AgentId.fromString(request.getUserProxId());

    int right = 0;
    if (request instanceof SetReader)
View Full Code Here

   */
  protected void getRights(AgentId from, GetRightsRequestNot not) throws AccessException {
    if (! isAdministrator(from))
      throw new AccessException("ADMIN right not granted");

    AgentId key;
    int right;
    Vector readers = new Vector();
    Vector writers = new Vector();
    for (Enumeration keys = clients.keys(); keys.hasMoreElements();) {
      key = (AgentId) keys.nextElement();
View Full Code Here

   * @return the rights set on this destination.
   */
  public String[] getRights() {
    String rigths[] = new String[clients.size()];

    AgentId key;
    int right;

    int i=0;
    for (Enumeration keys = clients.keys(); keys.hasMoreElements();) {
      key = (AgentId) keys.nextElement();
      right = ((Integer) clients.get(key)).intValue();
      rigths[i++] = key.toString() + _rights[right -1];
    }

    return rigths;
  }
View Full Code Here

   *
   * @param userid The user's unique identifier.
   * @return the rights set on this destination.
   */
  public String getRight(String userid) {
    AgentId key = AgentId.fromString(userid);
    if (key == null) return userid + ":bad user;";
    Integer right = (Integer) clients.get(key);
    if (right == null) return userid + ":unknown;";

    return userid + _rights[right.intValue() -1];
View Full Code Here

      InterceptorsHelper.addInterceptors(interceptors_in, interceptorsIN);
    }
   
    // Browsing the pre-crash contexts:
    ClientContext activeCtx;
    AgentId destId;
    for (Iterator ctxs = contexts.values().iterator(); ctxs.hasNext();) {
      activeCtx = (ClientContext) ctxs.next();
      ctxs.remove();

      // Denying the non acknowledged messages:
      for (Iterator queueIds = activeCtx.getDeliveringQueues(); queueIds.hasNext();) {
        destId = (AgentId) queueIds.next();
        sendNot(destId, new DenyRequest(activeCtx.getId()));

        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, "Denies messages on queue " + destId.toString());
      }

      // Saving the prepared transactions.
      Iterator xids = activeCtx.getTxIds();
      Xid xid;
      XACnxPrepare recoveredPrepare;
      XACnxPrepare prepare;
      while (xids.hasNext()) {
        if (recoveredTransactions == null)
          recoveredTransactions = new Hashtable();

        xid = (Xid) xids.next();

        recoveredPrepare = (XACnxPrepare) recoveredTransactions.get(xid);
        prepare = activeCtx.getTxPrepare(xid);

        if (recoveredPrepare == null)
          recoveredTransactions.put(xid, prepare);
        else {
          recoveredPrepare.getSendings().addAll(prepare.getSendings());
          recoveredPrepare.getAcks().addAll(prepare.getAcks());
        }
      }

      // Deleting the temporary destinations:
      for (Iterator tempDests = activeCtx.getTempDestinations(); tempDests.hasNext();) {
        destId = (AgentId) tempDests.next();
        deleteTemporaryDestination(destId);
 
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, "Deletes temporary destination " + destId.toString());
      }
    }

    // Retrieving the subscriptions' messages.
    List messages = Message.loadAll(getMsgTxname());
View Full Code Here

   */
  private void reactToClientRequest(int key, ProducerMessages req) throws RequestException {
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "UserAgent.reactToClientRequest(" + key + ',' + req + ')');

    AgentId destId = AgentId.fromString(req.getTarget());
    if (destId == null)
      throw new RequestException("Request to an undefined destination (null).");

    ProducerMessages pm = req;
    if (interceptorsIN != null && !interceptorsIN.isEmpty()) {
      org.objectweb.joram.shared.messages.Message m = null;
      Vector msgs = ((ProducerMessages) req).getMessages();
      Vector newMsgs = new Vector();
      for (int i = 0; i < msgs.size(); i++) {
        m = (org.objectweb.joram.shared.messages.Message) msgs.elementAt(i);
        Iterator it = interceptorsIN.iterator();
        while (it.hasNext()) {
          MessageInterceptor interceptor = (MessageInterceptor) it.next();
          if (!interceptor.handle(m)) {
            m = null;
            break;
          }
        }
        if (m != null) {
          newMsgs.add(m);
        } else {
          // send the originals messages to the user DMQ.
          sendToDMQ((org.objectweb.joram.shared.messages.Message) msgs.elementAt(i), MessageErrorConstants.INTERCEPTORS);
        }
      }
      // no message to send. Send reply to the producer.
      if (newMsgs.size() == 0 && !msgs.isEmpty()) {
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, "UserAgent.reactToClientRequest : no message to send.");
        if (destId.getTo() == getId().getTo() && !pm.getAsyncSend()) {
          // send producer reply
          sendNot(getId(), new SendReplyNot(key, pm.getRequestId()));
        }
        return;
      }
      //update producer message.
      ((ProducerMessages) pm).setMessages(newMsgs);
      pm = req;
    }

    ClientMessages not = new ClientMessages(key, pm.getRequestId(), pm.getMessages());
    setDmq(not);

    if (destId.getTo() == getId().getTo()) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, " -> local sending");
      not.setPersistent(false);
      not.setExpiration(0L);
      if (pm.getAsyncSend()) {
View Full Code Here

   */
  private void reactToClientRequest(int key, ConsumerReceiveRequest req) throws RequestException {   
    if (req.getQueueMode()) {
      ReceiveRequest not = new ReceiveRequest(key, req.getRequestId(), req.getSelector(),
          req.getTimeToLive(), req.getReceiveAck(), null, 1);
      AgentId destId = AgentId.fromString(req.getTarget());
      if (destId == null)
        throw new RequestException("Request to an undefined destination (null).");

      if (destId.getTo() == getId().getTo()) {
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, " -> local receiving");
        not.setPersistent(false);
        sendNot(destId, not);
      } else {
View Full Code Here

                                              req.getSelector(),
                                              0,
                                              false,
                                              req.getMessageIdsToAck(),
                                              req.getMessageCount());   
      AgentId destId = AgentId.fromString(req.getTarget());
      if (destId == null)
        throw new RequestException("Request to an undefined destination (null).");

      if (destId.getTo() == getId().getTo()) {
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, " -> local sending");
        not.setPersistent(false);
        sendNot(destId, not);
      } else {
View Full Code Here

TOP

Related Classes of fr.dyade.aaa.agent.AgentId

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.