private void captureFileTime(boolean granted) { String name = getPolicyFileName(granted); File f = new File(name); lastModTimes[(int) (granted ? 1 : 0)] = f.lastModified(); }
private void captureFileTime(boolean granted) { String name = getPolicyFileName(granted); File f = new File(name); lastModTimes[(int) (granted ? 1 : 0)] = f.lastModified(); }
private boolean fileChanged(boolean granted) { String name = getPolicyFileName(granted); File f = new File(name); return _fileChanged(granted,f); }
private void removePolicyFile(boolean granted){ String fileName = getPolicyFileName(granted); File f = new File(fileName); if(f.exists()){ if (!f.delete()) { String defMsg = "Failure removing policy file: "+fileName; String msg=localStrings.getLocalString("pc.file_delete_error", defMsg,new Object []{ fileName} ); logger.log(Level.SEVERE,msg); throw new RuntimeException(defMsg); } else if(logger.isLoggable(Level.FINE)){ logger.fine("JACC Policy Provider: Policy file removed: "+fileName); } } }
private boolean fileChanged(boolean granted) { String name = getPolicyFileName(granted); File f = new File(name); return _fileChanged(granted,f); }
private void removePolicyFile(boolean granted){ String fileName = getPolicyFileName(granted); File f = new File(fileName); if(f.exists()){ if (!f.delete()) { String defMsg = "Failure removing policy file: "+fileName; String msg=localStrings.getLocalString("pc.file_delete_error", defMsg,new Object []{ fileName} ); logger.log(Level.SEVERE,msg); throw new RuntimeException(defMsg); } else if(logger.isLoggable(Level.FINE)){ logger.fine("JACC Policy Provider: Policy file removed: "+fileName); } } }
/** * tests if policy file has arrived (via synchronization system). * if File exists, also checks last modified time, in case file was * not deleted on transition out of inservice state. Called when context * is not inService to determine if it was needs to be transitioned * because of file distribution. * @param granted selects granted or excluded policy file * @return true if new file has arrived. */ private boolean fileArrived(boolean granted) { String name = getPolicyFileName(granted); File f = new File(name); boolean rvalue = ( f.exists() && _fileChanged(granted,f) ); if (logger.isLoggable(Level.FINE)){ logger.fine("JACC Policy Provider: file arrival check" + " type: " + (granted? "granted " : "excluded ") + " arrived: " + rvalue + " exists: " + f.exists() + " lastModified: " + f.lastModified() + " storedTime: " + lastModTimes[(int) (granted ? 1 : 0)] + " state: " + (this.state == OPEN_STATE ? "open " : "deleted ") + CONTEXT_ID); } return rvalue; }
/** * tests if policy file has arrived (via synchronization system). * if File exists, also checks last modified time, in case file was * not deleted on transition out of inservice state. Called when context * is not inService to determine if it was needs to be transitioned * because of file distribution. * @param granted selects granted or excluded policy file * @return true if new file has arrived. */ private boolean fileArrived(boolean granted) { String name = getPolicyFileName(granted); File f = new File(name); boolean rvalue = ( f.exists() && _fileChanged(granted,f) ); if (logger.isLoggable(Level.FINE)){ logger.fine("JACC Policy Provider: file arrival check" + " type: " + (granted? "granted " : "excluded ") + " arrived: " + rvalue + " exists: " + f.exists() + " lastModified: " + f.lastModified() + " storedTime: " + lastModTimes[(int) (granted ? 1 : 0)] + " state: " + (this.state == OPEN_STATE ? "open " : "deleted ") + CONTEXT_ID); } return rvalue; }
/** * @param applicationPolicyDirectory, need to have absolute path * @param open, then mark state as open * @param remove, then remove any existing policy statements */ protected PolicyConfigurationImpl (File applicationPolicyDirectory, boolean open, boolean remove, PolicyConfigurationFactoryImpl fact) { this.fact = fact; CONTEXT_ID = applicationPolicyDirectory.getParentFile().getName() + '/' + applicationPolicyDirectory.getName(); repository = fact.getRepository(); //initializeRepository(); String name = getPolicyFileName(true); File f = new File(name); if (!f.exists()) { String defMsg="Unable to open Policy file: "+name; String msg= localStrings.getLocalString("pc.file_not_found",defMsg,new Object []{ name}); logger.log(Level.SEVERE,msg); throw new RuntimeException(defMsg); } // initialize(open,remove,fromFile) initialize(open,remove,true); }
/** * @param applicationPolicyDirectory, need to have absolute path * @param open, then mark state as open * @param remove, then remove any existing policy statements */ protected PolicyConfigurationImpl (File applicationPolicyDirectory, boolean open, boolean remove, PolicyConfigurationFactoryImpl fact) { this.fact = fact; CONTEXT_ID = applicationPolicyDirectory.getParentFile().getName() + '/' + applicationPolicyDirectory.getName(); repository = fact.getRepository(); //initializeRepository(); String name = getPolicyFileName(true); File f = new File(name); if (!f.exists()) { String defMsg="Unable to open Policy file: "+name; String msg= localStrings.getLocalString("pc.file_not_found",defMsg,new Object []{ name}); logger.log(Level.SEVERE,msg); throw new RuntimeException(defMsg); } // initialize(open,remove,fromFile) initialize(open,remove,true); }
createPolicyContextDirectory(); removePolicyFile(granted); String name = getPolicyFileName(granted); OutputStreamWriter writer = null; try {
createPolicyContextDirectory(); removePolicyFile(granted); String name = getPolicyFileName(granted); OutputStreamWriter writer = null; try {
private Permissions loadExcludedPolicy() { Permissions result = null; String name = getPolicyFileName(false); FileReader reader = null; PolicyParser parser = new PolicyParser(false);
private Permissions loadExcludedPolicy() { Permissions result = null; String name = getPolicyFileName(false); FileReader reader = null; PolicyParser parser = new PolicyParser(false);
protected void initialize(boolean open, boolean remove, boolean fromFile) { synchronized(refreshLock) { String name = getPolicyFileName(true); if (open || remove) { setState(OPEN_STATE);
protected void initialize(boolean open, boolean remove, boolean fromFile) { synchronized(refreshLock) { String name = getPolicyFileName(true); if (open || remove) { setState(OPEN_STATE);