Hi Lakshman,
You can use your own util method in your component to get this done by a
simple JNDI lookup. Method should be as follows.
private static DataSource lookupDataSource(String dataSourceName, final
Hashtable<Object,Object> jndiProperties) {
try {
if(jndiProperties == null || jndiProperties.isEmpty()){
return (DataSource) InitialContext.doLookup(dataSourceName);
}
final InitialContext context = new
InitialContext(jndiProperties);
return (DataSource) context.doLookup(dataSourceName);
} catch (Exception e) {
throw new RuntimeException("Error in looking up data source: "
+ e.getMessage(), e);
}
}
Thanks,
Bhathiya
On Wed, Sep 24, 2014 at 11:01 PM, Lakshman Udayakantha <[email protected]>
wrote:
> Hi All,
>
> As per the requirement of Tenant deletion workflow in API Manager, we have
> to read some tables from API manager DB and execute delete operation on
> them. For that we keep tenantDataDeleter.xml. In that we keep data
> source name and table names that should be deleted by using tenant_id. *For
> that we need to get DataSource object using data source name. *
> DatabaseUtil in user core has private methods to lookup DataSource object
> by datasource name.
> There is a public method in DatabaseUtil called
> getRealmDataSource(RealmConfiguration
> realmConfig) to get a DataSource object. But it is not clear how to
> create realm configuration to call this method. can some one point me in
> right direction in this matter?
>
> Thanks
>
> --
> Lakshman Udayakantha
> Software Engineer, WSO2
> Mobile: *0711241005*
>
> *[email protected] <[email protected]>*
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
--
*Bhathiya Jayasekara*
*Software Engineer,*
*WSO2 inc., http://wso2.com <http://wso2.com>*
*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj
<http://www.linkedin.com/in/bhathiyaj>*
*Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
*Blog: http://movingaheadblog.blogspot.com
<http://movingaheadblog.blogspot.com/>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev