Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2011-02-01 18:45:46 -0500
committerRyan D. Brooks2011-02-01 18:45:46 -0500
commita329505e0fe21eb7f033c17c395d0753757e6acf (patch)
treeaea7aad1c3b721d3334718e3836b5186e00e51b7 /plugins/org.eclipse.osee.framework.core.message/src/org
parentf889330bd418a4a89f0ff6148c1cbb525d192c8c (diff)
downloadorg.eclipse.osee-a329505e0fe21eb7f033c17c395d0753757e6acf.tar.gz
org.eclipse.osee-a329505e0fe21eb7f033c17c395d0753757e6acf.tar.xz
org.eclipse.osee-a329505e0fe21eb7f033c17c395d0753757e6acf.zip
bug[ats_F0W3D]: App Server uses excessive amount an memory while running change reports
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org')
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java148
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java155
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java64
4 files changed, 131 insertions, 242 deletions
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 ec66002813..cb90f7b3a9 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
@@ -24,10 +24,8 @@ import org.eclipse.osee.framework.core.message.internal.translation.BranchCommit
import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationRequestTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.CacheUpdateRequestTranslator;
-import org.eclipse.osee.framework.core.message.internal.translation.ChangeItemTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.ChangeReportRequestTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.ChangeReportResponseTranslator;
-import org.eclipse.osee.framework.core.message.internal.translation.ChangeVersionTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.DatastoreInitRequestTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.OseeEnumTypeCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelRequestTranslator;
@@ -69,10 +67,8 @@ public class DataTranslationServiceFactory {
service.addTranslator(new BranchChangeArchivedStateRequestTranslator(),
CoreTranslatorId.CHANGE_BRANCH_ARCHIVE_STATE);
- service.addTranslator(new ChangeVersionTranslator(), CoreTranslatorId.CHANGE_VERSION);
- service.addTranslator(new ChangeItemTranslator(service), CoreTranslatorId.CHANGE_ITEM);
service.addTranslator(new ChangeReportRequestTranslator(), CoreTranslatorId.CHANGE_REPORT_REQUEST);
- service.addTranslator(new ChangeReportResponseTranslator(service), CoreTranslatorId.CHANGE_REPORT_RESPONSE);
+ service.addTranslator(new ChangeReportResponseTranslator(), CoreTranslatorId.CHANGE_REPORT_RESPONSE);
service.addTranslator(new PurgeBranchRequestTranslator(), CoreTranslatorId.PURGE_BRANCH_REQUEST);
service.addTranslator(new CacheUpdateRequestTranslator(), CoreTranslatorId.OSEE_CACHE_UPDATE_REQUEST);
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java
deleted file mode 100644
index c5d5a14cad..0000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeItemTranslator.java
+++ /dev/null
@@ -1,148 +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.enums.ChangeItemType;
-import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.message.ArtifactChangeItem;
-import org.eclipse.osee.framework.core.message.AttributeChangeItem;
-import org.eclipse.osee.framework.core.message.ChangeItem;
-import org.eclipse.osee.framework.core.message.ChangeVersion;
-import org.eclipse.osee.framework.core.message.RelationChangeItem;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ChangeItemTranslator implements ITranslator<ChangeItem> {
-
- private static enum Entry {
- BASE_ENTRY,
- FIRST_CHANGE,
- CURRENT_ENTRY,
- DESTINATION_ENTRY,
- NET_ENTRY,
- ART_ID,
- A_ART_ID,
- B_ART_ID,
- TYPE,
- ITEM_ID,
- ITEM_TYPE_ID,
- RATIONALE;
- }
-
- private final IDataTranslationService service;
-
- public ChangeItemTranslator(IDataTranslationService service) {
- super();
- this.service = service;
- }
-
- @Override
- public ChangeItem convert(PropertyStore store) throws OseeCoreException {
- PropertyStore currentEntryStore = store.getPropertyStore(Entry.CURRENT_ENTRY.name());
- ChangeVersion currentEntry = service.convert(currentEntryStore, CoreTranslatorId.CHANGE_VERSION);
-
- ChangeItem changeItem = createChangeItem(store, currentEntry);
-
- populateChangeVersion(store, changeItem.getCurrentVersion(), Entry.CURRENT_ENTRY);
- populateChangeVersion(store, changeItem.getBaselineVersion(), Entry.BASE_ENTRY);
- populateChangeVersion(store, changeItem.getDestinationVersion(), Entry.DESTINATION_ENTRY);
- populateChangeVersion(store, changeItem.getFirstNonCurrentChange(), Entry.FIRST_CHANGE);
- populateChangeVersion(store, changeItem.getNetChange(), Entry.NET_ENTRY);
- return changeItem;
- }
-
- private ChangeItem createChangeItem(PropertyStore propertyStore, ChangeVersion currentChangeVersion) throws OseeStateException {
- ChangeItem changeItem = null;
-
- int itemId = Integer.parseInt(propertyStore.get(Entry.ITEM_ID.name()));
- int itemTypeId = Integer.parseInt(propertyStore.get(Entry.ITEM_TYPE_ID.name()));
-
- ChangeItemType type = ChangeItemType.getType(propertyStore.get(Entry.TYPE.name()));
-
- switch (type) {
- case ARTIFACT:
- changeItem =
- new ArtifactChangeItem(itemId, itemTypeId, currentChangeVersion.getGammaId(),
- currentChangeVersion.getModType());
- break;
- case ATTRIBUTE:
- int artId = Integer.parseInt(propertyStore.get(Entry.ART_ID.name()));
- changeItem =
- new AttributeChangeItem(itemId, itemTypeId, artId, currentChangeVersion.getGammaId(),
- currentChangeVersion.getModType(), currentChangeVersion.getValue());
- break;
- case RELATION:
- int aArtId = Integer.parseInt(propertyStore.get(Entry.A_ART_ID.name()));
- int bArtId = Integer.parseInt(propertyStore.get(Entry.B_ART_ID.name()));
- String rationale = propertyStore.get(Entry.RATIONALE.name());
-
- changeItem =
- new RelationChangeItem(itemId, itemTypeId, currentChangeVersion.getGammaId(),
- currentChangeVersion.getModType(), aArtId, bArtId, rationale);
- break;
- default:
- throw new OseeStateException("Invalid change item type");
- }
- return changeItem;
- }
-
- private void populateChangeVersion(PropertyStore store, ChangeVersion destVersion, Enum<?> key) throws OseeCoreException {
- PropertyStore innerStore = store.getPropertyStore(key.name());
- ChangeVersion srcVersion = service.convert(innerStore, CoreTranslatorId.CHANGE_VERSION);
- if (srcVersion != null && destVersion != null && srcVersion.isValid()) {
- destVersion.setGammaId(srcVersion.getGammaId());
- destVersion.setModType(srcVersion.getModType());
- destVersion.setValue(srcVersion.getValue());
- }
- }
-
- @Override
- public PropertyStore convert(ChangeItem changeItem) throws OseeCoreException {
- PropertyStore store = new PropertyStore();
-
- store.put(Entry.ITEM_ID.name(), changeItem.getItemId());
- store.put(Entry.ITEM_TYPE_ID.name(), changeItem.getItemTypeId());
-
- if (changeItem instanceof ArtifactChangeItem) {
- store.put(Entry.TYPE.name(), ChangeItemType.ARTIFACT.name());
- } else if (changeItem instanceof AttributeChangeItem) {
- store.put(Entry.ART_ID.name(), changeItem.getArtId());
- store.put(Entry.TYPE.name(), ChangeItemType.ATTRIBUTE.name());
- } else if (changeItem instanceof RelationChangeItem) {
- store.put(Entry.TYPE.name(), ChangeItemType.RELATION.name());
-
- RelationChangeItem relationChangeItem = (RelationChangeItem) changeItem;
-
- store.put(Entry.A_ART_ID.name(), relationChangeItem.getArtId());
- store.put(Entry.B_ART_ID.name(), relationChangeItem.getBArtId());
- store.put(Entry.RATIONALE.name(), relationChangeItem.getRationale());
- }
-
- storeChangeVersion(store, Entry.CURRENT_ENTRY, changeItem.getCurrentVersion());
-
- storeChangeVersion(store, Entry.BASE_ENTRY, changeItem.getBaselineVersion());
- storeChangeVersion(store, Entry.FIRST_CHANGE, changeItem.getFirstNonCurrentChange());
- storeChangeVersion(store, Entry.DESTINATION_ENTRY, changeItem.getDestinationVersion());
- storeChangeVersion(store, Entry.NET_ENTRY, changeItem.getNetChange());
- return store;
- }
-
- private void storeChangeVersion(PropertyStore store, Enum<?> entry, ChangeVersion changeVersion) throws OseeCoreException {
- store.put(entry.name(), service.convert(changeVersion, CoreTranslatorId.CHANGE_VERSION));
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
index 27a4c3fc7c..a3bc2a9a38 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
@@ -11,12 +11,18 @@
package org.eclipse.osee.framework.core.message.internal.translation;
import java.util.List;
-import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.enums.ChangeItemType;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.message.ArtifactChangeItem;
+import org.eclipse.osee.framework.core.message.AttributeChangeItem;
import org.eclipse.osee.framework.core.message.ChangeItem;
import org.eclipse.osee.framework.core.message.ChangeReportResponse;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.message.RelationChangeItem;
import org.eclipse.osee.framework.core.message.TranslationUtil;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -24,43 +30,142 @@ import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
* @author Jeff C. Phillips
*/
public class ChangeReportResponseTranslator implements ITranslator<ChangeReportResponse> {
- private static enum Entry {
- CHANGE_ITEM,
- COUNT;
- }
- private final IDataTranslationService service;
+ private enum Fields {
+ COUNT,
+ ROW,
+ CURR,
+ BASE,
+ FIRST,
+ DEST,
+ NET;
+ }
- public ChangeReportResponseTranslator(IDataTranslationService service) {
+ public ChangeReportResponseTranslator() {
super();
- this.service = service;
}
@Override
- public ChangeReportResponse convert(PropertyStore propertyStore) throws OseeCoreException {
- ChangeReportResponse data = new ChangeReportResponse();
- int numberOfItems = propertyStore.getInt(Entry.COUNT.name());
-
- for (int index = 0; index < numberOfItems; index++) {
- String key = TranslationUtil.createKey(Entry.CHANGE_ITEM, index);
- PropertyStore innerStore = propertyStore.getPropertyStore(key);
- ChangeItem changeItem = service.convert(innerStore, CoreTranslatorId.CHANGE_ITEM);
- data.addItem(changeItem);
+ public ChangeReportResponse convert(PropertyStore store) throws OseeCoreException {
+ ChangeReportResponse response = new ChangeReportResponse();
+
+ int rowCount = store.getInt(Fields.COUNT.name());
+ for (int index = 0; index < rowCount; index++) {
+ String key = TranslationUtil.createKey(Fields.ROW, index);
+ String[] rowData = store.getArray(key);
+
+ ChangeItem item = fromArray(rowData);
+ load(store, Fields.CURR, index, item.getCurrentVersion());
+ load(store, Fields.BASE, index, item.getBaselineVersion());
+ load(store, Fields.FIRST, index, item.getFirstNonCurrentChange());
+ load(store, Fields.DEST, index, item.getDestinationVersion());
+ load(store, Fields.NET, index, item.getNetChange());
+
+ response.addItem(item);
}
- return data;
+ return response;
}
@Override
- public PropertyStore convert(ChangeReportResponse changeReportResponseData) throws OseeCoreException {
+ public PropertyStore convert(ChangeReportResponse data) throws OseeCoreException {
PropertyStore store = new PropertyStore();
- List<ChangeItem> items = changeReportResponseData.getChangeItems();
+ List<ChangeItem> items = data.getChangeItems();
for (int index = 0; index < items.size(); index++) {
- ChangeItem changeItem = items.get(index);
- PropertyStore innerStore = service.convert(changeItem, CoreTranslatorId.CHANGE_ITEM);
- store.put(TranslationUtil.createKey(Entry.CHANGE_ITEM, index), innerStore);
+ ChangeItem item = items.get(index);
+ String key = TranslationUtil.createKey(Fields.ROW, index);
+ store.put(key, toArray(item));
+
+ store(store, Fields.CURR, index, item.getCurrentVersion());
+ store(store, Fields.BASE, index, item.getBaselineVersion());
+ store(store, Fields.FIRST, index, item.getFirstNonCurrentChange());
+ store(store, Fields.DEST, index, item.getDestinationVersion());
+ store(store, Fields.NET, index, item.getNetChange());
}
- store.put(Entry.COUNT.name(), items.size());
+ store.put(Fields.COUNT.name(), items.size());
return store;
}
+
+ private static void load(PropertyStore store, Enum<?> prefix, int index, ChangeVersion version) throws OseeArgumentException, NumberFormatException {
+ String key = TranslationUtil.createKey(prefix, index);
+ String[] data = store.getArray(key);
+ if (data != null && data.length > 0) {
+ Long gammaId = Long.parseLong(data[0]);
+ ModificationType modificationType = ModificationType.getMod(Integer.parseInt(data[1]));
+ String value = data[2];
+
+ version.setGammaId(gammaId);
+ version.setModType(modificationType);
+ version.setValue(value);
+ }
+ }
+
+ private static void store(PropertyStore store, Enum<?> prefix, int index, ChangeVersion version) {
+ if (version != null && version.isValid()) {
+ String[] row = new String[3];
+ row[0] = String.valueOf(version.getGammaId());
+ row[1] = String.valueOf(version.getModType().getValue());
+ row[2] = version.getValue();
+
+ String key = TranslationUtil.createKey(prefix, index);
+ store.put(key, row);
+ }
+ }
+
+ private static String[] toArray(ChangeItem item) throws OseeStateException {
+ String[] row;
+ if (item instanceof ArtifactChangeItem) {
+ row = new String[3];
+ row[0] = ChangeItemType.ARTIFACT.name();
+ row[1] = String.valueOf(item.getItemId());
+ row[2] = String.valueOf(item.getItemTypeId());
+ } else if (item instanceof AttributeChangeItem) {
+ row = new String[4];
+ row[0] = ChangeItemType.ATTRIBUTE.name();
+ row[1] = String.valueOf(item.getItemId());
+ row[2] = String.valueOf(item.getItemTypeId());
+ row[3] = String.valueOf(item.getArtId());
+ } else if (item instanceof RelationChangeItem) {
+ row = new String[6];
+ RelationChangeItem relationChangeItem = (RelationChangeItem) item;
+ row[0] = ChangeItemType.RELATION.name();
+ row[1] = String.valueOf(item.getItemId());
+ row[2] = String.valueOf(item.getItemTypeId());
+ row[3] = String.valueOf(relationChangeItem.getArtId());
+ row[4] = String.valueOf(relationChangeItem.getBArtId());
+ row[5] = relationChangeItem.getRationale();
+ } else {
+ throw new OseeStateException("Invalid change item type");
+ }
+ return row;
+
+ }
+
+ private static ChangeItem fromArray(String[] row) throws OseeStateException {
+ ChangeItem changeItem = null;
+
+ ChangeItemType type = ChangeItemType.getType(row[0]);
+ int itemId = Integer.parseInt(row[1]);
+ int itemTypeId = Integer.parseInt(row[2]);
+ switch (type) {
+ case ARTIFACT:
+ changeItem = new ArtifactChangeItem(itemId, itemTypeId, -1, ModificationType.NEW);
+ break;
+ case ATTRIBUTE:
+ int artId = Integer.parseInt(row[3]);
+ changeItem = new AttributeChangeItem(itemId, itemTypeId, artId, -1, ModificationType.NEW, null);
+ break;
+ case RELATION:
+ int aArtId = Integer.parseInt(row[3]);
+ int bArtId = Integer.parseInt(row[4]);
+ String rationale = row[5];
+
+ changeItem =
+ new RelationChangeItem(itemId, itemTypeId, -1, ModificationType.NEW, aArtId, bArtId, rationale);
+ break;
+ default:
+ throw new OseeStateException("Invalid change item type");
+ }
+ return changeItem;
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java
deleted file mode 100644
index 58ef86212b..0000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeVersionTranslator.java
+++ /dev/null
@@ -1,64 +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.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.message.ChangeVersion;
-import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ChangeVersionTranslator implements ITranslator<ChangeVersion> {
- private static enum Entry {
- GAMMA_ID,
- MOD_TYPE,
- VALUE,
- IS_VALID;
- }
-
- public ChangeVersionTranslator() {
- super();
- }
-
- @Override
- public ChangeVersion convert(PropertyStore propertyStore) throws OseeCoreException {
- ChangeVersion changeVersion = new ChangeVersion();
-
- if (!propertyStore.get(Entry.IS_VALID.name()).isEmpty()) {
- String value = propertyStore.get(Entry.VALUE.name());
- ModificationType modificationType =
- ModificationType.getMod(Integer.parseInt(propertyStore.get(Entry.MOD_TYPE.name())));
- Long gammaId = Long.parseLong(propertyStore.get(Entry.GAMMA_ID.name()));
-
- changeVersion.setGammaId(gammaId);
- changeVersion.setModType(modificationType);
- changeVersion.setValue(value);
- }
- return changeVersion;
- }
-
- @Override
- public PropertyStore convert(ChangeVersion changeVersion) throws OseeCoreException {
- PropertyStore store = new PropertyStore();
-
- if (changeVersion.isValid()) {
- store.put(Entry.IS_VALID.name(), "IS_VALID");
- store.put(Entry.GAMMA_ID.name(), changeVersion.getGammaId());
- store.put(Entry.MOD_TYPE.name(), changeVersion.getModType().getValue());
- store.put(Entry.VALUE.name(), changeVersion.getValue());
- }
- return store;
- }
-
-}

Back to the top