makdimka077 / xades4j

Automatically exported from code.google.com/p/xades4j
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Allow a form of subclassing of built-in verifiers #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. The built-in verifiers are considered to be internal and therefore will 
remain private. It is nevertheless desirable to make this functionality 
available to custom verifiers.

The normal way of doing this is to @Inject the verifier type on the constructor 
of the custom verifier. This works unless the application has registered a 
custom verifier of that same type. The custom binding would override the 
built-in binding and the constructor would recieve an instance of custom 
verifier instead. The situation is likely to occur because that's how 
subclassing a verifier is done in Guice. The only way to reach the built-in 
verifier is to hard-code the internal class name. This is very much against 
Guice paradigm.

One solution proposed by the XAdES4J author is to use a named binding to 
specify a built-in verifier, like so:

class MyPolicyVerifier implements 
QualifyingPropertyVerifier?<SignaturePolicyData> {
   MyPolicyVerifier(@BuiltIn QualifyingPropertyVerifier?<SignaturePolicyData> buildInPolicyVerifier)   {
     // ...
   }
   // ...
}

This assumes there is a named binding available for this built-in verifier. 
Unfortunately, there is no way for the application to add this binging without 
hard-coding the internal class name. For this reason, the named bindings of 
built-in verifiers should be pre-registered in the XAdES4J library itself. (or 
another solution must be found for subclassing built-in verifiers).

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by clementp...@gmail.com on 25 Nov 2011 at 2:44

GoogleCodeExporter commented 9 years ago

Original comment by luis.fgoncalv on 27 Dec 2011 at 11:09

GoogleCodeExporter commented 9 years ago

Original comment by luis.fgoncalv on 20 Apr 2012 at 6:32

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/xades4j/source/detail?r=199

Original comment by luis.fgoncalv on 20 Apr 2012 at 9:23