This class implements the RELOAD Usage for shared resource access
Inheritance: IUsage
Ejemplo n.º 1
0
    public IUsage Create(int? type, params object[] arguments) {

      Boolean allowDelegation = (Boolean)arguments[3];

      AccessList accessList = new AccessList((string)arguments[0],
                                             (string)arguments[1],
                                             (UInt32)arguments[2],
                                             allowDelegation,
                                             myManager);
      return accessList;
    }
Ejemplo n.º 2
0
    public void AppProcedure(MessageTransport transport,
      List<FetchKindResponse> kindRes) {

      UInt32 aclKindId = new AccessList(myManager).KindId;

      var responses = new List<FetchKindResponse>();
      responses.AddRange(kindRes);
      var disCoList = new List<DisCoRegistration>();
      var aclList = new List<AccessList>();
      /* Extract all stored data for this usage */
      var rmIndice = new List<int>();
      foreach (FetchKindResponse fkr in responses) {
        if (fkr.kind == aclKindId) {
          foreach (StoredData sd in fkr.values)
            aclList.Add((AccessList)sd.Value.GetUsageValue);
          kindRes.Remove(fkr);
        }
        if (fkr.kind == KindId) {
          foreach (StoredData sd in fkr.values)
            disCoList.Add((DisCoRegistration)sd.Value.GetUsageValue);
          kindRes.Remove(fkr);
        }
      }

      /* begin AppProcedure */

      // TODO validation of DisCo-Regs with ACL
      /* Choose topologically closest focus */
      if (disCoList.Count > 0) {
        /* MOK for demo */
        //var coordinates = new List<int>();        
        foreach (DisCoRegistration dr in disCoList) {
          int remoteCoords = int.Parse(dr.Data.Coordinate);
          NodeId focusId = dr.data.node_id;
          if (remoteCoords == myManager.m_ReloadConfig.MyCoordinate) {
            myManager.m_ReloadConfig.MyFocus = focusId;
            Arbiter.Activate(myManager.m_DispatcherQueue,
                new IterativeTask<Destination>(new Destination(focusId),
                    transport.AppAttachProcedure));
          }
          else {
            myManager.m_ReloadConfig.Logger(ReloadGlobals.TRACEFLAGS.T_WARNING,
              "Focus not in my coords");
          }
        }
      }
    }