HERAS-AF Forum
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 20, 2012, 10:48:10 am

Login with username, password and session length
Search:     Advanced search
Welcome to the HERAS-AF Forum...
373 Posts in 89 Topics by 272 Members
Latest Member: Jasmine
* Home Help Search Login Register
+  HERAS-AF Forum
|-+  HERAS-AF XACML
| |-+  HERAS-AF XACML Core (Moderators: René Eggenschwiler, Florian Huonder)
| | |-+  Custom Function & Datatype
« previous next »
Pages: [1] Print
Author Topic: Custom Function & Datatype  (Read 119 times)
mascanc
Newbie
*
Posts: 11


View Profile
« on: February 02, 2012, 03:36:53 pm »

Hello,

I have the following policy:

Code:
<os:Target>
        <os:Resources>
            <os:Resource>
                <os:ResourceMatch MatchId = "http://www.hhs.gov/healthit/nhin/function#instance-identifier-equal">
                    <os:AttributeValue DataType = "urn:hl7-org:v3#II">
                        <v3:PatientId root = "2.16.840.1.113883.4.391.1.5258" extension = "57425"/>
                    </os:AttributeValue>
                    <os:ResourceAttributeDesignator AttributeId = "http://www.hhs.gov/healthit/nhin#subject-id" DataType = "urn:hl7-org:v3#II"/>
                </os:ResourceMatch>
            </os:Resource>
        </os:Resources>
    </os:Target>

As you can see, there is an custom matchId (Instance-identifier-equal). I created my matchid as follows:

Code:

public class NHIN_InstanceIdentifierEqual extends AbstractFunction implements Function
{
    /**
     *
     */
    private static final long serialVersionUID = 2881960288838865975L;
    /** XACML function ID. */
    public static final String ID = "http://www.hhs.gov/healthit/nhin/function#instance-identifier-equal";

    public String getFunctionId() {

return ID;
    }

    public Object handle(Object... arg0) throws FunctionProcessingException {
System.out.println("LEN IS: " + arg0.length);

return 1;
    }
    
    

}

and my initializer as:

Code:


public class NHINFunctionInitializer extends FunctionsJAXBInitializer implements Initializer {
    
    @Override
    protected void furtherInitializations(Map<String, Function> instancesMap) {

// Load your custom function here
NHIN_InstanceIdentifierEqual myFunction = new NHIN_InstanceIdentifierEqual();
instancesMap.put(myFunction.getFunctionId(), myFunction);
    }

}

I start my PDP as

Code:
Initializer myInitializer = new NHINFunctionInitializer();
Set<Initializer> initializers = SimplePDPFactory.getDefaultInitializers();
initializers.add(myInitializer);
SimplePDPFactory.setInitalizers(initializers);


/**
* Creates a simple PDP that runs all default initializers and additionally the custom initializer "MyCustomInitializer".
*/
simplePDP = SimplePDPFactory.getSimplePDP();

Now the question: how to define my datatype?

Code:

15:28:08.618 [main] ERROR o.h.x.c.u.DefaultValidationEventHandler - JAXB validation event handled:
com.sun.xml.bind.api.AccessorException: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:83) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:241) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:202) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:73) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:449) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:240) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:297) [jaxb-impl.jar:2.1.4]
at org.herasaf.xacml.core.policy.PolicyMarshaller.unmarshal(PolicyMarshaller.java:819) [herasaf-xacml-core-1.0.0-M2.jar:na]
at com.spirit.xacml.pep.EnforcePolicyHerasaf.setPolicy(EnforcePolicyHerasaf.java:60) [bin/:na]
at com.spirit.test.enforce.Scrapbook.testDecisionPermit(Scrapbook.java:57) [bin/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_29]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_29]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit.jar:na]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
Caused by: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:86) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:40) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:81) ~[jaxb-impl.jar:2.1.4]
... 46 common frames omitted

Logged
René Eggenschwiler
Administrator
Jr. Member
*****
Posts: 63



View Profile
« Reply #1 on: February 02, 2012, 03:59:50 pm »

Hi,

You implemented your match-function successfully and initialized te PDP correctly (at least I think so after a first look).

But your Policy also uses a Custom Datatype ("urn:hl7-org:v3#II"). You also have to implement that one and initialize in the PDP.

At the moment we are not sure what will happen with the AttributeValue that contains a v3:PatientID.
We expect that JAXB will unmarshall that PatientId to a DOM Node and set it into the AttributeValue object.

Then your match-function code must use the DOM Node for evaluation (extract necessary infos and use them for evaluation).

I hope my answer helps you.

Best regards
René
« Last Edit: February 02, 2012, 04:02:01 pm by Florian Huonder » Logged
mascanc
Newbie
*
Posts: 11


View Profile
« Reply #2 on: February 02, 2012, 04:57:48 pm »

Thanks!

But how to implement a custom datatype? Do you have a test instance?
Logged
Florian Huonder
Administrator
Full Member
*****
Posts: 129



View Profile WWW
« Reply #3 on: February 02, 2012, 05:22:11 pm »

Hi,
A custom data type is a custom DataTypeAttribute.
You can implement the DataTypeAttribute interface and add your type to the data type attributes the PDP knows the same way as with the custom functions (means with a custom DataTypeAttributesInitializer).

Best regards,
Florian
Logged
mascanc
Newbie
*
Posts: 11


View Profile
« Reply #4 on: February 02, 2012, 08:14:13 pm »

I implemented the datatype as

Code:

public class NHIN_DataType implements DataTypeAttribute<Node>
{
    /**
     *
     */
    private static final long serialVersionUID = 1815837537446179657L;
    String dataType = "urn:hl7-org:v3#II";
    public String getDatatypeURI() {

return dataType;
    }

    public Node convertTo(String jaxbRepresentation) throws SyntaxException {
System.out.println("Here we are: " + jaxbRepresentation);
return null;
    }

}

The DataType initializer as:
Code:


public class NHINDataTypeInitializer extends DataTypesJAXBInitializer implements Initializer
{
    protected void furtherInitializations(Map<String, DataTypeAttribute<?>> instancesMap) {

// Load your custom function here
NHIN_DataType type = new NHIN_DataType();
instancesMap.put(type.getDatatypeURI(), type);

    }
}


and I instantiate the PDP as:
Code:
Initializer myInitializer = new NHINFunctionInitializer();
Initializer myDataTypeInit = new NHINDataTypeInitializer();
Set<Initializer> initializers = SimplePDPFactory.getDefaultInitializers();
initializers.add(myInitializer);
initializers.add(myDataTypeInit);
SimplePDPFactory.setInitalizers(initializers);

/**
* Creates a simple PDP that runs all default initializers and additionally the custom initializer "MyCustomInitializer".
*/
//         simplePDP = SimplePDPFactory.getSimplePDP();
// Set<Initializer> initializers = new HashSet<Initializer>();
// initializers.add(new NHINFunctionInitializer());
// SimplePDPFactory.setInitalizers(initializers);
simplePDP = SimplePDPFactory.getSimplePDP();

However I have the following exception:

Code:

20:12:28.238 [main] INFO  o.h.x.c.simplePDP.SimplePDPFactory - Custom initializers are in use.
20:12:28.253 [main] WARN  o.h.x.c.s.MapBasedSimplePolicyRepository - This policy repository (org.herasaf.xacml.core.simplePDP.MapBasedSimplePolicyRepository) must not be used in a productive environment.
20:12:28.556 [main] INFO  o.h.x.c.s.i.FunctionsJAXBInitializer - 209 functions are initialized.
20:12:28.590 [main] INFO  o.h.x.c.s.i.FunctionsJAXBInitializer - 209 functions are initialized.
20:12:28.638 [main] INFO  o.h.x.c.s.i.DataTypesJAXBInitializer - 16 DataTypeAttributes are initialized.
20:12:28.646 [main] INFO  o.h.x.c.s.i.PolicyCombiningAlgorithmsJAXBInitializer - 6 policy combining algorithms are initialized.
20:12:28.654 [main] INFO  o.h.x.c.s.i.RuleCombiningAlgorithmsJAXBInitializer - 5 rule combining algorithms are initialized.
20:12:29.185 [main] INFO  o.h.x.c.s.i.DataTypesJAXBInitializer - 16 DataTypeAttributes are initialized.
20:12:29.186 [main] WARN  o.h.xacml.core.simplePDP.SimplePDP - No PIP is set. Attributes that are not present in the request cannot be resolved.
20:12:29.186 [main] WARN  o.h.xacml.core.simplePDP.SimplePDP - This PDP runs with a Java version > 1.5.0. This may lead to an unspecific behavior when using the data type http://www.w3.org/2001/XMLSchema#time.
20:12:29.186 [main] INFO  o.h.xacml.core.simplePDP.SimplePDP - Using custom status code comparator.
20:12:29.211 [main] ERROR o.h.x.c.u.DefaultValidationEventHandler - JAXB validation event handled:
com.sun.xml.bind.api.AccessorException: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:83) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:241) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:202) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:73) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:449) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:240) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:297) [jaxb-impl.jar:2.1.4]
at org.herasaf.xacml.core.policy.PolicyMarshaller.unmarshal(PolicyMarshaller.java:819) [herasaf-xacml-core-1.0.0-M2.jar:na]
at com.spirit.xacml.pep.EnforcePolicyHerasaf.setPolicy(EnforcePolicyHerasaf.java:63) [bin/:na]
at com.spirit.test.enforce.Scrapbook.testDecisionPermit(Scrapbook.java:57) [bin/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_29]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_29]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit.jar:na]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
Caused by: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:86) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:40) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:81) ~[jaxb-impl.jar:2.1.4]
... 46 common frames omitted
20:12:29.213 [main] ERROR o.h.x.core.policy.PolicyMarshaller - Unable to unmarshal the node.
javax.xml.bind.UnmarshalException: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:244) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleGenericException(Loader.java:234) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:233) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:73) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:449) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:240) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:297) ~[jaxb-impl.jar:2.1.4]
at org.herasaf.xacml.core.policy.PolicyMarshaller.unmarshal(PolicyMarshaller.java:819) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at com.spirit.xacml.pep.EnforcePolicyHerasaf.setPolicy(EnforcePolicyHerasaf.java:63) [bin/:na]
at com.spirit.test.enforce.Scrapbook.testDecisionPermit(Scrapbook.java:57) [bin/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_29]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_29]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit.jar:na]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
Caused by: com.sun.xml.bind.api.AccessorException: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:83) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:241) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:202) ~[jaxb-impl.jar:2.1.4]
... 44 common frames omitted
Caused by: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:86) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:40) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:81) ~[jaxb-impl.jar:2.1.4]
... 46 common frames omitted
com.spirit.xacml.pep.EnforcePolicyException: org.herasaf.xacml.core.SyntaxException: Unable to unmarshal the node.
at com.spirit.xacml.pep.EnforcePolicyHerasaf.setPolicy(EnforcePolicyHerasaf.java:65)
at com.spirit.test.enforce.Scrapbook.testDecisionPermit(Scrapbook.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.herasaf.xacml.core.SyntaxException: Unable to unmarshal the node.
at org.herasaf.xacml.core.policy.PolicyMarshaller.unmarshal(PolicyMarshaller.java:822)
at com.spirit.xacml.pep.EnforcePolicyHerasaf.setPolicy(EnforcePolicyHerasaf.java:63)
... 23 more
Logged
mascanc
Newbie
*
Posts: 11


View Profile
« Reply #5 on: February 03, 2012, 09:53:26 am »

Sorry, forgot to override. Now the new class is:
Code:
@Override
    protected void furtherInitializations(Map<String, DataTypeAttribute<?>> instancesMap) {

// Load your custom function here
System.out.println("NHIN DataType initialized");
NHIN_DataType type = new NHIN_DataType();
System.out.println("Type is: " + type.getDatatypeURI());
instancesMap.put(type.getDatatypeURI(), type);

    }

and in fact, it is called, as you see from the log:

Code:
LogFactory:created new AuditLogger for SpiritDcmServices
09:53:06.034 [main] INFO  o.h.x.c.simplePDP.SimplePDPFactory - Custom initializers are in use.
09:53:06.057 [main] WARN  o.h.x.c.s.MapBasedSimplePolicyRepository - This policy repository (org.herasaf.xacml.core.simplePDP.MapBasedSimplePolicyRepository) must not be used in a productive environment.
09:53:06.297 [main] INFO  o.h.x.c.s.i.FunctionsJAXBInitializer - 209 functions are initialized.
09:53:06.308 [main] INFO  o.h.x.c.s.i.FunctionsJAXBInitializer - 209 functions are initialized.
09:53:06.321 [main] INFO  o.h.x.c.s.i.DataTypesJAXBInitializer - 16 DataTypeAttributes are initialized.
NHIN DataType initialized
Type is: urn:hl7-org:v3#II
09:53:06.329 [main] INFO  o.h.x.c.s.i.PolicyCombiningAlgorithmsJAXBInitializer - 6 policy combining algorithms are initialized.
09:53:06.337 [main] INFO  o.h.x.c.s.i.RuleCombiningAlgorithmsJAXBInitializer - 5 rule combining algorithms are initialized.
09:53:06.867 [main] INFO  o.h.x.c.s.i.DataTypesJAXBInitializer - 16 DataTypeAttributes are initialized.
09:53:06.868 [main] WARN  o.h.xacml.core.simplePDP.SimplePDP - No PIP is set. Attributes that are not present in the request cannot be resolved.
09:53:06.868 [main] WARN  o.h.xacml.core.simplePDP.SimplePDP - This PDP runs with a Java version > 1.5.0. This may lead to an unspecific behavior when using the data type http://www.w3.org/2001/XMLSchema#time.
09:53:06.868 [main] INFO  o.h.xacml.core.simplePDP.SimplePDP - Using custom status code comparator.

However, the type seems still to not be registered:

Code:
09:53:06.896 [main] ERROR o.h.x.c.u.DefaultValidationEventHandler - JAXB validation event handled:
com.sun.xml.bind.api.AccessorException: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:83) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:241) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:202) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:73) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:449) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:240) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314) [jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:297) [jaxb-impl.jar:2.1.4]
at org.herasaf.xacml.core.policy.PolicyMarshaller.unmarshal(PolicyMarshaller.java:819) [herasaf-xacml-core-1.0.0-M2.jar:na]
at com.spirit.xacml.pep.EnforcePolicyHerasaf.setPolicy(EnforcePolicyHerasaf.java:66) [bin/:na]
at com.spirit.test.enforce.Scrapbook.testDecisionPermit(Scrapbook.java:57) [bin/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_29]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_29]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit.jar:na]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
Caused by: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:86) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:40) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:81) ~[jaxb-impl.jar:2.1.4]
... 46 common frames omitted
09:53:06.899 [main] ERROR o.h.x.core.policy.PolicyMarshaller - Unable to unmarshal the node.
javax.xml.bind.UnmarshalException: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:244) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleGenericException(Loader.java:234) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:233) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiTypeLoader.startElement(XsiTypeLoader.java:73) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:449) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:240) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:277) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:246) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:297) ~[jaxb-impl.jar:2.1.4]
at org.herasaf.xacml.core.policy.PolicyMarshaller.unmarshal(PolicyMarshaller.java:819) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at com.spirit.xacml.pep.EnforcePolicyHerasaf.setPolicy(EnforcePolicyHerasaf.java:66) [bin/:na]
at com.spirit.test.enforce.Scrapbook.testDecisionPermit(Scrapbook.java:57) [bin/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_29]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_29]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit.jar:na]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) [junit.jar:na]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) [junit.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) [junit.jar:na]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) [junit.jar:na]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) [junit.jar:na]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) [junit.jar:na]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) [junit.jar:na]
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) [junit.jar:na]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
Caused by: com.sun.xml.bind.api.AccessorException: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:83) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:241) ~[jaxb-impl.jar:2.1.4]
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:202) ~[jaxb-impl.jar:2.1.4]
... 44 common frames omitted
Caused by: java.lang.IllegalArgumentException: DataTypeAttribute urn:hl7-org:v3#II unknown.
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:86) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at org.herasaf.xacml.core.converter.URNToDataTypeConverter.unmarshal(URNToDataTypeConverter.java:40) ~[herasaf-xacml-core-1.0.0-M2.jar:na]
at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.set(AdaptedAccessor.java:81) ~[jaxb-impl.jar:2.1.4]
... 46 common frames omitted

What am I doing wrong?
Logged
Florian Huonder
Administrator
Full Member
*****
Posts: 129



View Profile WWW
« Reply #6 on: February 03, 2012, 12:09:33 pm »

Hi,

You hit the issue http://dev.herasaf.org/browse/XACMLCORE-57 .
The problem is that with
Code:
Initializer myDataTypeInit = new NHINDataTypeInitializer();
Set<Initializer> initializers = SimplePDPFactory.getDefaultInitializers();
initializers.add(myInitializer);
initializers.add(myDataTypeInit);
simplePDPFactory.setInitalizers(initializers);

you take all standard initializers provided with heras-af and add your two initializers.
When starting up the PDP all initializers are run and the standard data type attribute initializer runs after yours and overrides all what your initializer did (in the function case it is vice versa).
The solution is to add only the initializers that shall run with:
Code:
Initializer myFunctionInitializer = new NHINFunctionInitializer();
Initializer myDataTypeInit = new NHINDataTypeInitializer();
Initializer policyCombiningAlgorithmsInitializer = new PolicyCombiningAlgorithmsJAXBInitializer();
Initializer ruleCombiningAlgorithmsInitializer = new RuleCombiningAlgorithmsJAXBInitializer();
Initializer jaxbInitializer = new JAXBInitializer();

Set<Initializer> initializers = new HashSet<Initializer>();
initializers.add(myFunctionInitializer);
initializers.add(myDataTypeInit);
initializers.add(policyCombiningAlgorithmsInitializer);
initializers.add(ruleCombiningAlgorithmsInitializer);
initializers.add(jaxbInitializer);

SimplePDPFactory.setInitalizers(initializers);

Best regards,
Florian
Logged
mascanc
Newbie
*
Posts: 11


View Profile
« Reply #7 on: February 03, 2012, 01:28:37 pm »

Ok, one step forward: now the policy is deployed in the policy repository. But now the handle of my function:

Code:

public class NHIN_InstanceIdentifierEqual extends AbstractFunction implements Function
{
    /**
     *
     */
    private static final long serialVersionUID = 2881960288838865975L;
    /** XACML function ID. */
    public static final String ID = "http://www.hhs.gov/healthit/nhin/function#instance-identifier-equal";

    public String getFunctionId() {

return ID;
    }

    public Object handle(Object... arg0) throws FunctionProcessingException {
System.out.println("LEN IS: " + arg0.length);

return 1;
    }
   
   

}

is never called Sad

In TargetMatchImpl, I have:

Code:
List<?> requestAttributeValues = (List<?>) designator.handle(request, evaluationContext); // Fetches

and it is called

Code:
@Override
public Object handle(RequestType request, EvaluationContext evaluationContext) throws ExpressionProcessingException,
MissingAttributeException, SyntaxException {
List<Object> returnValues = new ArrayList<Object>();
from ResourceAttributeDesignator and in the for loop
Code:
for (ResourceType res : resources) {
for (AttributeType attr : res.getAttributes()) {
if (getAttributeId().equals(attr.getAttributeId())
&& getDataType().toString().equals(attr.getDataType().toString())) {
if (getIssuer() != null) {
if (getIssuer().equals(attr.getIssuer())) {
addAndConvertAttrValue(returnValues, attr.getAttributeValues());
}
} else {
addAndConvertAttrValue(returnValues, attr.getAttributeValues());
}
}
}
}
it is called
Code:

addAndConvertAttrValue(returnValues, attr.getAttributeValues());

which fails, The content of the AttributeValueType can't be greater than 1, as a ExpressionProcessingException resulting in this log:

Code:
13:24:07.642 [main] DEBUG o.h.x.c.c.p.i.PolicyOnlyOneApplicableAlgorithm - Starting evaluation of: 2011-10-19-08-53-01-0000507
13:24:07.651 [main] DEBUG o.h.x.c.c.AbstractCombiningAlgorithm - Starting target match.
13:24:07.651 [main] DEBUG o.h.x.c.t.impl.TargetMatcherImpl - Starting subjects match.
13:24:07.651 [main] DEBUG o.h.x.c.t.impl.TargetMatcherImpl - No subjects present.
13:24:07.652 [main] DEBUG o.h.x.c.t.impl.TargetMatcherImpl - Subjects match resulted in: true
13:24:07.652 [main] DEBUG o.h.x.c.t.impl.TargetMatcherImpl - Starting recources match.
13:24:07.652 [main] DEBUG o.h.x.c.t.impl.TargetMatcherImpl - Starting resource match. (id:org.herasaf.xacml.core.policy.impl.ResourceType@6a0239f6)
13:24:58.742 [main] DEBUG o.h.x.c.t.impl.TargetMatcherImpl - Matching with function: http://www.hhs.gov/healthit/nhin/function#instance-identifier-equal
13:28:33.055 [main] DEBUG o.h.x.c.c.AbstractCombiningAlgorithm - Processing error occurred.
13:28:35.876 [main] DEBUG o.h.x.c.c.AbstractCombiningAlgorithm - Target match resulted in: INDETERMINATE
Logged
Florian Huonder
Administrator
Full Member
*****
Posts: 129



View Profile WWW
« Reply #8 on: February 03, 2012, 05:32:39 pm »

Hi,

I must apologize. But I missed the fact that we can only handle single attribute values of type String so far. This means no complex types.
The issue for that is http://dev.herasaf.org/browse/XACMLCORE-30.

The place where we convert the content of the JAXB-Element into a corresponding datatype is in the AttributeDesignatorType.addAndConvertAttrValue method.
There we take the single element of type String
Code:
...
dataType.convertTo((String) attrVal.getContent().get(0)
...
from the request attribute and convert it into a data type that can then be used be the matching-function.

There are two possibilities how you can face this issue:
  • Extend our implementation (means fix issue XACMLCORE-30)
  • Transform your custom datatype (<v3: ... /> into a String-representation. Then it can be handled by the AttributeDesignator. Within the NHIN_DataType.convertTo(...) method you can analyze the String an create an appropriate internal data structure to work with.

Best regards,
Florian
Logged
mascanc
Newbie
*
Posts: 11


View Profile
« Reply #9 on: February 06, 2012, 03:47:55 pm »

Thanks for your answer! I will prefer to wait for your fix, rather than to maintain a separate fork. Unfortunately I can't modify the policy... Sad
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!