コード例 #1
0
ファイル: PDP.java プロジェクト: ki1795/enterprise-java-xacml
 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
ファイル: PDP.java プロジェクト: ki1795/enterprise-java-xacml
  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
ファイル: PDP.java プロジェクト: ki1795/enterprise-java-xacml
 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
ファイル: PDP.java プロジェクト: ki1795/enterprise-java-xacml
 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);
 }