As shown in the following Java™ and C# examples, you can get an existing instance of an ObjectStore object from any object that is persisted on that object store.
Any object that can be stored in an object store is represented by a RepositoryObject subclass (for example, Document, Folder, or Annotation). The getObjectStore method of the RepositoryObject interface returns the object store to which an object belongs.
Java Example
// Get object store from repository object subclass.
private static void getObjectStoreFromSubclass(Document doc)
{
// Get the object store in which the document is stored.
ObjectStore objStore = doc.getObjectStore();
// Get the display name of the returned object store.
objStore.refresh();
System.out.println("Object store name = " + objStore.get_DisplayName());
}
C# Example
// Get object store from repository object subclass.
private static void GetObjectStoreFromSubclass(IDocument doc)
{
// Get the object store in which the document is stored.
IObjectStore objStore = doc.GetObjectStore();
// Get the display name of the returned object store.
objStore.Refresh();
Debug.WriteLine("Object store name = " + objStore.DisplayName);
}