Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorafinkbein2009-01-14 23:33:08 +0000
committerafinkbein2009-01-14 23:33:08 +0000
commit8f7b59178a9b610bf0402c5dbc14d3ebda192dc2 (patch)
tree7979b342a5d1ee3aafc2c1eb740747d302187e5c
parent2153ada75e53772a2707c53d1a4bfa3606a4f6ff (diff)
downloadorg.eclipse.osee-8f7b59178a9b610bf0402c5dbc14d3ebda192dc2.tar.gz
org.eclipse.osee-8f7b59178a9b610bf0402c5dbc14d3ebda192dc2.tar.xz
org.eclipse.osee-8f7b59178a9b610bf0402c5dbc14d3ebda192dc2.zip
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.classpath7
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.project28
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/META-INF/MANIFEST.MF23
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/build.properties4
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchExchangeServlet.java141
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchManagerServlet.java70
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchCreationInfo.java193
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchExchangeInfo.java108
-rw-r--r--MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/InternalBranchServletActivator.java108
10 files changed, 686 insertions, 0 deletions
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.classpath b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.classpath
@@ -0,0 +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>
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.project b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.project
new file mode 100644
index 00000000000..6245017568c
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.framework.branch.management.servlet</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/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.settings/org.eclipse.pde.core.prefs b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 00000000000..54e7f34adec
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Thu May 08 12:25:01 MST 2008
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/META-INF/MANIFEST.MF b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..073f9da103d
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Servlet Plug-in
+Bundle-SymbolicName: org.eclipse.osee.framework.branch.management.servlet;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.osee.framework.branch.management.servlet.InternalBranchServletActivator
+Import-Package: javax.servlet;version="2.4.0",
+ javax.servlet.http;version="2.4.0",
+ org.eclipse.osee.framework.branch.management,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.server,
+ org.eclipse.osee.framework.db.connection.exception,
+ org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.jdk.core.util.io.xml,
+ org.eclipse.osee.framework.logging,
+ org.eclipse.osee.framework.resource.management,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.http;version="1.2.0",
+ org.osgi.service.log;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.3"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/build.properties b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/build.properties
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchExchangeServlet.java b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchExchangeServlet.java
new file mode 100644
index 00000000000..a2bc6fc20fe
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchExchangeServlet.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * 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.branch.management.servlet;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.Level;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.eclipse.osee.framework.core.server.OseeHttpServlet;
+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.IResourceManager;
+import org.eclipse.osee.framework.resource.management.Options;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchExchangeServlet extends OseeHttpServlet {
+
+ private static final long serialVersionUID = -1642995618810911260L;
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
+ try {
+ HttpBranchExchangeInfo exchangeInfo = new HttpBranchExchangeInfo(req);
+ switch (exchangeInfo.getFunction()) {
+ case exportBranch:
+ executeExport(exchangeInfo, response);
+ break;
+ case importBranch:
+ executeImport(exchangeInfo, response);
+ break;
+ case checkExchange:
+ executeCheckExchange(exchangeInfo, response);
+ default:
+ break;
+ }
+ } catch (Exception ex) {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.setContentType("text/plain");
+ OseeLog.log(InternalBranchServletActivator.class, Level.SEVERE, String.format("Error processing [%s]", req.toString()), ex);
+ response.getWriter().write(Lib.exceptionToString(ex));
+ }
+ response.getWriter().flush();
+ response.getWriter().close();
+ }
+
+ private void executeCheckExchange(HttpBranchExchangeInfo exchangeInfo, HttpServletResponse response) throws Exception {
+ int status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+ StringBuffer message = new StringBuffer();
+
+ String path = exchangeInfo.getPath();
+ IResourceLocator exchangeLocator = InternalBranchServletActivator.getInstance().getResourceLocatorManager().getResourceLocator(path);
+ IResourceLocator verifyLocator = InternalBranchServletActivator.getInstance().getBranchExchange().checkIntegrity(exchangeLocator);
+ status = HttpServletResponse.SC_ACCEPTED;
+ message.append(String.format("Verification at: [%s]", verifyLocator.getLocation().toASCIIString()));
+
+ response.setStatus(status);
+ response.setContentType("text/plain");
+ response.getWriter().write(message.toString());
+ }
+
+ private void executeExport(HttpBranchExchangeInfo exchangeInfo, HttpServletResponse response) throws Exception {
+ int status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+ StringBuffer message = new StringBuffer();
+ IResourceLocator exchangeLocator =
+ InternalBranchServletActivator.getInstance().getBranchExchange().exportBranch(exchangeInfo.getExchangeFileName(),
+ exchangeInfo.getOptions(), exchangeInfo.getSelectedBranchIds());
+ status = HttpServletResponse.SC_ACCEPTED;
+ message.append(String.format("Exported: [%s]", exchangeLocator.getLocation().toASCIIString()));
+
+ if (exchangeInfo.isSendExportFile()) {
+ InputStream exportFileStream = null;
+ try {
+ IResource resource = InternalBranchServletActivator.getInstance().getResourceManager().acquire(exchangeLocator, new Options());
+ exportFileStream = resource.getContent();
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.setContentLength(exportFileStream.available());
+ response.setCharacterEncoding("ISO-8859-1");
+ response.setContentType("application/zip");
+ response.setHeader("Content-Disposition", "attachment; filename=" + resource.getName());
+ Lib.inputStreamToOutputStream(exportFileStream, response.getOutputStream());
+ } finally {
+ if (exportFileStream != null) {
+ exportFileStream.close();
+ }
+ }
+ }
+
+ if (exchangeInfo.isDeleteExportFile()) {
+ int deleteResult = InternalBranchServletActivator.getInstance().getResourceManager().delete(exchangeLocator);
+ if (deleteResult == IResourceManager.OK) {
+ status = HttpServletResponse.SC_ACCEPTED;
+ } else {
+ status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+ message.append(String.format("Error during deletion of: [%s]",
+ exchangeLocator.getLocation().toASCIIString()));
+ }
+ }
+ response.setStatus(status);
+ response.setContentType("text/plain");
+ response.getWriter().write(message.toString());
+ }
+
+ private void executeImport(HttpBranchExchangeInfo exchangeInfo, HttpServletResponse response) throws Exception {
+ IResourceLocator locator =
+ InternalBranchServletActivator.getInstance().getResourceLocatorManager().getResourceLocator(exchangeInfo.getPath());
+
+ InternalBranchServletActivator.getInstance().getBranchExchange().importBranch(locator, exchangeInfo.getOptions(),
+ exchangeInfo.getSelectedBranchIds());
+
+ response.setStatus(HttpServletResponse.SC_ACCEPTED);
+ response.setContentType("text/plain");
+ response.getWriter().write(String.format("Successfully imported: [%s]", exchangeInfo.getPath()));
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ super.doGet(req, resp);
+ // Get available export files.
+ // Get export file metadata for options.
+ }
+}
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchManagerServlet.java b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchManagerServlet.java
new file mode 100644
index 00000000000..0e47f426112
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/BranchManagerServlet.java
@@ -0,0 +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.branch.management.servlet;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.eclipse.osee.framework.core.server.OseeHttpServlet;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.OseeLog;
+
+/**
+ * @author Andrew M Finkbeiner
+ */
+public class BranchManagerServlet extends OseeHttpServlet {
+
+ private static final long serialVersionUID = 226986283540461526L;
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ try {
+ resp.setStatus(HttpServletResponse.SC_ACCEPTED);
+ resp.setContentType("text/plain");
+ HttpBranchCreationInfo info = new HttpBranchCreationInfo(req);
+ int branchId = -1;
+ switch (info.getFunction()) {
+ case createChildBranch:
+ branchId =
+ InternalBranchServletActivator.getInstance().getBranchCreation().createChildBranch(info.getParentTransactionId(),
+ info.getParentBranchId(), info.getBranchShortName(), info.getBranchName(),
+ info.getCreationComment(), info.getAssociatedArtifactId(), info.getAuthorId(),
+ info.branchWithFiltering(), info.getCompressArtTypeIds(), info.getPreserveArtTypeIds());
+ break;
+ case createRootBranch:
+ branchId =
+ InternalBranchServletActivator.getInstance().getBranchCreation().createTopLevelBranch(info.getParentTransactionId(),
+ info.getParentBranchId(), info.getBranchShortName(), info.getBranchName(),
+ info.getCreationComment(), info.getAssociatedArtifactId(), info.getAuthorId(),
+ info.getStaticBranchName(), info.isSystemRootBranch());
+ break;
+ }
+ if (branchId != -1) {
+ resp.getWriter().write(Integer.toString(branchId));
+ } else {
+ resp.getWriter().write("Unknown Error during branch creation.");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(InternalBranchServletActivator.class, Level.SEVERE, String.format("Failed to respond to a branch servlet request [%s]",
+ req.toString()), ex);
+ resp.setContentType("text/plain");
+ resp.getWriter().write(Lib.exceptionToString(ex));
+ }
+ resp.getWriter().flush();
+ resp.getWriter().close();
+ }
+
+}
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchCreationInfo.java b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchCreationInfo.java
new file mode 100644
index 00000000000..b7217835467
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchCreationInfo.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * 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.branch.management.servlet;
+
+import javax.servlet.http.HttpServletRequest;
+import org.eclipse.osee.framework.db.connection.exception.OseeArgumentException;
+import org.eclipse.osee.framework.jdk.core.util.StringFormat;
+
+/**
+ * @author Andrew M Finkbeiner
+ */
+class HttpBranchCreationInfo {
+
+ enum BranchCreationFunction {
+ createRootBranch, createChildBranch
+ };
+
+ private BranchCreationFunction function;
+ private int parentBranchId;
+ private int parentTransactionId;
+ private String branchShortName;
+ private String branchName;
+ private String creationComment;
+ private int associatedArtifactId;
+ private int authorId;
+ private String staticBranchName;
+ private String[] compressArtTypeIds;
+ private String[] preserveArtTypeIds;
+ private boolean systemRootBranch;
+
+ public HttpBranchCreationInfo(HttpServletRequest req) throws OseeArgumentException {
+ ensureFunctionValid(req.getParameter("function"));
+
+ String parentBranchIdStr = req.getParameter("parentBranchId");
+ if (parentBranchIdStr == null) {
+ throw new OseeArgumentException("A 'parentBranchId' parameter must be specified");
+ } else {
+ parentBranchId = Integer.parseInt(parentBranchIdStr);
+ }
+
+ if (function == BranchCreationFunction.createChildBranch) {
+ String parentTransactionIdStr = req.getParameter("parentTransactionId");
+ if (parentTransactionIdStr == null) {
+ throw new OseeArgumentException("A 'parentTransactionId' parameter must be specified");
+ } else {
+ parentTransactionId = Integer.parseInt(parentTransactionIdStr);
+ }
+ }
+
+ branchName = req.getParameter("branchName");//required
+ if (branchName == null || branchName.length() == 0) {
+ throw new OseeArgumentException("A 'branchName' parameter must be specified");
+ }
+ branchShortName = req.getParameter("branchShortName");
+ if (branchShortName == null) {
+ branchShortName = branchName;
+ }
+ branchShortName = StringFormat.truncate(branchShortName, 25);
+ creationComment = req.getParameter("creationComment");//required
+ if (creationComment == null || creationComment.length() == 0) {
+ throw new OseeArgumentException("A 'creationComment' parameter must be specified");
+ }
+ String associatedArtifactIdStr = req.getParameter("associatedArtifactId");
+ if (associatedArtifactIdStr == null) {
+ throw new OseeArgumentException("A 'associatedArtifactId' parameter must be specified");
+ }
+ associatedArtifactId = Integer.parseInt(associatedArtifactIdStr);
+ String authorIdStr = req.getParameter("authorId");
+ if (authorIdStr == null) {
+ throw new OseeArgumentException("A 'authorIdStr' parameter must be specified");
+ }
+ authorId = Integer.parseInt(authorIdStr);
+ staticBranchName = req.getParameter("staticBranchName");
+
+ String compressArtTypeIdsString = req.getParameter("compressArtTypes");
+ if (compressArtTypeIdsString != null) {
+ compressArtTypeIds = compressArtTypeIdsString.split(",");
+ }
+ String preserveArtTypeIdsString = req.getParameter("preserveArtTypes");
+ if (preserveArtTypeIdsString != null) {
+ preserveArtTypeIds = preserveArtTypeIdsString.split(",");
+ }
+
+ systemRootBranch = Boolean.parseBoolean(req.getParameter("systemRootBranch"));
+ }
+
+ private void ensureFunctionValid(String function) throws OseeArgumentException {
+ if (function == null) {
+ throw new OseeArgumentException("A 'function' parameter must be defined.");
+ }
+ try {
+ this.function = BranchCreationFunction.valueOf(function);
+ } catch (IllegalArgumentException ex) {
+ throw new OseeArgumentException(String.format("[%s] is not a valid function.", function));
+ }
+ }
+
+ /**
+ * @return the parentBranchId
+ */
+ public int getParentBranchId() {
+ return parentBranchId;
+ }
+
+ /**
+ * @return the branchShortName
+ */
+ public String getBranchShortName() {
+ return branchShortName;
+ }
+
+ /**
+ * @return the branchName
+ */
+ public String getBranchName() {
+ return branchName;
+ }
+
+ /**
+ * @return the creationComment
+ */
+ public String getCreationComment() {
+ return creationComment;
+ }
+
+ /**
+ * @return the associatedArtifactId
+ */
+ public int getAssociatedArtifactId() {
+ return associatedArtifactId;
+ }
+
+ /**
+ * @return the authorId
+ */
+ public int getAuthorId() {
+ return authorId;
+ }
+
+ /**
+ * @return the staticBranchName
+ */
+ public String getStaticBranchName() {
+ return staticBranchName;
+ }
+
+ /**
+ * @return the function
+ */
+ public BranchCreationFunction getFunction() {
+ return function;
+ }
+
+ /**
+ * @return the preserveArtTypes
+ */
+ public String[] getPreserveArtTypeIds() {
+ return preserveArtTypeIds;
+ }
+
+ /**
+ * @return the compressArtTypes
+ */
+ public String[] getCompressArtTypeIds() {
+ return compressArtTypeIds;
+ }
+
+ public boolean branchWithFiltering() {
+ return (getCompressArtTypeIds() != null && getCompressArtTypeIds().length > 0) || (getPreserveArtTypeIds() != null && getPreserveArtTypeIds().length > 0);
+ }
+
+ /**
+ * @return the systemRootBranch
+ */
+ public boolean isSystemRootBranch() {
+ return systemRootBranch;
+ }
+
+ /**
+ * @return the parentTransactionId
+ */
+ public int getParentTransactionId() {
+ return parentTransactionId;
+ }
+} \ No newline at end of file
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchExchangeInfo.java b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchExchangeInfo.java
new file mode 100644
index 00000000000..1faaaa90f4d
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/HttpBranchExchangeInfo.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.branch.management.servlet;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import org.eclipse.osee.framework.resource.management.Options;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class HttpBranchExchangeInfo {
+
+ enum BranchExchangeFunctions {
+ exportBranch, importBranch, checkExchange;
+ };
+
+ private BranchExchangeFunctions function;
+ private String exchangeFileName;
+ private String path;
+ private List<Integer> selectedBranchIds;
+ private boolean sendExportFile;
+ private boolean deleteExportFile;
+ private Options options;
+
+ @SuppressWarnings("unchecked")
+ public HttpBranchExchangeInfo(HttpServletRequest request) throws Exception {
+ this.options = new Options();
+ this.function = null;
+ this.selectedBranchIds = new ArrayList<Integer>();
+ this.sendExportFile = false;
+ this.deleteExportFile = false;
+ this.exchangeFileName = null;
+ this.path = null;
+
+ Enumeration<String> enumeration = request.getParameterNames();
+ while (enumeration.hasMoreElements()) {
+ String name = enumeration.nextElement();
+ String value = request.getParameter(name);
+ if (name.equalsIgnoreCase("filename")) {
+ this.exchangeFileName = value;
+ } else if (name.equalsIgnoreCase("uri")) {
+ this.path = value;
+ } else if (name.equalsIgnoreCase("send.export.file")) {
+ this.sendExportFile = Boolean.valueOf(value);
+ } else if (name.equalsIgnoreCase("delete.export.file")) {
+ this.deleteExportFile = Boolean.valueOf(value);
+ } else if (name.equalsIgnoreCase("function")) {
+ isFunctionValid(value);
+ } else if (name.equalsIgnoreCase("branchIds")) {
+ for (String entry : value.split(",")) {
+ selectedBranchIds.add(new Integer(entry));
+ }
+ } else {
+ options.put(name.toUpperCase(), value);
+ }
+ }
+ }
+
+ public BranchExchangeFunctions getFunction() {
+ return this.function;
+ }
+
+ public boolean isSendExportFile() {
+ return this.sendExportFile;
+ }
+
+ public boolean isDeleteExportFile() {
+ return this.deleteExportFile;
+ }
+
+ public String getExchangeFileName() {
+ return this.exchangeFileName;
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public List<Integer> getSelectedBranchIds() {
+ return this.selectedBranchIds;
+ }
+
+ public Options getOptions() {
+ return this.options;
+ }
+
+ private void isFunctionValid(String function) throws Exception {
+ if (function == null) {
+ throw new Exception("A 'function' parameter must be defined.");
+ }
+ try {
+ this.function = BranchExchangeFunctions.valueOf(function);
+ } catch (IllegalArgumentException ex) {
+ throw new Exception(String.format("[%s] is not a valid function.", function), ex);
+ }
+ }
+}
diff --git a/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/InternalBranchServletActivator.java b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/InternalBranchServletActivator.java
new file mode 100644
index 00000000000..3b57986a6c9
--- /dev/null
+++ b/MS_0.6.0_20090114/org.eclipse.osee.framework.branch.management.servlet/src/org/eclipse/osee/framework/branch/management/servlet/InternalBranchServletActivator.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.branch.management.servlet;
+
+import org.eclipse.osee.framework.branch.management.IBranchCreation;
+import org.eclipse.osee.framework.branch.management.IBranchExchange;
+import org.eclipse.osee.framework.core.data.OseeServerContext;
+import org.eclipse.osee.framework.core.server.OseeHttpServiceTracker;
+import org.eclipse.osee.framework.resource.management.IResourceLocatorManager;
+import org.eclipse.osee.framework.resource.management.IResourceManager;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * @author Andrew M Finkbeiner
+ */
+public class InternalBranchServletActivator implements BundleActivator {
+ private ServiceTracker resourceManagementTracker;
+ private ServiceTracker resourceLocatorManagerTracker;
+ private OseeHttpServiceTracker httpBranchManagementTracker;
+ private OseeHttpServiceTracker httpBranchExportTracker;
+ private ServiceTracker branchCreationTracker;
+ private ServiceTracker branchExchangeTracker;
+ private static InternalBranchServletActivator instance;
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ instance = this;
+
+ resourceManagementTracker = new ServiceTracker(context, IResourceManager.class.getName(), null);
+ resourceManagementTracker.open();
+
+ resourceLocatorManagerTracker = new ServiceTracker(context, IResourceLocatorManager.class.getName(), null);
+ resourceLocatorManagerTracker.open();
+
+ branchCreationTracker = new ServiceTracker(context, IBranchCreation.class.getName(), null);
+ branchCreationTracker.open();
+
+ branchExchangeTracker = new ServiceTracker(context, IBranchExchange.class.getName(), null);
+ branchExchangeTracker.open();
+
+ httpBranchManagementTracker =
+ new OseeHttpServiceTracker(context, OseeServerContext.BRANCH_CREATION_CONTEXT, BranchManagerServlet.class);
+ httpBranchManagementTracker.open();
+
+ httpBranchExportTracker =
+ new OseeHttpServiceTracker(context, OseeServerContext.BRANCH_EXCHANGE_CONTEXT, BranchExchangeServlet.class);
+ httpBranchExportTracker.open();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ httpBranchManagementTracker.close();
+ httpBranchManagementTracker = null;
+
+ httpBranchExportTracker.close();
+ httpBranchExportTracker = null;
+
+ branchCreationTracker.close();
+ branchCreationTracker = null;
+
+ branchExchangeTracker.close();
+ branchExchangeTracker = null;
+
+ resourceManagementTracker.close();
+ resourceManagementTracker = null;
+
+ resourceLocatorManagerTracker.close();
+ resourceLocatorManagerTracker = null;
+ instance = null;
+ }
+
+ public static InternalBranchServletActivator getInstance() {
+ return instance;
+ }
+
+ public IBranchCreation getBranchCreation() {
+ return (IBranchCreation) branchCreationTracker.getService();
+ }
+
+ public IBranchExchange getBranchExchange() {
+ return (IBranchExchange) branchExchangeTracker.getService();
+ }
+
+ public IResourceManager getResourceManager() {
+ return (IResourceManager) resourceManagementTracker.getService();
+ }
+
+ public IResourceLocatorManager getResourceLocatorManager() {
+ return (IResourceLocatorManager) resourceLocatorManagerTracker.getService();
+ }
+}

Back to the top