Package fr.dyade.aaa.jndi2.distributed

Examples of fr.dyade.aaa.jndi2.distributed.DistributedJndiServer


                       "ReplicationManager.onUpdateEvent(" +
                       from + ',' + evt + ')');

    NamingContextInfo[] contexts = evt.getNamingContexts();
    for (int i = 0; i < contexts.length; i++) {
      NamingContext nc = getServerImpl().getNamingContext(
                                                          contexts[i].getNamingContext().getId());

      if (nc == null) {
        // The InitJndiServerNot sent by
        // the server that created this context may not
        // have been received.
        getServerImpl().addNamingContext(contexts[i]);
        // TODO : NTA uncomment and implement retryRequestsWaitingForMissingContext
        //         retryRequestsWaitingForMissingContext(
        //           contexts[i].getNamingContext().getId());
      } else {
        nc.setOwnerId(contexts[i].getNamingContext().getOwnerId());
        getServerImpl().resetNamingContext(
                                           contexts[i].getNamingContext());
        // DF: must retry the sync and write
        // requests to the new owner.
      }
View Full Code Here


    Hashtable  composite_context= new Hashtable();
    if (contexts != null) {
      Vector newNames = new Vector();
      for (int i = 0; i < contexts.length; i++) {
        if(!looseCoupling) {
          NamingContext nc = getServerImpl().getNamingContext(
                                                              contexts[i].getNamingContext().getId());
          if (nc == null) {
            getServerImpl().addNamingContext(contexts[i]);
            newNames.addElement(contexts[i].getCompositeName());
          }
          // Else the naming context has already been
          // added by an other server that is the (new)
          // owner of this context.

        } else {
          NamingContext nc;
          try{
            nc = getServerImpl().getNamingContext(contexts[i].getCompositeName());
          }catch(MissingRecordException mre){
            nc=null;
          }catch( MissingContextException mce){
            nc=null;
          }
          if(nc == null){
            nc = getServerImpl().newNamingContext( getId(),null,contexts[i].getCompositeName());
            contexts[i].getNamingContext().setOwnerId(getId());
          }

          Enumeration enumRecord = contexts[i].getNamingContext().getEnumRecord();
          while (enumRecord.hasMoreElements()) {         
            Record record =(RecordenumRecord.nextElement();
            Record r = nc.getRecord(record.getName());
            if (r == null
              nc.addRecord(record);
            if(record instanceof ContextRecord){
              CompositeName parentPath = contexts[i].getCompositeName();
              record_compositeName.put(record,parentPath);
            }
          }
          composite_context.put(contexts[i].getCompositeName(),nc);
        }
      }
      if(looseCoupling){
        Enumeration enumKeyRecord = record_compositeName.keys();
        while(enumKeyRecord.hasMoreElements()) {
          Record recor =(Record)enumKeyRecord.nextElement();
          CompositeName cn =(CompositeName)((CompositeName)(record_compositeName.get(recor))).clone();
          cn.add(recor.getName());
          if(composite_context.containsKey(cn)){
            NamingContext nc  =(NamingContext)composite_context.get(cn);
            ((ContextRecord)recor).setId(nc.getId());
          }       
        }
        Enumeration enumContext = composite_context.elements();
        while(enumContext.hasMoreElements()) {
          NamingContext nc  =(NamingContext)enumContext.nextElement();
          getServerImpl().storeNamingContext(nc);
        }
      }

View Full Code Here

                       "RequestManager.invokeReadRequest(" + reqCtx + ')');
    JndiRequest request = reqCtx.getRequest();
    if (request instanceof LookupRequest) {
      Object obj = lookup((LookupRequest)request);
      if (obj != null) {
        ObjectRecord or = (ObjectRecord)obj;
        return new LookupReply(or.getObject());
      }
      // This is a context record
      return new JndiReply();
    } else if (request instanceof ListBindingsRequest) {
      Object obj = listBindings((ListBindingsRequest)request);
View Full Code Here

            contexts[i].getNamingContext().setOwnerId(getId());
          }

          Enumeration enumRecord = contexts[i].getNamingContext().getEnumRecord();
          while (enumRecord.hasMoreElements()) {         
            Record record =(RecordenumRecord.nextElement();
            Record r = nc.getRecord(record.getName());
            if (r == null
              nc.addRecord(record);
            if(record instanceof ContextRecord){
              CompositeName parentPath = contexts[i].getCompositeName();
              record_compositeName.put(record,parentPath);
            }
          }
          composite_context.put(contexts[i].getCompositeName(),nc);
        }
      }
      if(looseCoupling){
        Enumeration enumKeyRecord = record_compositeName.keys();
        while(enumKeyRecord.hasMoreElements()) {
          Record recor =(Record)enumKeyRecord.nextElement();
          CompositeName cn =(CompositeName)((CompositeName)(record_compositeName.get(recor))).clone();
          cn.add(recor.getName());
          if(composite_context.containsKey(cn)){
            NamingContext nc  =(NamingContext)composite_context.get(cn);
            ((ContextRecord)recor).setId(nc.getId());
          }       
        }
View Full Code Here

      Trace.logger.log(BasicLevel.DEBUG,
                       "\n\nRequestManager.agentInitialize(" +
                       firstTime + ')');
    // Create the object that handles the
    // naming data.
    impl = new ServerImpl(
      AgentServer.getTransaction(),
      getId(),
      getRootOwnerId());   
    impl.initialize();
  }
View Full Code Here

    impl.writeBag(out);
  }

  public void readBag(ObjectInputStream in)
    throws IOException, ClassNotFoundException {
    impl = new ServerImpl(
      AgentServer.getTransaction(),
      getId(),
      getRootOwnerId());
    impl.readBag(in);
  }
View Full Code Here

  void doReact(AgentId from, JndiUpdateNot not) throws Exception {
    if (Trace.logger.isLoggable(BasicLevel.DEBUG))
      Trace.logger.log(BasicLevel.DEBUG,
                       "ReplicationManager[" + getId() + "].doReact(" +
                       from + ',' + not + ')');
    UpdateEvent updateEvent = not.getUpdateEvent();
    try {
      if (updateEvent instanceof BindEvent) {
        onUpdateEvent(from, (BindEvent)updateEvent);
      } else if (updateEvent instanceof RebindEvent) {
        onUpdateEvent(from, (RebindEvent)updateEvent);
View Full Code Here

  public static final int NOT_IDEMPOTENT = -1;

  public static boolean isIdempotent(JndiRequest request) {
    if (request instanceof JndiReadRequest) return true;
    if (request instanceof BindRequest) {
      BindRequest br = (BindRequest)request;
      return br.isRebind();
    }
    return false;
  }
View Full Code Here

                       name + ',' + obj + ')');
    if (obj instanceof Referenceable) {
      obj = ((Referenceable)obj).getReference();
    }
    JndiReply reply = connection.invoke(
      new BindRequest(merge(contextPath, name), obj));
    if (reply instanceof JndiError) {
      NamingException exc = ((JndiError)reply).getException();
      exc.fillInStackTrace();
      throw exc;
    }
View Full Code Here

                       name + ',' + obj + ')');
    if (obj instanceof Referenceable) {
      obj = ((Referenceable)obj).getReference();
    }
    JndiReply reply = connection.invoke(
      new BindRequest(merge(contextPath, name), obj, true));
    if (reply instanceof JndiError) {
      NamingException exc = ((JndiError)reply).getException();
      exc.fillInStackTrace();
      throw exc;
    }
View Full Code Here

TOP

Related Classes of fr.dyade.aaa.jndi2.distributed.DistributedJndiServer

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.