summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn F. Cook2011-08-02 16:05:37 (EDT)
committer Ryan D. Brooks2011-08-02 16:05:37 (EDT)
commit670e09d7c26b97fe066357e301eba39aa1cf6b03 (patch)
tree6557430ac6c67c90caa6192e1ac3e280fb53e557
parentd760f7f97c3373160d59c7cf07dd5d25350f4932 (diff)
downloadorg.eclipse.osee-670e09d7c26b97fe066357e301eba39aa1cf6b03.zip
org.eclipse.osee-670e09d7c26b97fe066357e301eba39aa1cf6b03.tar.gz
org.eclipse.osee-670e09d7c26b97fe066357e301eba39aa1cf6b03.tar.bz2
refinement[bgz_350331]: Migrate FindInvalidUTF8Chars to server side command line
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/FindInvalidUTF8CharsOperation.java (renamed from plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FindInvalidUTF8Chars.java)44
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java12
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml3
3 files changed, 33 insertions, 26 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FindInvalidUTF8Chars.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/FindInvalidUTF8CharsOperation.java
index 980e2d9..7e7986e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/FindInvalidUTF8Chars.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/FindInvalidUTF8CharsOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
+ * Copyright (c) 2011 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
@@ -8,29 +8,35 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.blam.operation;
+package org.eclipse.osee.framework.database.operation;
-import java.util.Arrays;
-import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.AbstractDbTxOperation;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
+import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.framework.database.internal.Activator;
/**
* @author Ryan D. Brooks
+ * @author Shawn F. Cook
*/
-public class FindInvalidUTF8Chars extends AbstractBlam {
+public class FindInvalidUTF8CharsOperation extends AbstractDbTxOperation {
private static final String READ_ATTRIBUTE_VALUES = "SELECT art_id, value FROM osee_attribute";
- @Override
- public String getName() {
- return "Find Invalid UTF8 Chars";
+ public FindInvalidUTF8CharsOperation(IOseeDatabaseService databaseService, IOseeCachingService cachingService, OperationLogger logger) {
+ super(databaseService, "Find Invalid UTF8 Chars Operation", Activator.PLUGIN_ID, logger);
}
@Override
- public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception {
+ protected void doTxWork(IProgressMonitor monitor, OseeConnection connection) throws OseeCoreException {
+
+ log();
+ log("Find Invalid UTF8 Chars in Table osee_attribute:");
int count = 0;
IOseeStatement chStmt = ConnectionHandler.getStatement();
@@ -45,24 +51,16 @@ public class FindInvalidUTF8Chars extends AbstractBlam {
char c = value.charAt(i);
// based on http://www.w3.org/TR/2006/REC-xml-20060816/#charsets
if (c < 0x20 && c != 0x9 && c != 0xA && c != 0xD || c > 0xD7FF && c < 0xE000 || c > 0xFFFD && c < 0x10000 || c > 0x10FFFF) {
- System.out.println("artifact id: " + chStmt.getInt("art_id") + " char: " + (int) c);
+ log("artifact id: " + chStmt.getInt("art_id") + " char: " + (int) c);
}
}
}
}
} finally {
chStmt.close();
- System.out.println("count: " + count);
+ log("count: " + count);
}
- }
- @Override
- public String getXWidgetsXml() {
- return AbstractBlam.emptyXWidgetsXml;
- }
-
- @Override
- public Collection<String> getCategories() {
- return Arrays.asList("Admin.Health");
+ log("...done.");
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java
index d414c4b..ceed981 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java
@@ -28,6 +28,7 @@ import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.database.operation.ConsolidateArtifactVersionTxOperation;
import org.eclipse.osee.framework.database.operation.ParseWindowsDirectoryListingOperation;
+import org.eclipse.osee.framework.database.operation.FindInvalidUTF8CharsOperation;
import org.eclipse.osee.framework.database.operation.ConsolidateRelationsTxOperation;
import org.eclipse.osee.framework.database.operation.PurgeUnusedBackingDataAndTransactions;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -170,6 +171,16 @@ public class ServerAdminCommandProvider implements CommandProvider {
return Operations.executeAsJob(operation, false);
}
+ public Job _find_invalid_utf8(CommandInterpreter ci) {
+ OperationLogger logger = new CommandInterpreterLogger(ci);
+
+ IOperation operation =
+ new FindInvalidUTF8CharsOperation(Activator.getOseeDatabaseService(), Activator.getOseeCachingService(),
+ logger);
+
+ return Operations.executeAsJob(operation, false);
+ }
+
@Override
public String getHelp() {
StringBuilder sb = new StringBuilder();
@@ -188,6 +199,7 @@ public class ServerAdminCommandProvider implements CommandProvider {
sb.append(" schedule <delay seconds> <iterations> <command> - runs the command after the specified delay and repeat given number of times\n");
sb.append(" purge_relation_type -force excute the operation, relationType1 ...\n");
sb.append(" parse_dir - converts the given file into a formatted CSV file\n");
+ sb.append(" find_invalid_utf8 - finds invalid UTF8 chars in table osee_attribute\n");
sb.append(" consolidate_relations - consolidate rows of relations\n");
sb.append(String.format(" reload_cache %s? - reloads server caches\n",
Arrays.deepToString(OseeCacheEnum.values()).replaceAll(",", " | ")));
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 204c663..a0d5a5c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -190,9 +190,6 @@
<Operation className="org.eclipse.osee.framework.ui.skynet.blam.operation.PurgeTransactionBlam"/>
</extension>
- <extension id="FindInvalidUTF8Chars" point="org.eclipse.osee.framework.ui.skynet.BlamOperation">
- <Operation className="org.eclipse.osee.framework.ui.skynet.blam.operation.FindInvalidUTF8Chars"/>
- </extension>
<extension
id="FindArtifactsWithMinAttributeContraintProblems"
point="org.eclipse.osee.framework.ui.skynet.BlamOperation">