A registry allows you to remove from it any objects that you have submitted to it. You use the object’s ID as an argument to the LifeCycleManager.deleteObjects method.
The following code fragment deletes the object that corresponds to a specified key string and then displays the key again so that you can confirm that it has deleted the correct one.
String id = key.getId(); Collection keys = new ArrayList(); keys.add(key); BulkResponse response = blcm.deleteObjects(keys); Collection exceptions = response.getException(); if (exceptions == null) { System.out.println("Objects deleted"); Collection retKeys = response.getCollection(); Iterator keyIter = retKeys.iterator(); javax.xml.registry.infomodel.Key orgKey = null; if (keyIter.hasNext()) { orgKey = (javax.xml.registry.infomodel.Key) keyIter.next(); id = orgKey.getId(); System.out.println("Object key was " + id); } }
Deleting an Organization object does not delete the Service and User objects that belong to the Organization. If you want to delete those objects, you must delete them separately.
Deleting a Service object deletes the ServiceBinding objects that belong to it. Deleting the Service and ServiceBinding objects, however, does not delete the associated ExtrinsicObject instances and their associated repository items. You must delete the extrinsic objects separately.
When you delete an object that has Classification or ExternalIdentifier or Slot objects, those objects are also deleted. However, if the object has ExternalLink objects, those objects are not deleted.
AuditableEvent objects are not deleted when the objects associated with them are deleted. You might find that as you use the Registry, a large number of these objects accumulates.
For an example of deleting an object from the Registry, see JAXRDelete.java in the directory INSTALL/registry-samples/delete-object/src. This example deletes the object whose unique identifier you specify.