Advanced Customization > Services and Infrastructure Customization > System Generation > Modeling Business Objects > Deploying Modeled Customizations
  
Deploying Modeled Customizations
This section documents guidelines for deploying modeled customizations. By “deploying” in this context we mean copying the customizations from one system to another – from a source to a destination. The process you use will depend on the actual source and destination of the customizations.
Modeled customizations, when built, will impact the installation in three primary ways:
1. 1. Registering modeled (annotated) classes in <loadpoint>/codebase in the following files:
modelRegistry.properties
associationRegistry.properties
descendentRegistry.properties
2. Adding compiled and generated files:
Java Classes (*.class)
introspection artifact files (*.ClassInfo.ser)
serialized bundle files (*.RB.ser)
3. Updating database scripts in <loadpoint>/db to incorporate any additional schema (including indexes)
database files (*.sql)
Additionally, you may have added entries to site.xconf to register services.
In any case, you must:
1. Copy over the changes introduced by your customization into the destination system (these are the files enumerated above)
2. Install the schema by invoking the SQL scripts necessary to create tables and indexes
3. Augment the destination system’s site.xconf to incorporate the customization’s changes (and run xconfmanager)
4. Restart the destination system
Deploying Modeled Customizations from Development to Production
One common scenario is an environment where the source is a Development system and the destination is a Production system. In this scenario we can make assumptions that simplify the deployment process. Most importantly, we assume the development and production systems are essentially clones.
This section uses “Development System” to refer to the source where the customizations are being developed. “Production System” refers to the destination that is either currently being used by the customer for their production work, or the new production system that is being developed as part of a new deployment, migration or upgrade. Your environment may include other systems that need to be maintained such as a test system or staging (pre-production) system. All the steps described below for deploying customizations to production apply as well to the other systems – as long as the same assumptions apply.
In this scenario we assume that the development and production systems are clones, and that as you make changes to the development system, you can copy them to the production system. For that reason it is important that the production system and development system share the same fundamental state (the same products are installed, the same patches, and all are at the same release level) or your classes may be incompatible, your registry files may contain extraneous entries (or drop important ones), and your database schema may be incorrect.
If these assumptions are met, then you can follow the guidelines in the following steps:
1. Copy over the changes introduced by your customization into the production system (these are the files enumerated above)
2. Copy over the changes introduced by your customization into the production system.
a. Copy the follow registry files before starting customization to: C:\temp\original_registry_files :
associationRegistry.properties
descendentRegistry.properties
modelRegistry.properties
moduleRegistry.properties
b. Create a new modeled object. See Model a New Document Subclass for more information.
c. To create merge files for the additions and deletions inside: d:\Windchill\temp\_model_registry run the following command in a Windchill shell.:
ant -f bin/tools.xml registry_diff -Dregistry_diff.basedir=C:\temp\original_registry_files -Dregistry_diff.modsdir=D:\windchill\codebase -Dregistry_diff.diffdir=d:\Windchill\temp\_model_registry
d. Copy the _model_registry folder to the new Windchill target system and paste it in d:\Windchill\temp
e. Run the following command in a Windchill shell on the new target system:
ant -f bin/tools.xml registry_merge -Dregistry_merge.adds=D:\Windchill\temp\_model_registry\reg_adds -Dregistry_merge.removes=D:\Windchill\temp\_model_registry\reg_removes
3. Install the schema by invoking the necessary SQL scripts to create tables and indexes
4. Augment the production system’s site.xconf to incorporate the customization’s changes (and run xconfmanager)
5. Restart the production system.
Additional Strategies for Deploying Modeled Customizations
Deploying your customization from your source to your destination entails replaying your actions in the source environment on the destination system. One strategy would be to simply copy over the source and rebuild it on the destination system. This strategy, however, necessitates compiling on the destination system, but if that is your production system then that is probably not acceptable.
Another strategy is to use a version control system, like Git or Subversion, putting your entire load point under it, allowing the version control system to tell you how your customization impacted the installation, and merge over the changes.
Merging Modeled Customizations
If the destination system includes customizations that are not part of the source system you are deploying, you will need to create incremental registry files that can be merged into the registry files in the destination system. The registry_diff target can be run against the source system files to produce the incremental files to merge into the destination system with the registry_merge target.
The registry_diff target can be run from the Windchill shell of either system, as long it has access to the required folders, described below.
ant -f <loadpoint>/bin/tools.xml registry_diff -Dregistry_diff.basedir=/wt_dev/base
-Dregistry_diff.modsdir=/wt_dev/codebase -Dregistry_diff.diffdir=/wt_dev/diff
registry_diff.basedir - the folder that contains the original registry file, prior to developing the customizations
Ideally you would have preserved the original state of your registry files before doing any customization. If not, then to access your original registry files you may need to unregister your customized classes, preserve the registry files as your base, and then rebuild your customizations. For example, to unregister your customized classes that begin with the prefix “ext.”:
Remove lines beginning with “ext.” or containing “=ext.”:
ant -f <loadpoint>/bin/tools.xml model_uninstall
-Dmodel_uninstall.filter="\Aext\.|=ext\."
Note: This will match any key or value that begins with “ext.”.
For additional usage examples execute: ant -f <loadpoint>/bin/tools.xml model_uninstall.help
registry_diff.modsdir is the folder that contains the development registry files (ie the development codebase), that is the version of the registry files with your customizations registered.
registry_diff.diffdir is the folder where the delta between the basedir and modsdir will be output. Within the directory two folders could be created: reg_adds and reg_removes. These two folders will be used by the registry_merge command on the destination system as described below.
The registry_merge target must be run from the Windchill shell of the destination system, and it must have access to the files generated by the registry_diff target.
ant -f <loadpoint>/bin/tools.xml registry_merge
-Dregistry_merge.adds=/wt_dev/diff/reg_adds
-Dregistry_merge.removes=/wt_dev/diff/reg_removes
registry_merge.adds is the folder that contains the customization entries to add to the destination system
registry_merge.removes is the (optional) folder that contains the customization entries to remove from the destination system