예제 #1
0
 private void shutdownPDP() {
   status.updateProperty(KEY_RUN_STATUS, STATUS_RUN_NOTRUN);
   cacheMgr.removeAll();
   policyLoader.shutdown();
   AttributeRetrieverRegistry.removeInstance(this);
   CacheManager.removeInstance(this);
   ContextFactoryRegistry.removeContextFactory(this);
   PolicyLoaderRegistry.removeDataStore(this);
   pdpRegistry.remove(domain);
 }
예제 #2
0
  public void reloadPolicies()
      throws DataAdapterException, CacheSizeExceedCapacityException, PolicySyntaxException,
          BuiltInFunctionNotFoundException {
    System.out.println("Reloading policies ...");
    try {
      // update status
      status.updateProperty(KEY_RUN_STATUS, STATUS_RUN_RELOADPOLICY);

      cacheMgr.policyCache.writeLock();
      // clear both result and policy cache
      cacheMgr.removeAll();
      // reload all policies
      loadPolicies();
      if (logger.isDebugEnabled()) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        cacheMgr.policyCache.dump(out);
        logger.debug(
            "=================Dump all Cacheables that current in Policy Cache=================");
        logger.debug(
            "\nCurrent non-indexed empty target cache size = "
                + cacheMgr.policyCache.emptyTargetCache.size()
                + ".\n"
                + cacheMgr.policyCache.emptyTargetCache
                + "\n"
                + out.toString());
        logger.debug(
            "=====================================Done=========================================");
      }
    } finally {
      cacheMgr.policyCache.writeUnlock();
      status.updateProperty(KEY_RUN_STATUS, STATUS_RUN_RUNING);
    }
  }
예제 #3
0
 protected void initialize() throws ConfigurationException, XMLGeneralException {
   policyLoader = PolicyLoaderRegistry.getDataStore(this);
   contextFactory = ContextFactoryRegistry.getContextFactory(this);
   cacheMgr = CacheManager.getInstance(this);
   AttributeRetrieverRegistry.getInstance(this);
   status.updateProperty(KEY_RUN_STATUS, STATUS_RUN_INITIALIZED);
 }
예제 #4
0
 protected void loadPolicies()
     throws DataAdapterException, CacheSizeExceedCapacityException, PolicySyntaxException,
         BuiltInFunctionNotFoundException {
   // Load policies from data store
   DataAdapter[] dataAdapters = policyLoader.load();
   // Preprocess
   DataAdapterPreprocessor processor = new DataAdapterPreprocessor(dataAdapters);
   // Get all policies
   AbstractPolicy[] policies = processor.getPolicies();
   // Init default policy resolver.
   PolicyResolver[] resolvers = PolicyResolverRegistry.getInstance(this).getAllPolicyResolvers();
   for (PolicyResolver resolver : resolvers) {
     if (resolver instanceof DefaultDataStorePolicyResolver) {
       ((DefaultDataStorePolicyResolver) resolver).setPolicies(policies);
     }
   }
   // Resolve all policies if required
   if (resolveReferencedPoliciesOnLoad) {
     processor.resolveAllPolicies();
   }
   // add policies to cache
   cacheMgr.addPolicies(policies);
 }