Sterling OMS Overriding customer_overrides.properties
Sterling OMS Overriding customer_overrides.properties
In this post we are going to learn about basic concepts of Sterling OMS properties. As part of Sterling install folder you can see folder with name properties. This folder has lot of files related to properties. Few important files to discuss
S.No | Files under properties folder | Used Build or Run Time | Remarks |
1 | sandbox.cfg | Build Time | Contains key,value parameters which is Used to create properties file. Stores all the information given during Installation like DB URL, DB user name, Password Install location details Example : DB_PORT=1521 |
2 | servers.properties | Run Time | This is important file which holds all the location reference for properties file available. During server startup below value passed to locate server properties file. -DvendorFile=/servers.propertiesSample Data in file yfs=E:/OMS/properties/yfs.properties customer_overrides= E:/OMS/properties/customer_overrides.properties |
3 | yfs.properties | Run Time | This file contains default configuration related to below area. Do not modify any value in this file. You should use customer_overrides.properties file to override
|
4 | yfs.properties.in | Build Time | This is temp file used for creating yfs.properties file |
5 | APPDynamicclasspath.cfg | Run Time | Holds class path which used during APP server startup |
6 | APPDynamicclasspath.cfg.in | Build Time | This is temp file used for creating APPDynamicclasspath.cfg Using sandbox.cfg values |
7 | AGENTDynamicclasspath.cfg | Run Time | Holds class path which used during AGENT server startup |
8 | AGENTDynamicclasspath.cfg.in | Build Time | This is temp file used for creating AGENTDynamicclasspath.cfg using sandbox.cfg values |
9 | customer_overrides.properties | Run Time | Manually created by user under <Install Dir>/properties. Used for override any existing or adding new properties |
How to modify database related properties in sandbox.cfg?
- From <Install Directory>/properties folder take a copy of sandbox.cfg as sandbox.cfg.original
- Search for following values in sandbox.cfg
- NO_DBVERIFY=false
- REINIT_DB=true
- First make change in sandbox.cfg file
- NO_DBVERIFY=false (DDL scripts created automatically)
- REINIT_DB=false (Database update will not happen automatically; Have to run the DDL script manually)
- Go to <Install Directory>/bin in command prompt
- Run <Install Directory>/bin/setupfiles.cmd files
- All places will get referenced with new change
How to add new 3rdparty jar file into OMS ?
- Go to <Install Directory>/bin in command prompt
- Run <Install Directory>/bin/install3rdParty.cmd weblogic 12.3 -j C:\weblogic\12\wlfullclient.jar -targetJVM AGENT
- weblogic – vendorname
- 12.3 – version number
- C:\weblogic\12\wlfullclient.jar – path of the jar file (Can take multiple jars)
- -targetJVM AGENT – Defines which classpath files should be updated
What happens when install3rdParty cmd run ?
- Jar files get copied under location <OMS Install Dir>/jar/weblogic/12.3 (If folder not there gets created)
- <OMS Install Dir>\properties\AGENTDynamicclasspath.cfg.in files gets below entry
VENDOR_JAR=&INSTALL_DIR;\jar\weblogic\12\wlfullclient.jar
- <OMS Install Dir>\properties\AGENTDynamicclasspath.cfg files gets below entry
VENDOR_JAR=E:/OMS\jar\weblogic\12\wlfullclient.jar
How to override property in yfs.properties ?
yfs.properties file has property with name yfs.jms.session.disable.pooling
Lets see how this property been defined in yfs.properties file (property group, modifiable, possible values, default)
## PROPERTY_START ## PROPERTY_NAME: yfs.jms.session.disable.pooling ## DATABASE_SUPPORT: Y ## EXTENDED_PROPERTY: N ## MODIFIABLE: Y ## MODIFIABLE_AT_RUNTIME: N ## SERVER_OVERRIDE: Y ## USER_OVERRIDE: N ## PROPERTY_GROUP: JMS ## PROPERTY_TYPE: Boolean ## PROPERTY_PERMISSIBLE_VALUES: Y, N ## PROPERTY_DESCRIPTION ## Indicates whether to disable JMS Session pooling. ## Valid values: ## Y: (default) Disable JMS Session pooling. IBM recommends Y value to this property for better performance reasons. ## N: Enable JMS Session pooling. yfs.jms.session.disable.pooling=Y ## PROPERTY_END
if you like to override this property you need to make entry into customer_overrides.properties file in below format.
Format : prefix_name.property_name=property_value
Example : yfs.yfs.jms.session.disable.pooling=N
Here prefix_name (first yfs) is derived from <Install dir>\properties\servers.properties file (Inside this file search for yfs=)
How to override property using customer_overrides.properties ?
Make below entry into customer_overrides.properties
yfs.yfs.searchIndex.rootDirectory=E:/OMS/SearchIndex yfs.forum.name=ActiveKite shell.environment.name=Active Kite Test
Sample Java Code for reading value from properties file
package com.oms94.util; import org.w3c.dom.Document; import org.w3c.dom.Element; import com.sterlingcommerce.woodstock.util.frame.Manager; import com.yantra.yfs.core.YFSSystem; import com.yantra.yfs.japi.YFSEnvironment; public class PropertiesReaderDemo { public Document readProperties(YFSEnvironment env, Document doc) throws Exception { Element element = doc.getDocumentElement(); //Option : 1 //yfs.yfs.searchIndex.rootDirectory=E:/OMS/SearchIndex added part of customer_overrides.properties //Override using customer override so value should be printed from customer_overrides.properties //we did not use name yfs.yfs.searchIndex.rootDirectory //Just called using yfs.searchIndex.rootDirectory //Because YFSSystem class already knows we are looking for yfs override value //Result : E:/OMS/SearchIndex element.setAttribute("Option1", YFSSystem.getProperty("yfs.searchIndex.rootDirectory")); //Option : 2 //yfs.jms.session.disable.pooling value is not overridden using customer override //So default value should be printed from yfs.properties // Result : Y element.setAttribute("Option2", YFSSystem.getProperty("yfs.jms.session.disable.pooling")); //Option : 3 //Another way to load same as option 1 //Result : E:/OMS/SearchIndex element.setAttribute("Option3", Manager.getProperty("yfs", "yfs.searchIndex.rootDirectory")); //Option : 4 //Option to load custom property //yfs.forum.name=ActiveKite added into customer_overrides.properties //Result : ActiveKite element.setAttribute("Option4", Manager.getProperty("yfs", "forum.name")); //Option : 5 //environment.name=Active Kite Test added into customer_overrides.properties //Result : Active Kite Test // by default shell is passed as option to search element.setAttribute("Option5", Manager.getProperty("environment.name")); return doc; } }
Export Jar and Add part of OMS (One time activity)
How to write java program : Read this blog
- Export project and create SterlingCustom94.jar file under C:\deploy\SterlingCustom94.jar
- Run below command from OMS bin folder (One time Activity)
install3rdParty.cmd customjar 1 -j C:\deploy\SterlingCustom94.jar -targetJVM EVERY
- Jar file automatically copied into <Install Directory>\jar\customjar\1\SterlingCustom94.jar
- Below lines get added in 3 files (APPDynamicclasspath.cfg, AGENTDynamicclasspath.cfg, and dynamicclasspath.cfg files)
- VENDOR_JAR=<OMS Install Directoty>\jar\customjar\1\SterlingCustom94.jar
- Next time you can export the custom jar directly into <Install Directory>\jar\customjar\1 from Eclipse
- Perform Build and deploy
OMS Build & Deployment
- Go to bin folder
- Run command : deployer.cmd -t resourcejar
- Run command : buildear.cmd -Dappserver=weblogic -Dwarfiles=smcfs -Dearfile=smcfs.ear -Dnowebservice=true -Ddevmode=true -Dnodocear=true -Dwls-10=true create-ear
- Ear file gets created under <Install Directory>\external_deployments\smcfs.ear
- Create new folder deploy and C:\
- Run command : del C:\deploy\smcfs.ear (Clean up any existing file)
- Run command : copy <Install Directory>\external_deployments\smcfs.ear C:\deploy\smcfs.ear
- Deploy manually using weblogic console from folder C:\deploy\smcfs.ear
Create New Service in OMS
- Go to Application Manager — General — Service
- Create new service with name “ReadProperties” and service group name as “Custom”
- Select Option as “In a Synchronous Mode”
- Add API from components tab and connect the start and end
- Select Extended API radio button
- API Name : ReadProperties
- Class Name : com.oms94.util.PropertiesReaderDemo
- Medthod Name : readProperties
- Save
Test the program using API Tester
Input to API Tester : <Hello />
API Tester Result :
<Hello Option1=”E:/OMS/SearchIndex“ Option2=”Y“ Option3=”E:/OMS/SearchIndex“ Option4=”ActiveKite“ Option5=”Active Kite Test“/>
If you have any question or suggestion please email to : support@activekite.com
Questions from this topic
- OMS System allows to override only existing property values ? Answer : No. In this above example we had added new property yfs.forum.name
- Can we change the property value run time ? Answer : Yes if MODIFIABLE_AT_RUNTIME value is Y
- Does property can be managed using database ? Answer : Yes if DATABASE_SUPPORT value is Y
- How to enable database property management ? Answer : sandbox.cfg file DATABASE_PROPERTY_MANAGEMENT=true
- Which database table holds the property name and value ? Answer : PLT_PROPERTY
- How to add or modify entry into database table ? Answer : manageProperty API or manageProperties command line script
- If property name available in database and file system which one value gets selected ? Answer : file system has priority over database
Hope this helps !!! Cheers. Happy Learning
Test your knowledge using our quiz page : install3rdparty.cmd
Awesome work.
Admired the detail.
Thanks lot Mayank Gaur for your nice words !!! Helps us to keep motivated. Thanks once again
Awesome!!!! Crystal and clear info. Good Job.
Thanks lot for nice feedback. Helps us to keep motivated
Hi Where can I get completer onDemand video tutorials on Sterling OMS/WMS
Ramakrishna,
Currently we don’t have onDemand video tutorials. We will work in this and keep you posted. Thank you.
The Information provided is very clear & I really appreciate the effort made for this information. Thank you !
Thanks for your support.
Here are some more interesting points regarding the topic. Enjoy 🙂
1. How to identify or create the Custom Property In database?
Answer : We can pass PropertyType==”CUSTOM” in the manageProperty API Call
and in PLT_PROPERTY table you can identify the custom property via PROPERTY_TYPE=’CUSTOM’.
2. How can you load Properties into database and what is the benefit of it in real time scenarios or with On -Primise ?
–> By running the loadProperties.cmd or loadProperties.sh script from /foundation/bin.
–>This command line script loads all the default properties and factory values to the database. This tool reads tagged property files and converts them into XML format, which can be loaded to the database, conforming to the PLT_Property_Metadata and PLT_Property property tables.
–>Benefits : The mechanism of handling properties via file based approach does not allow changes to properties at runtime. The JVMs must be restarted if you want to modify a property value. But in case of managing properties using DB , the db-cache mechanism is used to broadcast changes to property values to all live Sterling Order Management JVMs.
And the restart of JVM’s is /App Server is not required. This approach help us in lots of time saving and debugging also becomes easy in lower environments.
Thanks Priyanshi for New things …..
Thanks for the same. Sure helps a lot.
@admin @ Priyanshi As mentioned that file system as priority over db property vales then even if we update property values in db, how its gonna reflect?
And how to use db-cache mechanism to broadcast changes to property values to all live Sterling Order Management JVMs.