Reading database connection configuration from a registry properties file in WSO2 EI - wso2

We are doing a POC in WSO2 EI and developing an API for service orchestration. As part of it, I want to insert some data into a database. In Integration Studio 8.0.0, I am using the DB report mediator to insert data. Everything works fine when I hardcode the values as shown in the below screenshot.
Now, I want to read the database configurations from a properties file I created in registry config folder instead of hardcoding them. How can we achieve this?
Below is the screenshot of the registry properties file.

AFAIK you can't read properties files from the registry as key/value pairs and use them in integrations without processing the content of the properties file with something like the ScriptMediator. But you can pass a properties file to the runtime and pick the values from there. Please have a look at this document.

We can inject DB connection parameters from a properties file stored in EI/MI product home folders but still need to find how we can inject parameters from registry.

Related

WSO2: Configuring xml multiple in a single project

I am using WSO2 ESB 6.5.0.
In the WSO2HOME/conf/synapse.properties I set property
synapse.commons.json.output.xmloutMultiplePI=true
for set the XML output to an xml-multiple processing instruction in XML to JSON transformations. (As this says )
This works fine, but In my WSO2 EI I have many Carbon Applications (CARs) and I need to apply this configuration only for a specific car, not to all because I have projects that stop working properly.
I know that all the properties set in synapse.properties will apply globally.
Is there a way to configure xml-multiple in a single project/sequence?

wso2esb: can I use my own way to build a page that can add new proxy services?

wso2esb is based on a datasource, at first I thought that the data stored by the datasource contains the proxy service what is added by the wso2esb console, but I didn't find
corresponding data in that database, that is a big trouble for me.
Some users told me that the ui of wso2esb console is too complex and professional, so I want to build new pages that can let them add new proxy services and the methods are based on the original methods of wso2esb;
Is there original codes of method that can help me with this?
I read the source code of wso2esb, but I didn't know how it handle the data from the webpage and how the data user input saved.
As I know, wso2esb deploys service automatically, if you put file in right directory. I advice to create artifact with UI, name it and then search in wso2esb home directory.
For example, directory for services: $CARBON_HOME/repository/deployment/server/synapse-configs/default/proxy-services
Although, I think that creating of UI with similar functionality is very strange idea and could be very hard.

WSO2 Identity Server 3.2.3. Missing Ability to Add External User Stores

What happened to the ability to add an external user store with custom tables in WSO2 Identity Server 3.2.3?
We are evaluating use of this IS and it appears an older version had this capability and the latest version does not.
Am I missing a configuration setting or has this capability been completely removed? Or is this a build configuration option?
Not having this feature is a show-stopper.
it's done through the config files - there is (seemingly) no ui component. I was able to connect to an external sql server user store via jdbc by manipulating the user-mgt.xml and master-datasource.xml files. Although next step would be to define a logical schema definition to map the id fields. e.g. running the mssql.sql script in /dbscripts on my sql server db will create the needed structure.

WSO2 ESB - Data Services Server Feature - How to use Data Sources to swap data source on fly

I am using WSO2 ESB 4.0.3. I have installed WSO2 Data Services Feature on it and I have created DS.
There is feature in the ESB under "Configure" tab under admin UI where you can define the "Data Source".
My question is while creating new Data Service I am not able to use this "Data Source" which I have configured in ESB. We have different environments DEV / TEST / UAT / PROD. Each environment has different data base for same data service.
Currently I have manually change the DS XML file to point to new DB and then deploy.
Is there a way to point to the DB configured in ESB and change the DB for DS on the fly?
thanks
ABhijit
07/01/2012 -
Any update on this please ? This is Apple POC in their big group. If suceedded WSO2 will have Apple implementation?
If you've installed the dataservices features in to the same ESB instance that you've already been using, then it should be possible for you to use the datasources created via "Configure > Data Sources" menu. Because, when you create a particular datasource via the aforesaid option, it is visible to all the other installed features (that use datasources). But if you're having ESB and DSS in two boxes, the datasources defined in let's say ESB are not visible the DSS node unless you're having those nodes mounted to the same registry. However, this functionality too will be there in the next immediate upcoming release.
However, I'd suggest you the following pattern to get your requirement done. I;m assuming you're having DataServices features installed into ESBs in all your environments DEV / TEST / UAT / PROD. If so, you can create datasources using the "same name" (for eg: assume you have a datasource named "ds1" created in all 4 environments) via the "Configure > DataSources" menu pointing to different database configurations that you'll be using in each of those environments. Then you can point to the created datasource inside the DBS (dataservice discripters) as shown below.
<data name="TestDataService">
<config id="default">
<property name="carbon_datasource_name">ds1</property>
</config>
.....
</data>
Once you're done with those steps, whenever you deploy your dataservice in any of your environments, it will point to the relevant datasource without requiring you to reconfigure the database configurations manually and the relevant database configurations specific to each environment will be loaded dynamically at the runtime.
Hope the above explanation helps!
Regards,
Prabath
#----- Start of the configuration -----
synapse.datasources=TestDS,TestDS1
synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
synapse.datasources.providerPort=2199
#TestDS Configuration
synapse.datasources.TestDS.registry=JNDI
synapse.datasources.TestDS.type=BasicDataSource
synapse.datasources.TestDS.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.TestDS.url=jdbc:mysql://localhost:3306/testDB
synapse.datasources.TestDS.username=dummy_username
synapse.datasources.TestDS.password=dummy_password
synapse.datasources.TestDS.dsName=TestDS
synapse.datasources.TestDS.maxActive=100
synapse.datasources.TestDS.maxIdle=20
synapse.datasources.TestDS.maxWait=10000
#TestDS1 configuration
synapse.datasources.TestDS1.registry=JNDI
synapse.datasources.TestDS1.type=BasicDataSource
synapse.datasources.TestDS1.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.TestDS1.url=jdbc:mysql://localhost:3306/testDB1
synapse.datasources.TestDS1.username=dummy_username
synapse.datasources.TestDS1.password=dummy_password
synapse.datasources.TestDS1.dsName=TestDS1
synapse.datasources.TestDS1.maxActive=100
synapse.datasources.TestDS1.maxIdle=20
synapse.datasources.TestDS1.maxWait=10000
#----- End of the configuration -----

Where to put a configuration file for an Axis2 web service?

I'd like to have my Axis2 Web Service read from a configuration file, whose name is sent as a parameter to the service.
Where is the best place to put this file? And How to best access it? Examples welcome.
I've checked the current directory is the Apache/Tomcat/bin file, I could put it in the parent directory, or put it into a Apache/Tomcat/conf, although this looks like it's more reserved for apache configuration itself.
You don't want to load a configuration file on each request, which means configuration needs to be loaded ideally on startup.
In my experience that leaves you with two choices:
Embedded Spring container
JNDI
The former approach is described in the Axis2 documentation, the latter approach depends on the appserver/container you're using.
An example if JNDI configuration for jetty is here: