Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2013-05-24 21:05:11 +0000
committerRoberto E. Escobar2013-07-01 23:46:23 +0000
commita93cab41525d93bdd516382486202a0d84c6c8e7 (patch)
tree517083f2a20f08dec10db9a5c07123ca7e6a455d
parent5d493eb91b5add2a4583d6f48096cd6f3d9b48dc (diff)
downloadorg.eclipse.osee-a93cab41525d93bdd516382486202a0d84c6c8e7.tar.gz
org.eclipse.osee-a93cab41525d93bdd516382486202a0d84c6c8e7.tar.xz
org.eclipse.osee-a93cab41525d93bdd516382486202a0d84c6c8e7.zip
refactor: Remove caching service from db import/export & branch purge
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.export.console.command.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.import.console.command.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.purge.console.command.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchExportCommand.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchImportCommand.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchPurgeCommand.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ExportBranchDatabaseCallable.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java23
10 files changed, 29 insertions, 62 deletions
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.export.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.export.console.command.xml
index 1a6660c9c9a..f71aaef2b72 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.export.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.export.console.command.xml
@@ -5,5 +5,4 @@
<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.IOseeCachingService" name="IOseeCachingService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.import.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.import.console.command.xml
index e036c7cf3e5..a1c4e95fc8b 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.import.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.import.console.command.xml
@@ -5,5 +5,4 @@
<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.IOseeCachingService" name="IOseeCachingService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.purge.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.purge.console.command.xml
index d56fa61b10d..aab1c91c67f 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.purge.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.branch.purge.console.command.xml
@@ -5,5 +5,4 @@
<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.IOseeCachingService" name="IOseeCachingService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchExportCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchExportCommand.java
index 0e0fc1320a1..d0186607d21 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchExportCommand.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchExportCommand.java
@@ -26,7 +26,6 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.BranchFilter;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.orcs.ExportOptions;
@@ -39,7 +38,6 @@ import org.eclipse.osee.orcs.OrcsBranch;
public final class BranchExportCommand implements ConsoleCommand {
private OrcsApi orcsApi;
- private IOseeCachingService cachingService;
public void setOrcsApi(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
@@ -49,14 +47,6 @@ public final class BranchExportCommand implements ConsoleCommand {
return orcsApi;
}
- public void setCachingService(IOseeCachingService cachingService) {
- this.cachingService = cachingService;
- }
-
- public IOseeCachingService getCachingService() {
- return cachingService;
- }
-
@Override
public String getName() {
return "branch_export";
@@ -90,8 +80,8 @@ public final class BranchExportCommand implements ConsoleCommand {
List<String> includeBranchIds = Arrays.asList(params.getArray("includeBranchIds"));
OrcsBranch orcsBranch = getOrcsApi().getBranchOps(null);
- return new ExportBranchCallable(console, orcsBranch, getCachingService().getBranchCache(), exportFileName,
- options, includeArchivedBranches, includeBranchIds, excludeBranchIds);
+ return new ExportBranchCallable(console, orcsBranch, getOrcsApi().getBranchCache(), exportFileName, options,
+ includeArchivedBranches, includeBranchIds, excludeBranchIds);
}
private static class ExportBranchCallable extends CancellableCallable<URI> {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchImportCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchImportCommand.java
index bfa50ef3ea9..307eecc6eac 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchImportCommand.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchImportCommand.java
@@ -22,7 +22,6 @@ import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.orcs.ExportOptions;
import org.eclipse.osee.orcs.ImportOptions;
@@ -35,7 +34,6 @@ import org.eclipse.osee.orcs.OrcsBranch;
public final class BranchImportCommand implements ConsoleCommand {
private OrcsApi orcsApi;
- private IOseeCachingService cachingService;
public void setOrcsApi(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
@@ -45,14 +43,6 @@ public final class BranchImportCommand implements ConsoleCommand {
return orcsApi;
}
- public void setCachingService(IOseeCachingService cachingService) {
- this.cachingService = cachingService;
- }
-
- public IOseeCachingService getCachingService() {
- return cachingService;
- }
-
@Override
public String getName() {
return "branch_import";
@@ -85,8 +75,8 @@ public final class BranchImportCommand implements ConsoleCommand {
options.put(ImportOptions.CLEAN_BEFORE_IMPORT.name(), params.getBoolean("clean"));
OrcsBranch orcsBranch = getOrcsApi().getBranchOps(null);
- return new ImportBranchDelegateCallable(console, orcsBranch, getCachingService().getBranchCache(), options,
- importFiles, branchIds);
+ return new ImportBranchDelegateCallable(console, orcsBranch, getOrcsApi().getBranchCache(), options, importFiles,
+ branchIds);
}
private static final class ImportBranchDelegateCallable extends CancellableCallable<Boolean> {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchPurgeCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchPurgeCommand.java
index 0172852168b..c43c8a1bd12 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchPurgeCommand.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/BranchPurgeCommand.java
@@ -31,7 +31,6 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.ReadableBranch;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.BranchFilter;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.OrcsApi;
@@ -46,7 +45,6 @@ import org.eclipse.osee.orcs.core.internal.branch.provider.MultiBranchProvider;
public final class BranchPurgeCommand implements ConsoleCommand {
private OrcsApi orcsApi;
- private IOseeCachingService cachingService;
private static final String ERROR_STRING =
"Branch %s[%s] is a %s branch and that option was not specified! It will not be purged!\n";
@@ -58,14 +56,6 @@ public final class BranchPurgeCommand implements ConsoleCommand {
return orcsApi;
}
- public void setCachingService(IOseeCachingService cachingService) {
- this.cachingService = cachingService;
- }
-
- public IOseeCachingService getCachingService() {
- return cachingService;
- }
-
@Override
public String getName() {
return "branch_purge";
@@ -113,7 +103,7 @@ public final class BranchPurgeCommand implements ConsoleCommand {
boolean runPurge = options.contains("P");
OrcsBranch orcsBranch = getOrcsApi().getBranchOps(null);
- return new PurgeBranchCallable(console, orcsBranch, getCachingService().getBranchCache(), branchGuids, recurse,
+ return new PurgeBranchCallable(console, orcsBranch, getOrcsApi().getBranchCache(), branchGuids, recurse,
unArchived, unDeleted, baseline, runPurge);
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
index 8c479bff933..19c792eb94b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
@@ -126,8 +126,9 @@ public class BranchDataStoreImpl implements BranchDataStore {
@Override
public Callable<URI> exportBranch(String sessionId, List<IOseeBranch> branches, PropertyStore options, String exportName) {
ExportItemFactory factory =
- new ExportItemFactory(logger, dbService, cachingService, typeModelService, resourceManager);
- return new ExportBranchDatabaseCallable(factory, preferences, executorAdmin, branches, options, exportName);
+ new ExportItemFactory(logger, dbService, identityService, typeModelService, resourceManager);
+ return new ExportBranchDatabaseCallable(factory, preferences, executorAdmin, cachingService.getBranchCache(),
+ branches, options, exportName);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ExportBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ExportBranchDatabaseCallable.java
index bd2c579997b..3b600da1693 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ExportBranchDatabaseCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ExportBranchDatabaseCallable.java
@@ -48,16 +48,18 @@ public class ExportBranchDatabaseCallable extends DatabaseCallable<URI> {
private final SystemPreferences preferences;
private final ExecutorAdmin executorAdmin;
+ private final BranchCache branchCache;
private final List<IOseeBranch> branches;
private final PropertyStore options;
private String exportName;
- public ExportBranchDatabaseCallable(ExportItemFactory factory, SystemPreferences preferences, ExecutorAdmin executorAdmin, List<IOseeBranch> branches, PropertyStore options, String exportName) {
+ public ExportBranchDatabaseCallable(ExportItemFactory factory, SystemPreferences preferences, ExecutorAdmin executorAdmin, BranchCache branchCache, List<IOseeBranch> branches, PropertyStore options, String exportName) {
super(factory.getLogger(), factory.getDbService());
this.factory = factory;
this.preferences = preferences;
this.executorAdmin = executorAdmin;
+ this.branchCache = branchCache;
this.branches = branches;
this.options = options;
this.exportName = exportName;
@@ -68,7 +70,7 @@ public class ExportBranchDatabaseCallable extends DatabaseCallable<URI> {
}
private BranchCache getBranchCache() {
- return factory.getCachingService().getBranchCache();
+ return branchCache;
}
private ExecutorAdmin getExecutorAdmin() {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
index 06995c0808e..4998577a6fe 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
@@ -16,7 +16,7 @@ import java.util.List;
import java.util.Random;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IdentityService;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeSequence;
import org.eclipse.osee.framework.database.core.OseeConnection;
@@ -70,14 +70,14 @@ public class ExportItemFactory {
private final Log logger;
private final IOseeDatabaseService dbService;
- private final IOseeCachingService cachingService;
+ private final IdentityService identityService;
private final IOseeModelingService typeModelService;
private final IResourceManager resourceManager;
- public ExportItemFactory(Log logger, IOseeDatabaseService dbService, IOseeCachingService cachingService, IOseeModelingService typeModelService, IResourceManager resourceManager) {
+ public ExportItemFactory(Log logger, IOseeDatabaseService dbService, IdentityService identityService, IOseeModelingService typeModelService, IResourceManager resourceManager) {
this.logger = logger;
this.dbService = dbService;
- this.cachingService = cachingService;
+ this.identityService = identityService;
this.typeModelService = typeModelService;
this.resourceManager = resourceManager;
}
@@ -98,8 +98,8 @@ public class ExportItemFactory {
return resourceManager;
}
- public IOseeCachingService getCachingService() {
- return cachingService;
+ public IdentityService getIdentityService() {
+ return identityService;
}
public List<AbstractExportItem> createTaskList(int joinId, PropertyStore options) throws OseeCoreException {
@@ -130,7 +130,7 @@ public class ExportItemFactory {
private void addItem(List<AbstractExportItem> items, int exportJoinId, PropertyStore options, int gammaJoinId, ExportItem exportItem, String query) throws OseeCoreException {
StringBuilder modifiedQuery = new StringBuilder(query);
Object[] bindData = prepareQuery(exportItem, modifiedQuery, options, exportJoinId, gammaJoinId);
- items.add(new DbTableExportItem(getLogger(), getDbService(), getCachingService(), getResourceManager(),
+ items.add(new DbTableExportItem(getLogger(), getDbService(), getIdentityService(), getResourceManager(),
exportItem, modifiedQuery.toString(), bindData));
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java
index f9b39817ef7..8f9c9fbce1b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java
@@ -20,9 +20,7 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.AbstractOseeType;
-import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IdentityService;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.core.util.HexUtil;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
@@ -52,13 +50,13 @@ public class DbTableExportItem extends AbstractXmlExportItem {
private final Object[] bindData;
private final IOseeDatabaseService dbService;
- private final IOseeCachingService cachingService;
+ private final IdentityService identityService;
private final IResourceManager resourceManager;
- public DbTableExportItem(Log logger, IOseeDatabaseService dbService, IOseeCachingService cachingService, IResourceManager resourceManager, ExportItem id, String query, Object[] bindData) {
+ public DbTableExportItem(Log logger, IOseeDatabaseService dbService, IdentityService identityService, IResourceManager resourceManager, ExportItem id, String query, Object[] bindData) {
super(logger, id);
this.dbService = dbService;
- this.cachingService = cachingService;
+ this.identityService = identityService;
this.resourceManager = resourceManager;
this.query = query;
this.bindData = bindData;
@@ -128,11 +126,11 @@ public class DbTableExportItem extends AbstractXmlExportItem {
} else if (columnName.equals(ExportImportXml.RATIONALE)) {
handleStringContent(rationaleBuffer, value, columnName);
} else if (columnName.equals(ExportImportXml.ART_TYPE_ID)) {
- handleTypeId(appendable, value, cachingService.getArtifactTypeCache());
+ handleTypeId(appendable, value);
} else if (columnName.equals(ExportImportXml.ATTR_TYPE_ID)) {
- handleTypeId(appendable, value, cachingService.getAttributeTypeCache());
+ handleTypeId(appendable, value);
} else if (columnName.equals(ExportImportXml.REL_TYPE_ID)) {
- handleTypeId(appendable, value, cachingService.getRelationTypeCache());
+ handleTypeId(appendable, value);
} else {
Timestamp timestamp = asTimestamp(value);
if (timestamp != null) {
@@ -209,7 +207,7 @@ public class DbTableExportItem extends AbstractXmlExportItem {
}
}
- private void handleTypeId(Appendable appendable, Object value, AbstractOseeCache<Long, ? extends AbstractOseeType<Long>> cache) throws IOException, OseeCoreException {
+ private void handleTypeId(Appendable appendable, Object value) throws IOException, OseeCoreException {
int typeId = -1;
if (value instanceof Short) {
Short xShort = (Short) value;
@@ -225,9 +223,8 @@ public class DbTableExportItem extends AbstractXmlExportItem {
} else {
throw new OseeCoreException("Undefined Type [%s]", value != null ? value.getClass().getSimpleName() : value);
}
- AbstractOseeType<Long> type = cache.getById(typeId);
- Conditions.checkNotNull(type, "abstartOseeType", "localId[%s] for [%s]", typeId, getSource());
- long uuid = type.getGuid();
+ Long uuid = identityService.getUniversalId(typeId);
+ Conditions.checkNotNull(uuid, "abstartOseeType", "localId[%s] for [%s]", typeId, getSource());
String uuidString = HexUtil.toString(uuid);
ExportImportXml.addXmlAttribute(appendable, ExportImportXml.TYPE_GUID, uuidString);
}

Back to the top