public int getIdentityObjectsCount(
      IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType)
      throws IdentityException {
    int count =
        cacheSupport.getIdentityObjectCount(getCacheNS(invocationCtx), identityType.getName());

    if (count != -1) {
      return count;
    }
    count = identityStore.getIdentityObjectsCount(invocationCtx, identityType);

    cacheSupport.putIdentityObjectCount(getCacheNS(invocationCtx), identityType.getName(), count);

    return count;
  }
  public IdentityObject findIdentityObject(
      IdentityStoreInvocationContext invocationContext,
      String name,
      IdentityObjectType identityObjectType)
      throws IdentityException {
    IdentityObjectSearchImpl search = new IdentityObjectSearchImpl();
    search.setName(name);
    if (identityObjectType != null) {
      search.setType(identityObjectType.getName());
    }
    Collection<IdentityObject> results =
        cacheSupport.getIdentityObjectSearch(getCacheNS(invocationContext), search);

    if (results != null && results.size() == 1) {
      return results.iterator().next();
    }

    IdentityObject io =
        identityStore.findIdentityObject(invocationContext, name, identityObjectType);

    if (io != null) {
      Set<IdentityObject> temp = new HashSet<IdentityObject>();
      temp.add(io);
      cacheSupport.putIdentityObjectSearch(getCacheNS(invocationContext), search, temp);
    }

    return io;
  }
  public String getGroupType(IdentityObjectType identityObjectType) {
    if (identityObjectType == null) {
      throw new IllegalArgumentException("identityObjectType is null");
    }

    return identityObjectType.getName();
  }
  public boolean isIdentity(IdentityObjectType identityObjectType) {
    if (identityObjectType == null) {
      throw new IllegalArgumentException("identityObjectType is null");
    }

    if (identityObjectType.getName().equals(identityTypeName)) {
      return true;
    }
    return false;
  }
  public IdentityObject createIdentityObject(
      IdentityStoreInvocationContext invocationCtx,
      String name,
      IdentityObjectType identityObjectType)
      throws IdentityException {

    IdentityObject io = identityStore.createIdentityObject(invocationCtx, name, identityObjectType);

    if (io != null) {
      cacheSupport.invalidateIdentityObjectRelationshipNameSearches(getCacheNS(invocationCtx));
      cacheSupport.invalidateIdentityObjectRelationshipSearches(getCacheNS(invocationCtx));
      cacheSupport.invalidateIdentityObjectSearches(getCacheNS(invocationCtx));
      cacheSupport.invalidateIdentityObjectCount(
          getCacheNS(invocationCtx), identityObjectType.getName());
    }
    return io;
  }