Examples of EntityIdentifier


Examples of cross.reputation.model.EntityIdentifier

      String userName, Collection<String> accounts) throws Exception {
    for(String accountName : accounts) {
      Community community = getCommunityByAccountName(accountName);
      if(community == null)
        continue;
      EntityIdentifier id = entity.getIdentificatorInCommunities().get(community);
      if(id == null) {
        ModelException.sendMessage(ModelException.INFO,
            "New account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        entity.addIdentificatorInCommunities(community,
          new EntityIdentifier(userName, accountName));
      } else if(id.getUrl() == null) {
        ModelException.sendMessage(ModelException.INFO,"Update account:"
            +entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        id.setUrl(accountName);
      }
    }
  }
View Full Code Here

Examples of cross.reputation.model.EntityIdentifier

          entity.getUniqueIdentificator()+" and it is discarted:"+ userArray.getString(0));
          continue;
        }
        if(!name.equals("")){
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
            new EntityIdentifier(user,null));
        }
        else{
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
            new EntityIdentifier(entity.getUniqueIdentificator(),userArray.getString(0)));
        }
         
        if(!entity.getIdentificatorInCommunities().isEmpty()) {
          GlobalModel.addEntity(entity);
        }
View Full Code Here

Examples of cross.reputation.model.EntityIdentifier

            System.out.println("Error: domain is not known from user:"+
            entity.getUniqueIdentificator()+" and it is discarted: "+contents[i]);
            continue;
          }
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
              new EntityIdentifier(entity.getUniqueIdentificator(),contents[i]));
        } else {
          String userName = contents[i].substring(0,coincidence);
          //System.out.println("iu:"+entity.getUniqueIdentificator()+",u:"+userName);
          String domain = findDomain(contents[i].substring(coincidence+3));
          //System.out.println("d:"+domain);         
          if(domain == null) {
            System.out.println("Error: domain is not known from user:"+
                entity.getUniqueIdentificator()+"-nickname:"+userName+
                " and it is discarted: "+contents[i].substring(coincidence+3));
            continue;
          }
          entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
              new EntityIdentifier(userName,null));
        }         
      }
      if(!entity.getIdentificatorInCommunities().isEmpty()) {
        GlobalModel.addEntity(entity);
      }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.applicationhistoryservice.timeline.EntityIdentifier

      return new TimelinePutResponse();
    }
    try {
      List<EntityIdentifier> entityIDs = new ArrayList<EntityIdentifier>();
      for (TimelineEntity entity : entities.getEntities()) {
        EntityIdentifier entityID =
            new EntityIdentifier(entity.getEntityId(), entity.getEntityType());
        entityIDs.add(entityID);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Storing the entity " + entityID + ", JSON-style content: "
              + TimelineUtils.dumpTimelineRecordtoJSON(entity));
        }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.timeline.EntityIdentifier

  public boolean checkAccess(UserGroupInformation callerUGI,
      TimelineEntity entity) throws YarnException, IOException {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Verifying the access of " + callerUGI.getShortUserName()
          + " on the timeline entity "
          + new EntityIdentifier(entity.getEntityId(), entity.getEntityType()));
    }

    if (!adminAclsManager.areACLsEnabled()) {
      return true;
    }

    Set<Object> values =
        entity.getPrimaryFilters().get(
            SystemFilter.ENTITY_OWNER.toString());
    if (values == null || values.size() != 1) {
      throw new YarnException("Owner information of the timeline entity "
          + new EntityIdentifier(entity.getEntityId(), entity.getEntityType())
          + " is corrupted.");
    }
    String owner = values.iterator().next().toString();
    // TODO: Currently we just check the user is the admin or the timeline
    // entity owner. In the future, we need to check whether the user is in the
View Full Code Here

Examples of org.apache.hadoop.yarn.server.timeline.EntityIdentifier

              }
            }
          } catch (YarnException e) {
            LOG.error("Error when verifying access for user " + callerUGI
                + " on the events of the timeline entity "
                + new EntityIdentifier(entity.getEntityId(),
                    entity.getEntityType()), e);
            entitiesItr.remove();
          }
        }
      }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.timeline.EntityIdentifier

      throw new WebApplicationException(e,
          Response.Status.INTERNAL_SERVER_ERROR);
    }
    if (entity == null) {
      throw new NotFoundException("Timeline entity "
          + new EntityIdentifier(parseStr(entityId), parseStr(entityType))
          + " is not found");
    }
    return entity;
  }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.timeline.EntityIdentifier

              eventsItr.remove();
            }
          } catch (Exception e) {
            LOG.error("Error when verifying access for user " + callerUGI
                + " on the events of the timeline entity "
                + new EntityIdentifier(eventsOfOneEntity.getEntityId(),
                    eventsOfOneEntity.getEntityType()), e);
            eventsItr.remove();
          }
        }
      }
View Full Code Here

Examples of org.apache.hadoop.yarn.server.timeline.EntityIdentifier

      List<EntityIdentifier> entityIDs = new ArrayList<EntityIdentifier>();
      TimelineEntities entitiesToPut = new TimelineEntities();
      List<TimelinePutResponse.TimelinePutError> errors =
          new ArrayList<TimelinePutResponse.TimelinePutError>();
      for (TimelineEntity entity : entities.getEntities()) {
        EntityIdentifier entityID =
            new EntityIdentifier(entity.getEntityId(), entity.getEntityType());

        // check if there is existing entity
        TimelineEntity existingEntity = null;
        try {
          existingEntity =
              store.getEntity(entityID.getId(), entityID.getType(),
                  EnumSet.of(Field.PRIMARY_FILTERS));
          if (existingEntity != null
              && !timelineACLsManager.checkAccess(callerUGI, existingEntity)) {
            throw new YarnException("The timeline entity " + entityID
                + " was not put by " + callerUGI + " before");
          }
        } catch (Exception e) {
          // Skip the entity which already exists and was put by others
          LOG.warn("Skip the timeline entity: " + entityID + ", because "
              + e.getMessage());
          TimelinePutResponse.TimelinePutError error =
              new TimelinePutResponse.TimelinePutError();
          error.setEntityId(entityID.getId());
          error.setEntityType(entityID.getType());
          error.setErrorCode(
              TimelinePutResponse.TimelinePutError.ACCESS_DENIED);
          errors.add(error);
          continue;
        }

        // inject owner information for the access check if this is the first
        // time to post the entity, in case it's the admin who is updating
        // the timeline data.
        try {
          if (existingEntity == null) {
            injectOwnerInfo(entity,
                callerUGI == null ? "" : callerUGI.getShortUserName());
          }
        } catch (YarnException e) {
          // Skip the entity which messes up the primary filter and record the
          // error
          LOG.warn("Skip the timeline entity: " + entityID + ", because "
              + e.getMessage());
          TimelinePutResponse.TimelinePutError error =
              new TimelinePutResponse.TimelinePutError();
          error.setEntityId(entityID.getId());
          error.setEntityType(entityID.getType());
          error.setErrorCode(
              TimelinePutResponse.TimelinePutError.SYSTEM_FILTER_CONFLICT);
          errors.add(error);
          continue;
        }
View Full Code Here

Examples of org.eurekastreams.server.domain.EntityIdentifier

                oneOf(tokenAddressBuilder).build(tokenContent, userId);
                will(returnValue(address));
            }
        });

        Serializable result = sut.execute(TestContextCreator.createPrincipalActionContext(new EntityIdentifier(
                EntityType.GROUP, groupId), null, userId));
        mockery.assertIsSatisfied();
        assertEquals(address, result);
    }
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.