Skip to content

Commit de4e435

Browse files
committed
In the ObjectManagerFactory class, renamed the method from getInstance to getDataManager.
1 parent e71c01d commit de4e435

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/main/java/org/dataone/cn/indexer/IndexWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public IndexWorker(Boolean initialize)
243243
initExecutorService();//initialize the executor first
244244
initIndexQueue();
245245
initIndexParsers();
246-
ObjectManagerFactory.getInstance();
246+
ObjectManagerFactory.getObjectManager();
247247
OntologyModelService.getInstance();
248248
}
249249
}

src/main/java/org/dataone/cn/indexer/SolrIndex.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private Map<String, SolrDoc> process(String id, boolean isSysmetaChangeOnly)
152152
Map<String, SolrDoc> docs = new HashMap<>();
153153
// Load the System Metadata document
154154
try (InputStream systemMetadataStream =
155-
ObjectManagerFactory.getInstance().getSystemMetadataStream(id)){
155+
ObjectManagerFactory.getObjectManager().getSystemMetadataStream(id)){
156156
docs = systemMetadataProcessor.processDocument(id, docs, systemMetadataStream);
157157
} catch (Exception e) {
158158
log.error(e.getMessage(), e);
@@ -190,7 +190,7 @@ private Map<String, SolrDoc> process(String id, boolean isSysmetaChangeOnly)
190190
// if so, then extract the additional information from the
191191
// document.
192192
try (InputStream dataStream =
193-
ObjectManagerFactory.getInstance().getObject(id)) {
193+
ObjectManagerFactory.getObjectManager().getObject(id)) {
194194
// docObject = the resource map document or science
195195
// metadata document.
196196
// note that resource map processing touches all objects

src/main/java/org/dataone/cn/indexer/object/ObjectManagerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ObjectManagerFactory {
2828
* @throws InstantiationException
2929
* @throws IllegalAccessException
3030
*/
31-
public static ObjectManager getInstance()
31+
public static ObjectManager getObjectManager()
3232
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
3333
InstantiationException, IllegalAccessException {
3434
String classNameFromEnv = System.getenv(OBJECT_MANAGER_CLASSNAME_ENV);

src/main/java/org/dataone/cn/indexer/resourcemap/ForesiteResourceMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ private SolrDoc _mergeMappedReference(ResourceEntry resourceEntry, SolrDoc merge
240240
Identifier identifier = new Identifier();
241241
identifier.setValue(mergeDocument.getIdentifier());
242242
try {
243-
SystemMetadata sysMeta = (SystemMetadata) ObjectManagerFactory.getInstance()
243+
SystemMetadata sysMeta = (SystemMetadata) ObjectManagerFactory.getObjectManager()
244244
.getSystemMetadata(identifier.getValue());
245245
if (sysMeta.getSeriesId() != null && sysMeta.getSeriesId().getValue() != null
246246
&& !sysMeta.getSeriesId().getValue().trim().equals("")) {

src/main/java/org/dataone/cn/indexer/resourcemap/IndexVisibilityDelegateImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public IndexVisibilityDelegateImpl() {
2828
public boolean isDocumentVisible(Identifier pid) {
2929
boolean visible = false;
3030
try {
31-
SystemMetadata systemMetadata = ObjectManagerFactory.getInstance()
31+
SystemMetadata systemMetadata = ObjectManagerFactory.getObjectManager()
3232
.getSystemMetadata(pid.getValue());
3333
// TODO: Is pid Identifier a SID?
3434
if (systemMetadata == null) {
@@ -76,7 +76,7 @@ public boolean documentExists(Identifier pid) {
7676
boolean exists = false;
7777
try {
7878
SystemMetadata systemMetadata =
79-
ObjectManagerFactory.getInstance().getSystemMetadata(pid.getValue());
79+
ObjectManagerFactory.getObjectManager().getSystemMetadata(pid.getValue());
8080
if (systemMetadata != null) {
8181
exists = true;
8282
} else {

src/test/java/org/dataone/cn/indexer/object/ObjectManagerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void setUp() throws Exception {
6262
*/
6363
@Test
6464
public void testGetObjectAndSystemMetadata() throws Exception {
65-
try (InputStream input = ObjectManagerFactory.getInstance().getObject(identifier)) {
65+
try (InputStream input = ObjectManagerFactory.getObjectManager().getObject(identifier)) {
6666
assertNotNull(input);
6767
try (OutputStream os = new ByteArrayOutputStream()) {
6868
MessageDigest md5 = MessageDigest.getInstance("MD5");
@@ -77,7 +77,7 @@ public void testGetObjectAndSystemMetadata() throws Exception {
7777
assertEquals("1755a557c13be7af44d676bb09274b0e", md5Digest);
7878
}
7979
}
80-
org.dataone.service.types.v1.SystemMetadata sysmeta = ObjectManagerFactory.getInstance()
80+
org.dataone.service.types.v1.SystemMetadata sysmeta = ObjectManagerFactory.getObjectManager()
8181
.getSystemMetadata(identifier);
8282
assertEquals(identifier, sysmeta.getIdentifier().getValue());
8383
assertEquals("1755a557c13be7af44d676bb09274b0e", sysmeta.getChecksum().getValue());

0 commit comments

Comments
 (0)