Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.server.admin')
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/.classpath14
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/.project56
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/META-INF/MANIFEST.MF82
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/build.properties12
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/plugin.xml36
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BaseServerCommand.java184
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BranchManagementCommandProvider.java128
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/SearchTaggerCommandProvider.java168
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/ServerAdminCommandProvider.java218
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/app/DataStoreBackupApplication.java264
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchCommands.java226
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchExportWorker.java208
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchImportWorker.java186
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/ExchangeIntegrityWorker.java136
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java464
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/DbResource.java212
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/Util.java90
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/internal/Activator.java232
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AddServerVersionWorker.java74
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AdminCommands.java224
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ClearCachesWorker.java126
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ConsolidateArtifactVersionsCommand.java80
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/FinishPartiallyArchivedBranchesCommand.java128
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GarbageCollectionCommand.java58
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GetServerVersionWorker.java70
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ReloadCachesWorker.java128
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/RemoveServerVersionWorker.java74
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/SchedulingCommand.java76
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerRequestsWorker.java62
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerShutdownWorker.java140
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerStats.java214
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/TxCurrentsAndModTypesCommand.java92
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchStats.java80
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchTaggerCommands.java264
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerAllWorker.java362
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerDropAllWorker.java78
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerStats.java122
37 files changed, 2684 insertions, 2684 deletions
diff --git a/plugins/org.eclipse.osee.framework.server.admin/.classpath b/plugins/org.eclipse.osee.framework.server.admin/.classpath
index 8a8f1668cdc..ad32c83a788 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/.classpath
+++ b/plugins/org.eclipse.osee.framework.server.admin/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.framework.server.admin/.project b/plugins/org.eclipse.osee.framework.server.admin/.project
index 3d5da73c193..13b097df489 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/.project
+++ b/plugins/org.eclipse.osee.framework.server.admin/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.framework.server.admin</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.framework.server.admin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.framework.server.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.server.admin/META-INF/MANIFEST.MF
index cf9381987e9..ab92a3af643 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.server.admin/META-INF/MANIFEST.MF
@@ -1,41 +1,41 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Tool Plug-in
-Bundle-SymbolicName: org.eclipse.osee.framework.server.admin;singleton:=true
-Bundle-Version: 0.9.5.qualifier
-Bundle-Activator: org.eclipse.osee.framework.server.admin.internal.Activator
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Bundle-ActivationPolicy: lazy
-Import-Package: org.eclipse.core.runtime,
- org.eclipse.core.runtime.jobs,
- org.eclipse.equinox.app,
- org.eclipse.osee.framework.branch.management,
- org.eclipse.osee.framework.core.data,
- org.eclipse.osee.framework.core.datastore,
- org.eclipse.osee.framework.core.enums,
- org.eclipse.osee.framework.core.exception,
- org.eclipse.osee.framework.core.model,
- org.eclipse.osee.framework.core.model.cache,
- org.eclipse.osee.framework.core.operation,
- org.eclipse.osee.framework.core.server,
- org.eclipse.osee.framework.core.services,
- org.eclipse.osee.framework.core.util,
- org.eclipse.osee.framework.database,
- org.eclipse.osee.framework.database.core,
- org.eclipse.osee.framework.database.operation,
- org.eclipse.osee.framework.jdk.core.type,
- org.eclipse.osee.framework.jdk.core.util,
- org.eclipse.osee.framework.logging,
- org.eclipse.osee.framework.resource.locator.attribute,
- org.eclipse.osee.framework.resource.management,
- org.eclipse.osee.framework.resource.management.exception,
- org.eclipse.osee.framework.resource.management.util,
- org.eclipse.osee.framework.search.engine,
- org.eclipse.osee.framework.search.engine.attribute,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,
- org.osgi.util.tracker
-Service-Component: OSGI-INF/server.admin.cmds.xml,
- OSGI-INF/search.tagger.cmds.xml,
- OSGI-INF/branch.cmds.xml
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tool Plug-in
+Bundle-SymbolicName: org.eclipse.osee.framework.server.admin;singleton:=true
+Bundle-Version: 0.9.5.qualifier
+Bundle-Activator: org.eclipse.osee.framework.server.admin.internal.Activator
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.equinox.app,
+ org.eclipse.osee.framework.branch.management,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.datastore,
+ org.eclipse.osee.framework.core.enums,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.model.cache,
+ org.eclipse.osee.framework.core.operation,
+ org.eclipse.osee.framework.core.server,
+ org.eclipse.osee.framework.core.services,
+ org.eclipse.osee.framework.core.util,
+ org.eclipse.osee.framework.database,
+ org.eclipse.osee.framework.database.core,
+ org.eclipse.osee.framework.database.operation,
+ org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.logging,
+ org.eclipse.osee.framework.resource.locator.attribute,
+ org.eclipse.osee.framework.resource.management,
+ org.eclipse.osee.framework.resource.management.exception,
+ org.eclipse.osee.framework.resource.management.util,
+ org.eclipse.osee.framework.search.engine,
+ org.eclipse.osee.framework.search.engine.attribute,
+ org.eclipse.osgi.framework.console,
+ org.osgi.framework,
+ org.osgi.util.tracker
+Service-Component: OSGI-INF/server.admin.cmds.xml,
+ OSGI-INF/search.tagger.cmds.xml,
+ OSGI-INF/branch.cmds.xml
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/org.eclipse.osee.framework.server.admin/build.properties b/plugins/org.eclipse.osee.framework.server.admin/build.properties
index 9d19e40311a..948f0bdf020 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/build.properties
+++ b/plugins/org.eclipse.osee.framework.server.admin/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/,\
- plugin.xml
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ plugin.xml
diff --git a/plugins/org.eclipse.osee.framework.server.admin/plugin.xml b/plugins/org.eclipse.osee.framework.server.admin/plugin.xml
index 86c70f6d7ad..a56d9ef206d 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.server.admin/plugin.xml
@@ -1,18 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension
- id="OseeBackup"
- name="OseeBackup"
- point="org.eclipse.core.runtime.applications">
- <application
- cardinality="singleton-global"
- thread="main"
- visible="true">
- <run
- class="org.eclipse.osee.framework.server.admin.app.DataStoreBackupApplication">
- </run>
- </application>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ id="OseeBackup"
+ name="OseeBackup"
+ point="org.eclipse.core.runtime.applications">
+ <application
+ cardinality="singleton-global"
+ thread="main"
+ visible="true">
+ <run
+ class="org.eclipse.osee.framework.server.admin.app.DataStoreBackupApplication">
+ </run>
+ </application>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BaseServerCommand.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BaseServerCommand.java
index 2306ecc44ae..300129a3678 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BaseServerCommand.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BaseServerCommand.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * 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.server.admin;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class BaseServerCommand extends AbstractOperation {
-
- private CommandInterpreter ci;
-
- private volatile boolean isRunning;
- private volatile boolean isVerbose;
- private volatile boolean isExecutionAllowed;
-
- protected BaseServerCommand(String name) {
- super(name, Activator.class.getSimpleName());
- this.isRunning = false;
- this.isVerbose = true;
- this.isExecutionAllowed = true;
- }
-
- protected BaseServerCommand(String name, CommandInterpreter ci) {
- this(name);
- setCommandInterpreter(ci);
- }
-
- public boolean isRunning() {
- return isRunning;
- }
-
- public void setExecutionAllowed(boolean value) {
- this.isExecutionAllowed = value;
- }
-
- public void setCommandInterpreter(CommandInterpreter ci) {
- this.ci = ci;
- }
-
- public CommandInterpreter getCommandInterpreter() {
- return this.ci;
- }
-
- public boolean isVerbose() {
- return isVerbose;
- }
-
- public void setVerbose(boolean isVerbose) {
- this.isVerbose = isVerbose;
- }
-
- public boolean isExecutionAllowed() {
- return isExecutionAllowed;
- }
-
- protected void println(Object value) {
- ci.println(value);
- }
-
- protected void printStackTrace(Exception ex) {
- ci.printStackTrace(ex);
- }
-
- @Override
- protected final void doWork(IProgressMonitor monitor) throws Exception {
- this.isRunning = true;
- long startTime = System.currentTimeMillis();
- try {
- doCommandWork(monitor);
- } catch (Exception ex) {
- ci.printStackTrace(ex);
- }
- ci.println(String.format("[%s] Completed in [%s]", getName(), Lib.getElapseString(startTime)));
- this.isRunning = false;
- }
-
- protected abstract void doCommandWork(IProgressMonitor monitor) throws Exception;
-}
+/*******************************************************************************
+ * 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.server.admin;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class BaseServerCommand extends AbstractOperation {
+
+ private CommandInterpreter ci;
+
+ private volatile boolean isRunning;
+ private volatile boolean isVerbose;
+ private volatile boolean isExecutionAllowed;
+
+ protected BaseServerCommand(String name) {
+ super(name, Activator.class.getSimpleName());
+ this.isRunning = false;
+ this.isVerbose = true;
+ this.isExecutionAllowed = true;
+ }
+
+ protected BaseServerCommand(String name, CommandInterpreter ci) {
+ this(name);
+ setCommandInterpreter(ci);
+ }
+
+ public boolean isRunning() {
+ return isRunning;
+ }
+
+ public void setExecutionAllowed(boolean value) {
+ this.isExecutionAllowed = value;
+ }
+
+ public void setCommandInterpreter(CommandInterpreter ci) {
+ this.ci = ci;
+ }
+
+ public CommandInterpreter getCommandInterpreter() {
+ return this.ci;
+ }
+
+ public boolean isVerbose() {
+ return isVerbose;
+ }
+
+ public void setVerbose(boolean isVerbose) {
+ this.isVerbose = isVerbose;
+ }
+
+ public boolean isExecutionAllowed() {
+ return isExecutionAllowed;
+ }
+
+ protected void println(Object value) {
+ ci.println(value);
+ }
+
+ protected void printStackTrace(Exception ex) {
+ ci.printStackTrace(ex);
+ }
+
+ @Override
+ protected final void doWork(IProgressMonitor monitor) throws Exception {
+ this.isRunning = true;
+ long startTime = System.currentTimeMillis();
+ try {
+ doCommandWork(monitor);
+ } catch (Exception ex) {
+ ci.printStackTrace(ex);
+ }
+ ci.println(String.format("[%s] Completed in [%s]", getName(), Lib.getElapseString(startTime)));
+ this.isRunning = false;
+ }
+
+ protected abstract void doCommandWork(IProgressMonitor monitor) throws Exception;
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BranchManagementCommandProvider.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BranchManagementCommandProvider.java
index 53a7c354ab8..99eca51973c 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BranchManagementCommandProvider.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/BranchManagementCommandProvider.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * 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.server.admin;
-
-import org.eclipse.osee.framework.server.admin.branch.BranchCommands;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-import org.eclipse.osgi.framework.console.CommandProvider;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchManagementCommandProvider implements CommandProvider {
-
- private final BranchCommands branchCmds;
-
- public BranchManagementCommandProvider() {
- this.branchCmds = new BranchCommands();
- }
-
- public void _export_branch(CommandInterpreter ci) {
- branchCmds.startBranchExport(ci);
- }
-
- public void _export_branch_stop(CommandInterpreter ci) {
- branchCmds.stopBranchExport(ci);
- }
-
- public void _import_branch(CommandInterpreter ci) {
- branchCmds.startBranchImport(ci);
- }
-
- public void _import_branch_stop(CommandInterpreter ci) {
- branchCmds.stopBranchImport(ci);
- }
-
- public void _check_exchange(CommandInterpreter ci) {
- branchCmds.startBranchIntegrityCheck(ci);
- }
-
- public void _check_exchange_stop(CommandInterpreter ci) {
- branchCmds.stopBranchIntegrityCheck(ci);
- }
-
- @Override
- public String getHelp() {
- StringBuilder sb = new StringBuilder();
- sb.append("\n---OSEE Branch Commands---\n");
- sb.append(" export_branch <exchangeFileName> [-compress] [-minTx <value>] [-maxTx <value>] [-exclude_baseline_txs] [-includeArchivedBranches][<branchId>]+ - export a specific set of branches into an exchange zip file.\n");
- sb.append(" export_branch_stop - stop branch export\n");
- sb.append(" import_branch <exchangeFilePath> [-exclude_baseline_txs] [-allAsRootBranches] [-minTx <value>] [-maxTx <value>] [-clean] [<branchId>]+ - import a specific set of branches from an exchange zip file.\n");
- sb.append(" check_exchange <exchangeFilePath> - checks an exchange file to ensure data integrity\n");
- sb.append(" check_exchange_stop - stop exchange integrity check\n");
- return sb.toString();
- }
-
-}
+/*******************************************************************************
+ * 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.server.admin;
+
+import org.eclipse.osee.framework.server.admin.branch.BranchCommands;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchManagementCommandProvider implements CommandProvider {
+
+ private final BranchCommands branchCmds;
+
+ public BranchManagementCommandProvider() {
+ this.branchCmds = new BranchCommands();
+ }
+
+ public void _export_branch(CommandInterpreter ci) {
+ branchCmds.startBranchExport(ci);
+ }
+
+ public void _export_branch_stop(CommandInterpreter ci) {
+ branchCmds.stopBranchExport(ci);
+ }
+
+ public void _import_branch(CommandInterpreter ci) {
+ branchCmds.startBranchImport(ci);
+ }
+
+ public void _import_branch_stop(CommandInterpreter ci) {
+ branchCmds.stopBranchImport(ci);
+ }
+
+ public void _check_exchange(CommandInterpreter ci) {
+ branchCmds.startBranchIntegrityCheck(ci);
+ }
+
+ public void _check_exchange_stop(CommandInterpreter ci) {
+ branchCmds.stopBranchIntegrityCheck(ci);
+ }
+
+ @Override
+ public String getHelp() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("\n---OSEE Branch Commands---\n");
+ sb.append(" export_branch <exchangeFileName> [-compress] [-minTx <value>] [-maxTx <value>] [-exclude_baseline_txs] [-includeArchivedBranches][<branchId>]+ - export a specific set of branches into an exchange zip file.\n");
+ sb.append(" export_branch_stop - stop branch export\n");
+ sb.append(" import_branch <exchangeFilePath> [-exclude_baseline_txs] [-allAsRootBranches] [-minTx <value>] [-maxTx <value>] [-clean] [<branchId>]+ - import a specific set of branches from an exchange zip file.\n");
+ sb.append(" check_exchange <exchangeFilePath> - checks an exchange file to ensure data integrity\n");
+ sb.append(" check_exchange_stop - stop exchange integrity check\n");
+ return sb.toString();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/SearchTaggerCommandProvider.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/SearchTaggerCommandProvider.java
index bb85a1aefef..bfc57a43429 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/SearchTaggerCommandProvider.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/SearchTaggerCommandProvider.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * 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.server.admin;
-
-import org.eclipse.osee.framework.server.admin.search.SearchTaggerCommands;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-import org.eclipse.osgi.framework.console.CommandProvider;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SearchTaggerCommandProvider implements CommandProvider {
-
- private final SearchTaggerCommands searchTaggerCommands;
-
- public SearchTaggerCommandProvider() {
- this.searchTaggerCommands = new SearchTaggerCommands();
- }
-
- public void _tag_all(CommandInterpreter ci) {
- searchTaggerCommands.startTagAll(ci);
- }
-
- public void _tag_all_stop(CommandInterpreter ci) {
- searchTaggerCommands.stopTagAll(ci);
- }
-
- public void _drop_all_tags(CommandInterpreter ci) {
- searchTaggerCommands.startDropAll(ci);
- }
-
- public void _drop_all_tags_stop(CommandInterpreter ci) {
- searchTaggerCommands.stopDropAll(ci);
- }
-
- public void _tagger_stats(CommandInterpreter ci) {
- searchTaggerCommands.getTaggerStatistics(ci);
- }
-
- public void _tagger_stats_clear(CommandInterpreter ci) {
- searchTaggerCommands.clearTaggerStats();
- }
-
- public void _search_stats(CommandInterpreter ci) {
- searchTaggerCommands.getSearchStatistics(ci);
- }
-
- public void _search_stats_clear(CommandInterpreter ci) {
- searchTaggerCommands.clearSearchStats();
- }
-
- public void _tag(CommandInterpreter ci) {
- searchTaggerCommands.startTagItem(ci);
- }
-
- public void _tag_stop(CommandInterpreter ci) {
- searchTaggerCommands.stopTagItem(ci);
- }
-
- @Override
- public String getHelp() {
- StringBuilder sb = new StringBuilder();
- sb.append("\n---OSEE Search & Tag Commands---\n");
- sb.append(" tag_all [<branchId>] - tag all attributes in a branch or tag all attributes in all branches if id not specified\n");
- sb.append(" tag_all_stop - stop tagging all attributes\n");
- sb.append(" tag [<gammaId> <gammaId> ...]- tag individual item\n");
- sb.append(" tag_stop - stop tagging individual items\n");
- sb.append(" drop_all_tags - drops all tags\n");
- sb.append(" drop_all_tags_stop - stop dropping all tags\n");
- sb.append(" tagger_stats - get tagger stats\n");
- sb.append(" tagger_stats_clear - clear tagger stats\n");
- sb.append(" search_stats - get tagger stats\n");
- sb.append(" search_stats_clear - clear tagger stats\n");
- return sb.toString();
- }
-}
+/*******************************************************************************
+ * 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.server.admin;
+
+import org.eclipse.osee.framework.server.admin.search.SearchTaggerCommands;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SearchTaggerCommandProvider implements CommandProvider {
+
+ private final SearchTaggerCommands searchTaggerCommands;
+
+ public SearchTaggerCommandProvider() {
+ this.searchTaggerCommands = new SearchTaggerCommands();
+ }
+
+ public void _tag_all(CommandInterpreter ci) {
+ searchTaggerCommands.startTagAll(ci);
+ }
+
+ public void _tag_all_stop(CommandInterpreter ci) {
+ searchTaggerCommands.stopTagAll(ci);
+ }
+
+ public void _drop_all_tags(CommandInterpreter ci) {
+ searchTaggerCommands.startDropAll(ci);
+ }
+
+ public void _drop_all_tags_stop(CommandInterpreter ci) {
+ searchTaggerCommands.stopDropAll(ci);
+ }
+
+ public void _tagger_stats(CommandInterpreter ci) {
+ searchTaggerCommands.getTaggerStatistics(ci);
+ }
+
+ public void _tagger_stats_clear(CommandInterpreter ci) {
+ searchTaggerCommands.clearTaggerStats();
+ }
+
+ public void _search_stats(CommandInterpreter ci) {
+ searchTaggerCommands.getSearchStatistics(ci);
+ }
+
+ public void _search_stats_clear(CommandInterpreter ci) {
+ searchTaggerCommands.clearSearchStats();
+ }
+
+ public void _tag(CommandInterpreter ci) {
+ searchTaggerCommands.startTagItem(ci);
+ }
+
+ public void _tag_stop(CommandInterpreter ci) {
+ searchTaggerCommands.stopTagItem(ci);
+ }
+
+ @Override
+ public String getHelp() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("\n---OSEE Search & Tag Commands---\n");
+ sb.append(" tag_all [<branchId>] - tag all attributes in a branch or tag all attributes in all branches if id not specified\n");
+ sb.append(" tag_all_stop - stop tagging all attributes\n");
+ sb.append(" tag [<gammaId> <gammaId> ...]- tag individual item\n");
+ sb.append(" tag_stop - stop tagging individual items\n");
+ sb.append(" drop_all_tags - drops all tags\n");
+ sb.append(" drop_all_tags_stop - stop dropping all tags\n");
+ sb.append(" tagger_stats - get tagger stats\n");
+ sb.append(" tagger_stats_clear - clear tagger stats\n");
+ sb.append(" search_stats - get tagger stats\n");
+ sb.append(" search_stats_clear - clear tagger stats\n");
+ return sb.toString();
+ }
+}
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 396880f9ca8..cfc1dac8114 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
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * 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.server.admin;
-
-import java.util.Arrays;
-import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.server.admin.management.AdminCommands;
-import org.eclipse.osee.framework.server.admin.management.ConsolidateArtifactVersionsCommand;
-import org.eclipse.osee.framework.server.admin.management.FinishPartiallyArchivedBranchesCommand;
-import org.eclipse.osee.framework.server.admin.management.GarbageCollectionCommand;
-import org.eclipse.osee.framework.server.admin.management.SchedulingCommand;
-import org.eclipse.osee.framework.server.admin.management.TxCurrentsAndModTypesCommand;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-import org.eclipse.osgi.framework.console.CommandProvider;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ServerAdminCommandProvider implements CommandProvider {
-
- private final AdminCommands adminCommands;
-
- public ServerAdminCommandProvider() {
- this.adminCommands = new AdminCommands();
- }
-
- public void _server_status(CommandInterpreter ci) {
- adminCommands.getServerStatus(ci);
- }
-
- public void _server_process_requests(CommandInterpreter ci) {
- adminCommands.setServletRequestProcessing(ci);
- }
-
- public void _add_osee_version(CommandInterpreter ci) {
- adminCommands.addServerVersion(ci);
- }
-
- public void _remove_osee_version(CommandInterpreter ci) {
- adminCommands.removeServerVersion(ci);
- }
-
- public void _osee_version(CommandInterpreter ci) {
- adminCommands.getServerVersion(ci);
- }
-
- public void _reload_cache(CommandInterpreter ci) {
- adminCommands.reloadCache(ci);
- }
-
- public void _clear_cache(CommandInterpreter ci) {
- adminCommands.clearCache(ci);
- }
-
- public void _finish_partial_archives(CommandInterpreter ci) {
- Operations.executeAsJob(new FinishPartiallyArchivedBranchesCommand(ci), false);
- }
-
- public void _consolidate_artifact_versions(CommandInterpreter ci) {
- Operations.executeAsJob(new ConsolidateArtifactVersionsCommand(ci), false);
- }
-
- public void _gc(CommandInterpreter ci) {
- Operations.executeAsJob(new GarbageCollectionCommand(ci), false);
- }
-
- public void _schedule(CommandInterpreter ci) {
- Operations.executeAsJob(new SchedulingCommand(ci), false);
- }
-
- public void _tx_currents(CommandInterpreter ci) {
- Operations.executeAsJob(new TxCurrentsAndModTypesCommand(ci), false);
- }
-
- public void _osee_shutdown(CommandInterpreter ci) {
- adminCommands.oseeShutdown(ci);
- }
-
- @Override
- public String getHelp() {
- StringBuilder sb = new StringBuilder();
- sb.append("\n---OSEE Server Admin Commands---\n");
- sb.append(" server_status - displays server status\n");
- sb.append(" server_process_requests [true | false]- command servlets to accept/reject requests\n");
- sb.append(" osee_version - displays the supported osee versions\n");
- sb.append(" add_osee_version [version string]- add the version string to the list of supported osee versions\n");
- sb.append(" remove_osee_version [version string]- removes the version string from the list of supported osee versions\n");
- sb.append(" finish_partial_archives - move txs addressing to osee_txs_archived for archived branches\n");
- sb.append(" consolidate_artifact_versions - migrate to 0.9.2 database schema\n");
- sb.append(" tx_currents [true | false] - detect and fix tx current and mod types inconsistencies on archive txs or txs\n");
- sb.append(" osee_shutdown [-oseeOnly] - immediately release the listening port then waits for all existing operations to finish. \n");
- sb.append(" gc - run java garbage collecction\n");
- sb.append(" schedule <delay seconds> <iterations> <command> - runs the command after the specified delay and repeat given number of times\n");
- sb.append(String.format(" reload_cache %s? - reloads server caches\n", Arrays.deepToString(
- OseeCacheEnum.values()).replaceAll(",", " | ")));
- sb.append(String.format(" clear_cache %s? - decaches all objects from the specified caches\n",
- Arrays.deepToString(OseeCacheEnum.values()).replaceAll(",", " |")));
- return sb.toString();
- }
-}
+/*******************************************************************************
+ * 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.server.admin;
+
+import java.util.Arrays;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.server.admin.management.AdminCommands;
+import org.eclipse.osee.framework.server.admin.management.ConsolidateArtifactVersionsCommand;
+import org.eclipse.osee.framework.server.admin.management.FinishPartiallyArchivedBranchesCommand;
+import org.eclipse.osee.framework.server.admin.management.GarbageCollectionCommand;
+import org.eclipse.osee.framework.server.admin.management.SchedulingCommand;
+import org.eclipse.osee.framework.server.admin.management.TxCurrentsAndModTypesCommand;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ServerAdminCommandProvider implements CommandProvider {
+
+ private final AdminCommands adminCommands;
+
+ public ServerAdminCommandProvider() {
+ this.adminCommands = new AdminCommands();
+ }
+
+ public void _server_status(CommandInterpreter ci) {
+ adminCommands.getServerStatus(ci);
+ }
+
+ public void _server_process_requests(CommandInterpreter ci) {
+ adminCommands.setServletRequestProcessing(ci);
+ }
+
+ public void _add_osee_version(CommandInterpreter ci) {
+ adminCommands.addServerVersion(ci);
+ }
+
+ public void _remove_osee_version(CommandInterpreter ci) {
+ adminCommands.removeServerVersion(ci);
+ }
+
+ public void _osee_version(CommandInterpreter ci) {
+ adminCommands.getServerVersion(ci);
+ }
+
+ public void _reload_cache(CommandInterpreter ci) {
+ adminCommands.reloadCache(ci);
+ }
+
+ public void _clear_cache(CommandInterpreter ci) {
+ adminCommands.clearCache(ci);
+ }
+
+ public void _finish_partial_archives(CommandInterpreter ci) {
+ Operations.executeAsJob(new FinishPartiallyArchivedBranchesCommand(ci), false);
+ }
+
+ public void _consolidate_artifact_versions(CommandInterpreter ci) {
+ Operations.executeAsJob(new ConsolidateArtifactVersionsCommand(ci), false);
+ }
+
+ public void _gc(CommandInterpreter ci) {
+ Operations.executeAsJob(new GarbageCollectionCommand(ci), false);
+ }
+
+ public void _schedule(CommandInterpreter ci) {
+ Operations.executeAsJob(new SchedulingCommand(ci), false);
+ }
+
+ public void _tx_currents(CommandInterpreter ci) {
+ Operations.executeAsJob(new TxCurrentsAndModTypesCommand(ci), false);
+ }
+
+ public void _osee_shutdown(CommandInterpreter ci) {
+ adminCommands.oseeShutdown(ci);
+ }
+
+ @Override
+ public String getHelp() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("\n---OSEE Server Admin Commands---\n");
+ sb.append(" server_status - displays server status\n");
+ sb.append(" server_process_requests [true | false]- command servlets to accept/reject requests\n");
+ sb.append(" osee_version - displays the supported osee versions\n");
+ sb.append(" add_osee_version [version string]- add the version string to the list of supported osee versions\n");
+ sb.append(" remove_osee_version [version string]- removes the version string from the list of supported osee versions\n");
+ sb.append(" finish_partial_archives - move txs addressing to osee_txs_archived for archived branches\n");
+ sb.append(" consolidate_artifact_versions - migrate to 0.9.2 database schema\n");
+ sb.append(" tx_currents [true | false] - detect and fix tx current and mod types inconsistencies on archive txs or txs\n");
+ sb.append(" osee_shutdown [-oseeOnly] - immediately release the listening port then waits for all existing operations to finish. \n");
+ sb.append(" gc - run java garbage collecction\n");
+ sb.append(" schedule <delay seconds> <iterations> <command> - runs the command after the specified delay and repeat given number of times\n");
+ sb.append(String.format(" reload_cache %s? - reloads server caches\n", Arrays.deepToString(
+ OseeCacheEnum.values()).replaceAll(",", " | ")));
+ sb.append(String.format(" clear_cache %s? - decaches all objects from the specified caches\n",
+ Arrays.deepToString(OseeCacheEnum.values()).replaceAll(",", " |")));
+ return sb.toString();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/app/DataStoreBackupApplication.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/app/DataStoreBackupApplication.java
index 963b2b7ed9a..a62ec80a7d7 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/app/DataStoreBackupApplication.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/app/DataStoreBackupApplication.java
@@ -1,132 +1,132 @@
-/*******************************************************************************
- * 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.server.admin.app;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.osee.framework.branch.management.ExportOptions;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.resource.management.IResource;
-import org.eclipse.osee.framework.resource.management.IResourceLocator;
-import org.eclipse.osee.framework.resource.management.Options;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class DataStoreBackupApplication implements IApplication {
- private static final String ALL_BRANCHES_QUERY = "select branch_id from osee_branch";
-
- public DataStoreBackupApplication() {
- }
-
- private List<Integer> getAllBranches() throws OseeDataStoreException {
- List<Integer> toReturn = new ArrayList<Integer>();
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(100, ALL_BRANCHES_QUERY);
- while (chStmt.next()) {
- toReturn.add(chStmt.getInt("branch_id"));
- }
- } finally {
- chStmt.close();
- }
- return toReturn;
- }
-
- private void transferToBackupLocation(IResourceLocator locator, File backupFolder) throws Exception {
- InputStream inputStream = null;
- OutputStream outputStream = null;
- try {
- IResource resource = Activator.getInstance().getResourceManager().acquire(locator, new Options());
- inputStream = resource.getContent();
-
- outputStream = new BufferedOutputStream(new FileOutputStream(new File(backupFolder, resource.getName())));
-
- Lib.inputStreamToOutputStream(inputStream, outputStream);
- } finally {
- try {
- if (inputStream != null) {
- inputStream.close();
- }
- } finally {
- if (outputStream != null) {
- outputStream.flush();
- outputStream.close();
- }
- }
- }
- }
-
- @Override
- public Object start(IApplicationContext context) throws Exception {
- try {
- String backupName = "osee_" + Lib.getDateTimeString();
-
- Options options = new Options();
- options.put(ExportOptions.COMPRESS.name(), true);
-
- List<Integer> branchIds = getAllBranches();
-
- int totalBranches = branchIds.size();
- OseeLog.log(Activator.class, Level.INFO, String.format("Exporting [%s] branch%s", totalBranches,
- totalBranches == 1 ? "" : "es"));
-
- IResourceLocator exportLocator =
- Activator.getInstance().getBranchExchange().exportBranch(backupName, options, branchIds);
-
- OseeLog.log(Activator.class, Level.INFO, String.format("Verifying export file integrity [%s]",
- exportLocator.getLocation()));
-
- IResourceLocator exportCheckLocator =
- Activator.getInstance().getBranchExchange().checkIntegrity(exportLocator);
- OseeLog.log(Activator.class, Level.INFO, String.format("Verified [%s]", exportCheckLocator.getLocation()));
-
- OseeLog.log(Activator.class, Level.INFO, String.format("Completed export - [%s] branch%s", totalBranches,
- totalBranches == 1 ? "" : "es"));
-
- String backupPath = (String) context.getArguments().get("osee.backup.path");
- if (Strings.isValid(backupPath)) {
- if (!backupPath.endsWith(File.separator)) {
- backupPath = backupPath + File.separator;
- }
- File backupFolder = new File(backupPath);
- backupFolder.mkdirs();
- transferToBackupLocation(exportLocator, backupFolder);
- transferToBackupLocation(exportCheckLocator, backupFolder);
-
- Activator.getInstance().getResourceManager().delete(exportLocator);
- Activator.getInstance().getResourceManager().delete(exportCheckLocator);
- }
- } catch (Throwable ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- return IApplication.EXIT_OK;
- }
-
- @Override
- public void stop() {
- }
-
-}
+/*******************************************************************************
+ * 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.server.admin.app;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.osee.framework.branch.management.ExportOptions;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.resource.management.IResource;
+import org.eclipse.osee.framework.resource.management.IResourceLocator;
+import org.eclipse.osee.framework.resource.management.Options;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataStoreBackupApplication implements IApplication {
+ private static final String ALL_BRANCHES_QUERY = "select branch_id from osee_branch";
+
+ public DataStoreBackupApplication() {
+ }
+
+ private List<Integer> getAllBranches() throws OseeDataStoreException {
+ List<Integer> toReturn = new ArrayList<Integer>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(100, ALL_BRANCHES_QUERY);
+ while (chStmt.next()) {
+ toReturn.add(chStmt.getInt("branch_id"));
+ }
+ } finally {
+ chStmt.close();
+ }
+ return toReturn;
+ }
+
+ private void transferToBackupLocation(IResourceLocator locator, File backupFolder) throws Exception {
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ IResource resource = Activator.getInstance().getResourceManager().acquire(locator, new Options());
+ inputStream = resource.getContent();
+
+ outputStream = new BufferedOutputStream(new FileOutputStream(new File(backupFolder, resource.getName())));
+
+ Lib.inputStreamToOutputStream(inputStream, outputStream);
+ } finally {
+ try {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ } finally {
+ if (outputStream != null) {
+ outputStream.flush();
+ outputStream.close();
+ }
+ }
+ }
+ }
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ try {
+ String backupName = "osee_" + Lib.getDateTimeString();
+
+ Options options = new Options();
+ options.put(ExportOptions.COMPRESS.name(), true);
+
+ List<Integer> branchIds = getAllBranches();
+
+ int totalBranches = branchIds.size();
+ OseeLog.log(Activator.class, Level.INFO, String.format("Exporting [%s] branch%s", totalBranches,
+ totalBranches == 1 ? "" : "es"));
+
+ IResourceLocator exportLocator =
+ Activator.getInstance().getBranchExchange().exportBranch(backupName, options, branchIds);
+
+ OseeLog.log(Activator.class, Level.INFO, String.format("Verifying export file integrity [%s]",
+ exportLocator.getLocation()));
+
+ IResourceLocator exportCheckLocator =
+ Activator.getInstance().getBranchExchange().checkIntegrity(exportLocator);
+ OseeLog.log(Activator.class, Level.INFO, String.format("Verified [%s]", exportCheckLocator.getLocation()));
+
+ OseeLog.log(Activator.class, Level.INFO, String.format("Completed export - [%s] branch%s", totalBranches,
+ totalBranches == 1 ? "" : "es"));
+
+ String backupPath = (String) context.getArguments().get("osee.backup.path");
+ if (Strings.isValid(backupPath)) {
+ if (!backupPath.endsWith(File.separator)) {
+ backupPath = backupPath + File.separator;
+ }
+ File backupFolder = new File(backupPath);
+ backupFolder.mkdirs();
+ transferToBackupLocation(exportLocator, backupFolder);
+ transferToBackupLocation(exportCheckLocator, backupFolder);
+
+ Activator.getInstance().getResourceManager().delete(exportLocator);
+ Activator.getInstance().getResourceManager().delete(exportCheckLocator);
+ }
+ } catch (Throwable ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return IApplication.EXIT_OK;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchCommands.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchCommands.java
index 321101e8e31..3bfad998c20 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchCommands.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchCommands.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * 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.server.admin.branch;
-
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchCommands {
-
- private final BranchExportWorker branchExportWorker;
- private final BranchImportWorker branchImportWorker;
- private final ExchangeIntegrityWorker integrityWorker;
-
- public BranchCommands() {
- this.branchExportWorker = new BranchExportWorker();
- this.branchExportWorker.setExecutionAllowed(true);
-
- this.branchImportWorker = new BranchImportWorker();
- this.branchImportWorker.setExecutionAllowed(true);
-
- this.integrityWorker = new ExchangeIntegrityWorker();
- this.integrityWorker.setExecutionAllowed(true);
- }
-
- public void startBranchExport(CommandInterpreter ci) {
- if (!this.branchExportWorker.isRunning() && !this.branchImportWorker.isRunning() && !this.integrityWorker.isRunning()) {
- this.branchExportWorker.setCommandInterpreter(ci);
- this.branchExportWorker.setExecutionAllowed(true);
- Operations.executeAsJob(branchExportWorker, false);
- } else {
- if (this.branchExportWorker.isRunning()) {
- ci.println("Branch Export is already running.");
- }
- if (this.branchImportWorker.isRunning()) {
- ci.println("Branch Import is already running.");
- }
- if (this.integrityWorker.isRunning()) {
- ci.println("Branch Integrity Check is already running.");
- }
- }
- }
-
- public void stopBranchExport(CommandInterpreter ci) {
- if (this.branchExportWorker.isRunning()) {
- this.branchExportWorker.setExecutionAllowed(false);
- } else {
- ci.println("Branch Export is not running.");
- }
- }
-
- public void startBranchImport(CommandInterpreter ci) {
- if (!this.branchExportWorker.isRunning() && !this.branchImportWorker.isRunning() && !this.integrityWorker.isRunning()) {
- this.branchImportWorker.setCommandInterpreter(ci);
- this.branchImportWorker.setExecutionAllowed(true);
- Operations.executeAsJob(branchImportWorker, false);
- } else {
- if (this.branchExportWorker.isRunning()) {
- ci.println("Branch Export is already running.");
- }
- if (this.branchImportWorker.isRunning()) {
- ci.println("Branch Import is already running.");
- }
- if (this.integrityWorker.isRunning()) {
- ci.println("Branch Integrity Check is already running.");
- }
- }
- }
-
- public void stopBranchImport(CommandInterpreter ci) {
- if (this.branchImportWorker.isRunning()) {
- this.branchImportWorker.setExecutionAllowed(false);
- } else {
- ci.println("Branch Import is not running.");
- }
- }
-
- public void startBranchIntegrityCheck(CommandInterpreter ci) {
- if (!this.branchExportWorker.isRunning() && !this.branchImportWorker.isRunning() && !this.integrityWorker.isRunning()) {
- this.integrityWorker.setCommandInterpreter(ci);
- this.integrityWorker.setExecutionAllowed(true);
- Operations.executeAsJob(integrityWorker, false);
- } else {
- if (this.branchExportWorker.isRunning()) {
- ci.println("Branch Export is already running.");
- }
- if (this.branchImportWorker.isRunning()) {
- ci.println("Branch Import is already running.");
- }
- if (this.integrityWorker.isRunning()) {
- ci.println("Branch Integrity Check is already running.");
- }
- }
- }
-
- public void stopBranchIntegrityCheck(CommandInterpreter ci) {
- if (this.integrityWorker.isRunning()) {
- this.integrityWorker.setExecutionAllowed(false);
- } else {
- ci.println("Branch Integrity Check is not running.");
- }
- }
-}
+/*******************************************************************************
+ * 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.server.admin.branch;
+
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchCommands {
+
+ private final BranchExportWorker branchExportWorker;
+ private final BranchImportWorker branchImportWorker;
+ private final ExchangeIntegrityWorker integrityWorker;
+
+ public BranchCommands() {
+ this.branchExportWorker = new BranchExportWorker();
+ this.branchExportWorker.setExecutionAllowed(true);
+
+ this.branchImportWorker = new BranchImportWorker();
+ this.branchImportWorker.setExecutionAllowed(true);
+
+ this.integrityWorker = new ExchangeIntegrityWorker();
+ this.integrityWorker.setExecutionAllowed(true);
+ }
+
+ public void startBranchExport(CommandInterpreter ci) {
+ if (!this.branchExportWorker.isRunning() && !this.branchImportWorker.isRunning() && !this.integrityWorker.isRunning()) {
+ this.branchExportWorker.setCommandInterpreter(ci);
+ this.branchExportWorker.setExecutionAllowed(true);
+ Operations.executeAsJob(branchExportWorker, false);
+ } else {
+ if (this.branchExportWorker.isRunning()) {
+ ci.println("Branch Export is already running.");
+ }
+ if (this.branchImportWorker.isRunning()) {
+ ci.println("Branch Import is already running.");
+ }
+ if (this.integrityWorker.isRunning()) {
+ ci.println("Branch Integrity Check is already running.");
+ }
+ }
+ }
+
+ public void stopBranchExport(CommandInterpreter ci) {
+ if (this.branchExportWorker.isRunning()) {
+ this.branchExportWorker.setExecutionAllowed(false);
+ } else {
+ ci.println("Branch Export is not running.");
+ }
+ }
+
+ public void startBranchImport(CommandInterpreter ci) {
+ if (!this.branchExportWorker.isRunning() && !this.branchImportWorker.isRunning() && !this.integrityWorker.isRunning()) {
+ this.branchImportWorker.setCommandInterpreter(ci);
+ this.branchImportWorker.setExecutionAllowed(true);
+ Operations.executeAsJob(branchImportWorker, false);
+ } else {
+ if (this.branchExportWorker.isRunning()) {
+ ci.println("Branch Export is already running.");
+ }
+ if (this.branchImportWorker.isRunning()) {
+ ci.println("Branch Import is already running.");
+ }
+ if (this.integrityWorker.isRunning()) {
+ ci.println("Branch Integrity Check is already running.");
+ }
+ }
+ }
+
+ public void stopBranchImport(CommandInterpreter ci) {
+ if (this.branchImportWorker.isRunning()) {
+ this.branchImportWorker.setExecutionAllowed(false);
+ } else {
+ ci.println("Branch Import is not running.");
+ }
+ }
+
+ public void startBranchIntegrityCheck(CommandInterpreter ci) {
+ if (!this.branchExportWorker.isRunning() && !this.branchImportWorker.isRunning() && !this.integrityWorker.isRunning()) {
+ this.integrityWorker.setCommandInterpreter(ci);
+ this.integrityWorker.setExecutionAllowed(true);
+ Operations.executeAsJob(integrityWorker, false);
+ } else {
+ if (this.branchExportWorker.isRunning()) {
+ ci.println("Branch Export is already running.");
+ }
+ if (this.branchImportWorker.isRunning()) {
+ ci.println("Branch Import is already running.");
+ }
+ if (this.integrityWorker.isRunning()) {
+ ci.println("Branch Integrity Check is already running.");
+ }
+ }
+ }
+
+ public void stopBranchIntegrityCheck(CommandInterpreter ci) {
+ if (this.integrityWorker.isRunning()) {
+ this.integrityWorker.setExecutionAllowed(false);
+ } else {
+ ci.println("Branch Integrity Check is not running.");
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchExportWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchExportWorker.java
index 578acc59933..10d6240e136 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchExportWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchExportWorker.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * 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.server.admin.branch;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.ExportOptions;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.resource.management.Options;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchExportWorker extends BaseServerCommand {
-
- private static final String ALL_BRANCHES_QUERY =
- "SELECT x1.branch_id FROM (" + "SELECT br1.branch_id FROM osee_branch br1%s br1.branch_type <> 3 " + "UNION " + "SELECT om1.merge_branch_id FROM osee_merge om1, osee_branch ob1 WHERE om1.dest_branch_id = ob1.branch_id%s " + "UNION " + "SELECT om2.source_branch_id from osee_merge om2, osee_branch ob2 WHERE om2.dest_branch_id = ob2.branch_id%s " + ") x1 ORDER BY x1.branch_id";
-
- protected BranchExportWorker() {
- super("");
- }
-
- private boolean isValidArg(String arg) {
- return arg != null && arg.length() > 0;
- }
-
- private String getAllBranchesQuery(boolean includeArchivedBranches) {
- return String.format(ALL_BRANCHES_QUERY, includeArchivedBranches ? " where" : " where br1.archived <> 1 and",
- includeArchivedBranches ? "" : " and ob1.archived <> 1",
- includeArchivedBranches ? "" : " and ob2.archived <> 1");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- Options options = new Options();
- String arg = null;
- int count = 0;
- String exportFileName = null;
- boolean includeArchivedBranches = false;
- List<Integer> branchIds = new ArrayList<Integer>();
- do {
- arg = getCommandInterpreter().nextArgument();
- if (isValidArg(arg)) {
- if (arg.equals("-excludeBaselineTxs")) {
- options.put(ExportOptions.EXCLUDE_BASELINE_TXS.name(), true);
- } else if (arg.equals("-includeArchivedBranches")) {
- includeArchivedBranches = true;
- } else if (arg.equals("-compress")) {
- options.put(ExportOptions.COMPRESS.name(), true);
- } else if (arg.equals("-minTx")) {
- arg = getCommandInterpreter().nextArgument();
- if (isValidArg(arg)) {
- options.put(ExportOptions.MIN_TXS.name(), arg);
- }
- count++;
- } else if (arg.equals("-maxTx")) {
- arg = getCommandInterpreter().nextArgument();
- if (isValidArg(arg)) {
- options.put(ExportOptions.MAX_TXS.name(), arg);
- }
- count++;
- } else {
- if (count == 0 && !arg.startsWith("-")) {
- exportFileName = arg;
- } else {
- branchIds.add(new Integer(arg));
- }
- }
- }
- count++;
- } while (isValidArg(arg));
-
- if (!isValidArg(exportFileName)) {
- throw new IllegalArgumentException(String.format("exportFileName was invalid: [%s]", exportFileName));
- }
-
- if (branchIds.isEmpty()) {
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- chStmt.runPreparedQuery(getAllBranchesQuery(includeArchivedBranches));
- while (chStmt.next()) {
- branchIds.add(chStmt.getInt("branch_id"));
- }
- } finally {
- chStmt.close();
- }
- }
- println(String.format("Exporting: [%s] branches\n", branchIds.size()));
-
- Activator.getInstance().getBranchExchange().exportBranch(exportFileName, options, branchIds);
- }
-}
+/*******************************************************************************
+ * 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.server.admin.branch;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.branch.management.ExportOptions;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.resource.management.Options;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchExportWorker extends BaseServerCommand {
+
+ private static final String ALL_BRANCHES_QUERY =
+ "SELECT x1.branch_id FROM (" + "SELECT br1.branch_id FROM osee_branch br1%s br1.branch_type <> 3 " + "UNION " + "SELECT om1.merge_branch_id FROM osee_merge om1, osee_branch ob1 WHERE om1.dest_branch_id = ob1.branch_id%s " + "UNION " + "SELECT om2.source_branch_id from osee_merge om2, osee_branch ob2 WHERE om2.dest_branch_id = ob2.branch_id%s " + ") x1 ORDER BY x1.branch_id";
+
+ protected BranchExportWorker() {
+ super("");
+ }
+
+ private boolean isValidArg(String arg) {
+ return arg != null && arg.length() > 0;
+ }
+
+ private String getAllBranchesQuery(boolean includeArchivedBranches) {
+ return String.format(ALL_BRANCHES_QUERY, includeArchivedBranches ? " where" : " where br1.archived <> 1 and",
+ includeArchivedBranches ? "" : " and ob1.archived <> 1",
+ includeArchivedBranches ? "" : " and ob2.archived <> 1");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ Options options = new Options();
+ String arg = null;
+ int count = 0;
+ String exportFileName = null;
+ boolean includeArchivedBranches = false;
+ List<Integer> branchIds = new ArrayList<Integer>();
+ do {
+ arg = getCommandInterpreter().nextArgument();
+ if (isValidArg(arg)) {
+ if (arg.equals("-excludeBaselineTxs")) {
+ options.put(ExportOptions.EXCLUDE_BASELINE_TXS.name(), true);
+ } else if (arg.equals("-includeArchivedBranches")) {
+ includeArchivedBranches = true;
+ } else if (arg.equals("-compress")) {
+ options.put(ExportOptions.COMPRESS.name(), true);
+ } else if (arg.equals("-minTx")) {
+ arg = getCommandInterpreter().nextArgument();
+ if (isValidArg(arg)) {
+ options.put(ExportOptions.MIN_TXS.name(), arg);
+ }
+ count++;
+ } else if (arg.equals("-maxTx")) {
+ arg = getCommandInterpreter().nextArgument();
+ if (isValidArg(arg)) {
+ options.put(ExportOptions.MAX_TXS.name(), arg);
+ }
+ count++;
+ } else {
+ if (count == 0 && !arg.startsWith("-")) {
+ exportFileName = arg;
+ } else {
+ branchIds.add(new Integer(arg));
+ }
+ }
+ }
+ count++;
+ } while (isValidArg(arg));
+
+ if (!isValidArg(exportFileName)) {
+ throw new IllegalArgumentException(String.format("exportFileName was invalid: [%s]", exportFileName));
+ }
+
+ if (branchIds.isEmpty()) {
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(getAllBranchesQuery(includeArchivedBranches));
+ while (chStmt.next()) {
+ branchIds.add(chStmt.getInt("branch_id"));
+ }
+ } finally {
+ chStmt.close();
+ }
+ }
+ println(String.format("Exporting: [%s] branches\n", branchIds.size()));
+
+ Activator.getInstance().getBranchExchange().exportBranch(exportFileName, options, branchIds);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchImportWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchImportWorker.java
index 40edb4c4871..f6285ac2818 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchImportWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/BranchImportWorker.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * 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.server.admin.branch;
-
-import java.io.File;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.branch.management.ImportOptions;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.resource.management.Options;
-import org.eclipse.osee.framework.resource.management.util.ResourceLocator;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class BranchImportWorker extends BaseServerCommand {
-
- protected BranchImportWorker() {
- super("Branch Import");
- }
-
- private boolean isValidArg(String arg) {
- return arg != null && arg.length() > 0;
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- Options options = new Options();
- String arg = null;
- int count = 0;
-
- List<Integer> branchIds = new ArrayList<Integer>();
- List<File> importFiles = new ArrayList<File>();
- do {
- arg = getCommandInterpreter().nextArgument();
- if (isValidArg(arg)) {
- if (arg.equals("-excludeBaselineTxs")) {
- options.put(ImportOptions.EXCLUDE_BASELINE_TXS.name(), true);
- } else if (arg.equals("-clean")) {
- options.put(ImportOptions.CLEAN_BEFORE_IMPORT.name(), true);
- } else if (arg.equals("-allAsRootBranches")) {
- options.put(ImportOptions.ALL_AS_ROOT_BRANCHES.name(), true);
- } else if (arg.equals("-minTx")) {
- arg = getCommandInterpreter().nextArgument();
- if (isValidArg(arg)) {
- options.put(ImportOptions.MIN_TXS.name(), arg);
- }
- count++;
- } else if (arg.equals("-maxTx")) {
- arg = getCommandInterpreter().nextArgument();
- if (isValidArg(arg)) {
- options.put(ImportOptions.MAX_TXS.name(), arg);
- }
- count++;
- } else if (count == 0 && !arg.startsWith("-")) {
- importFiles.add(new File(arg));
- } else {
- branchIds.add(new Integer(arg));
- }
- count++;
- }
- } while (isValidArg(arg));
-
- if (importFiles.isEmpty()) {
- throw new IllegalArgumentException("Files to import were not specified");
- }
-
- for (File file : importFiles) {
- if (file == null || !file.exists() || !file.canRead()) {
- throw new IllegalArgumentException(String.format("File was not accessible: [%s]", file));
- } else if (file.isFile() && !Lib.isCompressed(file)) {
- throw new IllegalArgumentException(String.format("Invalid File: [%s]", file));
- }
- }
-
- for (File fileToImport : importFiles) {
- URI uri = new URI("exchange://" + fileToImport.toURI().toASCIIString());
- Activator.getInstance().getBranchExchange().importBranch(new ResourceLocator(uri), options, branchIds);
- }
- }
-}
+/*******************************************************************************
+ * 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.server.admin.branch;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.branch.management.ImportOptions;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.resource.management.Options;
+import org.eclipse.osee.framework.resource.management.util.ResourceLocator;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchImportWorker extends BaseServerCommand {
+
+ protected BranchImportWorker() {
+ super("Branch Import");
+ }
+
+ private boolean isValidArg(String arg) {
+ return arg != null && arg.length() > 0;
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ Options options = new Options();
+ String arg = null;
+ int count = 0;
+
+ List<Integer> branchIds = new ArrayList<Integer>();
+ List<File> importFiles = new ArrayList<File>();
+ do {
+ arg = getCommandInterpreter().nextArgument();
+ if (isValidArg(arg)) {
+ if (arg.equals("-excludeBaselineTxs")) {
+ options.put(ImportOptions.EXCLUDE_BASELINE_TXS.name(), true);
+ } else if (arg.equals("-clean")) {
+ options.put(ImportOptions.CLEAN_BEFORE_IMPORT.name(), true);
+ } else if (arg.equals("-allAsRootBranches")) {
+ options.put(ImportOptions.ALL_AS_ROOT_BRANCHES.name(), true);
+ } else if (arg.equals("-minTx")) {
+ arg = getCommandInterpreter().nextArgument();
+ if (isValidArg(arg)) {
+ options.put(ImportOptions.MIN_TXS.name(), arg);
+ }
+ count++;
+ } else if (arg.equals("-maxTx")) {
+ arg = getCommandInterpreter().nextArgument();
+ if (isValidArg(arg)) {
+ options.put(ImportOptions.MAX_TXS.name(), arg);
+ }
+ count++;
+ } else if (count == 0 && !arg.startsWith("-")) {
+ importFiles.add(new File(arg));
+ } else {
+ branchIds.add(new Integer(arg));
+ }
+ count++;
+ }
+ } while (isValidArg(arg));
+
+ if (importFiles.isEmpty()) {
+ throw new IllegalArgumentException("Files to import were not specified");
+ }
+
+ for (File file : importFiles) {
+ if (file == null || !file.exists() || !file.canRead()) {
+ throw new IllegalArgumentException(String.format("File was not accessible: [%s]", file));
+ } else if (file.isFile() && !Lib.isCompressed(file)) {
+ throw new IllegalArgumentException(String.format("Invalid File: [%s]", file));
+ }
+ }
+
+ for (File fileToImport : importFiles) {
+ URI uri = new URI("exchange://" + fileToImport.toURI().toASCIIString());
+ Activator.getInstance().getBranchExchange().importBranch(new ResourceLocator(uri), options, branchIds);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/ExchangeIntegrityWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/ExchangeIntegrityWorker.java
index ce0de96547b..c0fb906c090 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/ExchangeIntegrityWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/branch/ExchangeIntegrityWorker.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * 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.server.admin.branch;
-
-import java.io.File;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.resource.management.util.ResourceLocator;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ExchangeIntegrityWorker extends BaseServerCommand {
-
- protected ExchangeIntegrityWorker() {
- super("Verify Exchange File");
- }
-
- private boolean isValidArg(String arg) {
- return arg != null && arg.length() > 0;
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- String arg = null;
- int count = 0;
- List<File> importFiles = new ArrayList<File>();
- do {
- arg = getCommandInterpreter().nextArgument();
- if (isValidArg(arg)) {
- if (count == 0 && !arg.startsWith("-")) {
- importFiles.add(new File(arg));
- }
- count++;
- }
- } while (isValidArg(arg));
-
- if (importFiles.isEmpty()) {
- throw new IllegalArgumentException("File to check was not specified");
- }
-
- for (File file : importFiles) {
- if (file == null || !file.exists() || !file.canRead()) {
- throw new IllegalArgumentException(String.format("File was not accessible: [%s]", file));
- } else if (file.isFile() && !Lib.isCompressed(file)) {
- throw new IllegalArgumentException(String.format("Invalid File: [%s]", file));
- }
- }
-
- for (File fileToImport : importFiles) {
- URI uri = new URI("exchange://" + fileToImport.toURI().toASCIIString());
- Activator.getInstance().getBranchExchange().checkIntegrity(new ResourceLocator(uri));
- }
- }
-}
+/*******************************************************************************
+ * 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.server.admin.branch;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.resource.management.util.ResourceLocator;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExchangeIntegrityWorker extends BaseServerCommand {
+
+ protected ExchangeIntegrityWorker() {
+ super("Verify Exchange File");
+ }
+
+ private boolean isValidArg(String arg) {
+ return arg != null && arg.length() > 0;
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ String arg = null;
+ int count = 0;
+ List<File> importFiles = new ArrayList<File>();
+ do {
+ arg = getCommandInterpreter().nextArgument();
+ if (isValidArg(arg)) {
+ if (count == 0 && !arg.startsWith("-")) {
+ importFiles.add(new File(arg));
+ }
+ count++;
+ }
+ } while (isValidArg(arg));
+
+ if (importFiles.isEmpty()) {
+ throw new IllegalArgumentException("File to check was not specified");
+ }
+
+ for (File file : importFiles) {
+ if (file == null || !file.exists() || !file.canRead()) {
+ throw new IllegalArgumentException(String.format("File was not accessible: [%s]", file));
+ } else if (file.isFile() && !Lib.isCompressed(file)) {
+ throw new IllegalArgumentException(String.format("Invalid File: [%s]", file));
+ }
+ }
+
+ for (File fileToImport : importFiles) {
+ URI uri = new URI("exchange://" + fileToImport.toURI().toASCIIString());
+ Activator.getInstance().getBranchExchange().checkIntegrity(new ResourceLocator(uri));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java
index 9e847919c00..76f29255d97 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java
@@ -1,232 +1,232 @@
-/*******************************************************************************
- * 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.server.admin.conversion;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URLEncoder;
-import java.util.Map;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.resource.management.IResource;
-import org.eclipse.osee.framework.resource.management.IResourceLocator;
-import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
-import org.eclipse.osee.framework.resource.management.IResourceManager;
-import org.eclipse.osee.framework.resource.management.Options;
-import org.eclipse.osee.framework.resource.management.StandardOptions;
-import org.eclipse.osee.framework.resource.management.util.Resources;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CompressedContentFix {
-
- private static CompressedContentFix instance = null;
-
- private static final String FIND_ALL_NATIVE_CONTENT_SQL =
- "SELECT art1.art_id, art1.human_readable_id, art1.guid, attr1.uri FROM osee_attribute attr1, osee_attribute_type attyp1, osee_artifact art1 WHERE attyp1.NAME = 'Native Content' AND attyp1.attr_type_id = attr1.attr_type_id AND art1.ART_ID = attr1.ART_ID";
-
- public static CompressedContentFix getInstance() {
- if (instance == null) {
- instance = new CompressedContentFix();
- }
- return instance;
- }
-
- private volatile boolean execute;
- private volatile boolean isRunning = false;
- private volatile boolean verbose = true;
-
- private CompressedContentFix() {
- }
-
- public void executeStop(CommandInterpreter ci) {
- execute = false;
- }
-
- public void execute(CommandInterpreter ci) {
- if (!isRunning) {
- execute = true;
- isRunning = true;
- Thread th = new Thread(new Worker(ci));
- th.setName("CompressedContentFix");
- th.start();
- }
- }
-
- private class Worker implements Runnable {
-
- private final CommandInterpreter ci;
- private final IResourceManager resourceManager;
- private final IResourceLocatorManager locatorManager;
- private Map<Long, String> nativeExtension;
- private Map<Long, String> nameMap;
-
- private Worker(CommandInterpreter cmdi) {
- ci = cmdi;
- resourceManager = Activator.getInstance().getResourceManager();
- locatorManager = Activator.getInstance().getResourceLocatorManager();
- nativeExtension = null;
- nameMap = null;
- }
-
- @Override
- public void run() {
- long time = System.currentTimeMillis();
- try {
- initializeData();
- doWork(time);
- } catch (OseeDataStoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- } finally {
- clear();
- }
- long seconds = (System.currentTimeMillis() - time) / 1000;
- long leftOverSeconds = seconds % 60;
- long minutes = seconds / 60;
- long leftOverMinutes = minutes % 60;
- long hours = minutes / 60;
- ci.println(String.format("Done. Elapsed Time = %d:%02d:%02d.", hours, leftOverMinutes, leftOverSeconds));
- isRunning = false;
- }
-
- private void initializeData() throws OseeDataStoreException {
- nativeExtension = Util.getArtIdMap("Extension");
- nameMap = Util.getArtIdMap("Name");
- }
-
- private void clear() {
- if (nativeExtension != null) {
- nativeExtension.clear();
- nativeExtension = null;
- }
-
- if (nameMap != null) {
- nameMap.clear();
- nameMap = null;
- }
- }
-
- private void processEntry(long artId, String hrid, String guid, String uri) throws Exception {
- boolean resourceExists = isResourceAvailable(uri);
- if (resourceExists) {
- IResourceLocator locator = locatorManager.getResourceLocator(uri);
- Options options = new Options();
- IResource resource = resourceManager.acquire(locator, options);
-
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- String oldEntryName = getContent(resource, outputStream);
- String extension = nativeExtension.get(artId);
- String newEntryName = generateFileName(nameMap.get(artId), hrid, extension);
-
- byte[] compressed = Lib.compressStream(new ByteArrayInputStream(outputStream.toByteArray()), newEntryName);
- IResource modifiedResource =
- Resources.createResourceFromBytes(compressed, locator.getLocation().toASCIIString(), true);
- options.put(StandardOptions.Overwrite.name(), true);
- resourceManager.save(locator, modifiedResource, options);
-
- ci.println(String.format("hrid [%s] uri [%s] fileName[%s] newName[%s] extension[%s]", hrid, uri,
- oldEntryName, newEntryName, extension));
- }
- }
-
- public String generateFileName(String name, String hrid, String fileTypeExtension) {
- StringBuilder builder = new StringBuilder();
- if (name != null && name.length() > 0) {
- try {
- if (name.length() > 60) {
- name = name.substring(0, 60);
- }
- builder.append(URLEncoder.encode(name, "UTF-8"));
- builder.append(".");
- } catch (Exception ex) {
- // Do Nothing - this is not important
- }
- }
- builder.append(hrid);
-
- if (fileTypeExtension != null && fileTypeExtension.length() > 0) {
- builder.append(".");
- builder.append(fileTypeExtension);
- }
- return builder.toString();
- }
-
- private String getContent(IResource resource, OutputStream outputStream) throws OseeCoreException {
- String name = null;
- InputStream inputStream = null;
- try {
- inputStream = resource.getContent();
- name = Lib.decompressStream(inputStream, outputStream);
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- Lib.close(inputStream);
- }
- return name;
- }
-
- private boolean isResourceAvailable(String uri) throws Exception {
- boolean resourceExists = false;
- if (uri != null && uri.length() > 0) {
- IResourceLocator locator = locatorManager.getResourceLocator(uri);
- resourceExists = resourceManager.exists(locator);
- }
- return resourceExists;
- }
-
- private void doWork(long time) {
- IOseeStatement chStmt = null;
- try {
- chStmt = ConnectionHandler.getStatement();
- chStmt.runPreparedQuery(FIND_ALL_NATIVE_CONTENT_SQL);
- int count = 0;
- while (chStmt.next() && execute) {
- long artId = chStmt.getLong("art_id");
- String hrid = chStmt.getString("human_readable_id");
- String guid = chStmt.getString("guid");
- String uri = chStmt.getString("uri");
- processEntry(artId, hrid, guid, uri);
-
- count++;
- if (count % 100 == 0) {
- if (verbose) {
- long seconds = (System.currentTimeMillis() - time) / 1000;
- long leftOverSeconds = seconds % 60;
- long minutes = seconds / 60;
- long leftOverMinutes = minutes % 60;
- long hours = minutes / 60;
- ci.println(String.format("%d files processed, Elapsed Time = %d:%02d:%02d.", count, hours,
- leftOverMinutes, leftOverSeconds));
- }
- }
- }
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- } finally {
- if (chStmt != null) {
- chStmt.close();
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * 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.server.admin.conversion;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URLEncoder;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.resource.management.IResource;
+import org.eclipse.osee.framework.resource.management.IResourceLocator;
+import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
+import org.eclipse.osee.framework.resource.management.IResourceManager;
+import org.eclipse.osee.framework.resource.management.Options;
+import org.eclipse.osee.framework.resource.management.StandardOptions;
+import org.eclipse.osee.framework.resource.management.util.Resources;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CompressedContentFix {
+
+ private static CompressedContentFix instance = null;
+
+ private static final String FIND_ALL_NATIVE_CONTENT_SQL =
+ "SELECT art1.art_id, art1.human_readable_id, art1.guid, attr1.uri FROM osee_attribute attr1, osee_attribute_type attyp1, osee_artifact art1 WHERE attyp1.NAME = 'Native Content' AND attyp1.attr_type_id = attr1.attr_type_id AND art1.ART_ID = attr1.ART_ID";
+
+ public static CompressedContentFix getInstance() {
+ if (instance == null) {
+ instance = new CompressedContentFix();
+ }
+ return instance;
+ }
+
+ private volatile boolean execute;
+ private volatile boolean isRunning = false;
+ private volatile boolean verbose = true;
+
+ private CompressedContentFix() {
+ }
+
+ public void executeStop(CommandInterpreter ci) {
+ execute = false;
+ }
+
+ public void execute(CommandInterpreter ci) {
+ if (!isRunning) {
+ execute = true;
+ isRunning = true;
+ Thread th = new Thread(new Worker(ci));
+ th.setName("CompressedContentFix");
+ th.start();
+ }
+ }
+
+ private class Worker implements Runnable {
+
+ private final CommandInterpreter ci;
+ private final IResourceManager resourceManager;
+ private final IResourceLocatorManager locatorManager;
+ private Map<Long, String> nativeExtension;
+ private Map<Long, String> nameMap;
+
+ private Worker(CommandInterpreter cmdi) {
+ ci = cmdi;
+ resourceManager = Activator.getInstance().getResourceManager();
+ locatorManager = Activator.getInstance().getResourceLocatorManager();
+ nativeExtension = null;
+ nameMap = null;
+ }
+
+ @Override
+ public void run() {
+ long time = System.currentTimeMillis();
+ try {
+ initializeData();
+ doWork(time);
+ } catch (OseeDataStoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ } finally {
+ clear();
+ }
+ long seconds = (System.currentTimeMillis() - time) / 1000;
+ long leftOverSeconds = seconds % 60;
+ long minutes = seconds / 60;
+ long leftOverMinutes = minutes % 60;
+ long hours = minutes / 60;
+ ci.println(String.format("Done. Elapsed Time = %d:%02d:%02d.", hours, leftOverMinutes, leftOverSeconds));
+ isRunning = false;
+ }
+
+ private void initializeData() throws OseeDataStoreException {
+ nativeExtension = Util.getArtIdMap("Extension");
+ nameMap = Util.getArtIdMap("Name");
+ }
+
+ private void clear() {
+ if (nativeExtension != null) {
+ nativeExtension.clear();
+ nativeExtension = null;
+ }
+
+ if (nameMap != null) {
+ nameMap.clear();
+ nameMap = null;
+ }
+ }
+
+ private void processEntry(long artId, String hrid, String guid, String uri) throws Exception {
+ boolean resourceExists = isResourceAvailable(uri);
+ if (resourceExists) {
+ IResourceLocator locator = locatorManager.getResourceLocator(uri);
+ Options options = new Options();
+ IResource resource = resourceManager.acquire(locator, options);
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ String oldEntryName = getContent(resource, outputStream);
+ String extension = nativeExtension.get(artId);
+ String newEntryName = generateFileName(nameMap.get(artId), hrid, extension);
+
+ byte[] compressed = Lib.compressStream(new ByteArrayInputStream(outputStream.toByteArray()), newEntryName);
+ IResource modifiedResource =
+ Resources.createResourceFromBytes(compressed, locator.getLocation().toASCIIString(), true);
+ options.put(StandardOptions.Overwrite.name(), true);
+ resourceManager.save(locator, modifiedResource, options);
+
+ ci.println(String.format("hrid [%s] uri [%s] fileName[%s] newName[%s] extension[%s]", hrid, uri,
+ oldEntryName, newEntryName, extension));
+ }
+ }
+
+ public String generateFileName(String name, String hrid, String fileTypeExtension) {
+ StringBuilder builder = new StringBuilder();
+ if (name != null && name.length() > 0) {
+ try {
+ if (name.length() > 60) {
+ name = name.substring(0, 60);
+ }
+ builder.append(URLEncoder.encode(name, "UTF-8"));
+ builder.append(".");
+ } catch (Exception ex) {
+ // Do Nothing - this is not important
+ }
+ }
+ builder.append(hrid);
+
+ if (fileTypeExtension != null && fileTypeExtension.length() > 0) {
+ builder.append(".");
+ builder.append(fileTypeExtension);
+ }
+ return builder.toString();
+ }
+
+ private String getContent(IResource resource, OutputStream outputStream) throws OseeCoreException {
+ String name = null;
+ InputStream inputStream = null;
+ try {
+ inputStream = resource.getContent();
+ name = Lib.decompressStream(inputStream, outputStream);
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ } finally {
+ Lib.close(inputStream);
+ }
+ return name;
+ }
+
+ private boolean isResourceAvailable(String uri) throws Exception {
+ boolean resourceExists = false;
+ if (uri != null && uri.length() > 0) {
+ IResourceLocator locator = locatorManager.getResourceLocator(uri);
+ resourceExists = resourceManager.exists(locator);
+ }
+ return resourceExists;
+ }
+
+ private void doWork(long time) {
+ IOseeStatement chStmt = null;
+ try {
+ chStmt = ConnectionHandler.getStatement();
+ chStmt.runPreparedQuery(FIND_ALL_NATIVE_CONTENT_SQL);
+ int count = 0;
+ while (chStmt.next() && execute) {
+ long artId = chStmt.getLong("art_id");
+ String hrid = chStmt.getString("human_readable_id");
+ String guid = chStmt.getString("guid");
+ String uri = chStmt.getString("uri");
+ processEntry(artId, hrid, guid, uri);
+
+ count++;
+ if (count % 100 == 0) {
+ if (verbose) {
+ long seconds = (System.currentTimeMillis() - time) / 1000;
+ long leftOverSeconds = seconds % 60;
+ long minutes = seconds / 60;
+ long leftOverMinutes = minutes % 60;
+ long hours = minutes / 60;
+ ci.println(String.format("%d files processed, Elapsed Time = %d:%02d:%02d.", count, hours,
+ leftOverMinutes, leftOverSeconds));
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ } finally {
+ if (chStmt != null) {
+ chStmt.close();
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/DbResource.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/DbResource.java
index 00b37a136eb..a28781845db 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/DbResource.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/DbResource.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.server.admin.conversion;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLEncoder;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.resource.management.IResource;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class DbResource implements IResource {
-
- // private String name = "unknown";
- private final InputStream inputStream;
- private boolean isCompressed = false;
- private URI uri;
- private final String hrid;
- private final String artName;
- private final String fileTypeExtension;
-
- /**
- * @param binaryStream
- */
- public DbResource(InputStream inputStream, String artName, String hrid, String fileTypeExtension) {
- this.hrid = hrid;
- this.artName = artName;
- this.fileTypeExtension = fileTypeExtension;
- this.inputStream = inputStream;
- try {
- uri = new URI("db://");
- } catch (URISyntaxException ex1) {
- }
- if (inputStream.markSupported()) {
- inputStream.mark(1000);
- ZipInputStream in = new ZipInputStream(inputStream);
- // find out if it was compressed
- try {
- ZipEntry entry = in.getNextEntry();
- if (entry == null) {
- isCompressed = false;
- } else {
- // name = entry.getName();
- isCompressed = true;
- }
- } catch (IOException ex) {
- isCompressed = false;
- }
- try {
- inputStream.reset();
- } catch (IOException ex) {
- }
- }
- }
-
- @Override
- public InputStream getContent() throws OseeCoreException {
- return inputStream;
- }
-
- @Override
- public URI getLocation() {
- return uri;
- }
-
- @Override
- public String getName() {
- return generateFileName(artName, hrid, fileTypeExtension);
- }
-
- @Override
- public boolean isCompressed() {
- return isCompressed;
- }
-
- private String generateFileName(String artName, String hrid, String fileTypeExtension) {
- StringBuilder builder = new StringBuilder();
- try {
- builder.append(URLEncoder.encode(artName, "UTF-8"));
- builder.append(".");
- } catch (Exception ex) {
- // Do Nothing - this is not important
- }
- builder.append(hrid);
-
- if (fileTypeExtension != null && fileTypeExtension.length() > 0) {
- builder.append(".");
- builder.append(fileTypeExtension);
- }
- return builder.toString();
- }
-}
+/*******************************************************************************
+ * 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.server.admin.conversion;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLEncoder;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.resource.management.IResource;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class DbResource implements IResource {
+
+ // private String name = "unknown";
+ private final InputStream inputStream;
+ private boolean isCompressed = false;
+ private URI uri;
+ private final String hrid;
+ private final String artName;
+ private final String fileTypeExtension;
+
+ /**
+ * @param binaryStream
+ */
+ public DbResource(InputStream inputStream, String artName, String hrid, String fileTypeExtension) {
+ this.hrid = hrid;
+ this.artName = artName;
+ this.fileTypeExtension = fileTypeExtension;
+ this.inputStream = inputStream;
+ try {
+ uri = new URI("db://");
+ } catch (URISyntaxException ex1) {
+ }
+ if (inputStream.markSupported()) {
+ inputStream.mark(1000);
+ ZipInputStream in = new ZipInputStream(inputStream);
+ // find out if it was compressed
+ try {
+ ZipEntry entry = in.getNextEntry();
+ if (entry == null) {
+ isCompressed = false;
+ } else {
+ // name = entry.getName();
+ isCompressed = true;
+ }
+ } catch (IOException ex) {
+ isCompressed = false;
+ }
+ try {
+ inputStream.reset();
+ } catch (IOException ex) {
+ }
+ }
+ }
+
+ @Override
+ public InputStream getContent() throws OseeCoreException {
+ return inputStream;
+ }
+
+ @Override
+ public URI getLocation() {
+ return uri;
+ }
+
+ @Override
+ public String getName() {
+ return generateFileName(artName, hrid, fileTypeExtension);
+ }
+
+ @Override
+ public boolean isCompressed() {
+ return isCompressed;
+ }
+
+ private String generateFileName(String artName, String hrid, String fileTypeExtension) {
+ StringBuilder builder = new StringBuilder();
+ try {
+ builder.append(URLEncoder.encode(artName, "UTF-8"));
+ builder.append(".");
+ } catch (Exception ex) {
+ // Do Nothing - this is not important
+ }
+ builder.append(hrid);
+
+ if (fileTypeExtension != null && fileTypeExtension.length() > 0) {
+ builder.append(".");
+ builder.append(fileTypeExtension);
+ }
+ return builder.toString();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/Util.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/Util.java
index 23e93f3abbd..71069669dec 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/Util.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/Util.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.server.admin.conversion;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-
-/**
- * @author Roberto E. Escobar
- */
-public class Util {
-
- private static final String sqlExtensionTypeId =
- "Select attrt1.ATTR_TYPE_ID from osee_attribute_type attrt1 where name = ?";
-
- private static final String sqlExtensionTypes =
- "SELECT attr1.art_id, attr1.value FROM osee_attribute attr1 WHERE attr1.ATTR_TYPE_ID = ?";
-
- public static Map<Long, String> getArtIdMap(String attrTypeName) throws OseeDataStoreException {
- Map<Long, String> toReturn = new HashMap<Long, String>(250);
-
- IOseeStatement chStmt = ConnectionHandler.getStatement();
- try {
- int typeId = ConnectionHandler.runPreparedQueryFetchInt(-1, sqlExtensionTypeId, attrTypeName);
- chStmt.runPreparedQuery(sqlExtensionTypes, typeId);
- while (chStmt.next()) {
- toReturn.put(chStmt.getLong("art_id"), chStmt.getString("value"));
- }
- } finally {
- chStmt.close();
- }
- return toReturn;
- }
-}
+/*******************************************************************************
+ * 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.server.admin.conversion;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class Util {
+
+ private static final String sqlExtensionTypeId =
+ "Select attrt1.ATTR_TYPE_ID from osee_attribute_type attrt1 where name = ?";
+
+ private static final String sqlExtensionTypes =
+ "SELECT attr1.art_id, attr1.value FROM osee_attribute attr1 WHERE attr1.ATTR_TYPE_ID = ?";
+
+ public static Map<Long, String> getArtIdMap(String attrTypeName) throws OseeDataStoreException {
+ Map<Long, String> toReturn = new HashMap<Long, String>(250);
+
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ int typeId = ConnectionHandler.runPreparedQueryFetchInt(-1, sqlExtensionTypeId, attrTypeName);
+ chStmt.runPreparedQuery(sqlExtensionTypes, typeId);
+ while (chStmt.next()) {
+ toReturn.put(chStmt.getLong("art_id"), chStmt.getString("value"));
+ }
+ } finally {
+ chStmt.close();
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/internal/Activator.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/internal/Activator.java
index 0ecc8849872..2a5deb583db 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/internal/Activator.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/internal/Activator.java
@@ -1,116 +1,116 @@
-/*******************************************************************************
- * 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.server.admin.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.osee.framework.branch.management.IBranchExchange;
-import org.eclipse.osee.framework.core.enums.OseeServiceTrackerId;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.server.ISessionManager;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
-import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
-import org.eclipse.osee.framework.resource.management.IResourceManager;
-import org.eclipse.osee.framework.search.engine.ISearchEngine;
-import org.eclipse.osee.framework.search.engine.ISearchEngineTagger;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class Activator implements BundleActivator, IOseeDatabaseServiceProvider {
- public static final String PLUGIN_ID = "org.eclipse.osee.framework.server.admin";
- private static Activator instance;
-
- private final Map<OseeServiceTrackerId, ServiceTracker> mappedTrackers;
-
- public Activator() {
- this.mappedTrackers = new HashMap<OseeServiceTrackerId, ServiceTracker>();
- }
-
- public void start(BundleContext context) throws Exception {
- instance = this;
-
- createServiceTracker(context, IResourceManager.class, OseeServiceTrackerId.RESOURCE_MANAGER);
- createServiceTracker(context, IResourceLocatorManager.class, OseeServiceTrackerId.RESOURCE_LOCATOR);
- createServiceTracker(context, ISearchEngineTagger.class, OseeServiceTrackerId.SEARCH_TAGGER);
- createServiceTracker(context, ISearchEngine.class, OseeServiceTrackerId.SEARCH_ENGINE);
- createServiceTracker(context, IBranchExchange.class, OseeServiceTrackerId.BRANCH_EXCHANGE);
- createServiceTracker(context, IOseeCachingService.class, OseeServiceTrackerId.OSEE_CACHING_SERVICE);
- createServiceTracker(context, IOseeDatabaseService.class, OseeServiceTrackerId.OSEE_DATABASE_SERVICE);
- createServiceTracker(context, IApplicationServerManager.class, OseeServiceTrackerId.APPLICATION_MANAGER);
- createServiceTracker(context, ISessionManager.class, OseeServiceTrackerId.SESSION_MANAGER);
- }
-
- public void stop(BundleContext context) throws Exception {
- for (ServiceTracker tracker : mappedTrackers.values()) {
- tracker.close();
- }
- mappedTrackers.clear();
-
- instance = null;
- }
-
- @Override
- public IOseeDatabaseService getOseeDatabaseService() throws OseeDataStoreException {
- return getTracker(OseeServiceTrackerId.OSEE_DATABASE_SERVICE, IOseeDatabaseService.class);
- }
-
- private void createServiceTracker(BundleContext context, Class<?> clazz, OseeServiceTrackerId trackerId) {
- ServiceTracker tracker = new ServiceTracker(context, clazz.getName(), null);
- tracker.open();
- mappedTrackers.put(trackerId, tracker);
- }
-
- public IBranchExchange getBranchExchange() {
- return getTracker(OseeServiceTrackerId.BRANCH_EXCHANGE, IBranchExchange.class);
- }
-
- public IResourceManager getResourceManager() {
- return getTracker(OseeServiceTrackerId.RESOURCE_MANAGER, IResourceManager.class);
- }
-
- public IResourceLocatorManager getResourceLocatorManager() {
- return getTracker(OseeServiceTrackerId.RESOURCE_LOCATOR, IResourceLocatorManager.class);
- }
-
- public ISearchEngineTagger getSearchTagger() {
- return getTracker(OseeServiceTrackerId.SEARCH_TAGGER, ISearchEngineTagger.class);
- }
-
- public ISearchEngine getSearchEngine() {
- return getTracker(OseeServiceTrackerId.SEARCH_ENGINE, ISearchEngine.class);
- }
-
- public IOseeCachingService getOseeCachingService() {
- return getTracker(OseeServiceTrackerId.OSEE_CACHING_SERVICE, IOseeCachingService.class);
- }
-
- public IApplicationServerManager getApplicationServerManager() {
- return getTracker(OseeServiceTrackerId.APPLICATION_MANAGER, IApplicationServerManager.class);
- }
-
- public ISessionManager getSessionManager() {
- return getTracker(OseeServiceTrackerId.SESSION_MANAGER, ISessionManager.class);
- }
-
- private <T> T getTracker(OseeServiceTrackerId trackerId, Class<T> clazz) {
- ServiceTracker tracker = mappedTrackers.get(trackerId);
- Object service = tracker.getService();
- return clazz.cast(service);
- }
-
- public static Activator getInstance() {
- return Activator.instance;
- }
-}
+/*******************************************************************************
+ * 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.server.admin.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.osee.framework.branch.management.IBranchExchange;
+import org.eclipse.osee.framework.core.enums.OseeServiceTrackerId;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.core.server.IApplicationServerManager;
+import org.eclipse.osee.framework.core.server.ISessionManager;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.IOseeDatabaseServiceProvider;
+import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
+import org.eclipse.osee.framework.resource.management.IResourceManager;
+import org.eclipse.osee.framework.search.engine.ISearchEngine;
+import org.eclipse.osee.framework.search.engine.ISearchEngineTagger;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator, IOseeDatabaseServiceProvider {
+ public static final String PLUGIN_ID = "org.eclipse.osee.framework.server.admin";
+ private static Activator instance;
+
+ private final Map<OseeServiceTrackerId, ServiceTracker> mappedTrackers;
+
+ public Activator() {
+ this.mappedTrackers = new HashMap<OseeServiceTrackerId, ServiceTracker>();
+ }
+
+ public void start(BundleContext context) throws Exception {
+ instance = this;
+
+ createServiceTracker(context, IResourceManager.class, OseeServiceTrackerId.RESOURCE_MANAGER);
+ createServiceTracker(context, IResourceLocatorManager.class, OseeServiceTrackerId.RESOURCE_LOCATOR);
+ createServiceTracker(context, ISearchEngineTagger.class, OseeServiceTrackerId.SEARCH_TAGGER);
+ createServiceTracker(context, ISearchEngine.class, OseeServiceTrackerId.SEARCH_ENGINE);
+ createServiceTracker(context, IBranchExchange.class, OseeServiceTrackerId.BRANCH_EXCHANGE);
+ createServiceTracker(context, IOseeCachingService.class, OseeServiceTrackerId.OSEE_CACHING_SERVICE);
+ createServiceTracker(context, IOseeDatabaseService.class, OseeServiceTrackerId.OSEE_DATABASE_SERVICE);
+ createServiceTracker(context, IApplicationServerManager.class, OseeServiceTrackerId.APPLICATION_MANAGER);
+ createServiceTracker(context, ISessionManager.class, OseeServiceTrackerId.SESSION_MANAGER);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ for (ServiceTracker tracker : mappedTrackers.values()) {
+ tracker.close();
+ }
+ mappedTrackers.clear();
+
+ instance = null;
+ }
+
+ @Override
+ public IOseeDatabaseService getOseeDatabaseService() throws OseeDataStoreException {
+ return getTracker(OseeServiceTrackerId.OSEE_DATABASE_SERVICE, IOseeDatabaseService.class);
+ }
+
+ private void createServiceTracker(BundleContext context, Class<?> clazz, OseeServiceTrackerId trackerId) {
+ ServiceTracker tracker = new ServiceTracker(context, clazz.getName(), null);
+ tracker.open();
+ mappedTrackers.put(trackerId, tracker);
+ }
+
+ public IBranchExchange getBranchExchange() {
+ return getTracker(OseeServiceTrackerId.BRANCH_EXCHANGE, IBranchExchange.class);
+ }
+
+ public IResourceManager getResourceManager() {
+ return getTracker(OseeServiceTrackerId.RESOURCE_MANAGER, IResourceManager.class);
+ }
+
+ public IResourceLocatorManager getResourceLocatorManager() {
+ return getTracker(OseeServiceTrackerId.RESOURCE_LOCATOR, IResourceLocatorManager.class);
+ }
+
+ public ISearchEngineTagger getSearchTagger() {
+ return getTracker(OseeServiceTrackerId.SEARCH_TAGGER, ISearchEngineTagger.class);
+ }
+
+ public ISearchEngine getSearchEngine() {
+ return getTracker(OseeServiceTrackerId.SEARCH_ENGINE, ISearchEngine.class);
+ }
+
+ public IOseeCachingService getOseeCachingService() {
+ return getTracker(OseeServiceTrackerId.OSEE_CACHING_SERVICE, IOseeCachingService.class);
+ }
+
+ public IApplicationServerManager getApplicationServerManager() {
+ return getTracker(OseeServiceTrackerId.APPLICATION_MANAGER, IApplicationServerManager.class);
+ }
+
+ public ISessionManager getSessionManager() {
+ return getTracker(OseeServiceTrackerId.SESSION_MANAGER, ISessionManager.class);
+ }
+
+ private <T> T getTracker(OseeServiceTrackerId trackerId, Class<T> clazz) {
+ ServiceTracker tracker = mappedTrackers.get(trackerId);
+ Object service = tracker.getService();
+ return clazz.cast(service);
+ }
+
+ public static Activator getInstance() {
+ return Activator.instance;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AddServerVersionWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AddServerVersionWorker.java
index 20ba49eb485..52adb74f2c7 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AddServerVersionWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AddServerVersionWorker.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import java.util.Arrays;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AddServerVersionWorker extends BaseServerCommand {
-
- protected AddServerVersionWorker() {
- super("Add Version");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- String versionToAdd = getCommandInterpreter().nextArgument();
- Activator.getInstance().getApplicationServerManager().addSupportedVersion(versionToAdd);
- StringBuffer buffer = new StringBuffer();
- buffer.append("Osee Application Server: ");
- buffer.append(Arrays.deepToString(Activator.getInstance().getApplicationServerManager().getSupportedVersions()));
- buffer.append("\n");
- println(buffer.toString());
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import java.util.Arrays;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AddServerVersionWorker extends BaseServerCommand {
+
+ protected AddServerVersionWorker() {
+ super("Add Version");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ String versionToAdd = getCommandInterpreter().nextArgument();
+ Activator.getInstance().getApplicationServerManager().addSupportedVersion(versionToAdd);
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Osee Application Server: ");
+ buffer.append(Arrays.deepToString(Activator.getInstance().getApplicationServerManager().getSupportedVersions()));
+ buffer.append("\n");
+ println(buffer.toString());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AdminCommands.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AdminCommands.java
index e62e392e3bc..a36d2d0a96d 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AdminCommands.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/AdminCommands.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AdminCommands {
-
- private ServerShutdownWorker shutdownWorker;
- private final RemoveServerVersionWorker removeServerVersion;
- private final AddServerVersionWorker addServerVersion;
- private final ReloadCachesWorker reloadCacheWorker;
- private final ClearCachesWorker clearCacheWorker;
-
- public AdminCommands() {
- this.addServerVersion = new AddServerVersionWorker();
- this.addServerVersion.setExecutionAllowed(true);
-
- this.removeServerVersion = new RemoveServerVersionWorker();
- this.removeServerVersion.setExecutionAllowed(true);
-
- this.reloadCacheWorker = new ReloadCachesWorker();
- this.reloadCacheWorker.setExecutionAllowed(true);
-
- this.clearCacheWorker = new ClearCachesWorker();
- this.clearCacheWorker.setExecutionAllowed(true);
- }
-
- public void getServerStatus(CommandInterpreter ci) {
- Operations.executeAsJob(new ServerStats(ci), false);
- }
-
- public void getServerVersion(CommandInterpreter ci) {
- GetServerVersionWorker serverVersion = new GetServerVersionWorker();
- serverVersion.setCommandInterpreter(ci);
- serverVersion.setExecutionAllowed(true);
- Operations.executeAsJob(serverVersion, false);
- }
-
- public void reloadCache(CommandInterpreter ci) {
- if (!this.clearCacheWorker.isRunning() && !this.reloadCacheWorker.isRunning()) {
- this.reloadCacheWorker.setCommandInterpreter(ci);
- Operations.executeAsJob(reloadCacheWorker, false);
- } else {
- if (clearCacheWorker.isRunning()) {
- ci.println("Waiting for clear cache to complete");
- }
- if (reloadCacheWorker.isRunning()) {
- ci.println("Waiting for reload cache to complete");
- }
- }
- }
-
- public void clearCache(CommandInterpreter ci) {
- if (!this.clearCacheWorker.isRunning() && !this.reloadCacheWorker.isRunning()) {
- this.clearCacheWorker.setCommandInterpreter(ci);
- Operations.executeAsJob(clearCacheWorker, false);
- } else {
- if (clearCacheWorker.isRunning()) {
- ci.println("Waiting for clear cache to complete");
- }
- if (reloadCacheWorker.isRunning()) {
- ci.println("Waiting for reload cache to complete");
- }
- }
- }
-
- public void addServerVersion(CommandInterpreter ci) {
- if (!this.removeServerVersion.isRunning()) {
- this.addServerVersion.setCommandInterpreter(ci);
- Operations.executeAsJob(addServerVersion, false);
- } else {
- ci.println("Waiting for remove server version");
- }
- }
-
- public void removeServerVersion(CommandInterpreter ci) {
- if (!this.addServerVersion.isRunning()) {
- this.removeServerVersion.setCommandInterpreter(ci);
- Operations.executeAsJob(removeServerVersion, false);
- } else {
- ci.println("Waiting for add server version");
- }
- }
-
- public void oseeShutdown(CommandInterpreter ci) {
- if (shutdownWorker == null) {
- this.shutdownWorker = new ServerShutdownWorker(ci);
- Operations.executeAsJob(shutdownWorker, false);
- } else {
- ci.println("Waiting for shutdown");
- }
- }
-
- public void setServletRequestProcessing(CommandInterpreter ci) {
- ServerRequestsWorker worker = new ServerRequestsWorker();
- worker.setCommandInterpreter(ci);
- worker.setExecutionAllowed(true);
- Operations.executeAsJob(worker, false);
- }
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AdminCommands {
+
+ private ServerShutdownWorker shutdownWorker;
+ private final RemoveServerVersionWorker removeServerVersion;
+ private final AddServerVersionWorker addServerVersion;
+ private final ReloadCachesWorker reloadCacheWorker;
+ private final ClearCachesWorker clearCacheWorker;
+
+ public AdminCommands() {
+ this.addServerVersion = new AddServerVersionWorker();
+ this.addServerVersion.setExecutionAllowed(true);
+
+ this.removeServerVersion = new RemoveServerVersionWorker();
+ this.removeServerVersion.setExecutionAllowed(true);
+
+ this.reloadCacheWorker = new ReloadCachesWorker();
+ this.reloadCacheWorker.setExecutionAllowed(true);
+
+ this.clearCacheWorker = new ClearCachesWorker();
+ this.clearCacheWorker.setExecutionAllowed(true);
+ }
+
+ public void getServerStatus(CommandInterpreter ci) {
+ Operations.executeAsJob(new ServerStats(ci), false);
+ }
+
+ public void getServerVersion(CommandInterpreter ci) {
+ GetServerVersionWorker serverVersion = new GetServerVersionWorker();
+ serverVersion.setCommandInterpreter(ci);
+ serverVersion.setExecutionAllowed(true);
+ Operations.executeAsJob(serverVersion, false);
+ }
+
+ public void reloadCache(CommandInterpreter ci) {
+ if (!this.clearCacheWorker.isRunning() && !this.reloadCacheWorker.isRunning()) {
+ this.reloadCacheWorker.setCommandInterpreter(ci);
+ Operations.executeAsJob(reloadCacheWorker, false);
+ } else {
+ if (clearCacheWorker.isRunning()) {
+ ci.println("Waiting for clear cache to complete");
+ }
+ if (reloadCacheWorker.isRunning()) {
+ ci.println("Waiting for reload cache to complete");
+ }
+ }
+ }
+
+ public void clearCache(CommandInterpreter ci) {
+ if (!this.clearCacheWorker.isRunning() && !this.reloadCacheWorker.isRunning()) {
+ this.clearCacheWorker.setCommandInterpreter(ci);
+ Operations.executeAsJob(clearCacheWorker, false);
+ } else {
+ if (clearCacheWorker.isRunning()) {
+ ci.println("Waiting for clear cache to complete");
+ }
+ if (reloadCacheWorker.isRunning()) {
+ ci.println("Waiting for reload cache to complete");
+ }
+ }
+ }
+
+ public void addServerVersion(CommandInterpreter ci) {
+ if (!this.removeServerVersion.isRunning()) {
+ this.addServerVersion.setCommandInterpreter(ci);
+ Operations.executeAsJob(addServerVersion, false);
+ } else {
+ ci.println("Waiting for remove server version");
+ }
+ }
+
+ public void removeServerVersion(CommandInterpreter ci) {
+ if (!this.addServerVersion.isRunning()) {
+ this.removeServerVersion.setCommandInterpreter(ci);
+ Operations.executeAsJob(removeServerVersion, false);
+ } else {
+ ci.println("Waiting for add server version");
+ }
+ }
+
+ public void oseeShutdown(CommandInterpreter ci) {
+ if (shutdownWorker == null) {
+ this.shutdownWorker = new ServerShutdownWorker(ci);
+ Operations.executeAsJob(shutdownWorker, false);
+ } else {
+ ci.println("Waiting for shutdown");
+ }
+ }
+
+ public void setServletRequestProcessing(CommandInterpreter ci) {
+ ServerRequestsWorker worker = new ServerRequestsWorker();
+ worker.setCommandInterpreter(ci);
+ worker.setExecutionAllowed(true);
+ Operations.executeAsJob(worker, false);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ClearCachesWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ClearCachesWorker.java
index 0cb18ff0089..334617ed1c4 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ClearCachesWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ClearCachesWorker.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.server.admin.management;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ClearCachesWorker extends BaseServerCommand {
-
- protected ClearCachesWorker() {
- super("Clear Cache(s)");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- IOseeCachingService service = Activator.getInstance().getOseeCachingService();
- Collection<OseeCacheEnum> cacheIds = getSelectedCaches();
- if (cacheIds.isEmpty()) {
- service.clearAll();
- println(String.format("Cleared the following caches: %s",
- Arrays.deepToString(OseeCacheEnum.values()).replaceAll(", SESSION_CACHE", "")));
- } else {
- for (OseeCacheEnum cacheId : cacheIds) {
- service.getCache(cacheId).decacheAll();
- }
- println(String.format("Cleared %s", cacheIds));
- }
- }
-
- private Collection<OseeCacheEnum> getSelectedCaches() {
- Set<OseeCacheEnum> caches = new HashSet<OseeCacheEnum>();
-
- boolean hasArgument = true;
- while (hasArgument) {
- String value = getCommandInterpreter().nextArgument();
- if (Strings.isValid(value)) {
- caches.add(OseeCacheEnum.valueOf(value));
- } else {
- hasArgument = false;
- }
- }
- return caches;
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ClearCachesWorker extends BaseServerCommand {
+
+ protected ClearCachesWorker() {
+ super("Clear Cache(s)");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ IOseeCachingService service = Activator.getInstance().getOseeCachingService();
+ Collection<OseeCacheEnum> cacheIds = getSelectedCaches();
+ if (cacheIds.isEmpty()) {
+ service.clearAll();
+ println(String.format("Cleared the following caches: %s",
+ Arrays.deepToString(OseeCacheEnum.values()).replaceAll(", SESSION_CACHE", "")));
+ } else {
+ for (OseeCacheEnum cacheId : cacheIds) {
+ service.getCache(cacheId).decacheAll();
+ }
+ println(String.format("Cleared %s", cacheIds));
+ }
+ }
+
+ private Collection<OseeCacheEnum> getSelectedCaches() {
+ Set<OseeCacheEnum> caches = new HashSet<OseeCacheEnum>();
+
+ boolean hasArgument = true;
+ while (hasArgument) {
+ String value = getCommandInterpreter().nextArgument();
+ if (Strings.isValid(value)) {
+ caches.add(OseeCacheEnum.valueOf(value));
+ } else {
+ hasArgument = false;
+ }
+ }
+ return caches;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ConsolidateArtifactVersionsCommand.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ConsolidateArtifactVersionsCommand.java
index 8998b66064f..a5a2ba42541 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ConsolidateArtifactVersionsCommand.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ConsolidateArtifactVersionsCommand.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.operation.CommandInterpreterReporter;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.database.operation.ConsolidateArtifactVersionTxOperation;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Ryan D. Brooks
- */
-public class ConsolidateArtifactVersionsCommand extends BaseServerCommand {
-
- public ConsolidateArtifactVersionsCommand(CommandInterpreter ci) {
- super("Consolidate Artifact Versions", ci);
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- try {
- Operations.executeWorkAndCheckStatus(new ConsolidateArtifactVersionTxOperation(Activator.getInstance(),
- new CommandInterpreterReporter(getCommandInterpreter())), monitor, 0);
- } catch (OseeCoreException ex) {
- printStackTrace(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.server.admin.management;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.CommandInterpreterReporter;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.database.operation.ConsolidateArtifactVersionTxOperation;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class ConsolidateArtifactVersionsCommand extends BaseServerCommand {
+
+ public ConsolidateArtifactVersionsCommand(CommandInterpreter ci) {
+ super("Consolidate Artifact Versions", ci);
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ try {
+ Operations.executeWorkAndCheckStatus(new ConsolidateArtifactVersionTxOperation(Activator.getInstance(),
+ new CommandInterpreterReporter(getCommandInterpreter())), monitor, 0);
+ } catch (OseeCoreException ex) {
+ printStackTrace(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/FinishPartiallyArchivedBranchesCommand.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/FinishPartiallyArchivedBranchesCommand.java
index 0c34018cb53..06f97be9dd7 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/FinishPartiallyArchivedBranchesCommand.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/FinishPartiallyArchivedBranchesCommand.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.server.admin.management;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.datastore.BranchMoveOperation;
-import org.eclipse.osee.framework.core.enums.BranchArchivedState;
-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.operation.Operations;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Ryan D. Brooks
- */
-public class FinishPartiallyArchivedBranchesCommand extends BaseServerCommand {
-
- public FinishPartiallyArchivedBranchesCommand(CommandInterpreter ci) {
- super("Finish Partially Archived Branches", ci);
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- String sql =
- "select branch_id from osee_branch br where exists (select 1 from osee_txs txs where txs.branch_id = br.branch_id and br.archived = " + BranchArchivedState.ARCHIVED.getValue() + ")";
- IOseeStatement chStmt = null;
- try {
- IOseeDatabaseService databaseService = Activator.getInstance().getOseeDatabaseService();
- chStmt = databaseService.getStatement();
-
- List<Branch> branches = new ArrayList<Branch>(100);
- chStmt.runPreparedQuery(100, sql);
- BranchCache branchCache = Activator.getInstance().getOseeCachingService().getBranchCache();
- while (chStmt.next()) {
- branches.add(branchCache.getById(chStmt.getInt("branch_id")));
- }
- for (Branch branch : branches) {
- Operations.executeWorkAndCheckStatus(new BranchMoveOperation(Activator.getInstance(), true, branch),
- monitor, 0);
- }
- } catch (OseeCoreException ex) {
- printStackTrace(ex);
- } finally {
- if (chStmt != null) {
- chStmt.close();
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.server.admin.management;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.datastore.BranchMoveOperation;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+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.operation.Operations;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class FinishPartiallyArchivedBranchesCommand extends BaseServerCommand {
+
+ public FinishPartiallyArchivedBranchesCommand(CommandInterpreter ci) {
+ super("Finish Partially Archived Branches", ci);
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ String sql =
+ "select branch_id from osee_branch br where exists (select 1 from osee_txs txs where txs.branch_id = br.branch_id and br.archived = " + BranchArchivedState.ARCHIVED.getValue() + ")";
+ IOseeStatement chStmt = null;
+ try {
+ IOseeDatabaseService databaseService = Activator.getInstance().getOseeDatabaseService();
+ chStmt = databaseService.getStatement();
+
+ List<Branch> branches = new ArrayList<Branch>(100);
+ chStmt.runPreparedQuery(100, sql);
+ BranchCache branchCache = Activator.getInstance().getOseeCachingService().getBranchCache();
+ while (chStmt.next()) {
+ branches.add(branchCache.getById(chStmt.getInt("branch_id")));
+ }
+ for (Branch branch : branches) {
+ Operations.executeWorkAndCheckStatus(new BranchMoveOperation(Activator.getInstance(), true, branch),
+ monitor, 0);
+ }
+ } catch (OseeCoreException ex) {
+ printStackTrace(ex);
+ } finally {
+ if (chStmt != null) {
+ chStmt.close();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GarbageCollectionCommand.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GarbageCollectionCommand.java
index d3cff5ec236..2119bf1d15b 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GarbageCollectionCommand.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GarbageCollectionCommand.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.server.admin.management;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Ryan D. Brooks
- */
-public class GarbageCollectionCommand extends BaseServerCommand {
-
- public GarbageCollectionCommand(CommandInterpreter ci) {
- super("Run Garbage Collection", ci);
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- System.gc();
- }
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.server.admin.management;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class GarbageCollectionCommand extends BaseServerCommand {
+
+ public GarbageCollectionCommand(CommandInterpreter ci) {
+ super("Run Garbage Collection", ci);
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ System.gc();
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GetServerVersionWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GetServerVersionWorker.java
index 5e5786dec66..b3ca0f31a49 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GetServerVersionWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/GetServerVersionWorker.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.server.admin.management;
-
-import java.util.Arrays;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class GetServerVersionWorker extends BaseServerCommand {
-
- protected GetServerVersionWorker() {
- super("Get Version");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- StringBuffer buffer = new StringBuffer();
- buffer.append("Osee Application Server: ");
- buffer.append(Arrays.deepToString(Activator.getInstance().getApplicationServerManager().getSupportedVersions()));
- buffer.append("\n");
- println(buffer.toString());
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import java.util.Arrays;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class GetServerVersionWorker extends BaseServerCommand {
+
+ protected GetServerVersionWorker() {
+ super("Get Version");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Osee Application Server: ");
+ buffer.append(Arrays.deepToString(Activator.getInstance().getApplicationServerManager().getSupportedVersions()));
+ buffer.append("\n");
+ println(buffer.toString());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ReloadCachesWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ReloadCachesWorker.java
index 04679bfb516..8391e6430bf 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ReloadCachesWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ReloadCachesWorker.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ReloadCachesWorker extends BaseServerCommand {
-
- protected ReloadCachesWorker() {
- super("Reload Cache(s)");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- IOseeCachingService service = Activator.getInstance().getOseeCachingService();
- Collection<OseeCacheEnum> cacheIds = getSelectedCaches();
- if (cacheIds.isEmpty()) {
- service.reloadAll();
- println(String.format("Reloaded all caches %s",
- Arrays.deepToString(OseeCacheEnum.values()).replaceAll(", SESSION_CACHE", "")));
- } else {
- for (OseeCacheEnum cacheId : cacheIds) {
-
- service.getCache(cacheId).reloadCache();
- }
- println(String.format("Reloading %s", cacheIds));
- }
- }
-
- private Collection<OseeCacheEnum> getSelectedCaches() {
- Set<OseeCacheEnum> caches = new HashSet<OseeCacheEnum>();
-
- boolean hasArgument = true;
- while (hasArgument) {
- String value = getCommandInterpreter().nextArgument();
- if (Strings.isValid(value)) {
- caches.add(OseeCacheEnum.valueOf(value));
- } else {
- hasArgument = false;
- }
- }
- return caches;
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ReloadCachesWorker extends BaseServerCommand {
+
+ protected ReloadCachesWorker() {
+ super("Reload Cache(s)");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ IOseeCachingService service = Activator.getInstance().getOseeCachingService();
+ Collection<OseeCacheEnum> cacheIds = getSelectedCaches();
+ if (cacheIds.isEmpty()) {
+ service.reloadAll();
+ println(String.format("Reloaded all caches %s",
+ Arrays.deepToString(OseeCacheEnum.values()).replaceAll(", SESSION_CACHE", "")));
+ } else {
+ for (OseeCacheEnum cacheId : cacheIds) {
+
+ service.getCache(cacheId).reloadCache();
+ }
+ println(String.format("Reloading %s", cacheIds));
+ }
+ }
+
+ private Collection<OseeCacheEnum> getSelectedCaches() {
+ Set<OseeCacheEnum> caches = new HashSet<OseeCacheEnum>();
+
+ boolean hasArgument = true;
+ while (hasArgument) {
+ String value = getCommandInterpreter().nextArgument();
+ if (Strings.isValid(value)) {
+ caches.add(OseeCacheEnum.valueOf(value));
+ } else {
+ hasArgument = false;
+ }
+ }
+ return caches;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/RemoveServerVersionWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/RemoveServerVersionWorker.java
index fc47ad7a824..9d77e31b77f 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/RemoveServerVersionWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/RemoveServerVersionWorker.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import java.util.Arrays;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class RemoveServerVersionWorker extends BaseServerCommand {
-
- protected RemoveServerVersionWorker() {
- super("Remove Version");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- String versionToRemove = getCommandInterpreter().nextArgument();
- Activator.getInstance().getApplicationServerManager().removeSupportedVersion(versionToRemove);
- StringBuffer buffer = new StringBuffer();
- buffer.append("Osee Application Server: ");
- buffer.append(Arrays.deepToString(Activator.getInstance().getApplicationServerManager().getSupportedVersions()));
- buffer.append("\n");
- println(buffer.toString());
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import java.util.Arrays;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RemoveServerVersionWorker extends BaseServerCommand {
+
+ protected RemoveServerVersionWorker() {
+ super("Remove Version");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ String versionToRemove = getCommandInterpreter().nextArgument();
+ Activator.getInstance().getApplicationServerManager().removeSupportedVersion(versionToRemove);
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Osee Application Server: ");
+ buffer.append(Arrays.deepToString(Activator.getInstance().getApplicationServerManager().getSupportedVersions()));
+ buffer.append("\n");
+ println(buffer.toString());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/SchedulingCommand.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/SchedulingCommand.java
index f2707657545..8d4e59b7b87 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/SchedulingCommand.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/SchedulingCommand.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.server.admin.management;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Ryan D. Brooks
- */
-public class SchedulingCommand extends BaseServerCommand {
- private final long delayMiliseconds;
- private final int iterations;
- private final String command;
-
- public SchedulingCommand(CommandInterpreter ci) {
- super("Schedule", ci);
- delayMiliseconds = Integer.parseInt(ci.nextArgument()) * 1000;
- iterations = Integer.parseInt(ci.nextArgument());
- command = ci.nextArgument();
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- for (int i = 0; i < iterations; i++) {
- Thread.sleep(delayMiliseconds);
- getCommandInterpreter().execute(command);
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.server.admin.management;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class SchedulingCommand extends BaseServerCommand {
+ private final long delayMiliseconds;
+ private final int iterations;
+ private final String command;
+
+ public SchedulingCommand(CommandInterpreter ci) {
+ super("Schedule", ci);
+ delayMiliseconds = Integer.parseInt(ci.nextArgument()) * 1000;
+ iterations = Integer.parseInt(ci.nextArgument());
+ command = ci.nextArgument();
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ for (int i = 0; i < iterations; i++) {
+ Thread.sleep(delayMiliseconds);
+ getCommandInterpreter().execute(command);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerRequestsWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerRequestsWorker.java
index 442d3da52f8..4c69e3a1da4 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerRequestsWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerRequestsWorker.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ServerRequestsWorker extends BaseServerCommand {
-
- protected ServerRequestsWorker() {
- super("Set Servlet Requests Allowed");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- String value = getCommandInterpreter().nextArgument();
- Activator.getInstance().getApplicationServerManager().setServletRequestsAllowed(new Boolean(value));
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ServerRequestsWorker extends BaseServerCommand {
+
+ protected ServerRequestsWorker() {
+ super("Set Servlet Requests Allowed");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ String value = getCommandInterpreter().nextArgument();
+ Activator.getInstance().getApplicationServerManager().setServletRequestsAllowed(new Boolean(value));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerShutdownWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerShutdownWorker.java
index 90120979c09..ec4fc15bcf6 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerShutdownWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerShutdownWorker.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-import org.osgi.framework.Bundle;
-
-/**
- * @author Roberto E. Escobar
- */
-class ServerShutdownWorker extends BaseServerCommand {
-
- private final static String OSEE_ONLY_OPTION = "-oseeOnly";
- private final static String OSEE_SHUTDOWN_COMPLETE = "Osee Shutdown Complete";
- private boolean isOseeOnly;
- private boolean isFirstTime;
-
- protected ServerShutdownWorker(CommandInterpreter ci) {
- super("Server Shutdown", ci);
- isOseeOnly = false;
- isFirstTime = true;
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- IApplicationServerManager manager = Activator.getInstance().getApplicationServerManager();
-
- Bundle equinoxHttpBundle = Platform.getBundle("org.eclipse.equinox.http.jetty");
- equinoxHttpBundle.stop();
-
- manager.setServletRequestsAllowed(false);
-
- while (!manager.isSystemIdle()) {
- try {
- Thread.sleep(5000);
- } catch (InterruptedException ex) {
- printStackTrace(ex);
- }
- }
- manager.shutdown();
-
- if (isOseeOnly()) {
- println(OSEE_SHUTDOWN_COMPLETE);
- } else {
- getCommandInterpreter().execute("close");
- }
- }
-
- private synchronized boolean isOseeOnly() {
- if (isFirstTime) {
- isFirstTime = false;
- String cmd = getCommandInterpreter().nextArgument();
- isOseeOnly = OSEE_ONLY_OPTION.equalsIgnoreCase(cmd);
- }
- return isOseeOnly;
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.server.IApplicationServerManager;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Roberto E. Escobar
+ */
+class ServerShutdownWorker extends BaseServerCommand {
+
+ private final static String OSEE_ONLY_OPTION = "-oseeOnly";
+ private final static String OSEE_SHUTDOWN_COMPLETE = "Osee Shutdown Complete";
+ private boolean isOseeOnly;
+ private boolean isFirstTime;
+
+ protected ServerShutdownWorker(CommandInterpreter ci) {
+ super("Server Shutdown", ci);
+ isOseeOnly = false;
+ isFirstTime = true;
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ IApplicationServerManager manager = Activator.getInstance().getApplicationServerManager();
+
+ Bundle equinoxHttpBundle = Platform.getBundle("org.eclipse.equinox.http.jetty");
+ equinoxHttpBundle.stop();
+
+ manager.setServletRequestsAllowed(false);
+
+ while (!manager.isSystemIdle()) {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException ex) {
+ printStackTrace(ex);
+ }
+ }
+ manager.shutdown();
+
+ if (isOseeOnly()) {
+ println(OSEE_SHUTDOWN_COMPLETE);
+ } else {
+ getCommandInterpreter().execute("close");
+ }
+ }
+
+ private synchronized boolean isOseeOnly() {
+ if (isFirstTime) {
+ isFirstTime = false;
+ String cmd = getCommandInterpreter().nextArgument();
+ isOseeOnly = OSEE_ONLY_OPTION.equalsIgnoreCase(cmd);
+ }
+ return isOseeOnly;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerStats.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerStats.java
index a0d9d9fdbce..da6cdd6670b 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerStats.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/ServerStats.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * 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.server.admin.management;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.server.IApplicationServerManager;
-import org.eclipse.osee.framework.core.server.ISessionManager;
-import org.eclipse.osee.framework.core.server.OseeServerProperties;
-import org.eclipse.osee.framework.database.core.DatabaseInfoManager;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Roberto E. Escobar
- */
-class ServerStats extends BaseServerCommand {
-
- protected ServerStats(CommandInterpreter ci) {
- super("Server Stats", ci);
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- IApplicationServerManager manager = Activator.getInstance().getApplicationServerManager();
- ISessionManager sessionManager = Activator.getInstance().getSessionManager();
-
- StringBuffer buffer = new StringBuffer();
- buffer.append("\n----------------------------------------------\n");
- buffer.append(" Server Stats \n");
- buffer.append("----------------------------------------------\n");
-
- buffer.append(String.format("Server:[%s:%s]\n", manager.getServerAddress(), manager.getPort()));
- buffer.append(String.format("Id: [%s]\n", manager.getId()));
- buffer.append(String.format("Running Since: [%s]\n\n",
- SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(manager.getDateStarted())));
-
- buffer.append(String.format("Code Base Location: [%s]\n", System.getProperty("user.dir")));
- buffer.append(String.format("Datastore: [%s]\n", DatabaseInfoManager.getDefault().toString()));
- buffer.append(String.format("Binary Data Path: [%s]\n\n", OseeServerProperties.getOseeApplicationServerData()));
-
- buffer.append(String.format("Supported Versions: %s\n", Arrays.deepToString(manager.getSupportedVersions())));
- buffer.append(String.format("Accepting Requests: [%s]\n", manager.isAcceptingRequests()));
- buffer.append(Lib.getMemoryInfo());
-
- buffer.append("Servlets:");
- List<String> contexts = new ArrayList<String>(manager.getRegisteredServlets());
- Collections.sort(contexts);
- int indexCnt = 0;
- for (String context : contexts) {
- if (indexCnt % 3 == 0) {
- if (indexCnt != 0) {
- buffer.append("\n\t");
- } else {
- buffer.append(" ");
- }
- } else {
- buffer.append("\t\t");
- }
- buffer.append(context);
- indexCnt++;
- }
-
- buffer.append(String.format("\nSessionsManaged: [%s]\n", sessionManager.getAllSessions(false).size()));
- buffer.append(String.format("\nServer State: [%s]\n", manager.isSystemIdle() ? "IDLE" : "BUSY"));
- buffer.append(String.format("Active Threads: [%s]\n", manager.getNumberOfActiveThreads()));
-
- IJobManager jobManager = Job.getJobManager();
- buffer.append(String.format("Job Manager: [%s]\n", jobManager.isIdle() ? "IDLE" : "BUSY"));
- buffer.append(String.format("Current Job: [%s]\n", jobManager.currentJob().getName()));
-
- buffer.append("Current Tasks: ");
- List<String> entries = manager.getCurrentProcesses();
- if (entries.isEmpty()) {
- buffer.append("[NONE]");
- } else {
- buffer.append("\n");
- for (int index = 0; index < entries.size(); index++) {
- buffer.append(String.format("[%s] ", index));
- buffer.append(entries.get(index));
- if (index + 1 < entries.size()) {
- buffer.append("\n");
- }
- }
- }
-
- buffer.append("\n");
- println(buffer.toString());
- }
-}
+/*******************************************************************************
+ * 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.server.admin.management;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osee.framework.core.server.IApplicationServerManager;
+import org.eclipse.osee.framework.core.server.ISessionManager;
+import org.eclipse.osee.framework.core.server.OseeServerProperties;
+import org.eclipse.osee.framework.database.core.DatabaseInfoManager;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Roberto E. Escobar
+ */
+class ServerStats extends BaseServerCommand {
+
+ protected ServerStats(CommandInterpreter ci) {
+ super("Server Stats", ci);
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ IApplicationServerManager manager = Activator.getInstance().getApplicationServerManager();
+ ISessionManager sessionManager = Activator.getInstance().getSessionManager();
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("\n----------------------------------------------\n");
+ buffer.append(" Server Stats \n");
+ buffer.append("----------------------------------------------\n");
+
+ buffer.append(String.format("Server:[%s:%s]\n", manager.getServerAddress(), manager.getPort()));
+ buffer.append(String.format("Id: [%s]\n", manager.getId()));
+ buffer.append(String.format("Running Since: [%s]\n\n",
+ SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(manager.getDateStarted())));
+
+ buffer.append(String.format("Code Base Location: [%s]\n", System.getProperty("user.dir")));
+ buffer.append(String.format("Datastore: [%s]\n", DatabaseInfoManager.getDefault().toString()));
+ buffer.append(String.format("Binary Data Path: [%s]\n\n", OseeServerProperties.getOseeApplicationServerData()));
+
+ buffer.append(String.format("Supported Versions: %s\n", Arrays.deepToString(manager.getSupportedVersions())));
+ buffer.append(String.format("Accepting Requests: [%s]\n", manager.isAcceptingRequests()));
+ buffer.append(Lib.getMemoryInfo());
+
+ buffer.append("Servlets:");
+ List<String> contexts = new ArrayList<String>(manager.getRegisteredServlets());
+ Collections.sort(contexts);
+ int indexCnt = 0;
+ for (String context : contexts) {
+ if (indexCnt % 3 == 0) {
+ if (indexCnt != 0) {
+ buffer.append("\n\t");
+ } else {
+ buffer.append(" ");
+ }
+ } else {
+ buffer.append("\t\t");
+ }
+ buffer.append(context);
+ indexCnt++;
+ }
+
+ buffer.append(String.format("\nSessionsManaged: [%s]\n", sessionManager.getAllSessions(false).size()));
+ buffer.append(String.format("\nServer State: [%s]\n", manager.isSystemIdle() ? "IDLE" : "BUSY"));
+ buffer.append(String.format("Active Threads: [%s]\n", manager.getNumberOfActiveThreads()));
+
+ IJobManager jobManager = Job.getJobManager();
+ buffer.append(String.format("Job Manager: [%s]\n", jobManager.isIdle() ? "IDLE" : "BUSY"));
+ buffer.append(String.format("Current Job: [%s]\n", jobManager.currentJob().getName()));
+
+ buffer.append("Current Tasks: ");
+ List<String> entries = manager.getCurrentProcesses();
+ if (entries.isEmpty()) {
+ buffer.append("[NONE]");
+ } else {
+ buffer.append("\n");
+ for (int index = 0; index < entries.size(); index++) {
+ buffer.append(String.format("[%s] ", index));
+ buffer.append(entries.get(index));
+ if (index + 1 < entries.size()) {
+ buffer.append("\n");
+ }
+ }
+ }
+
+ buffer.append("\n");
+ println(buffer.toString());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/TxCurrentsAndModTypesCommand.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/TxCurrentsAndModTypesCommand.java
index f23cb01621d..e38f0a9c94a 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/TxCurrentsAndModTypesCommand.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/TxCurrentsAndModTypesCommand.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.server.admin.management;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.operation.CommandInterpreterReporter;
-import org.eclipse.osee.framework.database.operation.InvalidTxCurrentsAndModTypes;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Ryan D. Brooks
- */
-public class TxCurrentsAndModTypesCommand extends BaseServerCommand {
- private final boolean archived;
-
- public TxCurrentsAndModTypesCommand(CommandInterpreter ci) {
- super("TxCurrents And Mod Types", ci);
- archived = Boolean.parseBoolean(ci.nextArgument());
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- try {
- checkAndFix("osee_artifact", "art_id", monitor);
- checkAndFix("osee_attribute", "attr_id", monitor);
- checkAndFix("osee_relation_link", "rel_link_id", monitor);
-
- } catch (OseeCoreException ex) {
- printStackTrace(ex);
- }
- }
-
- private void checkAndFix(String tableName, String columnName, IProgressMonitor monitor) throws Exception {
- doSubWork(new InvalidTxCurrentsAndModTypes(tableName, columnName, new CommandInterpreterReporter(
- getCommandInterpreter()), true, archived), monitor, 0.3);
- }
+/*******************************************************************************
+ * Copyright (c) 2010 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.server.admin.management;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.CommandInterpreterReporter;
+import org.eclipse.osee.framework.database.operation.InvalidTxCurrentsAndModTypes;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public class TxCurrentsAndModTypesCommand extends BaseServerCommand {
+ private final boolean archived;
+
+ public TxCurrentsAndModTypesCommand(CommandInterpreter ci) {
+ super("TxCurrents And Mod Types", ci);
+ archived = Boolean.parseBoolean(ci.nextArgument());
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ try {
+ checkAndFix("osee_artifact", "art_id", monitor);
+ checkAndFix("osee_attribute", "attr_id", monitor);
+ checkAndFix("osee_relation_link", "rel_link_id", monitor);
+
+ } catch (OseeCoreException ex) {
+ printStackTrace(ex);
+ }
+ }
+
+ private void checkAndFix(String tableName, String columnName, IProgressMonitor monitor) throws Exception {
+ doSubWork(new InvalidTxCurrentsAndModTypes(tableName, columnName, new CommandInterpreterReporter(
+ getCommandInterpreter()), true, archived), monitor, 0.3);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchStats.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchStats.java
index 7a39ad98c76..76a5b00a4ee 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchStats.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchStats.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * 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.server.admin.search;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.search.engine.ISearchStatistics;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-class SearchStats extends BaseServerCommand {
-
- protected SearchStats() {
- super("Search Engine Stats");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- ISearchStatistics stats = Activator.getInstance().getSearchEngine().getStatistics();
- StringBuffer buffer = new StringBuffer();
- buffer.append("\n----------------------------------------------\n");
- buffer.append(" Search Stats \n");
- buffer.append("----------------------------------------------\n");
- buffer.append(String.format("Total Searches - [%d]\n", stats.getTotalSearches()));
- buffer.append(String.format("Search Time - avg: [%s] ms - longest: [%s] ms\n", stats.getAverageSearchTime(),
- stats.getLongestSearchTime()));
- buffer.append(String.format("Longest Search - %s\n", stats.getLongestSearch()));
- println(buffer.toString());
- }
-}
+/*******************************************************************************
+ * 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.server.admin.search;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.search.engine.ISearchStatistics;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+class SearchStats extends BaseServerCommand {
+
+ protected SearchStats() {
+ super("Search Engine Stats");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ ISearchStatistics stats = Activator.getInstance().getSearchEngine().getStatistics();
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("\n----------------------------------------------\n");
+ buffer.append(" Search Stats \n");
+ buffer.append("----------------------------------------------\n");
+ buffer.append(String.format("Total Searches - [%d]\n", stats.getTotalSearches()));
+ buffer.append(String.format("Search Time - avg: [%s] ms - longest: [%s] ms\n", stats.getAverageSearchTime(),
+ stats.getLongestSearchTime()));
+ buffer.append(String.format("Longest Search - %s\n", stats.getLongestSearch()));
+ println(buffer.toString());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchTaggerCommands.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchTaggerCommands.java
index b9d5d10d323..db82e86a2f8 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchTaggerCommands.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/SearchTaggerCommands.java
@@ -1,132 +1,132 @@
-/*******************************************************************************
- * 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.server.admin.search;
-
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-import org.eclipse.osgi.framework.console.CommandInterpreter;
-
-/**
- * @author Roberto E. Escobar
- */
-public class SearchTaggerCommands {
-
- private final TaggerAllWorker tagAllWorker;
- private final TaggerDropAllWorker dropAllWorker;
- private final TagItemWorker tagItemWorker;
-
- public SearchTaggerCommands() {
- this.tagAllWorker = new TaggerAllWorker();
- this.tagAllWorker.setExecutionAllowed(true);
-
- this.dropAllWorker = new TaggerDropAllWorker();
- this.dropAllWorker.setExecutionAllowed(true);
-
- this.tagItemWorker = new TagItemWorker();
- this.tagItemWorker.setExecutionAllowed(true);
- }
-
- public void startTagItem(CommandInterpreter ci) {
- if (!this.dropAllWorker.isRunning() && !this.tagAllWorker.isRunning()) {
- this.tagItemWorker.setCommandInterpreter(ci);
- this.tagItemWorker.setExecutionAllowed(true);
- } else {
- if (this.dropAllWorker.isRunning()) {
- ci.println("Drop All Tags is running.");
- }
- if (this.tagAllWorker.isRunning()) {
- ci.println("Tag All is running.");
- }
- }
- }
-
- public void stopTagItem(CommandInterpreter ci) {
- if (this.tagItemWorker.isRunning()) {
- this.tagItemWorker.setExecutionAllowed(false);
- } else {
- ci.println("Tag Item is not running.");
- }
- }
-
- public void startDropAll(CommandInterpreter ci) {
- if (!this.dropAllWorker.isRunning() && !this.tagAllWorker.isRunning() && !this.tagItemWorker.isRunning()) {
- this.dropAllWorker.setCommandInterpreter(ci);
- this.dropAllWorker.setExecutionAllowed(true);
- Operations.executeAsJob(dropAllWorker, false);
- } else {
- if (this.dropAllWorker.isRunning()) {
- ci.println("Drop All Tags is running.");
- }
- if (this.tagAllWorker.isRunning()) {
- ci.println("Tag All is running.");
- }
- if (this.tagItemWorker.isRunning()) {
- ci.println("Tag Item is running.");
- }
- }
- }
-
- public void stopDropAll(CommandInterpreter ci) {
- if (this.dropAllWorker.isRunning()) {
- this.dropAllWorker.setExecutionAllowed(false);
- } else {
- ci.println("Drop All Tags is not running.");
- }
- }
-
- public void stopTagAll(CommandInterpreter ci) {
- if (this.tagAllWorker.isRunning()) {
- this.tagAllWorker.setExecutionAllowed(false);
- } else {
- ci.println("Tag All is not running.");
- }
- }
-
- public void startTagAll(CommandInterpreter ci) {
- if (!this.dropAllWorker.isRunning() && !this.tagAllWorker.isRunning() && !this.tagItemWorker.isRunning()) {
- this.tagAllWorker.setCommandInterpreter(ci);
- this.tagAllWorker.setExecutionAllowed(true);
- Operations.executeAsJob(tagAllWorker, false);
- } else {
- if (this.dropAllWorker.isRunning()) {
- ci.println("Drop All Tags is running.");
- }
- if (this.tagAllWorker.isRunning()) {
- ci.println("Tag All is running.");
- }
- if (this.tagItemWorker.isRunning()) {
- ci.println("Tag Item is running.");
- }
- }
- }
-
- public void getTaggerStatistics(CommandInterpreter ci) {
- TaggerStats stats = new TaggerStats();
- stats.setCommandInterpreter(ci);
- stats.setExecutionAllowed(true);
- Operations.executeAsJob(stats, false);
- }
-
- public void clearTaggerStats() {
- Activator.getInstance().getSearchTagger().clearStatistics();
- }
-
- public void getSearchStatistics(CommandInterpreter ci) {
- SearchStats stats = new SearchStats();
- stats.setCommandInterpreter(ci);
- stats.setExecutionAllowed(true);
- Operations.executeAsJob(stats, false);
- }
-
- public void clearSearchStats() {
- Activator.getInstance().getSearchEngine().clearStatistics();
- }
-}
+/*******************************************************************************
+ * 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.server.admin.search;
+
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SearchTaggerCommands {
+
+ private final TaggerAllWorker tagAllWorker;
+ private final TaggerDropAllWorker dropAllWorker;
+ private final TagItemWorker tagItemWorker;
+
+ public SearchTaggerCommands() {
+ this.tagAllWorker = new TaggerAllWorker();
+ this.tagAllWorker.setExecutionAllowed(true);
+
+ this.dropAllWorker = new TaggerDropAllWorker();
+ this.dropAllWorker.setExecutionAllowed(true);
+
+ this.tagItemWorker = new TagItemWorker();
+ this.tagItemWorker.setExecutionAllowed(true);
+ }
+
+ public void startTagItem(CommandInterpreter ci) {
+ if (!this.dropAllWorker.isRunning() && !this.tagAllWorker.isRunning()) {
+ this.tagItemWorker.setCommandInterpreter(ci);
+ this.tagItemWorker.setExecutionAllowed(true);
+ } else {
+ if (this.dropAllWorker.isRunning()) {
+ ci.println("Drop All Tags is running.");
+ }
+ if (this.tagAllWorker.isRunning()) {
+ ci.println("Tag All is running.");
+ }
+ }
+ }
+
+ public void stopTagItem(CommandInterpreter ci) {
+ if (this.tagItemWorker.isRunning()) {
+ this.tagItemWorker.setExecutionAllowed(false);
+ } else {
+ ci.println("Tag Item is not running.");
+ }
+ }
+
+ public void startDropAll(CommandInterpreter ci) {
+ if (!this.dropAllWorker.isRunning() && !this.tagAllWorker.isRunning() && !this.tagItemWorker.isRunning()) {
+ this.dropAllWorker.setCommandInterpreter(ci);
+ this.dropAllWorker.setExecutionAllowed(true);
+ Operations.executeAsJob(dropAllWorker, false);
+ } else {
+ if (this.dropAllWorker.isRunning()) {
+ ci.println("Drop All Tags is running.");
+ }
+ if (this.tagAllWorker.isRunning()) {
+ ci.println("Tag All is running.");
+ }
+ if (this.tagItemWorker.isRunning()) {
+ ci.println("Tag Item is running.");
+ }
+ }
+ }
+
+ public void stopDropAll(CommandInterpreter ci) {
+ if (this.dropAllWorker.isRunning()) {
+ this.dropAllWorker.setExecutionAllowed(false);
+ } else {
+ ci.println("Drop All Tags is not running.");
+ }
+ }
+
+ public void stopTagAll(CommandInterpreter ci) {
+ if (this.tagAllWorker.isRunning()) {
+ this.tagAllWorker.setExecutionAllowed(false);
+ } else {
+ ci.println("Tag All is not running.");
+ }
+ }
+
+ public void startTagAll(CommandInterpreter ci) {
+ if (!this.dropAllWorker.isRunning() && !this.tagAllWorker.isRunning() && !this.tagItemWorker.isRunning()) {
+ this.tagAllWorker.setCommandInterpreter(ci);
+ this.tagAllWorker.setExecutionAllowed(true);
+ Operations.executeAsJob(tagAllWorker, false);
+ } else {
+ if (this.dropAllWorker.isRunning()) {
+ ci.println("Drop All Tags is running.");
+ }
+ if (this.tagAllWorker.isRunning()) {
+ ci.println("Tag All is running.");
+ }
+ if (this.tagItemWorker.isRunning()) {
+ ci.println("Tag Item is running.");
+ }
+ }
+ }
+
+ public void getTaggerStatistics(CommandInterpreter ci) {
+ TaggerStats stats = new TaggerStats();
+ stats.setCommandInterpreter(ci);
+ stats.setExecutionAllowed(true);
+ Operations.executeAsJob(stats, false);
+ }
+
+ public void clearTaggerStats() {
+ Activator.getInstance().getSearchTagger().clearStatistics();
+ }
+
+ public void getSearchStatistics(CommandInterpreter ci) {
+ SearchStats stats = new SearchStats();
+ stats.setCommandInterpreter(ci);
+ stats.setExecutionAllowed(true);
+ Operations.executeAsJob(stats, false);
+ }
+
+ public void clearSearchStats() {
+ Activator.getInstance().getSearchEngine().clearStatistics();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerAllWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerAllWorker.java
index 3913488ab7a..fc21b154565 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerAllWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerAllWorker.java
@@ -1,181 +1,181 @@
-/*******************************************************************************
- * 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.server.admin.search;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.JoinUtility;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.database.core.JoinUtility.TagQueueJoinQuery;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.search.engine.TagListenerAdapter;
-import org.eclipse.osee.framework.search.engine.attribute.AttributeDataStore;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-class TaggerAllWorker extends BaseServerCommand {
- private static final int BATCH_SIZE = 1000;
-
- private TagProcessListener processor;
-
- TaggerAllWorker() {
- super("Tag All Attributes");
- this.processor = null;
- }
-
- private void fetchAndProcessGammas(OseeConnection connection, int branchId, TagProcessListener processor) throws OseeDataStoreException {
- IOseeStatement chStmt = ConnectionHandler.getStatement(connection);
- try {
- chStmt.runPreparedQuery(AttributeDataStore.getAllTaggableGammasByBranchQuery(branchId),
- AttributeDataStore.getAllTaggableGammasByBranchQueryData(branchId));
- TagQueueJoinQuery joinQuery = JoinUtility.createTagQueueJoinQuery();
- while (chStmt.next() && isExecutionAllowed()) {
- long gammaId = chStmt.getLong("gamma_id");
- joinQuery.add(gammaId);
- if (joinQuery.size() >= BATCH_SIZE) {
- processor.storeAndAddQueryId(connection, joinQuery);
- joinQuery = JoinUtility.createTagQueueJoinQuery();
- }
- }
- processor.storeAndAddQueryId(connection, joinQuery);
- } finally {
- chStmt.close();
- }
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- long startTime = System.currentTimeMillis();
- OseeConnection connection = ConnectionHandler.getConnection();
- try {
- String arg = getCommandInterpreter().nextArgument();
- int branchId = -1;
- if (arg != null && arg.length() > 0) {
- branchId = Integer.parseInt(arg);
- }
- println(String.format("Tagging Attributes For: [%s]", branchId > -1 ? "Branch " + branchId : "All Branches"));
-
- int totalAttributes = AttributeDataStore.getTotalTaggableItems(connection, branchId);
- processor = new TagProcessListener(startTime, totalAttributes);
- fetchAndProcessGammas(connection, branchId, processor);
- if (!processor.isProcessingDone()) {
- synchronized (processor) {
- processor.wait();
- }
- }
-
- if (!isExecutionAllowed() && !processor.isProcessingDone()) {
- processor.cancelProcessing(connection);
- }
- processor.printStats();
- } finally {
- processor = null;
- connection.close();
- }
- }
-
- @Override
- public void setExecutionAllowed(boolean value) {
- super.setExecutionAllowed(value);
- if (!value && processor != null) {
- synchronized (processor) {
- processor.notify();
- }
- }
- }
-
- private final class TagProcessListener extends TagListenerAdapter {
-
- private final Map<Integer, TagQueueJoinQuery> queryIdMap;
- private int attributesProcessed;
- private int queriesProcessed;
- private final long startTime;
- private final int totalAttributes;
-
- public TagProcessListener(long startTime, int totalAttributes) {
- this.queryIdMap = Collections.synchronizedMap(new HashMap<Integer, TagQueueJoinQuery>());
- this.startTime = startTime;
- this.totalAttributes = totalAttributes;
- this.attributesProcessed = 0;
- this.queriesProcessed = 0;
- }
-
- /**
- * @param connection
- */
- public void cancelProcessing(OseeConnection connection) {
- Set<Integer> list = queryIdMap.keySet();
- int[] toStop = new int[list.size()];
- int index = 0;
- for (Integer item : list) {
- toStop[index] = item;
- index++;
- }
- Activator.getInstance().getSearchTagger().stopTaggingByQueueQueryId(toStop);
- }
-
- public void storeAndAddQueryId(OseeConnection connection, TagQueueJoinQuery joinQuery) throws OseeDataStoreException {
- if (joinQuery.size() > 0) {
- joinQuery.store(connection);
- this.queryIdMap.put(joinQuery.getQueryId(), joinQuery);
- Activator.getInstance().getSearchTagger().tagByQueueQueryId(this, joinQuery.getQueryId());
- }
- }
-
- public boolean isProcessingDone() {
- return queriesProcessed == totalQueries();
- }
-
- public int totalQueries() {
- int remainder = totalAttributes % 1000;
- return totalAttributes / 1000 + (remainder > 0 ? 1 : 0);
- }
-
- public void printStats() {
- if (isVerbose()) {
- println(String.format("QueryIds: [ %d of %d] Attributes: [%d of %d] - Elapsed Time = %s.",
- queriesProcessed, totalQueries(), attributesProcessed, totalAttributes,
- Lib.getElapseString(startTime)));
- }
- }
-
- @Override
- public void onAttributeTagComplete(int queryId, long gammaId, int totalTags, long processingTime) {
- if (queryIdMap.containsKey(queryId)) {
- attributesProcessed++;
- if (attributesProcessed % 1000 == 0) {
- printStats();
- }
- }
- }
-
- @Override
- synchronized public void onTagQueryIdTagComplete(int queryId, long waitTime, long processingTime) {
- TagQueueJoinQuery joinQuery = this.queryIdMap.get(queryId);
- if (joinQuery != null) {
- this.queryIdMap.remove(joinQuery);
- queriesProcessed++;
- if (isProcessingDone()) {
- this.notify();
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * 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.server.admin.search;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.database.core.JoinUtility;
+import org.eclipse.osee.framework.database.core.OseeConnection;
+import org.eclipse.osee.framework.database.core.JoinUtility.TagQueueJoinQuery;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.search.engine.TagListenerAdapter;
+import org.eclipse.osee.framework.search.engine.attribute.AttributeDataStore;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+class TaggerAllWorker extends BaseServerCommand {
+ private static final int BATCH_SIZE = 1000;
+
+ private TagProcessListener processor;
+
+ TaggerAllWorker() {
+ super("Tag All Attributes");
+ this.processor = null;
+ }
+
+ private void fetchAndProcessGammas(OseeConnection connection, int branchId, TagProcessListener processor) throws OseeDataStoreException {
+ IOseeStatement chStmt = ConnectionHandler.getStatement(connection);
+ try {
+ chStmt.runPreparedQuery(AttributeDataStore.getAllTaggableGammasByBranchQuery(branchId),
+ AttributeDataStore.getAllTaggableGammasByBranchQueryData(branchId));
+ TagQueueJoinQuery joinQuery = JoinUtility.createTagQueueJoinQuery();
+ while (chStmt.next() && isExecutionAllowed()) {
+ long gammaId = chStmt.getLong("gamma_id");
+ joinQuery.add(gammaId);
+ if (joinQuery.size() >= BATCH_SIZE) {
+ processor.storeAndAddQueryId(connection, joinQuery);
+ joinQuery = JoinUtility.createTagQueueJoinQuery();
+ }
+ }
+ processor.storeAndAddQueryId(connection, joinQuery);
+ } finally {
+ chStmt.close();
+ }
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ long startTime = System.currentTimeMillis();
+ OseeConnection connection = ConnectionHandler.getConnection();
+ try {
+ String arg = getCommandInterpreter().nextArgument();
+ int branchId = -1;
+ if (arg != null && arg.length() > 0) {
+ branchId = Integer.parseInt(arg);
+ }
+ println(String.format("Tagging Attributes For: [%s]", branchId > -1 ? "Branch " + branchId : "All Branches"));
+
+ int totalAttributes = AttributeDataStore.getTotalTaggableItems(connection, branchId);
+ processor = new TagProcessListener(startTime, totalAttributes);
+ fetchAndProcessGammas(connection, branchId, processor);
+ if (!processor.isProcessingDone()) {
+ synchronized (processor) {
+ processor.wait();
+ }
+ }
+
+ if (!isExecutionAllowed() && !processor.isProcessingDone()) {
+ processor.cancelProcessing(connection);
+ }
+ processor.printStats();
+ } finally {
+ processor = null;
+ connection.close();
+ }
+ }
+
+ @Override
+ public void setExecutionAllowed(boolean value) {
+ super.setExecutionAllowed(value);
+ if (!value && processor != null) {
+ synchronized (processor) {
+ processor.notify();
+ }
+ }
+ }
+
+ private final class TagProcessListener extends TagListenerAdapter {
+
+ private final Map<Integer, TagQueueJoinQuery> queryIdMap;
+ private int attributesProcessed;
+ private int queriesProcessed;
+ private final long startTime;
+ private final int totalAttributes;
+
+ public TagProcessListener(long startTime, int totalAttributes) {
+ this.queryIdMap = Collections.synchronizedMap(new HashMap<Integer, TagQueueJoinQuery>());
+ this.startTime = startTime;
+ this.totalAttributes = totalAttributes;
+ this.attributesProcessed = 0;
+ this.queriesProcessed = 0;
+ }
+
+ /**
+ * @param connection
+ */
+ public void cancelProcessing(OseeConnection connection) {
+ Set<Integer> list = queryIdMap.keySet();
+ int[] toStop = new int[list.size()];
+ int index = 0;
+ for (Integer item : list) {
+ toStop[index] = item;
+ index++;
+ }
+ Activator.getInstance().getSearchTagger().stopTaggingByQueueQueryId(toStop);
+ }
+
+ public void storeAndAddQueryId(OseeConnection connection, TagQueueJoinQuery joinQuery) throws OseeDataStoreException {
+ if (joinQuery.size() > 0) {
+ joinQuery.store(connection);
+ this.queryIdMap.put(joinQuery.getQueryId(), joinQuery);
+ Activator.getInstance().getSearchTagger().tagByQueueQueryId(this, joinQuery.getQueryId());
+ }
+ }
+
+ public boolean isProcessingDone() {
+ return queriesProcessed == totalQueries();
+ }
+
+ public int totalQueries() {
+ int remainder = totalAttributes % 1000;
+ return totalAttributes / 1000 + (remainder > 0 ? 1 : 0);
+ }
+
+ public void printStats() {
+ if (isVerbose()) {
+ println(String.format("QueryIds: [ %d of %d] Attributes: [%d of %d] - Elapsed Time = %s.",
+ queriesProcessed, totalQueries(), attributesProcessed, totalAttributes,
+ Lib.getElapseString(startTime)));
+ }
+ }
+
+ @Override
+ public void onAttributeTagComplete(int queryId, long gammaId, int totalTags, long processingTime) {
+ if (queryIdMap.containsKey(queryId)) {
+ attributesProcessed++;
+ if (attributesProcessed % 1000 == 0) {
+ printStats();
+ }
+ }
+ }
+
+ @Override
+ synchronized public void onTagQueryIdTagComplete(int queryId, long waitTime, long processingTime) {
+ TagQueueJoinQuery joinQuery = this.queryIdMap.get(queryId);
+ if (joinQuery != null) {
+ this.queryIdMap.remove(joinQuery);
+ queriesProcessed++;
+ if (isProcessingDone()) {
+ this.notify();
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerDropAllWorker.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerDropAllWorker.java
index 7de50875e05..2d83b96869f 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerDropAllWorker.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerDropAllWorker.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * 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.server.admin.search;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.database.core.ConnectionHandler;
-import org.eclipse.osee.framework.database.core.SupportedDatabase;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-
-/**
- * @author Roberto E. Escobar
- */
-class TaggerDropAllWorker extends BaseServerCommand {
- private static final String TRUNCATE_SQL = "TRUNCATE osee_search_tags";
- private static final String DELETE_TABLE_SQL = "DELETE FROM osee_search_tags";
-
- protected TaggerDropAllWorker() {
- super("Drop All Search Tags");
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- String deleteSql = null;
- if (SupportedDatabase.isDatabaseType(ConnectionHandler.getMetaData(), SupportedDatabase.derby)) {
- deleteSql = DELETE_TABLE_SQL;
- } else {
- deleteSql = TRUNCATE_SQL;
- }
- ConnectionHandler.runPreparedUpdate(deleteSql);
- }
-}
+/*******************************************************************************
+ * 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.server.admin.search;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.SupportedDatabase;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+
+/**
+ * @author Roberto E. Escobar
+ */
+class TaggerDropAllWorker extends BaseServerCommand {
+ private static final String TRUNCATE_SQL = "TRUNCATE osee_search_tags";
+ private static final String DELETE_TABLE_SQL = "DELETE FROM osee_search_tags";
+
+ protected TaggerDropAllWorker() {
+ super("Drop All Search Tags");
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ String deleteSql = null;
+ if (SupportedDatabase.isDatabaseType(ConnectionHandler.getMetaData(), SupportedDatabase.derby)) {
+ deleteSql = DELETE_TABLE_SQL;
+ } else {
+ deleteSql = TRUNCATE_SQL;
+ }
+ ConnectionHandler.runPreparedUpdate(deleteSql);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerStats.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerStats.java
index 42206e7391b..1318bb7b452 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerStats.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/search/TaggerStats.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * 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.server.admin.search;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.search.engine.ISearchEngineTagger;
-import org.eclipse.osee.framework.search.engine.ITagItemStatistics;
-import org.eclipse.osee.framework.search.engine.ITaggerStatistics;
-import org.eclipse.osee.framework.server.admin.BaseServerCommand;
-import org.eclipse.osee.framework.server.admin.internal.Activator;
-
-/**
- * @author Roberto E. Escobar
- */
-class TaggerStats extends BaseServerCommand {
-
- protected TaggerStats() {
- super("Tag Engine Stats");
- }
-
- private String toString(ITagItemStatistics task) {
- return String.format("id: [%d] - processed [%d] tags in [%d] ms", task.getGammaId(), task.getTotalTags(),
- task.getProcessingTime());
- }
-
- @Override
- protected void doCommandWork(IProgressMonitor monitor) throws Exception {
- ISearchEngineTagger tagger = Activator.getInstance().getSearchTagger();
-
- ITaggerStatistics stats = tagger.getStatistics();
-
- StringBuffer buffer = new StringBuffer();
- buffer.append("\n----------------------------------------------\n");
- buffer.append(" Tagger Stats \n");
- buffer.append("----------------------------------------------\n");
- buffer.append(String.format("Query Id Processing Time - avg: [%s] ms - longest: [%s] ms\n",
- stats.getAverageQueryIdProcessingTime(), stats.getLongestQueryIdProcessingTime()));
- buffer.append(String.format("Query Id Wait Time - avg: [%s] ms - longest: [%s] ms\n",
- stats.getAverageQueryIdWaitTime(), stats.getLongestQueryIdWaitTime()));
-
- buffer.append(String.format("Attribute Processing Time - avg: [%s] ms - longest: [%s] ms\n",
- stats.getAverageAttributeProcessingTime(), stats.getLongestAttributeProcessingTime()));
- buffer.append(String.format("Attribute with longest processing time - %s\n", toString(stats.getLongestTask())));
- buffer.append(String.format("Attribute with most tags - %s\n", toString(stats.getMostTagsTask())));
- buffer.append(String.format("Total - QueryIds: [%d] Attributes: [%d] Tags: [%d]\n",
- stats.getTotalQueryIdsProcessed(), stats.getTotalAttributesProcessed(), stats.getTotalTags()));
- buffer.append(String.format("Total Query Ids Waiting to be Processed - [%d]\n", tagger.getWorkersInQueue()));
- buffer.append(String.format("Total Query Ids in Tag Queue Table - [%d]\n", stats.getTotalQueryIdsInQueue()));
- buffer.append(String.format("Total Tags in System - [%d]\n\n", stats.getTagsInSystem()));
-
- println(buffer.toString());
- }
-}
+/*******************************************************************************
+ * 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.server.admin.search;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.search.engine.ISearchEngineTagger;
+import org.eclipse.osee.framework.search.engine.ITagItemStatistics;
+import org.eclipse.osee.framework.search.engine.ITaggerStatistics;
+import org.eclipse.osee.framework.server.admin.BaseServerCommand;
+import org.eclipse.osee.framework.server.admin.internal.Activator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+class TaggerStats extends BaseServerCommand {
+
+ protected TaggerStats() {
+ super("Tag Engine Stats");
+ }
+
+ private String toString(ITagItemStatistics task) {
+ return String.format("id: [%d] - processed [%d] tags in [%d] ms", task.getGammaId(), task.getTotalTags(),
+ task.getProcessingTime());
+ }
+
+ @Override
+ protected void doCommandWork(IProgressMonitor monitor) throws Exception {
+ ISearchEngineTagger tagger = Activator.getInstance().getSearchTagger();
+
+ ITaggerStatistics stats = tagger.getStatistics();
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("\n----------------------------------------------\n");
+ buffer.append(" Tagger Stats \n");
+ buffer.append("----------------------------------------------\n");
+ buffer.append(String.format("Query Id Processing Time - avg: [%s] ms - longest: [%s] ms\n",
+ stats.getAverageQueryIdProcessingTime(), stats.getLongestQueryIdProcessingTime()));
+ buffer.append(String.format("Query Id Wait Time - avg: [%s] ms - longest: [%s] ms\n",
+ stats.getAverageQueryIdWaitTime(), stats.getLongestQueryIdWaitTime()));
+
+ buffer.append(String.format("Attribute Processing Time - avg: [%s] ms - longest: [%s] ms\n",
+ stats.getAverageAttributeProcessingTime(), stats.getLongestAttributeProcessingTime()));
+ buffer.append(String.format("Attribute with longest processing time - %s\n", toString(stats.getLongestTask())));
+ buffer.append(String.format("Attribute with most tags - %s\n", toString(stats.getMostTagsTask())));
+ buffer.append(String.format("Total - QueryIds: [%d] Attributes: [%d] Tags: [%d]\n",
+ stats.getTotalQueryIdsProcessed(), stats.getTotalAttributesProcessed(), stats.getTotalTags()));
+ buffer.append(String.format("Total Query Ids Waiting to be Processed - [%d]\n", tagger.getWorkersInQueue()));
+ buffer.append(String.format("Total Query Ids in Tag Queue Table - [%d]\n", stats.getTotalQueryIdsInQueue()));
+ buffer.append(String.format("Total Tags in System - [%d]\n\n", stats.getTagsInSystem()));
+
+ println(buffer.toString());
+ }
+}

Back to the top