コード例 #1
0
  public SessionImpl(
      Repository repository,
      User currentUser,
      StorageClient client,
      Configuration configuration,
      StorageCacheManager storageCacheManager,
      StoreListener storeListener,
      PrincipalValidatorResolver principalValidatorResolver)
      throws ClientPoolException, StorageClientException, AccessDeniedException {
    this.currentUser = currentUser;
    this.repository = repository;
    this.client = client;
    this.storageCacheManager = storageCacheManager;
    this.storeListener = storeListener;
    this.configuration = configuration;

    if (this.storageCacheManager == null) {
      if ((nagclient % 1000) == 0) {
        LOGGER.warn(
            "No Cache Manager, All Caching disabled, please provide an Implementation of NamedCacheManager. This message will appear every 1000th time a session is created. ");
      }
      nagclient++;
    }
    accessControlManager =
        new AccessControlManagerImpl(
            client,
            currentUser,
            configuration,
            getCache(configuration.getAclColumnFamily()),
            storeListener,
            principalValidatorResolver);
    Map<String, CacheHolder> authorizableCache =
        getCache(configuration.getAuthorizableColumnFamily());
    authorizableManager =
        new AuthorizableManagerImpl(
            currentUser,
            this,
            client,
            configuration,
            accessControlManager,
            authorizableCache,
            storeListener);

    contentManager =
        new ContentManagerImpl(
            client,
            accessControlManager,
            configuration,
            getCache(configuration.getContentColumnFamily()),
            storeListener);

    lockManager =
        new LockManagerImpl(
            client, configuration, currentUser, getCache(configuration.getLockColumnFamily()));

    authenticator = new AuthenticatorImpl(client, configuration, authorizableCache);

    storeListener.onLogin(currentUser.getId(), this.toString());
  }
コード例 #2
0
 public void logout() throws ClientPoolException {
   if (closedAt == null) {
     commit();
     accessControlManager.close();
     authorizableManager.close();
     contentManager.close();
     lockManager.close();
     client.close();
     accessControlManager = null;
     authorizableManager = null;
     contentManager = null;
     client = null;
     authenticator = null;
     closedAt = new Exception("This session was closed at:");
     storeListener.onLogout(currentUser.getId(), this.toString());
   }
 }