private String fileToName(File policyFile) throws PolicyIndexException {
        try {
            if (!policyFile.getName().endsWith(".xml"))
                throw new PolicyIndexException("Invalid policy file name.  Policy files must end in .xml - " + policyFile.getName());

            return PID.fromFilename(policyFile.getName().substring(0, policyFile.getName().lastIndexOf(".xml"))).toString();
        } catch (MalformedPIDException e) {
            throw new PolicyIndexException("Invalid policy file name.  Filename cannot be converted to a valid PID - " + policyFile.getName());
        }

    }
private String fileToName ( File policyFile ) throws PolicyIndexException { try { if ( ! policyFile . getName ( ) . endsWith ( ".xml" ) ) throw new PolicyIndexException ( "Invalid policy file name.  Policy files must end in .xml - " + policyFile . getName ( ) ) ; return PID . fromFilename ( policyFile . getName ( ) . substring ( 0 , policyFile . getName ( ) . lastIndexOf ( ".xml" ) ) ) . toString ( ) ; } catch ( MalformedPIDException e ) { throw new PolicyIndexException ( "Invalid policy file name.  Filename cannot be converted to a valid PID - " + policyFile . getName ( ) ) ; } }
Determine name of policy from file.  .xml prefix is removed, and name is converted to a PID.
Policy names must be valid PIDs.
@param policyFile
@return
@throws PolicyIndexException