Finding objects by external link does not require the use of a classification scheme, but it does require you to specify a valid URI. The arguments to the createExternalLink method are a URI and a description.
If the link you specify is outside your firewall, you must also specify the system properties http.proxyHost and http.proxyPort when you run the program so that JAXR can determine the validity of the URI.
The following code fragment finds all organizations that have a specified ExternalLink object.
ExternalLink extLink = blcm.createExternalLink("http://java.sun.com/", "Sun Java site"); Collection extLinks = new ArrayList(); extLinks.add(extLink); BulkResponse response = bqm.findObjects(LifeCycleManager.ORGANIZATION, null, null, null, null, null, extLinks); Collection objects = response.getCollection();
For an example of finding objects by external link, see JAXRSearchByExternalLink.java in the directory install/registry-samples/search-external-link/src, which searches for objects that have a specified external link. The http.proxyHost and http.proxyPort properties are specified in the run target in the build.xml file. Make sure you have set these properties as described in To Edit the build.properties File.
To obtain results from this example, first run the publish-object example described in Adding Classifications: Example.
Go to the directory install/registry-samples/search-external-link.
Type the following command:
Ant-base/ant run |
The output of the run target looks something like this:
run: [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] Got registry service, query manager, and lifecycle manager [java] Searching by external link with URI=http://java.sun.com/ and description=%Sun Java technology website% [java] URI is http://java.sun.com/ [java] Object type is Organization [java] Object name: GenericOrg [java] Object description: Generic organization [java] Object key id: urn:uuid:f23cffcd-23d2-4171-ba41-f2d1547158f8 [java] External link name is Java Technology [java] External link description is Sun Java technology website [java] External link URI is http://java.sun.com/ [java] --- |