Also forgot to mention, the type of a specific data source can be found with: carbonDataSource.getDSMInfo().getDefinition().getType(), where for now the default shipped implementation has only ones with the type: RDBMSDataSourceConstants.RDBMS_DATASOURCE_TYPE.
Cheers, Anjana. On Thu, May 24, 2012 at 12:50 PM, Anjana Fernando <[email protected]> wrote: > Hi Tharindu, > > On Thu, May 24, 2012 at 11:56 AM, Tharindu Mathew <[email protected]>wrote: > >> Hi, >> >> After getting a specific carbon data source I only saw this method. >> >> carbonDataSource.getDSMInfo().getDefinition().getDsXMLConfiguration() >> >> Do I have to parse this XML to get the DB connection info? >> > > A small background on the design of the component. Basically the data > source component was written to be neutral of the data sources being > registered/accessed. So the CarbonDataSource class is a generic > implementation of a data source and doesn't have any specific > configuration. The system is run using a concept known as a data source > providers, where when we give it a data source specific XML chunk, it > returns the actual data source object. So only the provider knows how to > read the XML configuration, and the CarbonDataSource object itself is not > aware of data source specific configuration, it only has the actual data > source object and the low level XML config. So the normal case is, you > define the data source from the UI, which will generate the XML config and > save it, and the core component reads it and just creates the data source > object to be looked up from JNDI or accessed from the OSGi service. > > Anyways, if you have a specific requirement to look at the actual > registered RDBMS data source object's properties. One way is to create an > actual Connection from the data source and get the props like connection > URL etc.. or if you need the original much finer details used to create the > DataSource like connection pooling params and all, I've opened up a method > in the RDBMS data source provider: RDBMSDataSourceReader#loadConfig, to > parse the XML and return a RDBMSConfiguration object. > > Cheers, > Anjana. > > >> >> >> -- >> Regards, >> >> Tharindu >> >> blog: http://mackiemathew.com/ >> M: +94777759908 >> >> > > > -- > *Anjana Fernando* > Associate Technical Lead > WSO2 Inc. | http://wso2.com > lean . enterprise . middleware > -- *Anjana Fernando* Associate Technical Lead WSO2 Inc. | http://wso2.com lean . enterprise . middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
