Search in sources :

Example 1 with X509FieldType

use of org.nhindirect.policy.x509.X509FieldType in project nhin-d by DirectProject.

the class SimpleTextV1LexiconPolicyParser method buildX509Field.

/**
	 * Builds a certificate reference expression that is an {@link X509Field}.
	 * @param token The token used to build the field.
	 * @return An {@link X509Field} object that represents the token.  Returns null if the token does not represent an {@link X509Field}.
	 * @throws PolicyParseException
	 */
protected PolicyExpression buildX509Field(String token) throws PolicyParseException {
    X509Field<?> retVal = null;
    final X509FieldType fieldType = X509FieldType.fromToken(token);
    if (fieldType != null) {
        try {
            Class<? extends X509Field<?>> fieldRefClass = fieldType.getReferenceClass();
            if (fieldRefClass == null)
                throw new PolicyParseException("X509Field with token name " + token + " has not been implemented yet.");
            retVal = fieldRefClass.newInstance();
        } catch (PolicyParseException ex) {
            throw ex;
        }///CLOVER:OFF
         catch (Exception e) {
            throw new PolicyParseException("Error building X509Field", e);
        }
    ///CLOVER:ON
    }
    return retVal;
}
Also used : X509FieldType(org.nhindirect.policy.x509.X509FieldType) PolicyParseException(org.nhindirect.policy.PolicyParseException) PolicyGrammarException(org.nhindirect.policy.PolicyGrammarException) IOException(java.io.IOException) PolicyParseException(org.nhindirect.policy.PolicyParseException)

Aggregations

IOException (java.io.IOException)1 PolicyGrammarException (org.nhindirect.policy.PolicyGrammarException)1 PolicyParseException (org.nhindirect.policy.PolicyParseException)1 X509FieldType (org.nhindirect.policy.x509.X509FieldType)1