diff options
63 files changed, 1574 insertions, 142 deletions
diff --git a/features/org.eclipse.osee.x.server.external.feature/feature.xml b/features/org.eclipse.osee.x.server.external.feature/feature.xml index 9bbdc592463..62047125a02 100644 --- a/features/org.eclipse.osee.x.server.external.feature/feature.xml +++ b/features/org.eclipse.osee.x.server.external.feature/feature.xml @@ -114,4 +114,109 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.xtext" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.xtext.util" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.h2" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.emf.common" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.emf.compare" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.emf.compare.diff" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.emf.compare.match" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.emf.ecore" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.emf.ecore.xmi" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="com.google.collect" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="com.google.inject" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.aopalliance" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.antlr.runtime" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.emf.edit" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.equinox.event" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/features/org.eclipse.osee.x.server.feature.source/feature.xml b/features/org.eclipse.osee.x.server.feature.source/feature.xml index 141f0b0a2c1..cfc3f49faa9 100644 --- a/features/org.eclipse.osee.x.server.feature.source/feature.xml +++ b/features/org.eclipse.osee.x.server.feature.source/feature.xml @@ -106,24 +106,38 @@ unpack="false"/> <plugin - id="org.eclipse.osee.ats.presenter" + id="org.eclipse.osee.ats.presenter.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin - id="org.eclipse.osee.ats.view.web" + id="org.eclipse.osee.ats.view.web.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin - id="org.eclipse.osee.ats.api" + id="org.eclipse.osee.ats.api.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.osee.framework.core.dsl.source" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.osee.framework.core.dsl.integration.source" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/features/org.eclipse.osee.x.server.feature/feature.xml b/features/org.eclipse.osee.x.server.feature/feature.xml index c3bc9764c82..e4b9a491413 100644 --- a/features/org.eclipse.osee.x.server.feature/feature.xml +++ b/features/org.eclipse.osee.x.server.feature/feature.xml @@ -138,4 +138,18 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.osee.framework.core.dsl" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.osee.framework.core.dsl.integration" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java index cdca5940eb1..89e7362cbc3 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/OseeServices.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.osee.framework.branch.management.exchange; -import org.eclipse.osee.framework.core.message.IOseeModelingService; import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.resource.management.IResourceLocatorManager; diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/OseeTypeModelExportItem.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/OseeTypeModelExportItem.java index 8ac4d724a9a..b123c5d2d79 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/OseeTypeModelExportItem.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/OseeTypeModelExportItem.java @@ -15,7 +15,7 @@ import java.io.FileOutputStream; import java.io.OutputStream; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.osee.framework.branch.management.exchange.handler.ExportItem; -import org.eclipse.osee.framework.core.message.IOseeModelingService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.jdk.core.util.Lib; /** diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java index f82997b012f..e098ca4ee95 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/ImportOseeModelHandler.java @@ -12,11 +12,11 @@ import java.net.URI; import java.net.URL; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.branch.management.internal.Activator; -import org.eclipse.osee.framework.core.message.IOseeModelingService; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.OperationLogger; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.jdk.core.util.Lib; public class ImportOseeModelHandler extends AbstractOperation { diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java index 3c55592965e..5d898714f3c 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/internal/trackers/OseeBranchExchangeServiceRegistrationHandler.java @@ -14,8 +14,8 @@ import java.util.Map; import org.eclipse.osee.framework.branch.management.IBranchExchange; import org.eclipse.osee.framework.branch.management.exchange.BranchExchange; import org.eclipse.osee.framework.branch.management.exchange.OseeServices; -import org.eclipse.osee.framework.core.message.IOseeModelingService; import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; import org.eclipse.osee.framework.database.IOseeDatabaseService; diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java index d1e186024cd..b53282346c6 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ArtifactTypeDataAccessor.java @@ -18,10 +18,10 @@ import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.enums.TxChange; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.exception.OseeExceptions; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; import org.eclipse.osee.framework.core.model.AbstractOseeType; import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; 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.IOseeDataAccessor; diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ModelingServiceProvider.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ModelingServiceProvider.java index b25429b4a7d..8cab46844e0 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ModelingServiceProvider.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ModelingServiceProvider.java @@ -1,7 +1,7 @@ package org.eclipse.osee.framework.core.datastore.internal; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.message.IOseeModelingService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; public interface ModelingServiceProvider { IOseeModelingService getIOseeModelingService() throws OseeCoreException; diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java index 7493ae6a5f9..cab21d7a58e 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/OseeCachingServiceRegistrationHandler.java @@ -13,12 +13,12 @@ package org.eclipse.osee.framework.core.datastore.internal; import java.util.Map; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.exception.OseeStateException; -import org.eclipse.osee.framework.core.message.IOseeModelingService; import org.eclipse.osee.framework.core.server.IApplicationServerLookup; import org.eclipse.osee.framework.core.server.IApplicationServerManager; import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory; import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/META-INF/MANIFEST.MF index bd8ccea8b93..9b34f586805 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/META-INF/MANIFEST.MF @@ -6,8 +6,9 @@ Bundle-Version: 0.9.9.qualifier Bundle-Vendor: Eclipse Open System Engineering Environment Fragment-Host: org.eclipse.osee.framework.core.dsl.integration Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.junit -Import-Package: org.eclipse.osee.framework.core.dsl.integration, - org.eclipse.osee.framework.core.model.mocks, - org.eclipse.osee.framework.jdk.core.type Export-Package: org.eclipse.osee.framework.core.dsl.integration +Import-Package: org.eclipse.osee.framework.jdk.core.type, + org.eclipse.osee.framework.jdk.core.util, + org.junit;version="4.8.2", + org.junit.runner;version="4.8.2", + org.junit.runners;version="4.8.2" diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/build.properties b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/build.properties index 34d2e4d2dad..edf08e91d3b 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/build.properties +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/build.properties @@ -2,3 +2,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ . +additional.bundles = org.junit,\ + org.eclipse.osee.framework.jdk.core diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/pom.xml b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/pom.xml new file mode 100644 index 00000000000..284a3849b9b --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/pom.xml @@ -0,0 +1,30 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.osee</groupId> + <artifactId>org.eclipse.osee.x.server.parent</artifactId> + <version>0.9.9-SNAPSHOT</version> + <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath> + </parent> + + <artifactId>org.eclipse.osee.framework.core.dsl.integration.test</artifactId> + <packaging>eclipse-test-plugin</packaging> + <name>ORCS DSL Test- (Incubation)</name> + + <build> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <version>${tycho-version}</version> + <configuration> + <testSuite>org.eclipse.osee.framework.core.dsl.integration</testSuite> + <testClass>org.eclipse.osee.framework.core.dsl.integration.AllDslIntegrationTestSuite</testClass> + </configuration> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AccessModelInterpreterImplTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AccessModelInterpreterImplTest.java index 05034da9549..ae0ff033004 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AccessModelInterpreterImplTest.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AccessModelInterpreterImplTest.java @@ -13,11 +13,10 @@ package org.eclipse.osee.framework.core.dsl.integration.internal; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import org.junit.Assert; import org.eclipse.osee.framework.core.data.IAccessContextId; import org.eclipse.osee.framework.core.data.TokenFactory; -import org.eclipse.osee.framework.core.dsl.integration.internal.AccessModelInterpreterImpl; import org.eclipse.osee.framework.core.dsl.integration.mocks.CheckAccessDetailCollectorNotCalled; +import org.eclipse.osee.framework.core.dsl.integration.mocks.MockAccessDetailCollector; import org.eclipse.osee.framework.core.dsl.integration.mocks.MockArtifactDataProvider; import org.eclipse.osee.framework.core.dsl.integration.mocks.MockArtifactProxy; import org.eclipse.osee.framework.core.dsl.integration.mocks.MockModel; @@ -27,8 +26,8 @@ import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction; import org.eclipse.osee.framework.core.exception.OseeArgumentException; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.access.AccessDetailCollector; -import org.eclipse.osee.framework.core.model.mocks.MockAccessDetailCollector; import org.eclipse.osee.framework.jdk.core.util.GUID; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/DslAsserts.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/DslAsserts.java index 394bee3b7a1..bdfcef700f9 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/DslAsserts.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/DslAsserts.java @@ -35,7 +35,6 @@ import org.eclipse.osee.framework.core.enums.PermissionEnum; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.access.AccessDetail; import org.eclipse.osee.framework.core.model.access.Scope; -import org.eclipse.osee.framework.core.model.mocks.MockAccessDetailCollector; import org.junit.Assert; /** diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockAccessDetailCollector.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockAccessDetailCollector.java new file mode 100644 index 00000000000..b2092afe2af --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockAccessDetailCollector.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.dsl.integration.mocks; + +import org.eclipse.osee.framework.core.model.access.AccessDetail; +import org.eclipse.osee.framework.core.model.access.AccessDetailCollector; + +/** + * @author Roberto E. Escobar + */ +public final class MockAccessDetailCollector implements AccessDetailCollector { + + private AccessDetail<?> actualAccessDetail; + + public AccessDetail<?> getAccessDetails() { + return actualAccessDetail; + } + + public void clear() { + collect(null); + } + + @Override + public void collect(AccessDetail<?> accessDetail) { + this.actualAccessDetail = accessDetail; + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java new file mode 100644 index 00000000000..61d8f087c4b --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/mocks/MockArtifact.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * 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.core.dsl.integration.mocks; + +import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.NamedIdentity; +import org.eclipse.osee.framework.core.enums.BranchState; +import org.eclipse.osee.framework.core.enums.BranchType; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.core.model.IBasicArtifact; +import org.eclipse.osee.framework.core.model.type.ArtifactType; + +/** + * @author Jeff C. Phillips + */ +public class MockArtifact extends NamedIdentity<String> implements IBasicArtifact<Object> { + + private final Branch branch; + private final ArtifactType artifactType; + private final int artId; + + public MockArtifact(String guid, String name, IOseeBranch branch, IArtifactType artifactType, int artId) { + super(guid, name); + this.branch = new Branch(branch.getGuid(), branch.getName(), BranchType.WORKING, BranchState.MODIFIED, false); + this.artifactType = new ArtifactType(artifactType.getGuid(), artifactType.getName(), false); + this.artId = artId; + } + + @Override + public int getArtId() { + return artId; + } + + @Override + public Branch getBranch() { + return branch; + } + + @Override + public ArtifactType getArtifactType() { + return artifactType; + } + + @Override + public Object getFullArtifact() { + return null; + } + +} diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java index 4ad74310bbc..331a604f63a 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java @@ -13,9 +13,8 @@ package org.eclipse.osee.framework.core.dsl.integration.util; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; -import org.junit.Assert; import org.eclipse.osee.framework.core.data.IOseeBranch; -import org.eclipse.osee.framework.core.dsl.integration.util.OseeDslSegmentParser; +import org.eclipse.osee.framework.core.dsl.integration.mocks.MockArtifact; import org.eclipse.osee.framework.core.dsl.integration.util.OseeDslSegmentParser.OseeDslSegment; import org.eclipse.osee.framework.core.dsl.integration.util.OseeDslSegmentParser.TagLocation; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; @@ -25,8 +24,8 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.exception.OseeStateException; import org.eclipse.osee.framework.core.model.DefaultBasicArtifact; import org.eclipse.osee.framework.core.model.IBasicArtifact; -import org.eclipse.osee.framework.core.model.mocks.MockArtifact; import org.eclipse.osee.framework.jdk.core.util.GUID; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/.project b/plugins/org.eclipse.osee.framework.core.dsl.integration/.project index 2757c0be777..d0db2e298ad 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/.project +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/.project @@ -20,6 +20,11 @@ <arguments> </arguments> </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ds.core.builder</name> + <arguments> + </arguments> + </buildCommand> </buildSpec> <natures> <nature>org.eclipse.pde.PluginNature</nature> diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF index 7345d4a4318..b210faa492c 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/META-INF/MANIFEST.MF @@ -6,15 +6,15 @@ Bundle-Version: 0.9.9.qualifier Bundle-Vendor: Eclipse Open System Engineering Environment Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy -Import-Package: org.eclipse.core.runtime, - org.eclipse.emf.compare.diff.metamodel, +Import-Package: org.eclipse.emf.compare.diff.metamodel, org.eclipse.emf.compare.diff.service, org.eclipse.emf.compare.match.metamodel, org.eclipse.emf.compare.match.service, org.eclipse.osee.framework.core.data, + org.eclipse.osee.framework.core.dsl, + org.eclipse.osee.framework.core.dsl.oseeDsl, org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.core.exception, - org.eclipse.osee.framework.core.message, org.eclipse.osee.framework.core.model, org.eclipse.osee.framework.core.model.access, org.eclipse.osee.framework.core.model.cache, @@ -22,18 +22,12 @@ Import-Package: org.eclipse.core.runtime, org.eclipse.osee.framework.core.operation, org.eclipse.osee.framework.core.services, org.eclipse.osee.framework.core.util, - org.eclipse.osee.framework.database, - org.eclipse.osee.framework.database.core, - org.eclipse.osee.framework.jdk.core.text.change, - org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, - org.osgi.framework, - org.osgi.util.tracker -Require-Bundle: org.eclipse.osee.framework.core.dsl, - org.eclipse.emf.ecore, - org.eclipse.emf.common, - org.eclipse.xtext + org.osgi.framework +Require-Bundle: org.eclipse.xtext, + org.eclipse.core.runtime Eclipse-ExtensibleAPI: true Bundle-Activator: org.eclipse.osee.framework.core.dsl.integration.internal.Activator Export-Package: org.eclipse.osee.framework.core.dsl.integration, org.eclipse.osee.framework.core.dsl.integration.util +Service-Component: OSGI-INF/osee.dsl.modeling.service.xml diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/OSGI-INF/osee.dsl.modeling.service.xml b/plugins/org.eclipse.osee.framework.core.dsl.integration/OSGI-INF/osee.dsl.modeling.service.xml new file mode 100644 index 00000000000..1d8c7ff0dc1 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/OSGI-INF/osee.dsl.modeling.service.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" name="org.eclipse.osee.framework.core.dsl.integration.internal.OseeModelingServiceImpl"> + <implementation class="org.eclipse.osee.framework.core.dsl.integration.internal.OseeModelingServiceImpl"/> + <service> + <provide interface="org.eclipse.osee.framework.core.services.IOseeModelingService"/> + </service> + <reference bind="setFactoryService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/> + <reference bind="setCacheService" cardinality="0..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="dynamic" unbind="unsetCacheService"/> + <reference bind="unsetCacheFactory" cardinality="0..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory" name="IOseeCachingServiceFactory" policy="dynamic"/> +</scr:component> diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/build.properties b/plugins/org.eclipse.osee.framework.core.dsl.integration/build.properties index 34d2e4d2dad..862af7c09de 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/build.properties +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/build.properties @@ -1,4 +1,10 @@ -source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + OSGI-INF/ +source.. = src/ +additional.bundles = org.eclipse.osee.framework.core.dsl,\ + org.eclipse.osee.framework.core.model,\ + org.eclipse.osee.framework.jdk.core,\ + org.eclipse.osee.framework.core,\ + org.eclipse.osgi diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/pom.xml b/plugins/org.eclipse.osee.framework.core.dsl.integration/pom.xml new file mode 100644 index 00000000000..58fdf780fe8 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/pom.xml @@ -0,0 +1,34 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.osee</groupId> + <artifactId>org.eclipse.osee.x.server.parent</artifactId> + <version>0.9.9-SNAPSHOT</version> + <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath> + </parent> + + <artifactId>org.eclipse.osee.framework.core.dsl.integration</artifactId> + <packaging>eclipse-plugin</packaging> + <name>ORCS DSL Integration - (Incubation)</name> + + <build> + <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 --> + <resources> + <resource> + <directory>src</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-source-plugin</artifactId> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/CreateOseeTypeChangesReportOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/CreateOseeTypeChangesReportOperation.java index 5c9f4b9c866..f27a39bc842 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/CreateOseeTypeChangesReportOperation.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/CreateOseeTypeChangesReportOperation.java @@ -16,9 +16,9 @@ import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.dsl.integration.internal.Activator; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.message.TableData; import org.eclipse.osee.framework.core.model.AbstractOseeType; import org.eclipse.osee.framework.core.model.OseeEnumEntry; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache; import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.model.type.AttributeType; diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/Activator.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/Activator.java index 263d045d448..7eaf54eb01b 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/Activator.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/Activator.java @@ -19,21 +19,16 @@ public class Activator implements BundleActivator { public static final String PLUGIN_ID = "org.eclipse.osee.framework.core.dsl.integration"; - private ServiceDependencyTracker dependencyTracker1; private ServiceDependencyTracker dependencyTracker2; @Override public void start(BundleContext context) throws Exception { - dependencyTracker1 = new ServiceDependencyTracker(context, new OseeModelingServiceRegHandler()); - dependencyTracker1.open(); - dependencyTracker2 = new ServiceDependencyTracker(context, new AccessModelInterpreterServiceRegHandler()); dependencyTracker2.open(); } @Override public void stop(BundleContext context) throws Exception { - Lib.close(dependencyTracker1); Lib.close(dependencyTracker2); } } diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java index 131004efaf3..d73a89a912c 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceImpl.java @@ -28,16 +28,16 @@ import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl; import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.exception.OseeExceptions; -import org.eclipse.osee.framework.core.message.IOseeModelingService; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; -import org.eclipse.osee.framework.core.message.TableData; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.operation.CompositeOperation; import org.eclipse.osee.framework.core.operation.IOperation; import org.eclipse.osee.framework.core.operation.Operations; import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory; import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.jdk.core.util.Lib; /** @@ -45,16 +45,39 @@ import org.eclipse.osee.framework.jdk.core.util.Lib; */ public class OseeModelingServiceImpl implements IOseeModelingService { - private final IOseeModelFactoryService modelFactoryService; - private final IOseeCachingService systemCachingService; - private final IOseeCachingServiceFactory cachingFactoryService; - private final OseeDslFactory modelFactory; + private IOseeModelFactoryService modelFactoryService; + private IOseeCachingService systemCachingService; + private IOseeCachingServiceFactory cachingFactoryService; + private OseeDslFactory modelFactory; - public OseeModelingServiceImpl(IOseeModelFactoryService modelFactoryService, IOseeCachingService systemCachingService, IOseeCachingServiceFactory cachingFactoryService, OseeDslFactory dslFactory) { + public void setFactoryService(IOseeModelFactoryService modelFactoryService) { this.modelFactoryService = modelFactoryService; + } + + // This needs to be dynamic since there is a cycle + public void setCacheService(IOseeCachingService systemCachingService) { this.systemCachingService = systemCachingService; + } + + public void unsetCacheService(IOseeCachingService systemCachingService) { + this.systemCachingService = systemCachingService; + } + + // This needs to be dynamic since there is a cycle + public void setCacheFactory(IOseeCachingServiceFactory cachingFactoryService) { this.cachingFactoryService = cachingFactoryService; - this.modelFactory = dslFactory; + } + + public void unsetCacheFactory(IOseeCachingServiceFactory cachingFactoryService) { + this.cachingFactoryService = cachingFactoryService; + } + + public void start() { + modelFactory = OseeDslFactory.eINSTANCE; + } + + public void stop() { + modelFactory = null; } @Override diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceRegHandler.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceRegHandler.java deleted file mode 100644 index 662caee2626..00000000000 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/internal/OseeModelingServiceRegHandler.java +++ /dev/null @@ -1,60 +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.dsl.integration.internal; - -import java.util.Map; -import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory; -import org.eclipse.osee.framework.core.message.IOseeModelingService; -import org.eclipse.osee.framework.core.services.IOseeCachingService; -import org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -/** - * @author Roberto E. Escobar - */ -public class OseeModelingServiceRegHandler extends AbstractTrackingHandler { - - private static final Class<?>[] SERVICE_DEPENDENCIES = new Class<?>[] {// - IOseeCachingService.class, // - IOseeModelFactoryService.class, // - IOseeCachingServiceFactory.class // - }; - - private ServiceRegistration<?> registration; - - @Override - public Class<?>[] getDependencies() { - return SERVICE_DEPENDENCIES; - } - - @Override - public void onActivate(BundleContext context, Map<Class<?>, Object> services) { - IOseeModelFactoryService modelFactoryService = getService(IOseeModelFactoryService.class, services); - IOseeCachingService cachingService = getService(IOseeCachingService.class, services); - IOseeCachingServiceFactory cachingFactoryService = getService(IOseeCachingServiceFactory.class, services); - - IOseeModelingService service = - new OseeModelingServiceImpl(modelFactoryService, cachingService, cachingFactoryService, - OseeDslFactory.eINSTANCE); - registration = context.registerService(IOseeModelingService.class.getName(), service, null); - } - - @Override - public void onDeActivate() { - if (registration != null) { - registration.unregister(); - } - } - -} diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java index 0adc4931002..c93229eec8d 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/CreateEditorReportOperation.java @@ -20,7 +20,7 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.nebula.widgets.xviewer.XViewerColumn; import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType; import org.eclipse.osee.framework.core.dsl.ui.integration.internal.Activator; -import org.eclipse.osee.framework.core.message.TableData; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.Operations; import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorProvider; diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java index fde3ce4f15b..d0bce5aa28b 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/OseeTypesImportOperation.java @@ -29,9 +29,9 @@ import org.eclipse.osee.framework.core.data.OseeServerContext; import org.eclipse.osee.framework.core.dsl.integration.util.ModelUtil; import org.eclipse.osee.framework.core.dsl.ui.integration.internal.Activator; import org.eclipse.osee.framework.core.enums.CoreTranslatorId; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; -import org.eclipse.osee.framework.core.message.TableData; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.core.operation.Operations; import org.eclipse.osee.framework.core.services.IOseeCachingService; diff --git a/plugins/org.eclipse.osee.framework.core.dsl/pom.xml b/plugins/org.eclipse.osee.framework.core.dsl/pom.xml new file mode 100644 index 00000000000..383ec6614ec --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.dsl/pom.xml @@ -0,0 +1,34 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.osee</groupId> + <artifactId>org.eclipse.osee.x.server.parent</artifactId> + <version>0.9.9-SNAPSHOT</version> + <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath> + </parent> + + <artifactId>org.eclipse.osee.framework.core.dsl</artifactId> + <packaging>eclipse-plugin</packaging> + <name>ORCS DSL - (Incubation)</name> + + <build> + <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 --> + <resources> + <resource> + <directory>src</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-source-plugin</artifactId> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java index 6e901f6a90f..88a9c7146c9 100644 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java +++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java @@ -23,16 +23,16 @@ import org.eclipse.osee.framework.core.message.ChangeBranchTypeRequest; import org.eclipse.osee.framework.core.message.ChangeItem; import org.eclipse.osee.framework.core.message.ChangeVersion; import org.eclipse.osee.framework.core.message.DatastoreInitRequest; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; import org.eclipse.osee.framework.core.message.PurgeBranchRequest; import org.eclipse.osee.framework.core.message.SearchOptions; import org.eclipse.osee.framework.core.message.SearchRequest; import org.eclipse.osee.framework.core.message.SearchResponse; -import org.eclipse.osee.framework.core.message.TableData; import org.eclipse.osee.framework.core.model.AbstractOseeType; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.IBasicArtifact; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.type.AttributeType; import org.eclipse.osee.framework.core.model.type.RelationType; diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DatastoreInitRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DatastoreInitRequestTranslatorTest.java index 2325bfc72f9..203bda38ec7 100644 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DatastoreInitRequestTranslatorTest.java +++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DatastoreInitRequestTranslatorTest.java @@ -15,9 +15,9 @@ import java.util.Collection; import java.util.List; import org.junit.Assert; import org.eclipse.osee.framework.core.message.DatastoreInitRequest; -import org.eclipse.osee.framework.core.message.TableData; import org.eclipse.osee.framework.core.message.internal.translation.DatastoreInitRequestTranslator; import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.translation.ITranslator; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java index c6f9eede866..2779af32fa0 100644 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java +++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java @@ -14,9 +14,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.junit.Assert; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelRequestTranslator; import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; import org.eclipse.osee.framework.core.translation.ITranslator; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java index 3d3dd08b9fa..bc145b8ac17 100644 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java +++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java @@ -17,12 +17,12 @@ import java.util.List; import org.junit.Assert; import org.eclipse.osee.framework.core.enums.CoreTranslatorId; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; -import org.eclipse.osee.framework.core.message.TableData; import org.eclipse.osee.framework.core.message.internal.DataTranslationService; import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelResponseTranslator; import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator; import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslator; import org.junit.runner.RunWith; diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java index 545990ae3c9..626f80fff18 100644 --- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java +++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java @@ -15,9 +15,9 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import org.junit.Assert; -import org.eclipse.osee.framework.core.message.TableData; import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator; import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.translation.ITranslator; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java index a02af8b81d9..8cc98bb20c6 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelRequestTranslator.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.message.internal.translation; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java index 283b485f276..4b28f133190 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/OseeImportModelResponseTranslator.java @@ -14,8 +14,8 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.core.enums.CoreTranslatorId; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; -import org.eclipse.osee.framework.core.message.TableData; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.TableData; 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; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java index 1c5530babc7..93c3ce285c5 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java @@ -12,8 +12,8 @@ package org.eclipse.osee.framework.core.message.internal.translation; import java.util.ArrayList; import java.util.List; -import org.eclipse.osee.framework.core.message.TableData; import org.eclipse.osee.framework.core.message.TranslationUtil; +import org.eclipse.osee.framework.core.model.TableData; import org.eclipse.osee.framework.core.translation.ITranslator; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelRequest.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeImportModelRequest.java index c1893cc8d14..f48cc9eca96 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelRequest.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeImportModelRequest.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.message; +package org.eclipse.osee.framework.core.model; /** * @author Roberto E. Escobar diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelResponse.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeImportModelResponse.java index 751ba0d9ec8..fe6a4213175 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeImportModelResponse.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeImportModelResponse.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.message; +package org.eclipse.osee.framework.core.model; import java.util.ArrayList; import java.util.Collection; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TableData.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TableData.java index ef9352bcee9..0f1fd2292de 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TableData.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TableData.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.message; +package org.eclipse.osee.framework.core.model; import java.util.List; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingService.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeModelingService.java index 00197ed7785..683388b5668 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingService.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeModelingService.java @@ -8,11 +8,13 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.message; +package org.eclipse.osee.framework.core.services; import java.io.OutputStream; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; /** * @author Roberto E. Escobar diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingServiceProvider.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeModelingServiceProvider.java index 7b670742f57..d75ab0c3c24 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/IOseeModelingServiceProvider.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeModelingServiceProvider.java @@ -8,7 +8,7 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.message; +package org.eclipse.osee.framework.core.services; import org.eclipse.osee.framework.core.exception.OseeCoreException; diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java index 28227c33b6b..f2bff02b07f 100644 --- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java +++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java @@ -19,12 +19,12 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.osee.framework.core.enums.CoreTranslatorId; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.message.IOseeModelingService; -import org.eclipse.osee.framework.core.message.OseeImportModelRequest; -import org.eclipse.osee.framework.core.message.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; import org.eclipse.osee.framework.core.operation.LogProgressMonitor; import org.eclipse.osee.framework.core.server.ISessionManager; import org.eclipse.osee.framework.core.server.SecureOseeHttpServlet; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.logging.OseeLog; 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 76f16b5b991..0c371475971 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 @@ -17,7 +17,6 @@ import java.util.Set; import org.eclipse.osee.framework.branch.management.IBranchExchange; import org.eclipse.osee.framework.branch.management.IOseeBranchService; import org.eclipse.osee.framework.core.data.OseeServerContext; -import org.eclipse.osee.framework.core.message.IOseeModelingService; import org.eclipse.osee.framework.core.server.IApplicationServerLookup; import org.eclipse.osee.framework.core.server.IApplicationServerManager; import org.eclipse.osee.framework.core.server.IAuthenticationManager; @@ -25,6 +24,7 @@ import org.eclipse.osee.framework.core.server.ISessionManager; import org.eclipse.osee.framework.core.server.OseeHttpServlet; import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; diff --git a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF index 6a9176b0b59..df6109c9d40 100644 --- a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF @@ -12,6 +12,7 @@ Import-Package: org.eclipse.osee.framework.core.data, org.eclipse.osee.framework.core.model, org.eclipse.osee.framework.core.model.cache, org.eclipse.osee.framework.core.model.type, + org.eclipse.osee.framework.core.services, org.eclipse.osee.framework.core.util, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/legacy.cache.service.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/legacy.cache.service.xml new file mode 100644 index 00000000000..d73908e195e --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/legacy.cache.service.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" name="org.eclipse.osee.orcs.core.internal.CachingService"> + <implementation class="org.eclipse.osee.orcs.core.internal.CachingService"/> + <service> + <provide interface="org.eclipse.osee.framework.core.services.IOseeCachingService"/> + </service> + <reference bind="setFactoryService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory" name="IOseeCachingServiceFactory" policy="static"/> + <reference interface="org.eclipse.osee.logger.Log" name="Log" cardinality="1..1" policy="static" bind="setLogger" /> +</scr:component> diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.type.cache.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.type.cache.xml new file mode 100644 index 00000000000..4e7e569ef7b --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.type.cache.xml @@ -0,0 +1,8 @@ +<?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.OrcsTypeCacheImpl"> + <implementation class="org.eclipse.osee.orcs.core.internal.OrcsTypeCacheImpl"/> + <service> + <provide interface="org.eclipse.osee.orcs.core.DataStoreTypeCache"/> + </service> + <reference bind="setCache" 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/CachingService.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/CachingService.java new file mode 100644 index 00000000000..a48600fff37 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/CachingService.java @@ -0,0 +1,114 @@ +/******************************************************************************* + * 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; + +import java.util.Collection; +import org.eclipse.osee.framework.core.enums.OseeCacheEnum; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache; +import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache; +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.OseeEnumTypeCache; +import org.eclipse.osee.framework.core.model.cache.RelationTypeCache; +import org.eclipse.osee.framework.core.model.cache.TransactionCache; +import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory; +import org.eclipse.osee.framework.core.services.IdentityService; +import org.eclipse.osee.logger.Log; + +/** + * @author Roberto E. Escobar + */ +public class CachingService implements IOseeCachingService { + + private IOseeCachingServiceFactory factory; + private Log logger; + private IOseeCachingService proxied; + + public void setFactoryService(IOseeCachingServiceFactory factory) { + this.factory = factory; + } + + public void setLogger(Log logger) { + this.logger = logger; + } + + private Log getLogger() { + return logger; + } + + public void start() { + proxied = factory.createCachingService(); + getLogger().info("ORCS Cache - Created"); + } + + public void stop() { + proxied = null; + getLogger().info("ORCS Cache - Destroyed"); + } + + @Override + public BranchCache getBranchCache() { + return proxied.getBranchCache(); + } + + @Override + public TransactionCache getTransactionCache() { + return proxied.getTransactionCache(); + } + + @Override + public ArtifactTypeCache getArtifactTypeCache() { + return proxied.getArtifactTypeCache(); + } + + @Override + public AttributeTypeCache getAttributeTypeCache() { + return proxied.getAttributeTypeCache(); + } + + @Override + public RelationTypeCache getRelationTypeCache() { + return proxied.getRelationTypeCache(); + } + + @Override + public OseeEnumTypeCache getEnumTypeCache() { + return proxied.getEnumTypeCache(); + } + + @Override + public IdentityService getIdentityService() { + return proxied.getIdentityService(); + } + + @Override + public Collection<?> getCaches() { + return proxied.getCaches(); + } + + @Override + public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException { + return proxied.getCache(cacheId); + } + + @Override + public void reloadAll() throws OseeCoreException { + proxied.reloadAll(); + } + + @Override + public void clearAll() { + proxied.clearAll(); + } + +} diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsTypeCacheImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsTypeCacheImpl.java new file mode 100644 index 00000000000..3841fd852dd --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsTypeCacheImpl.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * 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; + +import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache; +import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache; +import org.eclipse.osee.framework.core.model.cache.RelationTypeCache; +import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.orcs.core.DataStoreTypeCache; + +/** + * @author Roberto E. Escobar + */ +public class OrcsTypeCacheImpl implements DataStoreTypeCache { + + private IOseeCachingService cachingService; + + public void setCache(IOseeCachingService cachingService) { + this.cachingService = cachingService; + } + + @Override + public AttributeTypeCache getAttributeTypeCache() { + return cachingService.getAttributeTypeCache(); + } + + @Override + public ArtifactTypeCache getArtifactTypeCache() { + return cachingService.getArtifactTypeCache(); + } + + @Override + public RelationTypeCache getRelationTypeCache() { + return cachingService.getRelationTypeCache(); + } + +} diff --git a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF index 27f01befcdf..329a1e3e05f 100644 --- a/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.orcs.db/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Bundle-Version: 0.9.9.qualifier Bundle-Vendor: Eclipse Open System Engineering Environment Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Service-Component: OSGI-INF/*.xml -Import-Package: org.eclipse.osee.framework.core.data, +Import-Package: org.eclipse.osee.event, + org.eclipse.osee.framework.core.data, org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.core.exception, org.eclipse.osee.framework.core.model, @@ -22,6 +23,7 @@ Import-Package: org.eclipse.osee.framework.core.data, org.eclipse.osee.framework.resource.management.exception, org.eclipse.osee.framework.resource.management.util, org.eclipse.osee.logger, + org.eclipse.osee.orcs, org.eclipse.osee.orcs.core, org.eclipse.osee.orcs.core.ds, org.eclipse.osee.orcs.core.ds.criteria, diff --git a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml new file mode 100644 index 00000000000..b6d2c4c801f --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/cache.factory.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.orcs.db.internal.CacheFactoryService"> + <implementation class="org.eclipse.osee.orcs.db.internal.CacheFactoryService"/> + <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"/> + <reference bind="setIdentityService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IdentityService" name="IdentityService" policy="static"/> + <reference bind="setFactoryService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/> + <reference bind="setModelService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelingService" name="IOseeModelingService" policy="static"/> + <reference bind="setEventService" cardinality="1..1" interface="org.eclipse.osee.event.EventService" name="EventService" policy="static"/> + <service> + <provide interface="org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory"/> + </service> +</scr:component> diff --git a/plugins/org.eclipse.osee.orcs.db/build.properties b/plugins/org.eclipse.osee.orcs.db/build.properties index 3cb0a58364f..f1258538ac5 100644 --- a/plugins/org.eclipse.osee.orcs.db/build.properties +++ b/plugins/org.eclipse.osee.orcs.db/build.properties @@ -10,4 +10,5 @@ additional.bundles = org.eclipse.osee.framework.database,\ org.eclipse.osee.framework.core,\ org.eclipse.osee.framework.resource.management,\ org.eclipse.osee.framework.core.model,\ - org.eclipse.osee.orcs + org.eclipse.osee.orcs,\ + org.eclipse.osee.event diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java new file mode 100644 index 00000000000..66f020d5b92 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/CacheFactoryService.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * 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; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import org.eclipse.osee.event.EventService; +import org.eclipse.osee.framework.core.model.OseeCachingService; +import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache; +import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache; +import org.eclipse.osee.framework.core.model.cache.BranchCache; +import org.eclipse.osee.framework.core.model.cache.OseeEnumTypeCache; +import org.eclipse.osee.framework.core.model.cache.RelationTypeCache; +import org.eclipse.osee.framework.core.model.cache.TransactionCache; +import org.eclipse.osee.framework.core.model.type.ArtifactType; +import org.eclipse.osee.framework.core.model.type.AttributeType; +import org.eclipse.osee.framework.core.model.type.OseeEnumType; +import org.eclipse.osee.framework.core.model.type.RelationType; +import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.core.services.IOseeCachingServiceFactory; +import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; +import org.eclipse.osee.framework.core.services.IOseeModelingService; +import org.eclipse.osee.framework.core.services.IdentityService; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.logger.Log; +import org.eclipse.osee.orcs.db.internal.accessor.ArtifactTypeDataAccessor; +import org.eclipse.osee.orcs.db.internal.accessor.DatabaseBranchAccessor; +import org.eclipse.osee.orcs.db.internal.accessor.DatabaseTransactionRecordAccessor; + +/** + * @author Roberto E. Escobar + */ +public class CacheFactoryService implements IOseeCachingServiceFactory { + + private IOseeDatabaseService dbService; + private IOseeModelFactoryService factoryService; + private IOseeModelingService modelingService; + private IdentityService identityService; + private Log logger; + private EventService eventService; + + private ExecutorService executor; + + public void start() { + // TODO: Pass in executor admin service + executor = Executors.newFixedThreadPool(5); + } + + public void stop() { + executor.shutdownNow(); + } + + public void setLogger(Log logger) { + this.logger = logger; + } + + public void setDatabaseService(IOseeDatabaseService dbService) { + this.dbService = dbService; + } + + public void setIdentityService(IdentityService identityService) { + this.identityService = identityService; + } + + public void setFactoryService(IOseeModelFactoryService factoryService) { + this.factoryService = factoryService; + } + + public void setModelService(IOseeModelingService modelingService) { + this.modelingService = modelingService; + } + + public void setEventService(EventService eventService) { + this.eventService = eventService; + } + + @Override + public IOseeCachingService createCachingService() { + TransactionCache txCache = new TransactionCache(); + BranchCache branchCache = + new BranchCache(new DatabaseBranchAccessor(logger, executor, eventService, dbService, txCache, + factoryService.getBranchFactory())); + txCache.setAccessor(new DatabaseTransactionRecordAccessor(dbService, branchCache, + factoryService.getTransactionFactory())); + + OseeEnumTypeCache oseeEnumTypeCache = + new OseeEnumTypeCache(new ArtifactTypeDataAccessor<OseeEnumType>(modelingService, identityService)); + AttributeTypeCache attributeCache = + new AttributeTypeCache(new ArtifactTypeDataAccessor<AttributeType>(modelingService, identityService)); + ArtifactTypeCache artifactCache = + new ArtifactTypeCache(new ArtifactTypeDataAccessor<ArtifactType>(modelingService, identityService)); + RelationTypeCache relationCache = + new RelationTypeCache(new ArtifactTypeDataAccessor<RelationType>(modelingService, identityService)); + + return new OseeCachingService(branchCache, txCache, artifactCache, attributeCache, relationCache, + oseeEnumTypeCache, identityService); + } +} diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/AbstractDatabaseAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/AbstractDatabaseAccessor.java new file mode 100644 index 00000000000..87c1a1d221e --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/AbstractDatabaseAccessor.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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.orcs.db.internal.accessor; + +import org.eclipse.osee.framework.core.exception.OseeDataStoreException; +import org.eclipse.osee.framework.core.model.IOseeStorable; +import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.framework.database.core.IOseeSequence; + +/** + * @author Roberto E. Escobar + */ +public abstract class AbstractDatabaseAccessor<K, T extends IOseeStorable> implements IOseeDataAccessor<K, T> { + + private final IOseeDatabaseService databaseService; + + protected AbstractDatabaseAccessor(IOseeDatabaseService databaseService) { + this.databaseService = databaseService; + } + + protected IOseeDatabaseService getDatabaseService() { + return databaseService; + } + + protected IOseeSequence getSequence() throws OseeDataStoreException { + return getDatabaseService().getSequence(); + } +} diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/ArtifactTypeDataAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/ArtifactTypeDataAccessor.java new file mode 100644 index 00000000000..3ea60c7d575 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/ArtifactTypeDataAccessor.java @@ -0,0 +1,91 @@ +/* + * Created on Aug 17, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.orcs.db.internal.accessor; + +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Collection; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; +import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.core.enums.CoreBranches; +import org.eclipse.osee.framework.core.enums.LoadLevel; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.AbstractOseeType; +import org.eclipse.osee.framework.core.model.OseeImportModelRequest; +import org.eclipse.osee.framework.core.model.OseeImportModelResponse; +import org.eclipse.osee.framework.core.model.cache.IOseeCache; +import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor; +import org.eclipse.osee.framework.core.services.IOseeModelingService; +import org.eclipse.osee.framework.core.services.IdentityService; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.orcs.OseeApi; +import org.eclipse.osee.orcs.data.ReadableArtifact; +import org.eclipse.osee.orcs.search.QueryFactory; +import org.eclipse.osee.orcs.search.ResultSet; + +public class ArtifactTypeDataAccessor<T extends AbstractOseeType<Long>> implements IOseeDataAccessor<Long, T> { + + private static volatile boolean wasLoaded; + + private final IOseeModelingService modelingService; + private final IdentityService identityService; + + private OseeApi oseeApi; + + public ArtifactTypeDataAccessor(IOseeModelingService modelingService, IdentityService identityService) { + this.modelingService = modelingService; + this.identityService = identityService; + } + + @Override + public synchronized void load(IOseeCache<Long, T> cache) throws OseeCoreException { + if (!wasLoaded) { + wasLoaded = true; + String modelData = getTypeData(); + if (Strings.isValid(modelData)) { + String modelName = String.format("osee.types.%s.osee", Lib.getDateTimeString()); + + OseeImportModelRequest request = new OseeImportModelRequest(modelName, modelData, false, false, true); + OseeImportModelResponse response = new OseeImportModelResponse(); + modelingService.importOseeTypes(new NullProgressMonitor(), true, request, response); + } + } + } + + @Override + public void store(Collection<T> types) throws OseeCoreException { + Collection<Long> remoteIds = new ArrayList<Long>(); + for (T type : types) { + remoteIds.add(type.getGuid()); + } + identityService.store(remoteIds); + for (T type : types) { + type.setId(identityService.getLocalId(type.getGuid())); + type.clearDirty(); + } + } + + private String getTypeData() throws OseeCoreException { + QueryFactory factory = oseeApi.getQueryFactory(null); + ResultSet<ReadableArtifact> result = + factory.fromBranch(CoreBranches.COMMON).and(CoreArtifactTypes.OseeTypeDefinition).build(LoadLevel.ATTRIBUTE); + + StringWriter writer = new StringWriter(); + for (ReadableArtifact artifact : result.getList()) { + String oseeTypeFragment = artifact.getSoleAttributeAsString(CoreAttributeTypes.UriGeneralStringData); + oseeTypeFragment = oseeTypeFragment.replaceAll("import\\s+\"", "// import \""); + writer.write("\n"); + writer.write("////////////// "); + writer.write(artifact.getName()); + writer.write("\n"); + writer.write("\n"); + writer.write(oseeTypeFragment); + } + return writer.toString(); + } +} diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java new file mode 100644 index 00000000000..cc9644349e5 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseBranchAccessor.java @@ -0,0 +1,206 @@ +/******************************************************************************* + * 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.orcs.db.internal.accessor; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.osee.event.EventService; +import org.eclipse.osee.framework.core.enums.BranchArchivedState; +import org.eclipse.osee.framework.core.enums.BranchState; +import org.eclipse.osee.framework.core.enums.BranchType; +import org.eclipse.osee.framework.core.enums.StorageState; +import org.eclipse.osee.framework.core.exception.BranchDoesNotExist; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.core.exception.OseeStateException; +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.core.model.cache.IOseeCache; +import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor; +import org.eclipse.osee.framework.core.model.cache.TransactionCache; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.framework.database.core.IOseeStatement; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.logger.Log; +import org.eclipse.osee.orcs.db.internal.callable.StoreBranchCallable; + +/** + * @author Roberto E. Escobar + */ +public class DatabaseBranchAccessor implements IOseeDataAccessor<String, Branch> { + private static final int NULL_PARENT_BRANCH_ID = -1; + + private static final String SELECT_BRANCHES = "SELECT * FROM osee_branch"; + private static final String SELECT_MERGE_BRANCHES = "SELECT * FROM osee_merge"; + + private final Log logger; + private final IOseeDatabaseService dbService; + private final ExecutorService executor; + private final EventService eventService; + + private final TransactionCache txCache; + private final BranchFactory branchFactory; + + public DatabaseBranchAccessor(Log logger, ExecutorService executor, EventService eventService, IOseeDatabaseService dbService, TransactionCache txCache, BranchFactory branchFactory) { + this.logger = logger; + this.executor = executor; + this.eventService = eventService; + this.dbService = dbService; + this.txCache = txCache; + this.branchFactory = branchFactory; + } + + public Log getLogger() { + return logger; + } + + private IOseeDatabaseService getDatabaseService() { + return dbService; + } + + @Override + public void load(IOseeCache<String, Branch> cache) throws OseeCoreException { + long startTime = System.currentTimeMillis(); + Map<Branch, Integer> childToParent = new HashMap<Branch, Integer>(); + Map<Branch, Integer> branchToBaseTx = new HashMap<Branch, Integer>(); + Map<Branch, Integer> branchToSourceTx = new HashMap<Branch, Integer>(); + Map<Branch, Integer> associatedArtifact = new HashMap<Branch, Integer>(); + + BranchCache brCache = (BranchCache) cache; + loadBranches(brCache, childToParent, branchToBaseTx, branchToSourceTx, associatedArtifact); + loadBranchHierarchy(brCache, childToParent); + loadMergeBranches(brCache); + loadAssociatedArtifacts(brCache, associatedArtifact); + loadBranchRelatedTransactions(brCache, branchToBaseTx, branchToSourceTx); + + for (Branch branch : cache.getAll()) { + branch.clearDirty(); + } + getLogger().info("Branch Cache loaded [%s]", Lib.getElapseString(startTime)); + } + + private void loadBranches(BranchCache cache, Map<Branch, Integer> childToParent, Map<Branch, Integer> branchToBaseTx, Map<Branch, Integer> branchToSourceTx, Map<Branch, Integer> associatedArtifact) throws OseeCoreException { + IOseeStatement chStmt = getDatabaseService().getStatement(); + try { + chStmt.runPreparedQuery(2000, SELECT_BRANCHES); + while (chStmt.next()) { + try { + int branchId = chStmt.getInt("branch_id"); + + String branchName = chStmt.getString("branch_name"); + BranchState branchState = BranchState.getBranchState(chStmt.getInt("branch_state")); + BranchType branchType = BranchType.valueOf(chStmt.getInt("branch_type")); + boolean isArchived = BranchArchivedState.valueOf(chStmt.getInt("archived")).isArchived(); + String branchGuid = chStmt.getString("branch_guid"); + Branch branch = + branchFactory.createOrUpdate(cache, branchId, StorageState.LOADED, branchGuid, branchName, + branchType, branchState, isArchived); + + Integer parentBranchId = chStmt.getInt("parent_branch_id"); + if (parentBranchId != NULL_PARENT_BRANCH_ID) { + childToParent.put(branch, parentBranchId); + } + branchToSourceTx.put(branch, chStmt.getInt("parent_transaction_id")); + branchToBaseTx.put(branch, chStmt.getInt("baseline_transaction_id")); + associatedArtifact.put(branch, chStmt.getInt("associated_art_id")); + } catch (OseeCoreException ex) { + getLogger().error(ex, "Error loading branches"); + } + } + } finally { + chStmt.close(); + } + } + + private void loadAssociatedArtifacts(BranchCache cache, Map<Branch, Integer> associatedArtifact) throws OseeCoreException { + for (Entry<Branch, Integer> entry : associatedArtifact.entrySet()) { + Branch branch = entry.getKey(); + branch.setAssociatedArtifactId(entry.getValue()); + } + } + + private void loadBranchRelatedTransactions(BranchCache cache, Map<Branch, Integer> branchToBaseTx, Map<Branch, Integer> branchToSourceTx) throws OseeCoreException { + Set<Integer> transactionIds = new HashSet<Integer>(); + transactionIds.addAll(branchToSourceTx.values()); + transactionIds.addAll(branchToBaseTx.values()); + txCache.loadTransactions(transactionIds); + + for (Entry<Branch, Integer> entry : branchToBaseTx.entrySet()) { + Branch branch = entry.getKey(); + if (branch.getBaseTransaction() == null) { + TransactionRecord baseTx = txCache.getById(entry.getValue()); + branch.setBaseTransaction(baseTx); + } + } + + for (Entry<Branch, Integer> entry : branchToSourceTx.entrySet()) { + Branch branch = entry.getKey(); + if (branch.getSourceTransaction() == null) { + TransactionRecord srcTx = txCache.getById(entry.getValue()); + branch.setSourceTransaction(srcTx); + } + } + } + + private void loadBranchHierarchy(BranchCache branchCache, Map<Branch, Integer> childToParent) throws OseeCoreException { + for (Entry<Branch, Integer> entry : childToParent.entrySet()) { + Branch childBranch = entry.getKey(); + Branch parentBranch = branchCache.getById(entry.getValue()); + if (parentBranch == null) { + throw new BranchDoesNotExist("Parent Branch id:[%s] does not exist for child branch [%s]", + entry.getValue(), entry.getKey()); + } + childBranch.setParentBranch(parentBranch); + } + } + + private void loadMergeBranches(BranchCache branchCache) throws OseeCoreException { + IOseeStatement chStmt = getDatabaseService().getStatement(); + try { + chStmt.runPreparedQuery(1000, SELECT_MERGE_BRANCHES); + while (chStmt.next()) { + Branch sourceBranch = branchCache.getById(chStmt.getInt("source_branch_id")); + Branch destBranch = branchCache.getById(chStmt.getInt("dest_branch_id")); + + MergeBranch mergeBranch = (MergeBranch) branchCache.getById(chStmt.getInt("merge_branch_id")); + mergeBranch.setSourceBranch(sourceBranch); + mergeBranch.setDestinationBranch(destBranch); + } + } finally { + chStmt.close(); + } + + } + + @Override + public void store(Collection<Branch> branches) throws OseeCoreException { + StoreBranchCallable task = new StoreBranchCallable(dbService, executor, eventService, branches); + Future<IStatus> future = executor.submit(task); + try { + IStatus status = future.get(); + if (!status.isOK()) { + throw new OseeStateException("Error storing branches"); + } + } catch (Exception ex) { + OseeExceptions.wrapAndThrow(ex); + } + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java new file mode 100644 index 00000000000..ad4f249063b --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java @@ -0,0 +1,179 @@ +/******************************************************************************* + * 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.accessor; + +import java.util.Collection; +import java.util.Date; +import org.eclipse.osee.framework.core.enums.TransactionDetailsType; +import org.eclipse.osee.framework.core.enums.TransactionVersion; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeStateException; +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.ITransactionDataAccessor; +import org.eclipse.osee.framework.core.model.cache.TransactionCache; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.framework.database.core.IOseeStatement; +import org.eclipse.osee.framework.database.core.IdJoinQuery; +import org.eclipse.osee.framework.database.core.JoinUtility; +import org.eclipse.osee.framework.jdk.core.type.MutableInteger; + +/** + * @author Roberto E. Escobar + */ +public class DatabaseTransactionRecordAccessor implements ITransactionDataAccessor { + + private static final String SELECT_BASE_TRANSACTION = + "select * from osee_tx_details where branch_id = ? and tx_type = ?"; + + private static final String SELECT_BY_TRANSACTION = "select * from osee_tx_details WHERE transaction_id = ?"; + + private static final String SELECT_HEAD_TRANSACTION = + "select * from osee_tx_details where transaction_id = (select max(transaction_id) from osee_tx_details where branch_id = ?) and branch_id = ?"; + + private static final String SELECT_TRANSACTIONS_BY_QUERY_ID = + "select * from osee_join_id oji, osee_tx_details txd where oji.query_id = ? and txd.transaction_id = oji.id"; + + private static final String SELECT_NON_EXISTING_TRANSACTIONS_BY_QUERY_ID = + "select oji.id from osee_join_id oji where oji.query_id = ? and not exists (select 1 from osee_tx_details txd where txd.transaction_id = oji.id)"; + + private static final String GET_PRIOR_TRANSACTION = + "select max(transaction_id) FROM osee_tx_details where branch_id = ? and transaction_id < ?"; + + private final IOseeDatabaseService oseeDatabaseService; + private final BranchCache branchCache; + private final TransactionRecordFactory factory; + + public DatabaseTransactionRecordAccessor(IOseeDatabaseService oseeDatabaseService, BranchCache branchCache, TransactionRecordFactory factory) { + this.oseeDatabaseService = oseeDatabaseService; + this.branchCache = branchCache; + this.factory = factory; + } + + private synchronized void ensureDependantCachePopulated() throws OseeCoreException { + branchCache.ensurePopulated(); + } + + @Override + public void loadTransactionRecord(TransactionCache cache, Collection<Integer> transactionIds) throws OseeCoreException { + if (transactionIds.isEmpty()) { + return; + } + ensureDependantCachePopulated(); + if (transactionIds.size() > 1) { + IdJoinQuery joinQuery = JoinUtility.createIdJoinQuery(); + try { + for (Integer txNumber : transactionIds) { + joinQuery.add(txNumber); + } + joinQuery.store(); + + loadTransactions(cache, transactionIds.size(), SELECT_TRANSACTIONS_BY_QUERY_ID, joinQuery.getQueryId()); + + } finally { + joinQuery.delete(); + } + } else { + loadTransaction(cache, SELECT_BY_TRANSACTION, transactionIds.iterator().next()); + } + } + + @Override + public TransactionRecord loadTransactionRecord(TransactionCache cache, Branch branch, TransactionVersion transactionType) throws OseeCoreException { + ensureDependantCachePopulated(); + TransactionRecord toReturn = null; + switch (transactionType) { + case BASE: + toReturn = + loadTransaction(cache, SELECT_BASE_TRANSACTION, branch.getId(), TransactionDetailsType.Baselined); + break; + case HEAD: + toReturn = loadTransaction(cache, SELECT_HEAD_TRANSACTION, branch.getId(), branch.getId()); + break; + default: + throw new OseeStateException("Transaction Type [%s] is not supported", transactionType); + } + return toReturn; + } + + private void loadTransactions(TransactionCache cache, int expectedCount, String query, int queryId) throws OseeCoreException { + MutableInteger numberLoaded = new MutableInteger(-1); + loadFromTransaction(cache, expectedCount, numberLoaded, query, queryId); + + if (numberLoaded.getValue() != expectedCount) { + IOseeStatement chStmt = oseeDatabaseService.getStatement(); + try { + chStmt.runPreparedQuery(expectedCount, SELECT_NON_EXISTING_TRANSACTIONS_BY_QUERY_ID, queryId); + while (chStmt.next()) { + int transactionNumber = chStmt.getInt("id"); + factory.getOrCreate(cache, transactionNumber); + } + } finally { + chStmt.close(); + } + } + } + + private TransactionRecord loadTransaction(TransactionCache cache, String query, Object... parameters) throws OseeCoreException { + return loadFromTransaction(cache, 1, new MutableInteger(0), query, parameters); + } + + private TransactionRecord loadFromTransaction(TransactionCache cache, int expectedCount, MutableInteger numberLoaded, String query, Object... parameters) throws OseeCoreException { + IOseeStatement chStmt = oseeDatabaseService.getStatement(); + TransactionRecord record = null; + int count = 0; + try { + chStmt.runPreparedQuery(expectedCount, query, parameters); + while (chStmt.next()) { + count++; + int branchId = chStmt.getInt("branch_id"); + int transactionNumber = chStmt.getInt("transaction_id"); + String comment = chStmt.getString("osee_comment"); + Date timestamp = chStmt.getTimestamp("time"); + int authorArtId = chStmt.getInt("author"); + int commitArtId = chStmt.getInt("commit_art_id"); + TransactionDetailsType txType = TransactionDetailsType.toEnum(chStmt.getInt("tx_type")); + + record = + prepareTransactionRecord(cache, transactionNumber, branchId, comment, timestamp, authorArtId, + commitArtId, txType); + } + numberLoaded.setValue(count); + } finally { + chStmt.close(); + } + return record; + } + + private TransactionRecord prepareTransactionRecord(TransactionCache cache, int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType) throws OseeCoreException { + TransactionRecord record = + factory.createOrUpdate(cache, transactionNumber, branchId, comment, timestamp, authorArtId, commitArtId, + txType); + record.setBranchCache(branchCache); + record.clearDirty(); + return record; + } + + @SuppressWarnings("unused") + @Override + public void load(TransactionCache transactionCache) throws OseeCoreException { + // Not implemented + } + + @Override + public TransactionRecord getOrLoadPriorTransaction(TransactionCache cache, int transactionNumber, int branchId) throws OseeCoreException { + int priorTransactionId = + oseeDatabaseService.runPreparedQueryFetchObject(-1, GET_PRIOR_TRANSACTION, branchId, transactionNumber); + return cache.getOrLoad(priorTransactionId); + } +} diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchCallable.java new file mode 100644 index 00000000000..013fe3279c7 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/MoveBranchCallable.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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.orcs.db.internal.callable; + +import java.util.HashMap; +import org.eclipse.osee.event.EventService; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.framework.database.core.OseeConnection; +import org.eclipse.osee.orcs.OrcsConstants; +import org.eclipse.osee.orcs.db.internal.util.DatabaseTxCallable; + +/** + * @author Ryan D. Brooks + */ +public class MoveBranchCallable extends DatabaseTxCallable { + + private static final String INSERT_ADDRESSING = + "insert into %s (transaction_id, gamma_id, tx_current, mod_type, branch_id) select transaction_id, gamma_id, tx_current, mod_type, branch_id from %s where branch_id = ?"; + + public static final String DELETE_ADDRESSING = "delete from %s where branch_id = ?"; + private final boolean archive; + private final Branch branch; + + private final EventService eventService; + + public MoveBranchCallable(IOseeDatabaseService databaseService, EventService eventService, boolean archive, Branch branch) { + super(databaseService, "Branch Move"); + this.eventService = eventService; + this.archive = archive; + this.branch = branch; + } + + private EventService getEventService() { + return eventService; + } + + @Override + protected void handleTxWork(OseeConnection connection) throws OseeCoreException { + String sourceTableName = archive ? "osee_txs" : "osee_txs_archived"; + String destinationTableName = archive ? "osee_txs_archived" : "osee_txs"; + + String sql = String.format(INSERT_ADDRESSING, destinationTableName, sourceTableName); + getDatabaseService().runPreparedUpdate(connection, sql, branch.getId()); + + sql = String.format(DELETE_ADDRESSING, sourceTableName); + getDatabaseService().runPreparedUpdate(connection, sql, branch.getId()); + + // TODO Populated Event Data + getEventService().postEvent(OrcsConstants.BRANCH_MOVE_EVENT, new HashMap<String, Object>()); + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java new file mode 100644 index 00000000000..0d1618fb765 --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/StoreBranchCallable.java @@ -0,0 +1,153 @@ +/******************************************************************************* + * 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.orcs.db.internal.callable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutorService; +import org.eclipse.osee.event.EventService; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.AbstractOseeType; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.core.model.BranchField; +import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.framework.database.core.OseeConnection; +import org.eclipse.osee.orcs.OrcsConstants; +import org.eclipse.osee.orcs.db.internal.util.DatabaseTxCallable; + +/** + * @author Ryan D. Brooks + */ +public class StoreBranchCallable extends DatabaseTxCallable { + protected static final int NULL_PARENT_BRANCH_ID = -1; + + private static final String INSERT_BRANCH = + "INSERT INTO osee_branch (branch_id, branch_guid, branch_name, parent_branch_id, parent_transaction_id, archived, associated_art_id, branch_type, branch_state, baseline_transaction_id) VALUES (?,?,?,?,?,?,?,?,?,?)"; + + private static final String UPDATE_BRANCH = + "update osee_branch SET branch_name = ?, parent_branch_id = ?, parent_transaction_id = ?, archived = ?, associated_art_id = ?, branch_type = ?, branch_state = ?, baseline_transaction_id = ? where branch_id = ?"; + + private static final String DELETE_BRANCH = "DELETE from osee_branch where branch_id = ?"; + + private final Collection<Branch> branches; + private final ExecutorService executor; + private final EventService eventService; + + public StoreBranchCallable(IOseeDatabaseService dbService, ExecutorService executor, EventService eventService, Collection<Branch> branches) { + super(dbService, "Branch Archive Operation"); + this.executor = executor; + this.eventService = eventService; + this.branches = branches; + } + + private EventService getEventService() { + return eventService; + } + + private ExecutorService getExecutorService() { + return executor; + } + + @Override + public void handleTxWork(OseeConnection connection) throws OseeCoreException { + List<Object[]> insertData = new ArrayList<Object[]>(); + List<Object[]> updateData = new ArrayList<Object[]>(); + List<Object[]> deleteData = new ArrayList<Object[]>(); + + for (Branch branch : branches) { + if (isDataDirty(branch)) { + switch (branch.getStorageState()) { + case CREATED: + branch.setId(getDatabaseService().getSequence().getNextBranchId()); + insertData.add(toInsertValues(branch)); + break; + case MODIFIED: + updateData.add(toUpdateValues(branch)); + break; + case PURGED: + deleteData.add(toDeleteValues(branch)); + break; + default: + break; + } + } + if (branch.isFieldDirty(BranchField.BRANCH_ARCHIVED_STATE_FIELD_KEY)) { + DatabaseTxCallable task = + new MoveBranchCallable(getDatabaseService(), getEventService(), branch.getArchiveState().isArchived(), + branch); + getExecutorService().submit(task); + } + } + getDatabaseService().runBatchUpdate(connection, INSERT_BRANCH, insertData); + getDatabaseService().runBatchUpdate(connection, UPDATE_BRANCH, updateData); + getDatabaseService().runBatchUpdate(connection, DELETE_BRANCH, deleteData); + + for (Branch branch : branches) { + branch.clearDirty(); + } + getEventService().postEvent(OrcsConstants.BRANCH_CHANGE_EVENT, new HashMap<String, Object>()); + } + + private Object[] toInsertValues(Branch branch) throws OseeCoreException { + Branch parentBranch = branch.getParentBranch(); + TransactionRecord baseTxRecord = branch.getBaseTransaction(); + int parentBranchId = parentBranch != null ? parentBranch.getId() : NULL_PARENT_BRANCH_ID; + int baselineTransaction = baseTxRecord != null ? baseTxRecord.getId() : NULL_PARENT_BRANCH_ID; + + return new Object[] { + branch.getId(), + branch.getGuid(), + branch.getName(), + parentBranchId, + branch.getSourceTransaction().getId(), + branch.getArchiveState().getValue(), + branch.getAssociatedArtifactId(), + branch.getBranchType().getValue(), + branch.getBranchState().getValue(), + baselineTransaction}; + } + + private Object[] toUpdateValues(Branch branch) throws OseeCoreException { + Branch parentBranch = branch.getParentBranch(); + TransactionRecord baseTxRecord = branch.getBaseTransaction(); + int parentBranchId = parentBranch != null ? parentBranch.getId() : NULL_PARENT_BRANCH_ID; + int baselineTransaction = baseTxRecord != null ? baseTxRecord.getId() : NULL_PARENT_BRANCH_ID; + return new Object[] { + branch.getName(), + parentBranchId, + branch.getSourceTransaction().getId(), + branch.getArchiveState().getValue(), + branch.getAssociatedArtifactId(), + branch.getBranchType().getValue(), + branch.getBranchState().getValue(), + baselineTransaction, + branch.getId()}; + } + + private Object[] toDeleteValues(Branch branch) { + return new Object[] {branch.getId()}; + } + + private boolean isDataDirty(Branch type) throws OseeCoreException { + return type.areFieldsDirty(// + AbstractOseeType.NAME_FIELD_KEY, // + AbstractOseeType.UNIQUE_ID_FIELD_KEY, // + BranchField.BRANCH_ARCHIVED_STATE_FIELD_KEY, // + BranchField.BRANCH_STATE_FIELD_KEY, // + BranchField.BRANCH_TYPE_FIELD_KEY, // + BranchField.BRANCH_ASSOCIATED_ARTIFACT_ID_FIELD_KEY, // + BranchField.BRANCH_BASE_TRANSACTION); + } + +} diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DatabaseTxCallable.java new file mode 100644 index 00000000000..e419995188b --- /dev/null +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/DatabaseTxCallable.java @@ -0,0 +1,76 @@ +/* + * Created on Oct 14, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.orcs.db.internal.util; + +import java.util.concurrent.Callable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.framework.database.core.DatabaseTransactions; +import org.eclipse.osee.framework.database.core.IDbTransactionWork; +import org.eclipse.osee.framework.database.core.OseeConnection; + +public abstract class DatabaseTxCallable implements Callable<IStatus> { + + private final IOseeDatabaseService dbService; + private final String name; + + public DatabaseTxCallable(IOseeDatabaseService dbService, String name) { + this.dbService = dbService; + this.name = name; + } + + protected IOseeDatabaseService getDatabaseService() { + return dbService; + } + + @Override + public final IStatus call() throws Exception { + OseeConnection connection = getDatabaseService().getConnection(); + try { + InternalTxWork work = new InternalTxWork(); + DatabaseTransactions.execute(connection, work); + } finally { + connection.close(); + } + return Status.OK_STATUS; + } + + protected abstract void handleTxWork(OseeConnection connection) throws OseeCoreException; + + protected void handleTxException(Exception ex) { + // Do nothing + } + + @SuppressWarnings("unused") + protected void handleTxFinally() throws OseeCoreException { + // Do nothing + } + + private final class InternalTxWork implements IDbTransactionWork { + + @Override + public String getName() { + return name; + } + + @Override + public void handleTxWork(OseeConnection connection) throws OseeCoreException { + DatabaseTxCallable.this.handleTxWork(connection); + } + + @Override + public void handleTxException(Exception ex) { + DatabaseTxCallable.this.handleTxException(ex); + } + + @Override + public void handleTxFinally() throws OseeCoreException { + DatabaseTxCallable.this.handleTxFinally(); + } + }; +} diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsConstants.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsConstants.java new file mode 100644 index 00000000000..9bcbf6d885b --- /dev/null +++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsConstants.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.orcs; + +/** + * @author Roberto E. Escobar + */ +public final class OrcsConstants { + + private OrcsConstants() { + // Constants class + } + + private static final String PREFIX = "org/eclipse/osee/orcs/event/"; + + public static final String REGISTRATION_EVENT = PREFIX + "OSEE_ORCS_SERVICE_REGISTRATION"; + + public static final String BRANCH_CHANGE_EVENT = PREFIX + "branch/CHANGE"; + public static final String BRANCH_MOVE_EVENT = PREFIX + "branch/MOVE"; +} diff --git a/plugins/org.eclipse.osee.x.server.parent/pom.xml b/plugins/org.eclipse.osee.x.server.parent/pom.xml index a569869fde9..08c05d2261a 100644 --- a/plugins/org.eclipse.osee.x.server.parent/pom.xml +++ b/plugins/org.eclipse.osee.x.server.parent/pom.xml @@ -12,6 +12,9 @@ <modules> <module>../../plugins/org.eclipse.osee.framework.core</module> <module>../../plugins/org.eclipse.osee.framework.core.test</module> + <module>../../plugins/org.eclipse.osee.framework.core.dsl</module> + <module>../../plugins/org.eclipse.osee.framework.core.dsl.integration</module> + <module>../../plugins/org.eclipse.osee.framework.core.dsl.integration.test</module> <module>../../plugins/org.eclipse.osee.framework.core.model</module> <module>../../plugins/org.eclipse.osee.framework.core.model.test</module> <module>../../plugins/org.eclipse.osee.framework.resource.management</module> |