I have a 3rd party library I can potentially define to tomee as a resource
created by a factory class. But the constructor for the resource factory
only takes a specific class. Something like this:
public class Config {
String opt1;
String opt2;
public setOpt1(String s) { opt1 = s; }
public setOpt2(String s) { opt2 = s; }
public String getOpt1() { return opt1; }
public String getOpt2() { return opt2; }
}
public class TheFactory() {
private Config conf;
public TheFactory(Config c) { this.conf = c }
public Object makeObject() { return .... }
}
I figure I'd define the Config in tomee.xml as
<Resource id="aconfig" class-name="Config">
opt1 blah
opt2 derp
</Resource>
The question is if there is a way to tell the resource definition for the
factory that the input to its constructor is the "aconfig" resource?
I thought it might be something like
<Resource id="afactory" class-name="TheFactory"
factory-name="makeObject" constructor="what to put
here?">
config iwdldap
</Resource>
Is this possible or might I have to make my own factory that would use
Properties instead?
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/How-to-pass-a-custom-resource-to-custom-resource-factory-tp4680444.html
Sent from the TomEE Users mailing list archive at Nabble.com.