diff options
author | jmisinco | 2012-04-25 20:34:24 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2012-04-25 20:34:24 +0000 |
commit | 1bade4b39557a88055cb33ad6f06a7b6604dcf72 (patch) | |
tree | 482a9372e39d5ec3c00d5f03d9cbdcb110b8e040 /plugins | |
parent | fc2bd3a1435862af41fbadab51aacf446aa83ee0 (diff) | |
download | org.eclipse.osee-1bade4b39557a88055cb33ad6f06a7b6604dcf72.tar.gz org.eclipse.osee-1bade4b39557a88055cb33ad6f06a7b6604dcf72.tar.xz org.eclipse.osee-1bade4b39557a88055cb33ad6f06a7b6604dcf72.zip |
feature[ats_VGR8B]: Convert skynet core to DS
Diffstat (limited to 'plugins')
34 files changed, 394 insertions, 301 deletions
diff --git a/plugins/org.eclipse.osee.client.all.parent/workspace/.metadata/.log b/plugins/org.eclipse.osee.client.all.parent/workspace/.metadata/.log new file mode 100644 index 00000000000..2c1cd3cde5e --- /dev/null +++ b/plugins/org.eclipse.osee.client.all.parent/workspace/.metadata/.log @@ -0,0 +1,66 @@ +!SESSION 2012-04-25 15:14:57.656 ----------------------------------------------- +eclipse.buildId=unknown +java.version=1.6.0_25 +java.vendor=Sun Microsystems Inc. +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US +Framework arguments: -eclipse.keyring C:\Users\sk602c\AppData\Local\Temp\tycho4178995945087560302secure_storage +Command-line arguments: -eclipse.keyring C:\Users\sk602c\AppData\Local\Temp\tycho4178995945087560302secure_storage + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:14:57.656 +!MESSAGE System property http.proxyHost is not set but should be www-slb-proxy.boeing.com. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:14:57.656 +!MESSAGE System property http.proxyPort is not set but should be 31060. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:14:57.782 +!MESSAGE System property http.proxyHost is set to www-slb-proxy.boeing.com but should not be set. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:14:57.796 +!MESSAGE System property http.proxyHost is not set but should be www-slb-proxy.boeing.com. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:14:57.796 +!MESSAGE System property http.proxyPort is not set but should be 31060. +!SESSION 2012-04-25 15:19:19.777 ----------------------------------------------- +eclipse.buildId=unknown +java.version=1.6.0_25 +java.vendor=Sun Microsystems Inc. +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US +Framework arguments: -eclipse.keyring C:\Users\sk602c\AppData\Local\Temp\tycho8568397976087452282secure_storage +Command-line arguments: -eclipse.keyring C:\Users\sk602c\AppData\Local\Temp\tycho8568397976087452282secure_storage + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:19:19.777 +!MESSAGE System property http.proxyHost is not set but should be www-slb-proxy.boeing.com. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:19:19.778 +!MESSAGE System property http.proxyPort is not set but should be 31060. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:19:19.904 +!MESSAGE System property http.proxyHost is set to www-slb-proxy.boeing.com but should not be set. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:19:19.918 +!MESSAGE System property http.proxyHost is not set but should be www-slb-proxy.boeing.com. + +!ENTRY org.eclipse.core.net 1 0 2012-04-25 15:19:19.918 +!MESSAGE System property http.proxyPort is not set but should be 31060. +!SESSION 2012-04-26 09:35:06.841 ----------------------------------------------- +eclipse.buildId=unknown +java.version=1.6.0_25 +java.vendor=Sun Microsystems Inc. +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US +Framework arguments: -eclipse.keyring C:\Users\sk602c\AppData\Local\Temp\tycho1887151385974562995secure_storage +Command-line arguments: -eclipse.keyring C:\Users\sk602c\AppData\Local\Temp\tycho1887151385974562995secure_storage + +!ENTRY org.eclipse.core.net 1 0 2012-04-26 09:35:06.841 +!MESSAGE System property http.proxyHost is not set but should be www-slb-proxy.boeing.com. + +!ENTRY org.eclipse.core.net 1 0 2012-04-26 09:35:06.842 +!MESSAGE System property http.proxyPort is not set but should be 31060. + +!ENTRY org.eclipse.core.net 1 0 2012-04-26 09:35:06.970 +!MESSAGE System property http.proxyHost is set to www-slb-proxy.boeing.com but should not be set. + +!ENTRY org.eclipse.core.net 1 0 2012-04-26 09:35:07.013 +!MESSAGE System property http.proxyHost is not set but should be www-slb-proxy.boeing.com. + +!ENTRY org.eclipse.core.net 1 0 2012-04-26 09:35:07.013 +!MESSAGE System property http.proxyPort is not set but should be 31060. diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/IOseeDatabaseServiceProvider.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/IOseeDatabaseServiceProvider.java index 0aa0367889f..c9527ba9cfc 100644 --- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/IOseeDatabaseServiceProvider.java +++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/IOseeDatabaseServiceProvider.java @@ -10,12 +10,12 @@ *******************************************************************************/ package org.eclipse.osee.framework.database; -import org.eclipse.osee.framework.core.exception.OseeDataStoreException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; /** * @author Roberto E. Escobar */ public interface IOseeDatabaseServiceProvider { - IOseeDatabaseService getOseeDatabaseService() throws OseeDataStoreException; + IOseeDatabaseService getOseeDatabaseService() throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF index 31b488f9f5f..5aa0b7d5652 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF @@ -77,4 +77,4 @@ Import-Package: org.apache.commons.lang;version="2.4.0", org.eclipse.osee.framework.plugin.core.util Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy -Service-Component: OSGI-INF/access.policy.service.xml +Service-Component: OSGI-INF/*.xml diff --git a/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.client.caching.service.xml b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.client.caching.service.xml new file mode 100644 index 00000000000..7a66eb81e27 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.client.caching.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" deactivate="stop" name="org.eclipse.osee.framework.skynet.core.internal.ClientCachingServiceProxy"> + <implementation class="org.eclipse.osee.framework.skynet.core.internal.ClientCachingServiceProxy"/> + <service> + <provide interface="org.eclipse.osee.framework.core.services.IOseeCachingService"/> + </service> + <reference bind="setIdentityService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IdentityService" name="IdentityService" policy="static"/> + <reference bind="setModelFactory" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeModelFactoryService" name="IOseeModelFactoryService" policy="static"/> +</scr:component> diff --git a/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.event.system.service.xml b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.event.system.service.xml new file mode 100644 index 00000000000..0b8b6153151 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/osee.event.system.service.xml @@ -0,0 +1,6 @@ +<?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.framework.skynet.core.internal.OseeEventAdmin"> + <implementation class="org.eclipse.osee.framework.skynet.core.internal.OseeEventAdmin"/> + <reference bind="addEventListener" cardinality="0..n" interface="org.eclipse.osee.framework.skynet.core.event.listener.IEventListener" name="IEventListener" policy="dynamic" unbind="removeEventListener"/> + <reference bind="setOseeCoreModelEventService" cardinality="1..1" interface="org.eclipse.osee.framework.messaging.event.res.IOseeCoreModelEventService" name="IOseeCoreModelEventService" policy="static"/> +</scr:component> diff --git a/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/workbench.user.service.xml b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/workbench.user.service.xml new file mode 100644 index 00000000000..5eef0520e84 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.skynet.core/OSGI-INF/workbench.user.service.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osee.framework.skynet.core.WorkbenchUserService"> + <implementation class="org.eclipse.osee.framework.skynet.core.WorkbenchUserService"/> + <service> + <provide interface="org.eclipse.osee.framework.plugin.core.IWorkbenchUserService"/> + </service> +</scr:component> diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index eb56315a1d4..d9551c6c31c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -78,6 +78,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager; import org.eclipse.osee.framework.skynet.core.event.model.AttributeChange; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationLink; import org.eclipse.osee.framework.skynet.core.relation.RelationManager; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; @@ -985,7 +986,12 @@ public class Artifact extends NamedIdentity<String> implements IArtifact, IAdapt public final boolean isReadOnly() { boolean result = true; - AccessPolicy service = Activator.getInstance().getAccessPolicy(); + AccessPolicy service = null; + try { + service = ServiceUtil.getAccessPolicy(); + } catch (OseeCoreException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } if (service != null) { result = service.isReadOnly(this); } @@ -1031,7 +1037,7 @@ public class Artifact extends NamedIdentity<String> implements IArtifact, IAdapt * silently you are provided a transaction. * <p> * Example: - * + * * <pre> * ... * Artifact artifact = ArtifactTypeManager.addArtifact(CoreArtifactTypes.Folder, ARTIFACT_BRANCH); @@ -1043,9 +1049,9 @@ public class Artifact extends NamedIdentity<String> implements IArtifact, IAdapt * <b>transaction.execute();</b> * ... * </pre> - * + * * </p> - * + * * @param managedTransaction * @throws OseeCoreException */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java index a7d26609990..dbb75f1bdf3 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java @@ -35,7 +35,7 @@ import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.database.core.ConnectionHandler; import org.eclipse.osee.framework.skynet.core.artifact.factory.ArtifactFactoryManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * Contains methods specific to artifact types. All artifact methods will eventually be moved from the @@ -47,12 +47,12 @@ public class ArtifactTypeManager { private final static ArtifactFactoryManager factoryManager = new ArtifactFactoryManager(); - private static ArtifactTypeCache getCache() { + private static ArtifactTypeCache getCache() throws OseeCoreException { return getCacheService().getArtifactTypeCache(); } - private static IOseeCachingService getCacheService() { - return Activator.getInstance().getOseeCacheService(); + private static IOseeCachingService getCacheService() throws OseeCoreException { + return ServiceUtil.getOseeCacheService(); } public static Collection<ArtifactType> getArtifactTypesFromAttributeType(IAttributeType attributeType, IOseeBranch branchToken) throws OseeCoreException { @@ -179,7 +179,7 @@ public class ArtifactTypeManager { "select count(1) from (select DISTINCT(art_id) FROM osee_artifact where art_type_id = ?) t1"; public static void purgeArtifactType(IArtifactType artifactType) throws OseeCoreException { - final int artifactTypeId = Activator.getInstance().getIdentityService().getLocalId(artifactType); + final int artifactTypeId = ServiceUtil.getIdentityService().getLocalId(artifactType); int artifactCount = ConnectionHandler.runPreparedQueryFetchInt(0, COUNT_ARTIFACT_OCCURRENCE, artifactTypeId); if (artifactCount != 0) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java index bf8064b7a3b..911fdc3f510 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java @@ -63,6 +63,7 @@ import org.eclipse.osee.framework.skynet.core.httpRequests.UpdateBranchArchivedS import org.eclipse.osee.framework.skynet.core.httpRequests.UpdateBranchStateHttpRequestOperation; import org.eclipse.osee.framework.skynet.core.httpRequests.UpdateBranchTypeHttpRequestOperation; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; /** @@ -90,8 +91,8 @@ public class BranchManager { return instance; } - public static BranchCache getCache() { - return Activator.getInstance().getOseeCacheService().getBranchCache(); + public static BranchCache getCache() throws OseeCoreException { + return ServiceUtil.getOseeCacheService().getBranchCache(); } private static Branch commonBranch = null; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpClientMessage.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpClientMessage.java index e79d5344155..f6b0cbbbda6 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpClientMessage.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpClientMessage.java @@ -17,7 +17,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.translation.IDataTranslationService; import org.eclipse.osee.framework.core.translation.ITranslatorId; import org.eclipse.osee.framework.core.util.HttpMessage; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Roberto E. Escobar @@ -28,7 +28,7 @@ public class HttpClientMessage { if (!parameters.containsKey("sessionId")) { parameters.put("sessionId", ClientSessionManager.getSessionId()); } - IDataTranslationService service = Activator.getInstance().getTranslationService(); + IDataTranslationService service = ServiceUtil.getTranslationService(); String urlString = HttpUrlBuilderClient.getInstance().getOsgiServletServiceUrl(context, parameters); return HttpMessage.send(urlString, service, requestId, requestData, responseId); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java index 6805e800834..ced112a20ec 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/PurgeArtifacts.java @@ -21,7 +21,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.enums.DeletionFlag; 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.AbstractDbTxOperation; import org.eclipse.osee.framework.database.core.ConnectionHandler; import org.eclipse.osee.framework.database.core.IOseeStatement; @@ -34,6 +33,7 @@ import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent; import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact; import org.eclipse.osee.framework.skynet.core.event.model.EventModType; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationLink; /** @@ -54,12 +54,12 @@ public class PurgeArtifacts extends AbstractDbTxOperation { private boolean success; private final boolean recurseChildrenBranches; - public PurgeArtifacts(Collection<? extends Artifact> artifactsToPurge) { + public PurgeArtifacts(Collection<? extends Artifact> artifactsToPurge) throws OseeCoreException { this(artifactsToPurge, false); } - public PurgeArtifacts(Collection<? extends Artifact> artifactsToPurge, boolean recurseChildrenBranches) { - super(Activator.getInstance().getOseeDatabaseService(), "Purge Artifact", Activator.PLUGIN_ID); + public PurgeArtifacts(Collection<? extends Artifact> artifactsToPurge, boolean recurseChildrenBranches) throws OseeCoreException { + super(ServiceUtil.getOseeDatabaseService(), "Purge Artifact", Activator.PLUGIN_ID); this.artifactsToPurge = new LinkedList<Artifact>(artifactsToPurge); this.success = false; this.recurseChildrenBranches = recurseChildrenBranches; @@ -188,9 +188,8 @@ public class PurgeArtifacts extends AbstractDbTxOperation { @SuppressWarnings("unchecked") public void insertSelectItems(OseeConnection connection, String tableName, String artifactJoinSql, int transactionJoinId, Timestamp insertTime, int queryId) throws OseeCoreException { - IOseeDatabaseService databaseService = Activator.getInstance().getOseeDatabaseService(); String sql = String.format(INSERT_SELECT_ITEM, tableName, artifactJoinSql); - databaseService.runPreparedUpdate(connection, sql, transactionJoinId, insertTime, queryId); + getDatabaseService().runPreparedUpdate(connection, sql, transactionJoinId, insertTime, queryId); } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java index d4e089b8513..b658dfb8748 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java @@ -47,7 +47,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactLoader; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; import org.eclipse.osee.framework.skynet.core.artifact.ISearchConfirmer; import org.eclipse.osee.framework.skynet.core.artifact.LoadType; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Ryan D. Brooks @@ -293,7 +293,7 @@ public class ArtifactQueryBuilder { if (hasValues(artifactTypes)) { Set<Integer> artTypeIds = new HashSet<Integer>(); - IdentityService identityService = Activator.getInstance().getIdentityService(); + IdentityService identityService = ServiceUtil.getIdentityService(); for (IArtifactType artifactType : artifactTypes) { artTypeIds.add(identityService.getLocalId(artifactType)); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java index b0be3ca1d34..e08aa4fd076 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactTypeSearch.java @@ -16,7 +16,7 @@ import org.eclipse.osee.framework.core.data.Identity; import org.eclipse.osee.framework.core.data.NamedIdentity; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.services.IdentityService; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Robert A. Fisher @@ -41,7 +41,7 @@ public class ArtifactTypeSearch implements ISearchPrimitive { @Override public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException { String sql = "osee_artifact.art_type_id = ?"; - IdentityService remoteIdManager = Activator.getInstance().getIdentityService(); + IdentityService remoteIdManager = ServiceUtil.getIdentityService(); dataList.add(remoteIdManager.getLocalId(artifactType)); return sql; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java index d6d2a2d2b85..37b3e9d653e 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeCriteria.java @@ -18,7 +18,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.database.core.CharJoinQuery; import org.eclipse.osee.framework.database.core.JoinUtility; import org.eclipse.osee.framework.jdk.core.util.Collections; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Ryan D. Brooks @@ -138,7 +138,7 @@ public class AttributeCriteria extends AbstractArtifactSearchCriteria { if (attributeType != null) { builder.append(attrAlias); builder.append(".attr_type_id=? AND "); - builder.addParameter(Activator.getInstance().getIdentityService().getLocalId(attributeType)); + builder.addParameter(ServiceUtil.getIdentityService().getLocalId(attributeType)); } if (value != null) { builder.append(attrAlias); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java index 7ca9b5e2470..c5ce90bc58d 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeValueSearch.java @@ -18,7 +18,7 @@ import org.eclipse.osee.framework.core.data.NamedIdentity; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Robert A. Fisher @@ -61,7 +61,7 @@ public class AttributeValueSearch implements ISearchPrimitive { sql.append(" attr_1.attr_type_id = ? AND attr_1.gamma_id = txs.gamma_id AND txs.tx_current = 1 and txs.branch_id = ?"); - IdentityService remoteIdManager = Activator.getInstance().getIdentityService(); + IdentityService remoteIdManager = ServiceUtil.getIdentityService(); dataList.add(remoteIdManager.getLocalId(attributeType)); dataList.add(BranchManager.getBranchId(branch)); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java index 0dfdb7d49c6..0bc09995d82 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java @@ -18,7 +18,7 @@ import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Robert A. Fisher @@ -41,7 +41,7 @@ public class InRelationSearch implements ISearchPrimitive { @Override public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException { - IdentityService remoteIdManager = Activator.getInstance().getIdentityService(); + IdentityService remoteIdManager = ServiceUtil.getIdentityService(); dataList.add(remoteIdManager.getLocalId(relationType)); dataList.add(BranchManager.getBranchId(branch)); dataList.add(ModificationType.DELETED.getValue()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java index 8904c3e3714..377adea847f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/OrphanArtifactSearch.java @@ -20,7 +20,7 @@ import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Jeff C. Phillips @@ -35,13 +35,12 @@ public class OrphanArtifactSearch implements ISearchPrimitive { public OrphanArtifactSearch(IArtifactType aritfactType) throws OseeCoreException { this.aritfactType = aritfactType; - this.relationTypeId = - Activator.getInstance().getIdentityService().getLocalId(CoreRelationTypes.Default_Hierarchical__Child); + this.relationTypeId = ServiceUtil.getIdentityService().getLocalId(CoreRelationTypes.Default_Hierarchical__Child); } @Override public String getCriteriaSql(List<Object> dataList, IOseeBranch branch) throws OseeCoreException { - IdentityService identityService = Activator.getInstance().getIdentityService(); + IdentityService identityService = ServiceUtil.getIdentityService(); dataList.add(identityService.getLocalId(aritfactType)); dataList.add(BranchManager.getBranchId(branch)); dataList.add(relationTypeId); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java index 24a401c4620..245cdd4d26f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java @@ -15,7 +15,7 @@ import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.services.IdentityService; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Ryan D. Brooks @@ -61,7 +61,7 @@ public class RelationCriteria extends AbstractArtifactSearchCriteria { builder.addParameter(artifactId); } if (relationType != null) { - IdentityService identityService = Activator.getInstance().getIdentityService(); + IdentityService identityService = ServiceUtil.getIdentityService(); builder.append(relAlias); builder.append(".rel_link_type_id=? AND "); builder.addParameter(identityService.getLocalId(relationType)); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java index c84bbdd7d2e..a2e8a9bb735 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java @@ -24,22 +24,27 @@ import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache; import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.model.type.AttributeType; +import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; import org.eclipse.osee.framework.skynet.core.artifact.Attribute; import org.eclipse.osee.framework.skynet.core.attribute.providers.IAttributeDataProvider; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Ryan D. Brooks */ public class AttributeTypeManager { - public static AbstractOseeCache<Long, AttributeType> getCache() { - return Activator.getInstance().getOseeCacheService().getAttributeTypeCache(); + private static IOseeCachingService getCacheService() throws OseeCoreException { + return ServiceUtil.getOseeCacheService(); } - public static BranchCache getBranchCache() { - return Activator.getInstance().getOseeCacheService().getBranchCache(); + public static AbstractOseeCache<Long, AttributeType> getCache() throws OseeCoreException { + return getCacheService().getAttributeTypeCache(); + } + + public static BranchCache getBranchCache() throws OseeCoreException { + return getCacheService().getBranchCache(); } public static Collection<IAttributeType> getValidAttributeTypes(IOseeBranch branchToken) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java index d685d9fef5a..ae27246ec0b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java @@ -17,15 +17,15 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist; import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache; import org.eclipse.osee.framework.core.model.type.OseeEnumType; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Roberto E. Escobar */ public class OseeEnumTypeManager { - public static AbstractOseeCache<Long, OseeEnumType> getCache() { - return Activator.getInstance().getOseeCacheService().getEnumTypeCache(); + public static AbstractOseeCache<Long, OseeEnumType> getCache() throws OseeCoreException { + return ServiceUtil.getOseeCacheService().getEnumTypeCache(); } public static OseeEnumType getType(int enumTypeId) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java index 191ae4436f7..afef6195917 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java @@ -53,14 +53,14 @@ public class OseeEventManager { private static List<IEventFilter> commonBranchEventFilter; private static BranchGuidEventFilter commonBranchGuidEvenFilter; private static IBranchEventListener testBranchEventListener; - private static EventManagerData eventManagerData; + private static final EventManagerData eventManagerData = new EventManagerData(); private OseeEventManager() { // Static methods only; } - public static void setEventManagerData(EventManagerData eventManagerData) { - OseeEventManager.eventManagerData = eventManagerData; + public static EventManagerData getEventManagerData() { + return eventManagerData; } /** diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java index 4f87098aa34..8805cac2aea 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java @@ -27,6 +27,7 @@ import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.operation.AbstractOperation; import org.eclipse.osee.framework.database.core.ConnectionHandler; import org.eclipse.osee.framework.database.core.IOseeStatement; +import org.eclipse.osee.framework.skynet.core.AccessPolicy; import org.eclipse.osee.framework.skynet.core.User; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache; @@ -37,6 +38,7 @@ import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent; import org.eclipse.osee.framework.skynet.core.event.model.BranchEventType; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; /** @@ -93,7 +95,8 @@ public final class CommitBranchHttpRequestOperation extends AbstractOperation { private void handleResponse(BranchCommitResponse response, Branch sourceBranch) throws OseeCoreException { TransactionRecord newTransaction = response.getTransaction(); - Activator.getInstance().getAccessPolicy().removePermissions(sourceBranch); + AccessPolicy accessPolicy = ServiceUtil.getAccessPolicy(); + accessPolicy.removePermissions(sourceBranch); // Update commit artifact cache with new information if (sourceBranch.getAssociatedArtifactId() > 0) { TransactionManager.cacheCommittedArtifactTransaction(BranchManager.getAssociatedArtifact(sourceBranch), diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java index 6bbffcbd3ad..b647f57e764 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/Activator.java @@ -10,86 +10,26 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.internal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; -import org.eclipse.core.runtime.Platform; import org.eclipse.osee.framework.core.client.ClientSessionManager; -import org.eclipse.osee.framework.core.enums.OseeServiceTrackerId; -import org.eclipse.osee.framework.core.model.TransactionRecordFactory; -import org.eclipse.osee.framework.core.services.IOseeCachingService; -import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.services.IdentityService; -import org.eclipse.osee.framework.core.translation.IDataTranslationService; -import org.eclipse.osee.framework.core.util.ServiceDependencyTracker; -import org.eclipse.osee.framework.database.IOseeDatabaseService; -import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider; -import org.eclipse.osee.framework.lifecycle.ILifecycleService; -import org.eclipse.osee.framework.lifecycle.ILifecycleServiceProvider; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.skynet.core.AccessPolicy; -import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; -import org.eclipse.osee.framework.skynet.core.event.systems.EventManagerData; -import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.util.tracker.ServiceTracker; /** * @author Ryan D. Brooks */ -public class Activator implements BundleActivator, IOseeDatabaseServiceProvider, ILifecycleServiceProvider { +public class Activator implements BundleActivator { public static final String PLUGIN_ID = "org.eclipse.osee.framework.skynet.core"; private static Activator instance; - private final Map<OseeServiceTrackerId, ServiceTracker> mappedTrackers; - private final Collection<ServiceDependencyTracker> trackers = new ArrayList<ServiceDependencyTracker>(); - - public Activator() { - this.mappedTrackers = new HashMap<OseeServiceTrackerId, ServiceTracker>(); - } @Override public void start(BundleContext context) throws Exception { instance = this; - - trackers.add(new ServiceDependencyTracker(context, new ClientCachingServiceRegHandler())); - trackers.add(new ServiceDependencyTracker(context, new ClientWorkbenchUserRegHandler())); - - EventManagerData eventManagerData = new EventManagerData(); - OseeEventManager.setEventManagerData(eventManagerData); - trackers.add(new ServiceDependencyTracker(context, new OseeEventSystemServiceRegHandler(eventManagerData))); - ClientSessionManager.class.getCanonicalName(); - - createServiceTracker(context, IOseeCachingService.class, OseeServiceTrackerId.OSEE_CACHING_SERVICE); - createServiceTracker(context, IDataTranslationService.class, OseeServiceTrackerId.TRANSLATION_SERVICE); - createServiceTracker(context, IOseeModelFactoryService.class, OseeServiceTrackerId.OSEE_FACTORY_SERVICE); - createServiceTracker(context, IOseeDatabaseService.class, OseeServiceTrackerId.OSEE_DATABASE_SERVICE); - createServiceTracker(context, ILifecycleService.class, OseeServiceTrackerId.LIFECYCLE_SERVER); - createServiceTracker(context, AccessPolicy.class, OseeServiceTrackerId.OSEE_ACCESS_CONTROL_SERVICE); - createServiceTracker(context, IdentityService.class, OseeServiceTrackerId.IDENTITY_SERVICE); - - for (ServiceDependencyTracker dependencyTracker : trackers) { - dependencyTracker.open(); - } } @Override public void stop(BundleContext context) throws Exception { - for (ServiceDependencyTracker dependencyTracker : trackers) { - dependencyTracker.close(); - } - trackers.clear(); - - for (ServiceTracker tracker : mappedTrackers.values()) { - tracker.close(); - } - mappedTrackers.clear(); - instance = null; } @@ -97,55 +37,4 @@ public class Activator implements BundleActivator, IOseeDatabaseServiceProvider, return instance; } - public IdentityService getIdentityService() { - return getTracker(OseeServiceTrackerId.IDENTITY_SERVICE, IdentityService.class); - } - - public IOseeCachingService getOseeCacheService() { - return getTracker(OseeServiceTrackerId.OSEE_CACHING_SERVICE, IOseeCachingService.class); - } - - public IDataTranslationService getTranslationService() { - return getTracker(OseeServiceTrackerId.TRANSLATION_SERVICE, IDataTranslationService.class); - } - - public TransactionRecordFactory getTransactionFactory() { - IOseeModelFactoryService service = - getTracker(OseeServiceTrackerId.OSEE_FACTORY_SERVICE, IOseeModelFactoryService.class); - return service != null ? service.getTransactionFactory() : null; - } - - private void createServiceTracker(BundleContext context, Class<?> clazz, OseeServiceTrackerId trackerId) { - ServiceTracker tracker = new ServiceTracker(context, clazz.getName(), null); - tracker.open(); - mappedTrackers.put(trackerId, tracker); - } - - @Override - public IOseeDatabaseService getOseeDatabaseService() { - return getTracker(OseeServiceTrackerId.OSEE_DATABASE_SERVICE, IOseeDatabaseService.class); - } - - @Override - public ILifecycleService getLifecycleServices() { - return getTracker(OseeServiceTrackerId.LIFECYCLE_SERVER, ILifecycleService.class); - } - - private <T> T getTracker(OseeServiceTrackerId trackerId, Class<T> clazz) { - ServiceTracker tracker = mappedTrackers.get(trackerId); - Object service = tracker.getService(); - return clazz.cast(service); - } - - public AccessPolicy getAccessPolicy() { - try { - Bundle bundle = Platform.getBundle("org.eclipse.osee.framework.access"); - if (bundle.getState() != Bundle.ACTIVE) { - bundle.start(); - } - } catch (BundleException ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex); - } - return getTracker(OseeServiceTrackerId.OSEE_ACCESS_CONTROL_SERVICE, AccessPolicy.class); - } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceRegHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceProxy.java index b6d32c14de1..432cf3977e3 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceRegHandler.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientCachingServiceProxy.java @@ -10,57 +10,116 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.internal; -import java.util.Map; +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.OseeCachingService; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; 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.IOseeModelFactoryService; -import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; +import org.eclipse.osee.framework.core.services.IdentityService; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientArtifactTypeAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientAttributeTypeAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientBranchAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientOseeEnumTypeAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientRelationTypeAccessor; import org.eclipse.osee.framework.skynet.core.internal.accessors.ClientTransactionAccessor; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; /** * @author Roberto E. Escobar */ -public class ClientCachingServiceRegHandler extends AbstractTrackingHandler { +public class ClientCachingServiceProxy implements IOseeCachingService { - private static final Class<?>[] DEPENDENCIES = new Class<?>[] {IOseeModelFactoryService.class}; + private IdentityService identityService; + private IOseeModelFactoryService modelFactory; - private ServiceRegistration serviceRegistration; + private IOseeCachingService proxiedService; + + public void setIdentityService(IdentityService identityService) { + this.identityService = identityService; + } + + public void setModelFactory(IOseeModelFactoryService modelFactory) { + this.modelFactory = modelFactory; + } + + public void start() { + proxiedService = createService(modelFactory, identityService); + } + + public void stop() { + if (proxiedService != null) { + proxiedService = null; + } + } + + private IOseeCachingService getProxiedService() { + return proxiedService; + } @Override - public Class<?>[] getDependencies() { - return DEPENDENCIES; + public BranchCache getBranchCache() { + return getProxiedService().getBranchCache(); } @Override - public void onActivate(BundleContext context, Map<Class<?>, Object> services) { - IOseeModelFactoryService modelFactory = getService(IOseeModelFactoryService.class, services); - IOseeCachingService cachingService = createService(modelFactory); + public TransactionCache getTransactionCache() { + return getProxiedService().getTransactionCache(); + } - serviceRegistration = context.registerService(IOseeCachingService.class.getName(), cachingService, null); + @Override + public ArtifactTypeCache getArtifactTypeCache() { + return getProxiedService().getArtifactTypeCache(); } @Override - public void onDeActivate() { - if (serviceRegistration != null) { - serviceRegistration.unregister(); - } + public AttributeTypeCache getAttributeTypeCache() { + return getProxiedService().getAttributeTypeCache(); + } + + @Override + public RelationTypeCache getRelationTypeCache() { + return getProxiedService().getRelationTypeCache(); + } + + @Override + public OseeEnumTypeCache getEnumTypeCache() { + return getProxiedService().getEnumTypeCache(); + } + + @Override + public IdentityService getIdentityService() { + return getProxiedService().getIdentityService(); + } + + @Override + public Collection<?> getCaches() { + return getProxiedService().getCaches(); + } + + @Override + public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException { + return getProxiedService().getCache(cacheId); + } + + @Override + public void reloadAll() throws OseeCoreException { + getProxiedService().reloadAll(); + } + + @Override + public void clearAll() { + getProxiedService().clearAll(); } - private IOseeCachingService createService(IOseeModelFactoryService factory) { + private IOseeCachingService createService(IOseeModelFactoryService factory, IdentityService identityService) { TransactionCache transactionCache = new TransactionCache(); ClientBranchAccessor clientBranchAccessor = new ClientBranchAccessor(factory.getBranchFactory(), transactionCache); @@ -84,6 +143,6 @@ public class ClientCachingServiceRegHandler extends AbstractTrackingHandler { new RelationTypeCache(new ClientRelationTypeAccessor(factory.getRelationTypeFactory(), artifactTypeCache)); return new OseeCachingService(branchCache, transactionCache, artifactTypeCache, attributeTypeCache, - relationTypeCache, oseeEnumTypeCache, Activator.getInstance().getIdentityService()); + relationTypeCache, oseeEnumTypeCache, identityService); } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientWorkbenchUserRegHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientWorkbenchUserRegHandler.java deleted file mode 100644 index 34cbd5b77cd..00000000000 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ClientWorkbenchUserRegHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.framework.skynet.core.internal; - -import java.util.Map; -import org.eclipse.osee.framework.core.services.IOseeCachingService; -import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; -import org.eclipse.osee.framework.plugin.core.IWorkbenchUserService; -import org.eclipse.osee.framework.skynet.core.WorkbenchUserService; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -public class ClientWorkbenchUserRegHandler extends AbstractTrackingHandler { - - private static final Class<?>[] DEPENDENCIES = new Class<?>[] {IOseeCachingService.class}; - - private ServiceRegistration serviceRegistration; - - @Override - public Class<?>[] getDependencies() { - return DEPENDENCIES; - } - - @Override - public void onActivate(BundleContext context, Map<Class<?>, Object> services) { - serviceRegistration = - context.registerService(IWorkbenchUserService.class.getName(), new WorkbenchUserService(), null); - } - - @Override - public void onDeActivate() { - if (serviceRegistration != null) { - serviceRegistration.unregister(); - } - } - -} diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventSystemServiceRegHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventAdmin.java index ae5cdb7bc61..4d0ee240e95 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventSystemServiceRegHandler.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeEventAdmin.java @@ -12,11 +12,8 @@ package org.eclipse.osee.framework.skynet.core.internal; import java.util.ArrayList; import java.util.Collection; -import java.util.Map; import java.util.logging.Level; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.services.IOseeCachingService; -import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.messaging.event.res.IOseeCoreModelEventService; import org.eclipse.osee.framework.skynet.core.attribute.HttpAttributeTaggingListener; @@ -27,53 +24,49 @@ import org.eclipse.osee.framework.skynet.core.event.systems.EventManagerData; import org.eclipse.osee.framework.skynet.core.event.systems.EventManagerFactory; import org.eclipse.osee.framework.skynet.core.event.systems.InternalEventManager; import org.eclipse.osee.framework.skynet.core.event.systems.ResMessagingConnectionListener; -import org.osgi.framework.BundleContext; /** * @author Roberto E. Escobar */ -public class OseeEventSystemServiceRegHandler extends AbstractTrackingHandler { +public class OseeEventAdmin { - private static final Class<?>[] DEPENDENCIES = new Class<?>[] { - IOseeCachingService.class, - IOseeCoreModelEventService.class}; - - @Override - public Class<?>[] getDependencies() { - return DEPENDENCIES; - } + private IOseeCoreModelEventService coreModelEventService; - private final EventManagerData eventManagerData; + private final EventManagerFactory factory = new EventManagerFactory(); private ResMessagingConnectionListener connectionStatusListener; - private IOseeCoreModelEventService coreModelEventService; private final Collection<IEventListener> coreListeners = new ArrayList<IEventListener>(); - private Thread thread; - public OseeEventSystemServiceRegHandler(EventManagerData eventManagerData) { - this.eventManagerData = eventManagerData; + public void setOseeCoreModelEventService(IOseeCoreModelEventService coreModelEventService) { + this.coreModelEventService = coreModelEventService; } - @Override - public void onActivate(BundleContext context, Map<Class<?>, Object> services) { - coreModelEventService = getService(IOseeCoreModelEventService.class, services); + public void addEventListener(IEventListener listener) { + OseeEventManager.addListener(listener); + } + + public void removeEventListener(IEventListener listener) { + OseeEventManager.removeListener(listener); + } - EventManagerFactory factory = new EventManagerFactory(); + public void start() { + final EventManagerData eventManagerData = OseeEventManager.getEventManagerData(); connectionStatusListener = new ResMessagingConnectionListener(eventManagerData.getPreferences()); - final InternalEventManager eventManager = - factory.createNewEventManager(coreModelEventService, eventManagerData.getPreferences(), - eventManagerData.getListeners(), eventManagerData.getPriorityListeners(), connectionStatusListener); - if (eventManager != null) { - Runnable runnable = new Runnable() { - @Override - public void run() { + Runnable runnable = new Runnable() { + @Override + public void run() { + InternalEventManager eventManager = + factory.createNewEventManager(coreModelEventService, eventManagerData.getPreferences(), + eventManagerData.getListeners(), eventManagerData.getPriorityListeners(), connectionStatusListener); + if (eventManager != null) { try { eventManagerData.setMessageEventManager(eventManager); coreModelEventService.addConnectionListener(connectionStatusListener); eventManager.start(); + try { OseeEventManager.kickLocalRemEvent(eventManager, RemoteEventServiceEventType.Rem_Connected); } catch (OseeCoreException ex) { @@ -83,22 +76,19 @@ public class OseeEventSystemServiceRegHandler extends AbstractTrackingHandler { } catch (Throwable th) { OseeLog.log(Activator.class, Level.SEVERE, th); } - } - }; - - thread = new Thread(runnable); - thread.start(); - - OseeLog.log(Activator.class, Level.INFO, "Remote Event Service - Enabled"); - } else { - OseeLog.log(Activator.class, Level.INFO, "Remote Event Service - Disabled"); - } + OseeLog.log(Activator.class, Level.INFO, "Remote Event Service - Enabled"); + } else { + OseeLog.log(Activator.class, Level.INFO, "Remote Event Service - Disabled"); + } + } + }; + thread = new Thread(runnable); + thread.start(); } private void addCoreListeners() { coreListeners.add(new HttpAttributeTaggingListener()); - for (IEventListener listener : coreListeners) { OseeEventManager.addListener(listener); } @@ -111,24 +101,18 @@ public class OseeEventSystemServiceRegHandler extends AbstractTrackingHandler { coreListeners.clear(); } - @Override - public void onDeActivate() { + public void stop() throws OseeCoreException { if (thread != null) { thread.interrupt(); thread = null; } removeCoreListeners(); - InternalEventManager eventManager = eventManagerData.getMessageEventManager(); + InternalEventManager eventManager = OseeEventManager.getEventManagerData().getMessageEventManager(); if (eventManager != null) { - try { - coreModelEventService.removeConnectionListener(connectionStatusListener); - eventManager.stop(); - } catch (OseeCoreException ex) { - OseeLog.log(Activator.class, Level.SEVERE, ex); - } + coreModelEventService.removeConnectionListener(connectionStatusListener); + eventManager.stop(); // OseeEventManager.kickLocalRemEvent(eventManager, RemoteEventServiceEventType.Rem_DisConnected); - eventManagerData.setMessageEventManager(null); } } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java new file mode 100644 index 00000000000..c73a800540e --- /dev/null +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/ServiceUtil.java @@ -0,0 +1,89 @@ +/* + * Created on Apr 25, 2012 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.framework.skynet.core.internal; + +import java.util.logging.Level; +import org.eclipse.core.runtime.Platform; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.TransactionRecordFactory; +import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.core.services.IOseeModelFactoryService; +import org.eclipse.osee.framework.core.services.IdentityService; +import org.eclipse.osee.framework.core.translation.IDataTranslationService; +import org.eclipse.osee.framework.core.util.Conditions; +import org.eclipse.osee.framework.database.IOseeDatabaseService; +import org.eclipse.osee.framework.lifecycle.ILifecycleService; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.AccessPolicy; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; + +public final class ServiceUtil { + + private ServiceUtil() { + // Utility class + } + + private static BundleContext getBundleContext() throws OseeCoreException { + Bundle bundle = FrameworkUtil.getBundle(ServiceUtil.class); + Conditions.checkNotNull(bundle, "bundle"); + return bundle.getBundleContext(); + } + + private static <T> T getService(Class<T> clazz) throws OseeCoreException { + BundleContext context = getBundleContext(); + Conditions.checkNotNull(context, "bundleContext"); + ServiceReference<T> reference = context.getServiceReference(clazz); + Conditions.checkNotNull(reference, "serviceReference"); + T service = context.getService(reference); + Conditions.checkNotNull(service, "service"); + return service; + } + + public static IdentityService getIdentityService() throws OseeCoreException { + return getService(IdentityService.class); + } + + public static IOseeCachingService getOseeCacheService() throws OseeCoreException { + return getService(IOseeCachingService.class); + } + + public static IDataTranslationService getTranslationService() throws OseeCoreException { + return getService(IDataTranslationService.class); + } + + public static IOseeDatabaseService getOseeDatabaseService() throws OseeCoreException { + return getService(IOseeDatabaseService.class); + } + + public static ILifecycleService getLifecycleService() throws OseeCoreException { + return getService(ILifecycleService.class); + } + + public static TransactionRecordFactory getTransactionFactory() throws OseeCoreException { + IOseeModelFactoryService service = getService(IOseeModelFactoryService.class); + return service != null ? service.getTransactionFactory() : null; + } + + public static IOseeModelFactoryService getOseeModelFactoryService() throws OseeCoreException { + return getService(IOseeModelFactoryService.class); + } + + public static AccessPolicy getAccessPolicy() throws OseeCoreException { + try { + Bundle bundle = Platform.getBundle("org.eclipse.osee.framework.access"); + if (bundle.getState() != Bundle.ACTIVE) { + bundle.start(); + } + } catch (BundleException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + return getService(AccessPolicy.class); + } +} diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java index ec395f2dd93..d0e6a904459 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java @@ -46,6 +46,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationLink.ArtifactLinker; import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderData; import org.eclipse.osee.framework.skynet.core.relation.order.RelationOrderFactory; @@ -235,7 +236,7 @@ public class RelationManager { try { String sql = String.format(GET_DELETED_ARTIFACT, formatArgs); chStmt.runPreparedQuery(sql, artifact.getFullBranch().getId(), - Activator.getInstance().getIdentityService().getLocalId(relationType), artifact.getArtId()); + ServiceUtil.getIdentityService().getLocalId(relationType), artifact.getArtId()); while (chStmt.next()) { int artId = chStmt.getInt(formatArgs[0] + "_art_id"); artIds.add(artId); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java index d25bd631309..5656610cc31 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java @@ -22,7 +22,8 @@ import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist; import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache; import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.model.type.RelationType; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.core.services.IOseeCachingService; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * @author Ryan D. Brooks @@ -30,12 +31,16 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; */ public class RelationTypeManager { - public static AbstractOseeCache<Long, RelationType> getCache() { - return Activator.getInstance().getOseeCacheService().getRelationTypeCache(); + private static IOseeCachingService getCacheService() throws OseeCoreException { + return ServiceUtil.getOseeCacheService(); } - public static AbstractOseeCache<Long, ArtifactType> getArtifactTypeCache() { - return Activator.getInstance().getOseeCacheService().getArtifactTypeCache(); + public static AbstractOseeCache<Long, RelationType> getCache() throws OseeCoreException { + return getCacheService().getRelationTypeCache(); + } + + public static AbstractOseeCache<Long, ArtifactType> getArtifactTypeCache() throws OseeCoreException { + return getCacheService().getArtifactTypeCache(); } public static List<RelationType> getValidTypes(IArtifactType artifactType, IOseeBranch branch) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java index 6609cc49b63..fc991c87c29 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java @@ -42,7 +42,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.attribute.AttributeTransactionData; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.relation.RelationEventType; import org.eclipse.osee.framework.skynet.core.relation.RelationLink; import org.eclipse.osee.framework.skynet.core.relation.RelationTransactionData; @@ -167,9 +167,9 @@ public final class SkynetTransaction extends TransactionOperation<Branch> { } } - private AccessPolicy getAccess() { + private AccessPolicy getAccess() throws OseeCoreException { if (access == null) { - access = Activator.getInstance().getAccessPolicy(); + access = ServiceUtil.getAccessPolicy(); } return access; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java index a02417679e7..82e6a59f5cc 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java @@ -27,6 +27,7 @@ import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.core.model.TransactionRecordFactory; import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.model.cache.TransactionCache; +import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.util.Conditions; import org.eclipse.osee.framework.database.core.ConnectionHandler; import org.eclipse.osee.framework.database.core.IOseeStatement; @@ -36,7 +37,7 @@ import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime; import org.eclipse.osee.framework.skynet.core.User; import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; import org.eclipse.osee.framework.skynet.core.types.IArtifact; /** @@ -95,8 +96,16 @@ public final class TransactionManager { ConnectionHandler.runPreparedUpdate(UPDATE_TRANSACTION_COMMENTS, comment, transaction.getId()); } - private static TransactionCache getTransactionCache() { - return Activator.getInstance().getOseeCacheService().getTransactionCache(); + private static IOseeCachingService getCacheService() throws OseeCoreException { + return ServiceUtil.getOseeCacheService(); + } + + private static TransactionCache getTransactionCache() throws OseeCoreException { + return getCacheService().getTransactionCache(); + } + + private static BranchCache getBranchCache() throws OseeCoreException { + return getCacheService().getBranchCache(); } public static List<TransactionRecord> getTransactionsForBranch(Branch branch) throws OseeCoreException { @@ -150,7 +159,7 @@ public final class TransactionManager { public synchronized static void cacheCommittedArtifactTransaction(IArtifact artifact, TransactionRecord transactionId) throws OseeCoreException { Collection<TransactionRecord> transactionIds = getCommittedArtifactTransactionIds(artifact); if (!transactionIds.contains(transactionId)) { - BranchCache branchCache = Activator.getInstance().getOseeCacheService().getBranchCache(); + BranchCache branchCache = getBranchCache(); transactionId.setBranchCache(branchCache); transactionIds.add(transactionId); getTransactionCache().cache(transactionId); @@ -185,11 +194,11 @@ public final class TransactionManager { int authorArtId = userToBlame.getArtId(); TransactionDetailsType txType = TransactionDetailsType.NonBaselined; Date transactionTime = GlobalTime.GreenwichMeanTimestamp(); - TransactionRecordFactory factory = Activator.getInstance().getTransactionFactory(); + TransactionRecordFactory factory = ServiceUtil.getTransactionFactory(); TransactionRecord transactionId = factory.createOrUpdate(getTransactionCache(), transactionNumber, BranchManager.getBranchId(branch), comment, transactionTime, authorArtId, -1, txType); - transactionId.setBranchCache(Activator.getInstance().getOseeCacheService().getBranchCache()); + transactionId.setBranchCache(getBranchCache()); return transactionId; } @@ -257,8 +266,8 @@ public final class TransactionManager { } TransactionDetailsType txType = TransactionDetailsType.toEnum(chStmt.getInt("tx_type")); - TransactionRecordFactory factory = Activator.getInstance().getTransactionFactory(); - BranchCache branchCache = Activator.getInstance().getOseeCacheService().getBranchCache(); + TransactionRecordFactory factory = ServiceUtil.getTransactionFactory(); + BranchCache branchCache = getBranchCache(); transactionRecord = factory.createOrUpdate(txCache, txId, chStmt.getInt("branch_id"), chStmt.getString("osee_comment"), diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java index 66529bf91c9..c59fe9fac53 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperationWithListener.java @@ -20,10 +20,11 @@ import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; import org.eclipse.osee.framework.skynet.core.event.PurgeTransactionEventUtil; import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent; import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; public class PurgeTransactionOperationWithListener { - public static IOperation getPurgeTransactionOperation(List<TransactionRecord> transactions) { + public static IOperation getPurgeTransactionOperation(List<TransactionRecord> transactions) throws OseeCoreException { List<Integer> txIdsToDelete = new ArrayList<Integer>(); for (TransactionRecord record : transactions) { txIdsToDelete.add(record.getId()); @@ -31,15 +32,15 @@ public class PurgeTransactionOperationWithListener { return getPurgeTransactionOperationById(txIdsToDelete); } - public static IOperation getPurgeTransactionOperation(Integer txIdsToDelete) { + public static IOperation getPurgeTransactionOperation(Integer txIdsToDelete) throws OseeCoreException { return getPurgeTransactionOperationById(Arrays.asList(txIdsToDelete)); } - public static IOperation getPurgeTransactionOperationById(List<Integer> txIdsToDelete) { + public static IOperation getPurgeTransactionOperationById(List<Integer> txIdsToDelete) throws OseeCoreException { final PurgeTransactionOperation op = - new PurgeTransactionOperation(Activator.getInstance().getOseeDatabaseService(), - Activator.getInstance().getOseeCacheService().getTransactionCache(), txIdsToDelete); + new PurgeTransactionOperation(ServiceUtil.getOseeDatabaseService(), + ServiceUtil.getOseeCacheService().getTransactionCache(), txIdsToDelete); PurgeTransactionListener listener = new PurgeTransactionListener() { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java index 91265c60151..d10fc55932e 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/word/WordUtil.java @@ -38,7 +38,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.jdk.core.util.io.Streams; import org.eclipse.osee.framework.jdk.core.util.xml.Xml; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil; /** * Provides utility methods for parsing wordML. @@ -128,7 +128,7 @@ public class WordUtil { IOseeStatement chStmt = ConnectionHandler.getStatement(); try { - int localId = Activator.getInstance().getIdentityService().getLocalId(CoreAttributeTypes.WordTemplateContent); + int localId = ServiceUtil.getIdentityService().getLocalId(CoreAttributeTypes.WordTemplateContent); chStmt.runPreparedQuery(SELECT_WORD_VALUES, artId, localId, branch.getId()); List<Pair<String, Integer>> values = new LinkedList<Pair<String, Integer>>(); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java index ccc961dad18..640ddb5bc80 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/PurgeTransactionHandler.java @@ -41,7 +41,7 @@ import org.eclipse.osee.framework.ui.swt.Displays; public class PurgeTransactionHandler extends CommandHandler { @Override - public Object executeWithException(ExecutionEvent event) { + public Object executeWithException(ExecutionEvent event) throws OseeCoreException { IStructuredSelection selection = (IStructuredSelection) AWorkbench.getActivePage().getActivePart().getSite().getSelectionProvider().getSelection(); |