tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From daveg-iwd <>
Subject How to pass a custom resource to custom resource factory?
Date Mon, 31 Oct 2016 19:16:13 GMT
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

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
      config iwdldap

Is this possible or might I have to make my own factory that would use
Properties instead?

View this message in context:
Sent from the TomEE Users mailing list archive at

View raw message