I set JVM environment variable in domain.xml:
<jvm-options>-Dmydir=c:/mydir</jvm-options>
I am making virtual drive for my application and I want to set the value of the alternatedocroot property to take jvm environment variable .
Any help please .
for example:
<property name="alternatedocroot_1" value="from=/images/* dir=${mydir}" />
Related
I want to use the .car file on another server without using integration studio. So I want to be able to change the hostname and port dynamically using a configuration file. My endpoint URL has variables in it {uri.var.x} that's why I can't use $FILE:x to get the complete URL from file.properties.
I have already tried How to read a property injected from file.properties in WSO2 - micro integrator? but it did not work.
You can simply read the Property from the file and assign it to the variable you desire. Then use it in your Endpoint configurations.
<property expression="get-property('file', 'x')" name="uri.var.x"/>
You can store the values in a properties file called file.properties in the MI_HOME/conf folder and it will be loaded automatically. If you are using a different fileName you can pass it to the server startup script like -Dproperties.file.path=/home/dev/dev.properties. Then you can read them through a Property Mediator.
Further, if you want to construct the full URL from multiple properties you can use Xpath functions.
<property expression="concat('https://', get-property('file', 'host'), ':', get-property('file', 'port'))" name="uri.var.x" scope="default" type="STRING" />
If the properties are not picked from the default file, pass the file path like below.
sh micro-integrator.sh -Dproperties.file.path=./conf/file.properties
Update on WSO2 EI
It seems file scope is not supported in EI. But instead, you can read variables from Environment variables with get-property('env', 'NAME_OF_VARIABLE')
<property expression="concat('https://', get-property('env', 'host'), ':', get-property('env', 'port'))" name="uri.var.x" scope="default" type="STRING"/>
If you want to read them from a properties file, you can do something like the below. Assuming you have a properties file like below.
stockQuoteEP=http://localhost:9000/services/SimpleStockQuoteService
ycr=test1234
host=localycr
port=6676
Add the following script to integrator.sh to export the properties as environment variables. You can improve the script as you require.
while read line; do
echo "Exporting $line"
export $line
done < /home/wso2/wso2ei-6.6.0/conf/file.properties
Then in your integration read them as below.
<property expression="concat('https://', get-property('env', 'host'), ':', get-property('env', 'port'))" name="uri.var.x" scope="default" type="STRING"/>
Update 2 on File Scope in Property mediator
As Sanoj mentioned, file scope in the property mediator is only available from MI 4.0 onward vanilla packs. If you have a WSO2 subscription you can get it as an update for both MI and EI.
I'm currently implementing a wix(3.8) installer and the main MSI is merged with several other merge modules. I'm taking a user input during the installation and I store it in a global property called PORT like this.
In the MSI
<Property Id='PORT' Value="1">
I need to access this property value inside a condition in my merge module to edit a XML file if that condition is true. So I passed this property to the merge module as a configuration like this.
In MSI
<ConfigurationData Name="PROTOCOL" Value="[PORT]" />
In MSM
<Property Id="protocol"/>
<Configuration Name="PROTOCOL" Format="Text" DefaultValue="[protocol]"/>
<Substitution Table='CustomAction' Row='SetProtocol' Column='Target' Value='[=PROTOCOL]'/>
<CustomAction Id='SetProtocol' Property='protocol' Value='[protocol]'/>
I used the value of the property "protocol" inside my condition as below but the condition never executes.
<Condition>protocol = 1</Condition>
I tried by appending the property id with the merge module's GUID as well like this and accessing that property "NEWPORT" inside the condition. but didn't success.
<Property Id='NEWPORT' Value='[protocol.8c2910c9-5694-4312-a4cc-c9b2c2a5caa5]'/>
What would be the reason for this ? Can someone please tell me the way to access the property value in MSI within Merge module's condition element.
Thanks in advance.
I'm trying to migrate J2EE, very heavy, old school application, from RAD 8.5.5.1 to IntelliJ 2016.1.1. DataSource building using JNDI.
I compiled and configured all components (right for now) except DataSource.
In RAD DataSource configured like this, in resource.xml:
<resources.jdbc:JDBCProvider xmi:id="JDBCProvider_1163951110780" name="DB2 DataSource" description="DB2 Universal JDBC Driver Provider" implementationClassName="com.ibm.db2.jcc.DB2ConnectionPoolDataSource">
<classpath>${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar</classpath>
<classpath>${UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cu.jar</classpath>
<classpath>${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cisuz.jar</classpath>
<nativepath>${DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH}</nativepath>
<factories xmi:type="resources.jdbc:DataSource" xmi:id="DataSource_1163951270521" name="pensionjndi" jndiName="pensionjndi" description="DB2 Universal Driver Datasource" category="" authDataAlias="sec" relationalResourceAdapter="builtin_rra" statementCacheSize="150" datasourceHelperClassname="com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper">
<propertySet xmi:id="J2EEResourcePropertySet_1163951270522">
<resourceProperties xmi:id="J2EEResourceProperty_1163951270523" name="databaseName" type="java.lang.String" value="value" description="This is a required property. This is an actual database name, and its not the locally catalogued database name. The Universal JDBC Driver does not rely on information catalogued in the DB2 database directory." required="true"/>
<resourceProperties xmi:id="J2EEResourceProperty_1163951270524" name="driverType" type="java.lang.Integer" value="4" description="The JDBC connectivity-type of a data source. If you want to use type 4 driver, set the value to 4. If you want to use type 2 driver, set the value to 2. On WAS z/OS, driverType 2 uses RRS and supports 2-phase commit processing." required="true"/>
<resourceProperties xmi:id="J2EEResourceProperty_1163951270525" name="serverName" type="java.lang.String" value="serverName" description="The TCP/IP address or host name for the DRDA server. If custom property driverType is set to 4, this property is required." required="false"/>
<resourceProperties xmi:id="J2EEResourceProperty_1163951270526" name="portNumber" type="java.lang.Integer" value="50000" description="The TCP/IP port number where the DRDA server resides. If custom property driverType is set to 4, this property is required." required="false"/>
...
...
...
<resourceProperties xmi:id="J2EEResourceProperty_1175088739299" name="webSphereDefaultIsolationLevel" type="java.lang.Integer" value="2" description="" required="false"/>
</propertySet>
<connectionPool xmi:id="ConnectionPool_1163951270521" connectionTimeout="15" maxConnections="200" minConnections="5" reapTime="180" unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool"/>
<mapping xmi:id="MappingModule_1163951296456" mappingConfigAlias="DefaultPrincipalMapping" authDataAlias="sec"/>
</factories>
I tried to define DataSource with same name (pensionjndi) using IntelliJ's DataSource and Driver window
DS IntelliJ Screen
No luck! Application doesn't recognize the DataSourse (but it looking for the RIGHT DS name "pensionjndi")
The question is: What is a right way to configure DataSource for IntelliJ Artifacts? (Using an existing DataSources)
If an additional information required, I'll edit the post..
I didn't found any example, or guide, for DataSource config for websphere.
Please HELP!?
The problem is solved by defining data source in Websphere Application Console. WAS console | Resorces | Data Sources
See the topic of IBM "Configuring a data source using the administrative console"
Here is discussion about the problem with IntelliJ support
One of my goals in creating the bootstrap project is to set a default log location. I would like the location to be based on the local app data folder. I cannot figure out how to reference the builtin Burn variable LocalAppDataFolder. I have found information about how to reference these variables in code, but not in the xml.
The reference to the property looks like this:
<MsiPackage SourceFile="MyInstaller.msi" LogPathVariable="[LogLocation]" />
The property is set like this:
<Variable Name="LogLocation" Value="[LocalAppDataFolder]MyLogFolder\Setup" Type="string"/>
The log output shows:
Initializing string variable 'LogLocation' to value
'[LocalAppDataFolder]MyLogFolder\Setup'
What am I missing to resolve [LocalAppDataFolder] ?
thanks in advance.
It's normal for the log output to show the un-formatted value, so that part looks correct. I think what you are missing is LogPathVariable should be specified without the brackets.
<MsiPackage SourceFile="MyInstaller.msi" LogPathVariable="LogLocation" />
Installer is writting SQL Server's name to registry during installing my service.
And I created a dialog window with edit control where user will type the servername . Now I want to fill this control with value from registry in ChangeMode. And if this registry key is empty to fill with some default name.
How is possible to resolve it?
I tried to put RegistrySearch node into Control node. But it seems to me it's not working..
Any help is appreciated
P.S. Looked some information here: link1. And tried code like:
<Property Id="SERVCONNSTR" Value=".\SQLEXPRESS">
</Property>
<Property Id="CONNSEARCH">
<RegistrySearch Id="servconstr" Root="HKLM"
Key="Software\$(var.Manufacturer)\SERVICE" Name="SQL Server" Type="raw"></RegistrySearch>
</Property>
<SetProperty Id="SERVCONNSTR" Value="CONNSEARCH"
After="AppSearch"><![CDATA[CONNSEARCH AND (!FEATURE1=3 OR !FEATURE2=3 OR !FEATURE3=3)]]></SetProperty>
But I'm still getting .\SQLEXPRESS in edit-control during modifying.
What i'm doing wrong?
Put RegistrySearch into a Property, and tie that property to the Control.
<Property Id="SERVCONNSTR" Value=".\SQLEXPRESS">
</Property>
<Property Id="CONNSEARCH">
<RegistrySearch Id="servconstr" Root="HKLM"
Key="Software\$(var.Manufacturer)\SERVICE" Name="SQL Server" Type="raw"></RegistrySearch>
</Property>
<SetProperty Id="SERVCONNSTR" Value="[CONNSEARCH]"
After="AppSearch">CONNSEARCH</SetProperty>
I don't know why you are using two properties, If you set your property CONNSEARCH with the registrySearch, it'll check the registry and assign it the value found there, if one is present. This happens in the AppSearch phase well before most UI's take place, where your edit box would be. So you shouldn't need to use SetProperty either.
Did you want to fill the registry key with a default value, or your property with a default value?
For the property just fill the Value attribute of the property element that is using a registry search. It'll default to that if nothing is found in registry, as I said above.
It would look like this;
<
<Property Id="CONNSEARCH" Value="DefaultValue">
<RegistrySearch Id="servconstr" Root="HKLM"
Key="Software\$(var.Manufacturer)\SERVICE" Name="SQL Server" Type="raw"></RegistrySearch>
</Property>
After Appsearch your property would be set, and if your control is tied to that property it'll be filled with that value. This will also set your default property value to "DefaultValue" If nothing is in the registry.
To create a default value for the key in the registry, I guess just put a registryKey/RegistryValue element in a component that will always be installed in this scenario, and set that key to your default value if you don't set it anywhere else.
Best