Hi

If you add a Properties instance you should get it injected but you can
also just use context.xml I think.
Le 10 déc. 2015 01:07, "ereshgorantla" <[email protected]> a écrit :

> HI ,
> I am configuring datasources in tomee.xml using Resources.
> Initially I did like this ...
> <tomee>
> <Resource id="TestPoolDataSource" type="DataSource">
>                 DataSourceCreator   tomcat
>             DriverClassName  oracle.jdbc.OracleDriver
>             Url jdbc:oracle:thin:@$DB_URL$
>             UserName    $USER$
>             Password    $PWD$
>             JtaManaged  true
>             InitialSize $DB_INITIAL_CAPACITY$
>                 MaxActive   $DB_MAX_CAPACITY$
>             TestOnBorrow        true
>             TestOnReturn        false
>             ValidationQuery      select 1 from dual
>             ValidationQueryTimeout 30
>             RemoveAbandoned true
>             RemoveAbandonedTimeout 600
>             LogAbandoned true
>             SuspectTimeout 60
>             TimeBetweenEvictionRunsMillis       30000
>             MinEvictableIdleTimeMillis  30000
>             TestWhileIdle       true
>         </Resource>
> </tomee>
>
> Then there is a need to configure custom datasource  factory . So my
> tomee.xml chnaged to
>
> <tomee>
> <Resource id="TestPoolDataSource" type="DataSource"
> factory-name="getObjectInstance"
>             class-name="TomcatDataSourceFactory">
>
>         </Resource>
>
> </tomee>
>
> But factory-name getObjectInstance has arguments in it . How can we pass
> those values.
> public class TomcatDataSourceFactory extends BasicDataSourceFactory {
> public Object getObjectInstance(Object obj, Name name, Context nameCtx,
> Hashtable environment) throws Exception {
> <-------custom code ----->
> return super.getObjectInstance(obj,name,nameCtx,environment);
>
> }
> }
>
> Unlike if resource is congigured in context/server.xml . if factory class
> is
> specified , datasource is configured directly no need to specify . How can
> we achieve this functionality in tomee.xml.
> Either ways like passing arguments to Customdatasource factory/directly
> calling factory class .
> Please provide your comments.
> For complete files :
> tomee-inital.xml
> <http://tomee-openejb.979440.n4.nabble.com/file/n4677195/tomee-inital.xml>
> tomee-later.xml
> <http://tomee-openejb.979440.n4.nabble.com/file/n4677195/tomee-later.xml>
> TomcatDataSourceFactory.java
> <
> http://tomee-openejb.979440.n4.nabble.com/file/n4677195/TomcatDataSourceFactory.java
> >
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/custom-datasource-factory-in-tomee-xml-with-factory-name-having-arguements-tp4677195.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Reply via email to