diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core/src')
73 files changed, 1561 insertions, 1695 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/BootStrapUser.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/BootStrapUser.java index 120c86d8414..c63e99f4ae7 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/BootStrapUser.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/BootStrapUser.java @@ -22,10 +22,6 @@ public class BootStrapUser extends User { public static BootStrapUser instance; /** - * @param parentFactory - * @param guid - * @param humanReadableId - * @param tagId * @throws OseeDataStoreException */ private BootStrapUser() throws OseeDataStoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeGroup.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeGroup.java index cd1dc4b5b6a..7732d1311ca 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeGroup.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeGroup.java @@ -47,7 +47,6 @@ public class OseeGroup { /** * This does not persist the newly created relation that is the callers responsibility. * - * @param user */ public void addMember(User user) throws OseeCoreException { getGroupArtifact().addRelation(CoreRelationTypes.Users_User, user); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java index 75889f7117c..442171b683c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java @@ -46,9 +46,6 @@ public final class OseeSystemArtifacts { } /** - * @param artifactTypeName - * @param artifactName - * @param branch * @return the artifact specified by type, name, and branch from the cache if available otherwise the datastore is * accessed, and finally a new artifact is created if it can not be found * @throws OseeCoreException 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 bc506a06efa..4cd6a7f6a98 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 @@ -1455,8 +1455,17 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, Co } private static final Pattern safeNamePattern = Pattern.compile("[^A-Za-z0-9 ]"); - private static final String[] NUMBER = new String[] {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", - "Eight", "Nine"}; + private static final String[] NUMBER = new String[] { + "Zero", + "One", + "Two", + "Three", + "Four", + "Five", + "Six", + "Seven", + "Eight", + "Nine"}; /** * Since artifact names are free text it is important to reformat the name to ensure it is suitable as an element diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactData.java index 30eb6ca0bef..b0de9cbfc2e 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactData.java @@ -18,10 +18,6 @@ public class ArtifactData { private String source = ""; private final Artifact[] artifacts; - /** - * @param artifacts - * @param url - */ public ArtifactData(Artifact[] artifacts, String url, String source) { this.artifacts = artifacts; this.url = url; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java index 9be9d0a1c2f..b33b0844723 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java @@ -171,7 +171,11 @@ public final class ArtifactLoader { List<Object[]> insertParameters = new LinkedList<Object[]>(); for (int artId : org.eclipse.osee.framework.jdk.core.util.Collections.unique(artIds)) { - insertParameters.add(new Object[] {queryId, insertTime, artId, BranchManager.getBranchId(branch), + insertParameters.add(new Object[] { + queryId, + insertTime, + artId, + BranchManager.getBranchId(branch), historical ? transactionId.getId() : SQL3DataType.INTEGER}); } @@ -281,7 +285,11 @@ public final class ArtifactLoader { artifacts.add(artifact); } else { Object transactionParameter = transactionId == null ? SQL3DataType.INTEGER : transactionId.getId(); - insertParameters.put(artId, branchId, new Object[] {queryId, insertTime, artId, branchId, + insertParameters.put(artId, branchId, new Object[] { + queryId, + insertTime, + artId, + branchId, transactionParameter}); } } 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 9c38691d032..7b3f114a88e 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 @@ -260,8 +260,6 @@ public class ArtifactTypeManager { * Run code that will be run during purge with convert and report on what relations, attributes will be deleted as * part of the conversion. * - * @param purgeArtifactTypes - * @param newArtifactType * @throws OseeCoreException */ public static void purgeArtifactTypesWithConversionReportOnly(StringBuffer results, Collection<ArtifactType> purgeArtifactTypes, ArtifactType newArtifactType) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java index 442f3d40bd8..0384a2718b5 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Attribute.java @@ -163,7 +163,6 @@ public abstract class Attribute<T> { * Subclasses must provide an implementation of this method and in general should not override the other set value * methods * - * @param value * @throws OseeCoreException */ protected abstract boolean subClassSetValue(T value) throws OseeCoreException; @@ -246,7 +245,6 @@ public abstract class Attribute<T> { /** * Currently this method provides support for quasi attribute type inheritance * - * @param artifactType * @return whether this attribute's type or any of its super-types are the specified type */ public boolean isOfType(String otherAttributeTypeName) { @@ -256,7 +254,6 @@ public abstract class Attribute<T> { /** * Currently this method provides support for quasi attribute type inheritance * - * @param artifactType * @return whether this attribute's type or any of its super-types are the specified type */ public boolean isOfType(IAttributeType otherAttributeType) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java index 29d4bc4d3eb..98af6e9cf53 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ChangeArtifactType.java @@ -132,8 +132,6 @@ public class ChangeArtifactType { * Splits the attributes of the current artifact into two groups. The attributes that are compatible for the new type * and the attributes that will need to be purged. * - * @param artifact - * @param descriptor */ private static void processAttributes(Artifact artifact, ArtifactType artifactType) throws OseeCoreException { attributesToPurge = new LinkedList<Attribute<?>>(); @@ -149,8 +147,6 @@ public class ChangeArtifactType { * Splits the relationLinks of the current artifact into Two groups. The links that are compatible for the new type * and the links that will need to be purged. * - * @param artifact - * @param artifactType * @throws OseeCoreException */ private static void processRelations(Artifact artifact, ArtifactType artifactType) throws OseeCoreException { @@ -164,8 +160,6 @@ public class ChangeArtifactType { } /** - * @param artifact - * @param artifactType * @return true if the user accepts the purging of the attributes and relations that are not compatible for the new * artifact type else false. */ @@ -189,8 +183,6 @@ public class ChangeArtifactType { /** * Sets the artifact descriptor. * - * @param artifact - * @param newArtifactType * @throws OseeCoreException */ private static boolean changeArtifactTypeThroughHistory(Artifact artifact, ArtifactType newArtifactType) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpBranchCreation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpBranchCreation.java index 73ff67e8521..a2a993f88b8 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpBranchCreation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpBranchCreation.java @@ -38,11 +38,6 @@ public class HttpBranchCreation { /** * Creates a new root branch. Should NOT be used outside BranchManager. * - * @param branchType - * @param parentTransactionNumber - * @param parentBranchId - * @param branchName - * @param associatedArtifact * @return the newly created branch * @throws OseeCoreException */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpCommitDataRequester.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpCommitDataRequester.java index 3649430445e..d48f0d8e362 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpCommitDataRequester.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/HttpCommitDataRequester.java @@ -81,8 +81,13 @@ public class HttpCommitDataRequester { IOseeStatement chStmt = ConnectionHandler.getStatement(); try { Object[] queryData = - new Object[] {newTransaction.getBranchId(), newTransaction.getId(), newTransaction.getBranchId(), - newTransaction.getId(), newTransaction.getBranchId(), newTransaction.getId()}; + new Object[] { + newTransaction.getBranchId(), + newTransaction.getId(), + newTransaction.getBranchId(), + newTransaction.getId(), + newTransaction.getBranchId(), + newTransaction.getId()}; chStmt.runPreparedQuery(ARTIFACT_CHANGES, queryData); while (chStmt.next()) { int artId = chStmt.getInt("art_id"); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IArtifactCheck.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IArtifactCheck.java index ced8a8f515c..86911b33ab3 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IArtifactCheck.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IArtifactCheck.java @@ -23,7 +23,6 @@ public interface IArtifactCheck { /** * Checks set of artifacts for validation prior to delete * - * @param artifacts * @return Result with description of which artifact and why can't delete * @throws OseeCoreException */ @@ -32,7 +31,6 @@ public interface IArtifactCheck { /** * Checks set of artifacts for validation prior to rename * - * @param artifacts * @return Result with description of which artifact and why can't rename * @throws OseeCoreException */ 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 8b5a4346c7f..544effac343 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 @@ -58,9 +58,6 @@ public class PurgeArtifacts extends DbTransaction { private final Collection<? extends Artifact> artifactsToPurge; - /** - * @param artifactsToPurge - */ public PurgeArtifacts(Collection<? extends Artifact> artifactsToPurge) { this.artifactsToPurge = artifactsToPurge; } @@ -78,7 +75,11 @@ public class PurgeArtifacts extends DbTransaction { try { for (Artifact art : artifactsToPurge) { for (Branch branch : art.getBranch().getChildBranches(true)) { - batchParameters.add(new Object[] {queryId, insertTime, art.getArtId(), branch.getId(), + batchParameters.add(new Object[] { + queryId, + insertTime, + art.getArtId(), + branch.getId(), SQL3DataType.INTEGER}); } } @@ -114,7 +115,11 @@ public class PurgeArtifacts extends DbTransaction { // insert into the artifact_join_table for (Artifact art : artifactsToPurge) { - batchParameters.add(new Object[] {queryId, insertTime, art.getArtId(), art.getBranch().getId(), + batchParameters.add(new Object[] { + queryId, + insertTime, + art.getArtId(), + art.getBranch().getId(), SQL3DataType.INTEGER}); } ArtifactLoader.insertIntoArtifactJoin(connection, batchParameters); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java index 0bba539f807..683a41a8870 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UpdateMergeBranch.java @@ -65,12 +65,6 @@ public class UpdateMergeBranch extends DbTransaction { private final Branch destBranch; private final Branch sourceBranch; - /** - * @param destBranch - * @param expectedArtIds - * @param mergeBranch - * @param sourceBranch - */ public UpdateMergeBranch(Branch mergeBranch, ArrayList<Integer> expectedArtIds, Branch destBranch, Branch sourceBranch) { this.destBranch = destBranch; this.expectedArtIds = expectedArtIds; @@ -246,7 +240,6 @@ public class UpdateMergeBranch extends DbTransaction { * from the database. It also removes all history associated with this artifact (i.e. all transactions and gamma ids * will also be removed from the database only for the branch it is on). * - * @param artifact */ private static void purgeArtifactFromBranch(OseeConnection connection, Branch branch, int artId) throws OseeCoreException { int baseTxId = branch.getBaseTransaction().getId(); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/annotation/AttributeAnnotationManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/annotation/AttributeAnnotationManager.java index e56752ee616..631671ab30f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/annotation/AttributeAnnotationManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/annotation/AttributeAnnotationManager.java @@ -51,7 +51,6 @@ public class AttributeAnnotationManager { /** * Add an annotation to be stored in the "Annotation" attribute of this given artifact. * - * @param newAnnotation * @throws OseeCoreException */ public void addAnnotation(ArtifactAnnotation newAnnotation) throws OseeCoreException { @@ -70,7 +69,6 @@ public class AttributeAnnotationManager { /** * Remove the annotation from the "Annotation" attribute of the given artifact. * - * @param annotation * @throws OseeCoreException */ public void removeAnnotation(ArtifactAnnotation annotation) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/format/BaseStyleSheetArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/format/BaseStyleSheetArtifact.java index 1145226901e..607b8dfb752 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/format/BaseStyleSheetArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/format/BaseStyleSheetArtifact.java @@ -17,9 +17,6 @@ package org.eclipse.osee.framework.skynet.core.artifact.format; */ public class BaseStyleSheetArtifact implements IStyleSheetArtifact { - /** - * - */ public BaseStyleSheetArtifact() { super(); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/ArtifactOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/ArtifactOperation.java index c5874b5928b..d60ff0ce9ea 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/ArtifactOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/ArtifactOperation.java @@ -33,7 +33,6 @@ public abstract class ArtifactOperation extends Artifact implements WorkflowStep * The list of artifacts will never be null, but may be empty. Must never throw NullPointerException, but rather a * more informative excpetion explaining the problem that would have caused a NullPointerException. * - * @param artifacts * @param monitor progress monitor for upating the GUI * @return may return null because the engine will use an empty list in this case * @throws IllegalArgumentException @@ -42,7 +41,6 @@ public abstract class ArtifactOperation extends Artifact implements WorkflowStep public abstract List<Artifact> applyToArtifacts(List<Artifact> artifacts, IProgressMonitor monitor) throws IllegalArgumentException, Exception; /** - * @param operation * @return returns PROVIDES_ACCEPTABLE_INPUT if this operation can run after, i.e. accept input from, the given * operation, otherwise returns a human readable reason why the input can not be accepted */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/FinishUpdateBranchOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/FinishUpdateBranchOperation.java index 6770d51295b..f328c11cc05 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/FinishUpdateBranchOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/FinishUpdateBranchOperation.java @@ -28,10 +28,6 @@ public class FinishUpdateBranchOperation extends AbstractOperation { private final boolean archiveSourceBranch; private final boolean overwriteUnresolvedConflicts; - /** - * @param operationName - * @param pluginId - */ public FinishUpdateBranchOperation(ConflictManagerExternal conflictManager, boolean archiveSourceBranch, boolean overwriteUnresolvedConflicts) { super(String.format("Complete Branch Update [%s]", conflictManager.getSourceBranch().getShortName()), Activator.PLUGIN_ID); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/WorkflowStep.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/WorkflowStep.java index 3f032f98236..e7961728b90 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/WorkflowStep.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/operation/WorkflowStep.java @@ -23,8 +23,6 @@ public interface WorkflowStep { * <step> ::= <artifact operation invocation> | <workflow invocation> | <exit> | <flow * control construct> * - * @param artifacts - * @param monitor * @return list of artifacts that are the result of this step (if null) engine with replace with the empty list * @throws Exception */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java index 84d618d520d..10a54782dbf 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java @@ -60,7 +60,6 @@ public class ArtifactQuery { * search for exactly one artifact by one its id - otherwise throw an exception * * @param artId the id of the desired artifact - * @param branch * @return exactly one artifact by one its id - otherwise throw an exception * @throws ArtifactDoesNotExist if no artifacts are found */ @@ -72,7 +71,6 @@ public class ArtifactQuery { * search for exactly one artifact by one its id - otherwise throw an exception * * @param artId the id of the desired artifact - * @param branch * @param allowDeleted whether to return the artifact even if it has been deleted * @return exactly one artifact by one its id - otherwise throw an exception * @throws ArtifactDoesNotExist if no artifacts are found @@ -93,7 +91,6 @@ public class ArtifactQuery { * Checks for existence of an artifact by id * * @param artifactId the id of the desired artifact - * @param branch * @param allowDeleted whether to return the artifact even if it has been deleted * @return one artifact by one its id if it exists, otherwise null */ @@ -105,7 +102,6 @@ public class ArtifactQuery { * Checks for existence of an artifact by one its guid or human readable id - otherwise throw an exception * * @param guidOrHrid either the guid or human readable id of the desired artifact - * @param branch * @param allowDeleted whether to return the artifact even if it has been deleted * @return one artifact by one its id if it exists, otherwise null */ @@ -117,7 +113,6 @@ public class ArtifactQuery { * Checks for existence of an artifact by one its guid or human readable id - otherwise throw an exception * * @param guidOrHrid either the guid or human readable id of the desired artifact - * @param branch * @return one artifact by one its guid or human readable id if it exists, otherwise null */ public static Artifact checkArtifactFromId(String guidOrHrid, IOseeBranch branch) throws OseeCoreException { @@ -128,7 +123,6 @@ public class ArtifactQuery { * search for exactly one artifact by one its guid or human readable id - otherwise throw an exception * * @param guidOrHrid either the guid or human readable id of the desired artifact - * @param branch * @return exactly one artifact by one its guid or human readable id - otherwise throw an exception * @throws ArtifactDoesNotExist if no artifacts are found * @throws MultipleArtifactsExist if more than one artifact is found @@ -141,7 +135,6 @@ public class ArtifactQuery { * search for exactly one artifact by one its guid or human readable id - otherwise throw an exception * * @param guidOrHrid either the guid or human readable id of the desired artifact - * @param branch * @param allowDeleted whether to return the artifact even if it has been deleted * @return exactly one artifact by one its guid or human readable id - otherwise throw an exception * @throws ArtifactDoesNotExist if no artifacts are found 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 30c240dd4e8..7bc84e8bd87 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 @@ -71,8 +71,6 @@ public class ArtifactQueryBuilder { private CharJoinQuery guidJoinQuery; /** - * @param artId - * @param branch * @param allowDeleted set whether deleted artifacts should be included in the resulting artifact list */ public ArtifactQueryBuilder(int artId, IOseeBranch branch, DeletionFlag allowDeleted, LoadLevel loadLevel) { @@ -83,7 +81,6 @@ public class ArtifactQueryBuilder { * search for artifacts with the given ids * * @param artifactIds list of artifact ids - * @param branch * @param allowDeleted set whether deleted artifacts should be included in the resulting artifact list */ public ArtifactQueryBuilder(Collection<Integer> artifactIds, IOseeBranch branch, DeletionFlag allowDeleted, LoadLevel loadLevel) { 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 1bff81c083d..5a238658005 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 @@ -22,9 +22,6 @@ public class ArtifactTypeSearch implements ISearchPrimitive { private static final String tables = "osee_artifact, osee_artifact_type"; private final static String TOKEN = ";"; - /** - * @param typeName - */ public ArtifactTypeSearch(String typeName, DeprecatedOperator operation) { super(); this.typeName = typeName; 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 a1460475504..e9771692c64 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 @@ -41,7 +41,6 @@ public class AttributeCriteria extends AbstractArtifactSearchCriteria { * Constructor for search criteria that finds an attribute of the given type with its current value equal to the * given value. * - * @param attributeType * @param value to search; supports % wildcard * @throws OseeCoreException */ @@ -53,8 +52,6 @@ public class AttributeCriteria extends AbstractArtifactSearchCriteria { * Constructor for search criteria that finds an attribute of the given type and any value (i.e. checks for * existence) * - * @param attributeTypeName - * @param value * @throws OseeCoreException */ public AttributeCriteria(IAttributeType attributeType) throws OseeCoreException { @@ -67,8 +64,6 @@ public class AttributeCriteria extends AbstractArtifactSearchCriteria { * if the single value constructor was called. This search does not support the wildcard for multiple values. Throws * OseeArgumentException values is empty or null * - * @param attributeTypeName - * @param values * @throws OseeCoreException */ public AttributeCriteria(IAttributeType attributeType, Collection<String> values) throws OseeCoreException { @@ -85,8 +80,6 @@ public class AttributeCriteria extends AbstractArtifactSearchCriteria { * conducted exactly as if the single value constructor was called. This search does not support the wildcard for * multiple values. * - * @param attributeTypeName - * @param values * @throws OseeCoreException */ public AttributeCriteria(String attributeTypeName, Collection<String> values, Operator operator) throws OseeCoreException { @@ -101,7 +94,6 @@ public class AttributeCriteria extends AbstractArtifactSearchCriteria { * Constructor for search criteria that finds an attribute of the given type with its current value equal to the * given value. * - * @param attributeTypeName * @param value to search; supports % wildcard * @param historical if true will search on any branch and any attribute revision * @throws OseeCoreException diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java index e19d62a977f..fe23ed14352 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/FromArtifactsSearch.java @@ -32,9 +32,6 @@ public class FromArtifactsSearch implements ISearchPrimitive { return "art_id"; } - /** - * - */ public FromArtifactsSearch(List<ISearchPrimitive> criteria, boolean all) { this.criteria = criteria; this.all = all; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java index 00fbdd64386..d9b71cce90a 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ISearchPrimitive.java @@ -18,7 +18,6 @@ public interface ISearchPrimitive { /** * The sql operators that will provide a set of art_id's for the given search. * - * @param branch * @return Return SQL string */ public String getCriteriaSql(List<Object> dataList, Branch branch); @@ -33,7 +32,6 @@ public interface ISearchPrimitive { /** * Returns a list of the tables, comma separated, that are necessary for the sql statement returned from getSql(). * - * @param branch * @return tables string * @see ISearchPrimitive#getCriteriaSql(List, 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 9acf46b0aad..dda15bcf384 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 @@ -40,8 +40,6 @@ public class InRelationSearch implements ISearchPrimitive { * <code>RelationSide</code>'s must be for the same side, that is all sideB or all sideA. This restriction is in * place to optimize SQL performance. * - * @param firstSide - * @param sides * @throws IllegalArgumentException if the sides are a mixture of sideA and sideB relation sides. */ public InRelationSearch(IRelationEnumeration firstSide, IRelationEnumeration... sides) { @@ -53,9 +51,6 @@ public class InRelationSearch implements ISearchPrimitive { * <code>RelationSide</code>'s must be for the same side, that is all sideB or all sideA. This restriction is in * place to optimize SQL performance. * - * @param otherArtifacts - * @param firstSide - * @param sides * @throws IllegalArgumentException if the sides are a mixture of sideA and sideB relation sides. */ public InRelationSearch(FromArtifactsSearch otherArtifacts, IRelationEnumeration firstSide, IRelationEnumeration... sides) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java index 465608ebe1f..8aed9347300 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/NotSearch.java @@ -20,9 +20,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManage public class NotSearch implements ISearchPrimitive { private final ISearchPrimitive search; - /** - * @param search - */ public NotSearch(ISearchPrimitive search) { super(); this.search = search; 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 64d8830e93e..b4344588f89 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 @@ -30,7 +30,6 @@ public class RelationCriteria extends AbstractArtifactSearchCriteria { * Constructor for search criteria that follows the relation link ending on the given side * * @param relationEnum the side to start following the link from - * @param value * @throws OseeCoreException */ public RelationCriteria(IRelationEnumeration relationEnum) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeExtensionManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeExtensionManager.java index d4b4df8cb25..a6508d61b20 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeExtensionManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeExtensionManager.java @@ -38,9 +38,11 @@ public class AttributeExtensionManager { private static final String ATTRIBUTE_TYPE = Activator.PLUGIN_ID + ".AttributeType"; private static final String ATTRIBUTE_DATA_PROVIDER_TYPE = Activator.PLUGIN_ID + ".AttributeDataProvider"; - private static final String[] attributeBaseTypes = new String[] {"CharacterBackedAttributeType", + private static final String[] attributeBaseTypes = new String[] { + "CharacterBackedAttributeType", "BinaryBackedAttributeType"}; - private static final String[] attributeProviderBaseTypes = new String[] {"CharacterAttributeDataProvider", + private static final String[] attributeProviderBaseTypes = new String[] { + "CharacterAttributeDataProvider", "BinaryAttributeDataProvider"}; private static final AttributeExtensionManager instance = new AttributeExtensionManager(); 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 7f173a728a2..dcd12808977 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 @@ -96,7 +96,6 @@ public class AttributeTypeManager { } /** - * @param name * @return the attribute type with the given name or throws an OseeTypeDoesNotExist if it does not exist. * @throws OseeCoreException */ @@ -111,7 +110,6 @@ public class AttributeTypeManager { /** * Returns the attribute type with the given type id or throws an IllegalArgumentException if it does not exist. * - * @param attrTypeId * @throws OseeCoreException */ public static AttributeType getType(int attrTypeId) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BinaryBackedAttribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BinaryBackedAttribute.java index 4fd1629fb78..201db169963 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BinaryBackedAttribute.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BinaryBackedAttribute.java @@ -19,7 +19,7 @@ import org.eclipse.osee.framework.skynet.core.attribute.providers.IBinaryAttribu public abstract class BinaryBackedAttribute<T> extends Attribute<T> { @Override public IBinaryAttributeDataProvider getAttributeDataProvider() { - // this cast is always safe since the the data provider passed in the constructor to + // this cast is always safe since the the data provider passed in the constructor to // the super class is of type IBinaryAttributeDataProvider return (IBinaryAttributeDataProvider) super.getAttributeDataProvider(); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/CharacterBackedAttribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/CharacterBackedAttribute.java index 2ee0f7ef9aa..cb15abbb1be 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/CharacterBackedAttribute.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/CharacterBackedAttribute.java @@ -19,7 +19,7 @@ import org.eclipse.osee.framework.skynet.core.attribute.providers.ICharacterAttr public abstract class CharacterBackedAttribute<T> extends Attribute<T> { @Override public ICharacterAttributeDataProvider getAttributeDataProvider() { - // this cast is always safe since the the data provider passed in the constructor to + // this cast is always safe since the the data provider passed in the constructor to // the super class is of type ICharacterAttributeDataProvider return (ICharacterAttributeDataProvider) super.getAttributeDataProvider(); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeTrackedChangesException.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeTrackedChangesException.java index 13b4e51111d..6b57167b99f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeTrackedChangesException.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeTrackedChangesException.java @@ -14,9 +14,6 @@ import org.eclipse.osee.framework.core.exception.OseeArgumentException; public class OseeTrackedChangesException extends OseeArgumentException { - /** - * - */ private static final long serialVersionUID = -4953741614901835086L; public OseeTrackedChangesException(String message) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/AbstractAttributeDataProvider.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/AbstractAttributeDataProvider.java index 39b8c35f3a7..8b2b809fb3f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/AbstractAttributeDataProvider.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/AbstractAttributeDataProvider.java @@ -18,9 +18,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; public abstract class AbstractAttributeDataProvider implements IAttributeDataProvider { private final Attribute<?> attribute; - /** - * @param attribute - */ public AbstractAttributeDataProvider(Attribute<?> attribute) { super(); this.attribute = attribute; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/ClobAttributeDataProvider.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/ClobAttributeDataProvider.java index 4dea5ee22d8..905de7f8ea2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/ClobAttributeDataProvider.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/ClobAttributeDataProvider.java @@ -16,9 +16,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; * @author Roberto E. Escobar */ public class ClobAttributeDataProvider extends DefaultAttributeDataProvider { - /** - * @param attributeStateManager - */ public ClobAttributeDataProvider(Attribute<?> attribute) { super(attribute); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java index 6424777a1ee..b66edf80a4d 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/DefaultAttributeDataProvider.java @@ -32,9 +32,6 @@ public class DefaultAttributeDataProvider extends AbstractAttributeDataProvider private final DataStore dataStore; - /** - * @param attributeStateManager - */ public DefaultAttributeDataProvider(Attribute<?> attribute) { super(attribute); this.dataStore = new DataStore(new AttributeResourceProcessor(attribute)); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventSystemPreferences.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventSystemPreferences.java index f0ede4ee6f7..7b582eccaca 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventSystemPreferences.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/EventSystemPreferences.java @@ -1,97 +1,97 @@ -/*******************************************************************************
- * 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.skynet.core.event;
-
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.OseeInfo;
-import org.eclipse.osee.framework.jdk.core.util.OseeProperties;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class EventSystemPreferences {
- // This will disable all Local TransactionEvents and enable loop-back routing of Remote TransactionEvents back
- // through the RemoteEventService as if they came from another client. This is for testing purposes only and
- // should be reset to false before release.
- private boolean enableRemoteEventLoopback = false;
- private boolean disableEvents = false;
- private boolean pendRunning = false;
-
- public boolean isDisableEvents() {
- return disableEvents;
- }
-
- public void setDisableEvents(boolean disableEvents) {
- this.disableEvents = disableEvents;
- }
-
- public boolean isEnableRemoteEventLoopback() {
- return enableRemoteEventLoopback;
- }
-
- public void setEnableRemoteEventLoopback(boolean enableRemoteEventLoopback) {
- this.enableRemoteEventLoopback = enableRemoteEventLoopback;
- }
-
- /**
- * If true, all listeners will be called back in main thread. For testing purposes only.
- */
- public void setPendRunning(boolean pendRunning) {
- this.pendRunning = pendRunning;
- }
-
- public boolean isPendRunning() {
- return pendRunning;
- }
-
- public boolean isNewEvents() {
- try {
- String dbProperty = OseeInfo.getCachedValue("eventSystem");
- if (Strings.isValid(dbProperty)) {
- return dbProperty.equals("new");
- }
- } catch (OseeDataStoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- if (!Strings.isValid(getEventSystemType())) {
- return false;
- }
- return getEventSystemType().equals("new");
- }
-
- public void setNewEvents(boolean enabled) {
- System.setProperty("eventSystem", enabled ? "new" : "old");
- }
-
- public boolean isOldEvents() {
- return !isNewEvents();
- }
-
- public String getEventSystemType() {
- return System.getProperty("eventSystem");
- }
-
- public String getEventDebug() {
- return System.getProperty("eventDebug");
- }
-
- public String getOseeEventBrokerUri() {
- return OseeProperties.getOseeDefaultBrokerUri();
- }
-
- public boolean isOseeEventBrokerValid() {
- return Strings.isValid(getOseeEventBrokerUri());
- }
+/******************************************************************************* + * 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.skynet.core.event; + +import java.util.logging.Level; +import org.eclipse.osee.framework.core.exception.OseeDataStoreException; +import org.eclipse.osee.framework.database.core.OseeInfo; +import org.eclipse.osee.framework.jdk.core.util.OseeProperties; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.internal.Activator; + +/** + * @author Roberto E. Escobar + */ +public final class EventSystemPreferences { + // This will disable all Local TransactionEvents and enable loop-back routing of Remote TransactionEvents back + // through the RemoteEventService as if they came from another client. This is for testing purposes only and + // should be reset to false before release. + private boolean enableRemoteEventLoopback = false; + private boolean disableEvents = false; + private boolean pendRunning = false; + + public boolean isDisableEvents() { + return disableEvents; + } + + public void setDisableEvents(boolean disableEvents) { + this.disableEvents = disableEvents; + } + + public boolean isEnableRemoteEventLoopback() { + return enableRemoteEventLoopback; + } + + public void setEnableRemoteEventLoopback(boolean enableRemoteEventLoopback) { + this.enableRemoteEventLoopback = enableRemoteEventLoopback; + } + + /** + * If true, all listeners will be called back in main thread. For testing purposes only. + */ + public void setPendRunning(boolean pendRunning) { + this.pendRunning = pendRunning; + } + + public boolean isPendRunning() { + return pendRunning; + } + + public boolean isNewEvents() { + try { + String dbProperty = OseeInfo.getCachedValue("eventSystem"); + if (Strings.isValid(dbProperty)) { + return dbProperty.equals("new"); + } + } catch (OseeDataStoreException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + if (!Strings.isValid(getEventSystemType())) { + return false; + } + return getEventSystemType().equals("new"); + } + + public void setNewEvents(boolean enabled) { + System.setProperty("eventSystem", enabled ? "new" : "old"); + } + + public boolean isOldEvents() { + return !isNewEvents(); + } + + public String getEventSystemType() { + return System.getProperty("eventSystem"); + } + + public String getEventDebug() { + return System.getProperty("eventDebug"); + } + + public String getOseeEventBrokerUri() { + return OseeProperties.getOseeDefaultBrokerUri(); + } + + public boolean isOseeEventBrokerValid() { + return Strings.isValid(getOseeEventBrokerUri()); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java index 816dc24c661..e0f47afe49e 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/FrameworkTransactionData.java @@ -48,8 +48,8 @@ public class FrameworkTransactionData { public Set<Artifact> cacheDeletedArtifacts = new HashSet<Artifact>(); public Set<Artifact> cacheAddedArtifacts = new HashSet<Artifact>(); - // collection of unloaded artifact changes that are NOT currently loaded in the client's artifact cache; - // where UnloadedArtifact contains artifact id, branch and artifact type id + // collection of unloaded artifact changes that are NOT currently loaded in the client's artifact cache; + // where UnloadedArtifact contains artifact id, branch and artifact type id public Set<UnloadedArtifact> unloadedChangedArtifacts = new HashSet<UnloadedArtifact>(); public Set<UnloadedArtifact> unloadedDeletedArtifacts = new HashSet<UnloadedArtifact>(); public Set<UnloadedArtifact> unloadedAddedArtifacts = new HashSet<UnloadedArtifact>(); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/FrameworkEventToRemoteEvent2Listener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/FrameworkEventToRemoteEvent2Listener.java index 8a2d8d7172c..417891e10dc 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/FrameworkEventToRemoteEvent2Listener.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/FrameworkEventToRemoteEvent2Listener.java @@ -1,354 +1,354 @@ -/*******************************************************************************
- * 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.skynet.core.event.systems;
-
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.core.model.type.RelationType;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.event.res.AttributeEventModificationType;
-import org.eclipse.osee.framework.messaging.event.res.IFrameworkEventListener;
-import org.eclipse.osee.framework.messaging.event.res.RemoteEvent;
-import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBranchEvent1;
-import org.eclipse.osee.framework.messaging.event.res.msgs.RemotePersistEvent1;
-import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteTransactionEvent1;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
-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.ChangeArtifactType;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeTransactionOperation;
-import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
-import org.eclipse.osee.framework.skynet.core.event.EventUtil;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent;
-import org.eclipse.osee.framework.skynet.core.event2.BranchEvent;
-import org.eclipse.osee.framework.skynet.core.event2.FrameworkEventUtil;
-import org.eclipse.osee.framework.skynet.core.event2.TransactionEvent;
-import org.eclipse.osee.framework.skynet.core.event2.TransactionEventType;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.AttributeChange;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidRelation;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventChangeTypeBasicGuidArtifact;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModifiedBasicGuidArtifact;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-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.RelationManager;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-
-/**
- * @author Donald G. Dunne
- */
-public final class FrameworkEventToRemoteEvent2Listener implements IFrameworkEventListener {
-
- private final ISchedulingRule mutexRule;
- private InternalEventManager2 eventManager;
-
- public FrameworkEventToRemoteEvent2Listener(InternalEventManager2 eventManager) {
- this.eventManager = eventManager;
- this.mutexRule = new ISchedulingRule() {
-
- @Override
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- @Override
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
- };
- }
-
- @Override
- public void onEvent(final RemoteEvent remoteEvent) {
- final Runnable runnable = new Runnable() {
- private void handleTransactionEvent(Sender sender, TransactionEvent transEvent) {
- try {
- if (transEvent.getEventType() == TransactionEventType.Purged) {
- PurgeTransactionOperation.handleRemotePurgeTransactionEvent(transEvent);
- eventManager.kickTransactionEvent(sender, transEvent);
- } else {
- EventUtil.eventLog("REM2: handleTransactionEvent - unhandled mod type " + transEvent.getEventType());
- }
- } catch (Exception ex) {
- EventUtil.eventLog("REM2: handleTransactionEvent", ex);
- }
- }
-
- @Override
- public void run() {
- Sender sender = new Sender(remoteEvent.getNetworkSender());
- // If the sender's sessionId is the same as this client, then this event was
- // created in this client and returned by remote event manager; ignore and continue
- if (sender.isLocal()) {
- return;
- }
- // Handles TransactionEvents, ArtifactChangeTypeEvents, ArtifactPurgeEvents
- if (remoteEvent instanceof RemotePersistEvent1) {
- try {
- RemotePersistEvent1 event1 = (RemotePersistEvent1) remoteEvent;
- ArtifactEvent transEvent = FrameworkEventUtil.getPersistEvent(event1);
- updateArtifacts(sender, transEvent);
- updateRelations(sender, transEvent);
- eventManager.kickArtifactEvent(sender, transEvent);
- } catch (Exception ex) {
- EventUtil.eventLog("REM2: RemoteTransactionEvent1", ex);
- }
- } else if (remoteEvent instanceof RemoteBranchEvent1) {
- try {
- BranchEvent branchEvent = FrameworkEventUtil.getBranchEvent((RemoteBranchEvent1) remoteEvent);
- updateBranches(sender, branchEvent);
- eventManager.kickBranchEvent(sender, branchEvent);
- } catch (Exception ex) {
- EventUtil.eventLog("REM2: RemoteBranchEvent1", ex);
- }
- } else if (remoteEvent instanceof RemoteTransactionEvent1) {
- try {
- TransactionEvent transEvent =
- FrameworkEventUtil.getTransactionEvent((RemoteTransactionEvent1) remoteEvent);
- handleTransactionEvent(sender, transEvent);
- } catch (Exception ex) {
- EventUtil.eventLog("REM2: RemoteBranchEvent1", ex);
- }
- }
- }
- };
-
- if (OseeEventManager.getPreferences().isPendRunning()) {
- runnable.run();
- } else {
- Job job =
- new Job(String.format("[%s] - receiving [%s]", getClass().getSimpleName(),
- remoteEvent.getClass().getSimpleName())) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
-
- try {
- runnable.run();
- } catch (Exception ex) {
- // don't want exceptions poping up; just log and return nicely
- OseeLog.log(Activator.class, Level.SEVERE, "REM2 Receive Event Exception", ex);
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.setRule(mutexRule);
- job.setUser(false);
- job.schedule();
- }
- }
-
- /**
- * Updates local cache
- **/
- private void updateArtifacts(Sender sender, ArtifactEvent transEvent) {
- // Don't crash on any one artifact update problem (no update method throughs exceptions)
- for (EventBasicGuidArtifact guidArt : transEvent.getArtifacts()) {
- EventUtil.eventLog(String.format("REM2: updateArtifact -> [%s]", guidArt));
- // Handle Added Artifacts
- // Nothing to do for added cause they're not in cache yet. Apps will load if they need them.
- if (guidArt.getModType() == EventModType.Added) {
- // do nothing cause not in cache
- }
- // Handle Deleted Artifacts
- else if (guidArt.getModType() == EventModType.Deleted || guidArt.getModType() == EventModType.Purged) {
- updateDeletedArtifact(guidArt);
- }
- // Handle Modified Artifacts
- else if (guidArt.getModType() == EventModType.Modified) {
- updateModifiedArtifact((EventModifiedBasicGuidArtifact) guidArt);
- }
- // Handle Change Type Artifacts
- else if (guidArt.getModType() == EventModType.ChangeType) {
- ChangeArtifactType.handleRemoteChangeType((EventChangeTypeBasicGuidArtifact) guidArt);
- }
- // Unknown mod type
- else {
- EventUtil.eventLog(String.format("REM2: updateArtifacts - Unhandled mod type [%s]", guidArt.getModType()));
- }
- }
- }
-
- /**
- * Updates local cache
- */
- private void updateBranches(Sender sender, BranchEvent branchEvent) {
- BranchEventType eventType = branchEvent.getEventType();
- try {
- if (eventType == BranchEventType.Committed) {
- TransactionManager.clearCommitArtifactCacheForAssociatedArtifact(BranchManager.getAssociatedArtifact(BranchManager.getBranchByGuid(branchEvent.getBranchGuid())));
- }
- BranchManager.refreshBranches();
- } catch (Exception ex) {
- EventUtil.eventLog("REM2: updateBranches", ex);
- }
- }
-
- private void updateRelations(Sender sender, ArtifactEvent transEvent) {
- for (EventBasicGuidRelation guidArt : transEvent.getRelations()) {
- // Don't crash on any one relation update problem
- try {
- EventUtil.eventLog(String.format("REM2: updateRelation -> [%s]", guidArt));
- RelationEventType eventType = guidArt.getModType();
- Branch branch = BranchManager.getBranch(guidArt.getArtA());
- RelationType relationType = RelationTypeManager.getTypeByGuid(guidArt.getRelTypeGuid());
- Artifact aArtifact = ArtifactCache.getActive(guidArt.getArtA());
- Artifact bArtifact = ArtifactCache.getActive(guidArt.getArtB());
- // Nothing in cache, ignore
- if (aArtifact == null && bArtifact == null) {
- return;
- }
- boolean aArtifactLoaded = aArtifact != null;
- boolean bArtifactLoaded = bArtifact != null;
-
- if (aArtifactLoaded || bArtifactLoaded) {
- if (eventType == RelationEventType.Added) {
- RelationLink relation =
- RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(),
- guidArt.getArtBId(), branch, branch);
-
- if (relation == null || relation.getModificationType() == ModificationType.DELETED || relation.getModificationType() == ModificationType.ARTIFACT_DELETED) {
- relation =
- RelationLink.getOrCreate(guidArt.getArtAId(), guidArt.getArtBId(), branch, branch,
- relationType, guidArt.getRelationId(), guidArt.getGammaId(), guidArt.getRationale(),
- ModificationType.NEW);
-
- }
- } else if (eventType == RelationEventType.Deleted || eventType == RelationEventType.Purged) {
- RelationLink relation =
- RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(),
- guidArt.getArtBId(), branch, branch);
- if (relation != null) {
- relation.internalRemoteEventDelete();
- }
- } else if (eventType == RelationEventType.ModifiedRationale) {
- RelationLink relation =
- RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(),
- guidArt.getArtBId(), branch, branch);
- if (relation != null) {
- relation.internalSetRationale(guidArt.getRationale());
- relation.setNotDirty();
- }
- } else if (eventType == RelationEventType.Undeleted) {
- RelationLink relation =
- RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(),
- guidArt.getArtBId(), branch, branch);
- if (relation != null) {
- relation.undelete();
- relation.setNotDirty();
- }
- } else {
- EventUtil.eventLog(String.format("REM2: updateRelations - Unhandled mod type [%s]", eventType));
- }
- }
- } catch (OseeCoreException ex) {
- EventUtil.eventLog("REM2: updateRelations", ex);
- }
- }
- }
-
- private void updateDeletedArtifact(DefaultBasicGuidArtifact guidArt) {
- try {
- Artifact artifact = ArtifactCache.getActive(guidArt);
- if (artifact == null) {
- // do nothing, artifact not in cache, so don't need to update
- } else if (!artifact.isHistorical()) {
- artifact.internalSetDeletedFromRemoteEvent();
- }
- } catch (OseeCoreException ex) {
- EventUtil.eventLog("REM2: updateDeletedArtifact", ex);
- }
- }
-
- private void updateModifiedArtifact(EventModifiedBasicGuidArtifact guidArt) {
- try {
- Artifact artifact = ArtifactCache.getActive(guidArt);
- if (artifact == null) {
- // do nothing, artifact not in cache, so don't need to update
- } else if (!artifact.isHistorical()) {
- for (AttributeChange attrChange : guidArt.getAttributeChanges()) {
- if (!OseeEventManager.getPreferences().isEnableRemoteEventLoopback()) {
- ModificationType modificationType =
- AttributeEventModificationType.getType(attrChange.getModTypeGuid()).getModificationType();
- AttributeType attributeType = AttributeTypeManager.getTypeByGuid(attrChange.getAttrTypeGuid());
- try {
- Attribute<?> attribute = artifact.getAttributeById(attrChange.getAttributeId(), true);
- // Attribute already exists (but may be deleted), process update
- // Process MODIFIED / DELETED attribute
- if (attribute != null) {
- if (attribute.isDirty()) {
- EventUtil.eventLog(String.format("%s's attribute %d [/n%s/n] has been overwritten.",
- artifact.getSafeName(), attribute.getId(), attribute.toString()));
- }
- try {
- if (modificationType == null) {
- EventUtil.eventLog(String.format(
- "REM2: updateModifiedArtifact - Can't get mod type for %s's attribute %d.",
- artifact.getArtifactTypeName(), attrChange.getAttributeId()));
- continue;
- }
- if (modificationType.isDeleted()) {
- attribute.internalSetModificationType(modificationType);
- } else {
- attribute.getAttributeDataProvider().loadData(
- attrChange.getData().toArray(new Object[attrChange.getData().size()]));
- }
- attribute.internalSetGammaId(attrChange.getGammaId());
- attribute.setNotDirty();
- } catch (OseeCoreException ex) {
- EventUtil.eventLog(
- String.format("REM2: Exception updating %s's attribute %d [/n%s/n].",
- artifact.getSafeName(), attribute.getId(), attribute.toString()), ex);
- }
- }
- // Otherwise, attribute needs creation
- // Process NEW attribute
- else {
- if (modificationType == null) {
- EventUtil.eventLog(String.format("REM2: Can't get mod type for %s's attribute %d.",
- artifact.getArtifactTypeName(), attrChange.getAttributeId()));
- continue;
- }
- artifact.internalInitializeAttribute(attributeType, attrChange.getAttributeId(),
- attrChange.getGammaId(), modificationType, false,
- attrChange.getData().toArray(new Object[attrChange.getData().size()]));
- }
- } catch (OseeCoreException ex) {
- EventUtil.eventLog(String.format(
- "REM2: Exception updating %s's attribute change for attributeTypeId %d.",
- artifact.getSafeName(), attributeType.getId()), ex);
- }
- }
- }
- }
- } catch (OseeCoreException ex) {
- EventUtil.eventLog("REM2: updateModifiedArtifact", ex);
- }
- }
+/******************************************************************************* + * 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.skynet.core.event.systems; + +import java.util.logging.Level; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osee.framework.core.enums.ModificationType; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact; +import org.eclipse.osee.framework.core.model.type.AttributeType; +import org.eclipse.osee.framework.core.model.type.RelationType; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.event.res.AttributeEventModificationType; +import org.eclipse.osee.framework.messaging.event.res.IFrameworkEventListener; +import org.eclipse.osee.framework.messaging.event.res.RemoteEvent; +import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteBranchEvent1; +import org.eclipse.osee.framework.messaging.event.res.msgs.RemotePersistEvent1; +import org.eclipse.osee.framework.messaging.event.res.msgs.RemoteTransactionEvent1; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache; +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.ChangeArtifactType; +import org.eclipse.osee.framework.skynet.core.artifact.PurgeTransactionOperation; +import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager; +import org.eclipse.osee.framework.skynet.core.event.BranchEventType; +import org.eclipse.osee.framework.skynet.core.event.EventUtil; +import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; +import org.eclipse.osee.framework.skynet.core.event.Sender; +import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent; +import org.eclipse.osee.framework.skynet.core.event2.BranchEvent; +import org.eclipse.osee.framework.skynet.core.event2.FrameworkEventUtil; +import org.eclipse.osee.framework.skynet.core.event2.TransactionEvent; +import org.eclipse.osee.framework.skynet.core.event2.TransactionEventType; +import org.eclipse.osee.framework.skynet.core.event2.artifact.AttributeChange; +import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidArtifact; +import org.eclipse.osee.framework.skynet.core.event2.artifact.EventBasicGuidRelation; +import org.eclipse.osee.framework.skynet.core.event2.artifact.EventChangeTypeBasicGuidArtifact; +import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModType; +import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModifiedBasicGuidArtifact; +import org.eclipse.osee.framework.skynet.core.internal.Activator; +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.RelationManager; +import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; +import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; + +/** + * @author Donald G. Dunne + */ +public final class FrameworkEventToRemoteEvent2Listener implements IFrameworkEventListener { + + private final ISchedulingRule mutexRule; + private InternalEventManager2 eventManager; + + public FrameworkEventToRemoteEvent2Listener(InternalEventManager2 eventManager) { + this.eventManager = eventManager; + this.mutexRule = new ISchedulingRule() { + + @Override + public boolean contains(ISchedulingRule rule) { + return rule == this; + } + + @Override + public boolean isConflicting(ISchedulingRule rule) { + return rule == this; + } + }; + } + + @Override + public void onEvent(final RemoteEvent remoteEvent) { + final Runnable runnable = new Runnable() { + private void handleTransactionEvent(Sender sender, TransactionEvent transEvent) { + try { + if (transEvent.getEventType() == TransactionEventType.Purged) { + PurgeTransactionOperation.handleRemotePurgeTransactionEvent(transEvent); + eventManager.kickTransactionEvent(sender, transEvent); + } else { + EventUtil.eventLog("REM2: handleTransactionEvent - unhandled mod type " + transEvent.getEventType()); + } + } catch (Exception ex) { + EventUtil.eventLog("REM2: handleTransactionEvent", ex); + } + } + + @Override + public void run() { + Sender sender = new Sender(remoteEvent.getNetworkSender()); + // If the sender's sessionId is the same as this client, then this event was + // created in this client and returned by remote event manager; ignore and continue + if (sender.isLocal()) { + return; + } + // Handles TransactionEvents, ArtifactChangeTypeEvents, ArtifactPurgeEvents + if (remoteEvent instanceof RemotePersistEvent1) { + try { + RemotePersistEvent1 event1 = (RemotePersistEvent1) remoteEvent; + ArtifactEvent transEvent = FrameworkEventUtil.getPersistEvent(event1); + updateArtifacts(sender, transEvent); + updateRelations(sender, transEvent); + eventManager.kickArtifactEvent(sender, transEvent); + } catch (Exception ex) { + EventUtil.eventLog("REM2: RemoteTransactionEvent1", ex); + } + } else if (remoteEvent instanceof RemoteBranchEvent1) { + try { + BranchEvent branchEvent = FrameworkEventUtil.getBranchEvent((RemoteBranchEvent1) remoteEvent); + updateBranches(sender, branchEvent); + eventManager.kickBranchEvent(sender, branchEvent); + } catch (Exception ex) { + EventUtil.eventLog("REM2: RemoteBranchEvent1", ex); + } + } else if (remoteEvent instanceof RemoteTransactionEvent1) { + try { + TransactionEvent transEvent = + FrameworkEventUtil.getTransactionEvent((RemoteTransactionEvent1) remoteEvent); + handleTransactionEvent(sender, transEvent); + } catch (Exception ex) { + EventUtil.eventLog("REM2: RemoteBranchEvent1", ex); + } + } + } + }; + + if (OseeEventManager.getPreferences().isPendRunning()) { + runnable.run(); + } else { + Job job = + new Job(String.format("[%s] - receiving [%s]", getClass().getSimpleName(), + remoteEvent.getClass().getSimpleName())) { + + @Override + protected IStatus run(IProgressMonitor monitor) { + + try { + runnable.run(); + } catch (Exception ex) { + // don't want exceptions poping up; just log and return nicely + OseeLog.log(Activator.class, Level.SEVERE, "REM2 Receive Event Exception", ex); + } + monitor.done(); + return Status.OK_STATUS; + } + }; + job.setSystem(true); + job.setRule(mutexRule); + job.setUser(false); + job.schedule(); + } + } + + /** + * Updates local cache + **/ + private void updateArtifacts(Sender sender, ArtifactEvent transEvent) { + // Don't crash on any one artifact update problem (no update method throughs exceptions) + for (EventBasicGuidArtifact guidArt : transEvent.getArtifacts()) { + EventUtil.eventLog(String.format("REM2: updateArtifact -> [%s]", guidArt)); + // Handle Added Artifacts + // Nothing to do for added cause they're not in cache yet. Apps will load if they need them. + if (guidArt.getModType() == EventModType.Added) { + // do nothing cause not in cache + } + // Handle Deleted Artifacts + else if (guidArt.getModType() == EventModType.Deleted || guidArt.getModType() == EventModType.Purged) { + updateDeletedArtifact(guidArt); + } + // Handle Modified Artifacts + else if (guidArt.getModType() == EventModType.Modified) { + updateModifiedArtifact((EventModifiedBasicGuidArtifact) guidArt); + } + // Handle Change Type Artifacts + else if (guidArt.getModType() == EventModType.ChangeType) { + ChangeArtifactType.handleRemoteChangeType((EventChangeTypeBasicGuidArtifact) guidArt); + } + // Unknown mod type + else { + EventUtil.eventLog(String.format("REM2: updateArtifacts - Unhandled mod type [%s]", guidArt.getModType())); + } + } + } + + /** + * Updates local cache + */ + private void updateBranches(Sender sender, BranchEvent branchEvent) { + BranchEventType eventType = branchEvent.getEventType(); + try { + if (eventType == BranchEventType.Committed) { + TransactionManager.clearCommitArtifactCacheForAssociatedArtifact(BranchManager.getAssociatedArtifact(BranchManager.getBranchByGuid(branchEvent.getBranchGuid()))); + } + BranchManager.refreshBranches(); + } catch (Exception ex) { + EventUtil.eventLog("REM2: updateBranches", ex); + } + } + + private void updateRelations(Sender sender, ArtifactEvent transEvent) { + for (EventBasicGuidRelation guidArt : transEvent.getRelations()) { + // Don't crash on any one relation update problem + try { + EventUtil.eventLog(String.format("REM2: updateRelation -> [%s]", guidArt)); + RelationEventType eventType = guidArt.getModType(); + Branch branch = BranchManager.getBranch(guidArt.getArtA()); + RelationType relationType = RelationTypeManager.getTypeByGuid(guidArt.getRelTypeGuid()); + Artifact aArtifact = ArtifactCache.getActive(guidArt.getArtA()); + Artifact bArtifact = ArtifactCache.getActive(guidArt.getArtB()); + // Nothing in cache, ignore + if (aArtifact == null && bArtifact == null) { + return; + } + boolean aArtifactLoaded = aArtifact != null; + boolean bArtifactLoaded = bArtifact != null; + + if (aArtifactLoaded || bArtifactLoaded) { + if (eventType == RelationEventType.Added) { + RelationLink relation = + RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(), + guidArt.getArtBId(), branch, branch); + + if (relation == null || relation.getModificationType() == ModificationType.DELETED || relation.getModificationType() == ModificationType.ARTIFACT_DELETED) { + relation = + RelationLink.getOrCreate(guidArt.getArtAId(), guidArt.getArtBId(), branch, branch, + relationType, guidArt.getRelationId(), guidArt.getGammaId(), guidArt.getRationale(), + ModificationType.NEW); + + } + } else if (eventType == RelationEventType.Deleted || eventType == RelationEventType.Purged) { + RelationLink relation = + RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(), + guidArt.getArtBId(), branch, branch); + if (relation != null) { + relation.internalRemoteEventDelete(); + } + } else if (eventType == RelationEventType.ModifiedRationale) { + RelationLink relation = + RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(), + guidArt.getArtBId(), branch, branch); + if (relation != null) { + relation.internalSetRationale(guidArt.getRationale()); + relation.setNotDirty(); + } + } else if (eventType == RelationEventType.Undeleted) { + RelationLink relation = + RelationManager.getLoadedRelationById(guidArt.getRelationId(), guidArt.getArtAId(), + guidArt.getArtBId(), branch, branch); + if (relation != null) { + relation.undelete(); + relation.setNotDirty(); + } + } else { + EventUtil.eventLog(String.format("REM2: updateRelations - Unhandled mod type [%s]", eventType)); + } + } + } catch (OseeCoreException ex) { + EventUtil.eventLog("REM2: updateRelations", ex); + } + } + } + + private void updateDeletedArtifact(DefaultBasicGuidArtifact guidArt) { + try { + Artifact artifact = ArtifactCache.getActive(guidArt); + if (artifact == null) { + // do nothing, artifact not in cache, so don't need to update + } else if (!artifact.isHistorical()) { + artifact.internalSetDeletedFromRemoteEvent(); + } + } catch (OseeCoreException ex) { + EventUtil.eventLog("REM2: updateDeletedArtifact", ex); + } + } + + private void updateModifiedArtifact(EventModifiedBasicGuidArtifact guidArt) { + try { + Artifact artifact = ArtifactCache.getActive(guidArt); + if (artifact == null) { + // do nothing, artifact not in cache, so don't need to update + } else if (!artifact.isHistorical()) { + for (AttributeChange attrChange : guidArt.getAttributeChanges()) { + if (!OseeEventManager.getPreferences().isEnableRemoteEventLoopback()) { + ModificationType modificationType = + AttributeEventModificationType.getType(attrChange.getModTypeGuid()).getModificationType(); + AttributeType attributeType = AttributeTypeManager.getTypeByGuid(attrChange.getAttrTypeGuid()); + try { + Attribute<?> attribute = artifact.getAttributeById(attrChange.getAttributeId(), true); + // Attribute already exists (but may be deleted), process update + // Process MODIFIED / DELETED attribute + if (attribute != null) { + if (attribute.isDirty()) { + EventUtil.eventLog(String.format("%s's attribute %d [/n%s/n] has been overwritten.", + artifact.getSafeName(), attribute.getId(), attribute.toString())); + } + try { + if (modificationType == null) { + EventUtil.eventLog(String.format( + "REM2: updateModifiedArtifact - Can't get mod type for %s's attribute %d.", + artifact.getArtifactTypeName(), attrChange.getAttributeId())); + continue; + } + if (modificationType.isDeleted()) { + attribute.internalSetModificationType(modificationType); + } else { + attribute.getAttributeDataProvider().loadData( + attrChange.getData().toArray(new Object[attrChange.getData().size()])); + } + attribute.internalSetGammaId(attrChange.getGammaId()); + attribute.setNotDirty(); + } catch (OseeCoreException ex) { + EventUtil.eventLog( + String.format("REM2: Exception updating %s's attribute %d [/n%s/n].", + artifact.getSafeName(), attribute.getId(), attribute.toString()), ex); + } + } + // Otherwise, attribute needs creation + // Process NEW attribute + else { + if (modificationType == null) { + EventUtil.eventLog(String.format("REM2: Can't get mod type for %s's attribute %d.", + artifact.getArtifactTypeName(), attrChange.getAttributeId())); + continue; + } + artifact.internalInitializeAttribute(attributeType, attrChange.getAttributeId(), + attrChange.getGammaId(), modificationType, false, + attrChange.getData().toArray(new Object[attrChange.getData().size()])); + } + } catch (OseeCoreException ex) { + EventUtil.eventLog(String.format( + "REM2: Exception updating %s's attribute change for attributeTypeId %d.", + artifact.getSafeName(), attributeType.getId()), ex); + } + } + } + } + } catch (OseeCoreException ex) { + EventUtil.eventLog("REM2: updateModifiedArtifact", ex); + } + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/JiniSkynetEventServiceLookup.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/JiniSkynetEventServiceLookup.java index e3bca76dfee..8619d24566d 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/JiniSkynetEventServiceLookup.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/JiniSkynetEventServiceLookup.java @@ -1,208 +1,208 @@ -/*******************************************************************************
- * 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.skynet.core.event.systems;
-
-import java.rmi.RemoteException;
-import java.rmi.server.ExportException;
-import java.util.logging.Level;
-import net.jini.core.entry.Entry;
-import net.jini.core.lookup.ServiceItem;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jini.discovery.EclipseJiniClassloader;
-import org.eclipse.osee.framework.jini.discovery.IServiceLookupListener;
-import org.eclipse.osee.framework.jini.discovery.ServiceDataStore;
-import org.eclipse.osee.framework.jini.service.core.SimpleFormattedEntry;
-import org.eclipse.osee.framework.jini.util.OseeJini;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventListener;
-import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventService;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.event.EventSystemPreferences;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.RemoteEventServiceEventType;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-
-/**
- * @author Donald G. Dunne
- */
-public final class JiniSkynetEventServiceLookup implements IServiceLookupListener {
-
- private final ISkynetEventListener clientEventListener;
- private String acceptableServiceName;
- private ISkynetEventService currentEventService;
- private ISkynetEventListener clientEventListenerRemoteReference;
- private final EventSystemPreferences preferences;
-
- public JiniSkynetEventServiceLookup(EventSystemPreferences preferences, ISkynetEventListener clientEventListener) {
- this.preferences = preferences;
- this.clientEventListener = clientEventListener;
- clear();
- }
-
- private void clear() {
- currentEventService = null;
- clientEventListenerRemoteReference = null;
- acceptableServiceName = null;
- }
-
- public void start() {
- getClientEventListenerRemoteReference();
- }
-
- public void stop() {
- if (clientEventListenerRemoteReference != null) {
- ServiceDataStore.getEclipseInstance(EclipseJiniClassloader.getInstance()).removeListener(this);
- }
- reset();
- }
-
- public ISkynetEventListener getClientEventListenerRemoteReference() {
- checkJiniRegistration();
- return clientEventListenerRemoteReference;
- }
-
- public void checkJiniRegistration() {
- if (preferences.isNewEvents()) {
- return;
- }
- if (clientEventListenerRemoteReference == null) {
- try {
- // We need to trigger authentication before attempting to get database information from client session manager.
- UserManager.getUser();
- acceptableServiceName =
- ClientSessionManager.getDataStoreName() + ":" + ClientSessionManager.getDataStoreLoginName();
- clientEventListenerRemoteReference =
- (ISkynetEventListener) OseeJini.getRemoteReference(clientEventListener);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- clientEventListenerRemoteReference = null;
- }
-
- if (clientEventListenerRemoteReference != null) {
- ServiceDataStore.getEclipseInstance(EclipseJiniClassloader.getInstance()).addListener(this,
- ISkynetEventService.class);
- }
- }
- }
-
- private ISkynetEventService getReference() {
- return currentEventService;
- }
-
- public boolean isValid() {
- return isValidService(currentEventService);
- }
-
- public void reset() {
- setEventService(null);
- }
-
- public void kick(ISkynetEvent[] events, ISkynetEventListener... except) {
- try {
- getReference().kick(events, except);
- } catch (ExportException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- } catch (RemoteException ex) {
- disconnectService(ex);
- }
- }
-
- private boolean isValidService(ISkynetEventService service) {
- boolean result = false;
- try {
- if (service != null) {
- result = service.isAlive();
- }
- } catch (Exception ex) {
- // Do Nothing
- result = false;
- }
- return result;
- }
-
- private synchronized void setEventService(ISkynetEventService service) {
- if (isValidService(currentEventService)) {
- try {
- currentEventService.deregister(getClientEventListenerRemoteReference());
- } catch (RemoteException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- currentEventService = service;
- }
-
- private void disconnectService(Exception e) {
- if (preferences.isNewEvents()) {
- return;
- }
- OseeLog.log(Activator.class, Level.WARNING, "Skynet Event Service connection lost\n" + e.toString(), e);
- setEventService(null);
- try {
- OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem1_DisConnected);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
-
- private void connectToService(ISkynetEventService service) {
- if (preferences.isNewEvents()) {
- return;
- }
- try {
- ISkynetEventListener clientListener = getClientEventListenerRemoteReference();
- if (clientListener != null) {
- service.register(clientListener);
- setEventService(service);
- OseeLog.log(Activator.class, Level.INFO,
- "Skynet Event Service connection established " + acceptableServiceName);
- OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem1_Connected);
- } else {
- OseeLog.log(Activator.class, Level.SEVERE, "Client listener reference was null");
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public void serviceAdded(ServiceItem serviceItem) {
- if (preferences.isNewEvents()) {
- return;
- }
- if (serviceItem.service instanceof ISkynetEventService) {
- ISkynetEventService service = (ISkynetEventService) serviceItem.service;
- if (isValidService(service)) {
- // Check if the service is for the database we are using
- for (Entry entry : serviceItem.attributeSets) {
- if (entry instanceof SimpleFormattedEntry) {
- SimpleFormattedEntry simpleEntry = (SimpleFormattedEntry) entry;
- if ("db".equals(simpleEntry.name) && acceptableServiceName.equals(simpleEntry.value)) {
- connectToService(service);
- break;
- }
- }
- }
- }
- }
- }
-
- @Override
- public void serviceChanged(ServiceItem serviceItem) {
- serviceAdded(serviceItem);
- }
-
- @Override
- public void serviceRemoved(ServiceItem serviceItem) {
- // do nothing
- }
+/******************************************************************************* + * 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.skynet.core.event.systems; + +import java.rmi.RemoteException; +import java.rmi.server.ExportException; +import java.util.logging.Level; +import net.jini.core.entry.Entry; +import net.jini.core.lookup.ServiceItem; +import org.eclipse.osee.framework.core.client.ClientSessionManager; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jini.discovery.EclipseJiniClassloader; +import org.eclipse.osee.framework.jini.discovery.IServiceLookupListener; +import org.eclipse.osee.framework.jini.discovery.ServiceDataStore; +import org.eclipse.osee.framework.jini.service.core.SimpleFormattedEntry; +import org.eclipse.osee.framework.jini.util.OseeJini; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventListener; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEventService; +import org.eclipse.osee.framework.skynet.core.UserManager; +import org.eclipse.osee.framework.skynet.core.event.EventSystemPreferences; +import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; +import org.eclipse.osee.framework.skynet.core.event.RemoteEventServiceEventType; +import org.eclipse.osee.framework.skynet.core.internal.Activator; + +/** + * @author Donald G. Dunne + */ +public final class JiniSkynetEventServiceLookup implements IServiceLookupListener { + + private final ISkynetEventListener clientEventListener; + private String acceptableServiceName; + private ISkynetEventService currentEventService; + private ISkynetEventListener clientEventListenerRemoteReference; + private final EventSystemPreferences preferences; + + public JiniSkynetEventServiceLookup(EventSystemPreferences preferences, ISkynetEventListener clientEventListener) { + this.preferences = preferences; + this.clientEventListener = clientEventListener; + clear(); + } + + private void clear() { + currentEventService = null; + clientEventListenerRemoteReference = null; + acceptableServiceName = null; + } + + public void start() { + getClientEventListenerRemoteReference(); + } + + public void stop() { + if (clientEventListenerRemoteReference != null) { + ServiceDataStore.getEclipseInstance(EclipseJiniClassloader.getInstance()).removeListener(this); + } + reset(); + } + + public ISkynetEventListener getClientEventListenerRemoteReference() { + checkJiniRegistration(); + return clientEventListenerRemoteReference; + } + + public void checkJiniRegistration() { + if (preferences.isNewEvents()) { + return; + } + if (clientEventListenerRemoteReference == null) { + try { + // We need to trigger authentication before attempting to get database information from client session manager. + UserManager.getUser(); + acceptableServiceName = + ClientSessionManager.getDataStoreName() + ":" + ClientSessionManager.getDataStoreLoginName(); + clientEventListenerRemoteReference = + (ISkynetEventListener) OseeJini.getRemoteReference(clientEventListener); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + clientEventListenerRemoteReference = null; + } + + if (clientEventListenerRemoteReference != null) { + ServiceDataStore.getEclipseInstance(EclipseJiniClassloader.getInstance()).addListener(this, + ISkynetEventService.class); + } + } + } + + private ISkynetEventService getReference() { + return currentEventService; + } + + public boolean isValid() { + return isValidService(currentEventService); + } + + public void reset() { + setEventService(null); + } + + public void kick(ISkynetEvent[] events, ISkynetEventListener... except) { + try { + getReference().kick(events, except); + } catch (ExportException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } catch (RemoteException ex) { + disconnectService(ex); + } + } + + private boolean isValidService(ISkynetEventService service) { + boolean result = false; + try { + if (service != null) { + result = service.isAlive(); + } + } catch (Exception ex) { + // Do Nothing + result = false; + } + return result; + } + + private synchronized void setEventService(ISkynetEventService service) { + if (isValidService(currentEventService)) { + try { + currentEventService.deregister(getClientEventListenerRemoteReference()); + } catch (RemoteException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + currentEventService = service; + } + + private void disconnectService(Exception e) { + if (preferences.isNewEvents()) { + return; + } + OseeLog.log(Activator.class, Level.WARNING, "Skynet Event Service connection lost\n" + e.toString(), e); + setEventService(null); + try { + OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem1_DisConnected); + } catch (OseeCoreException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + + private void connectToService(ISkynetEventService service) { + if (preferences.isNewEvents()) { + return; + } + try { + ISkynetEventListener clientListener = getClientEventListenerRemoteReference(); + if (clientListener != null) { + service.register(clientListener); + setEventService(service); + OseeLog.log(Activator.class, Level.INFO, + "Skynet Event Service connection established " + acceptableServiceName); + OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem1_Connected); + } else { + OseeLog.log(Activator.class, Level.SEVERE, "Client listener reference was null"); + } + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + + @Override + public void serviceAdded(ServiceItem serviceItem) { + if (preferences.isNewEvents()) { + return; + } + if (serviceItem.service instanceof ISkynetEventService) { + ISkynetEventService service = (ISkynetEventService) serviceItem.service; + if (isValidService(service)) { + // Check if the service is for the database we are using + for (Entry entry : serviceItem.attributeSets) { + if (entry instanceof SimpleFormattedEntry) { + SimpleFormattedEntry simpleEntry = (SimpleFormattedEntry) entry; + if ("db".equals(simpleEntry.name) && acceptableServiceName.equals(simpleEntry.value)) { + connectToService(service); + break; + } + } + } + } + } + } + + @Override + public void serviceChanged(ServiceItem serviceItem) { + serviceAdded(serviceItem); + } + + @Override + public void serviceRemoved(ServiceItem serviceItem) { + // do nothing + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/LegacyRemoteEventReceiver.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/LegacyRemoteEventReceiver.java index fef0f35c4bf..0ad8368c1f4 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/LegacyRemoteEventReceiver.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/LegacyRemoteEventReceiver.java @@ -1,476 +1,475 @@ -/*******************************************************************************
- * 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.skynet.core.event.systems;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.type.RelationType;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.event.skynet.ASkynetEventListener;
-import org.eclipse.osee.framework.messaging.event.skynet.ISkynetArtifactEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.ISkynetRelationLinkEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkAccessControlArtifactsEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactChangeTypeEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactDeletedEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactModifiedEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactPurgeEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkBroadcastEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkCommitBranchEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkDeletedBranchEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkNewBranchEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkPurgeBranchEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRelationLinkCreatedEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRelationLinkDeletedEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRelationLinkRationalModifiedEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRenameBranchEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkTransactionDeletedEvent;
-import org.eclipse.osee.framework.messaging.event.skynet.event.SkynetAttributeChange;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType;
-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.AttributeTypeManager;
-import org.eclipse.osee.framework.skynet.core.event.AccessControlEventType;
-import org.eclipse.osee.framework.skynet.core.event.ArtifactTransactionModifiedEvent;
-import org.eclipse.osee.framework.skynet.core.event.BranchEventType;
-import org.eclipse.osee.framework.skynet.core.event.BroadcastEventType;
-import org.eclipse.osee.framework.skynet.core.event.EventUtil;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event2.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-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.RelationManager;
-import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
-import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
-import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts;
-import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact;
-import org.eclipse.osee.framework.ui.plugin.event.UnloadedRelation;
-
-/**
- * @author Donald G. Dunne
- */
-public final class LegacyRemoteEventReceiver extends ASkynetEventListener {
- private static final long serialVersionUID = -3017349745450262540L;
-
- private static final ISchedulingRule mutexRule = new ISchedulingRule() {
-
- @Override
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- @Override
- public boolean isConflicting(ISchedulingRule rule) {
- return rule == this;
- }
- };
-
- private LegacyEventManager legacyEventManager;
-
- public LegacyRemoteEventReceiver() {
- super();
- }
-
- public void setInternalEventManager(LegacyEventManager legacyEventManager) {
- this.legacyEventManager = legacyEventManager;
- }
-
- @Override
- public void onEvent(final ISkynetEvent[] events) {
- final List<ArtifactTransactionModifiedEvent> xModifiedEvents = new LinkedList<ArtifactTransactionModifiedEvent>();
- Job job = new Job("Receive Event") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- Sender lastArtifactRelationModChangeSender = null;
-
- for (ISkynetEvent event : events) {
-
- Sender sender = new Sender(event.getNetworkSender());
- // If the sender's sessionId is the same as this client, then this event was
- // created in this client and returned by remote event manager; ignore and continue
- if (sender.isLocal()) {
- continue;
- }
-
- if (event instanceof NetworkAccessControlArtifactsEvent) {
- try {
- AccessControlEvent accessControlEvent = new AccessControlEvent();
- AccessControlEventType accessControlModType =
- AccessControlEventType.valueOf(((NetworkAccessControlArtifactsEvent) event).getAccessControlModTypeName());
- accessControlEvent.setEventType(accessControlModType);
- NetworkAccessControlArtifactsEvent accessEvent = (NetworkAccessControlArtifactsEvent) event;
- Integer[] artIds =
- accessEvent.getArtifactIds().toArray(new Integer[accessEvent.getArtifactIds().size()]);
- Branch branch = BranchManager.getBranch(accessEvent.getId());
- for (int x = 0; x < accessEvent.getArtifactIds().size(); x++) {
- Artifact cachedArt = ArtifactQuery.getArtifactFromId(artIds[x], branch);
- if (cachedArt != null) {
- accessControlEvent.getArtifacts().add(cachedArt.getBasicGuidArtifact());
- }
- }
- LoadedArtifacts loadedArtifacts =
- new LoadedArtifacts(accessEvent.getId(), accessEvent.getArtifactIds(),
- accessEvent.getArtifactTypeIds());
- OseeEventManager.kickAccessControlArtifactsEvent(sender, accessControlEvent, loadedArtifacts);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkRenameBranchEvent) {
- int branchId = ((NetworkRenameBranchEvent) event).getId();
- try {
- Branch branch = BranchManager.getBranch(branchId);
- branch.setName(((NetworkRenameBranchEvent) event).getBranchName());
- branch.clearDirty();
- try {
- legacyEventManager.kickBranchEvent(sender, BranchEventType.Renamed, branchId);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkNewBranchEvent) {
- int branchId = ((NetworkNewBranchEvent) event).getId();
- try {
- legacyEventManager.kickBranchEvent(sender, BranchEventType.Added, branchId);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkDeletedBranchEvent) {
- int branchId = ((NetworkDeletedBranchEvent) event).getId();
- try {
- Branch branch =
- Activator.getInstance().getOseeCacheService().getBranchCache().getById(branchId);
- if (branch != null) {
- branch.setBranchState(BranchState.DELETED);
- branch.clearDirty();
- }
- legacyEventManager.kickBranchEvent(sender, BranchEventType.Deleted, branchId);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkPurgeBranchEvent) {
- int branchId = ((NetworkPurgeBranchEvent) event).getId();
- try {
- BranchCache cache = Activator.getInstance().getOseeCacheService().getBranchCache();
- Branch branch = cache.getById(branchId);
- if (branch != null) {
- cache.decache(branch);
- }
- legacyEventManager.kickBranchEvent(sender, BranchEventType.Purged, branchId);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkCommitBranchEvent) {
- int branchId = ((NetworkCommitBranchEvent) event).getId();
- try {
- try {
- TransactionManager.clearCommitArtifactCacheForAssociatedArtifact(BranchManager.getAssociatedArtifact(BranchManager.getBranch(branchId)));
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- legacyEventManager.kickBranchEvent(sender, BranchEventType.Committed, branchId);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkBroadcastEvent) {
- try {
- final BroadcastEventType broadcastEventType =
- BroadcastEventType.valueOf(((NetworkBroadcastEvent) event).getBroadcastEventTypeName());
- if (broadcastEventType == null) {
- OseeLog.log(
- Activator.class,
- Level.SEVERE,
- "Unknown broadcast event type \"" + ((NetworkBroadcastEvent) event).getBroadcastEventTypeName() + "\"",
- new IllegalArgumentException());
- } else {
- legacyEventManager.kickBroadcastEvent(sender, broadcastEventType,
- ((NetworkBroadcastEvent) event).getUserIds(),
- ((NetworkBroadcastEvent) event).getMessage());
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof ISkynetArtifactEvent) {
- try {
- updateArtifacts(sender, (ISkynetArtifactEvent) event, xModifiedEvents);
- lastArtifactRelationModChangeSender = sender;
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof ISkynetRelationLinkEvent) {
- try {
- updateRelations(sender, (ISkynetRelationLinkEvent) event, xModifiedEvents);
- lastArtifactRelationModChangeSender = sender;
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkArtifactChangeTypeEvent) {
- try {
- LoadedArtifacts loadedArtifacts =
- new LoadedArtifacts(((NetworkArtifactChangeTypeEvent) event).getId(),
- ((NetworkArtifactChangeTypeEvent) event).getArtifactIds(),
- ((NetworkArtifactChangeTypeEvent) event).getArtifactTypeIds());
- legacyEventManager.kickArtifactsChangeTypeEvent(sender,
- ((NetworkArtifactChangeTypeEvent) event).getToArtifactTypeId(), loadedArtifacts);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkArtifactPurgeEvent) {
- try {
- LoadedArtifacts loadedArtifacts =
- new LoadedArtifacts(((NetworkArtifactPurgeEvent) event).getId(),
- ((NetworkArtifactPurgeEvent) event).getArtifactIds(),
- ((NetworkArtifactPurgeEvent) event).getArtifactTypeIds());
- for (Artifact artifact : loadedArtifacts.getLoadedArtifacts()) {
- //This is because applications may still have a reference to the artifact
- for (RelationLink link : RelationManager.getRelationsAll(artifact.getArtId(),
- artifact.getBranch().getId(), false)) {
- link.internalRemoteEventDelete();
- }
- ArtifactCache.deCache(artifact);
- artifact.internalSetDeleted();
- }
- legacyEventManager.kickArtifactsPurgedEvent(sender, loadedArtifacts);
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- } else if (event instanceof NetworkTransactionDeletedEvent) {
- try {
- legacyEventManager.kickTransactionsPurgedEvent(sender,
- ((NetworkTransactionDeletedEvent) event).getTransactionIds());
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- }
-
- if (xModifiedEvents.size() > 0) {
- /*
- * Since transaction events are a collection of ArtifactModfied and RelationModified events, create a
- * new Sender based on the last sender for these events.
- */
- Sender transactionSender =
- new Sender("RemoteEventManager", lastArtifactRelationModChangeSender.getOseeSession());
- legacyEventManager.kickPersistEvent(transactionSender, xModifiedEvents);
- }
- } catch (Exception ex) {
- // don't want exceptions poping up; just log and return nicely
- OseeLog.log(Activator.class, Level.SEVERE, "REM Receive Event Exception", ex);
- }
- return Status.OK_STATUS;
- }
-
- };
- job.setSystem(true);
- job.setUser(false);
- job.setRule(mutexRule);
- job.schedule();
- }
-
- /**
- * Updates local cache
- *
- * @param event
- */
- private void updateArtifacts(Sender sender, ISkynetArtifactEvent event, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
- if (event == null) {
- return;
- }
-
- try {
- int artId = event.getArtId();
- int artTypeId = event.getArtTypeId();
- List<String> dirtyAttributeName = new LinkedList<String>();
-
- if (event instanceof NetworkArtifactModifiedEvent) {
- int branchId = ((NetworkArtifactModifiedEvent) event).getId();
- Artifact artifact = ArtifactCache.getActive(artId, branchId);
- if (artifact == null) {
- UnloadedArtifact unloadedArtifact = new UnloadedArtifact(branchId, artId, artTypeId);
- xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Changed, unloadedArtifact));
- } else if (!artifact.isHistorical()) {
- for (SkynetAttributeChange skynetAttributeChange : ((NetworkArtifactModifiedEvent) event).getAttributeChanges()) {
- if (!OseeEventManager.getPreferences().isEnableRemoteEventLoopback()) {
- try {
- Attribute<?> attribute =
- artifact.getAttributeById(skynetAttributeChange.getAttributeId(), true);
- // Attribute already exists (but may be deleted), process update
- // Process MODIFIED / DELETED attribute
- if (attribute != null) {
- if (attribute.isDirty()) {
- dirtyAttributeName.add(attribute.getNameValueDescription());
- EventUtil.eventLog(String.format("%s's attribute %d [/n%s/n] has been overwritten.",
- artifact.getSafeName(), attribute.getId(), attribute.toString()));
- }
- try {
- ModificationType modificationType = skynetAttributeChange.getModificationType();
- if (modificationType == null) {
- OseeLog.log(
- Activator.class,
- Level.SEVERE,
- String.format("MOD1: Can't get mod type for %s's attribute %d.",
- artifact.getArtifactTypeName(), skynetAttributeChange.getAttributeId()));
- continue;
- }
- if (modificationType.isDeleted()) {
- attribute.internalSetModificationType(modificationType);
- } else {
- attribute.getAttributeDataProvider().loadData(skynetAttributeChange.getData());
- }
- attribute.internalSetGammaId(skynetAttributeChange.getGammaId());
- attribute.setNotDirty();
- } catch (OseeCoreException ex) {
- EventUtil.eventLog(String.format("Exception updating %s's attribute %d [/n%s/n].",
- artifact.getSafeName(), attribute.getId(), attribute.toString()), ex);
- }
- }
- // Otherwise, attribute needs creation
- // Process NEW attribute
- else {
- ModificationType modificationType = skynetAttributeChange.getModificationType();
- if (modificationType == null) {
- OseeLog.log(
- Activator.class,
- Level.SEVERE,
- String.format("MOD2: Can't get mod type for %s's attribute %d.",
- artifact.getArtifactTypeName(), skynetAttributeChange.getAttributeId()));
- continue;
- }
- artifact.internalInitializeAttribute(
- AttributeTypeManager.getType(skynetAttributeChange.getTypeId()),
- skynetAttributeChange.getAttributeId(), skynetAttributeChange.getGammaId(),
- modificationType, false, skynetAttributeChange.getData());
- }
- } catch (OseeCoreException ex) {
- EventUtil.eventLog(
- String.format("Exception updating %s's attribute change for attributeTypeId %d.",
- artifact.getSafeName(), skynetAttributeChange.getTypeId()), ex);
- }
- }
- }
-
- xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Changed, artifact,
- ((NetworkArtifactModifiedEvent) event).getTransactionId(),
- ((NetworkArtifactModifiedEvent) event).getAttributeChanges()));
-
- }
- } else if (event instanceof NetworkArtifactDeletedEvent) {
- int branchId = ((NetworkArtifactDeletedEvent) event).getId();
- Artifact artifact = ArtifactCache.getActive(artId, branchId);
- if (artifact == null) {
- UnloadedArtifact unloadedArtifact = new UnloadedArtifact(branchId, artId, artTypeId);
- xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Deleted, unloadedArtifact));
- } else if (!artifact.isHistorical()) {
- internalHandleRemoteArtifactDeleted(artifact);
-
- xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Deleted, artifact,
- ((NetworkArtifactDeletedEvent) event).getTransactionId(), new ArrayList<SkynetAttributeChange>()));
- }
- }
- } catch (OseeCoreException ex) {
- EventUtil.eventLog("Update Artifacts", ex);
- }
- }
-
- private void updateRelations(Sender sender, ISkynetRelationLinkEvent event, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) {
- if (event == null) {
- return;
- }
-
- try {
- RelationType relationType = RelationTypeManager.getType(event.getRelTypeId());
- Branch branch = BranchManager.getBranch(event.getId());
- Artifact aArtifact = ArtifactCache.getActive(event.getArtAId(), branch.getId());
- Artifact bArtifact = ArtifactCache.getActive(event.getArtBId(), branch.getId());
- boolean aArtifactLoaded = aArtifact != null;
- boolean bArtifactLoaded = bArtifact != null;
-
- if (!aArtifactLoaded && !bArtifactLoaded) {
- if (event instanceof NetworkRelationLinkDeletedEvent) {
- UnloadedRelation unloadedRelation =
- new UnloadedRelation(branch.getId(), event.getArtAId(), event.getArtATypeId(), event.getArtBId(),
- event.getArtBTypeId(), event.getRelTypeId());
- xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Deleted, unloadedRelation));
- } else if (event instanceof NetworkRelationLinkRationalModifiedEvent) {
- UnloadedRelation unloadedRelation =
- new UnloadedRelation(branch.getId(), event.getArtAId(), event.getArtATypeId(), event.getArtBId(),
- event.getArtBTypeId(), event.getRelTypeId());
- xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.ModifiedRationale,
- unloadedRelation));
- } else if (event instanceof NetworkRelationLinkCreatedEvent) {
- UnloadedRelation unloadedRelation =
- new UnloadedRelation(branch.getId(), event.getArtAId(), event.getArtATypeId(), event.getArtBId(),
- event.getArtBTypeId(), event.getRelTypeId());
- xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Added, unloadedRelation));
- }
- }
- if (aArtifactLoaded || bArtifactLoaded) {
- if (event instanceof NetworkRelationLinkDeletedEvent) {
- RelationLink relation =
- RelationManager.getLoadedRelationById(event.getRelId(), event.getArtAId(), event.getArtBId(), branch,
- branch);
- if (relation != null) {
- relation.internalRemoteEventDelete();
-
- xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Deleted, relation,
- relation.getBranch(), relation.getRelationType().getName()));
- }
- } else if (event instanceof NetworkRelationLinkCreatedEvent) {
- RelationLink relation =
- RelationManager.getLoadedRelationById(event.getRelId(), event.getArtAId(), event.getArtBId(), branch,
- branch);
-
- if (relation == null || relation.getModificationType() == ModificationType.DELETED) {
- relation =
- RelationLink.getOrCreate(event.getArtAId(), event.getArtBId(), branch, branch, relationType,
- event.getRelId(), event.getGammaId(), ((NetworkRelationLinkCreatedEvent) event).getRationale(),
- ModificationType.NEW);
-
- xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Added, relation,
- relation.getBranch(), relation.getRelationType().getName()));
- }
- }
- }
- } catch (OseeCoreException ex) {
- EventUtil.eventLog("Update Relations", ex);
- }
- }
-
- private void internalHandleRemoteArtifactDeleted(Artifact artifact) throws OseeCoreException {
- if (artifact == null) {
- return;
- } else {
- artifact.internalSetDeletedFromRemoteEvent();
- }
- }
-
-}
+/******************************************************************************* + * 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.skynet.core.event.systems; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.logging.Level; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osee.framework.core.enums.BranchState; +import org.eclipse.osee.framework.core.enums.ModificationType; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.core.model.cache.BranchCache; +import org.eclipse.osee.framework.core.model.type.RelationType; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.event.skynet.ASkynetEventListener; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetArtifactEvent; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetEvent; +import org.eclipse.osee.framework.messaging.event.skynet.ISkynetRelationLinkEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkAccessControlArtifactsEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactChangeTypeEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactDeletedEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactModifiedEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkArtifactPurgeEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkBroadcastEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkCommitBranchEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkDeletedBranchEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkNewBranchEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkPurgeBranchEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRelationLinkCreatedEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRelationLinkDeletedEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRelationLinkRationalModifiedEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkRenameBranchEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.NetworkTransactionDeletedEvent; +import org.eclipse.osee.framework.messaging.event.skynet.event.SkynetAttributeChange; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache; +import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType; +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.AttributeTypeManager; +import org.eclipse.osee.framework.skynet.core.event.AccessControlEventType; +import org.eclipse.osee.framework.skynet.core.event.ArtifactTransactionModifiedEvent; +import org.eclipse.osee.framework.skynet.core.event.BranchEventType; +import org.eclipse.osee.framework.skynet.core.event.BroadcastEventType; +import org.eclipse.osee.framework.skynet.core.event.EventUtil; +import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; +import org.eclipse.osee.framework.skynet.core.event.Sender; +import org.eclipse.osee.framework.skynet.core.event2.AccessControlEvent; +import org.eclipse.osee.framework.skynet.core.internal.Activator; +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.RelationManager; +import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; +import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; +import org.eclipse.osee.framework.skynet.core.utility.LoadedArtifacts; +import org.eclipse.osee.framework.ui.plugin.event.UnloadedArtifact; +import org.eclipse.osee.framework.ui.plugin.event.UnloadedRelation; + +/** + * @author Donald G. Dunne + */ +public final class LegacyRemoteEventReceiver extends ASkynetEventListener { + private static final long serialVersionUID = -3017349745450262540L; + + private static final ISchedulingRule mutexRule = new ISchedulingRule() { + + @Override + public boolean contains(ISchedulingRule rule) { + return rule == this; + } + + @Override + public boolean isConflicting(ISchedulingRule rule) { + return rule == this; + } + }; + + private LegacyEventManager legacyEventManager; + + public LegacyRemoteEventReceiver() { + super(); + } + + public void setInternalEventManager(LegacyEventManager legacyEventManager) { + this.legacyEventManager = legacyEventManager; + } + + @Override + public void onEvent(final ISkynetEvent[] events) { + final List<ArtifactTransactionModifiedEvent> xModifiedEvents = new LinkedList<ArtifactTransactionModifiedEvent>(); + Job job = new Job("Receive Event") { + + @Override + protected IStatus run(IProgressMonitor monitor) { + try { + Sender lastArtifactRelationModChangeSender = null; + + for (ISkynetEvent event : events) { + + Sender sender = new Sender(event.getNetworkSender()); + // If the sender's sessionId is the same as this client, then this event was + // created in this client and returned by remote event manager; ignore and continue + if (sender.isLocal()) { + continue; + } + + if (event instanceof NetworkAccessControlArtifactsEvent) { + try { + AccessControlEvent accessControlEvent = new AccessControlEvent(); + AccessControlEventType accessControlModType = + AccessControlEventType.valueOf(((NetworkAccessControlArtifactsEvent) event).getAccessControlModTypeName()); + accessControlEvent.setEventType(accessControlModType); + NetworkAccessControlArtifactsEvent accessEvent = (NetworkAccessControlArtifactsEvent) event; + Integer[] artIds = + accessEvent.getArtifactIds().toArray(new Integer[accessEvent.getArtifactIds().size()]); + Branch branch = BranchManager.getBranch(accessEvent.getId()); + for (int x = 0; x < accessEvent.getArtifactIds().size(); x++) { + Artifact cachedArt = ArtifactQuery.getArtifactFromId(artIds[x], branch); + if (cachedArt != null) { + accessControlEvent.getArtifacts().add(cachedArt.getBasicGuidArtifact()); + } + } + LoadedArtifacts loadedArtifacts = + new LoadedArtifacts(accessEvent.getId(), accessEvent.getArtifactIds(), + accessEvent.getArtifactTypeIds()); + OseeEventManager.kickAccessControlArtifactsEvent(sender, accessControlEvent, loadedArtifacts); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkRenameBranchEvent) { + int branchId = ((NetworkRenameBranchEvent) event).getId(); + try { + Branch branch = BranchManager.getBranch(branchId); + branch.setName(((NetworkRenameBranchEvent) event).getBranchName()); + branch.clearDirty(); + try { + legacyEventManager.kickBranchEvent(sender, BranchEventType.Renamed, branchId); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkNewBranchEvent) { + int branchId = ((NetworkNewBranchEvent) event).getId(); + try { + legacyEventManager.kickBranchEvent(sender, BranchEventType.Added, branchId); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkDeletedBranchEvent) { + int branchId = ((NetworkDeletedBranchEvent) event).getId(); + try { + Branch branch = + Activator.getInstance().getOseeCacheService().getBranchCache().getById(branchId); + if (branch != null) { + branch.setBranchState(BranchState.DELETED); + branch.clearDirty(); + } + legacyEventManager.kickBranchEvent(sender, BranchEventType.Deleted, branchId); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkPurgeBranchEvent) { + int branchId = ((NetworkPurgeBranchEvent) event).getId(); + try { + BranchCache cache = Activator.getInstance().getOseeCacheService().getBranchCache(); + Branch branch = cache.getById(branchId); + if (branch != null) { + cache.decache(branch); + } + legacyEventManager.kickBranchEvent(sender, BranchEventType.Purged, branchId); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkCommitBranchEvent) { + int branchId = ((NetworkCommitBranchEvent) event).getId(); + try { + try { + TransactionManager.clearCommitArtifactCacheForAssociatedArtifact(BranchManager.getAssociatedArtifact(BranchManager.getBranch(branchId))); + } catch (OseeCoreException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + legacyEventManager.kickBranchEvent(sender, BranchEventType.Committed, branchId); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkBroadcastEvent) { + try { + final BroadcastEventType broadcastEventType = + BroadcastEventType.valueOf(((NetworkBroadcastEvent) event).getBroadcastEventTypeName()); + if (broadcastEventType == null) { + OseeLog.log( + Activator.class, + Level.SEVERE, + "Unknown broadcast event type \"" + ((NetworkBroadcastEvent) event).getBroadcastEventTypeName() + "\"", + new IllegalArgumentException()); + } else { + legacyEventManager.kickBroadcastEvent(sender, broadcastEventType, + ((NetworkBroadcastEvent) event).getUserIds(), + ((NetworkBroadcastEvent) event).getMessage()); + } + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof ISkynetArtifactEvent) { + try { + updateArtifacts(sender, (ISkynetArtifactEvent) event, xModifiedEvents); + lastArtifactRelationModChangeSender = sender; + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof ISkynetRelationLinkEvent) { + try { + updateRelations(sender, (ISkynetRelationLinkEvent) event, xModifiedEvents); + lastArtifactRelationModChangeSender = sender; + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkArtifactChangeTypeEvent) { + try { + LoadedArtifacts loadedArtifacts = + new LoadedArtifacts(((NetworkArtifactChangeTypeEvent) event).getId(), + ((NetworkArtifactChangeTypeEvent) event).getArtifactIds(), + ((NetworkArtifactChangeTypeEvent) event).getArtifactTypeIds()); + legacyEventManager.kickArtifactsChangeTypeEvent(sender, + ((NetworkArtifactChangeTypeEvent) event).getToArtifactTypeId(), loadedArtifacts); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkArtifactPurgeEvent) { + try { + LoadedArtifacts loadedArtifacts = + new LoadedArtifacts(((NetworkArtifactPurgeEvent) event).getId(), + ((NetworkArtifactPurgeEvent) event).getArtifactIds(), + ((NetworkArtifactPurgeEvent) event).getArtifactTypeIds()); + for (Artifact artifact : loadedArtifacts.getLoadedArtifacts()) { + //This is because applications may still have a reference to the artifact + for (RelationLink link : RelationManager.getRelationsAll(artifact.getArtId(), + artifact.getBranch().getId(), false)) { + link.internalRemoteEventDelete(); + } + ArtifactCache.deCache(artifact); + artifact.internalSetDeleted(); + } + legacyEventManager.kickArtifactsPurgedEvent(sender, loadedArtifacts); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } else if (event instanceof NetworkTransactionDeletedEvent) { + try { + legacyEventManager.kickTransactionsPurgedEvent(sender, + ((NetworkTransactionDeletedEvent) event).getTransactionIds()); + } catch (Exception ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + } + + if (xModifiedEvents.size() > 0) { + /* + * Since transaction events are a collection of ArtifactModfied and RelationModified events, create a + * new Sender based on the last sender for these events. + */ + Sender transactionSender = + new Sender("RemoteEventManager", lastArtifactRelationModChangeSender.getOseeSession()); + legacyEventManager.kickPersistEvent(transactionSender, xModifiedEvents); + } + } catch (Exception ex) { + // don't want exceptions poping up; just log and return nicely + OseeLog.log(Activator.class, Level.SEVERE, "REM Receive Event Exception", ex); + } + return Status.OK_STATUS; + } + + }; + job.setSystem(true); + job.setUser(false); + job.setRule(mutexRule); + job.schedule(); + } + + /** + * Updates local cache + * + */ + private void updateArtifacts(Sender sender, ISkynetArtifactEvent event, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) { + if (event == null) { + return; + } + + try { + int artId = event.getArtId(); + int artTypeId = event.getArtTypeId(); + List<String> dirtyAttributeName = new LinkedList<String>(); + + if (event instanceof NetworkArtifactModifiedEvent) { + int branchId = ((NetworkArtifactModifiedEvent) event).getId(); + Artifact artifact = ArtifactCache.getActive(artId, branchId); + if (artifact == null) { + UnloadedArtifact unloadedArtifact = new UnloadedArtifact(branchId, artId, artTypeId); + xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Changed, unloadedArtifact)); + } else if (!artifact.isHistorical()) { + for (SkynetAttributeChange skynetAttributeChange : ((NetworkArtifactModifiedEvent) event).getAttributeChanges()) { + if (!OseeEventManager.getPreferences().isEnableRemoteEventLoopback()) { + try { + Attribute<?> attribute = + artifact.getAttributeById(skynetAttributeChange.getAttributeId(), true); + // Attribute already exists (but may be deleted), process update + // Process MODIFIED / DELETED attribute + if (attribute != null) { + if (attribute.isDirty()) { + dirtyAttributeName.add(attribute.getNameValueDescription()); + EventUtil.eventLog(String.format("%s's attribute %d [/n%s/n] has been overwritten.", + artifact.getSafeName(), attribute.getId(), attribute.toString())); + } + try { + ModificationType modificationType = skynetAttributeChange.getModificationType(); + if (modificationType == null) { + OseeLog.log( + Activator.class, + Level.SEVERE, + String.format("MOD1: Can't get mod type for %s's attribute %d.", + artifact.getArtifactTypeName(), skynetAttributeChange.getAttributeId())); + continue; + } + if (modificationType.isDeleted()) { + attribute.internalSetModificationType(modificationType); + } else { + attribute.getAttributeDataProvider().loadData(skynetAttributeChange.getData()); + } + attribute.internalSetGammaId(skynetAttributeChange.getGammaId()); + attribute.setNotDirty(); + } catch (OseeCoreException ex) { + EventUtil.eventLog(String.format("Exception updating %s's attribute %d [/n%s/n].", + artifact.getSafeName(), attribute.getId(), attribute.toString()), ex); + } + } + // Otherwise, attribute needs creation + // Process NEW attribute + else { + ModificationType modificationType = skynetAttributeChange.getModificationType(); + if (modificationType == null) { + OseeLog.log( + Activator.class, + Level.SEVERE, + String.format("MOD2: Can't get mod type for %s's attribute %d.", + artifact.getArtifactTypeName(), skynetAttributeChange.getAttributeId())); + continue; + } + artifact.internalInitializeAttribute( + AttributeTypeManager.getType(skynetAttributeChange.getTypeId()), + skynetAttributeChange.getAttributeId(), skynetAttributeChange.getGammaId(), + modificationType, false, skynetAttributeChange.getData()); + } + } catch (OseeCoreException ex) { + EventUtil.eventLog( + String.format("Exception updating %s's attribute change for attributeTypeId %d.", + artifact.getSafeName(), skynetAttributeChange.getTypeId()), ex); + } + } + } + + xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Changed, artifact, + ((NetworkArtifactModifiedEvent) event).getTransactionId(), + ((NetworkArtifactModifiedEvent) event).getAttributeChanges())); + + } + } else if (event instanceof NetworkArtifactDeletedEvent) { + int branchId = ((NetworkArtifactDeletedEvent) event).getId(); + Artifact artifact = ArtifactCache.getActive(artId, branchId); + if (artifact == null) { + UnloadedArtifact unloadedArtifact = new UnloadedArtifact(branchId, artId, artTypeId); + xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Deleted, unloadedArtifact)); + } else if (!artifact.isHistorical()) { + internalHandleRemoteArtifactDeleted(artifact); + + xModifiedEvents.add(new ArtifactModifiedEvent(sender, ArtifactModType.Deleted, artifact, + ((NetworkArtifactDeletedEvent) event).getTransactionId(), new ArrayList<SkynetAttributeChange>())); + } + } + } catch (OseeCoreException ex) { + EventUtil.eventLog("Update Artifacts", ex); + } + } + + private void updateRelations(Sender sender, ISkynetRelationLinkEvent event, Collection<ArtifactTransactionModifiedEvent> xModifiedEvents) { + if (event == null) { + return; + } + + try { + RelationType relationType = RelationTypeManager.getType(event.getRelTypeId()); + Branch branch = BranchManager.getBranch(event.getId()); + Artifact aArtifact = ArtifactCache.getActive(event.getArtAId(), branch.getId()); + Artifact bArtifact = ArtifactCache.getActive(event.getArtBId(), branch.getId()); + boolean aArtifactLoaded = aArtifact != null; + boolean bArtifactLoaded = bArtifact != null; + + if (!aArtifactLoaded && !bArtifactLoaded) { + if (event instanceof NetworkRelationLinkDeletedEvent) { + UnloadedRelation unloadedRelation = + new UnloadedRelation(branch.getId(), event.getArtAId(), event.getArtATypeId(), event.getArtBId(), + event.getArtBTypeId(), event.getRelTypeId()); + xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Deleted, unloadedRelation)); + } else if (event instanceof NetworkRelationLinkRationalModifiedEvent) { + UnloadedRelation unloadedRelation = + new UnloadedRelation(branch.getId(), event.getArtAId(), event.getArtATypeId(), event.getArtBId(), + event.getArtBTypeId(), event.getRelTypeId()); + xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.ModifiedRationale, + unloadedRelation)); + } else if (event instanceof NetworkRelationLinkCreatedEvent) { + UnloadedRelation unloadedRelation = + new UnloadedRelation(branch.getId(), event.getArtAId(), event.getArtATypeId(), event.getArtBId(), + event.getArtBTypeId(), event.getRelTypeId()); + xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Added, unloadedRelation)); + } + } + if (aArtifactLoaded || bArtifactLoaded) { + if (event instanceof NetworkRelationLinkDeletedEvent) { + RelationLink relation = + RelationManager.getLoadedRelationById(event.getRelId(), event.getArtAId(), event.getArtBId(), branch, + branch); + if (relation != null) { + relation.internalRemoteEventDelete(); + + xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Deleted, relation, + relation.getBranch(), relation.getRelationType().getName())); + } + } else if (event instanceof NetworkRelationLinkCreatedEvent) { + RelationLink relation = + RelationManager.getLoadedRelationById(event.getRelId(), event.getArtAId(), event.getArtBId(), branch, + branch); + + if (relation == null || relation.getModificationType() == ModificationType.DELETED) { + relation = + RelationLink.getOrCreate(event.getArtAId(), event.getArtBId(), branch, branch, relationType, + event.getRelId(), event.getGammaId(), ((NetworkRelationLinkCreatedEvent) event).getRationale(), + ModificationType.NEW); + + xModifiedEvents.add(new RelationModifiedEvent(sender, RelationEventType.Added, relation, + relation.getBranch(), relation.getRelationType().getName())); + } + } + } + } catch (OseeCoreException ex) { + EventUtil.eventLog("Update Relations", ex); + } + } + + private void internalHandleRemoteArtifactDeleted(Artifact artifact) throws OseeCoreException { + if (artifact == null) { + return; + } else { + artifact.internalSetDeletedFromRemoteEvent(); + } + } + +} diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/ResMessagingConnectionListener.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/ResMessagingConnectionListener.java index ac504ede2a6..a9c75eb1a7f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/ResMessagingConnectionListener.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/systems/ResMessagingConnectionListener.java @@ -1,63 +1,63 @@ -/*******************************************************************************
- * 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.skynet.core.event.systems;
-
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.messaging.ConnectionListener;
-import org.eclipse.osee.framework.messaging.ConnectionNode;
-import org.eclipse.osee.framework.skynet.core.event.EventSystemPreferences;
-import org.eclipse.osee.framework.skynet.core.event.EventUtil;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.RemoteEventServiceEventType;
-import org.eclipse.osee.framework.skynet.core.event.systems.InternalEventManager2.ConnectionStatus;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-
-/**
- * @author Donald G. Dunne
- */
-public final class ResMessagingConnectionListener implements ConnectionListener, ConnectionStatus {
-
- private final EventSystemPreferences preferences;
- private boolean connectionStatus;
-
- public ResMessagingConnectionListener(EventSystemPreferences preferences) {
- this.preferences = preferences;
- }
-
- @Override
- public void connected(ConnectionNode node) {
- connectionStatus = preferences.isOseeEventBrokerValid();
- try {
- OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem2_Connected);
- OseeLog.log(Activator.class, Level.INFO, "RES2 Connected");
- } catch (OseeCoreException ex) {
- EventUtil.eventLog("REM2: ResConnectionListener", ex);
- }
- }
-
- @Override
- public void notConnected(ConnectionNode node) {
- connectionStatus = false;
- try {
- OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem2_DisConnected);
- OseeLog.log(Activator.class, Level.INFO, "RES2 Dis-Connected");
- } catch (OseeCoreException ex) {
- EventUtil.eventLog("REM2: ResConnectionListener", ex);
- }
- }
-
- @Override
- public boolean isConnected() {
- return connectionStatus;
- }
+/******************************************************************************* + * 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.skynet.core.event.systems; + +import java.util.logging.Level; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.messaging.ConnectionListener; +import org.eclipse.osee.framework.messaging.ConnectionNode; +import org.eclipse.osee.framework.skynet.core.event.EventSystemPreferences; +import org.eclipse.osee.framework.skynet.core.event.EventUtil; +import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; +import org.eclipse.osee.framework.skynet.core.event.RemoteEventServiceEventType; +import org.eclipse.osee.framework.skynet.core.event.systems.InternalEventManager2.ConnectionStatus; +import org.eclipse.osee.framework.skynet.core.internal.Activator; + +/** + * @author Donald G. Dunne + */ +public final class ResMessagingConnectionListener implements ConnectionListener, ConnectionStatus { + + private final EventSystemPreferences preferences; + private boolean connectionStatus; + + public ResMessagingConnectionListener(EventSystemPreferences preferences) { + this.preferences = preferences; + } + + @Override + public void connected(ConnectionNode node) { + connectionStatus = preferences.isOseeEventBrokerValid(); + try { + OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem2_Connected); + OseeLog.log(Activator.class, Level.INFO, "RES2 Connected"); + } catch (OseeCoreException ex) { + EventUtil.eventLog("REM2: ResConnectionListener", ex); + } + } + + @Override + public void notConnected(ConnectionNode node) { + connectionStatus = false; + try { + OseeEventManager.kickLocalRemEvent(this, RemoteEventServiceEventType.Rem2_DisConnected); + OseeLog.log(Activator.class, Level.INFO, "RES2 Dis-Connected"); + } catch (OseeCoreException ex) { + EventUtil.eventLog("REM2: ResConnectionListener", ex); + } + } + + @Override + public boolean isConnected() { + return connectionStatus; + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/AttributeChange.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/AttributeChange.java index d90d4291654..6c7b75866cf 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/AttributeChange.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event2/artifact/AttributeChange.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2010.05.13 at 02:25:18 PM MST +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.05.13 at 02:25:18 PM MST // package org.eclipse.osee.framework.skynet.core.event2.artifact; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumbering.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumbering.java index 844b17f1a01..a2adb724fe2 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumbering.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/ReqNumbering.java @@ -27,7 +27,6 @@ public class ReqNumbering implements Comparable<ReqNumbering> { } /** - * @param numbering * @return returns whether the numbering argument is a child of this number */ public boolean isChild(ReqNumbering numbering) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifact.java index 6ecbc322868..bc7b26e69a1 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/RoughArtifact.java @@ -29,7 +29,7 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; /** * Test: @link RoughArtifactTest - * + * * @author Robert A. Fisher * @author Ryan D. Brooks */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java index a677c60a6fd..626210913c6 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/IArtifactExtractorDelegate.java @@ -21,7 +21,6 @@ public interface IArtifactExtractorDelegate { /** * Determines whether this delegate can operate with the selected parser * - * @param parser * @return whether this delegate is compatible with the parser */ public boolean isApplicable(IArtifactExtractor parser); @@ -50,13 +49,6 @@ public interface IArtifactExtractorDelegate { * and initialize it with data from the content, or to append the content to the last, or a prior created * RoughArtifact. * - * @param forceBody - * @param forcePrimaryType - * @param headerNumber - * @param listIdentifier - * @param paragraphStyle - * @param content - * @param isParagraph * @throws OseeCoreException */ public void processContent(RoughArtifactCollector collector, boolean forceBody, boolean forcePrimaryType, String headerNumber, String listIdentifier, String paragraphStyle, String content, boolean isParagraph) throws OseeCoreException; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolution.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolution.java index 531570a68d1..90825d07cc1 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolution.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/OutlineResolution.java @@ -60,7 +60,7 @@ public final class OutlineResolution { //i.e. last=2.1.1.1 current=2.1.1.1.1 zeroDeltaCounter++; } else if (delta < 0) { - //negative delta, therefore number + //negative delta, therefore number //does not follow pattern //invalidate previous findings. if (currentDigit == 0) { @@ -73,7 +73,7 @@ public final class OutlineResolution { } } - //check for last=2.1.1.1 current=2.1.1.1.1, indented paragraphs + //check for last=2.1.1.1 current=2.1.1.1.1, indented paragraphs if (nextNumberIndex == minLength - 1 && zeroDeltaCounter == minLength && currentOutlineNumberArray.length > lastOutlineNumberArray.length) { if (Strings.isValid(currentOutlineNumberArray[currentOutlineNumberArray.length - 1])) { if (currentOutlineNumberArray[currentOutlineNumberArray.length - 1].compareTo("1") == 0) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java index dfdae300f6c..d6fe25272fb 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractor.java @@ -38,8 +38,14 @@ public class WordOutlineExtractor extends AbstractArtifactExtractor { private static final String TABLE_TAG_WITH_ATTRS = "<w:tbl "; private static final String TABLE_TAG_EMPTY = "<w:tbl/>"; private static final String TABLE_TAG = "<w:tbl>"; - private static final CharSequence[] BODY_TAGS = new CharSequence[] {PARAGRAPH_TAG, PARAGRAPH_TAG_EMPTY, - PARAGRAPH_TAG_WITH_ATTRS, TABLE_TAG, TABLE_TAG_EMPTY, TABLE_TAG_WITH_ATTRS, WordUtil.BODY_END}; + private static final CharSequence[] BODY_TAGS = new CharSequence[] { + PARAGRAPH_TAG, + PARAGRAPH_TAG_EMPTY, + PARAGRAPH_TAG_WITH_ATTRS, + TABLE_TAG, + TABLE_TAG_EMPTY, + TABLE_TAG_WITH_ATTRS, + WordUtil.BODY_END}; // A regex for reading xml elements. Assumes that an element never has a descendant with the same name as itself private static final Pattern internalAttributeElementsPattern = Pattern.compile( diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java index 3d985f5c851..4ed2b972f70 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/WordOutlineExtractorDelegate.java @@ -149,7 +149,7 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate boolean newOutlineNumber = processOutlineNumberAndName(content, outlineNumber, outlineName); - //outline number detection failed, try content + //outline number detection failed, try content if (!newOutlineNumber) { processContentOfParagraph(content, outlineContent); } @@ -197,9 +197,6 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate * Gets content and attempts to extract outline number and title, if it fails with regular regex, it tries * specializedOutlineNumberTitleExtract() * - * @param content - * @param outlineNumber - * @param outlineName * @return * @throws OseeCoreException */ @@ -232,8 +229,6 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate /** * Grabs outline text or content. Stores results in outLineStorage. * - * @param paragraph - * @param outLineStorage */ private void grabNameAndTemplateContent(String paragraph, StringBuilder outLineStorage) { if (outLineStorage.length() == 0) { @@ -251,9 +246,6 @@ public class WordOutlineExtractorDelegate implements IArtifactExtractorDelegate * Specializes in extraction of "1. scope" type of outline number and names. Outline name can also be spread out over * multiple <w:t>s * - * @param paragraph - * @param outlineNumberStorage - * @param outlineTitleStorage * @throws OseeCoreException */ private void specializedOutlineNumberTitleExtract(String paragraph, StringBuilder outlineNumberStorage, StringBuilder outlineTitleStorage) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataSaxHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataSaxHandler.java index cbbf940cabb..026aeab9b1b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataSaxHandler.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/parsers/XmlDataSaxHandler.java @@ -26,9 +26,6 @@ public class XmlDataSaxHandler extends AbstractSaxHandler { private final RoughArtifactCollector collector; private final ArtifactType primaryArtifactType; - /** - * @param branch - */ public XmlDataSaxHandler(RoughArtifactCollector collector, ArtifactType primaryArtifactType) { super(); this.collector = collector; 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/OseeEventSystemServiceRegHandler.java index 60a0d381f8d..f17571e64cf 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/OseeEventSystemServiceRegHandler.java @@ -35,7 +35,8 @@ import org.osgi.framework.BundleContext; */ public class OseeEventSystemServiceRegHandler extends AbstractTrackingHandler { - private static final Class<?>[] DEPENDENCIES = new Class<?>[] {IOseeCachingService.class, + private static final Class<?>[] DEPENDENCIES = new Class<?>[] { + IOseeCachingService.class, IOseeCoreModelEventService.class}; @Override diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/SkynetTransactionAccessServiceHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/SkynetTransactionAccessServiceHandler.java index 464a6bddb49..28be6654ea3 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/SkynetTransactionAccessServiceHandler.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/SkynetTransactionAccessServiceHandler.java @@ -1,65 +1,65 @@ -/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.internal;
-
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.services.IAccessControlService;
-import org.eclipse.osee.framework.core.util.AbstractTrackingHandler;
-import org.eclipse.osee.framework.lifecycle.ILifecycleService;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionAccessHandler;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionCheckPoint;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionHandler;
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class SkynetTransactionAccessServiceHandler extends AbstractTrackingHandler {
-
- private static final Class<?>[] DEPENDENCIES = new Class[] {//
- ILifecycleService.class, //
- IAccessControlService.class,//
- };
-
- private SkynetTransactionHandler handler;
- private ILifecycleService lifecycleService;
-
- @Override
- public Class<?>[] getDependencies() {
- return DEPENDENCIES;
- }
-
- @Override
- public void onActivate(BundleContext context, Map<Class<?>, Object> services) {
- IAccessControlService accessService = getService(IAccessControlService.class, services);
- lifecycleService = getService(ILifecycleService.class, services);
- try {
- handler = new SkynetTransactionAccessHandler(accessService);
- lifecycleService.addHandler(SkynetTransactionCheckPoint.TYPE, handler);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
-
- @Override
- public void onDeActivate() {
- if (handler != null) {
- try {
- lifecycleService.removeHandler(SkynetTransactionCheckPoint.TYPE, handler);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- }
+/******************************************************************************* + * Copyright (c) 2009 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.skynet.core.internal; + +import java.util.Map; +import java.util.logging.Level; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.services.IAccessControlService; +import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; +import org.eclipse.osee.framework.lifecycle.ILifecycleService; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionAccessHandler; +import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionCheckPoint; +import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionHandler; +import org.osgi.framework.BundleContext; + +/** + * @author Roberto E. Escobar + */ +public final class SkynetTransactionAccessServiceHandler extends AbstractTrackingHandler { + + private static final Class<?>[] DEPENDENCIES = new Class[] {// + ILifecycleService.class, // + IAccessControlService.class,// + }; + + private SkynetTransactionHandler handler; + private ILifecycleService lifecycleService; + + @Override + public Class<?>[] getDependencies() { + return DEPENDENCIES; + } + + @Override + public void onActivate(BundleContext context, Map<Class<?>, Object> services) { + IAccessControlService accessService = getService(IAccessControlService.class, services); + lifecycleService = getService(ILifecycleService.class, services); + try { + handler = new SkynetTransactionAccessHandler(accessService); + lifecycleService.addHandler(SkynetTransactionCheckPoint.TYPE, handler); + } catch (OseeCoreException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + + @Override + public void onDeActivate() { + if (handler != null) { + try { + lifecycleService.removeHandler(SkynetTransactionCheckPoint.TYPE, handler); + } catch (OseeCoreException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkBuilder.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkBuilder.java index 3cd20649fc7..0413593419c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkBuilder.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkBuilder.java @@ -63,7 +63,7 @@ public class OseeLinkBuilder { public String getWordMlBookmark(Artifact source) { Random random = new Random(); - int idNumber = getValidNumber(random.nextInt(19580427), random); + getValidNumber(random.nextInt(19580427), random); return String.format(WORDML_BOOKMARK_FORMAT, 0, source.getGuid(), 0); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java index c2b7e85ecfc..84a9781f21c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java @@ -85,7 +85,6 @@ public final class OseeLinkParser { * Process new style requests are of the following format: * http://127.0.0.1:<port>/<ProcessType>?key1=value1&key2=value2...&key3=value3 * - * @param link */ private void parseNewStyleRequests(String link) { String noHostStr = link.replaceFirst("^http:\\/\\/(.*?)\\/", "/"); @@ -104,7 +103,6 @@ public final class OseeLinkParser { * Process old format: http://127.0.0.1:<port>/get/guid/<guid>/<ats,Define> old format should be removed once all * legacy references are change to new format * - * @param entry * @return */ private boolean parseOldSchoolStyleLinks(String link) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java index 64e602020e3..a86d173d31b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java @@ -86,7 +86,6 @@ public class WordMlLinkHandler { * link call. Therefore we expect the input to have links that are recognized by this handler as identified by the * sourceLinkType. * - * @param sourceLinkType * @param source artifact that produced the string content * @param content input * @return processed input @@ -138,7 +137,6 @@ public class WordMlLinkHandler { /** * Find WordML links locations in content grouped by GUID * - * @param content * @return locations where WordMlLinks were found grouped by GUID * @throws OseeWrappedException */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/LinkSideRestriction.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/LinkSideRestriction.java index 1e5f0e71cac..17e4b9d7407 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/LinkSideRestriction.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/LinkSideRestriction.java @@ -18,9 +18,6 @@ public class LinkSideRestriction { private final int sideALinkMax; private final int sideBLinkMax; - /** - * - */ public LinkSideRestriction(int sideALinkMax, int sideBLinkMax) { super(); 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 4772dd6a076..cbf7181a71e 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 @@ -459,8 +459,6 @@ public class RelationManager { } /** - * @param transaction - * @param artifact * @param relationType if not null persists the relations of this type, otherwise persists relations of all types */ public static void persistRelationsFor(SkynetTransaction transaction, Artifact artifact, RelationType relationType) throws OseeCoreException { @@ -561,10 +559,6 @@ public class RelationManager { * Check whether artifactCount number of additional artifacts of type artifactType can be related to the artifact on * side relationSide for relations of type relationType * - * @param relationType - * @param relationSide - * @param artifact - * @param artifactCount * @throws OseeArgumentException */ private static void ensureSideWillSupport(Artifact artifact, RelationType relationType, RelationSide relationSide, int artifactCount) throws OseeCoreException { @@ -635,9 +629,6 @@ public class RelationManager { * This method should only be called for unordered Relation Types. It does not handle reordering relation types that * maintain order. * - * @param artifact - * @param relationType - * @param relationSide * @throws OseeCoreException */ public static void revertRelations(Artifact artifact, RelationType relationType, RelationSide relationSide) throws OseeCoreException { 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 f39dd32d46f..9fc91bc96e8 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 @@ -57,7 +57,6 @@ public class RelationTypeManager { } /** - * @param branch * @return all the relation types that are valid for the given branch * @throws OseeCoreException */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java index 08b7b667677..7181109a5ef 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java @@ -69,8 +69,6 @@ public class ChangeData { /** * Return artifacts of kind and modType. * - * @param kindType - * @param modificationType * @return artifacts * @throws OseeCoreException */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java index c612a5a7de8..fd8d0872008 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeManager.java @@ -63,8 +63,6 @@ public final class ChangeManager { /** * Acquires changes for a particular artifact * - * @param artifact - * @param monitor * @return changes * @throws OseeCoreException */ @@ -75,8 +73,6 @@ public final class ChangeManager { /** * Acquires artifact, relation and attribute changes from a source branch since its creation. * - * @param transactionId - * @param monitor * @return changes * @throws OseeCoreException */ @@ -91,8 +87,6 @@ public final class ChangeManager { /** * Acquires artifact, relation and attribute changes from a source branch since its creation. * - * @param sourceBranch - * @param monitor * @return changes * @throws OseeCoreException */ @@ -116,7 +110,6 @@ public final class ChangeManager { * For the given list of artifacts determine which transactions (on that artifact's branch) affected that artifact. * The branch's baseline transaction is excluded. * - * @param artifacts * @return a map of artifact to collection of TransactionIds which affected the given artifact * @throws OseeCoreException */ @@ -137,7 +130,11 @@ public final class ChangeManager { while (branch.hasParentBranch()) { transactionNumber = branch.getSourceTransaction().getId(); branch = branch.getParentBranch(); - insertParameters.add(new Object[] {queryId, insertTime, artifact.getArtId(), branch.getId(), + insertParameters.add(new Object[] { + queryId, + insertTime, + artifact.getArtId(), + branch.getId(), transactionNumber}); } } @@ -168,7 +165,6 @@ public final class ChangeManager { * For the given list of artifacts determine which branches (in the branch hierarchy for that artifact) affected that * artifact. * - * @param artifacts * @return a map of artifact to collection of branches which affected the given artifact * @throws OseeCoreException */ @@ -184,7 +180,11 @@ public final class ChangeManager { // hierarchy for (Branch workingBranch : BranchManager.getBranches(BranchArchivedState.UNARCHIVED, BranchType.WORKING)) { if (artifact.getBranch().equals(workingBranch.getParentBranch())) { - insertParameters.add(new Object[] {queryId, insertTime, artifact.getArtId(), workingBranch.getId(), + insertParameters.add(new Object[] { + queryId, + insertTime, + artifact.getArtId(), + workingBranch.getId(), SQL3DataType.INTEGER}); } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java index 051a661d5fb..091ec8a71ef 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ConflictManagerInternal.java @@ -178,11 +178,6 @@ public class ConflictManagerInternal { } /** - * @param sourceBranch - * @param destinationBranch - * @param baselineTransaction - * @param conflictBuilders - * @param artIdSet * @throws OseeCoreException */ @@ -237,10 +232,6 @@ public class ConflictManagerInternal { } /** - * @param sourceBranch - * @param destinationBranch - * @param baselineTransaction - * @param conflicts * @throws OseeCoreException */ private static void loadAttributeConflictsNew(Branch sourceBranch, Branch destinationBranch, TransactionRecord baselineTransaction, Collection<ConflictBuilder> conflictBuilders, Set<Integer> artIdSet, IProgressMonitor monitor, TransactionRecord transactionId) throws OseeCoreException { @@ -331,7 +322,11 @@ public class ConflictManagerInternal { List<Object[]> insertParameters = new LinkedList<Object[]>(); for (Conflict conflict : conflicts) { - insertParameters.add(new Object[] {queryId, insertTime, conflict.getObjectId(), branchId, + insertParameters.add(new Object[] { + queryId, + insertTime, + conflict.getObjectId(), + branchId, SQL3DataType.INTEGER}); } ArtifactLoader.insertIntoArtifactJoin(insertParameters); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java index 4e450afb78a..1ec2bc9a2bb 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/RevisionChangeLoader.java @@ -44,8 +44,6 @@ public final class RevisionChangeLoader { } /** - * @param artifact - * @param monitor * @return Returns artifact, relation and attribute changes from a specific artifact * @throws OseeCoreException */ @@ -98,8 +96,6 @@ public final class RevisionChangeLoader { * Not Part of Change Report Acquires artifact, relation and attribute changes from a source branch since its * creation. * - * @param sourceBranch - * @param baselineTransactionId * @return * @throws OseeCoreException */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java index b5c3f1e664a..4b11e4e8cac 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java @@ -162,12 +162,6 @@ public class AttributeChangeAcquirer extends ChangeAcquirer { } /** - * @param sourceBranch - * @param transactionId - * @param artIds - * @param monitor - * @param attributesWasValueCache - * @param hasBranch * @throws OseeCoreException * @throws OseeDataStoreException */ diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java index 424e47f1333..53a1c4917ec 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/StoreSkynetTransactionOperation.java @@ -1,210 +1,210 @@ -/*******************************************************************************
- * 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.skynet.core.transaction;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.eclipse.osee.framework.core.enums.BranchState;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.DatabaseTransactions;
-import org.eclipse.osee.framework.database.core.IDbTransactionWork;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.jdk.core.type.HashCollection;
-import org.eclipse.osee.framework.lifecycle.AbstractLifecycleOperation;
-import org.eclipse.osee.framework.lifecycle.AbstractLifecyclePoint;
-import org.eclipse.osee.framework.lifecycle.ILifecycleService;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.Sender;
-import org.eclipse.osee.framework.skynet.core.event.systems.ArtifactModifiedEvent;
-import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent;
-import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModifiedBasicGuidArtifact;
-import org.eclipse.osee.framework.skynet.core.internal.Activator;
-import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData.InsertDataCollector;
-
-/**
- * @author Roberto E. Escobar
- * @author Ryan D. Brooks
- * @author Jeff C. Phillips
- */
-public final class StoreSkynetTransactionOperation extends AbstractLifecycleOperation implements IDbTransactionWork, InsertDataCollector {
- private static final String UPDATE_TXS_NOT_CURRENT =
- "UPDATE osee_txs txs1 SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " WHERE txs1.transaction_id = ? AND txs1.gamma_id = ?";
-
- private final HashCollection<String, Object[]> dataItemInserts = new HashCollection<String, Object[]>();
- private final Map<Integer, String> dataInsertOrder = new HashMap<Integer, String>();
-
- private final Branch branch;
- private final TransactionRecord transactionRecord;
- private final Collection<BaseTransactionData> txDatas;
- private final Collection<Artifact> artifactReferences;
-
- private boolean executedWithException;
-
- public StoreSkynetTransactionOperation(String name, ILifecycleService service, AbstractLifecyclePoint<?> lifecyclePoint, Branch branch, TransactionRecord transactionRecord, Collection<BaseTransactionData> txDatas, Collection<Artifact> artifactReferences) {
- super(service, lifecyclePoint, name, Activator.PLUGIN_ID);
- this.branch = branch;
- this.transactionRecord = transactionRecord;
- this.txDatas = txDatas;
- this.artifactReferences = artifactReferences;
- }
-
- @Override
- public int getTransactionNumber() {
- return transactionRecord.getId();
- }
-
- @Override
- public int getBranchId() {
- return branch.getId();
- }
-
- @Override
- public void internalAddInsertToBatch(int insertPriority, String insertSql, Object... data) {
- dataItemInserts.put(insertSql, data);
- dataInsertOrder.put(insertPriority, insertSql);
- }
-
- @Override
- protected void doCoreWork(IProgressMonitor monitor) throws Exception {
- DatabaseTransactions.execute(this);
- }
-
- @Override
- public void handleTxWork(OseeConnection connection) throws OseeCoreException {
- executedWithException = false;
- TransactionManager.internalPersist(connection, transactionRecord);
- if (!txDatas.isEmpty()) {
- executeTransactionDataItems(connection);
- }
- if (branch.getBranchState() == BranchState.CREATED) {
- branch.setBranchState(BranchState.MODIFIED);
- BranchManager.persist(branch);
- }
- }
-
- @Override
- public void handleTxException(Exception ex) {
- executedWithException = true;
- for (BaseTransactionData transactionData : txDatas) {
- try {
- transactionData.internalOnRollBack();
- } catch (OseeCoreException ex1) {
- OseeLog.log(Activator.class, Level.SEVERE, ex1);
- }
- }
- }
-
- @Override
- public void handleTxFinally() throws OseeCoreException {
- if (!executedWithException) {
- updateModifiedCachedObject();
- }
- }
-
- private void executeTransactionDataItems(OseeConnection connection) throws OseeCoreException {
- List<Object[]> txNotCurrentData = new ArrayList<Object[]>();
- for (BaseTransactionData transactionData : txDatas) {
- // Collect inserts for attribute, relation, artifact, and artifact version tables
- transactionData.addInsertToBatch(this);
-
- // Collect stale tx currents for batch update
- fetchTxNotCurrent(connection, branch, transactionData, txNotCurrentData);
- }
-
- // Insert into data tables - i.e. attribute, relation and artifact version tables
- List<Integer> keys = new ArrayList<Integer>(dataInsertOrder.keySet());
- Collections.sort(keys);
- for (int priority : keys) {
- String sqlKey = dataInsertOrder.get(priority);
- ConnectionHandler.runBatchUpdate(connection, sqlKey, (List<Object[]>) dataItemInserts.getValues(sqlKey));
- }
-
- // Set stale tx currents in txs table
- ConnectionHandler.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, txNotCurrentData);
- }
-
- private static void fetchTxNotCurrent(OseeConnection connection, Branch branch, BaseTransactionData transactionData, List<Object[]> results) throws OseeCoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement(connection);
- try {
- String query = ClientSessionManager.getSql(transactionData.getSelectTxNotCurrentSql());
-
- chStmt.runPreparedQuery(query, transactionData.getItemId(), branch.getId());
- while (chStmt.next()) {
- results.add(new Object[] {chStmt.getInt("transaction_id"), chStmt.getLong("gamma_id")});
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void updateModifiedCachedObject() throws OseeCoreException {
- ArtifactEvent artifactEvent = new ArtifactEvent(transactionRecord.getBranch());
- artifactEvent.setTransactionId(getTransactionNumber());
-
- // Update all transaction items before collecting events
- for (BaseTransactionData transactionData : txDatas) {
- transactionData.internalUpdate(transactionRecord);
- }
-
- // Collect events before clearing any dirty flags
- for (BaseTransactionData transactionData : txDatas) {
- transactionData.internalAddToEvents(artifactEvent);
- }
-
- // Collect attribute events
- for (Artifact artifact : artifactReferences) {
- if (artifact.hasDirtyAttributes()) {
- artifactEvent.getSkynetTransactionDetails().add(
- new ArtifactModifiedEvent(new Sender(this.getClass().getName()), ArtifactModType.Changed, artifact,
- artifact.getTransactionNumber(), artifact.getDirtySkynetAttributeChanges()));
- EventModifiedBasicGuidArtifact guidArt =
- new EventModifiedBasicGuidArtifact(artifact.getBranch().getGuid(), artifact.getArtifactType().getGuid(),
- artifact.getGuid(), artifact.getDirtyFrameworkAttributeChanges());
- artifactEvent.getArtifacts().add(guidArt);
-
- // Collection relation reorder records for events
- if (!artifact.getRelationOrderRecords().isEmpty()) {
- artifactEvent.getRelationOrderRecords().addAll(artifact.getRelationOrderRecords());
- }
- }
- }
-
- // Clear all dirty flags
- for (BaseTransactionData transactionData : txDatas) {
- transactionData.internalClearDirtyState();
- }
-
- // Clear all relation order records
- for (Artifact artifact : artifactReferences) {
- artifact.getRelationOrderRecords().clear();
- }
-
- if (!artifactEvent.getSkynetTransactionDetails().isEmpty()) {
- OseeEventManager.kickPersistEvent(this, artifactEvent);
- }
- }
-}
+/******************************************************************************* + * 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.skynet.core.transaction; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.client.ClientSessionManager; +import org.eclipse.osee.framework.core.enums.BranchState; +import org.eclipse.osee.framework.core.enums.TxChange; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.database.core.ConnectionHandler; +import org.eclipse.osee.framework.database.core.DatabaseTransactions; +import org.eclipse.osee.framework.database.core.IDbTransactionWork; +import org.eclipse.osee.framework.database.core.IOseeStatement; +import org.eclipse.osee.framework.database.core.OseeConnection; +import org.eclipse.osee.framework.jdk.core.type.HashCollection; +import org.eclipse.osee.framework.lifecycle.AbstractLifecycleOperation; +import org.eclipse.osee.framework.lifecycle.AbstractLifecyclePoint; +import org.eclipse.osee.framework.lifecycle.ILifecycleService; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.artifact.ArtifactModType; +import org.eclipse.osee.framework.skynet.core.artifact.BranchManager; +import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; +import org.eclipse.osee.framework.skynet.core.event.Sender; +import org.eclipse.osee.framework.skynet.core.event.systems.ArtifactModifiedEvent; +import org.eclipse.osee.framework.skynet.core.event2.ArtifactEvent; +import org.eclipse.osee.framework.skynet.core.event2.artifact.EventModifiedBasicGuidArtifact; +import org.eclipse.osee.framework.skynet.core.internal.Activator; +import org.eclipse.osee.framework.skynet.core.transaction.BaseTransactionData.InsertDataCollector; + +/** + * @author Roberto E. Escobar + * @author Ryan D. Brooks + * @author Jeff C. Phillips + */ +public final class StoreSkynetTransactionOperation extends AbstractLifecycleOperation implements IDbTransactionWork, InsertDataCollector { + private static final String UPDATE_TXS_NOT_CURRENT = + "UPDATE osee_txs txs1 SET tx_current = " + TxChange.NOT_CURRENT.getValue() + " WHERE txs1.transaction_id = ? AND txs1.gamma_id = ?"; + + private final HashCollection<String, Object[]> dataItemInserts = new HashCollection<String, Object[]>(); + private final Map<Integer, String> dataInsertOrder = new HashMap<Integer, String>(); + + private final Branch branch; + private final TransactionRecord transactionRecord; + private final Collection<BaseTransactionData> txDatas; + private final Collection<Artifact> artifactReferences; + + private boolean executedWithException; + + public StoreSkynetTransactionOperation(String name, ILifecycleService service, AbstractLifecyclePoint<?> lifecyclePoint, Branch branch, TransactionRecord transactionRecord, Collection<BaseTransactionData> txDatas, Collection<Artifact> artifactReferences) { + super(service, lifecyclePoint, name, Activator.PLUGIN_ID); + this.branch = branch; + this.transactionRecord = transactionRecord; + this.txDatas = txDatas; + this.artifactReferences = artifactReferences; + } + + @Override + public int getTransactionNumber() { + return transactionRecord.getId(); + } + + @Override + public int getBranchId() { + return branch.getId(); + } + + @Override + public void internalAddInsertToBatch(int insertPriority, String insertSql, Object... data) { + dataItemInserts.put(insertSql, data); + dataInsertOrder.put(insertPriority, insertSql); + } + + @Override + protected void doCoreWork(IProgressMonitor monitor) throws Exception { + DatabaseTransactions.execute(this); + } + + @Override + public void handleTxWork(OseeConnection connection) throws OseeCoreException { + executedWithException = false; + TransactionManager.internalPersist(connection, transactionRecord); + if (!txDatas.isEmpty()) { + executeTransactionDataItems(connection); + } + if (branch.getBranchState() == BranchState.CREATED) { + branch.setBranchState(BranchState.MODIFIED); + BranchManager.persist(branch); + } + } + + @Override + public void handleTxException(Exception ex) { + executedWithException = true; + for (BaseTransactionData transactionData : txDatas) { + try { + transactionData.internalOnRollBack(); + } catch (OseeCoreException ex1) { + OseeLog.log(Activator.class, Level.SEVERE, ex1); + } + } + } + + @Override + public void handleTxFinally() throws OseeCoreException { + if (!executedWithException) { + updateModifiedCachedObject(); + } + } + + private void executeTransactionDataItems(OseeConnection connection) throws OseeCoreException { + List<Object[]> txNotCurrentData = new ArrayList<Object[]>(); + for (BaseTransactionData transactionData : txDatas) { + // Collect inserts for attribute, relation, artifact, and artifact version tables + transactionData.addInsertToBatch(this); + + // Collect stale tx currents for batch update + fetchTxNotCurrent(connection, branch, transactionData, txNotCurrentData); + } + + // Insert into data tables - i.e. attribute, relation and artifact version tables + List<Integer> keys = new ArrayList<Integer>(dataInsertOrder.keySet()); + Collections.sort(keys); + for (int priority : keys) { + String sqlKey = dataInsertOrder.get(priority); + ConnectionHandler.runBatchUpdate(connection, sqlKey, (List<Object[]>) dataItemInserts.getValues(sqlKey)); + } + + // Set stale tx currents in txs table + ConnectionHandler.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, txNotCurrentData); + } + + private static void fetchTxNotCurrent(OseeConnection connection, Branch branch, BaseTransactionData transactionData, List<Object[]> results) throws OseeCoreException { + IOseeStatement chStmt = ConnectionHandler.getStatement(connection); + try { + String query = ClientSessionManager.getSql(transactionData.getSelectTxNotCurrentSql()); + + chStmt.runPreparedQuery(query, transactionData.getItemId(), branch.getId()); + while (chStmt.next()) { + results.add(new Object[] {chStmt.getInt("transaction_id"), chStmt.getLong("gamma_id")}); + } + } finally { + chStmt.close(); + } + } + + private void updateModifiedCachedObject() throws OseeCoreException { + ArtifactEvent artifactEvent = new ArtifactEvent(transactionRecord.getBranch()); + artifactEvent.setTransactionId(getTransactionNumber()); + + // Update all transaction items before collecting events + for (BaseTransactionData transactionData : txDatas) { + transactionData.internalUpdate(transactionRecord); + } + + // Collect events before clearing any dirty flags + for (BaseTransactionData transactionData : txDatas) { + transactionData.internalAddToEvents(artifactEvent); + } + + // Collect attribute events + for (Artifact artifact : artifactReferences) { + if (artifact.hasDirtyAttributes()) { + artifactEvent.getSkynetTransactionDetails().add( + new ArtifactModifiedEvent(new Sender(this.getClass().getName()), ArtifactModType.Changed, artifact, + artifact.getTransactionNumber(), artifact.getDirtySkynetAttributeChanges())); + EventModifiedBasicGuidArtifact guidArt = + new EventModifiedBasicGuidArtifact(artifact.getBranch().getGuid(), artifact.getArtifactType().getGuid(), + artifact.getGuid(), artifact.getDirtyFrameworkAttributeChanges()); + artifactEvent.getArtifacts().add(guidArt); + + // Collection relation reorder records for events + if (!artifact.getRelationOrderRecords().isEmpty()) { + artifactEvent.getRelationOrderRecords().addAll(artifact.getRelationOrderRecords()); + } + } + } + + // Clear all dirty flags + for (BaseTransactionData transactionData : txDatas) { + transactionData.internalClearDirtyState(); + } + + // Clear all relation order records + for (Artifact artifact : artifactReferences) { + artifact.getRelationOrderRecords().clear(); + } + + if (!artifactEvent.getSkynetTransactionDetails().isEmpty()) { + OseeEventManager.kickPersistEvent(this, artifactEvent); + } + } +} 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 893fb8150b8..1da6908c15c 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 @@ -153,7 +153,6 @@ public final class TransactionManager { } /** - * @param branch * @return the largest (most recent) transaction on the given branch * @throws OseeCoreException */ @@ -198,7 +197,6 @@ public final class TransactionManager { } /** - * @param transactionId * @return The prior transactionId, or null if there is no prior. * @throws BranchDoesNotExist * @throws TransactionDoesNotExist diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionMonitor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionMonitor.java index 0056b057012..1695d08161b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionMonitor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionMonitor.java @@ -74,7 +74,7 @@ public class TransactionMonitor { throw new OseeStateException( "reportTxEnd called for key: " + key + " but reportTxCreation had not been called."); } else if (currentTx.getState() != TxState.RUNNING) { - // This is a valid case -- can add a log to detect when a reportTxEnd is called before a transaction has a chance to run + // This is a valid case -- can add a log to detect when a reportTxEnd is called before a transaction has a chance to run } if (currentTx.getTransaction().equals(transaction)) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java index 3b94cc1bc2a..6b79584cbb7 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/Artifacts.java @@ -116,10 +116,6 @@ public final class Artifacts { * Recurses default hierarchy and collections children of parentArtifact that are of type class * * @param <A> - * @param parentArtifact - * @param children - * @param clazz - * @param recurse * @throws OseeDataStoreException */ @SuppressWarnings("unchecked") diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CsvArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CsvArtifact.java index 9fbfe8e9d14..ec4fdc5a17b 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CsvArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/CsvArtifact.java @@ -62,10 +62,6 @@ public class CsvArtifact { /** * Creates a new un-persisted CsvArtifact * - * @param staticId - * @param artifactName - * @param csvData - * @param branch * @throws OseeCoreException */ public static CsvArtifact generateCsvArtifact(String staticId, String artifactName, String csvData, IOseeBranch branch) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileChangeEvent.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileChangeEvent.java index 618a7cfb6c7..b8f8422bd21 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileChangeEvent.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileChangeEvent.java @@ -19,10 +19,6 @@ public class FileChangeEvent { private final File file; private final FileChangeType changeType; - /** - * @param file - * @param changeType - */ public FileChangeEvent(File file, FileChangeType changeType) { this.file = file; this.changeType = changeType; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileWatcher.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileWatcher.java index 8238db8f0f6..f68c17c3683 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileWatcher.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/FileWatcher.java @@ -47,7 +47,6 @@ public class FileWatcher extends TimerTask { * adds a {@link File} to the files to be monitored. This method can be called before or after the {@link #start()} * method is called. * - * @param file */ public synchronized void addFile(File file) { filesToWatch.put(file, file.lastModified()); @@ -57,7 +56,6 @@ public class FileWatcher extends TimerTask { * removes a {@link File} from the set of files to be monitored. This method can be called before or after the * {@link #start()} method is called. * - * @param file * @return returns the last know timestamp of the file before it was removed or null if it was never being monitored * in the first place */ @@ -69,7 +67,6 @@ public class FileWatcher extends TimerTask { * registers a listener who will be notified of file change events. This method can be called before or after the * {@link #start()} method is called. * - * @param listener */ public synchronized void addListener(IFileWatcherListener listener) { listeners.add(listener); @@ -79,7 +76,6 @@ public class FileWatcher extends TimerTask { * unregisters a listener from receiving file change events. This method can be called before or after the * {@link #start()} method is called. * - * @param listener */ public synchronized void removeListener(IFileWatcherListener listener) { listeners.remove(listener); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java index 0f9dcf718d0..b076df49942 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/LoadedArtifacts.java @@ -36,9 +36,6 @@ public class LoadedArtifacts { /** * Called when network event passes artifactIds that may or may not be in current client's cache * - * @param branchId - * @param artifactIds - * @param artifactTypeIds */ public LoadedArtifacts(int branchId, Collection<Integer> artifactIds, Collection<Integer> artifactTypeIds) { unloadedArtifacts = new ArrayList<UnloadedArtifact>(); @@ -53,7 +50,6 @@ public class LoadedArtifacts { /** * Called when local event is kicked. Since local, all artifacts are, by definition, cached * - * @param artifacts */ public LoadedArtifacts(Collection<? extends Artifact> artifacts) { this.artifacts = new HashSet<Artifact>(); @@ -64,7 +60,6 @@ public class LoadedArtifacts { /** * Called when local event is kicked. Since local, all artifacts are, by definition, cached * - * @param artifacts */ public LoadedArtifacts(Artifact artifact) { this.artifacts = new HashSet<Artifact>(); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java index e5d37d23924..28a9b5ea0a7 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/validation/OseeValidator.java @@ -104,7 +104,7 @@ public class OseeValidator { // if (loadedObjects.isEmpty()) { // List<IConfigurationElement> elements = ExtensionPoints.getExtensionElements(EXTENSION_ID, EXTENSION_ELEMENT); // for (IConfigurationElement element : elements) { - // // TODO Implement dynamic attribute type validation chain definition + // // TODO Implement dynamic attribute type validation chain definition // // IExtension extension = ((IExtension) element.getParent()); // // String identifier = extension.getUniqueIdentifier(); // String attributeTypeName = element.getAttribute(ATTRIBUTE_TYPENAME); @@ -135,7 +135,7 @@ public class OseeValidator { // } // } - // TODO Implement dynamic attribute type validation chain definition + // TODO Implement dynamic attribute type validation chain definition // public List<IValidator> createValidateChain(String xml) { // List<IValidator> validators = new ArrayList<IValidator>(); // return validators; 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 11d5b2a2964..797f259a635 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 @@ -51,8 +51,17 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; public class WordUtil { public static final String BODY_START = "<w:body>"; public static final String BODY_END = "</w:body>"; - private static final String[] NUMBER = new String[] {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", - "Eight", "Nine"}; + private static final String[] NUMBER = new String[] { + "Zero", + "One", + "Two", + "Three", + "Four", + "Five", + "Six", + "Seven", + "Eight", + "Nine"}; private static final String SELECT_WORD_VALUES = "SELECT attr.content, attr.gamma_id FROM osee_attribute attr, osee_txs txs WHERE attr.art_id=? AND attr.attr_type_id=? AND attr.gamma_id = txs.gamma_id AND txs.branch_id=? ORDER BY attr.gamma_id DESC"; |