Registry packages allow you to group a number of logically related registry objects, even if the individual member objects belong to different owners. A RegistryPackage is analogous to a directory or folder in a file system, and the registry objects it contains are analogous to the files in the directories or folders.
To create a RegistryPackage object, call the LifeCycleManager.createRegistryPackage method, which takes a String or InternationalString argument. Then call the RegistryPackage.addRegistryObject or RegistryPackage.addRegistryObjects method to add objects to the package.
For example, you could create a RegistryPackage object that is named “SunPackage”:
RegistryPackage pkg = blcm.createRegistryPackage("SunPackage");
Then, after finding all objects with the string "Sun" in their names, you could iterate through the results and add each object to the package:
pkg.addRegistryObject(object);
A common use of packages is to organize a set of extrinsic objects. A registry administrator can use the cp command of the Admin Tool to load a file system into the Registry, storing the directories as registry packages and the files as the package contents. See cp Command in Service Registry 3.1 Update 1 Administration Guide for details.
For examples of using registry packages, see JAXRPublishPackage.java and JAXRSearchPackage.java in the directory install/registry-samples/packages/src. The first example publishes a RegistryPackage object that includes all objects in the Registry whose names contain the string "free". The second example searches for this package and displays its contents.
Go to the directory install/registry-samples/packages.
Type the following command:
Ant-base/ant pub-pkg |
The output of the pub-pkg target looks something like this:
pub-pkg: [java] Query URL is http://localhost:6480/soar/registry/soap [java] Publish URL is http://localhost:6480/soar/registry/soap [java] Created connection to registry [java] Established security credentials [java] Got registry service and life cycle manager [java] Package ID is urn:uuid:182e383b-1244-4e9f-9439-bddac093ebe7 [java] Object type is ClassificationNode [java] Object name: Household Refrigerator and Home Freezer Manufacturing [java] Object type is ClassificationNode [java] Object name: Freestanding Ambulatory Surgical and Emergency Centers [java] Object type is Federation [java] Object name: freebXMLRegistryFederation [java] Object type is Organization [java] Object name: freebXMLRegistry [java] Object type is Registry [java] Object name: freebXMLRegistry [java] Package saved |
Type the following command:
Ant-base/ant search-pkg |
The output of the search-pkg target looks something like this:
search-pkg: [java] Query URL is http://localhost:6480/soar/registry/soap [java] Created connection to registry [java] Got registry service and query manager [java] Contents of FreePackage: [java] Object type is Registry [java] Object name: freebXMLRegistry [java] Object description: freebXML Registry [java] Object key id: urn:uuid:48b099a8-ed72-454e-9075-a6f96bd1280a [java] Object type is Federation [java] Object name: freebXMLRegistryFederation [java] Object description: freebXML Registry Federation [java] Object key id: urn:uuid:51f410c3-de34-47f6-845d-eeda495c458a [java] Object type is ClassificationNode [java] Object name: Household Refrigerator and Home Freezer Manufacturing [java] Object description: null [java] Object key id: urn:uuid:4f368d2d-25a4-413f-8609-a91166f1333f [java] Object type is ClassificationNode [java] Object name: Freestanding Ambulatory Surgical and Emergency Centers [java] Object description: null [java] Object key id: urn:uuid:ad381518-6986-444d-95ba-e62d85e2e84a [java] Object type is Organization [java] Object name: freebXMLRegistry [java] Object description: freebXML Registry [java] Object key id: urn:freebxml:registry:Organization:freebXMLRegistry |