diff options
39 files changed, 50 insertions, 1434 deletions
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 cfa49919836..02cee890d24 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 @@ -13,16 +13,10 @@ package org.eclipse.osee.framework.core.message.test.translation; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.eclipse.osee.framework.core.enums.CoreTranslatorId; import org.eclipse.osee.framework.core.message.BranchCommitResponse; -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.MockDataFactory; -import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.cache.TransactionCache; -import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.junit.runner.RunWith; @@ -50,18 +44,13 @@ public class BranchCommitResponseTranslatorTest extends BaseTranslatorTest<Branc public static Collection<Object[]> data() throws OseeCoreException { List<Object[]> data = new ArrayList<Object[]>(); - IDataTranslationService service = new DataTranslationService(); - service.addTranslator(new TransactionRecordTranslator(), CoreTranslatorId.TRANSACTION_RECORD); - ITranslator<BranchCommitResponse> translator = new BranchCommitResponseTranslator(service); + ITranslator<BranchCommitResponse> translator = new BranchCommitResponseTranslator(); for (int index = 1; index <= 2; index++) { - TransactionRecord tx = MockDataFactory.createTransaction(index, index * 3); - BranchCommitResponse response = new BranchCommitResponse(); - response.setTransactionId(tx.getGuid()); + response.setTransactionId(index); data.add(new Object[] {response, translator}); } - data.add(new Object[] {new BranchCommitResponse(), translator}); return data; } } 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 fe5e0293cda..614ecc32b37 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 @@ -10,15 +10,11 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.message.test.translation; -import java.util.Collection; import org.eclipse.osee.framework.core.enums.CoreTranslatorId; -import org.eclipse.osee.framework.core.enums.OseeCacheEnum; import org.eclipse.osee.framework.core.message.internal.DataTranslationService; import org.eclipse.osee.framework.core.message.internal.DataTranslationServiceFactory; import org.eclipse.osee.framework.core.message.internal.translation.ArtifactTypeCacheUpdateResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.AttributeTypeCacheUpdateResponseTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheStoreRequestTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheUpdateResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitRequestTranslator; import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationRequestTranslator; @@ -32,19 +28,13 @@ import org.eclipse.osee.framework.core.message.internal.translation.OseeImportMo import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.RelationTypeCacheUpdateResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator; import org.eclipse.osee.framework.core.model.BranchFactory; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; -import org.eclipse.osee.framework.core.model.cache.BranchCache; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; -import org.eclipse.osee.framework.core.model.cache.TransactionCache; import org.eclipse.osee.framework.core.model.type.ArtifactTypeFactory; import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory; import org.eclipse.osee.framework.core.model.type.OseeEnumTypeFactory; import org.eclipse.osee.framework.core.model.type.RelationTypeFactory; import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.core.translation.ITranslatorId; @@ -63,11 +53,8 @@ public class DataTranslationServiceFactoryTest { public void testServiceCreation() throws OseeCoreException { DataTranslationService srvc = new DataTranslationService(); srvc.setModelFactory(new MockModelFactoryService()); - srvc.setTempCachingService(new MockOseeCachingService()); srvc.start(); - checkExists(srvc, TransactionRecordTranslator.class, CoreTranslatorId.TRANSACTION_RECORD); - checkExists(srvc, BranchCreationRequestTranslator.class, CoreTranslatorId.BRANCH_CREATION_REQUEST); checkExists(srvc, BranchCreationResponseTranslator.class, CoreTranslatorId.BRANCH_CREATION_RESPONSE); @@ -86,9 +73,6 @@ public class DataTranslationServiceFactoryTest { CoreTranslatorId.RELATION_TYPE_CACHE_UPDATE_RESPONSE); checkExists(srvc, OseeEnumTypeCacheUpdateResponseTranslator.class, CoreTranslatorId.OSEE_ENUM_TYPE_CACHE_UPDATE_RESPONSE); - checkExists(srvc, BranchCacheUpdateResponseTranslator.class, CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE); - checkExists(srvc, BranchCacheStoreRequestTranslator.class, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); - checkExists(srvc, TransactionCacheUpdateResponseTranslator.class, CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE); checkExists(srvc, OseeImportModelRequestTranslator.class, CoreTranslatorId.OSEE_IMPORT_MODEL_REQUEST); checkExists(srvc, OseeImportModelResponseTranslator.class, CoreTranslatorId.OSEE_IMPORT_MODEL_RESPONSE); @@ -138,37 +122,4 @@ public class DataTranslationServiceFactoryTest { } } - private final class MockOseeCachingService implements TempCachingService { - - @Override - public BranchCache getBranchCache() { - return null; - } - - @Override - public TransactionCache getTransactionCache() { - return null; - } - - @Override - public Collection<?> getCaches() { - return null; - } - - @Override - public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) { - return null; - } - - @Override - 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 deleted file mode 100644 index a17e4159a40..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * 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.translation; - -import java.util.ArrayList; -import java.util.Collection; -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.MockDataFactory; -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; -import org.eclipse.osee.framework.core.model.cache.TransactionCache; -import org.eclipse.osee.framework.core.translation.ITranslator; -import org.junit.Assert; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -/** - * Test Case for {@link TransactionCacheUpdateResponseTranslator} - * - * @author Roberto E. Escobar - */ -@RunWith(Parameterized.class) -public class TransactionCacheUpdateResponseTranslatorTest extends BaseTranslatorTest<TransactionCacheUpdateResponse> { - - public TransactionCacheUpdateResponseTranslatorTest(TransactionCacheUpdateResponse data, ITranslator<TransactionCacheUpdateResponse> translator) { - super(data, translator); - } - - @Override - protected void checkEquals(TransactionCacheUpdateResponse expected, TransactionCacheUpdateResponse actual) { - Assert.assertNotSame(expected, actual); - List<TransactionRecord> expectedRows = expected.getTxRows(); - List<TransactionRecord> actualRows = actual.getTxRows(); - Assert.assertEquals(expectedRows.size(), actualRows.size()); - for (int index = 0; index < expectedRows.size(); index++) { - DataAsserts.assertEquals(expectedRows.get(index), actualRows.get(index)); - } - } - - @Parameters - public static Collection<Object[]> data() { - BranchCache branchCache = new BranchCache(new MockOseeDataAccessor<Long, Branch>(), new TransactionCache()); - ITranslator<TransactionCacheUpdateResponse> translator = - new TransactionCacheUpdateResponseTranslator(new TransactionRecordFactory(), branchCache); - - List<Object[]> data = new ArrayList<Object[]>(); - for (int index = 1; index <= 2; index++) { - List<TransactionRecord> txRecords = new ArrayList<TransactionRecord>(); - for (int j = 1; j <= index; j++) { - txRecords.add(MockDataFactory.createTransaction(j, j * 3)); - } - data.add(new Object[] {new TransactionCacheUpdateResponse(txRecords), translator}); - } - return data; - } -} 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 deleted file mode 100644 index 370e022ce3e..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * 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.translation; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator; -import org.eclipse.osee.framework.core.model.cache.TransactionCache; -import org.eclipse.osee.framework.core.translation.ITranslator; -import org.junit.Assert; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -/** - * Test Case For {@link TransactionRecordTranslator} - * - * @author Roberto E. Escobar - */ -@RunWith(Parameterized.class) -public class TransactionRecordTranslatorTest extends BaseTranslatorTest<Integer> { - - public TransactionRecordTranslatorTest(Integer data, ITranslator<Integer> translator) { - super(data, translator); - } - - @Override - protected void checkEquals(Integer expected, Integer actual) { - Assert.assertEquals(expected, actual); - } - - @Parameters - public static Collection<Object[]> data() { - ITranslator<Integer> translator = new TransactionRecordTranslator(); - List<Object[]> data = new ArrayList<Object[]>(); - for (int index = 1; index <= 2; index++) { - data.add(new Object[] {index * 10, translator}); - } - return data; - } -} diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java index e3eca0bab21..4e327c7504d 100644 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java +++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java @@ -27,8 +27,6 @@ import org.junit.runners.Suite; OseeImportModelRequestTranslatorTest.class, OseeImportModelResponseTranslatorTest.class, TableDataTranslatorTest.class, - TransactionCacheUpdateResponseTranslatorTest.class, - TransactionRecordTranslatorTest.class, PurgeBranchRequestTranslatorTest.class, BranchChangeTypeRequestTranslatorTest.class, BranchChangeStateRequestTranslatorTest.class, diff --git a/plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.message.translation.service.xml b/plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.message.translation.service.xml index a36cadbb83d..6859f37fed9 100644 --- a/plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.message.translation.service.xml +++ b/plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.message.translation.service.xml @@ -5,5 +5,4 @@ <provide interface="org.eclipse.osee.framework.core.translation.IDataTranslationService"/> </service> <reference bind="setModelFactory" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/> - <reference bind="setTempCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.TempCachingService" name="TempCachingService" policy="static"/> </scr:component> diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java deleted file mode 100644 index fb607278c9a..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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; - -import java.util.Collection; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; - -/** - * @author Roberto E. Escobar - */ -public class BranchCacheStoreRequest extends AbstractBranchCacheMessage { - - private boolean isServerUpdateMessage; - - public BranchCacheStoreRequest() { - this.isServerUpdateMessage = false; - } - - public static BranchCacheStoreRequest fromCache(Collection<Branch> types) throws OseeCoreException { - BranchCacheStoreRequest request = new BranchCacheStoreRequest(); - BranchCacheUpdateUtil.loadFromCache(request, types); - return request; - } - - public void setServerUpdateMessage(boolean isServerUpdateMessage) { - this.isServerUpdateMessage = isServerUpdateMessage; - } - - public boolean isServerUpdateMessage() { - return isServerUpdateMessage; - } -} diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java deleted file mode 100644 index 4371b7ced9e..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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; - -import java.util.Collection; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; - -/** - * @author Roberto E. Escobar - */ -public class BranchCacheUpdateResponse extends AbstractBranchCacheMessage { - - public static BranchCacheUpdateResponse fromCache(IOseeCache<Long, Branch> cache, Collection<Branch> types) throws OseeCoreException { - BranchCacheUpdateResponse response = new BranchCacheUpdateResponse(); - BranchCacheUpdateUtil.loadFromCache(response, types); - return response; - } -} diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java deleted file mode 100644 index 3570986f04c..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import org.eclipse.osee.framework.core.data.IOseeBranch; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.core.model.BranchFactory; -import org.eclipse.osee.framework.core.model.MergeBranch; -import org.eclipse.osee.framework.core.model.TransactionRecord; -import org.eclipse.osee.framework.core.model.cache.BranchCache; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; -import org.eclipse.osee.framework.jdk.core.type.Triplet; - -/** - * @author Megumi Telles - */ -public final class BranchCacheUpdateUtil { - - private enum Fields { - BRANCH_COUNT, - BRANCH_ROW, - CHILD_TO_PARENT, - BRANCH_TO_BASE_TX, - BRANCH_TO_SRC_TX, - BRANCH_TO_ASSOC_ART, - BRANCH_TO_ALIASES, - SRC_DEST_MERGE; - } - - private final BranchFactory factory; - public static final Long DEFAULT_UUID = -1L; - private final BranchCache branchCache; - - public BranchCacheUpdateUtil(BranchFactory factory, BranchCache branchCache) { - this.factory = factory; - this.branchCache = branchCache; - } - - public Collection<Branch> updateCache(AbstractBranchCacheMessage cacheMessage) throws OseeCoreException { - List<Branch> updatedItems = new ArrayList<Branch>(); - - Map<Long, Integer> branchToAssocArt = cacheMessage.getBranchToAssocArt(); - - preLoadTransactions(cacheMessage); - - for (BranchRow srcItem : cacheMessage.getBranchRows()) { - long branchUuid = srcItem.getBranchId(); - Branch updated = - factory.createOrUpdate(branchCache, branchUuid, srcItem.getBranchName(), srcItem.getBranchType(), - srcItem.getBranchState(), srcItem.getBranchArchived().isArchived(), srcItem.getStorageState(), - srcItem.isInheritAccessControl()); - updatedItems.add(updated); - - Integer artifactId = branchToAssocArt.get(branchUuid); - if (artifactId != null) { - updated.setAssociatedArtifactId(artifactId); - } - - updated.setBaseTransaction(getTx(cacheMessage.getBranchToBaseTx(), branchUuid)); - updated.setSourceTransaction(getTx(cacheMessage.getBranchToSourceTx(), branchUuid)); - } - - for (Entry<Long, Long> entry : cacheMessage.getChildToParent().entrySet()) { - Branch parent = branchCache.getById(entry.getValue()); - if (parent != null) { - Branch child = branchCache.getById(entry.getKey()); - if (child != null) { - child.setParentBranch(parent); - } - } - } - for (Triplet<Long, Long, Long> entry : cacheMessage.getMergeBranches()) { - IOseeBranch sourceBranch = entry.getFirst() > 0 ? branchCache.getByGuid(entry.getFirst()) : null; - IOseeBranch destinationBranch = entry.getSecond() > 0 ? branchCache.getByGuid(entry.getSecond()) : null; - - Branch branch = branchCache.getByGuid(entry.getThird()); - MergeBranch mergeBranch = null; - try { - mergeBranch = (MergeBranch) branch; - mergeBranch.setSourceBranch(sourceBranch); - mergeBranch.setDestinationBranch(destinationBranch); - } catch (ClassCastException ex) { - throw new OseeCoreException(ex, "Problem casting branch [%s] to MergeBranch, source: [%s], dest: [%s]", - branch, sourceBranch, destinationBranch); - } - } - return updatedItems; - } - - private void preLoadTransactions(AbstractBranchCacheMessage cacheMessage) throws OseeCoreException { - Set<Integer> txIdsToLoad = new HashSet<Integer>(); - addValidTxIds(cacheMessage.getBranchToBaseTx().values(), txIdsToLoad); - addValidTxIds(cacheMessage.getBranchToSourceTx().values(), txIdsToLoad); - branchCache.loadTransactions(txIdsToLoad); - } - - private void addValidTxIds(Collection<Integer> source, Collection<Integer> destination) { - for (Integer txId : source) { - if (txId != null && txId > 0) { - destination.add(txId); - } - } - } - - private TransactionRecord getTx(Map<Long, Integer> branchToTx, Long branchUuid) throws OseeCoreException { - TransactionRecord tx = null; - Integer txId = branchToTx.get(branchUuid); - if (txId != null && txId > 0) { - tx = branchCache.getOrLoad(txId); - } - return tx; - } - - public static void loadFromCache(AbstractBranchCacheMessage message, Collection<Branch> types) throws OseeCoreException { - for (Branch br : types) { - Long branchUuid = br.getUuid(); - message.getBranchRows().add( - new BranchRow(br.getUuid(), br.getName(), br.getBranchType(), br.getBranchState(), br.getArchiveState(), - br.getStorageState(), br.isInheritAccessControl())); - if (br.hasParentBranch()) { - message.getChildToParent().put(branchUuid, br.getParentBranch().getUuid()); - } - addTxRecord(message.getBranchToBaseTx(), branchUuid, br.getBaseTransaction()); - addTxRecord(message.getBranchToSourceTx(), branchUuid, br.getSourceTransaction()); - addAssocArtifact(message.getBranchToAssocArt(), branchUuid, br.getAssociatedArtifactId()); - if (br.getBranchType().isMergeBranch()) { - addMergeBranches(message.getMergeBranches(), (MergeBranch) br); - } - } - } - - private static void addAssocArtifact(Map<Long, Integer> map, Long branchUuid, Integer artId) { - if (artId != null) { - map.put(branchUuid, artId); - } else { - map.put(branchUuid, -1); - } - } - - private static void addMergeBranches(List<Triplet<Long, Long, Long>> srcDestMerge, MergeBranch mergeBranch) throws OseeCoreException { - Long src = mergeBranch.getSourceBranch() != null ? mergeBranch.getSourceBranch().getGuid() : DEFAULT_UUID; - Long dest = - mergeBranch.getDestinationBranch() != null ? mergeBranch.getDestinationBranch().getGuid() : DEFAULT_UUID; - Long merge = mergeBranch.getUuid(); - srcDestMerge.add(new Triplet<Long, Long, Long>(src, dest, merge)); - } - - private static void addTxRecord(Map<Long, Integer> map, Long branchUuid, TransactionRecord toAdd) { - if (toAdd != null) { - map.put(branchUuid, toAdd.getId()); - } else { - map.put(branchUuid, -1); - } - } - - public static void loadMessage(AbstractBranchCacheMessage message, PropertyStore store) { - List<BranchRow> rows = message.getBranchRows(); - int rowCount = store.getInt(Fields.BRANCH_COUNT.name()); - for (int index = 0; index < rowCount; index++) { - String[] rowData = store.getArray(TranslationUtil.createKey(Fields.BRANCH_ROW, index)); - rows.add(BranchRow.fromArray(rowData)); - } - TranslationUtil.loadMapLong(message.getChildToParent(), store, Fields.CHILD_TO_PARENT); - TranslationUtil.loadMap(message.getBranchToBaseTx(), store, Fields.BRANCH_TO_BASE_TX); - TranslationUtil.loadMap(message.getBranchToSourceTx(), store, Fields.BRANCH_TO_SRC_TX); - TranslationUtil.loadMap(message.getBranchToAssocArt(), store, Fields.BRANCH_TO_ASSOC_ART); - TranslationUtil.loadArrayMap(message.getBranchAliases(), store, Fields.BRANCH_TO_ALIASES); - TranslationUtil.loadTripletListForMergeBranches(message.getMergeBranches(), store, Fields.SRC_DEST_MERGE); - } - - public static void loadStore(PropertyStore store, AbstractBranchCacheMessage message) { - List<BranchRow> rows = message.getBranchRows(); - for (int index = 0; index < rows.size(); index++) { - BranchRow row = rows.get(index); - store.put(TranslationUtil.createKey(Fields.BRANCH_ROW, index), row.toArray()); - } - store.put(Fields.BRANCH_COUNT.name(), rows.size()); - - TranslationUtil.putMapLong(store, Fields.CHILD_TO_PARENT, message.getChildToParent()); - TranslationUtil.putMap(store, Fields.BRANCH_TO_BASE_TX, message.getBranchToBaseTx()); - TranslationUtil.putMap(store, Fields.BRANCH_TO_SRC_TX, message.getBranchToSourceTx()); - TranslationUtil.putMap(store, Fields.BRANCH_TO_ASSOC_ART, message.getBranchToAssocArt()); - TranslationUtil.putArrayMap(store, Fields.BRANCH_TO_ALIASES, message.getBranchAliases()); - TranslationUtil.putTripletList(store, Fields.SRC_DEST_MERGE, message.getMergeBranches()); - } -} diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java index 26693a6baea..8dab3ffc464 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java @@ -21,7 +21,6 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory; import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.core.translation.ITranslatorId; @@ -40,22 +39,17 @@ public class DataTranslationService implements IDataTranslationService { new ConcurrentHashMap<ITranslatorId, ITranslator<?>>(); private IOseeModelFactoryService modelFactory; - private TempCachingService cachingService; public void setModelFactory(IOseeModelFactoryService modelFactory) { this.modelFactory = modelFactory; } - public void setTempCachingService(TempCachingService cachingService) { - this.cachingService = cachingService; - } - public void start() throws OseeCoreException { TransactionRecordFactory txFactory = modelFactory.getTransactionFactory(); AttributeTypeFactory attributeTypeFactory = modelFactory.getAttributeTypeFactory(); translators.clear(); - factoryConfigurator.configureService(this, txFactory, attributeTypeFactory, cachingService); + factoryConfigurator.configureService(this, txFactory, attributeTypeFactory); } public void stop() { diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java index a8b4e85665a..e7268c10465 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java @@ -13,8 +13,6 @@ package org.eclipse.osee.framework.core.message.internal; import org.eclipse.osee.framework.core.enums.CoreTranslatorId; import org.eclipse.osee.framework.core.message.internal.translation.ArtifactTypeCacheUpdateResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.AttributeTypeCacheUpdateResponseTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheStoreRequestTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheUpdateResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeArchivedStateRequestTranslator; import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeStateRequestTranslator; import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeTypeRequestTranslator; @@ -32,12 +30,8 @@ import org.eclipse.osee.framework.core.message.internal.translation.OseeImportMo import org.eclipse.osee.framework.core.message.internal.translation.PurgeBranchRequestTranslator; import org.eclipse.osee.framework.core.message.internal.translation.RelationTypeCacheUpdateResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator; -import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; -import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -51,15 +45,12 @@ public class DataTranslationServiceFactory { // } - public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory, TempCachingService cachingService) throws OseeCoreException { - BranchCache branchCache = cachingService.getBranchCache(); - service.addTranslator(new TransactionRecordTranslator(), CoreTranslatorId.TRANSACTION_RECORD); - + public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory) throws OseeCoreException { service.addTranslator(new BranchCreationRequestTranslator(), CoreTranslatorId.BRANCH_CREATION_REQUEST); service.addTranslator(new BranchCreationResponseTranslator(), CoreTranslatorId.BRANCH_CREATION_RESPONSE); service.addTranslator(new BranchCommitRequestTranslator(), CoreTranslatorId.BRANCH_COMMIT_REQUEST); - service.addTranslator(new BranchCommitResponseTranslator(service), CoreTranslatorId.BRANCH_COMMIT_RESPONSE); + service.addTranslator(new BranchCommitResponseTranslator(), CoreTranslatorId.BRANCH_COMMIT_RESPONSE); service.addTranslator(new BranchChangeTypeRequestTranslator(), CoreTranslatorId.CHANGE_BRANCH_TYPE); service.addTranslator(new BranchChangeStateRequestTranslator(), CoreTranslatorId.CHANGE_BRANCH_STATE); @@ -72,11 +63,6 @@ public class DataTranslationServiceFactory { service.addTranslator(new CacheUpdateRequestTranslator(), CoreTranslatorId.OSEE_CACHE_UPDATE_REQUEST); - service.addTranslator(new BranchCacheUpdateResponseTranslator(), CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE); - service.addTranslator(new BranchCacheStoreRequestTranslator(), CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); - service.addTranslator(new TransactionCacheUpdateResponseTranslator(txRecordFactory, branchCache), - CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE); - service.addTranslator(new ArtifactTypeCacheUpdateResponseTranslator(), CoreTranslatorId.ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE); diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java deleted file mode 100644 index 257b945da9c..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheStoreRequestTranslator.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * 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.internal.translation; - -import org.eclipse.osee.framework.core.message.BranchCacheStoreRequest; -import org.eclipse.osee.framework.core.message.BranchCacheUpdateUtil; -import org.eclipse.osee.framework.core.translation.ITranslator; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; - -/** - * @author Roberto E. Escobar - * @author Jeff C. Phillips - */ -public class BranchCacheStoreRequestTranslator implements ITranslator<BranchCacheStoreRequest> { - - private static enum Field { - IS_SERVER_MESSAGE; - } - - @Override - public BranchCacheStoreRequest convert(PropertyStore store) { - BranchCacheStoreRequest request = new BranchCacheStoreRequest(); - BranchCacheUpdateUtil.loadMessage(request, store); - request.setServerUpdateMessage(store.getBoolean(Field.IS_SERVER_MESSAGE.name())); - return request; - } - - @Override - public PropertyStore convert(BranchCacheStoreRequest object) { - PropertyStore store = new PropertyStore(); - BranchCacheUpdateUtil.loadStore(store, object); - store.put(Field.IS_SERVER_MESSAGE.name(), object.isServerUpdateMessage()); - return store; - } -} diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java deleted file mode 100644 index 2fa8e133ab7..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCacheUpdateResponseTranslator.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * 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.internal.translation; - -import org.eclipse.osee.framework.core.message.BranchCacheUpdateResponse; -import org.eclipse.osee.framework.core.message.BranchCacheUpdateUtil; -import org.eclipse.osee.framework.core.translation.ITranslator; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; - -/** - * @author Roberto E. Escobar - * @author Jeff C. Phillips - */ -public class BranchCacheUpdateResponseTranslator implements ITranslator<BranchCacheUpdateResponse> { - - @Override - public BranchCacheUpdateResponse convert(PropertyStore store) { - BranchCacheUpdateResponse response = new BranchCacheUpdateResponse(); - BranchCacheUpdateUtil.loadMessage(response, store); - return response; - } - - @Override - public PropertyStore convert(BranchCacheUpdateResponse object) { - PropertyStore store = new PropertyStore(); - BranchCacheUpdateUtil.loadStore(store, object); - return store; - } -} diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java index f9c79e4ff7b..41f77b083f3 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java @@ -10,9 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.message.internal.translation; -import org.eclipse.osee.framework.core.enums.CoreTranslatorId; import org.eclipse.osee.framework.core.message.BranchCommitResponse; -import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; @@ -26,17 +24,10 @@ public class BranchCommitResponseTranslator implements ITranslator<BranchCommitR TRANSACTION_NUMBER } - private final IDataTranslationService service; - - public BranchCommitResponseTranslator(IDataTranslationService service) { - this.service = service; - } - @Override public BranchCommitResponse convert(PropertyStore propertyStore) throws OseeCoreException { BranchCommitResponse response = new BranchCommitResponse(); - PropertyStore innerStore = propertyStore.getPropertyStore(Entry.TRANSACTION_NUMBER.name()); - Integer transactionRecord = service.convert(innerStore, CoreTranslatorId.TRANSACTION_RECORD); + Integer transactionRecord = propertyStore.getInt(Entry.TRANSACTION_NUMBER.name()); response.setTransactionId(transactionRecord); return response; } @@ -45,8 +36,7 @@ public class BranchCommitResponseTranslator implements ITranslator<BranchCommitR public PropertyStore convert(BranchCommitResponse data) throws OseeCoreException { PropertyStore store = new PropertyStore(); Integer record = data.getTransactionId(); - PropertyStore property = service.convert(record, CoreTranslatorId.TRANSACTION_RECORD); - store.put(Entry.TRANSACTION_NUMBER.name(), property); + store.put(Entry.TRANSACTION_NUMBER.name(), record); return store; } 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 deleted file mode 100644 index 55a4d436105..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * 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.internal.translation; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import org.eclipse.osee.framework.core.enums.TransactionDetailsType; -import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse; -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; -import org.eclipse.osee.framework.core.translation.ITranslator; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; - -/** - * @author Roberto E. Escobar - * @author Jeff C. Phillips - */ -public class TransactionCacheUpdateResponseTranslator implements ITranslator<TransactionCacheUpdateResponse> { - - private static enum Fields { - TX_COUNT, - TX_ROW, - TX_TO_BRANCH; - } - - private final TransactionRecordFactory txRecordFactory; - private final BranchCache branchCache; - - public TransactionCacheUpdateResponseTranslator(TransactionRecordFactory txRecordFactory, BranchCache branchCache) { - this.txRecordFactory = txRecordFactory; - this.branchCache = branchCache; - } - - private TransactionRecordFactory getFactory() { - return txRecordFactory; - } - - @Override - public TransactionCacheUpdateResponse convert(PropertyStore store) throws OseeCoreException { - TransactionRecordFactory factory = getFactory(); - List<TransactionRecord> rows = new ArrayList<TransactionRecord>(); - int rowCount = store.getInt(Fields.TX_COUNT.name()); - for (int index = 0; index < rowCount; index++) { - String[] rowData = store.getArray(createKey(Fields.TX_ROW, index)); - rows.add(fromArray(factory, rowData)); - } - return new TransactionCacheUpdateResponse(rows); - } - - @Override - public PropertyStore convert(TransactionCacheUpdateResponse object) { - PropertyStore store = new PropertyStore(); - List<TransactionRecord> rows = object.getTxRows(); - for (int index = 0; index < rows.size(); index++) { - TransactionRecord row = rows.get(index); - store.put(createKey(Fields.TX_ROW, index), toArray(row)); - } - store.put(Fields.TX_COUNT.name(), rows.size()); - return store; - } - - private String createKey(Fields key, int index) { - return String.format("%s_%s", key.name(), index); - } - - private String[] toArray(TransactionRecord row) { - return new String[] { - String.valueOf(row.getId()), - row.getTxType().name(), - row.getComment(), - String.valueOf(row.getTimeStamp().getTime()), - String.valueOf(row.getAuthor()), - String.valueOf(row.getCommit()), - String.valueOf(row.getBranchId())}; - } - - private TransactionRecord fromArray(TransactionRecordFactory factory, String[] data) throws OseeCoreException { - int index = 0; - int txId = Integer.valueOf(data[index++]); - TransactionDetailsType txType = TransactionDetailsType.valueOf(data[index++]); - String comment = data[index++]; - Date timeStamp = new Date(Long.valueOf(data[index++])); - int authorArtId = Integer.valueOf(data[index++]); - int commitArtId = Integer.valueOf(data[index++]); - long branchUuid = Long.valueOf(data[index++]); - return factory.create(txId, branchUuid, comment, timeStamp, authorArtId, commitArtId, txType, branchCache); - } -} diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java deleted file mode 100644 index beb7f785c3c..00000000000 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * 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.internal.translation; - -import org.eclipse.osee.framework.core.translation.ITranslator; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; - -/** - * @author Roberto E. Escobar - */ -public final class TransactionRecordTranslator implements ITranslator<Integer> { - - private static enum Entry { - TRANSACTION_ID, - } - - @Override - public Integer convert(PropertyStore store) throws OseeCoreException { - return store.getInt(Entry.TRANSACTION_ID.name()); - } - - @Override - public PropertyStore convert(Integer transactionId) { - PropertyStore store = new PropertyStore(); - store.put(Entry.TRANSACTION_ID.name(), transactionId); - return store; - } -} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java index d7e4797219c..9db161681db 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java @@ -38,9 +38,6 @@ public enum CoreTranslatorId implements ITranslatorId { ATTRIBUTE_TYPE_CACHE_UPDATE_RESPONSE, RELATION_TYPE_CACHE_UPDATE_RESPONSE, OSEE_ENUM_TYPE_CACHE_UPDATE_RESPONSE, - TX_CACHE_UPDATE_RESPONSE, - BRANCH_CACHE_UPDATE_RESPONSE, - BRANCH_CACHE_STORE_REQUEST, TRANSACTION_RECORD, BRANCH_CREATION_REQUEST, diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/branch.update.event.handler.xml b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/branch.update.event.handler.xml deleted file mode 100644 index e595b384cbb..00000000000 --- a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/branch.update.event.handler.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.framework.manager.servlet.internal.BranchUpdateEventHandler"> - <implementation class="org.eclipse.osee.framework.manager.servlet.internal.BranchUpdateEventHandler"/> - <service> - <provide interface="org.eclipse.osee.event.EventHandler"/> - </service> - <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/> - <reference bind="setTranslationService" cardinality="1..1" interface="org.eclipse.osee.framework.core.translation.IDataTranslationService" name="IDataTranslationService" policy="static"/> - <reference bind="setServerLookup" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerLookup" name="IApplicationServerLookup" policy="static"/> - <reference bind="setAppServerManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerManager" name="IApplicationServerManager" policy="static"/> - <property name="event.topics" type="String" value="org/eclipse/osee/orcs/event/branch/MODIFIED"/> - <reference bind="setExecutor" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/> -</scr:component> diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml index 89a972f4a23..7248ab8dd45 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml +++ b/plugins/org.eclipse.osee.framework.manager.servlet/OSGI-INF/legacy.servlets.xml @@ -7,7 +7,6 @@ <reference bind="setSessionManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.ISessionManager" name="ISessionManager" policy="static"/> <reference bind="setAppServerManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IApplicationServerManager" name="IApplicationServerManager" policy="static"/> <reference bind="setTranslationService" cardinality="1..1" interface="org.eclipse.osee.framework.core.translation.IDataTranslationService" name="IDataTranslationService" policy="static"/> - <reference bind="setCaching" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.TempCachingService" name="TempCachingService" policy="static"/> <reference bind="setAuthenticationManager" cardinality="1..1" interface="org.eclipse.osee.framework.core.server.IAuthenticationManager" name="IAuthenticationManager" policy="static"/> <reference bind="setFactoryService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/> <reference bind="setResourceManager" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceManager" name="IResourceManager" policy="static"/> diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/build.properties b/plugins/org.eclipse.osee.framework.manager.servlet/build.properties index c79412ce3f1..6210e849b59 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/build.properties +++ b/plugins/org.eclipse.osee.framework.manager.servlet/build.properties @@ -1,7 +1,5 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ - OSGI-INF/,\ - OSGI-INF/legacy.servlets.xml,\ - OSGI-INF/branch.update.event.handler.xml + OSGI-INF/ source.. = src/ diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java index dc038b34c57..2503a5a26e2 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ArtifactFileServlet.java @@ -18,8 +18,6 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.exception.OseeExceptions; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; @@ -36,6 +34,8 @@ import org.eclipse.osee.framework.resource.management.StandardOptions; import org.eclipse.osee.logger.Log; import org.eclipse.osee.orcs.OrcsApi; import org.eclipse.osee.orcs.data.ArtifactReadable; +import org.eclipse.osee.orcs.data.BranchReadable; +import org.eclipse.osee.orcs.search.BranchQuery; /** * @author Roberto E. Escobar @@ -51,13 +51,11 @@ public class ArtifactFileServlet extends UnsecuredOseeHttpServlet { private static final String MAPPING_ART = "ABKY9QDQLSaHQBiRC7wA"; private final IResourceManager resourceManager; - private final BranchCache branchCache; private final OrcsApi orcs; - public ArtifactFileServlet(Log logger, IResourceManager resourceManager, BranchCache branchCache, OrcsApi orcs) { + public ArtifactFileServlet(Log logger, IResourceManager resourceManager, OrcsApi orcs) { super(logger); this.resourceManager = resourceManager; - this.branchCache = branchCache; this.orcs = orcs; } @@ -89,12 +87,13 @@ public class ArtifactFileServlet extends UnsecuredOseeHttpServlet { } String uri = null; - Branch branch = null; + BranchQuery query = orcs.getQueryFactory(null).branchQuery(); if (branchName != null) { - branch = branchCache.getBySoleName(branchName); + query.andNameEquals(branchName); } else if (branchUuid != null) { - branch = branchCache.getByGuid(branchUuid); + query.andUuids(branchUuid); } + BranchReadable branch = query.getResults().getExactlyOne(); Conditions.checkNotNull(branch, "branch", "Unable to determine branch"); uri = ArtifactUtil.getUri(artifactGuid, branch); handleArtifactUri(resourceManager, request.getQueryString(), uri, response); diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java index 9122b008a73..3814d76af7e 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/AtsServlet.java @@ -15,7 +15,6 @@ import java.net.URL; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; import org.eclipse.osee.framework.manager.servlet.ats.AtsService; @@ -27,6 +26,7 @@ import org.eclipse.osee.framework.resource.management.IResource; import org.eclipse.osee.framework.resource.management.IResourceLocator; import org.eclipse.osee.framework.resource.management.IResourceManager; import org.eclipse.osee.logger.Log; +import org.eclipse.osee.orcs.OrcsApi; /** * @author Roberto E. Escobar @@ -39,13 +39,13 @@ public class AtsServlet extends UnsecuredOseeHttpServlet { private final IResourceManager resourceManager; - public AtsServlet(Log logger, IResourceManager resourceManager, TempCachingService cacheService) { + public AtsServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi) { super(logger); this.resourceManager = resourceManager; AtsService.IResourceProvider provider = new ResourceProvider(); AtsXmlSearch xmlSearch = new AtsXmlSearch(); AtsXmlMessages messages = new AtsXmlMessages(new XmlMessage(getLogger())); - this.atsService = new AtsService(provider, xmlSearch, messages, resourceManager, cacheService); + this.atsService = new AtsService(provider, xmlSearch, messages, resourceManager, orcsApi); } @Override diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java index 78f1ddb2ff3..f390b4e6ba0 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/DataServlet.java @@ -17,9 +17,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.osee.framework.core.exception.OseeNotFoundException; -import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Conditions; import org.eclipse.osee.framework.jdk.core.util.Lib; @@ -27,25 +25,28 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.manager.servlet.data.ArtifactUtil; import org.eclipse.osee.framework.resource.management.IResourceManager; import org.eclipse.osee.logger.Log; +import org.eclipse.osee.orcs.OrcsApi; +import org.eclipse.osee.orcs.data.BranchReadable; +import org.eclipse.osee.orcs.search.BranchQuery; public class DataServlet extends UnsecuredOseeHttpServlet { private static final long serialVersionUID = -1399699606153734250L; private final IResourceManager resourceManager; - private final BranchCache branchCache; + private final OrcsApi orcsApi; - public DataServlet(Log logger, IResourceManager resourceManager, TempCachingService cacheService) { + public DataServlet(Log logger, IResourceManager resourceManager, OrcsApi orcsApi) { super(logger); this.resourceManager = resourceManager; - branchCache = cacheService.getBranchCache(); + this.orcsApi = orcsApi; } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String urlRequest = request.getRequestURI(); try { - handleUriRequest(resourceManager, urlRequest, response, branchCache); + handleUriRequest(resourceManager, urlRequest, response, orcsApi); } catch (OseeCoreException ex) { handleError(response, HttpURLConnection.HTTP_INTERNAL_ERROR, "", ex); } @@ -57,12 +58,15 @@ public class DataServlet extends UnsecuredOseeHttpServlet { response.sendError(status, Lib.exceptionToString(ex)); } - public static void handleUriRequest(IResourceManager resourceManager, String urlRequest, HttpServletResponse response, BranchCache branchCache) throws OseeCoreException { + public static void handleUriRequest(IResourceManager resourceManager, String urlRequest, HttpServletResponse response, OrcsApi orcsApi) throws OseeCoreException { UrlParser parser = new UrlParser(); parser.parse(urlRequest); Long branchUuid = Long.valueOf(parser.getAttribute("branch")); String artifactGuid = parser.getAttribute("artifact"); - String uri = ArtifactUtil.getUri(artifactGuid, branchCache.getByGuid(branchUuid)); + BranchQuery query = orcsApi.getQueryFactory(null).branchQuery(); + BranchReadable branch = query.andUuids(branchUuid).getResults().getExactlyOne(); + + String uri = ArtifactUtil.getUri(artifactGuid, branch); ArtifactFileServlet.handleArtifactUri(resourceManager, urlRequest, uri, response); } diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java index 5f896508984..b60d4884344 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeCacheServlet.java @@ -34,21 +34,12 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions; import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse; import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse.ArtifactTypeRow; import org.eclipse.osee.framework.core.message.AttributeTypeCacheUpdateResponse; -import org.eclipse.osee.framework.core.message.BranchCacheStoreRequest; -import org.eclipse.osee.framework.core.message.BranchCacheUpdateResponse; -import org.eclipse.osee.framework.core.message.BranchCacheUpdateUtil; import org.eclipse.osee.framework.core.message.CacheUpdateRequest; import org.eclipse.osee.framework.core.message.OseeEnumTypeCacheUpdateResponse; import org.eclipse.osee.framework.core.message.RelationTypeCacheUpdateResponse; import org.eclipse.osee.framework.core.message.RelationTypeCacheUpdateResponse.RelationTypeRow; -import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.core.model.TransactionRecord; -import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.model.type.AttributeType; import org.eclipse.osee.framework.core.server.UnsecuredOseeHttpServlet; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslatorId; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; @@ -75,17 +66,13 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet { private static final long serialVersionUID = 6693534844874109524L; private final IDataTranslationService translationService; - private final IOseeModelFactoryService factoryService; - private final BranchCache branchCache; private final OrcsApi orcsApi; private static final StorageState DEFAULT_STORAGE_STATE = StorageState.CREATED; - public OseeCacheServlet(Log logger, IDataTranslationService translationService, TempCachingService cachingService, OrcsApi orcsApi, IOseeModelFactoryService factoryService) { + public OseeCacheServlet(Log logger, IDataTranslationService translationService, OrcsApi orcsApi) { super(logger); this.translationService = translationService; - this.branchCache = cachingService.getBranchCache(); this.orcsApi = orcsApi; - this.factoryService = factoryService; } public IDataTranslationService getTranslationService() { @@ -121,9 +108,6 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet { OrcsTypes orcsTypes = orcsApi.getOrcsTypes(context); sendUpdates(req, resp, orcsTypes); break; - case STORE: - storeUpdates(req, resp); - break; default: throw new UnsupportedOperationException(); } @@ -146,45 +130,6 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet { resp.getWriter().close(); } - private void storeUpdates(HttpServletRequest req, HttpServletResponse resp) throws OseeCoreException { - IDataTranslationService service = getTranslationService(); - - BranchCacheStoreRequest updateRequest = null; - InputStream inputStream = null; - try { - inputStream = req.getInputStream(); - updateRequest = service.convert(inputStream, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); - } catch (IOException ex) { - OseeExceptions.wrapAndThrow(ex); - } finally { - Lib.close(inputStream); - } - Collection<Branch> updated = - new BranchCacheUpdateUtil(factoryService.getBranchFactory(), branchCache).updateCache(updateRequest); - - if (updateRequest.isServerUpdateMessage()) { - for (Branch branch : updated) { - if (branch.isCreated()) { - branch.setStorageState(StorageState.MODIFIED); - } - branch.clearDirty(); - if (branch.isPurged()) { - branchCache.decache(branch); - } - } - } else { - branchCache.storeItems(updated); - } - try { - resp.setStatus(HttpServletResponse.SC_ACCEPTED); - resp.setContentType("text/plain"); - resp.setCharacterEncoding("UTF-8"); - resp.getWriter().write("Branch Store Successful"); - } catch (IOException ex) { - OseeExceptions.wrapAndThrow(ex); - } - } - private void sendUpdates(HttpServletRequest req, HttpServletResponse resp, OrcsTypes orcsTypes) throws OseeCoreException { IDataTranslationService service = getTranslationService(); @@ -219,25 +164,6 @@ public class OseeCacheServlet extends UnsecuredOseeHttpServlet { Object response = null; ITranslatorId transalatorId = null; switch (updateRequest.getCacheId()) { - case BRANCH_CACHE: - response = BranchCacheUpdateResponse.fromCache(branchCache, branchCache.getAll()); - transalatorId = CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE; - break; - case TRANSACTION_CACHE: - Collection<TransactionRecord> record; - - if (updateRequest.getItemsIds().isEmpty()) { - record = branchCache.getAllTx(); - } else { - record = new ArrayList<TransactionRecord>(); - branchCache.loadTransactions(updateRequest.getItemsIds()); - for (Integer item : updateRequest.getItemsIds()) { - record.add(branchCache.getByTxId(item)); - } - } - response = TransactionCacheUpdateResponse.fromCache(factoryService.getTransactionFactory(), record); - transalatorId = CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE; - break; case ARTIFACT_TYPE_CACHE: response = createArtifactTypeCacheUpdateResponse(orcsTypes); transalatorId = CoreTranslatorId.ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE; diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java index 0d66a8e9bb6..900dbb90747 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/ats/AtsService.java @@ -13,13 +13,12 @@ package org.eclipse.osee.framework.manager.servlet.ats; import java.util.Collection; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.osee.framework.core.model.cache.BranchCache; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.manager.servlet.DataServlet; import org.eclipse.osee.framework.resource.management.IResource; import org.eclipse.osee.framework.resource.management.IResourceManager; +import org.eclipse.osee.orcs.OrcsApi; import org.w3c.dom.Node; /** @@ -45,14 +44,14 @@ public class AtsService { private final AtsXmlSearch xmlSearch; private final AtsXmlMessages messages; private final IResourceManager resourceManager; - private final BranchCache branchCache; + private final OrcsApi orcsApi; - public AtsService(IResourceProvider resourceProvider, AtsXmlSearch xmlSearch, AtsXmlMessages messages, IResourceManager resourceManager, TempCachingService cacheService) { + public AtsService(IResourceProvider resourceProvider, AtsXmlSearch xmlSearch, AtsXmlMessages messages, IResourceManager resourceManager, OrcsApi orcsApi) { this.xmlSearch = xmlSearch; this.messages = messages; this.resourceProvider = resourceProvider; this.resourceManager = resourceManager; - branchCache = cacheService.getBranchCache(); + this.orcsApi = orcsApi; } public void performOperation(IResource resource, HttpServletResponse response) { @@ -135,7 +134,7 @@ public class AtsService { urlPath = request.getRequestURI().replace(servletPath, ""); if (urlPath.contains("osee/data")) { - DataServlet.handleUriRequest(resourceManager, urlPath, response, branchCache); + DataServlet.handleUriRequest(resourceManager, urlPath, response, orcsApi); return; } else { resource = getResource(urlPath); diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java index 49702d4ec3c..7bf293529a7 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/data/ArtifactUtil.java @@ -11,9 +11,9 @@ package org.eclipse.osee.framework.manager.servlet.data; import org.eclipse.osee.framework.core.enums.TxChange; -import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.database.core.ConnectionHandler; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.orcs.data.BranchReadable; /** * @author Roberto E. Escobar @@ -22,13 +22,13 @@ public class ArtifactUtil { private static final String URI_BY_GUID = "SELECT att.uri FROM osee_artifact art, osee_attribute att, %s txs where art.guid = ? and art.art_id = att.art_id and att.uri is not null and att.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.tx_current = ?"; - public static String getUri(String artifactGuid, Branch branch) throws OseeCoreException { + public static String getUri(String artifactGuid, BranchReadable branch) throws OseeCoreException { String sql = String.format(URI_BY_GUID, getTransactionTable(branch)); return ConnectionHandler.runPreparedQueryFetchString("", sql, artifactGuid, branch.getUuid(), TxChange.CURRENT.getValue()); } - private static String getTransactionTable(Branch branch) { + private static String getTransactionTable(BranchReadable branch) { return branch.getArchiveState().isArchived() ? "osee_txs_archived" : "osee_txs"; } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/BranchUpdateEventHandler.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/BranchUpdateEventHandler.java deleted file mode 100644 index d206edc8b86..00000000000 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/BranchUpdateEventHandler.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 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.manager.servlet.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import org.eclipse.osee.event.Event; -import org.eclipse.osee.event.EventHandler; -import org.eclipse.osee.executor.admin.ExecutorAdmin; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.core.server.IApplicationServerLookup; -import org.eclipse.osee.framework.core.server.IApplicationServerManager; -import org.eclipse.osee.framework.core.translation.IDataTranslationService; -import org.eclipse.osee.logger.Log; -import org.eclipse.osee.orcs.OrcsConstants; - -/** - * @author Roberto E. Escobar - */ -public class BranchUpdateEventHandler implements EventHandler { - - private Log logger; - private IDataTranslationService translationService; - private IApplicationServerLookup lookupService; - private IApplicationServerManager manager; - private ExecutorAdmin executor; - - public void setExecutor(ExecutorAdmin executor) { - this.executor = executor; - } - - public void setLogger(Log logger) { - this.logger = logger; - } - - public void setTranslationService(IDataTranslationService translationService) { - this.translationService = translationService; - } - - public void setServerLookup(IApplicationServerLookup lookupService) { - this.lookupService = lookupService; - } - - public void setAppServerManager(IApplicationServerManager manager) { - this.manager = manager; - } - - private boolean isReady() { - return logger != null && translationService != null && lookupService != null && manager != null; - } - - @Override - public void onEvent(Event event) { - if (isReady()) { - Collection<Branch> branches = getEventData(event); - List<Branch> branchToUpdate = new ArrayList<Branch>(); - for (Branch branch : branches) { - if (!branch.isDirty()) { - branchToUpdate.add(branch); - } - } - if (!branchToUpdate.isEmpty()) { - ServerBranchUpdateNotifier notifier = - new ServerBranchUpdateNotifier(logger, translationService, manager, lookupService, branchToUpdate, - executor); - try { - notifier.notifyServers(); - } catch (Exception ex) { - logger.error(ex, "Error notifying other servers"); - } - } - } - } - - @SuppressWarnings("unchecked") - private Collection<Branch> getEventData(Event event) { - Object object = event.getValue(OrcsConstants.ORCS_BRANCH_EVENT_DATA); - Collection<Branch> branches = null; - if (object instanceof Collection) { - branches = (Collection<Branch>) object; - } else { - branches = Collections.emptyList(); - } - return branches; - } -} diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerBranchUpdateNotifier.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerBranchUpdateNotifier.java deleted file mode 100644 index 2f6dcdae34d..00000000000 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServerBranchUpdateNotifier.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.manager.servlet.internal; - -import java.net.URI; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; -import org.eclipse.osee.executor.admin.ExecutorAdmin; -import org.eclipse.osee.framework.core.data.OseeServerContext; -import org.eclipse.osee.framework.core.enums.CacheOperation; -import org.eclipse.osee.framework.core.enums.CoreTranslatorId; -import org.eclipse.osee.framework.core.message.BranchCacheStoreRequest; -import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.core.server.IApplicationServerLookup; -import org.eclipse.osee.framework.core.server.IApplicationServerManager; -import org.eclipse.osee.framework.core.translation.IDataTranslationService; -import org.eclipse.osee.framework.core.util.HttpMessage; -import org.eclipse.osee.framework.core.util.HttpProcessor; -import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult; -import org.eclipse.osee.framework.jdk.core.util.HttpUrlBuilder; -import org.eclipse.osee.logger.Log; - -/** - * TODO: Temporary class used for backward server compatibility need to remove this and update servers using either - * distributed cache or JMS - * - * @author Roberto E. Escobar - */ -public class ServerBranchUpdateNotifier { - - private final Log logger; - private final IDataTranslationService translationService; - private final IApplicationServerLookup lookupService; - private final IApplicationServerManager manager; - private final ExecutorAdmin executor; - - private final Collection<Branch> branches; - - public ServerBranchUpdateNotifier(Log logger, IDataTranslationService translationService, IApplicationServerManager manager, IApplicationServerLookup lookUpProvider, Collection<Branch> branches, ExecutorAdmin executor) { - this.logger = logger; - this.translationService = translationService; - this.lookupService = lookUpProvider; - this.manager = manager; - this.branches = branches; - this.executor = executor; - } - - public void notifyServers() throws Exception { - logger.trace("Sending server update event for [%s]", branches); - - BranchCacheStoreRequest request = BranchCacheStoreRequest.fromCache(branches); - request.setServerUpdateMessage(true); - - Map<String, String> parameters = new HashMap<String, String>(); - parameters.put("function", CacheOperation.STORE.name()); - - List<Future<Void>> futures = new LinkedList<Future<Void>>(); - - for (URI serverUri : lookupService.getAvailableServerUris()) { - if (!manager.getServerUri().equals(serverUri)) { - ServerUpdateWorker worker = new ServerUpdateWorker(serverUri, parameters, request); - Future<Void> future = executor.schedule(worker); - futures.add(future); - } - } - - // wait for all requests to finish - for (Future<Void> future : futures) { - future.get(); - } - } - - private final class ServerUpdateWorker implements Callable<Void> { - - private final URI serverUri; - private final Map<String, String> parameters; - private final BranchCacheStoreRequest request; - - public ServerUpdateWorker(URI serverUri, Map<String, String> parameters, BranchCacheStoreRequest request) { - this.serverUri = serverUri; - this.parameters = parameters; - this.request = request; - } - - @Override - public Void call() throws Exception { - if (HttpProcessor.isAlive(serverUri)) { - try { - String urlString = HttpUrlBuilder.createURL(serverUri, OseeServerContext.CACHE_CONTEXT, parameters); - - AcquireResult updateResponse = - HttpMessage.send(urlString, translationService, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST, request, - null); - if (!updateResponse.wasSuccessful()) { - logger.error("Unsuccessful response when relaying branch updates to %s", serverUri); - } - } catch (Exception ex) { - logger.error(ex, "Error relaying branch updates to %s", serverUri); - } - } - return null; - } - } -} diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java index b9f07ebec15..f666fad2b8f 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/internal/ServletRegistrationHandler.java @@ -13,13 +13,10 @@ package org.eclipse.osee.framework.manager.servlet.internal; import java.util.HashSet; import java.util.Set; import org.eclipse.osee.framework.core.data.OseeServerContext; -import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.server.IApplicationServerManager; import org.eclipse.osee.framework.core.server.IAuthenticationManager; import org.eclipse.osee.framework.core.server.ISessionManager; import org.eclipse.osee.framework.core.server.OseeHttpServlet; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.manager.servlet.AdminServlet; import org.eclipse.osee.framework.manager.servlet.ArtifactFileServlet; @@ -51,9 +48,7 @@ public class ServletRegistrationHandler { private ISessionManager sessionManager; private IApplicationServerManager appServerManager; private IDataTranslationService translationService; - private TempCachingService caching; private IAuthenticationManager authenticationManager; - private IOseeModelFactoryService factoryService; private IResourceManager resourceManager; private OrcsApi orcsApi; @@ -71,18 +66,10 @@ public class ServletRegistrationHandler { this.translationService = translationService; } - public void setCaching(TempCachingService caching) { - this.caching = caching; - } - public void setAuthenticationManager(IAuthenticationManager authenticationManager) { this.authenticationManager = authenticationManager; } - public void setFactoryService(IOseeModelFactoryService factoryService) { - this.factoryService = factoryService; - } - public void setResourceManager(IResourceManager resourceManager) { this.resourceManager = resourceManager; } @@ -115,14 +102,11 @@ public class ServletRegistrationHandler { private void registerServices(BundleContext context) { contexts.clear(); - BranchCache branchCache = caching.getBranchCache(); register(new SystemManagerServlet(logger, sessionManager), OseeServerContext.MANAGER_CONTEXT); register(new ResourceManagerServlet(logger, sessionManager, resourceManager), OseeServerContext.RESOURCE_CONTEXT); - register(new ArtifactFileServlet(logger, resourceManager, branchCache, orcsApi), - OseeServerContext.PROCESS_CONTEXT); - register(new ArtifactFileServlet(logger, resourceManager, branchCache, orcsApi), - OseeServerContext.ARTIFACT_CONTEXT); - register(new ArtifactFileServlet(logger, resourceManager, branchCache, orcsApi), "index"); + register(new ArtifactFileServlet(logger, resourceManager, orcsApi), OseeServerContext.PROCESS_CONTEXT); + register(new ArtifactFileServlet(logger, resourceManager, orcsApi), OseeServerContext.ARTIFACT_CONTEXT); + register(new ArtifactFileServlet(logger, resourceManager, orcsApi), "index"); register(new BranchExchangeServlet(logger, sessionManager, resourceManager, orcsApi), OseeServerContext.BRANCH_EXCHANGE_CONTEXT); register(new BranchManagerServlet(logger, sessionManager, translationService, orcsApi), @@ -131,14 +115,13 @@ public class ServletRegistrationHandler { register(new SessionManagementServlet(logger, sessionManager, authenticationManager), OseeServerContext.SESSION_CONTEXT); register(new SessionClientLoopbackServlet(logger, sessionManager), OseeServerContext.CLIENT_LOOPBACK_CONTEXT); - register(new OseeCacheServlet(logger, translationService, caching, orcsApi, factoryService), - OseeServerContext.CACHE_CONTEXT); + register(new OseeCacheServlet(logger, translationService, orcsApi), OseeServerContext.CACHE_CONTEXT); register(new OseeModelServlet(logger, sessionManager, translationService, orcsApi), OseeServerContext.OSEE_MODEL_CONTEXT); - register(new AtsServlet(logger, resourceManager, caching), "osee/ats"); + register(new AtsServlet(logger, resourceManager, orcsApi), "osee/ats"); register(new ConfigurationServlet(logger, translationService, orcsApi), OseeServerContext.OSEE_CONFIGURE_CONTEXT); - register(new DataServlet(logger, resourceManager, caching), "osee/data"); + register(new DataServlet(logger, resourceManager, orcsApi), "osee/data"); register(new AdminServlet(logger, context), "osee/console"); } diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml index 1b89dd5e3ea..82f963bbc2a 100644 --- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml +++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml @@ -6,7 +6,6 @@ </service> <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/> <reference bind="setAttributeClassRegistry" cardinality="1..1" interface="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassRegistry" name="AttributeClassRegistry" policy="static"/> - <reference bind="setCacheService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.TempCachingService" name="TempCachingService" policy="static"/> <reference bind="setExecutorAdmin" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/> <reference bind="setSystemPreferences" cardinality="1..1" interface="org.eclipse.osee.orcs.core.SystemPreferences" name="SystemPreferences" policy="static"/> <reference bind="setOrcsDataStore" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.OrcsDataStore" name="OrcsDataStore" policy="static"/> diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml deleted file mode 100644 index d349a568477..00000000000 --- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.orcs.core.internal.console.CacheUpdateCommand"> - <implementation class="org.eclipse.osee.orcs.core.internal.console.CacheUpdateCommand"/> - <service> - <provide interface="org.eclipse.osee.console.admin.ConsoleCommand"/> - </service> - <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/> - <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.TempCachingService" name="IOseeCachingService" policy="static"/> -</scr:component> diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java index 71a1b982e09..9d343744d2f 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java @@ -18,7 +18,6 @@ import org.eclipse.osee.executor.admin.ExecutorAdmin; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.SystemUser; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.jdk.core.type.LazyObject; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; @@ -79,7 +78,6 @@ public class OrcsApiImpl implements OrcsApi { private Log logger; private OrcsDataStore dataStore; private AttributeClassRegistry registry; - private TempCachingService cacheService; private ExecutorAdmin executorAdmin; private SystemPreferences preferences; @@ -104,10 +102,6 @@ public class OrcsApiImpl implements OrcsApi { this.registry = registry; } - public void setCacheService(TempCachingService cacheService) { - this.cacheService = cacheService; - } - public void setExecutorAdmin(ExecutorAdmin executorAdmin) { this.executorAdmin = executorAdmin; } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java deleted file mode 100644 index 819c7f75365..00000000000 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * 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.orcs.core.internal.console; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.Callable; -import org.eclipse.osee.console.admin.Console; -import org.eclipse.osee.console.admin.ConsoleCommand; -import org.eclipse.osee.console.admin.ConsoleParameters; -import org.eclipse.osee.executor.admin.CancellableCallable; -import org.eclipse.osee.framework.core.enums.OseeCacheEnum; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; -import org.eclipse.osee.framework.core.services.TempCachingService; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.orcs.ApplicationContext; -import org.eclipse.osee.orcs.OrcsApi; -import org.eclipse.osee.orcs.OrcsTypes; - -/** - * @author Roberto E. Escobar - */ -public class CacheUpdateCommand implements ConsoleCommand { - - private static enum CacheType { - BRANCH_CACHE, - TRANSACTION_CACHE, - TYPE_CACHE; - } - - private OrcsApi orcsApi; - private TempCachingService cachingService; - - public void setOrcsApi(OrcsApi orcsApi) { - this.orcsApi = orcsApi; - } - - public OrcsApi getOrcsApi() { - return orcsApi; - } - - public TempCachingService getCachingService() { - return cachingService; - } - - public void setCachingService(TempCachingService cachingService) { - this.cachingService = cachingService; - } - - @Override - public String getName() { - return "cache_update"; - } - - @Override - public String getDescription() { - return "Updates server caches"; - } - - @Override - public String getUsage() { - StringBuilder builder = new StringBuilder(); - builder.append(" - Update all caches.\n"); - builder.append("cache=<"); - builder.append(Arrays.deepToString(CacheType.values()).replaceAll(",", " | ")); - builder.append("> - Caches to update.\n"); - return builder.toString(); - } - - @Override - public Callable<?> createCallable(Console console, ConsoleParameters params) { - return new CacheUpdateCallable(console, params); - } - - private class CacheUpdateCallable extends CancellableCallable<Boolean> { - - private final Console console; - private final ConsoleParameters params; - - public CacheUpdateCallable(Console console, ConsoleParameters params) { - this.console = console; - this.params = params; - } - - private Set<CacheType> getSelectedType() { - Set<CacheType> cacheIds = new HashSet<CacheType>(); - for (String cacheId : params.getArray("cacheId")) { - cacheIds.add(CacheType.valueOf(cacheId.toUpperCase())); - } - if (cacheIds.isEmpty()) { - for (CacheType type : CacheType.values()) { - cacheIds.add(type); - } - } - return cacheIds; - } - - private OrcsTypes getOrcTypes() { - return getOrcsApi().getOrcsTypes(new ApplicationContext() { - - @Override - public String getSessionId() { - return "Update Cache Console Command"; - } - }); - } - - @Override - public Boolean call() throws OseeCoreException { - OrcsTypes orcsTypes = getOrcTypes(); - - Set<CacheType> selectedType = getSelectedType(); - for (CacheType type : selectedType) { - OseeCacheEnum cacheId = null; - - if (CacheType.BRANCH_CACHE == type) { - cacheId = OseeCacheEnum.BRANCH_CACHE; - } else if (CacheType.TRANSACTION_CACHE == type) { - cacheId = OseeCacheEnum.TRANSACTION_CACHE; - } - - if (cacheId != null) { - IOseeCache<?, ?> cache = cachingService.getCache(cacheId); - cache.decacheAll(); - cache.reloadCache(); - } else { - orcsTypes.invalidateAll(); - } - } - console.writeln("Reloaded %s", selectedType); - return Boolean.TRUE; - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/orcs.data.store.impl.xml b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/orcs.data.store.impl.xml index 53e4692351f..9b52b607a59 100644 --- a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/orcs.data.store.impl.xml +++ b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/orcs.data.store.impl.xml @@ -3,7 +3,6 @@ <implementation class="org.eclipse.osee.orcs.db.internal.OrcsDataStoreImpl"/> <service> <provide interface="org.eclipse.osee.orcs.core.ds.OrcsDataStore"/> - <provide interface="org.eclipse.osee.framework.core.services.TempCachingService"/> </service> <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/> <reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/> @@ -11,6 +10,5 @@ <reference bind="setResourceManager" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceManager" name="IResourceManager" policy="static"/> <reference bind="setSystemPreferences" cardinality="1..1" interface="org.eclipse.osee.orcs.core.SystemPreferences" name="SystemPreferences" policy="static"/> <reference bind="setDataProxyFactoryProvider" cardinality="1..1" interface="org.eclipse.osee.orcs.db.internal.loader.DataProxyFactoryProvider" name="DataProxyFactoryProvider" policy="static"/> - <reference bind="setModelFactory" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/> <reference bind="setEventService" cardinality="1..1" interface="org.eclipse.osee.event.EventService" name="EventService" policy="static"/> </scr:component> diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java index 0fc07e352c5..fce8021010d 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java @@ -10,18 +10,10 @@ *******************************************************************************/ package org.eclipse.osee.orcs.db.internal; -import java.util.Collection; import org.eclipse.osee.event.EventService; import org.eclipse.osee.executor.admin.ExecutorAdmin; -import org.eclipse.osee.framework.core.enums.OseeCacheEnum; -import org.eclipse.osee.framework.core.model.cache.BranchCache; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; -import org.eclipse.osee.framework.core.model.cache.TransactionCache; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.BaseIdentity; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.resource.management.IResourceManager; import org.eclipse.osee.logger.Log; @@ -39,7 +31,6 @@ import org.eclipse.osee.orcs.db.internal.loader.LoaderModule; import org.eclipse.osee.orcs.db.internal.search.QueryModule; import org.eclipse.osee.orcs.db.internal.sql.StaticSqlProvider; import org.eclipse.osee.orcs.db.internal.transaction.TxModule; -import org.eclipse.osee.orcs.db.internal.types.TempCachingServiceFactory; import org.eclipse.osee.orcs.db.internal.types.TypesModule; import org.eclipse.osee.orcs.db.internal.util.IdentityManagerImpl; import org.osgi.framework.BundleContext; @@ -47,7 +38,7 @@ import org.osgi.framework.BundleContext; /** * @author Roberto E. Escobar */ -public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService { +public class OrcsDataStoreImpl implements OrcsDataStore { private Log logger; private IOseeDatabaseService dbService; @@ -55,7 +46,6 @@ public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService { private ExecutorAdmin executorAdmin; private IResourceManager resourceManager; private DataProxyFactoryProvider proxyProvider; - private IOseeModelFactoryService modelFactory; private EventService eventService; private OrcsTypesDataStore typesDataStore; @@ -64,8 +54,6 @@ public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService { private IdentityManager idManager; private SqlProvider sqlProvider; - private TempCachingService cacheService; - public void setLogger(Log logger) { this.logger = logger; } @@ -90,10 +78,6 @@ public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService { this.proxyProvider = proxyProvider; } - public void setModelFactory(IOseeModelFactoryService modelFactory) { - this.modelFactory = modelFactory; - } - public void setEventService(EventService eventService) { this.eventService = eventService; } @@ -102,10 +86,6 @@ public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService { String id = String.format("orcs_datastore_system_%s", GUID.create()); OrcsSession session = new DatastoreSession(id); - TempCachingServiceFactory modelingService = - new TempCachingServiceFactory(logger, dbService, executorAdmin, modelFactory, eventService); - cacheService = modelingService.createCachingService(session, true); - sqlProvider = createSqlProvider(); idManager = new IdentityManagerImpl(dbService); @@ -119,10 +99,9 @@ public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService { queryModule.startIndexer(resourceManager); BranchModule branchModule = - new BranchModule(logger, dbService, idManager, cacheService, preferences, executorAdmin, resourceManager, - modelFactory); + new BranchModule(logger, dbService, idManager, preferences, executorAdmin, resourceManager); - TxModule txModule = new TxModule(logger, dbService, cacheService, modelFactory, idManager); + TxModule txModule = new TxModule(logger, dbService, idManager); AdminModule adminModule = new AdminModule(logger, dbService, idManager, preferences); @@ -156,40 +135,6 @@ public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService { return queryModule.getQueryIndexer(); } - private TempCachingService getProxied() { - return cacheService; - } - - @Override - public BranchCache getBranchCache() { - return getProxied().getBranchCache(); - } - - @Override - public TransactionCache getTransactionCache() { - return getProxied().getTransactionCache(); - } - - @Override - public Collection<?> getCaches() { - return getProxied().getCaches(); - } - - @Override - public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException { - return getProxied().getCache(cacheId); - } - - @Override - public void reloadAll() throws OseeCoreException { - getProxied().reloadAll(); - } - - @Override - public void clearAll() { - getProxied().clearAll(); - } - private static final class DatastoreSession extends BaseIdentity<String> implements OrcsSession { public DatastoreSession(String id) { super(id); diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java index 84f186dbe56..a9833f92f3b 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java @@ -18,8 +18,6 @@ import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.model.change.ChangeItem; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; import org.eclipse.osee.framework.resource.management.IResourceManager; @@ -60,23 +58,18 @@ public class BranchModule { private final Log logger; private final IOseeDatabaseService dbService; private final IdentityLocator identityService; - private final TempCachingService cachingService; private final SystemPreferences preferences; private final ExecutorAdmin executorAdmin; private final IResourceManager resourceManager; - private final IOseeModelFactoryService modelFactory; - - public BranchModule(Log logger, IOseeDatabaseService dbService, IdentityLocator identityService, TempCachingService cachingService, SystemPreferences preferences, ExecutorAdmin executorAdmin, IResourceManager resourceManager, IOseeModelFactoryService modelFactory) { + public BranchModule(Log logger, IOseeDatabaseService dbService, IdentityLocator identityService, SystemPreferences preferences, ExecutorAdmin executorAdmin, IResourceManager resourceManager) { super(); this.logger = logger; this.dbService = dbService; this.identityService = identityService; - this.cachingService = cachingService; this.preferences = preferences; this.executorAdmin = executorAdmin; this.resourceManager = resourceManager; - this.modelFactory = modelFactory; } public BranchDataStore createBranchDataStore(final DataLoaderFactory dataLoaderFactory) { diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java index 0f0bd3ea0bb..eeb98e9a819 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java @@ -13,8 +13,6 @@ package org.eclipse.osee.orcs.db.internal.transaction; import java.util.Collection; import java.util.concurrent.Callable; import org.eclipse.osee.framework.core.data.ITransaction; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.logger.Log; import org.eclipse.osee.orcs.OrcsSession; @@ -34,18 +32,13 @@ public class TxModule { private final Log logger; private final IOseeDatabaseService dbService; - private final TempCachingService cachingService; - - private final IOseeModelFactoryService modelFactory; private final IdentityManager idManager; - public TxModule(Log logger, IOseeDatabaseService dbService, TempCachingService cachingService, IOseeModelFactoryService modelFactory, IdentityManager identityService) { + public TxModule(Log logger, IOseeDatabaseService dbService, IdentityManager identityService) { super(); this.logger = logger; this.dbService = dbService; this.idManager = identityService; - this.cachingService = cachingService; - this.modelFactory = modelFactory; } public TxDataStore createTransactionStore(DataLoaderFactory dataLoaderFactory, QueryEngineIndexer indexer, AttributeTypes types) { diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java deleted file mode 100644 index 735e9ed5978..00000000000 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 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.orcs.db.internal.types; - -import org.eclipse.osee.framework.core.services.TempCachingService; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.orcs.OrcsSession; - -/** - * @author Roberto E. Escobar - */ -public interface CacheServiceFactory { - - TempCachingService createCachingService(OrcsSession session, boolean needsPriming) throws OseeCoreException; - -} diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/TempCachingServiceFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/TempCachingServiceFactory.java deleted file mode 100644 index c224e567516..00000000000 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/TempCachingServiceFactory.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * 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.orcs.db.internal.types; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import org.eclipse.osee.event.EventService; -import org.eclipse.osee.executor.admin.ExecutorAdmin; -import org.eclipse.osee.framework.core.enums.OseeCacheEnum; -import org.eclipse.osee.framework.core.model.cache.BranchCache; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; -import org.eclipse.osee.framework.core.model.cache.TransactionCache; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.TempCachingService; -import org.eclipse.osee.framework.database.IOseeDatabaseService; -import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.Conditions; -import org.eclipse.osee.logger.Log; -import org.eclipse.osee.orcs.OrcsSession; -import org.eclipse.osee.orcs.db.internal.accessor.DatabaseBranchAccessor; -import org.eclipse.osee.orcs.db.internal.accessor.DatabaseTransactionRecordAccessor; - -/** - * @author Roberto E. Escobar - */ -public class TempCachingServiceFactory implements CacheServiceFactory { - - private final Log logger; - private final IOseeDatabaseService dbService; - private final ExecutorAdmin executorAdmin; - private final IOseeModelFactoryService modelFactoryService; - private final EventService eventService; - - public TempCachingServiceFactory(Log logger, IOseeDatabaseService dbService, ExecutorAdmin executorAdmin, IOseeModelFactoryService modelFactoryService, EventService eventService) { - super(); - this.logger = logger; - this.dbService = dbService; - this.executorAdmin = executorAdmin; - this.modelFactoryService = modelFactoryService; - this.eventService = eventService; - } - - @Override - public TempCachingService createCachingService(OrcsSession session, boolean needsPriming) { - final TransactionCache txCache = new TransactionCache(); - final BranchCache branchCache = - new BranchCache(new DatabaseBranchAccessor(logger, session, executorAdmin, eventService, dbService, txCache, - modelFactoryService.getBranchFactory()), txCache); - txCache.setAccessor(new DatabaseTransactionRecordAccessor(dbService, branchCache, - modelFactoryService.getTransactionFactory())); - - final List<IOseeCache<?, ?>> caches = Arrays.<IOseeCache<?, ?>> asList(branchCache); - - return new TempCachingService() { - - @Override - public BranchCache getBranchCache() { - return branchCache; - } - - @Override - public Collection<?> getCaches() { - return caches; - } - - @Override - public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException { - Conditions.checkNotNull(cacheId, "cache id to find"); - IOseeCache<?, ?> toReturn = null; - if (OseeCacheEnum.TRANSACTION_CACHE == cacheId) { - toReturn = txCache; - } else if (OseeCacheEnum.BRANCH_CACHE == cacheId) { - toReturn = branchCache; - } else { - throw new OseeArgumentException("Unable to find cache for id [%s]", cacheId); - } - return toReturn; - } - - @Override - public synchronized void reloadAll() throws OseeCoreException { - getBranchCache().reloadCache(); - } - - @Override - public synchronized void clearAll() { - getBranchCache().decacheAll(); - } - - @Override - public TransactionCache getTransactionCache() { - throw new UnsupportedOperationException("Server should not call this"); - } - - }; - } -} |