Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java7
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeDataAccessor.java58
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java12
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java25
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java2
18 files changed, 134 insertions, 37 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java
index 73e034445f..e7a865345b 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java
@@ -12,8 +12,11 @@ package org.eclipse.osee.framework.core.message.test.data;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockOseeDataAccessor;
+import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -42,7 +45,7 @@ public class TransactionCacheUpdateResponseTest {
}
@Test
- public void testFromCache() {
+ public void testFromCache() throws OseeCoreException {
List<TransactionRecord> data = new ArrayList<TransactionRecord>();
for (int j = 1; j <= 2; j++) {
@@ -50,7 +53,7 @@ public class TransactionCacheUpdateResponseTest {
}
TransactionRecordFactory factory = new TransactionRecordFactory();
- BranchCache branchCache = new BranchCache(null);
+ BranchCache branchCache = new BranchCache(new MockOseeDataAccessor<String, Branch>());
TransactionCacheUpdateResponse response = TransactionCacheUpdateResponse.fromCache(factory, data, branchCache);
List<TransactionRecord> actual = response.getTxRows();
Assert.assertEquals(data.size(), actual.size());
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeDataAccessor.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeDataAccessor.java
new file mode 100644
index 0000000000..d44e4d0cfe
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeDataAccessor.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.mocks;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.IOseeStorable;
+import org.eclipse.osee.framework.core.model.cache.IOseeCache;
+import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor;
+import org.junit.Assert;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockOseeDataAccessor<K, T extends IOseeStorable> implements IOseeDataAccessor<K, T> {
+
+ private boolean wasLoadCalled = false;
+ private boolean wasStoreCalled = false;
+
+ public void setLoadCalled(boolean wasLoadCalled) {
+ this.wasLoadCalled = wasLoadCalled;
+ }
+
+ public void setStoreCalled(boolean wasStoreCalled) {
+ this.wasStoreCalled = wasStoreCalled;
+ }
+
+ public boolean wasLoaded() {
+ return wasLoadCalled;
+ }
+
+ public boolean wasStoreCalled() {
+ return wasStoreCalled;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public void load(IOseeCache<K, T> cache) throws OseeCoreException {
+ Assert.assertNotNull(cache);
+ setLoadCalled(true);
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ public void store(Collection<T> types) throws OseeCoreException {
+ Assert.assertNotNull(types);
+ setStoreCalled(true);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
index bf64f202dc..5f26cf17e4 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
@@ -20,6 +20,8 @@ import org.eclipse.osee.framework.core.message.internal.DataTranslationService;
import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockOseeDataAccessor;
+import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -52,7 +54,7 @@ public class BranchCommitResponseTranslatorTest extends BaseTranslatorTest<Branc
List<Object[]> data = new ArrayList<Object[]>();
IDataTranslationService service = new DataTranslationService();
- BranchCache branchCache = new BranchCache(null);
+ BranchCache branchCache = new BranchCache(new MockOseeDataAccessor<String, Branch>());
service.addTranslator(new TransactionRecordTranslator(new TransactionRecordFactory(), branchCache),
CoreTranslatorId.TRANSACTION_RECORD);
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
index c19bce2bd7..fa7c61cef5 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
@@ -119,7 +119,7 @@ public class DataTranslationServiceFactoryTest {
@Override
public TransactionRecordFactory getTransactionFactory() {
- return new TransactionRecordFactory();
+ return null;
}
@Override
@@ -139,7 +139,7 @@ public class DataTranslationServiceFactoryTest {
@Override
public AttributeTypeFactory getAttributeTypeFactory() {
- return new AttributeTypeFactory();
+ return null;
}
@Override
@@ -152,7 +152,7 @@ public class DataTranslationServiceFactoryTest {
@Override
public BranchCache getBranchCache() {
- return new BranchCache(null);
+ return null;
}
@Override
@@ -191,16 +191,18 @@ public class DataTranslationServiceFactoryTest {
}
@Override
- public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException {
+ public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) {
return null;
}
@Override
- public void reloadAll() throws OseeCoreException {
+ public void reloadAll() {
+ //
}
@Override
public void clearAll() {
+ //
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
index 3fc81a8005..db474da107 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
@@ -16,6 +16,8 @@ import java.util.List;
import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockOseeDataAccessor;
+import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -51,7 +53,7 @@ public class TransactionCacheUpdateResponseTranslatorTest extends BaseTranslator
@Parameters
public static Collection<Object[]> data() {
- BranchCache branchCache = new BranchCache(null);
+ BranchCache branchCache = new BranchCache(new MockOseeDataAccessor<String, Branch>());
ITranslator<TransactionCacheUpdateResponse> translator =
new TransactionCacheUpdateResponseTranslator(new TransactionRecordFactory(), branchCache);
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
index 93487b47df..0545bfb265 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
@@ -15,6 +15,8 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockOseeDataAccessor;
+import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -45,7 +47,7 @@ public class TransactionRecordTranslatorTest extends BaseTranslatorTest<Transact
@Parameters
public static Collection<Object[]> data() {
- BranchCache branchCache = new BranchCache(null);
+ BranchCache branchCache = new BranchCache(new MockOseeDataAccessor<String, Branch>());
ITranslator<TransactionRecord> translator =
new TransactionRecordTranslator(new TransactionRecordFactory(), branchCache);
List<Object[]> data = new ArrayList<Object[]>();
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java
index 694b3dda48..70d704446b 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TransactionCacheUpdateResponse.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.core.message;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -32,7 +33,7 @@ public class TransactionCacheUpdateResponse {
return rows;
}
- public static TransactionCacheUpdateResponse fromCache(TransactionRecordFactory factory, Collection<TransactionRecord> types, BranchCache branchCache) {
+ public static TransactionCacheUpdateResponse fromCache(TransactionRecordFactory factory, Collection<TransactionRecord> types, BranchCache branchCache) throws OseeCoreException {
List<TransactionRecord> rows = new ArrayList<TransactionRecord>();
for (TransactionRecord tx : types) {
rows.add(factory.create(tx.getId(), tx.getBranchId(), tx.getComment(), tx.getTimeStamp(), tx.getAuthor(),
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
index b2ca335f7c..84ec907999 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
@@ -85,7 +85,7 @@ public class TransactionCacheUpdateResponseTranslator implements ITranslator<Tra
String.valueOf(row.getBranchId())};
}
- private TransactionRecord fromArray(TransactionRecordFactory factory, String[] data) {
+ private TransactionRecord fromArray(TransactionRecordFactory factory, String[] data) throws OseeCoreException {
int index = 0;
int txId = Integer.valueOf(data[index++]);
TransactionDetailsType txType = TransactionDetailsType.valueOf(data[index++]);
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java
index 2fc45bfa91..d9decdb404 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java
@@ -40,6 +40,7 @@ public class BranchFactory implements IOseeTypeFactory {
}
public Branch createOrUpdate(AbstractOseeCache<String, Branch> cache, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "BranchCache");
Branch branch = cache.getByGuid(guid);
if (branch == null) {
branch = create(guid, name, branchType, branchState, isArchived);
@@ -55,6 +56,7 @@ public class BranchFactory implements IOseeTypeFactory {
}
public Branch createOrUpdate(IOseeCache<String, Branch> cache, int uniqueId, StorageState storageState, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "BranchCache");
Branch branch = cache.getById(uniqueId);
if (branch == null) {
branch = create(guid, name, branchType, branchState, isArchived);
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java
index e6a1d55daf..c831edc0b3 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java
@@ -36,10 +36,6 @@ public final class TransactionRecord extends BaseIdentity<Integer> implements IT
public TransactionRecord(int transactionNumber, int branchId, String comment, Date time, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) {
super(transactionNumber);
- if (branchCache == null) {
- System.out.print("BranchCache cannot be null");
- Thread.dumpStack();
- }
this.branchId = branchId;
this.comment = Strings.intern(comment);
this.time = time;
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java
index 80635ccf9a..39721974b1 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java
@@ -16,42 +16,47 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.IOseeTypeFactory;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
+import org.eclipse.osee.framework.core.util.Conditions;
/**
* @author Roberto E. Escobar
*/
public class TransactionRecordFactory implements IOseeTypeFactory {
- public TransactionRecord create(int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) {
+ public TransactionRecord create(int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) throws OseeCoreException {
+ Conditions.checkNotNull(branchCache, "branchCache");
return new TransactionRecord(transactionNumber, branchId, comment, timestamp, authorArtId, commitArtId, txType,
branchCache);
}
- public TransactionRecord create(int transactionNumber, BranchCache branchCache) {
+ private TransactionRecord create(int transactionNumber, BranchCache branchCache) throws OseeCoreException {
+ Conditions.checkNotNull(branchCache, "branchCache");
return new TransactionRecord(transactionNumber, branchCache);
}
- public TransactionRecord createOrUpdate(TransactionCache cache, int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) throws OseeCoreException {
- TransactionRecord record = cache.getById(transactionNumber);
+ public TransactionRecord createOrUpdate(TransactionCache txCache, int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) throws OseeCoreException {
+ Conditions.checkNotNull(txCache, "txCache");
+ TransactionRecord record = txCache.getById(transactionNumber);
if (record == null) {
record =
create(transactionNumber, branchId, comment, timestamp, authorArtId, commitArtId, txType, branchCache);
} else {
- cache.decache(record);
+ txCache.decache(record);
record.setAuthor(authorArtId);
record.setComment(comment);
record.setCommit(commitArtId);
record.setTimeStamp(timestamp);
}
- cache.cache(record);
+ txCache.cache(record);
return record;
}
- public TransactionRecord getOrCreate(TransactionCache cache, int transactionNumber, BranchCache branchCache) throws OseeCoreException {
- TransactionRecord record = cache.getById(transactionNumber);
+ public TransactionRecord getOrCreate(TransactionCache txCache, int transactionNumber, BranchCache branchCache) throws OseeCoreException {
+ Conditions.checkNotNull(txCache, "txCache");
+ TransactionRecord record = txCache.getById(transactionNumber);
if (record == null) {
- record = new TransactionRecord(transactionNumber, branchCache);
- cache.cache(record);
+ record = create(transactionNumber, branchCache);
+ txCache.cache(record);
}
return record;
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java
index 95dfca2eaf..e6da832407 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java
@@ -28,6 +28,7 @@ public final class ArtifactTypeFactory implements IOseeTypeFactory {
}
public ArtifactType createOrUpdate(ArtifactTypeCache cache, Long guid, boolean isAbstract, String name) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "ArtifactTypeCache");
ArtifactType artifactType = cache.getByGuid(guid);
if (artifactType == null) {
artifactType = create(guid, isAbstract, name);
@@ -41,6 +42,7 @@ public final class ArtifactTypeFactory implements IOseeTypeFactory {
}
public ArtifactType createOrUpdate(IOseeCache<Long, ArtifactType> cache, int uniqueId, StorageState storageState, Long guid, boolean isAbstract, String name) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "ArtifactTypeCache");
ArtifactType artifactType = cache.getById(uniqueId);
if (artifactType == null) {
artifactType = create(guid, isAbstract, name);
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java
index 2fc8c0153a..f070fd1686 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java
@@ -42,6 +42,7 @@ public class AttributeTypeFactory implements IOseeTypeFactory {
}
public AttributeType createOrUpdate(AttributeTypeCache cache, long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "AttributeTypeCache");
AttributeType attributeType = cache.getByGuid(guid);
if (attributeType == null) {
@@ -59,6 +60,7 @@ public class AttributeTypeFactory implements IOseeTypeFactory {
}
public AttributeType createOrUpdate(IOseeCache<Long, AttributeType> cache, int uniqueId, StorageState storageState, Long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "AttributeTypeCache");
AttributeType attributeType = cache.getById(uniqueId);
if (attributeType == null) {
attributeType =
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java
index a90445c113..6e9aa2aae8 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java
@@ -37,6 +37,7 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory {
}
public OseeEnumType createOrUpdate(IOseeCache<Long, OseeEnumType> cache, int enumTypeId, StorageState storageState, Long guid, String enumTypeName) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "OseeEnumTypeCache");
OseeEnumType oseeEnumType = cache.getById(enumTypeId);
if (oseeEnumType == null) {
oseeEnumType = createEnumType(guid, enumTypeName);
@@ -51,6 +52,7 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory {
}
public OseeEnumType createOrUpdate(OseeEnumTypeCache cache, Long guid, String enumTypeName) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "OseeEnumTypeCache");
OseeEnumType oseeEnumType = cache.getByGuid(guid);
if (oseeEnumType == null) {
oseeEnumType = createEnumType(guid, enumTypeName);
@@ -63,6 +65,7 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory {
}
public OseeEnumEntry createOrUpdate(IOseeCache<Long, OseeEnumType> cache, Long enumTypeGuid, String enumEntryGuid, String enumEntryName, int ordinal) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "OseeEnumTypeCache");
OseeEnumType oseeEnumType = ((AbstractOseeCache<Long, OseeEnumType>) cache).getByGuid(enumTypeGuid);
OseeEnumEntry enumEntry = oseeEnumType.getEntryByGuid(enumEntryGuid);
if (enumEntry == null) {
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java
index 2f2c247955..8586792932 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java
@@ -36,6 +36,7 @@ public class RelationTypeFactory implements IOseeTypeFactory {
}
public RelationType createOrUpdate(RelationTypeCache cache, Long guid, String typeName, String sideAName, String sideBName, IArtifactType artifactTypeSideA, IArtifactType artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "RelationTypeCache");
RelationType relationType = cache.getByGuid(guid);
if (relationType == null) {
relationType =
@@ -51,6 +52,7 @@ public class RelationTypeFactory implements IOseeTypeFactory {
}
public RelationType createOrUpdate(IOseeCache<Long, RelationType> cache, int typeId, StorageState storageState, Long guid, String typeName, String sideAName, String sideBName, IArtifactType artifactTypeSideA, IArtifactType artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "RelationTypeCache");
RelationType relationType = cache.getById(typeId);
if (relationType == null) {
relationType =
diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java
index 25aa10a161..44fd618988 100644
--- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java
+++ b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java
@@ -48,7 +48,7 @@ public class SessionFactoryTest {
private final Date lastInteractionDate;
private final String lastInteractionDetails;
private final MockBuildTypeIdentifier typeIdentifier = new MockBuildTypeIdentifier();
- private final SessionFactory factory = new SessionFactory(new MockLog(), typeIdentifier);
+ private final SessionFactory factory = new SessionFactory(new MockLog(), null, typeIdentifier);
public SessionFactoryTest(String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) {
super();
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java
index f5aa087dd8..2727b945eb 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java
@@ -22,8 +22,10 @@ import org.eclipse.osee.framework.core.model.cache.IOseeTypeFactory;
import org.eclipse.osee.framework.core.server.OseeServerProperties;
import org.eclipse.osee.framework.core.server.internal.BuildTypeIdentifier;
import org.eclipse.osee.framework.core.server.internal.compatibility.OseeSql_0_9_1;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.DatabaseInfoManager;
+import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.logger.Log;
@@ -34,13 +36,16 @@ import org.eclipse.osee.logger.Log;
public final class SessionFactory implements IOseeTypeFactory {
private final BuildTypeIdentifier typeIdentifier;
private final Log logger;
+ private final IOseeDatabaseService dbService;
- public SessionFactory(Log logger, BuildTypeIdentifier typeIdentifier) {
+ public SessionFactory(Log logger, IOseeDatabaseService dbService, BuildTypeIdentifier typeIdentifier) {
this.typeIdentifier = typeIdentifier;
this.logger = logger;
+ this.dbService = dbService;
}
public Session createOrUpdate(IOseeCache<String, Session> cache, int uniqueId, StorageState storageState, String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) throws OseeCoreException {
+ Conditions.checkNotNull(cache, "SessionCache");
Session session = cache.getById(uniqueId);
if (session == null) {
session =
@@ -66,12 +71,15 @@ public final class SessionFactory implements IOseeTypeFactory {
}
public OseeSessionGrant createSessionGrant(Session session, IUserToken userToken) throws OseeCoreException {
+ Conditions.checkNotNull(session, "Session");
+ Conditions.checkNotNull(userToken, "IUserToken");
+
OseeSessionGrant sessionGrant = new OseeSessionGrant(session.getGuid());
sessionGrant.setCreationRequired(userToken.isCreationRequired());
sessionGrant.setUserToken(userToken);
sessionGrant.setDatabaseInfo(DatabaseInfoManager.getDefault());
- Properties properties = getSQLProperties(session.getClientVersion());
+ Properties properties = getSQLProperties(dbService, session.getClientVersion());
sessionGrant.setSqlProperties(properties);
sessionGrant.setDataStorePath(OseeServerProperties.getOseeApplicationServerData(logger));
@@ -79,13 +87,20 @@ public final class SessionFactory implements IOseeTypeFactory {
return sessionGrant;
}
- private static Properties getSQLProperties(String clientVersion) throws OseeCoreException {
+ private static Properties getSQLProperties(IOseeDatabaseService dbService, String clientVersion) throws OseeCoreException {
Properties properties = null;
- DatabaseMetaData metaData = ConnectionHandler.getMetaData();
- if (is_0_9_2_Compatible(clientVersion)) {
- properties = OseeSql.getSqlProperties(metaData);
- } else {
- properties = OseeSql_0_9_1.getSqlProperties(metaData);
+ OseeConnection connection = dbService.getConnection();
+ try {
+ DatabaseMetaData metaData = connection.getMetaData();
+ if (is_0_9_2_Compatible(clientVersion)) {
+ properties = OseeSql.getSqlProperties(metaData);
+ } else {
+ properties = OseeSql_0_9_1.getSqlProperties(metaData);
+ }
+ } finally {
+ if (connection != null) {
+ connection.close();
+ }
}
return properties;
}
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java
index 1fd3b172bc..f542ecb85f 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerService.java
@@ -69,7 +69,7 @@ public final class SessionManagerService implements ISessionManager {
String serverId = getServerManager().getId();
BuildTypeIdentifier identifier = new BuildTypeIdentifier(new BuildTypeDataProvider());
- SessionFactory sessionFactory = new SessionFactory(logger, identifier);
+ SessionFactory sessionFactory = new SessionFactory(logger, dbService, identifier);
ISessionQuery sessionQuery = new DatabaseSessionQuery(serverId, getDbService());
IOseeDataAccessor<String, Session> accessor =

Back to the top