diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core')
82 files changed, 4529 insertions, 4529 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BaseExchangeData.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BaseExchangeData.java index c0ac1953b9f..aebfc13794e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BaseExchangeData.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BaseExchangeData.java @@ -1,89 +1,89 @@ -/*******************************************************************************
- * 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.core.data;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.Properties;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStoreWriter;
-
-public class BaseExchangeData implements Serializable {
- private static final long serialVersionUID = -3844333805269321833L;
- protected final PropertyStore backingData;
-
- public BaseExchangeData() {
- super();
- this.backingData = new PropertyStore(Integer.toString(this.hashCode()));
- }
-
- protected String getString(String key) {
- return backingData.get(key);
- }
-
- /**
- * Set data from XML input stream
- *
- * @param xml inputStream
- * @throws OseeWrappedException
- */
- protected void loadfromXml(InputStream inputStream) throws OseeCoreException {
- try {
- PropertyStoreWriter writer = new PropertyStoreWriter();
- writer.load(backingData, inputStream);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- /**
- * Write to output stream
- *
- * @param outputStream
- * @throws OseeWrappedException
- */
- public void write(OutputStream outputStream) throws OseeCoreException {
- try {
- PropertyStoreWriter writer = new PropertyStoreWriter();
- writer.save(backingData, outputStream);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- @Override
- public String toString() {
- return this.backingData.toString();
- }
-
- protected void putProperties(String fieldName, Properties properties) {
- for (String theKey : properties.stringPropertyNames()) {
- String keyStr = String.format("%s.%s", fieldName, theKey);
- backingData.put(keyStr, properties.getProperty(theKey));
- }
- }
-
- protected Properties getPropertyString(String fieldName) {
- String prefix = fieldName + ".";
- Properties toReturn = new Properties();
- for (String key : backingData.keySet()) {
- if (key.startsWith(prefix)) {
- String normalizedKey = key.substring(prefix.length(), key.length());
- toReturn.put(normalizedKey, backingData.get(key));
- }
- }
- 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.core.data; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.util.Properties; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.core.exception.OseeWrappedException; +import org.eclipse.osee.framework.jdk.core.type.PropertyStore; +import org.eclipse.osee.framework.jdk.core.type.PropertyStoreWriter; + +public class BaseExchangeData implements Serializable { + private static final long serialVersionUID = -3844333805269321833L; + protected final PropertyStore backingData; + + public BaseExchangeData() { + super(); + this.backingData = new PropertyStore(Integer.toString(this.hashCode())); + } + + protected String getString(String key) { + return backingData.get(key); + } + + /** + * Set data from XML input stream + * + * @param xml inputStream + * @throws OseeWrappedException + */ + protected void loadfromXml(InputStream inputStream) throws OseeCoreException { + try { + PropertyStoreWriter writer = new PropertyStoreWriter(); + writer.load(backingData, inputStream); + } catch (Exception ex) { + OseeExceptions.wrapAndThrow(ex); + } + } + + /** + * Write to output stream + * + * @param outputStream + * @throws OseeWrappedException + */ + public void write(OutputStream outputStream) throws OseeCoreException { + try { + PropertyStoreWriter writer = new PropertyStoreWriter(); + writer.save(backingData, outputStream); + } catch (Exception ex) { + OseeExceptions.wrapAndThrow(ex); + } + } + + @Override + public String toString() { + return this.backingData.toString(); + } + + protected void putProperties(String fieldName, Properties properties) { + for (String theKey : properties.stringPropertyNames()) { + String keyStr = String.format("%s.%s", fieldName, theKey); + backingData.put(keyStr, properties.getProperty(theKey)); + } + } + + protected Properties getPropertyString(String fieldName) { + String prefix = fieldName + "."; + Properties toReturn = new Properties(); + for (String key : backingData.keySet()) { + if (key.startsWith(prefix)) { + String normalizedKey = key.substring(prefix.length(), key.length()); + toReturn.put(normalizedKey, backingData.get(key)); + } + } + return toReturn; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IDatabaseInfo.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IDatabaseInfo.java index 3a901123b78..7ba79fb1fbf 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IDatabaseInfo.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IDatabaseInfo.java @@ -1,34 +1,34 @@ -/*******************************************************************************
- * 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.core.data;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IDatabaseInfo extends Serializable {
-
- String getId();
-
- String getDatabaseName();
-
- String getDatabaseLoginName();
-
- String getDriver();
-
- String getConnectionUrl();
-
- Properties getConnectionProperties();
-
- boolean isProduction();
-}
+/******************************************************************************* + * 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.core.data; + +import java.io.Serializable; +import java.util.Properties; + +/** + * @author Roberto E. Escobar + */ +public interface IDatabaseInfo extends Serializable { + + String getId(); + + String getDatabaseName(); + + String getDatabaseLoginName(); + + String getDriver(); + + String getConnectionUrl(); + + Properties getConnectionProperties(); + + boolean isProduction(); +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeUserInfo.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeUserInfo.java index 817077b0d07..52b83b0e34b 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeUserInfo.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeUserInfo.java @@ -1,20 +1,20 @@ -/*******************************************************************************
- * 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.core.data;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IOseeUserInfo extends IOseeUser {
-
- public boolean isCreationRequired();
-
-}
+/******************************************************************************* + * 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.core.data; + +/** + * @author Roberto E. Escobar + */ +public interface IOseeUserInfo extends IOseeUser { + + public boolean isCreationRequired(); + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Named.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Named.java index 0053b686664..85f97ec4baa 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Named.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Named.java @@ -1,20 +1,20 @@ -/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.osee.framework.core.data;
-
-/**
- * @author Andrew M. Finkbeiner
- *
- */
-public interface Named {
- String getName();
-}
+/******************************************************************************* + * Copyright (c) 2009 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ + +package org.eclipse.osee.framework.core.data; + +/** + * @author Andrew M. Finkbeiner + * + */ +public interface Named { + String getName(); +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeBranch.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeBranch.java index 6f6b33c1190..4c9569f8562 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeBranch.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeBranch.java @@ -1,32 +1,32 @@ -/*
- * Created on Jul 19, 2010
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.core.data;
-
-/**
- * @author Donald G. Dunne
- */
-public class OseeBranch implements IOseeBranch {
-
- private final String name;
- private final String guid;
-
- public OseeBranch(String name, String guid) {
- this.name = name;
- this.guid = guid;
-
- }
-
- @Override
- public String getGuid() {
- return guid;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
-}
+/* + * Created on Jul 19, 2010 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.framework.core.data; + +/** + * @author Donald G. Dunne + */ +public class OseeBranch implements IOseeBranch { + + private final String name; + private final String guid; + + public OseeBranch(String name, String guid) { + this.name = name; + this.guid = guid; + + } + + @Override + public String getGuid() { + return guid; + } + + @Override + public String getName() { + return name; + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClientInfo.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClientInfo.java index f583c045497..fda50d78ab6 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClientInfo.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeClientInfo.java @@ -1,69 +1,69 @@ -/*******************************************************************************
- * 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.core.data;
-
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeClientInfo extends BaseExchangeData {
- private static final long serialVersionUID = -4467800965183123628L;
- private static final String CLIENT_VERSION = "clientVersion";
- private static final String CLIENT_IP_ADDRESS = "clientIpAddress";
- private static final String CLIENT_PORT = "clientPort";
- private static final String CLIENT_MACHINE_NAME = "clientMachineName";
-
- public OseeClientInfo() {
- super();
- }
-
- public OseeClientInfo(String clientVersion, String machineName, String address, int port) {
- super();
- this.backingData.put(CLIENT_VERSION, clientVersion);
- this.backingData.put(CLIENT_MACHINE_NAME, machineName);
- setClientAddress(address, port);
- }
-
- public void setClientAddress(String address, int port) {
- this.backingData.put(CLIENT_IP_ADDRESS, address);
- this.backingData.put(CLIENT_PORT, port);
- }
-
- public void setClientVersion(String version) {
- this.backingData.put(CLIENT_VERSION, version);
- }
-
- public void setClientMachineName(String name) {
- this.backingData.put(CLIENT_MACHINE_NAME, name);
- }
-
- public String getClientAddress() {
- return getString(CLIENT_IP_ADDRESS);
- }
-
- public String getVersion() {
- return getString(CLIENT_VERSION);
- }
-
- public String getClientMachineName() {
- return getString(CLIENT_MACHINE_NAME);
- }
-
- public int getPort() {
- int toReturn = -1;
- String port = this.getString(CLIENT_PORT);
- if (Strings.isValid(port)) {
- toReturn = Integer.valueOf(port);
- }
- 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.core.data; + +import org.eclipse.osee.framework.jdk.core.util.Strings; + +/** + * @author Roberto E. Escobar + */ +public class OseeClientInfo extends BaseExchangeData { + private static final long serialVersionUID = -4467800965183123628L; + private static final String CLIENT_VERSION = "clientVersion"; + private static final String CLIENT_IP_ADDRESS = "clientIpAddress"; + private static final String CLIENT_PORT = "clientPort"; + private static final String CLIENT_MACHINE_NAME = "clientMachineName"; + + public OseeClientInfo() { + super(); + } + + public OseeClientInfo(String clientVersion, String machineName, String address, int port) { + super(); + this.backingData.put(CLIENT_VERSION, clientVersion); + this.backingData.put(CLIENT_MACHINE_NAME, machineName); + setClientAddress(address, port); + } + + public void setClientAddress(String address, int port) { + this.backingData.put(CLIENT_IP_ADDRESS, address); + this.backingData.put(CLIENT_PORT, port); + } + + public void setClientVersion(String version) { + this.backingData.put(CLIENT_VERSION, version); + } + + public void setClientMachineName(String name) { + this.backingData.put(CLIENT_MACHINE_NAME, name); + } + + public String getClientAddress() { + return getString(CLIENT_IP_ADDRESS); + } + + public String getVersion() { + return getString(CLIENT_VERSION); + } + + public String getClientMachineName() { + return getString(CLIENT_MACHINE_NAME); + } + + public int getPort() { + int toReturn = -1; + String port = this.getString(CLIENT_PORT); + if (Strings.isValid(port)) { + toReturn = Integer.valueOf(port); + } + return toReturn; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java index e502b1430c8..de0cfdd000b 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeCredential.java @@ -1,74 +1,74 @@ -/*******************************************************************************
- * 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.core.data;
-
-import java.io.InputStream;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeCredential extends OseeClientInfo {
- private static final long serialVersionUID = 4583587251351958961L;
- private static final String USERNAME = "userName";
- private static final String PASSWORD = "password";
- private static final String DOMAIN = "domain";
- private static final String AUTHENTICATION_PROTOCOL = "authenticationProtocol";
-
- public OseeCredential() {
- super();
- }
-
- public void setUserName(String userName) {
- this.backingData.put(USERNAME, userName);
- }
-
- public void setPassword(String password) {
- this.backingData.put(PASSWORD, password);
- }
-
- public void setDomain(String domain) {
- this.backingData.put(DOMAIN, domain);
- }
-
- public String getUserName() {
- return getString(USERNAME);
- }
-
- public String getPassword() {
- return getString(PASSWORD);
- }
-
- public String getDomain() {
- return getString(DOMAIN);
- }
-
- public String getAuthenticationProtocol() {
- return getString(AUTHENTICATION_PROTOCOL);
- }
-
- public void setAuthenticationProtocol(String protocol) {
- this.backingData.put(AUTHENTICATION_PROTOCOL, protocol);
- }
-
- /**
- * Create new instance from XML input
- *
- * @param OseeCredential the new instance
- * @throws OseeWrappedException
- */
- public static OseeCredential fromXml(InputStream inputStream) throws OseeCoreException {
- OseeCredential session = new OseeCredential();
- session.loadfromXml(inputStream);
- return session;
- }
-}
+/******************************************************************************* + * 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.core.data; + +import java.io.InputStream; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeWrappedException; + +/** + * @author Roberto E. Escobar + */ +public class OseeCredential extends OseeClientInfo { + private static final long serialVersionUID = 4583587251351958961L; + private static final String USERNAME = "userName"; + private static final String PASSWORD = "password"; + private static final String DOMAIN = "domain"; + private static final String AUTHENTICATION_PROTOCOL = "authenticationProtocol"; + + public OseeCredential() { + super(); + } + + public void setUserName(String userName) { + this.backingData.put(USERNAME, userName); + } + + public void setPassword(String password) { + this.backingData.put(PASSWORD, password); + } + + public void setDomain(String domain) { + this.backingData.put(DOMAIN, domain); + } + + public String getUserName() { + return getString(USERNAME); + } + + public String getPassword() { + return getString(PASSWORD); + } + + public String getDomain() { + return getString(DOMAIN); + } + + public String getAuthenticationProtocol() { + return getString(AUTHENTICATION_PROTOCOL); + } + + public void setAuthenticationProtocol(String protocol) { + this.backingData.put(AUTHENTICATION_PROTOCOL, protocol); + } + + /** + * Create new instance from XML input + * + * @param OseeCredential the new instance + * @throws OseeWrappedException + */ + public static OseeCredential fromXml(InputStream inputStream) throws OseeCoreException { + OseeCredential session = new OseeCredential(); + session.loadfromXml(inputStream); + return session; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java index 749d011a889..936941c0cfc 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerContext.java @@ -1,41 +1,41 @@ -/*******************************************************************************
- * 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.core.data;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeServerContext {
-
- private static final String BASE_CONTEXT = "osee";
-
- public static final String PROCESS_CONTEXT = "GET.ARTIFACT"; // For backwards compatibility must remain without base context.
- public static final String SEARCH_CONTEXT = asAbsoluteContext("search");
- public static final String MANAGER_CONTEXT = asAbsoluteContext("manager");
- public static final String BRANCH_CONTEXT = asAbsoluteContext("branch");
- public static final String BRANCH_EXCHANGE_CONTEXT = asAbsoluteContext("branch/exchange");
- public static final String SEARCH_TAGGING_CONTEXT = asAbsoluteContext("search/tagger");
- public static final String RESOURCE_CONTEXT = asAbsoluteContext("resource");
- public static final String SESSION_CONTEXT = asAbsoluteContext("session");
- public static final String LOOKUP_CONTEXT = asAbsoluteContext("server/lookup");
- public static final String CLIENT_LOOPBACK_CONTEXT = asAbsoluteContext("client/loopback");
- public static final String ARTIFACT_CONTEXT = asAbsoluteContext("artifact");
- public static final String OSEE_MODEL_CONTEXT = asAbsoluteContext("model");
- public static final String OSEE_CONFIGURE_CONTEXT = asAbsoluteContext("configure");
- public static final String CACHE_CONTEXT = asAbsoluteContext("cache");
-
- private static final String asAbsoluteContext(String value) {
- return BASE_CONTEXT + "/" + value;
- }
-
- private OseeServerContext() {
- }
-}
+/******************************************************************************* + * 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.core.data; + +/** + * @author Roberto E. Escobar + */ +public class OseeServerContext { + + private static final String BASE_CONTEXT = "osee"; + + public static final String PROCESS_CONTEXT = "GET.ARTIFACT"; // For backwards compatibility must remain without base context. + public static final String SEARCH_CONTEXT = asAbsoluteContext("search"); + public static final String MANAGER_CONTEXT = asAbsoluteContext("manager"); + public static final String BRANCH_CONTEXT = asAbsoluteContext("branch"); + public static final String BRANCH_EXCHANGE_CONTEXT = asAbsoluteContext("branch/exchange"); + public static final String SEARCH_TAGGING_CONTEXT = asAbsoluteContext("search/tagger"); + public static final String RESOURCE_CONTEXT = asAbsoluteContext("resource"); + public static final String SESSION_CONTEXT = asAbsoluteContext("session"); + public static final String LOOKUP_CONTEXT = asAbsoluteContext("server/lookup"); + public static final String CLIENT_LOOPBACK_CONTEXT = asAbsoluteContext("client/loopback"); + public static final String ARTIFACT_CONTEXT = asAbsoluteContext("artifact"); + public static final String OSEE_MODEL_CONTEXT = asAbsoluteContext("model"); + public static final String OSEE_CONFIGURE_CONTEXT = asAbsoluteContext("configure"); + public static final String CACHE_CONTEXT = asAbsoluteContext("cache"); + + private static final String asAbsoluteContext(String value) { + return BASE_CONTEXT + "/" + value; + } + + private OseeServerContext() { + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerInfo.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerInfo.java index 2f6a6afea3a..17b321244f2 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerInfo.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeServerInfo.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.core.data;
-
-import java.io.InputStream;
-import java.sql.Timestamp;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeServerInfo extends BaseExchangeData {
- private static final long serialVersionUID = 2696663265012016128L;
- private static final String[] EMPTY_ARRAY = new String[0];
- private static final String SERVER_ADDRESS = "serverAddress";
- private static final String PORT = "port";
- protected static final String VERSION = "version";
- private static final String DATE_CREATED = "creationDate";
- private static final String SERVER_ID = "serverId";
- private static final String IS_ACCEPTING_REQUESTS = "isAcceptingRequests";
-
- private OseeServerInfo() {
- super();
- }
-
- public OseeServerInfo(String serverId, String serverAddress, int port, String[] version, Timestamp dateStarted, boolean isAcceptingRequests) {
- this();
- this.backingData.put(SERVER_ID, serverId);
- this.backingData.put(SERVER_ADDRESS, serverAddress);
- this.backingData.put(PORT, port);
- this.backingData.put(VERSION, version);
- this.backingData.put(DATE_CREATED, dateStarted.getTime());
- this.backingData.put(IS_ACCEPTING_REQUESTS, isAcceptingRequests);
- }
-
- /**
- * @return the serverId
- */
- public String getServerId() {
- return getString(SERVER_ID);
- }
-
- /**
- * @return the serverAddress
- */
- public String getServerAddress() {
- return getString(SERVER_ADDRESS);
- }
-
- /**
- * @return the port
- */
- public int getPort() {
- return backingData.getInt(PORT);
- }
-
- /**
- * @return the version
- */
- public String[] getVersion() {
- String[] toReturn = backingData.getArray(VERSION);
- return toReturn != null ? toReturn : EMPTY_ARRAY;
- }
-
- /**
- * @return whether requests are accepted
- */
- public boolean isAcceptingRequests() {
- return backingData.getBoolean(IS_ACCEPTING_REQUESTS);
- }
-
- /**
- * @return when server was launched
- */
- public Timestamp getDateStarted() {
- return new Timestamp(backingData.getLong(DATE_CREATED));
- }
-
- /**
- * @param whether server is accepting requests
- */
- public void setAcceptingRequests(boolean value) {
- backingData.put(IS_ACCEPTING_REQUESTS, value);
- }
-
- /**
- * Create new instance from XML input
- *
- * @param OseeServerInfo the new instance
- * @throws OseeWrappedException
- */
- public static OseeServerInfo fromXml(InputStream inputStream) throws OseeCoreException {
- OseeServerInfo serverInfo = new OseeServerInfo();
- serverInfo.loadfromXml(inputStream);
- return serverInfo;
- }
-}
+/******************************************************************************* + * 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.core.data; + +import java.io.InputStream; +import java.sql.Timestamp; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeWrappedException; + +/** + * @author Roberto E. Escobar + */ +public class OseeServerInfo extends BaseExchangeData { + private static final long serialVersionUID = 2696663265012016128L; + private static final String[] EMPTY_ARRAY = new String[0]; + private static final String SERVER_ADDRESS = "serverAddress"; + private static final String PORT = "port"; + protected static final String VERSION = "version"; + private static final String DATE_CREATED = "creationDate"; + private static final String SERVER_ID = "serverId"; + private static final String IS_ACCEPTING_REQUESTS = "isAcceptingRequests"; + + private OseeServerInfo() { + super(); + } + + public OseeServerInfo(String serverId, String serverAddress, int port, String[] version, Timestamp dateStarted, boolean isAcceptingRequests) { + this(); + this.backingData.put(SERVER_ID, serverId); + this.backingData.put(SERVER_ADDRESS, serverAddress); + this.backingData.put(PORT, port); + this.backingData.put(VERSION, version); + this.backingData.put(DATE_CREATED, dateStarted.getTime()); + this.backingData.put(IS_ACCEPTING_REQUESTS, isAcceptingRequests); + } + + /** + * @return the serverId + */ + public String getServerId() { + return getString(SERVER_ID); + } + + /** + * @return the serverAddress + */ + public String getServerAddress() { + return getString(SERVER_ADDRESS); + } + + /** + * @return the port + */ + public int getPort() { + return backingData.getInt(PORT); + } + + /** + * @return the version + */ + public String[] getVersion() { + String[] toReturn = backingData.getArray(VERSION); + return toReturn != null ? toReturn : EMPTY_ARRAY; + } + + /** + * @return whether requests are accepted + */ + public boolean isAcceptingRequests() { + return backingData.getBoolean(IS_ACCEPTING_REQUESTS); + } + + /** + * @return when server was launched + */ + public Timestamp getDateStarted() { + return new Timestamp(backingData.getLong(DATE_CREATED)); + } + + /** + * @param whether server is accepting requests + */ + public void setAcceptingRequests(boolean value) { + backingData.put(IS_ACCEPTING_REQUESTS, value); + } + + /** + * Create new instance from XML input + * + * @param OseeServerInfo the new instance + * @throws OseeWrappedException + */ + public static OseeServerInfo fromXml(InputStream inputStream) throws OseeCoreException { + OseeServerInfo serverInfo = new OseeServerInfo(); + serverInfo.loadfromXml(inputStream); + return serverInfo; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSession.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSession.java index f905a235c51..203e83a94fe 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSession.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSession.java @@ -1,117 +1,117 @@ -/*******************************************************************************
- * 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.core.data;
-
-import java.io.InputStream;
-import java.sql.Timestamp;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeSession extends OseeClientInfo {
-
- private static final long serialVersionUID = 8144856081780854567L;
- private static final String SESSION_ID = "sessionId";
- private static final String USER_ID = "userId";
- private static final String CREATED_ON = "createdOn";
- private static final String LAST_INTERACTION_DATE = "lastInteractionDate";
- private static final String LAST_INTERACTION = "lastInteraction";
-
- private OseeSession() {
- super();
- }
-
- public OseeSession(String sessionId, String userId, Timestamp createdOn, String machineName, String machineIp, int port, String clientVersion, Timestamp lastInteractionDate, String lastInteractionName) {
- super(clientVersion, machineName, machineIp, port);
- this.backingData.put(SESSION_ID, sessionId);
- this.backingData.put(USER_ID, userId);
- this.backingData.put(CREATED_ON, createdOn.getTime());
- this.backingData.put(LAST_INTERACTION_DATE, lastInteractionDate.getTime());
- this.backingData.put(LAST_INTERACTION, lastInteractionName);
- }
-
- /**
- * @return the userId
- */
- public String getUserId() {
- return getString(USER_ID);
- }
-
- /**
- * @return the session id
- */
- public String getSessionId() {
- return getString(SESSION_ID);
- }
-
- /**
- * @return the session creation date
- */
- public Timestamp getCreation() {
- return new Timestamp(backingData.getLong(CREATED_ON));
- }
-
- /**
- * @return the last task performed/requested
- */
- public String getLastInteraction() {
- return getString(LAST_INTERACTION);
- }
-
- /**
- * @return the last communication timestamp
- */
- public Timestamp getLastInteractionDate() {
- return new Timestamp(backingData.getLong(LAST_INTERACTION_DATE));
- }
-
- /**
- * Set the last interaction name
- *
- * @param lastInteractionName
- */
- public void setLastInteraction(String lastInteractionName) {
- this.backingData.put(LAST_INTERACTION, lastInteractionName);
- }
-
- /**
- * Set the last interaction date
- *
- * @param timestamp
- */
- public void setLastInteractionDate(Timestamp timestamp) {
- this.backingData.put(LAST_INTERACTION_DATE, timestamp.getTime());
- }
-
- /**
- * Get a the session id and version in a single string
- *
- * @param the session id and version
- */
- public String getSessionIdAndVersion() {
- return String.format("%s - %s", getSessionId(), getVersion());
- }
-
- /**
- * Create new instance from XML input
- *
- * @param OseeSession the new instance
- * @throws OseeWrappedException
- */
- public static OseeSession fromXml(InputStream inputStream) throws OseeCoreException {
- OseeSession session = new OseeSession();
- session.loadfromXml(inputStream);
- return session;
- }
-
-}
+/******************************************************************************* + * 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.core.data; + +import java.io.InputStream; +import java.sql.Timestamp; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeWrappedException; + +/** + * @author Roberto E. Escobar + */ +public class OseeSession extends OseeClientInfo { + + private static final long serialVersionUID = 8144856081780854567L; + private static final String SESSION_ID = "sessionId"; + private static final String USER_ID = "userId"; + private static final String CREATED_ON = "createdOn"; + private static final String LAST_INTERACTION_DATE = "lastInteractionDate"; + private static final String LAST_INTERACTION = "lastInteraction"; + + private OseeSession() { + super(); + } + + public OseeSession(String sessionId, String userId, Timestamp createdOn, String machineName, String machineIp, int port, String clientVersion, Timestamp lastInteractionDate, String lastInteractionName) { + super(clientVersion, machineName, machineIp, port); + this.backingData.put(SESSION_ID, sessionId); + this.backingData.put(USER_ID, userId); + this.backingData.put(CREATED_ON, createdOn.getTime()); + this.backingData.put(LAST_INTERACTION_DATE, lastInteractionDate.getTime()); + this.backingData.put(LAST_INTERACTION, lastInteractionName); + } + + /** + * @return the userId + */ + public String getUserId() { + return getString(USER_ID); + } + + /** + * @return the session id + */ + public String getSessionId() { + return getString(SESSION_ID); + } + + /** + * @return the session creation date + */ + public Timestamp getCreation() { + return new Timestamp(backingData.getLong(CREATED_ON)); + } + + /** + * @return the last task performed/requested + */ + public String getLastInteraction() { + return getString(LAST_INTERACTION); + } + + /** + * @return the last communication timestamp + */ + public Timestamp getLastInteractionDate() { + return new Timestamp(backingData.getLong(LAST_INTERACTION_DATE)); + } + + /** + * Set the last interaction name + * + * @param lastInteractionName + */ + public void setLastInteraction(String lastInteractionName) { + this.backingData.put(LAST_INTERACTION, lastInteractionName); + } + + /** + * Set the last interaction date + * + * @param timestamp + */ + public void setLastInteractionDate(Timestamp timestamp) { + this.backingData.put(LAST_INTERACTION_DATE, timestamp.getTime()); + } + + /** + * Get a the session id and version in a single string + * + * @param the session id and version + */ + public String getSessionIdAndVersion() { + return String.format("%s - %s", getSessionId(), getVersion()); + } + + /** + * Create new instance from XML input + * + * @param OseeSession the new instance + * @throws OseeWrappedException + */ + public static OseeSession fromXml(InputStream inputStream) throws OseeCoreException { + OseeSession session = new OseeSession(); + session.loadfromXml(inputStream); + return session; + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java index 4ddc6600407..3e02100486a 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java @@ -1,188 +1,188 @@ -/*******************************************************************************
- * 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.core.data;
-
-import java.io.InputStream;
-import java.util.Properties;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeSessionGrant extends BaseExchangeData {
-
- private static final long serialVersionUID = -7236201704435470272L;
- private static final String SESSION_ID = "sessionId";
- private static final String SQL_PROPERTIES = "slqProperty";
-
- private static final String DB_DRIVER = "dbDriver";
- private static final String DB_CONNECTION_URL = "dbUrl";
- private static final String DB_CONNECT_PROPERTIES = "dbConnectionProperties";
- private static final String DB_LOGIN_NAME = "dbLogin";
- private static final String DB_DATABASE_NAME = "dbDatabaseName";
- private static final String DB_IS_PRODUCTION = "dbIsProduction";
- private static final String DB_ID = "dbId";
-
- private static final String OSEE_USER_IS_CREATION_REQUIRED = "oseeUserNeedsCreation";
- private static final String OSEE_USER_EMAIL = "oseeUserEmail";
- private static final String OSEE_USER_NAME = "oseeUserName";
- private static final String OSEE_USER_ID = "oseeUserId";
- private static final String OSEE_IS_USER_ACTIVE = "isOseeUserActive";
- private static final String OSEE_APPLICATION_SERVER_DATA_PATH = "oseeApplicationServerDataPath";
- private static final String OSEE_CLIENT_BUILD_DESIGNATION = "oseeClientBuildDesignation";
-
- private IDatabaseInfo grantedDatabaseInfo;
- private IOseeUser grantedOseeUserInfo;
-
- protected OseeSessionGrant() {
- super();
- this.grantedDatabaseInfo = new GrantedDatabaseInfo();
- this.grantedOseeUserInfo = new GrantedOseeUserInfo();
- }
-
- public OseeSessionGrant(String sessionId) {
- super();
- this.backingData.put(SESSION_ID, sessionId);
- }
-
- public String getSessionId() {
- return getString(SESSION_ID);
- }
-
- public IDatabaseInfo getDatabaseInfo() {
- return grantedDatabaseInfo;
- }
-
- public void setDatabaseInfo(IDatabaseInfo dbInfo) {
- this.backingData.put(DB_DRIVER, dbInfo.getDriver());
- this.backingData.put(DB_CONNECTION_URL, dbInfo.getConnectionUrl());
- this.backingData.put(DB_LOGIN_NAME, dbInfo.getDatabaseLoginName());
- this.backingData.put(DB_DATABASE_NAME, dbInfo.getDatabaseName());
- this.backingData.put(DB_IS_PRODUCTION, dbInfo.isProduction());
- this.backingData.put(DB_ID, dbInfo.getId());
- putProperties(DB_CONNECT_PROPERTIES, dbInfo.getConnectionProperties());
- }
-
- public void setSqlProperties(Properties sqlProperties) {
- putProperties(SQL_PROPERTIES, sqlProperties);
- }
-
- public Properties getSqlProperties() {
- return getPropertyString(SQL_PROPERTIES);
- }
-
- public void setOseeUserInfo(IOseeUser userInfo) {
- this.backingData.put(OSEE_USER_EMAIL, userInfo.getEmail());
- this.backingData.put(OSEE_USER_NAME, userInfo.getName());
- this.backingData.put(OSEE_USER_ID, userInfo.getUserID());
- this.backingData.put(OSEE_IS_USER_ACTIVE, userInfo.isActive());
- }
-
- public boolean isCreationRequired() {
- return backingData.getBoolean(OSEE_USER_IS_CREATION_REQUIRED);
- }
-
- public void setCreationRequired(boolean value) {
- this.backingData.put(OSEE_USER_IS_CREATION_REQUIRED, value);
- }
-
- public void setDataStorePath(String oseeApplicationServerData) {
- this.backingData.put(OSEE_APPLICATION_SERVER_DATA_PATH, oseeApplicationServerData);
- }
-
- public String getDataStorePath() {
- return getString(OSEE_APPLICATION_SERVER_DATA_PATH);
- }
-
- public IOseeUser getOseeUserInfo() {
- return grantedOseeUserInfo;
- }
-
- public String getClientBuildDesignation(){
- return getString(OSEE_CLIENT_BUILD_DESIGNATION);
- }
-
- public void setClientBuildDesination(String designation){
- this.backingData.put(OSEE_CLIENT_BUILD_DESIGNATION, designation);
- }
-
- public static OseeSessionGrant fromXml(InputStream inputStream) throws OseeCoreException {
- OseeSessionGrant session = new OseeSessionGrant();
- session.loadfromXml(inputStream);
- return session;
- }
-
- private final class GrantedOseeUserInfo implements IOseeUser {
-
- private static final long serialVersionUID = 4895789161489202252L;
-
- @Override
- public String getEmail() {
- return getString(OSEE_USER_EMAIL);
- }
-
- @Override
- public String getName() {
- return getString(OSEE_USER_NAME);
- }
-
- @Override
- public String getUserID() {
- return getString(OSEE_USER_ID);
- }
-
- @Override
- public boolean isActive() {
- return backingData.getBoolean(OSEE_IS_USER_ACTIVE);
- }
- }
-
- private final class GrantedDatabaseInfo implements IDatabaseInfo {
-
- private static final long serialVersionUID = -7314120611445752014L;
-
- @Override
- public Properties getConnectionProperties() {
- return getPropertyString(DB_CONNECT_PROPERTIES);
- }
-
- @Override
- public String getConnectionUrl() {
- return getString(DB_CONNECTION_URL);
- }
-
- @Override
- public String getDatabaseLoginName() {
- return getString(DB_LOGIN_NAME);
- }
-
- @Override
- public String getDatabaseName() {
- return getString(DB_DATABASE_NAME);
- }
-
- @Override
- public String getDriver() {
- return getString(DB_DRIVER);
- }
-
- @Override
- public String getId() {
- return getString(DB_ID);
- }
-
- @Override
- public boolean isProduction() {
- return Boolean.valueOf(getString(DB_IS_PRODUCTION));
- }
-
- }
-}
+/******************************************************************************* + * 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.core.data; + +import java.io.InputStream; +import java.util.Properties; +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Roberto E. Escobar + */ +public class OseeSessionGrant extends BaseExchangeData { + + private static final long serialVersionUID = -7236201704435470272L; + private static final String SESSION_ID = "sessionId"; + private static final String SQL_PROPERTIES = "slqProperty"; + + private static final String DB_DRIVER = "dbDriver"; + private static final String DB_CONNECTION_URL = "dbUrl"; + private static final String DB_CONNECT_PROPERTIES = "dbConnectionProperties"; + private static final String DB_LOGIN_NAME = "dbLogin"; + private static final String DB_DATABASE_NAME = "dbDatabaseName"; + private static final String DB_IS_PRODUCTION = "dbIsProduction"; + private static final String DB_ID = "dbId"; + + private static final String OSEE_USER_IS_CREATION_REQUIRED = "oseeUserNeedsCreation"; + private static final String OSEE_USER_EMAIL = "oseeUserEmail"; + private static final String OSEE_USER_NAME = "oseeUserName"; + private static final String OSEE_USER_ID = "oseeUserId"; + private static final String OSEE_IS_USER_ACTIVE = "isOseeUserActive"; + private static final String OSEE_APPLICATION_SERVER_DATA_PATH = "oseeApplicationServerDataPath"; + private static final String OSEE_CLIENT_BUILD_DESIGNATION = "oseeClientBuildDesignation"; + + private IDatabaseInfo grantedDatabaseInfo; + private IOseeUser grantedOseeUserInfo; + + protected OseeSessionGrant() { + super(); + this.grantedDatabaseInfo = new GrantedDatabaseInfo(); + this.grantedOseeUserInfo = new GrantedOseeUserInfo(); + } + + public OseeSessionGrant(String sessionId) { + super(); + this.backingData.put(SESSION_ID, sessionId); + } + + public String getSessionId() { + return getString(SESSION_ID); + } + + public IDatabaseInfo getDatabaseInfo() { + return grantedDatabaseInfo; + } + + public void setDatabaseInfo(IDatabaseInfo dbInfo) { + this.backingData.put(DB_DRIVER, dbInfo.getDriver()); + this.backingData.put(DB_CONNECTION_URL, dbInfo.getConnectionUrl()); + this.backingData.put(DB_LOGIN_NAME, dbInfo.getDatabaseLoginName()); + this.backingData.put(DB_DATABASE_NAME, dbInfo.getDatabaseName()); + this.backingData.put(DB_IS_PRODUCTION, dbInfo.isProduction()); + this.backingData.put(DB_ID, dbInfo.getId()); + putProperties(DB_CONNECT_PROPERTIES, dbInfo.getConnectionProperties()); + } + + public void setSqlProperties(Properties sqlProperties) { + putProperties(SQL_PROPERTIES, sqlProperties); + } + + public Properties getSqlProperties() { + return getPropertyString(SQL_PROPERTIES); + } + + public void setOseeUserInfo(IOseeUser userInfo) { + this.backingData.put(OSEE_USER_EMAIL, userInfo.getEmail()); + this.backingData.put(OSEE_USER_NAME, userInfo.getName()); + this.backingData.put(OSEE_USER_ID, userInfo.getUserID()); + this.backingData.put(OSEE_IS_USER_ACTIVE, userInfo.isActive()); + } + + public boolean isCreationRequired() { + return backingData.getBoolean(OSEE_USER_IS_CREATION_REQUIRED); + } + + public void setCreationRequired(boolean value) { + this.backingData.put(OSEE_USER_IS_CREATION_REQUIRED, value); + } + + public void setDataStorePath(String oseeApplicationServerData) { + this.backingData.put(OSEE_APPLICATION_SERVER_DATA_PATH, oseeApplicationServerData); + } + + public String getDataStorePath() { + return getString(OSEE_APPLICATION_SERVER_DATA_PATH); + } + + public IOseeUser getOseeUserInfo() { + return grantedOseeUserInfo; + } + + public String getClientBuildDesignation(){ + return getString(OSEE_CLIENT_BUILD_DESIGNATION); + } + + public void setClientBuildDesination(String designation){ + this.backingData.put(OSEE_CLIENT_BUILD_DESIGNATION, designation); + } + + public static OseeSessionGrant fromXml(InputStream inputStream) throws OseeCoreException { + OseeSessionGrant session = new OseeSessionGrant(); + session.loadfromXml(inputStream); + return session; + } + + private final class GrantedOseeUserInfo implements IOseeUser { + + private static final long serialVersionUID = 4895789161489202252L; + + @Override + public String getEmail() { + return getString(OSEE_USER_EMAIL); + } + + @Override + public String getName() { + return getString(OSEE_USER_NAME); + } + + @Override + public String getUserID() { + return getString(OSEE_USER_ID); + } + + @Override + public boolean isActive() { + return backingData.getBoolean(OSEE_IS_USER_ACTIVE); + } + } + + private final class GrantedDatabaseInfo implements IDatabaseInfo { + + private static final long serialVersionUID = -7314120611445752014L; + + @Override + public Properties getConnectionProperties() { + return getPropertyString(DB_CONNECT_PROPERTIES); + } + + @Override + public String getConnectionUrl() { + return getString(DB_CONNECTION_URL); + } + + @Override + public String getDatabaseLoginName() { + return getString(DB_LOGIN_NAME); + } + + @Override + public String getDatabaseName() { + return getString(DB_DATABASE_NAME); + } + + @Override + public String getDriver() { + return getString(DB_DRIVER); + } + + @Override + public String getId() { + return getString(DB_ID); + } + + @Override + public boolean isProduction() { + return Boolean.valueOf(getString(DB_IS_PRODUCTION)); + } + + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeUser.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeUser.java index bee19fe06d8..3cde5163472 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeUser.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeUser.java @@ -1,49 +1,49 @@ -/*******************************************************************************
- * 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.core.data;
-
-/**
- * @author Ryan D. Brooks
- */
-public class OseeUser implements IOseeUser {
- private static final long serialVersionUID = -4632859204715457300L;
- private final String userName;
- private final String userId;
- private final String userEmail;
- private final boolean isActive;
-
- public OseeUser(String userName, String userId, String userEmail, boolean isActive) {
- this.userName = userName;
- this.userId = userId;
- this.userEmail = userEmail;
- this.isActive = isActive;
- }
-
- @Override
- public String getEmail() {
- return userEmail;
- }
-
- @Override
- public String getName() {
- return userName;
- }
-
- @Override
- public String getUserID() {
- return userId;
- }
-
- @Override
- public boolean isActive() {
- return isActive;
- }
+/******************************************************************************* + * 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.core.data; + +/** + * @author Ryan D. Brooks + */ +public class OseeUser implements IOseeUser { + private static final long serialVersionUID = -4632859204715457300L; + private final String userName; + private final String userId; + private final String userEmail; + private final boolean isActive; + + public OseeUser(String userName, String userId, String userEmail, boolean isActive) { + this.userName = userName; + this.userId = userId; + this.userEmail = userEmail; + this.isActive = isActive; + } + + @Override + public String getEmail() { + return userEmail; + } + + @Override + public String getName() { + return userName; + } + + @Override + public String getUserID() { + return userId; + } + + @Override + public boolean isActive() { + return isActive; + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TestRunStorageKey.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TestRunStorageKey.java index c6d5eaa303a..2b047ac469b 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TestRunStorageKey.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TestRunStorageKey.java @@ -8,17 +8,17 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.data;
-
-/**
- * @author Roberto E. Escobar
- */
-public class TestRunStorageKey {
- public static final String STORAGE_ENABLED = "test.run.upload.enabled";
- public static final String SELECTED_BRANCH_ID = "last.branch.id";
- public static final String BRANCH_IDS = "all.branches.id";
-
- private TestRunStorageKey() {
- }
-
-}
+package org.eclipse.osee.framework.core.data; + +/** + * @author Roberto E. Escobar + */ +public class TestRunStorageKey { + public static final String STORAGE_ENABLED = "test.run.upload.enabled"; + public static final String SELECTED_BRANCH_ID = "last.branch.id"; + public static final String BRANCH_IDS = "all.branches.id"; + + private TestRunStorageKey() { + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchArchivedState.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchArchivedState.java index a279f5e1a1a..0386322c275 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchArchivedState.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchArchivedState.java @@ -1,48 +1,48 @@ -/*******************************************************************************
- * 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.core.enums;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum BranchArchivedState {
- ARCHIVED(1), UNARCHIVED(0), ALL(-1);
-
- private final int value;
-
- BranchArchivedState(int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return value;
- }
-
- public boolean isArchived() {
- return this == ARCHIVED;
- }
-
- public boolean isUnArchived() {
- return this == UNARCHIVED;
- }
-
- public boolean matches(BranchArchivedState branchState) {
- return branchState == BranchArchivedState.ALL || this == branchState;
- }
-
- public static BranchArchivedState fromBoolean(boolean isArchived) {
- return isArchived ? ARCHIVED : UNARCHIVED;
- }
-
- public static BranchArchivedState valueOf(int value) {
- return ARCHIVED.getValue() != value ? UNARCHIVED : ARCHIVED;
- }
-}
+/******************************************************************************* + * 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.core.enums; + +/** + * @author Ryan D. Brooks + */ +public enum BranchArchivedState { + ARCHIVED(1), UNARCHIVED(0), ALL(-1); + + private final int value; + + BranchArchivedState(int value) { + this.value = value; + } + + public final int getValue() { + return value; + } + + public boolean isArchived() { + return this == ARCHIVED; + } + + public boolean isUnArchived() { + return this == UNARCHIVED; + } + + public boolean matches(BranchArchivedState branchState) { + return branchState == BranchArchivedState.ALL || this == branchState; + } + + public static BranchArchivedState fromBoolean(boolean isArchived) { + return isArchived ? ARCHIVED : UNARCHIVED; + } + + public static BranchArchivedState valueOf(int value) { + return ARCHIVED.getValue() != value ? UNARCHIVED : ARCHIVED; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchState.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchState.java index b208ec150b2..2f0a1a389bc 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchState.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchState.java @@ -1,75 +1,75 @@ -/*******************************************************************************
- * 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.core.enums;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum BranchState {
- UNKNOWN(-1),
- CREATED(0),
- MODIFIED(1),
- COMMITTED(2),
- REBASELINED(3),
- DELETED(4),
- REBASELINE_IN_PROGRESS(5),
- COMMIT_IN_PROGRESS(6),
- CREATION_IN_PROGRESS(7);
-
- private final int value;
-
- BranchState(int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return value;
- }
-
- public boolean isCommitted() {
- return this == BranchState.COMMITTED;
- }
-
- public boolean isRebaselined() {
- return this == BranchState.REBASELINED;
- }
-
- public boolean isRebaselineInProgress() {
- return this == BranchState.REBASELINE_IN_PROGRESS;
- }
-
- public boolean isCreationInProgress() {
- return this == BranchState.CREATION_IN_PROGRESS;
- }
-
- public boolean isDeleted() {
- return this == BranchState.DELETED;
- }
-
- public static BranchState getBranchState(int value) {
- for (BranchState type : values()) {
- if (type.getValue() == value) {
- return type;
- }
- }
- return null;
- }
-
- public boolean matches(BranchState... branchStates) {
- for (BranchState branchState : branchStates) {
- if (this == branchState) {
- return true;
- }
- }
- return 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.core.enums; + +/** + * @author Roberto E. Escobar + */ +public enum BranchState { + UNKNOWN(-1), + CREATED(0), + MODIFIED(1), + COMMITTED(2), + REBASELINED(3), + DELETED(4), + REBASELINE_IN_PROGRESS(5), + COMMIT_IN_PROGRESS(6), + CREATION_IN_PROGRESS(7); + + private final int value; + + BranchState(int value) { + this.value = value; + } + + public final int getValue() { + return value; + } + + public boolean isCommitted() { + return this == BranchState.COMMITTED; + } + + public boolean isRebaselined() { + return this == BranchState.REBASELINED; + } + + public boolean isRebaselineInProgress() { + return this == BranchState.REBASELINE_IN_PROGRESS; + } + + public boolean isCreationInProgress() { + return this == BranchState.CREATION_IN_PROGRESS; + } + + public boolean isDeleted() { + return this == BranchState.DELETED; + } + + public static BranchState getBranchState(int value) { + for (BranchState type : values()) { + if (type.getValue() == value) { + return type; + } + } + return null; + } + + public boolean matches(BranchState... branchStates) { + for (BranchState branchState : branchStates) { + if (this == branchState) { + return true; + } + } + return false; + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchStorageState.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchStorageState.java index 04883ec99ad..de544730051 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchStorageState.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchStorageState.java @@ -8,22 +8,22 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.enums;
-
-/**
- * @author Jeff C. Phillips
- *
- */
-public enum BranchStorageState {
-
- UN_ARCHIVED(0), ARCHIVED(1);
- private final int value;
-
- BranchStorageState(int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return value;
- }
-}
+package org.eclipse.osee.framework.core.enums; + +/** + * @author Jeff C. Phillips + * + */ +public enum BranchStorageState { + + UN_ARCHIVED(0), ARCHIVED(1); + private final int value; + + BranchStorageState(int value) { + this.value = value; + } + + public final int getValue() { + return value; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchType.java index d50833ad3ad..a9ea0597966 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/BranchType.java @@ -1,66 +1,66 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum BranchType {
- WORKING(0),
- BASELINE(2),
- MERGE(3),
- SYSTEM_ROOT(4);
- private final int value;
-
- BranchType(int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return value;
- }
-
- public boolean isBaselineBranch() {
- return this == BranchType.BASELINE;
- }
-
- public boolean isSystemRootBranch() {
- return this == BranchType.SYSTEM_ROOT;
- }
-
- public boolean isMergeBranch() {
- return this == BranchType.MERGE;
- }
-
- public boolean isWorkingBranch() {
- return this == BranchType.WORKING;
- }
-
- public boolean isOfType(BranchType... branchTypes) {
- for (BranchType branchType : branchTypes) {
- if (this == branchType) {
- return true;
- }
- }
- return false;
- }
-
- public static BranchType valueOf(int value) throws OseeArgumentException {
- for (BranchType type : values()) {
- if (type.getValue() == value) {
- return type;
- }
- }
- throw new OseeArgumentException("No branch type with value " + 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; + +/** + * @author Ryan D. Brooks + */ +public enum BranchType { + WORKING(0), + BASELINE(2), + MERGE(3), + SYSTEM_ROOT(4); + private final int value; + + BranchType(int value) { + this.value = value; + } + + public final int getValue() { + return value; + } + + public boolean isBaselineBranch() { + return this == BranchType.BASELINE; + } + + public boolean isSystemRootBranch() { + return this == BranchType.SYSTEM_ROOT; + } + + public boolean isMergeBranch() { + return this == BranchType.MERGE; + } + + public boolean isWorkingBranch() { + return this == BranchType.WORKING; + } + + public boolean isOfType(BranchType... branchTypes) { + for (BranchType branchType : branchTypes) { + if (this == branchType) { + return true; + } + } + return false; + } + + public static BranchType valueOf(int value) throws OseeArgumentException { + for (BranchType type : values()) { + if (type.getValue() == value) { + return type; + } + } + throw new OseeArgumentException("No branch type with value " + value); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CacheOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CacheOperation.java index 45365c67b7c..78e88e032b8 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CacheOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CacheOperation.java @@ -1,34 +1,34 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.util.Conditions;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum CacheOperation {
-
- UPDATE,
- STORE;
-
- public static CacheOperation fromString(String value) throws OseeCoreException {
- Conditions.checkNotNullOrEmpty(value, "enum string");
- for (CacheOperation op : CacheOperation.values()) {
- if (op.name().equalsIgnoreCase(value)) {
- return op;
- }
- }
- throw new OseeArgumentException(String.format("Unable to find cache operation matching [%s]", 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.util.Conditions; + +/** + * @author Roberto E. Escobar + */ +public enum CacheOperation { + + UPDATE, + STORE; + + public static CacheOperation fromString(String value) throws OseeCoreException { + Conditions.checkNotNullOrEmpty(value, "enum string"); + for (CacheOperation op : CacheOperation.values()) { + if (op.name().equalsIgnoreCase(value)) { + return op; + } + } + throw new OseeArgumentException(String.format("Unable to find cache operation matching [%s]", value)); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ChangeItemType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ChangeItemType.java index 96b26d4987c..568ec90e077 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ChangeItemType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ChangeItemType.java @@ -1,29 +1,29 @@ -/*******************************************************************************
- * 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.core.enums;
-
-/**
- * @author Jeff C. Phillips
- */
-public enum ChangeItemType {
- ARTIFACT,
- ATTRIBUTE,
- RELATION;
-
- public static ChangeItemType getType(String name) {
- for (ChangeItemType type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return null;
- }
-}
+/******************************************************************************* + * 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.core.enums; + +/** + * @author Jeff C. Phillips + */ +public enum ChangeItemType { + ARTIFACT, + ATTRIBUTE, + RELATION; + + public static ChangeItemType getType(String name) { + for (ChangeItemType type : values()) { + if (type.name().equalsIgnoreCase(name)) { + return type; + } + } + return null; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictStatus.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictStatus.java index 7e981b24f51..481b357e269 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictStatus.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictStatus.java @@ -1,87 +1,87 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Theron Virgin
- */
-public enum ConflictStatus {
-
- NOT_CONFLICTED(0),
- UNTOUCHED(1),
- EDITED(2),
- RESOLVED(3),
- OUT_OF_DATE_RESOLVED(4),
- NOT_RESOLVABLE(5),
- COMMITTED(6),
- INFORMATIONAL(7),
- OUT_OF_DATE(8),
- PREVIOUS_MERGE_APPLIED_SUCCESS(9),
- PREVIOUS_MERGE_APPLIED_CAUTION(10);
-
- private final int value;
-
- private ConflictStatus(int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return value;
- }
-
- public static ConflictStatus valueOf(int value) throws OseeCoreException {
- for (ConflictStatus type : values()) {
- if (type.value == value) {
- return type;
- }
- }
- throw new OseeArgumentException(String.format("[%s] is not a valid ConflictStatus"));
- }
-
- public boolean isConflict() {
- return this != NOT_CONFLICTED;
- }
-
- public boolean isCommitted() {
- return this == COMMITTED;
- }
-
- public boolean isInformational() {
- return this == INFORMATIONAL;
- }
-
- public boolean isNotResolvable() {
- return this == NOT_RESOLVABLE;
- }
-
- public boolean isIgnoreable() {
- return isInformational() || isNotResolvable();
- }
-
- public boolean isResolved() {
- return this == RESOLVED;
- }
-
- public boolean hasBeenEdited() {
- return this == EDITED;
- }
-
- public boolean wasPreviousMergeAppliedWithCaution() {
- return this == PREVIOUS_MERGE_APPLIED_CAUTION;
- }
-
- public boolean wasPreviousMergeSuccessfullyApplied() {
- return this == PREVIOUS_MERGE_APPLIED_SUCCESS;
- }
-}
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Theron Virgin + */ +public enum ConflictStatus { + + NOT_CONFLICTED(0), + UNTOUCHED(1), + EDITED(2), + RESOLVED(3), + OUT_OF_DATE_RESOLVED(4), + NOT_RESOLVABLE(5), + COMMITTED(6), + INFORMATIONAL(7), + OUT_OF_DATE(8), + PREVIOUS_MERGE_APPLIED_SUCCESS(9), + PREVIOUS_MERGE_APPLIED_CAUTION(10); + + private final int value; + + private ConflictStatus(int value) { + this.value = value; + } + + public final int getValue() { + return value; + } + + public static ConflictStatus valueOf(int value) throws OseeCoreException { + for (ConflictStatus type : values()) { + if (type.value == value) { + return type; + } + } + throw new OseeArgumentException(String.format("[%s] is not a valid ConflictStatus")); + } + + public boolean isConflict() { + return this != NOT_CONFLICTED; + } + + public boolean isCommitted() { + return this == COMMITTED; + } + + public boolean isInformational() { + return this == INFORMATIONAL; + } + + public boolean isNotResolvable() { + return this == NOT_RESOLVABLE; + } + + public boolean isIgnoreable() { + return isInformational() || isNotResolvable(); + } + + public boolean isResolved() { + return this == RESOLVED; + } + + public boolean hasBeenEdited() { + return this == EDITED; + } + + public boolean wasPreviousMergeAppliedWithCaution() { + return this == PREVIOUS_MERGE_APPLIED_CAUTION; + } + + public boolean wasPreviousMergeSuccessfullyApplied() { + return this == PREVIOUS_MERGE_APPLIED_SUCCESS; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictType.java index bc4e827a2a0..e79a40fd0ad 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ConflictType.java @@ -1,42 +1,42 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Theron Virgin
- */
-public enum ConflictType {
-
- ATTRIBUTE(1),
- RELATION(2),
- ARTIFACT(3);
- private final int value;
-
- ConflictType(int value) {
- this.value = value;
- }
-
- public final int getValue() {
- return value;
- }
-
- public static ConflictType valueOf(int value) throws OseeCoreException {
- for (ConflictType type : values()) {
- if (type.value == value) {
- return type;
- }
- }
- throw new OseeArgumentException(String.format("[%s] is not a valid ConflictType"));
- }
-}
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Theron Virgin + */ +public enum ConflictType { + + ATTRIBUTE(1), + RELATION(2), + ARTIFACT(3); + private final int value; + + ConflictType(int value) { + this.value = value; + } + + public final int getValue() { + return value; + } + + public static ConflictType valueOf(int value) throws OseeCoreException { + for (ConflictType type : values()) { + if (type.value == value) { + return type; + } + } + throw new OseeArgumentException(String.format("[%s] is not a valid ConflictType")); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java index 9580e80f026..0a60c9dec81 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.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.core.enums;
-
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.data.NamedIdentity;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CoreAttributeTypes extends NamedIdentity implements IAttributeType {
- public static final CoreAttributeTypes Active = new CoreAttributeTypes("AAMFEbImQyR38BY8A5QA", "Active");
- public static final CoreAttributeTypes Annotation = new CoreAttributeTypes("AAMFEcWy0xc4e3tcemQA", "Annotation");
- public static final CoreAttributeTypes DEFAULT_MAIL_SERVER =
- new CoreAttributeTypes("ABMuIC3FejpGilonfAgA", "osee.config.Default Mail Server");
- public static final CoreAttributeTypes EMAIL = new CoreAttributeTypes("AAMFEbaZjEVoecDFCCQA", "Email");
- public static final CoreAttributeTypes FAVORITE_BRANCH =
- new CoreAttributeTypes("AAMFEbMnzS7P92knZKAA", "Favorite Branch");
- public static final CoreAttributeTypes GENERAL_STRING_DATA =
- new CoreAttributeTypes("AAMFEca+MB5ssx+Ax5wA", "General String Data");
- public static final CoreAttributeTypes NAME = new CoreAttributeTypes("AAMFEcF1AzV7PKuHmxwA", "Name");
- public static final CoreAttributeTypes NATIVE_CONTENT =
- new CoreAttributeTypes("AAMFEcdBJGBK9nr9TTQA", "Native Content");
- public static final CoreAttributeTypes NATIVE_EXTENSION =
- new CoreAttributeTypes("AAMFEcUbJEERZTnwJzAA", "Extension");
- public static final CoreAttributeTypes PARAGRAPH_NUMBER =
- new CoreAttributeTypes("AAMFEQ3boD3sp6VfArAA", "Imported Paragraph Number");
- public static final CoreAttributeTypes PHONE = new CoreAttributeTypes("AAMFEbUkVSwKu4LSpWAA", "Phone");
- public static final CoreAttributeTypes QUALIFICATION_METHOD =
- new CoreAttributeTypes("AAMFERMRKHkM9k_Rg2QA", "Qualification Method");
- public static final CoreAttributeTypes WHOLE_WORD_CONTENT =
- new CoreAttributeTypes("AAMFEchZmAzZo2tHjVAA", "Whole Word Content");
- public static final CoreAttributeTypes WORD_TEMPLATE_CONTENT =
- new CoreAttributeTypes("AAMFEcfcGS2V3SqQN2wA", "Word Template Content");
- public static final CoreAttributeTypes WORD_OLE_DATA =
- new CoreAttributeTypes("AAMFEcP2rmoCzqmzJxQA", "Word Ole Data");
- public static final CoreAttributeTypes RELATION_ORDER =
- new CoreAttributeTypes("ABM5kHa9cFsTbI_ooyQA", "Relation Order");
- public static final CoreAttributeTypes SUBSYSTEM = new CoreAttributeTypes("AAMFERJ1GweNukuSd8QA", "Subsystem");
- public static final CoreAttributeTypes TEST_STATUS = new CoreAttributeTypes("AKTJWsjz3EjFV94XNHAA", "Test Status");
- public static final CoreAttributeTypes TEST_PROCEDURE_STATUS =
- new CoreAttributeTypes("AKkUuN2K1ilSHnvIMPQA", "Test Procedure Status");
- public static final CoreAttributeTypes USER_ID = new CoreAttributeTypes("AAMFEbKl8RCQr17bDAQA", "User Id");
- public static final CoreAttributeTypes VERIFICATION_LEVEL =
- new CoreAttributeTypes("AAMFEXRTkyKVIFqcMwQA", "Verification Level");
- public static final CoreAttributeTypes STATIC_ID = new CoreAttributeTypes("AAMFEcY5DUbWyuIpZVwA", "Static Id");
- public static final CoreAttributeTypes PARTITION = new CoreAttributeTypes("AAMFERHj9w6pmoLBCaQA", "Partition");
- public static final CoreAttributeTypes SAFETY_CRITICALITY =
- new CoreAttributeTypes("AAMFERg99R51HIz45HAA", "Safety Criticality");
-
- public static final CoreAttributeTypes Description = new CoreAttributeTypes("AAMFEcK+kyOhG8GYvPgA", "Description");
-
- private CoreAttributeTypes(String guid, String name) {
- super(guid, name);
- }
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.data.IAttributeType; +import org.eclipse.osee.framework.core.data.NamedIdentity; + +/** + * @author Roberto E. Escobar + */ +public class CoreAttributeTypes extends NamedIdentity implements IAttributeType { + public static final CoreAttributeTypes Active = new CoreAttributeTypes("AAMFEbImQyR38BY8A5QA", "Active"); + public static final CoreAttributeTypes Annotation = new CoreAttributeTypes("AAMFEcWy0xc4e3tcemQA", "Annotation"); + public static final CoreAttributeTypes DEFAULT_MAIL_SERVER = + new CoreAttributeTypes("ABMuIC3FejpGilonfAgA", "osee.config.Default Mail Server"); + public static final CoreAttributeTypes EMAIL = new CoreAttributeTypes("AAMFEbaZjEVoecDFCCQA", "Email"); + public static final CoreAttributeTypes FAVORITE_BRANCH = + new CoreAttributeTypes("AAMFEbMnzS7P92knZKAA", "Favorite Branch"); + public static final CoreAttributeTypes GENERAL_STRING_DATA = + new CoreAttributeTypes("AAMFEca+MB5ssx+Ax5wA", "General String Data"); + public static final CoreAttributeTypes NAME = new CoreAttributeTypes("AAMFEcF1AzV7PKuHmxwA", "Name"); + public static final CoreAttributeTypes NATIVE_CONTENT = + new CoreAttributeTypes("AAMFEcdBJGBK9nr9TTQA", "Native Content"); + public static final CoreAttributeTypes NATIVE_EXTENSION = + new CoreAttributeTypes("AAMFEcUbJEERZTnwJzAA", "Extension"); + public static final CoreAttributeTypes PARAGRAPH_NUMBER = + new CoreAttributeTypes("AAMFEQ3boD3sp6VfArAA", "Imported Paragraph Number"); + public static final CoreAttributeTypes PHONE = new CoreAttributeTypes("AAMFEbUkVSwKu4LSpWAA", "Phone"); + public static final CoreAttributeTypes QUALIFICATION_METHOD = + new CoreAttributeTypes("AAMFERMRKHkM9k_Rg2QA", "Qualification Method"); + public static final CoreAttributeTypes WHOLE_WORD_CONTENT = + new CoreAttributeTypes("AAMFEchZmAzZo2tHjVAA", "Whole Word Content"); + public static final CoreAttributeTypes WORD_TEMPLATE_CONTENT = + new CoreAttributeTypes("AAMFEcfcGS2V3SqQN2wA", "Word Template Content"); + public static final CoreAttributeTypes WORD_OLE_DATA = + new CoreAttributeTypes("AAMFEcP2rmoCzqmzJxQA", "Word Ole Data"); + public static final CoreAttributeTypes RELATION_ORDER = + new CoreAttributeTypes("ABM5kHa9cFsTbI_ooyQA", "Relation Order"); + public static final CoreAttributeTypes SUBSYSTEM = new CoreAttributeTypes("AAMFERJ1GweNukuSd8QA", "Subsystem"); + public static final CoreAttributeTypes TEST_STATUS = new CoreAttributeTypes("AKTJWsjz3EjFV94XNHAA", "Test Status"); + public static final CoreAttributeTypes TEST_PROCEDURE_STATUS = + new CoreAttributeTypes("AKkUuN2K1ilSHnvIMPQA", "Test Procedure Status"); + public static final CoreAttributeTypes USER_ID = new CoreAttributeTypes("AAMFEbKl8RCQr17bDAQA", "User Id"); + public static final CoreAttributeTypes VERIFICATION_LEVEL = + new CoreAttributeTypes("AAMFEXRTkyKVIFqcMwQA", "Verification Level"); + public static final CoreAttributeTypes STATIC_ID = new CoreAttributeTypes("AAMFEcY5DUbWyuIpZVwA", "Static Id"); + public static final CoreAttributeTypes PARTITION = new CoreAttributeTypes("AAMFERHj9w6pmoLBCaQA", "Partition"); + public static final CoreAttributeTypes SAFETY_CRITICALITY = + new CoreAttributeTypes("AAMFERg99R51HIz45HAA", "Safety Criticality"); + + public static final CoreAttributeTypes Description = new CoreAttributeTypes("AAMFEcK+kyOhG8GYvPgA", "Description"); + + private CoreAttributeTypes(String guid, String name) { + super(guid, name); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreBranches.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreBranches.java index 804f97f18fd..c05c5360ea1 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreBranches.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreBranches.java @@ -1,26 +1,26 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.data.NamedIdentity;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CoreBranches extends NamedIdentity implements IOseeBranch {
- public static final CoreBranches COMMON = new CoreBranches("AyH_fDpMERA+zDfML4gA", "Common");
- public static final CoreBranches SYSTEM_ROOT = new CoreBranches("AyH_fDnM2RFEhyybolQA", "System Root Branch");
-
- public CoreBranches(String guid, String name) {
- super(guid, name);
- }
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.NamedIdentity; + +/** + * @author Roberto E. Escobar + */ +public class CoreBranches extends NamedIdentity implements IOseeBranch { + public static final CoreBranches COMMON = new CoreBranches("AyH_fDpMERA+zDfML4gA", "Common"); + public static final CoreBranches SYSTEM_ROOT = new CoreBranches("AyH_fDnM2RFEhyybolQA", "System Root Branch"); + + public CoreBranches(String guid, String name) { + super(guid, name); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java index 80482641e94..fbc68bd7b70 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreTranslatorId.java @@ -1,59 +1,59 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.translation.ITranslatorId;
-
-/**
- * @author Megumi Telles
- * @author Roberto E. Escobar
- */
-public enum CoreTranslatorId implements ITranslatorId {
- BRANCH_COMMIT_REQUEST,
- BRANCH_COMMIT_RESPONSE,
- PURGE_BRANCH_REQUEST,
-
- CHANGE_BRANCH_TYPE,
- CHANGE_BRANCH_STATE,
- CHANGE_BRANCH_ARCHIVE_STATE,
-
- CHANGE_VERSION,
- CHANGE_ITEM,
- CHANGE_REPORT_REQUEST,
- CHANGE_REPORT_RESPONSE,
-
- OSEE_DATASTORE_INIT_REQUEST,
-
- OSEE_IMPORT_MODEL_REQUEST,
- OSEE_IMPORT_MODEL_RESPONSE,
-
- OSEE_CACHE_UPDATE_REQUEST,
- ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE,
- ATTRIBUTE_TYPE_CACHE_UPDATE_RESPONSE,
- RELATION_TYPE_CACHE_UPDATE_RESPONSE,
- OSEE_ENUM_TYPE_CACHE_UPDATE_RESPONSE,
- TX_CACHE_UPDATE_RESPONSE,
- BRANCH_CACHE_UPDATE_RESPONSE,
- BRANCH_CACHE_STORE_REQUEST,
-
- TRANSACTION_RECORD,
- BRANCH_CREATION_REQUEST,
- BRANCH_CREATION_RESPONSE,
- TABLE_DATA,
-
- STATUS_RESPONSE;
-
- @Override
- public String getKey() {
- return this.name();
- }
-
-}
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.translation.ITranslatorId; + +/** + * @author Megumi Telles + * @author Roberto E. Escobar + */ +public enum CoreTranslatorId implements ITranslatorId { + BRANCH_COMMIT_REQUEST, + BRANCH_COMMIT_RESPONSE, + PURGE_BRANCH_REQUEST, + + CHANGE_BRANCH_TYPE, + CHANGE_BRANCH_STATE, + CHANGE_BRANCH_ARCHIVE_STATE, + + CHANGE_VERSION, + CHANGE_ITEM, + CHANGE_REPORT_REQUEST, + CHANGE_REPORT_RESPONSE, + + OSEE_DATASTORE_INIT_REQUEST, + + OSEE_IMPORT_MODEL_REQUEST, + OSEE_IMPORT_MODEL_RESPONSE, + + OSEE_CACHE_UPDATE_REQUEST, + ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE, + ATTRIBUTE_TYPE_CACHE_UPDATE_RESPONSE, + RELATION_TYPE_CACHE_UPDATE_RESPONSE, + OSEE_ENUM_TYPE_CACHE_UPDATE_RESPONSE, + TX_CACHE_UPDATE_RESPONSE, + BRANCH_CACHE_UPDATE_RESPONSE, + BRANCH_CACHE_STORE_REQUEST, + + TRANSACTION_RECORD, + BRANCH_CREATION_REQUEST, + BRANCH_CREATION_RESPONSE, + TABLE_DATA, + + STATUS_RESPONSE; + + @Override + public String getKey() { + return this.name(); + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/EditState.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/EditState.java index 6a675e388a2..c83be99ea50 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/EditState.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/EditState.java @@ -1,33 +1,33 @@ -/*******************************************************************************
- * 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.core.enums;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum EditState {
-
- NO_CHANGE,
- ARTIFACT_TYPE_MODIFIED,
- ARTIFACT_TYPE_HISTORICAL_CHANGE;
-
- public boolean isArtifactTypeChange() {
- return this == ARTIFACT_TYPE_MODIFIED || this == ARTIFACT_TYPE_HISTORICAL_CHANGE;
- }
-
- public boolean isHistoricalArtifactTypeChange() {
- return this == ARTIFACT_TYPE_HISTORICAL_CHANGE;
- }
-
- public boolean isCurrentVersionArtifactTypeChange() {
- return this == ARTIFACT_TYPE_MODIFIED;
- }
-}
+/******************************************************************************* + * 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.core.enums; + +/** + * @author Roberto E. Escobar + */ +public enum EditState { + + NO_CHANGE, + ARTIFACT_TYPE_MODIFIED, + ARTIFACT_TYPE_HISTORICAL_CHANGE; + + public boolean isArtifactTypeChange() { + return this == ARTIFACT_TYPE_MODIFIED || this == ARTIFACT_TYPE_HISTORICAL_CHANGE; + } + + public boolean isHistoricalArtifactTypeChange() { + return this == ARTIFACT_TYPE_HISTORICAL_CHANGE; + } + + public boolean isCurrentVersionArtifactTypeChange() { + return this == ARTIFACT_TYPE_MODIFIED; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java index c939e206779..54519156213 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/Function.java @@ -1,36 +1,36 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Megumi Telles
- */
-public enum Function {
-
- BRANCH_COMMIT,
- CHANGE_REPORT,
- CREATE_BRANCH,
- PURGE_BRANCH,
- UPDATE_BRANCH_TYPE,
- UPDATE_BRANCH_STATE,
- UPDATE_ARCHIVE_STATE;
-
- public static Function fromString(String toMatch) throws OseeCoreException {
- for (Function function : Function.values()) {
- if (function.name().equalsIgnoreCase(toMatch)) {
- return function;
- }
- }
- throw new OseeCoreException(String.format("Invalid name - Function [%s] was not found ", toMatch));
- }
-}
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Megumi Telles + */ +public enum Function { + + BRANCH_COMMIT, + CHANGE_REPORT, + CREATE_BRANCH, + PURGE_BRANCH, + UPDATE_BRANCH_TYPE, + UPDATE_BRANCH_STATE, + UPDATE_ARCHIVE_STATE; + + public static Function fromString(String toMatch) throws OseeCoreException { + for (Function function : Function.values()) { + if (function.name().equalsIgnoreCase(toMatch)) { + return function; + } + } + throw new OseeCoreException(String.format("Invalid name - Function [%s] was not found ", toMatch)); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java index aa72ed03873..59cb227274f 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java @@ -1,136 +1,136 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum ModificationType implements Serializable {
- // Artifact, Attribute or Relation that was newly created
- NEW("New", 1),
-
- // Artifact if any Attribute was changed (not Relation)
- // Attribute if its value was modified
- // Relation if rationale changes
- // Relation temporarily set to this value in database UnDeleted in memory; this way until UNDELETED persisted to DB
- MODIFIED("Modified", 2),
-
- // Artifact, Attribute or Relation was deleted
- DELETED("Deleted", 3),
-
- // Artifact: Not Valid
- // Attribute: if value was merged from merge manager
- // TODO Relation: Not Currently Valid, but needs to be handled
- MERGED("Merged", 4),
-
- // Artifact: Not Valid
- // Attribute or Relation: was deleted as a direct result of Artifact delete, will be marked as ARTIFACT_DELETED
- ARTIFACT_DELETED("Artifact Deleted", 5),
-
- // Artifact or Attribute has been reflected from another branch
- INTRODUCED("Introduced", 6),
-
- // Previously deleted artifact, attribute, or relation has been reinstated
- // Relation can be in this state in memory, but this mod type is persisted as MODIFIED
- UNDELETED("Undeleted", 7);
-
- private final static Set<ModificationType> ALL_NONE_HARD_DELETED = new HashSet<ModificationType>();
- private final static Set<ModificationType> ALL_MOD_TYPES = new HashSet<ModificationType>();
- private final static Set<ModificationType> ALL_STATES = new HashSet<ModificationType>();
- private int value;
- private String displayName;
-
- ModificationType(String displayName, int value) {
- this.displayName = displayName;
- this.value = value;
- }
-
- /**
- * @return Returns the value.
- */
- public int getValue() {
- return value;
- }
-
- public boolean isEdited() {
- return this == MERGED || this == MODIFIED;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public boolean matches(ModificationType... modTypes) {
- for (ModificationType modType : modTypes) {
- if (modType == this) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @param value The value of the ModificationType to get.
- * @return The ModificationType that has the value passed.
- * @throws OseeArgumentException
- */
- public static ModificationType getMod(int value) throws OseeArgumentException {
- for (ModificationType modtype : values()) {
- if (modtype.value == value) {
- return modtype;
- }
- }
- throw new OseeArgumentException(value + " does not correspond to any defined ModificationType enumerations");
- }
-
- public boolean isDeleted() {
- return this == DELETED || this == ARTIFACT_DELETED;
- }
-
- public boolean isUnDeleted() {
- return this == UNDELETED;
- }
-
- public static Set<ModificationType> getCurrentModTypes() {
- if (ALL_NONE_HARD_DELETED.isEmpty()) {
- synchronized (ALL_NONE_HARD_DELETED) {
- ALL_NONE_HARD_DELETED.addAll(Arrays.asList(ModificationType.values()));
- ALL_NONE_HARD_DELETED.remove(ModificationType.DELETED);
- }
- }
- return ALL_NONE_HARD_DELETED;
- }
-
- public static Set<ModificationType> getAllCurrentModTypes() {
- if (ALL_MOD_TYPES.isEmpty()) {
- synchronized (ALL_MOD_TYPES) {
- ALL_MOD_TYPES.addAll(Arrays.asList(ModificationType.values()));
- }
- }
- return ALL_MOD_TYPES;
- }
-
- public static Set<ModificationType> getAllStates() {
- if (ALL_STATES.isEmpty()) {
- synchronized (ALL_STATES) {
- ALL_STATES.addAll(Arrays.asList(ModificationType.values()));
- }
- }
- return ALL_STATES;
- }
+/******************************************************************************* + * 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.core.enums; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; + +/** + * @author Ryan D. Brooks + */ +public enum ModificationType implements Serializable { + // Artifact, Attribute or Relation that was newly created + NEW("New", 1), + + // Artifact if any Attribute was changed (not Relation) + // Attribute if its value was modified + // Relation if rationale changes + // Relation temporarily set to this value in database UnDeleted in memory; this way until UNDELETED persisted to DB + MODIFIED("Modified", 2), + + // Artifact, Attribute or Relation was deleted + DELETED("Deleted", 3), + + // Artifact: Not Valid + // Attribute: if value was merged from merge manager + // TODO Relation: Not Currently Valid, but needs to be handled + MERGED("Merged", 4), + + // Artifact: Not Valid + // Attribute or Relation: was deleted as a direct result of Artifact delete, will be marked as ARTIFACT_DELETED + ARTIFACT_DELETED("Artifact Deleted", 5), + + // Artifact or Attribute has been reflected from another branch + INTRODUCED("Introduced", 6), + + // Previously deleted artifact, attribute, or relation has been reinstated + // Relation can be in this state in memory, but this mod type is persisted as MODIFIED + UNDELETED("Undeleted", 7); + + private final static Set<ModificationType> ALL_NONE_HARD_DELETED = new HashSet<ModificationType>(); + private final static Set<ModificationType> ALL_MOD_TYPES = new HashSet<ModificationType>(); + private final static Set<ModificationType> ALL_STATES = new HashSet<ModificationType>(); + private int value; + private String displayName; + + ModificationType(String displayName, int value) { + this.displayName = displayName; + this.value = value; + } + + /** + * @return Returns the value. + */ + public int getValue() { + return value; + } + + public boolean isEdited() { + return this == MERGED || this == MODIFIED; + } + + public String getDisplayName() { + return displayName; + } + + public boolean matches(ModificationType... modTypes) { + for (ModificationType modType : modTypes) { + if (modType == this) { + return true; + } + } + return false; + } + + /** + * @param value The value of the ModificationType to get. + * @return The ModificationType that has the value passed. + * @throws OseeArgumentException + */ + public static ModificationType getMod(int value) throws OseeArgumentException { + for (ModificationType modtype : values()) { + if (modtype.value == value) { + return modtype; + } + } + throw new OseeArgumentException(value + " does not correspond to any defined ModificationType enumerations"); + } + + public boolean isDeleted() { + return this == DELETED || this == ARTIFACT_DELETED; + } + + public boolean isUnDeleted() { + return this == UNDELETED; + } + + public static Set<ModificationType> getCurrentModTypes() { + if (ALL_NONE_HARD_DELETED.isEmpty()) { + synchronized (ALL_NONE_HARD_DELETED) { + ALL_NONE_HARD_DELETED.addAll(Arrays.asList(ModificationType.values())); + ALL_NONE_HARD_DELETED.remove(ModificationType.DELETED); + } + } + return ALL_NONE_HARD_DELETED; + } + + public static Set<ModificationType> getAllCurrentModTypes() { + if (ALL_MOD_TYPES.isEmpty()) { + synchronized (ALL_MOD_TYPES) { + ALL_MOD_TYPES.addAll(Arrays.asList(ModificationType.values())); + } + } + return ALL_MOD_TYPES; + } + + public static Set<ModificationType> getAllStates() { + if (ALL_STATES.isEmpty()) { + synchronized (ALL_STATES) { + ALL_STATES.addAll(Arrays.asList(ModificationType.values())); + } + } + return ALL_STATES; + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OseeCacheEnum.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OseeCacheEnum.java index 6f212c61e3a..121ab59916e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OseeCacheEnum.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/OseeCacheEnum.java @@ -1,26 +1,26 @@ -/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.enums;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum OseeCacheEnum {
-
- BRANCH_CACHE,
- TRANSACTION_CACHE,
- ARTIFACT_TYPE_CACHE,
- ATTRIBUTE_TYPE_CACHE,
- RELATION_TYPE_CACHE,
- OSEE_ENUM_TYPE_CACHE,
- SESSION_CACHE;
-
-}
+/******************************************************************************* + * Copyright (c) 2009 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.core.enums; + +/** + * @author Roberto E. Escobar + */ +public enum OseeCacheEnum { + + BRANCH_CACHE, + TRANSACTION_CACHE, + ARTIFACT_TYPE_CACHE, + ATTRIBUTE_TYPE_CACHE, + RELATION_TYPE_CACHE, + OSEE_ENUM_TYPE_CACHE, + SESSION_CACHE; + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/PermissionEnum.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/PermissionEnum.java index e3a72e4f7b3..6ad6ac6df12 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/PermissionEnum.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/PermissionEnum.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.core.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum PermissionEnum {
-
- NONE(5, "None"),
- READ(10, "Read"),
- WRITE(20, "Write"),
- FULLACCESS(30, "Full Access"),
- LOCK(40, "Lock"),
- DENY(65535, "Deny");
-
- // keeping this in sync with the number of permissions will ensure optimal memory usage
- private static final int COUNT = 4;
-
- private static final Map<Integer, PermissionEnum> rankToPermissionHash = new HashMap<Integer, PermissionEnum>(
- (int) (COUNT / .75) + 1, .75f);
- private static final Map<String, PermissionEnum> NameToPermissionHash = new HashMap<String, PermissionEnum>(
- (int) (COUNT / .75) + 1, .75f);
- private static final String[] NAME_ARRAY;
-
- static {
- NAME_ARRAY = new String[values().length];
-
- int i = 0;
- for (PermissionEnum permission : values()) {
- rankToPermissionHash.put(permission.getPermId(), permission);
- NameToPermissionHash.put(permission.getName(), permission);
- NAME_ARRAY[i++] = permission.getName();
- }
- }
-
- private int permissionId;
- private String name;
- public boolean add;
-
- PermissionEnum(int permissionId, String name) {
- this.permissionId = permissionId;
- this.name = name;
- }
-
- public int getRank() {
- return permissionId;
- }
-
- public String getName() {
- return name;
- }
-
- public static PermissionEnum getPermission(int permissionId) {
- return rankToPermissionHash.get(permissionId);
- }
-
- public static PermissionEnum getPermission(String name) {
- return NameToPermissionHash.get(name);
- }
-
- public boolean matches(PermissionEnum toMatch) {
- boolean hasPermission = false;
- if (toMatch == PermissionEnum.READ && this == PermissionEnum.LOCK) {
- hasPermission = true;
- } else if (toMatch == null || this == PermissionEnum.LOCK) {
- hasPermission = false;
- } else {
- hasPermission = this.getRank() >= toMatch.getRank() && !this.equals(PermissionEnum.DENY);
- }
- return hasPermission;
- }
-
- public static PermissionEnum getMostRestrictive(PermissionEnum perm1, PermissionEnum perm2) {
- PermissionEnum net = null;
- if (perm1 == PermissionEnum.DENY || perm2 == PermissionEnum.DENY) {
- net = PermissionEnum.DENY;
- } else if (perm1 == PermissionEnum.LOCK || perm2 == PermissionEnum.LOCK) {
- net = PermissionEnum.LOCK;
- } else {
- PermissionEnum object1 = perm1 == null ? PermissionEnum.NONE : perm1;
- PermissionEnum object2 = perm2 == null ? PermissionEnum.NONE : perm2;
- if (object1.matches(object2)) {
- net = object2;
- } else {
- net = object1;
- }
- }
- return net;
- }
-
- public static String[] getPermissionNames() {
- return NAME_ARRAY;
- }
-
- public int getPermId() {
- return permissionId;
- }
-}
+/******************************************************************************* + * 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.core.enums; + +import java.util.HashMap; +import java.util.Map; + +public enum PermissionEnum { + + NONE(5, "None"), + READ(10, "Read"), + WRITE(20, "Write"), + FULLACCESS(30, "Full Access"), + LOCK(40, "Lock"), + DENY(65535, "Deny"); + + // keeping this in sync with the number of permissions will ensure optimal memory usage + private static final int COUNT = 4; + + private static final Map<Integer, PermissionEnum> rankToPermissionHash = new HashMap<Integer, PermissionEnum>( + (int) (COUNT / .75) + 1, .75f); + private static final Map<String, PermissionEnum> NameToPermissionHash = new HashMap<String, PermissionEnum>( + (int) (COUNT / .75) + 1, .75f); + private static final String[] NAME_ARRAY; + + static { + NAME_ARRAY = new String[values().length]; + + int i = 0; + for (PermissionEnum permission : values()) { + rankToPermissionHash.put(permission.getPermId(), permission); + NameToPermissionHash.put(permission.getName(), permission); + NAME_ARRAY[i++] = permission.getName(); + } + } + + private int permissionId; + private String name; + public boolean add; + + PermissionEnum(int permissionId, String name) { + this.permissionId = permissionId; + this.name = name; + } + + public int getRank() { + return permissionId; + } + + public String getName() { + return name; + } + + public static PermissionEnum getPermission(int permissionId) { + return rankToPermissionHash.get(permissionId); + } + + public static PermissionEnum getPermission(String name) { + return NameToPermissionHash.get(name); + } + + public boolean matches(PermissionEnum toMatch) { + boolean hasPermission = false; + if (toMatch == PermissionEnum.READ && this == PermissionEnum.LOCK) { + hasPermission = true; + } else if (toMatch == null || this == PermissionEnum.LOCK) { + hasPermission = false; + } else { + hasPermission = this.getRank() >= toMatch.getRank() && !this.equals(PermissionEnum.DENY); + } + return hasPermission; + } + + public static PermissionEnum getMostRestrictive(PermissionEnum perm1, PermissionEnum perm2) { + PermissionEnum net = null; + if (perm1 == PermissionEnum.DENY || perm2 == PermissionEnum.DENY) { + net = PermissionEnum.DENY; + } else if (perm1 == PermissionEnum.LOCK || perm2 == PermissionEnum.LOCK) { + net = PermissionEnum.LOCK; + } else { + PermissionEnum object1 = perm1 == null ? PermissionEnum.NONE : perm1; + PermissionEnum object2 = perm2 == null ? PermissionEnum.NONE : perm2; + if (object1.matches(object2)) { + net = object2; + } else { + net = object1; + } + } + return net; + } + + public static String[] getPermissionNames() { + return NAME_ARRAY; + } + + public int getPermId() { + return permissionId; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationSide.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationSide.java index cc5e8077d5b..66656995b5f 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationSide.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationSide.java @@ -1,48 +1,48 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum RelationSide {
- SIDE_A,
- SIDE_B;
-
- public RelationSide oppositeSide() {
- return this == SIDE_A ? SIDE_B : SIDE_A;
- }
-
- public boolean isSideA() {
- return this == RelationSide.SIDE_A;
- }
-
- public boolean isOppositeSide(RelationSide side) {
- return this != side;
- }
-
- public static RelationSide fromString(String name) throws OseeCoreException {
- if (!Strings.isValid(name)) {
- throw new OseeArgumentException("Name cannot be null or empty");
- }
- String toMatch = name.toUpperCase();
- for (RelationSide side : RelationSide.values()) {
- if (side.name().equals(toMatch)) {
- return side;
- }
- }
- throw new OseeCoreException("Invalid name - Relation Side was not found");
- }
-}
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.Strings; + +/** + * @author Ryan D. Brooks + */ +public enum RelationSide { + SIDE_A, + SIDE_B; + + public RelationSide oppositeSide() { + return this == SIDE_A ? SIDE_B : SIDE_A; + } + + public boolean isSideA() { + return this == RelationSide.SIDE_A; + } + + public boolean isOppositeSide(RelationSide side) { + return this != side; + } + + public static RelationSide fromString(String name) throws OseeCoreException { + if (!Strings.isValid(name)) { + throw new OseeArgumentException("Name cannot be null or empty"); + } + String toMatch = name.toUpperCase(); + for (RelationSide side : RelationSide.values()) { + if (side.name().equals(toMatch)) { + return side; + } + } + throw new OseeCoreException("Invalid name - Relation Side was not found"); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationTypeMultiplicity.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationTypeMultiplicity.java index 86ab1cb4a2d..757d2eed29b 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationTypeMultiplicity.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationTypeMultiplicity.java @@ -1,129 +1,129 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum RelationTypeMultiplicity {
- ONE_TO_ONE(0, 1, 1),
-
- ONE_TO_MANY(1, 1, Integer.MAX_VALUE),
-
- MANY_TO_ONE(2, Integer.MAX_VALUE, 1),
-
- MANY_TO_MANY(3, Integer.MAX_VALUE, Integer.MAX_VALUE);
-
- private final int value;
- private final int alimit;
- private final int blimit;
-
- RelationTypeMultiplicity(int value, int alimit, int blimit) {
- this.value = value;
- this.alimit = alimit;
- this.blimit = blimit;
- }
-
- public int getSideALimit() {
- return alimit;
- }
-
- public int getSideBLimit() {
- return blimit;
- }
-
- private String limitToString(int limit) {
- return limit == Integer.MAX_VALUE ? "n" : "1";
- }
-
- public String getSideALimitLabel() {
- return limitToString(getSideALimit());
- }
-
- public String getSideBLimitLabel() {
- return limitToString(getSideBLimit());
- }
-
- public int getValue() {
- return value;
- }
-
- public String asLimitLabel(RelationSide side) throws OseeCoreException {
- String toReturn;
- switch (side) {
- case SIDE_A:
- toReturn = getSideALimitLabel();
- break;
- case SIDE_B:
- toReturn = getSideBLimitLabel();
- break;
- default:
- throw new OseeArgumentException("Expecting SIDE_A or SIDE_B");
- }
- return toReturn;
- }
-
- public int getLimit(RelationSide side) throws OseeCoreException {
- int limit = -1;
- switch (side) {
- case SIDE_A:
- limit = getSideALimit();
- break;
- case SIDE_B:
- limit = getSideBLimit();
- break;
- default:
- throw new OseeArgumentException("Expecting SIDE_A or SIDE_B");
- }
- return limit;
- }
-
- public boolean isWithinLimit(RelationSide side, int nextCount) throws OseeCoreException {
- int limit = getLimit(side);
- boolean result;
- if (limit == Integer.MAX_VALUE) {
- result = true;
- } else {
- result = nextCount <= limit;
- }
- return result;
- }
-
- public static RelationTypeMultiplicity getFromString(String value) {
- RelationTypeMultiplicity toReturn = null;
- if (Strings.isValid(value)) {
- String toMatch = value.toLowerCase();
- for (RelationTypeMultiplicity type : values()) {
- if (type.toString().toLowerCase().equals(toMatch)) {
- toReturn = type;
- break;
- }
- }
- }
- return toReturn;
- }
-
- public static RelationTypeMultiplicity getRelationMultiplicity(int value) {
- RelationTypeMultiplicity toReturn = null;
- for (RelationTypeMultiplicity type : values()) {
- if (type.getValue() == value) {
- toReturn = type;
- break;
- }
- }
- 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.Strings; + +/** + * @author Roberto E. Escobar + */ +public enum RelationTypeMultiplicity { + ONE_TO_ONE(0, 1, 1), + + ONE_TO_MANY(1, 1, Integer.MAX_VALUE), + + MANY_TO_ONE(2, Integer.MAX_VALUE, 1), + + MANY_TO_MANY(3, Integer.MAX_VALUE, Integer.MAX_VALUE); + + private final int value; + private final int alimit; + private final int blimit; + + RelationTypeMultiplicity(int value, int alimit, int blimit) { + this.value = value; + this.alimit = alimit; + this.blimit = blimit; + } + + public int getSideALimit() { + return alimit; + } + + public int getSideBLimit() { + return blimit; + } + + private String limitToString(int limit) { + return limit == Integer.MAX_VALUE ? "n" : "1"; + } + + public String getSideALimitLabel() { + return limitToString(getSideALimit()); + } + + public String getSideBLimitLabel() { + return limitToString(getSideBLimit()); + } + + public int getValue() { + return value; + } + + public String asLimitLabel(RelationSide side) throws OseeCoreException { + String toReturn; + switch (side) { + case SIDE_A: + toReturn = getSideALimitLabel(); + break; + case SIDE_B: + toReturn = getSideBLimitLabel(); + break; + default: + throw new OseeArgumentException("Expecting SIDE_A or SIDE_B"); + } + return toReturn; + } + + public int getLimit(RelationSide side) throws OseeCoreException { + int limit = -1; + switch (side) { + case SIDE_A: + limit = getSideALimit(); + break; + case SIDE_B: + limit = getSideBLimit(); + break; + default: + throw new OseeArgumentException("Expecting SIDE_A or SIDE_B"); + } + return limit; + } + + public boolean isWithinLimit(RelationSide side, int nextCount) throws OseeCoreException { + int limit = getLimit(side); + boolean result; + if (limit == Integer.MAX_VALUE) { + result = true; + } else { + result = nextCount <= limit; + } + return result; + } + + public static RelationTypeMultiplicity getFromString(String value) { + RelationTypeMultiplicity toReturn = null; + if (Strings.isValid(value)) { + String toMatch = value.toLowerCase(); + for (RelationTypeMultiplicity type : values()) { + if (type.toString().toLowerCase().equals(toMatch)) { + toReturn = type; + break; + } + } + } + return toReturn; + } + + public static RelationTypeMultiplicity getRelationMultiplicity(int value) { + RelationTypeMultiplicity toReturn = null; + for (RelationTypeMultiplicity type : values()) { + if (type.getValue() == value) { + toReturn = type; + break; + } + } + return toReturn; + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/StorageState.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/StorageState.java index 64842d1eb46..050d3afff6b 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/StorageState.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/StorageState.java @@ -1,41 +1,41 @@ -/*******************************************************************************
- * 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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum StorageState {
- LOADED(0), CREATED(1), MODIFIED(2), PURGED(3), //
- DELETED(4); // TODO remove after release
-
- private final int value;
-
- private StorageState(int value) {
- this.value = value;
- }
-
- public int value() {
- return value;
- }
-
- public static StorageState valueOf(int value) throws OseeCoreException {
- for (StorageState type : values()) {
- if (type.value == value) {
- return type;
- }
- }
- throw new OseeArgumentException(String.format("[%s] is not a valid StorageState"));
- }
-}
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Roberto E. Escobar + */ +public enum StorageState { + LOADED(0), CREATED(1), MODIFIED(2), PURGED(3), // + DELETED(4); // TODO remove after release + + private final int value; + + private StorageState(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static StorageState valueOf(int value) throws OseeCoreException { + for (StorageState type : values()) { + if (type.value == value) { + return type; + } + } + throw new OseeArgumentException(String.format("[%s] is not a valid StorageState")); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionDetailsType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionDetailsType.java index 6df3051e678..4a724154910 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionDetailsType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionDetailsType.java @@ -1,43 +1,43 @@ -/*******************************************************************************
- * 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.core.enums;
-
-/**
- * @author Jeff C. Phillips
- */
-public enum TransactionDetailsType {
- NonBaselined(0), Baselined(1), reverted(2);
-
- private int id;
-
- private TransactionDetailsType(int id) {
- this.id = id;
- }
-
- public int getId() {
- return id;
- }
-
- public boolean isBaseline() {
- return this == TransactionDetailsType.Baselined;
- }
-
- public static TransactionDetailsType toEnum(int value) {
- for (TransactionDetailsType txType : values()) {
- if (txType.getId() == value) {
- return txType;
- }
- }
- return null;
- }
-
+/******************************************************************************* + * 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.core.enums; + +/** + * @author Jeff C. Phillips + */ +public enum TransactionDetailsType { + NonBaselined(0), Baselined(1), reverted(2); + + private int id; + + private TransactionDetailsType(int id) { + this.id = id; + } + + public int getId() { + return id; + } + + public boolean isBaseline() { + return this == TransactionDetailsType.Baselined; + } + + public static TransactionDetailsType toEnum(int value) { + for (TransactionDetailsType txType : values()) { + if (txType.getId() == value) { + return txType; + } + } + return null; + } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionVersion.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionVersion.java index af1a5ab063c..0517b7e92a8 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionVersion.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TransactionVersion.java @@ -1,20 +1,20 @@ -/*******************************************************************************
- * 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.core.enums;
-
-/**
- * @author Roberto E. Escobar
- */
-public enum TransactionVersion {
- BASE,
- HEAD;
-
-}
+/******************************************************************************* + * 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.core.enums; + +/** + * @author Roberto E. Escobar + */ +public enum TransactionVersion { + BASE, + HEAD; + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.java index 95227a56360..30db84abd2a 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/TxChange.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.core.enums;
-
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-
-/**
- * @author Ryan D. Brooks
- */
-public enum TxChange {
- NOT_CURRENT(0), CURRENT(1), DELETED(2), ARTIFACT_DELETED(3);
-
- private int value;
-
- private TxChange(int value) {
- this.value = value;
- }
-
- public int getValue() {
- return value;
- }
-
- public boolean isDeleted() {
- return this == DELETED || this == ARTIFACT_DELETED;
- }
-
- public boolean isCurrent() {
- return this != TxChange.NOT_CURRENT;
- }
-
- public static TxChange getChangeType(int value) throws OseeArgumentException {
- for (TxChange change : values()) {
- if (change.getValue() == value) {
- return change;
- }
- }
- throw new OseeArgumentException(value + " does not correspond to any defined ModificationType enumerations");
- }
-
- public static TxChange getCurrent(ModificationType type) {
- TxChange txChange = null;
-
- if (type == ModificationType.DELETED) {
- txChange = TxChange.DELETED;
- } else if (type == ModificationType.ARTIFACT_DELETED) {
- txChange = TxChange.ARTIFACT_DELETED;
- } else {
- txChange = TxChange.CURRENT;
- }
- return txChange;
- }
-}
+/******************************************************************************* + * 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.core.enums; + +import org.eclipse.osee.framework.core.exception.OseeArgumentException; + +/** + * @author Ryan D. Brooks + */ +public enum TxChange { + NOT_CURRENT(0), CURRENT(1), DELETED(2), ARTIFACT_DELETED(3); + + private int value; + + private TxChange(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public boolean isDeleted() { + return this == DELETED || this == ARTIFACT_DELETED; + } + + public boolean isCurrent() { + return this != TxChange.NOT_CURRENT; + } + + public static TxChange getChangeType(int value) throws OseeArgumentException { + for (TxChange change : values()) { + if (change.getValue() == value) { + return change; + } + } + throw new OseeArgumentException(value + " does not correspond to any defined ModificationType enumerations"); + } + + public static TxChange getCurrent(ModificationType type) { + TxChange txChange = null; + + if (type == ModificationType.DELETED) { + txChange = TxChange.DELETED; + } else if (type == ModificationType.ARTIFACT_DELETED) { + txChange = TxChange.ARTIFACT_DELETED; + } else { + txChange = TxChange.CURRENT; + } + return txChange; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ArtifactDoesNotExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ArtifactDoesNotExist.java index 8a1f424d21e..eaf457ff44e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ArtifactDoesNotExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ArtifactDoesNotExist.java @@ -1,24 +1,24 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Donald G. Dunne
- */
-public class ArtifactDoesNotExist extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public ArtifactDoesNotExist(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Donald G. Dunne + */ +public class ArtifactDoesNotExist extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public ArtifactDoesNotExist(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/AttributeDoesNotExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/AttributeDoesNotExist.java index b9d0f41df14..4f0b7ee6cbe 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/AttributeDoesNotExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/AttributeDoesNotExist.java @@ -1,25 +1,25 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Donald G. Dunne
- */
-public class AttributeDoesNotExist extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public AttributeDoesNotExist(String message) {
- super(message);
- }
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Donald G. Dunne + */ +public class AttributeDoesNotExist extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public AttributeDoesNotExist(String message) { + super(message); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchDoesNotExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchDoesNotExist.java index 98ab6b7fc61..aa2bcc50322 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchDoesNotExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchDoesNotExist.java @@ -1,26 +1,26 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Ryan D. Brooks
- */
-public class BranchDoesNotExist extends OseeCoreException {
- private static final long serialVersionUID = -6197324585250025613L;
-
- public BranchDoesNotExist(String message) {
- super(message);
- }
-
- public BranchDoesNotExist(String message, Throwable cause) {
- super(message, cause);
- }
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Ryan D. Brooks + */ +public class BranchDoesNotExist extends OseeCoreException { + private static final long serialVersionUID = -6197324585250025613L; + + public BranchDoesNotExist(String message) { + super(message); + } + + public BranchDoesNotExist(String message, Throwable cause) { + super(message, cause); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchMergeException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchMergeException.java index 6dbd58af14b..794969d6bd6 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchMergeException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/BranchMergeException.java @@ -1,24 +1,24 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Donald G. Dunne
- */
-public class BranchMergeException extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public BranchMergeException(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Donald G. Dunne + */ +public class BranchMergeException extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public BranchMergeException(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ConflictDetectionException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ConflictDetectionException.java index 9d2e2a098ca..b097e171ed3 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ConflictDetectionException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/ConflictDetectionException.java @@ -1,25 +1,25 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Theron Virgin
- */
-public class ConflictDetectionException extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public ConflictDetectionException(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Theron Virgin + */ +public class ConflictDetectionException extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public ConflictDetectionException(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/InvalidTaggerException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/InvalidTaggerException.java index e263c932562..fa5e21161a2 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/InvalidTaggerException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/InvalidTaggerException.java @@ -1,23 +1,23 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class InvalidTaggerException extends OseeCoreException {
- private static final long serialVersionUID = 1L;
-
- public InvalidTaggerException() {
- super("");
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Roberto E. Escobar + */ +public class InvalidTaggerException extends OseeCoreException { + private static final long serialVersionUID = 1L; + + public InvalidTaggerException() { + super(""); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MergeChangesInArtifactException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MergeChangesInArtifactException.java index 5ad06cba383..3214fc9adbf 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MergeChangesInArtifactException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MergeChangesInArtifactException.java @@ -1,25 +1,25 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Theron Virgin
- */
-public class MergeChangesInArtifactException extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public MergeChangesInArtifactException(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Theron Virgin + */ +public class MergeChangesInArtifactException extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public MergeChangesInArtifactException(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleArtifactsExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleArtifactsExist.java index fadb2f6c837..bf264571f06 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleArtifactsExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleArtifactsExist.java @@ -1,24 +1,24 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Donald G. Dunne
- */
-public class MultipleArtifactsExist extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public MultipleArtifactsExist(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Donald G. Dunne + */ +public class MultipleArtifactsExist extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public MultipleArtifactsExist(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleAttributesExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleAttributesExist.java index 8c2ed8b7cfa..7f4ea4f4ec2 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleAttributesExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleAttributesExist.java @@ -1,25 +1,25 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Donald G. Dunne
- */
-public class MultipleAttributesExist extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public MultipleAttributesExist(String message) {
- super(message);
- }
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Donald G. Dunne + */ +public class MultipleAttributesExist extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public MultipleAttributesExist(String message) { + super(message); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleBranchesExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleBranchesExist.java index 426536437df..09e84799c90 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleBranchesExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/MultipleBranchesExist.java @@ -1,23 +1,23 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Donald G. Dunne
- */
-public class MultipleBranchesExist extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public MultipleBranchesExist(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Donald G. Dunne + */ +public class MultipleBranchesExist extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public MultipleBranchesExist(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAccessDeniedException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAccessDeniedException.java index fb746f543f1..a1d21284e69 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAccessDeniedException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAccessDeniedException.java @@ -1,23 +1,23 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeAccessDeniedException extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public OseeAccessDeniedException(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Roberto E. Escobar + */ +public class OseeAccessDeniedException extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public OseeAccessDeniedException(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArbitrationServerException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArbitrationServerException.java index 878cf7ed56e..c4794b02818 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArbitrationServerException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArbitrationServerException.java @@ -1,42 +1,42 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeArbitrationServerException extends OseeDataStoreException {
-
- private static final long serialVersionUID = -1622659773564525533L;
-
- /**
- * @param message
- */
- public OseeArbitrationServerException(String message) {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public OseeArbitrationServerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param cause
- */
- public OseeArbitrationServerException(Throwable cause) {
- super(cause);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Roberto E. Escobar + */ +public class OseeArbitrationServerException extends OseeDataStoreException { + + private static final long serialVersionUID = -1622659773564525533L; + + /** + * @param message + */ + public OseeArbitrationServerException(String message) { + super(message); + } + + /** + * @param message + * @param cause + */ + public OseeArbitrationServerException(String message, Throwable cause) { + super(message, cause); + } + + /** + * @param cause + */ + public OseeArbitrationServerException(Throwable cause) { + super(cause); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArgumentException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArgumentException.java index f6808499206..0119b094332 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArgumentException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeArgumentException.java @@ -1,23 +1,23 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Donald G. Dunne
- */
-public class OseeArgumentException extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public OseeArgumentException(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Donald G. Dunne + */ +public class OseeArgumentException extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public OseeArgumentException(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationException.java index 16184293ef6..5f22f832210 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationException.java @@ -1,55 +1,55 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeAuthenticationException extends OseeCoreException {
-
- private static final long serialVersionUID = 1890728724625261131L;
-
- public static enum AuthenticationErrorCode {
- Success, UserNotFound, InvalidPassword, NoResponse, Unknown;
- }
-
- private final AuthenticationErrorCode errorCode;
-
- /**
- * @param message
- * @param cause
- */
- public OseeAuthenticationException(String message, Throwable cause) {
- super(message, cause);
- this.errorCode = null;
- }
-
- /**
- * @param message
- */
- public OseeAuthenticationException(String message) {
- super(message);
- this.errorCode = null;
- }
-
- /**
- * @param cause
- */
- public OseeAuthenticationException(Throwable cause) {
- super(cause);
- this.errorCode = null;
- }
-
- public AuthenticationErrorCode getCode() {
- return errorCode;
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Roberto E. Escobar + */ +public class OseeAuthenticationException extends OseeCoreException { + + private static final long serialVersionUID = 1890728724625261131L; + + public static enum AuthenticationErrorCode { + Success, UserNotFound, InvalidPassword, NoResponse, Unknown; + } + + private final AuthenticationErrorCode errorCode; + + /** + * @param message + * @param cause + */ + public OseeAuthenticationException(String message, Throwable cause) { + super(message, cause); + this.errorCode = null; + } + + /** + * @param message + */ + public OseeAuthenticationException(String message) { + super(message); + this.errorCode = null; + } + + /** + * @param cause + */ + public OseeAuthenticationException(Throwable cause) { + super(cause); + this.errorCode = null; + } + + public AuthenticationErrorCode getCode() { + return errorCode; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationRequiredException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationRequiredException.java index d8a0ae7ad9a..43f1d243484 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationRequiredException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeAuthenticationRequiredException.java @@ -1,43 +1,43 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeAuthenticationRequiredException extends OseeDataStoreException {
-
- private static final long serialVersionUID = 1890728724625261131L;
-
- /**
- * @param message
- * @param cause
- */
- public OseeAuthenticationRequiredException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public OseeAuthenticationRequiredException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public OseeAuthenticationRequiredException(Throwable cause) {
- super(cause);
- }
-
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Roberto E. Escobar + */ +public class OseeAuthenticationRequiredException extends OseeDataStoreException { + + private static final long serialVersionUID = 1890728724625261131L; + + /** + * @param message + * @param cause + */ + public OseeAuthenticationRequiredException(String message, Throwable cause) { + super(message, cause); + } + + /** + * @param message + */ + public OseeAuthenticationRequiredException(String message) { + super(message); + } + + /** + * @param cause + */ + public OseeAuthenticationRequiredException(Throwable cause) { + super(cause); + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeCoreException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeCoreException.java index 8a44f65a243..def5a31f570 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeCoreException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeCoreException.java @@ -1,38 +1,38 @@ -/*******************************************************************************
- * 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.core.exception;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * @author Ryan D. Brooks
- */
-public class OseeCoreException extends CoreException {
- private static final long serialVersionUID = 1L;
-
- public OseeCoreException(String message) {
- super(new Status(IStatus.ERROR, "OSEE", message));
- }
-
- public OseeCoreException(String message, Throwable cause) {
- super(new Status(IStatus.ERROR, "OSEE", message, cause));
- }
-
- public OseeCoreException(Throwable cause) {
- super(new Status(IStatus.ERROR, "OSEE", cause.getMessage(), cause));
- }
-
- public OseeCoreException(IStatus status) {
- super(status);
- }
+/******************************************************************************* + * 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.core.exception; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * @author Ryan D. Brooks + */ +public class OseeCoreException extends CoreException { + private static final long serialVersionUID = 1L; + + public OseeCoreException(String message) { + super(new Status(IStatus.ERROR, "OSEE", message)); + } + + public OseeCoreException(String message, Throwable cause) { + super(new Status(IStatus.ERROR, "OSEE", message, cause)); + } + + public OseeCoreException(Throwable cause) { + super(new Status(IStatus.ERROR, "OSEE", cause.getMessage(), cause)); + } + + public OseeCoreException(IStatus status) { + super(status); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDataStoreException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDataStoreException.java index 32a03e274b2..6d125259b28 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDataStoreException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDataStoreException.java @@ -1,41 +1,41 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Ryan D. Brooks
- */
-public class OseeDataStoreException extends OseeCoreException {
- private static final long serialVersionUID = 7339636628746394923L;
-
- /**
- * @param message
- * @param cause
- */
- public OseeDataStoreException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public OseeDataStoreException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public OseeDataStoreException(Throwable cause) {
- super(cause);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Ryan D. Brooks + */ +public class OseeDataStoreException extends OseeCoreException { + private static final long serialVersionUID = 7339636628746394923L; + + /** + * @param message + * @param cause + */ + public OseeDataStoreException(String message, Throwable cause) { + super(message, cause); + } + + /** + * @param message + */ + public OseeDataStoreException(String message) { + super(message); + } + + /** + * @param cause + */ + public OseeDataStoreException(Throwable cause) { + super(cause); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDatabaseConnectionInfoNotFoundException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDatabaseConnectionInfoNotFoundException.java index e814bb383a7..fedcd49cacf 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDatabaseConnectionInfoNotFoundException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeDatabaseConnectionInfoNotFoundException.java @@ -1,42 +1,42 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeDatabaseConnectionInfoNotFoundException extends OseeDataStoreException {
-
- private static final long serialVersionUID = -2070849808510787374L;
-
- /**
- * @param message
- * @param cause
- */
- public OseeDatabaseConnectionInfoNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public OseeDatabaseConnectionInfoNotFoundException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public OseeDatabaseConnectionInfoNotFoundException(Throwable cause) {
- super(cause);
- }
-
-}
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Roberto E. Escobar + */ +public class OseeDatabaseConnectionInfoNotFoundException extends OseeDataStoreException { + + private static final long serialVersionUID = -2070849808510787374L; + + /** + * @param message + * @param cause + */ + public OseeDatabaseConnectionInfoNotFoundException(String message, Throwable cause) { + super(message, cause); + } + + /** + * @param message + */ + public OseeDatabaseConnectionInfoNotFoundException(String message) { + super(message); + } + + /** + * @param cause + */ + public OseeDatabaseConnectionInfoNotFoundException(Throwable cause) { + super(cause); + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeExceptions.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeExceptions.java index e79318ce724..daf116ac5a5 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeExceptions.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeExceptions.java @@ -1,29 +1,29 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class OseeExceptions {
-
- private OseeExceptions() {
- // private empty constructor is to prevent external instantiation
- }
-
- public static void wrapAndThrow(Throwable ex) throws OseeCoreException {
- if (ex instanceof OseeCoreException) {
- throw (OseeCoreException) ex;
- } else {
- throw new OseeWrappedException(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.core.exception; + +/** + * @author Roberto E. Escobar + */ +public final class OseeExceptions { + + private OseeExceptions() { + // private empty constructor is to prevent external instantiation + } + + public static void wrapAndThrow(Throwable ex) throws OseeCoreException { + if (ex instanceof OseeCoreException) { + throw (OseeCoreException) ex; + } else { + throw new OseeWrappedException(ex); + } + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidAuthenticationProtocolException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidAuthenticationProtocolException.java index bf2826a24bb..ec46721495e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidAuthenticationProtocolException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidAuthenticationProtocolException.java @@ -1,43 +1,43 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeInvalidAuthenticationProtocolException extends OseeAuthenticationException {
-
- private static final long serialVersionUID = 1890728724625261131L;
-
- /**
- * @param message
- * @param cause
- */
- public OseeInvalidAuthenticationProtocolException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public OseeInvalidAuthenticationProtocolException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public OseeInvalidAuthenticationProtocolException(Throwable cause) {
- super(cause);
- }
-
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Roberto E. Escobar + */ +public class OseeInvalidAuthenticationProtocolException extends OseeAuthenticationException { + + private static final long serialVersionUID = 1890728724625261131L; + + /** + * @param message + * @param cause + */ + public OseeInvalidAuthenticationProtocolException(String message, Throwable cause) { + super(message, cause); + } + + /** + * @param message + */ + public OseeInvalidAuthenticationProtocolException(String message) { + super(message); + } + + /** + * @param cause + */ + public OseeInvalidAuthenticationProtocolException(Throwable cause) { + super(cause); + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidInheritanceException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidInheritanceException.java index 91b6a9add36..9f24b343e1e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidInheritanceException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidInheritanceException.java @@ -1,28 +1,28 @@ -/*******************************************************************************
- * 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.core.exception;
-
-public class OseeInvalidInheritanceException extends OseeCoreException {
-
- private static final long serialVersionUID = -4553986819597790648L;
-
- public OseeInvalidInheritanceException(String message) {
- super(message);
- }
-
- public OseeInvalidInheritanceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public OseeInvalidInheritanceException(Throwable cause) {
- super(cause);
- }
-}
+/******************************************************************************* + * 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.core.exception; + +public class OseeInvalidInheritanceException extends OseeCoreException { + + private static final long serialVersionUID = -4553986819597790648L; + + public OseeInvalidInheritanceException(String message) { + super(message); + } + + public OseeInvalidInheritanceException(String message, Throwable cause) { + super(message, cause); + } + + public OseeInvalidInheritanceException(Throwable cause) { + super(cause); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidSessionException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidSessionException.java index a3caef48457..79b3f9836af 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidSessionException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeInvalidSessionException.java @@ -1,42 +1,42 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeInvalidSessionException extends OseeCoreException {
-
- private static final long serialVersionUID = 5540912279421352009L;
-
- /**
- * @param message
- */
- public OseeInvalidSessionException(String message) {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public OseeInvalidSessionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param cause
- */
- public OseeInvalidSessionException(Throwable cause) {
- super(cause);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Roberto E. Escobar + */ +public class OseeInvalidSessionException extends OseeCoreException { + + private static final long serialVersionUID = 5540912279421352009L; + + /** + * @param message + */ + public OseeInvalidSessionException(String message) { + super(message); + } + + /** + * @param message + * @param cause + */ + public OseeInvalidSessionException(String message, Throwable cause) { + super(message, cause); + } + + /** + * @param cause + */ + public OseeInvalidSessionException(Throwable cause) { + super(cause); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeMultipleEnumTypesExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeMultipleEnumTypesExist.java index 33c5a627838..ccb395eac1c 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeMultipleEnumTypesExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeMultipleEnumTypesExist.java @@ -1,24 +1,24 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeMultipleEnumTypesExist extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public OseeMultipleEnumTypesExist(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Roberto E. Escobar + */ +public class OseeMultipleEnumTypesExist extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public OseeMultipleEnumTypesExist(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeNotFoundException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeNotFoundException.java index 2cc85a06663..96a8bba95e1 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeNotFoundException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeNotFoundException.java @@ -1,38 +1,38 @@ -/*******************************************************************************
- * 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.core.exception;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * @author Ryan D. Brooks
- */
-public class OseeNotFoundException extends OseeCoreException {
-
- private static final long serialVersionUID = 3496442169445903235L;
-
- public OseeNotFoundException(String message) {
- super(new Status(IStatus.ERROR, "OSEE", message));
- }
-
- public OseeNotFoundException(String message, Throwable cause) {
- super(new Status(IStatus.ERROR, "OSEE", message, cause));
- }
-
- public OseeNotFoundException(Throwable cause) {
- super(new Status(IStatus.ERROR, "OSEE", cause.getMessage(), cause));
- }
-
- public OseeNotFoundException(IStatus status) {
- super(status);
- }
+/******************************************************************************* + * 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.core.exception; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * @author Ryan D. Brooks + */ +public class OseeNotFoundException extends OseeCoreException { + + private static final long serialVersionUID = 3496442169445903235L; + + public OseeNotFoundException(String message) { + super(new Status(IStatus.ERROR, "OSEE", message)); + } + + public OseeNotFoundException(String message, Throwable cause) { + super(new Status(IStatus.ERROR, "OSEE", message, cause)); + } + + public OseeNotFoundException(Throwable cause) { + super(new Status(IStatus.ERROR, "OSEE", cause.getMessage(), cause)); + } + + public OseeNotFoundException(IStatus status) { + super(status); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeStateException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeStateException.java index 9791488149d..41be3ccaff5 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeStateException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeStateException.java @@ -1,24 +1,24 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Donald G. Dunne
- */
-public class OseeStateException extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public OseeStateException(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Donald G. Dunne + */ +public class OseeStateException extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public OseeStateException(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeTypeDoesNotExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeTypeDoesNotExist.java index aee8a3c95dd..52aa9d26720 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeTypeDoesNotExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeTypeDoesNotExist.java @@ -1,23 +1,23 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Ryan D. Brooks
- */
-public class OseeTypeDoesNotExist extends OseeCoreException {
-
- private static final long serialVersionUID = 1L;
-
- public OseeTypeDoesNotExist(String message) {
- super(message);
- }
-}
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Ryan D. Brooks + */ +public class OseeTypeDoesNotExist extends OseeCoreException { + + private static final long serialVersionUID = 1L; + + public OseeTypeDoesNotExist(String message) { + super(message); + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeWrappedException.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeWrappedException.java index 1db0e861f84..818af1964c9 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeWrappedException.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/OseeWrappedException.java @@ -1,30 +1,30 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Ryan D. Brooks
- */
-public class OseeWrappedException extends OseeCoreException {
- private static final long serialVersionUID = 1L;
-
- public OseeWrappedException(String message) {
- super(message);
- }
-
- public OseeWrappedException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public OseeWrappedException(Throwable cause) {
- super(cause);
- }
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Ryan D. Brooks + */ +public class OseeWrappedException extends OseeCoreException { + private static final long serialVersionUID = 1L; + + public OseeWrappedException(String message) { + super(message); + } + + public OseeWrappedException(String message, Throwable cause) { + super(message, cause); + } + + public OseeWrappedException(Throwable cause) { + super(cause); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/TransactionDoesNotExist.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/TransactionDoesNotExist.java index 7a9f52fa1bd..352baab33b3 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/TransactionDoesNotExist.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/TransactionDoesNotExist.java @@ -1,33 +1,33 @@ -/*******************************************************************************
- * 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.core.exception;
-
-/**
- * @author Ryan D. Brooks
- */
-public class TransactionDoesNotExist extends OseeCoreException {
- private static final long serialVersionUID = -6197324585250025613L;
-
- /**
- * @param message
- */
- public TransactionDoesNotExist(String message) {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public TransactionDoesNotExist(String message, Throwable cause) {
- super(message, cause);
- }
+/******************************************************************************* + * 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.core.exception; + +/** + * @author Ryan D. Brooks + */ +public class TransactionDoesNotExist extends OseeCoreException { + private static final long serialVersionUID = -6197324585250025613L; + + /** + * @param message + */ + public TransactionDoesNotExist(String message) { + super(message); + } + + /** + * @param message + * @param cause + */ + public TransactionDoesNotExist(String message, Throwable cause) { + super(message, cause); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserInDatabaseMultipleTimes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserInDatabaseMultipleTimes.java index 890876c05e1..9ac1d11205f 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserInDatabaseMultipleTimes.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserInDatabaseMultipleTimes.java @@ -1,36 +1,36 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Ryan D. Brooks
- * @author Donald G. Dunne
- */
-public class UserInDatabaseMultipleTimes extends OseeCoreException {
- private static final long serialVersionUID = 1L;
-
- /**
- * @param message
- */
- public UserInDatabaseMultipleTimes(String message) {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public UserInDatabaseMultipleTimes(String message, Throwable cause) {
- super(message, cause);
- }
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Ryan D. Brooks + * @author Donald G. Dunne + */ +public class UserInDatabaseMultipleTimes extends OseeCoreException { + private static final long serialVersionUID = 1L; + + /** + * @param message + */ + public UserInDatabaseMultipleTimes(String message) { + super(message); + } + + /** + * @param message + * @param cause + */ + public UserInDatabaseMultipleTimes(String message, Throwable cause) { + super(message, cause); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserNotInDatabase.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserNotInDatabase.java index f21b1d56032..e67d8f8efdb 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserNotInDatabase.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/exception/UserNotInDatabase.java @@ -1,36 +1,36 @@ -/*******************************************************************************
- * 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.core.exception;
-
-
-/**
- * @author Ryan D. Brooks
- * @author Donald G. Dunne
- */
-public class UserNotInDatabase extends OseeCoreException {
- private static final long serialVersionUID = 1L;
-
- /**
- * @param message
- */
- public UserNotInDatabase(String message) {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public UserNotInDatabase(String message, Throwable cause) {
- super(message, cause);
- }
+/******************************************************************************* + * 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.core.exception; + + +/** + * @author Ryan D. Brooks + * @author Donald G. Dunne + */ +public class UserNotInDatabase extends OseeCoreException { + private static final long serialVersionUID = 1L; + + /** + * @param message + */ + public UserNotInDatabase(String message) { + super(message); + } + + /** + * @param message + * @param cause + */ + public UserNotInDatabase(String message, Throwable cause) { + super(message, cause); + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/internal/Activator.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/internal/Activator.java index 4ca652cc17f..339b1eba85a 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/internal/Activator.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/internal/Activator.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.core.internal;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext bundleContext;
-
- public void start(BundleContext context) throws Exception {
- Activator.bundleContext = context;
- }
-
- public void stop(BundleContext context) throws Exception {
- Activator.bundleContext = null;
- }
-
- public static BundleContext getBundleContext() {
- return Activator.bundleContext;
- }
-}
+/******************************************************************************* + * 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.core.internal; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext bundleContext; + + public void start(BundleContext context) throws Exception { + Activator.bundleContext = context; + } + + public void stop(BundleContext context) throws Exception { + Activator.bundleContext = null; + } + + public static BundleContext getBundleContext() { + return Activator.bundleContext; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java index 0a1727fe1cd..d654d444583 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/AbstractOperation.java @@ -1,182 +1,182 @@ -/*******************************************************************************
- * 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.core.operation;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-
-/**
- * @author Roberto E. Escobar
- */
-public abstract class AbstractOperation implements IOperation {
-
- private final InternalMultiStatus status;
- private boolean wasExecuted;
- private String name;
-
- public AbstractOperation(String operationName, String pluginId) {
- this.status = new InternalMultiStatus(pluginId, IStatus.OK, operationName);
- this.wasExecuted = false;
- setName(operationName);
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public IStatus getStatus() {
- return status;
- }
-
- protected void setStatus(IStatus status) {
- if (status.getSeverity() != IStatus.OK) {
- this.status.merge(status);
- }
- }
-
- public boolean wasExecuted() {
- return wasExecuted;
- }
-
- public final IOperation run(IProgressMonitor monitor) {
- wasExecuted = true;
- try {
- doWork(monitor);
- checkForCancelledStatus(monitor);
- } catch (Throwable error) {
- setStatus(createErrorStatus(error));
- } finally {
- doFinally(monitor);
- }
- return this;
- }
-
- /**
- * Convenience method to allow clients to hook into the operation's finally block
- *
- * @param monitor
- */
- protected void doFinally(IProgressMonitor monitor) {
-
- }
-
- /**
- * All work should be performed here
- *
- * @param monitor
- * @throws Exception
- */
- protected abstract void doWork(IProgressMonitor monitor) throws Exception;
-
- protected void setStatusMessage(String message) {
- status.setMessage(message);
- }
-
- protected IStatus createErrorStatus(Throwable error) {
- if (error instanceof OperationCanceledException) {
- return Status.CANCEL_STATUS;
- } else {
- return new Status(IStatus.ERROR, status.getPlugin(), String.format("%s: %s", status.getMessage(),
- error.toString()), error);
- }
- }
-
- protected int calculateWork(double workPercentage) {
- return Operations.calculateWork(getTotalWorkUnits(), workPercentage);
- }
-
- /**
- * Executes a nested operation setting monitor begin and done. If workPercentage is set greater than 0, monitor will
- * be wrapped into a SubProgressMonitor set to the appropriate number of ticks to consume from the main monitor.
- * Checks for status after work is complete to detect for execution errors or canceled.
- *
- * @param operation
- * @param monitor
- * @param workPercentage
- * @throws Exception
- */
- public void doSubWork(IOperation operation, IProgressMonitor monitor, double workPercentage) throws Exception {
- doSubWorkNoChecks(operation, monitor, workPercentage);
- checkForErrorsOrCanceled(monitor);
- }
-
- /**
- * Executes a nested operation setting monitor begin and done. If workPercentage is set greater than 0, monitor will
- * be wrapped into a SubProgressMonitor set to the appropriate number of ticks to consume from the main monitor.
- * Clients should use {@link #doSubWork(IOperation, IProgressMonitor, double)} when required to throw exceptions for
- * status errors or canceled. Alternatively, clients can perform the appropriate checks after calling this method.
- * The operation's status contains the result of having executed the sub-operation.
- *
- * @param operation
- * @param monitor
- * @param workPercentage
- */
- public void doSubWorkNoChecks(IOperation operation, IProgressMonitor monitor, double workPercentage) {
- Operations.executeWork(operation, monitor, workPercentage);
- setStatus(operation.getStatus());
- }
-
- /**
- * Throws an exception if the severity mask is detected.
- *
- * @param monitor
- * @throws Exception
- */
- protected void checkForStatusSeverityMask(int severityMask) throws Exception {
- Operations.checkForStatusSeverityMask(getStatus(), severityMask);
- }
-
- /**
- * Checks that the user has not canceled the operation and that the operation's status is still OK. If the status has
- * changed to ERROR, WARNING or CANCEL - an Exception will be thrown.
- *
- * @param monitor
- * @throws Exception
- */
- protected void checkForErrorsOrCanceled(IProgressMonitor monitor) throws Exception {
- checkForCancelledStatus(monitor);
- Operations.checkForErrorStatus(getStatus());
- }
-
- /**
- * Checks to see if the user cancelled the operation. If the operation was cancelled, the method will throw an
- * OperationCanceledException
- *
- * @param monitor
- * @throws OperationCanceledException
- */
- protected void checkForCancelledStatus(IProgressMonitor monitor) throws OperationCanceledException {
- Operations.checkForCancelledStatus(monitor, getStatus());
- }
-
- @Override
- public int getTotalWorkUnits() {
- return IOperation.TOTAL_WORK;
- }
-
- private final static class InternalMultiStatus extends org.eclipse.core.runtime.MultiStatus {
-
- public InternalMultiStatus(String pluginId, int code, String message) {
- super(pluginId, code, message, null);
- }
-
- @Override
- public void setMessage(String message) {
- super.setMessage(message);
- }
- }
-}
+/******************************************************************************* + * 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.core.operation; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; + +/** + * @author Roberto E. Escobar + */ +public abstract class AbstractOperation implements IOperation { + + private final InternalMultiStatus status; + private boolean wasExecuted; + private String name; + + public AbstractOperation(String operationName, String pluginId) { + this.status = new InternalMultiStatus(pluginId, IStatus.OK, operationName); + this.wasExecuted = false; + setName(operationName); + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public IStatus getStatus() { + return status; + } + + protected void setStatus(IStatus status) { + if (status.getSeverity() != IStatus.OK) { + this.status.merge(status); + } + } + + public boolean wasExecuted() { + return wasExecuted; + } + + public final IOperation run(IProgressMonitor monitor) { + wasExecuted = true; + try { + doWork(monitor); + checkForCancelledStatus(monitor); + } catch (Throwable error) { + setStatus(createErrorStatus(error)); + } finally { + doFinally(monitor); + } + return this; + } + + /** + * Convenience method to allow clients to hook into the operation's finally block + * + * @param monitor + */ + protected void doFinally(IProgressMonitor monitor) { + + } + + /** + * All work should be performed here + * + * @param monitor + * @throws Exception + */ + protected abstract void doWork(IProgressMonitor monitor) throws Exception; + + protected void setStatusMessage(String message) { + status.setMessage(message); + } + + protected IStatus createErrorStatus(Throwable error) { + if (error instanceof OperationCanceledException) { + return Status.CANCEL_STATUS; + } else { + return new Status(IStatus.ERROR, status.getPlugin(), String.format("%s: %s", status.getMessage(), + error.toString()), error); + } + } + + protected int calculateWork(double workPercentage) { + return Operations.calculateWork(getTotalWorkUnits(), workPercentage); + } + + /** + * Executes a nested operation setting monitor begin and done. If workPercentage is set greater than 0, monitor will + * be wrapped into a SubProgressMonitor set to the appropriate number of ticks to consume from the main monitor. + * Checks for status after work is complete to detect for execution errors or canceled. + * + * @param operation + * @param monitor + * @param workPercentage + * @throws Exception + */ + public void doSubWork(IOperation operation, IProgressMonitor monitor, double workPercentage) throws Exception { + doSubWorkNoChecks(operation, monitor, workPercentage); + checkForErrorsOrCanceled(monitor); + } + + /** + * Executes a nested operation setting monitor begin and done. If workPercentage is set greater than 0, monitor will + * be wrapped into a SubProgressMonitor set to the appropriate number of ticks to consume from the main monitor. + * Clients should use {@link #doSubWork(IOperation, IProgressMonitor, double)} when required to throw exceptions for + * status errors or canceled. Alternatively, clients can perform the appropriate checks after calling this method. + * The operation's status contains the result of having executed the sub-operation. + * + * @param operation + * @param monitor + * @param workPercentage + */ + public void doSubWorkNoChecks(IOperation operation, IProgressMonitor monitor, double workPercentage) { + Operations.executeWork(operation, monitor, workPercentage); + setStatus(operation.getStatus()); + } + + /** + * Throws an exception if the severity mask is detected. + * + * @param monitor + * @throws Exception + */ + protected void checkForStatusSeverityMask(int severityMask) throws Exception { + Operations.checkForStatusSeverityMask(getStatus(), severityMask); + } + + /** + * Checks that the user has not canceled the operation and that the operation's status is still OK. If the status has + * changed to ERROR, WARNING or CANCEL - an Exception will be thrown. + * + * @param monitor + * @throws Exception + */ + protected void checkForErrorsOrCanceled(IProgressMonitor monitor) throws Exception { + checkForCancelledStatus(monitor); + Operations.checkForErrorStatus(getStatus()); + } + + /** + * Checks to see if the user cancelled the operation. If the operation was cancelled, the method will throw an + * OperationCanceledException + * + * @param monitor + * @throws OperationCanceledException + */ + protected void checkForCancelledStatus(IProgressMonitor monitor) throws OperationCanceledException { + Operations.checkForCancelledStatus(monitor, getStatus()); + } + + @Override + public int getTotalWorkUnits() { + return IOperation.TOTAL_WORK; + } + + private final static class InternalMultiStatus extends org.eclipse.core.runtime.MultiStatus { + + public InternalMultiStatus(String pluginId, int code, String message) { + super(pluginId, code, message, null); + } + + @Override + public void setMessage(String message) { + super.setMessage(message); + } + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java index 63c8934f014..f92d4f1cd44 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.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.core.operation;
-
-import java.util.Collection;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CompositeOperation extends AbstractOperation {
-
- private final Collection<IOperation> operations;
-
- public CompositeOperation(String name, String pluginId, Collection<IOperation> operations) {
- super(name, pluginId);
- this.operations = operations;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- if (operations == null || operations.isEmpty()) {
- throw new OseeArgumentException("Sub-operations not available.");
- }
- double workPercentage = 1.00 / operations.size();
- for (IOperation operation : operations) {
- doSubWork(operation, monitor, workPercentage);
- }
- }
-}
+/******************************************************************************* + * 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.core.operation; + +import java.util.Collection; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; + +/** + * @author Roberto E. Escobar + */ +public class CompositeOperation extends AbstractOperation { + + private final Collection<IOperation> operations; + + public CompositeOperation(String name, String pluginId, Collection<IOperation> operations) { + super(name, pluginId); + this.operations = operations; + } + + @Override + protected void doWork(IProgressMonitor monitor) throws Exception { + if (operations == null || operations.isEmpty()) { + throw new OseeArgumentException("Sub-operations not available."); + } + double workPercentage = 1.00 / operations.size(); + for (IOperation operation : operations) { + doSubWork(operation, monitor, workPercentage); + } + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/EmptyOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/EmptyOperation.java index 084a00357aa..4ec07798e30 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/EmptyOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/EmptyOperation.java @@ -8,24 +8,24 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.operation;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * Operation to return if no work is to be done.
- *
- * @author Donald G. Dunne
- */
-public class EmptyOperation extends AbstractOperation {
-
- public EmptyOperation(String operationName, String pluginId) {
- super(operationName, pluginId);
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- monitor.worked(calculateWork(1.0));
- }
-
-}
+package org.eclipse.osee.framework.core.operation; + +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * Operation to return if no work is to be done. + * + * @author Donald G. Dunne + */ +public class EmptyOperation extends AbstractOperation { + + public EmptyOperation(String operationName, String pluginId) { + super(operationName, pluginId); + } + + @Override + protected void doWork(IProgressMonitor monitor) throws Exception { + monitor.worked(calculateWork(1.0)); + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/IOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/IOperation.java index a66e91bf373..df29a35859a 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/IOperation.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/IOperation.java @@ -1,34 +1,34 @@ -/*******************************************************************************
- * 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.core.operation;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osee.framework.core.data.Named;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IOperation extends Named {
-
- public final static int TOTAL_WORK = Integer.MAX_VALUE;
-
- public IStatus getStatus();
-
- public boolean wasExecuted();
-
- public IOperation run(IProgressMonitor monitor);
-
- /**
- * @return the total work units as used by a progress monitor
- */
- public int getTotalWorkUnits();
-}
+/******************************************************************************* + * 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.core.operation; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.osee.framework.core.data.Named; + +/** + * @author Roberto E. Escobar + */ +public interface IOperation extends Named { + + public final static int TOTAL_WORK = Integer.MAX_VALUE; + + public IStatus getStatus(); + + public boolean wasExecuted(); + + public IOperation run(IProgressMonitor monitor); + + /** + * @return the total work units as used by a progress monitor + */ + public int getTotalWorkUnits(); +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/LogProgressMonitor.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/LogProgressMonitor.java index 429358b2328..4e35ba1d9c2 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/LogProgressMonitor.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/LogProgressMonitor.java @@ -1,77 +1,77 @@ -/*******************************************************************************
- * 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.core.operation;
-
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.internal.Activator;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public class LogProgressMonitor implements IProgressMonitor {
- private boolean isCancelled;
- private String taskName;
-
- public LogProgressMonitor() {
- this.isCancelled = false;
- this.taskName = "";
- }
-
- @Override
- public void beginTask(String name, int totalWork) {
- this.taskName = name;
- OseeLog.log(Activator.class, Level.INFO, String.format("Start: %s", taskName));
- }
-
- @Override
- public void done() {
- OseeLog.log(Activator.class, Level.INFO, String.format("Finish: %s", taskName));
- }
-
- @Override
- public void internalWorked(double work) {
-
- }
-
- @Override
- public boolean isCanceled() {
- return isCancelled;
- }
-
- @Override
- public void setCanceled(boolean value) {
- this.isCancelled = value;
- }
-
- @Override
- public void setTaskName(String name) {
- if (Strings.isValid(name)) {
- this.taskName = name;
- OseeLog.log(Activator.class, Level.INFO, name);
- }
- }
-
- @Override
- public void subTask(String name) {
- if (Strings.isValid(name)) {
- OseeLog.log(Activator.class, Level.FINER, name);
- }
- }
-
- @Override
- public void worked(int work) {
-
- }
-
-}
+/******************************************************************************* + * 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.core.operation; + +import java.util.logging.Level; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.internal.Activator; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.logging.OseeLog; + +/** + * @author Roberto E. Escobar + */ +public class LogProgressMonitor implements IProgressMonitor { + private boolean isCancelled; + private String taskName; + + public LogProgressMonitor() { + this.isCancelled = false; + this.taskName = ""; + } + + @Override + public void beginTask(String name, int totalWork) { + this.taskName = name; + OseeLog.log(Activator.class, Level.INFO, String.format("Start: %s", taskName)); + } + + @Override + public void done() { + OseeLog.log(Activator.class, Level.INFO, String.format("Finish: %s", taskName)); + } + + @Override + public void internalWorked(double work) { + + } + + @Override + public boolean isCanceled() { + return isCancelled; + } + + @Override + public void setCanceled(boolean value) { + this.isCancelled = value; + } + + @Override + public void setTaskName(String name) { + if (Strings.isValid(name)) { + this.taskName = name; + OseeLog.log(Activator.class, Level.INFO, name); + } + } + + @Override + public void subTask(String name) { + if (Strings.isValid(name)) { + OseeLog.log(Activator.class, Level.FINER, name); + } + } + + @Override + public void worked(int work) { + + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java index 77569fd93e6..0e101f55978 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java @@ -1,184 +1,184 @@ -/*******************************************************************************
- * 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.core.operation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.internal.Activator;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class Operations {
-
- private Operations() {
- // this private empty constructor exists to prevent the default constructor from allowing public construction
- }
-
- /**
- * @param workPercentage
- * @return amount from total work
- */
- public static int calculateWork(int totalWork, double workPercentage) {
- return (int) (totalWork * workPercentage);
- }
-
- /**
- * Checks to see if the user canceled the operation. If the operation was canceled, the method will throw an
- * OperationCanceledException
- *
- * @param monitor
- * @throws OperationCanceledException
- */
- public static void checkForCancelledStatus(IProgressMonitor monitor, IStatus status) throws OperationCanceledException {
- if (monitor.isCanceled()) {
- boolean wasCancelled = false;
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- Throwable exception = children[i].getException();
- if (exception instanceof OperationCanceledException) {
- wasCancelled = true;
- break;
- }
- }
- if (!wasCancelled) {
- throw new OperationCanceledException();
- }
- }
- }
-
- /**
- * Checks to see if the status has errors. If the status contains errors, an exception will be thrown.
- *
- * @param monitor
- * @throws Exception
- * @see {@link IStatus#matches(int)}
- */
- public static void checkForStatusSeverityMask(IStatus status, int severityMask) throws Exception {
- if ((severityMask & IStatus.CANCEL) != 0 && status.getSeverity() == IStatus.CANCEL) {
- throw new OperationCanceledException();
- } else if (status.matches(severityMask)) {
- List<StackTraceElement> traceElements = new ArrayList<StackTraceElement>();
- String message = status.getMessage();
- for (IStatus childStatus : status.getChildren()) {
- Throwable exception = childStatus.getException();
- String childMessage = childStatus.getMessage();
- if (Strings.isValid(childMessage)) {
- message = childMessage;
- }
- if (exception != null) {
- traceElements.addAll(Arrays.asList(exception.getStackTrace()));
- }
- }
-
- Exception ex = new Exception(message);
- if (!traceElements.isEmpty()) {
- ex.setStackTrace(traceElements.toArray(new StackTraceElement[traceElements.size()]));
- }
- throw ex;
- }
- }
-
- /**
- * Checks to see if the status has errors. If the status contains errors, an exception will be thrown.
- *
- * @param monitor
- * @throws Exception
- * @see {@link IStatus#matches(int)}
- */
- public static void checkForErrorStatus(IStatus status) throws Exception {
- checkForStatusSeverityMask(status, IStatus.CANCEL | IStatus.ERROR | IStatus.WARNING);
- }
-
- /**
- * Executes an operation calling the monitor begin and done methods. If workPercentage is set greater than 0, monitor
- * will be wrapped into a SubProgressMonitor set to the appropriate number of ticks to consume from the main monitor.
- *
- * @param operation
- * @param monitor
- * @param workPercentage
- */
- public static void executeWork(IOperation operation, IProgressMonitor monitor, double workPercentage) {
- if (workPercentage > 0) {
- monitor = new SubProgressMonitor(monitor, calculateWork(operation.getTotalWorkUnits(), workPercentage));
- }
- monitor.beginTask(operation.getName(), operation.getTotalWorkUnits());
- try {
- operation.run(monitor);
- } finally {
- monitor.subTask("");
- monitor.setTaskName("");
- monitor.done();
- }
- }
-
- /**
- * Executes an operation by calling {@link #executeWork(IOperation, IProgressMonitor, double)} and checks for error
- * status {@link #checkForErrorStatus(IStatus)}. An OseeCoreException is thrown is an error is detected
- *
- * @param operation
- * @param monitor
- * @param workPercentage
- */
- public static void executeWorkAndCheckStatus(IOperation operation, IProgressMonitor monitor, double workPercentage) throws OseeCoreException {
- executeWork(operation, monitor, workPercentage);
- try {
- Operations.checkForErrorStatus(operation.getStatus());
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- public static Job executeAsJob(IOperation operation, boolean user) {
- return scheduleJob(new OperationJob(operation), user, Job.LONG, null);
- }
-
- public static Job executeAndPend(IOperation operation, boolean user) {
- return scheduleJob(new OperationJob(operation), user, Job.LONG, null, true);
- }
-
- public static Job executeAsJob(IOperation operation, boolean user, int priority, IJobChangeListener jobChangeListener) {
- return scheduleJob(new OperationJob(operation), user, priority, jobChangeListener);
- }
-
- public static Job scheduleJob(Job job, boolean user, int priority, IJobChangeListener jobChangeListener) {
- return scheduleJob(job, user, priority, jobChangeListener, false);
- }
-
- public static Job scheduleJob(Job job, boolean user, int priority, IJobChangeListener jobChangeListener, boolean forcePend) {
- job.setUser(user);
- job.setPriority(priority);
- if (jobChangeListener != null) {
- job.addJobChangeListener(jobChangeListener);
- }
- job.schedule();
- if (forcePend) {
- try {
- job.join();
- } catch (InterruptedException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- }
- }
- return job;
- }
-}
+/******************************************************************************* + * 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.core.operation; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.logging.Level; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeListener; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.core.internal.Activator; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.logging.OseeLog; + +/** + * @author Roberto E. Escobar + */ +public final class Operations { + + private Operations() { + // this private empty constructor exists to prevent the default constructor from allowing public construction + } + + /** + * @param workPercentage + * @return amount from total work + */ + public static int calculateWork(int totalWork, double workPercentage) { + return (int) (totalWork * workPercentage); + } + + /** + * Checks to see if the user canceled the operation. If the operation was canceled, the method will throw an + * OperationCanceledException + * + * @param monitor + * @throws OperationCanceledException + */ + public static void checkForCancelledStatus(IProgressMonitor monitor, IStatus status) throws OperationCanceledException { + if (monitor.isCanceled()) { + boolean wasCancelled = false; + IStatus[] children = status.getChildren(); + for (int i = 0; i < children.length; i++) { + Throwable exception = children[i].getException(); + if (exception instanceof OperationCanceledException) { + wasCancelled = true; + break; + } + } + if (!wasCancelled) { + throw new OperationCanceledException(); + } + } + } + + /** + * Checks to see if the status has errors. If the status contains errors, an exception will be thrown. + * + * @param monitor + * @throws Exception + * @see {@link IStatus#matches(int)} + */ + public static void checkForStatusSeverityMask(IStatus status, int severityMask) throws Exception { + if ((severityMask & IStatus.CANCEL) != 0 && status.getSeverity() == IStatus.CANCEL) { + throw new OperationCanceledException(); + } else if (status.matches(severityMask)) { + List<StackTraceElement> traceElements = new ArrayList<StackTraceElement>(); + String message = status.getMessage(); + for (IStatus childStatus : status.getChildren()) { + Throwable exception = childStatus.getException(); + String childMessage = childStatus.getMessage(); + if (Strings.isValid(childMessage)) { + message = childMessage; + } + if (exception != null) { + traceElements.addAll(Arrays.asList(exception.getStackTrace())); + } + } + + Exception ex = new Exception(message); + if (!traceElements.isEmpty()) { + ex.setStackTrace(traceElements.toArray(new StackTraceElement[traceElements.size()])); + } + throw ex; + } + } + + /** + * Checks to see if the status has errors. If the status contains errors, an exception will be thrown. + * + * @param monitor + * @throws Exception + * @see {@link IStatus#matches(int)} + */ + public static void checkForErrorStatus(IStatus status) throws Exception { + checkForStatusSeverityMask(status, IStatus.CANCEL | IStatus.ERROR | IStatus.WARNING); + } + + /** + * Executes an operation calling the monitor begin and done methods. If workPercentage is set greater than 0, monitor + * will be wrapped into a SubProgressMonitor set to the appropriate number of ticks to consume from the main monitor. + * + * @param operation + * @param monitor + * @param workPercentage + */ + public static void executeWork(IOperation operation, IProgressMonitor monitor, double workPercentage) { + if (workPercentage > 0) { + monitor = new SubProgressMonitor(monitor, calculateWork(operation.getTotalWorkUnits(), workPercentage)); + } + monitor.beginTask(operation.getName(), operation.getTotalWorkUnits()); + try { + operation.run(monitor); + } finally { + monitor.subTask(""); + monitor.setTaskName(""); + monitor.done(); + } + } + + /** + * Executes an operation by calling {@link #executeWork(IOperation, IProgressMonitor, double)} and checks for error + * status {@link #checkForErrorStatus(IStatus)}. An OseeCoreException is thrown is an error is detected + * + * @param operation + * @param monitor + * @param workPercentage + */ + public static void executeWorkAndCheckStatus(IOperation operation, IProgressMonitor monitor, double workPercentage) throws OseeCoreException { + executeWork(operation, monitor, workPercentage); + try { + Operations.checkForErrorStatus(operation.getStatus()); + } catch (Exception ex) { + OseeExceptions.wrapAndThrow(ex); + } + } + + public static Job executeAsJob(IOperation operation, boolean user) { + return scheduleJob(new OperationJob(operation), user, Job.LONG, null); + } + + public static Job executeAndPend(IOperation operation, boolean user) { + return scheduleJob(new OperationJob(operation), user, Job.LONG, null, true); + } + + public static Job executeAsJob(IOperation operation, boolean user, int priority, IJobChangeListener jobChangeListener) { + return scheduleJob(new OperationJob(operation), user, priority, jobChangeListener); + } + + public static Job scheduleJob(Job job, boolean user, int priority, IJobChangeListener jobChangeListener) { + return scheduleJob(job, user, priority, jobChangeListener, false); + } + + public static Job scheduleJob(Job job, boolean user, int priority, IJobChangeListener jobChangeListener, boolean forcePend) { + job.setUser(user); + job.setPriority(priority); + if (jobChangeListener != null) { + job.addJobChangeListener(jobChangeListener); + } + job.schedule(); + if (forcePend) { + try { + job.join(); + } catch (InterruptedException ex) { + OseeLog.log(Activator.class, Level.SEVERE, ex); + } + } + return job; + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationService.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationService.java index 1e5a3848935..f83e2a96acd 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationService.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationService.java @@ -1,95 +1,95 @@ -/*******************************************************************************
- * 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.core.translation;
-
-import java.io.InputStream;
-import java.util.Collection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IDataTranslationService {
-
- /**
- * Converts an input stream into the specified object
- *
- * @param inputStream containing object
- * @param toMatch class to convert object into
- * @return transformed object
- * @throws OseeCoreException if there are problems during conversion
- */
- public abstract <T> T convert(InputStream inputStream, ITranslatorId toMatch) throws OseeCoreException;
-
- /**
- * Converts a property store into a specified object
- *
- * @param propertyStore representing object
- * @param toMatch class to convert object into
- * @return transformed object
- * @throws OseeCoreException if there are problems during conversion
- */
- public abstract <T> T convert(PropertyStore propertyStore, ITranslatorId toMatch) throws OseeCoreException;
-
- /**
- * Converts an object into a property store
- *
- * @param object to transform
- * @return property store representation of the source object
- * @throws OseeCoreException if there are problems during conversion
- */
- public abstract <T> PropertyStore convert(T object, ITranslatorId toMatch) throws OseeCoreException;
-
- /**
- * Converts an object into an input stream
- *
- * @param object to transform
- * @return input stream representation of the source object
- * @throws OseeCoreException if there are problems during conversion
- */
- public abstract <T> InputStream convertToStream(T object, ITranslatorId toMatch) throws OseeCoreException;
-
- /**
- * Gets the translator matching the class
- *
- * @param toMatch key to obtain translator
- * @return translator associated with that class
- * @throws OseeCoreException if there are problems getting the translator or class does not have a registered
- * translator
- */
- public abstract ITranslator<?> getTranslator(ITranslatorId toMatch) throws OseeCoreException;
-
- /**
- * registers a translator for the specified class
- *
- * @param clazz to register translator for
- * @param translator to register
- * @return <b>true</b> if translator was added successfully
- */
- public abstract boolean addTranslator(ITranslator<?> translator, ITranslatorId toMatch) throws OseeCoreException;
-
- /**
- * removes a translator for the specified class
- *
- * @param clazz associated with the translator to remove
- * @return <b>true</b> if the translator associated with the class was removed
- */
- public abstract boolean removeTranslator(ITranslatorId toMatch) throws OseeCoreException;
-
- /**
- * Get all translator identifiers registered
- *
- * @return translator identifiers with registered translators
- */
- public abstract Collection<ITranslatorId> getSupportedClasses();
-
+/******************************************************************************* + * 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.core.translation; + +import java.io.InputStream; +import java.util.Collection; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.type.PropertyStore; + +/** + * @author Roberto E. Escobar + */ +public interface IDataTranslationService { + + /** + * Converts an input stream into the specified object + * + * @param inputStream containing object + * @param toMatch class to convert object into + * @return transformed object + * @throws OseeCoreException if there are problems during conversion + */ + public abstract <T> T convert(InputStream inputStream, ITranslatorId toMatch) throws OseeCoreException; + + /** + * Converts a property store into a specified object + * + * @param propertyStore representing object + * @param toMatch class to convert object into + * @return transformed object + * @throws OseeCoreException if there are problems during conversion + */ + public abstract <T> T convert(PropertyStore propertyStore, ITranslatorId toMatch) throws OseeCoreException; + + /** + * Converts an object into a property store + * + * @param object to transform + * @return property store representation of the source object + * @throws OseeCoreException if there are problems during conversion + */ + public abstract <T> PropertyStore convert(T object, ITranslatorId toMatch) throws OseeCoreException; + + /** + * Converts an object into an input stream + * + * @param object to transform + * @return input stream representation of the source object + * @throws OseeCoreException if there are problems during conversion + */ + public abstract <T> InputStream convertToStream(T object, ITranslatorId toMatch) throws OseeCoreException; + + /** + * Gets the translator matching the class + * + * @param toMatch key to obtain translator + * @return translator associated with that class + * @throws OseeCoreException if there are problems getting the translator or class does not have a registered + * translator + */ + public abstract ITranslator<?> getTranslator(ITranslatorId toMatch) throws OseeCoreException; + + /** + * registers a translator for the specified class + * + * @param clazz to register translator for + * @param translator to register + * @return <b>true</b> if translator was added successfully + */ + public abstract boolean addTranslator(ITranslator<?> translator, ITranslatorId toMatch) throws OseeCoreException; + + /** + * removes a translator for the specified class + * + * @param clazz associated with the translator to remove + * @return <b>true</b> if the translator associated with the class was removed + */ + public abstract boolean removeTranslator(ITranslatorId toMatch) throws OseeCoreException; + + /** + * Get all translator identifiers registered + * + * @return translator identifiers with registered translators + */ + public abstract Collection<ITranslatorId> getSupportedClasses(); + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationServiceProvider.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationServiceProvider.java index d47b8213ca0..a0e75e28c6e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationServiceProvider.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/IDataTranslationServiceProvider.java @@ -1,21 +1,21 @@ -/*******************************************************************************
- * 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.core.translation;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface IDataTranslationServiceProvider {
-
- IDataTranslationService getTranslationService() throws OseeCoreException;
+/******************************************************************************* + * 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.core.translation; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; + +/** + * @author Roberto E. Escobar + */ +public interface IDataTranslationServiceProvider { + + IDataTranslationService getTranslationService() throws OseeCoreException; }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslator.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslator.java index 78bf5f6c404..a62623c56bd 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslator.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslator.java @@ -1,24 +1,24 @@ -/*******************************************************************************
- * 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.core.translation;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface ITranslator<T> {
-
- T convert(PropertyStore propertyStore) throws OseeCoreException;
-
- PropertyStore convert(T object) throws OseeCoreException;
-}
+/******************************************************************************* + * 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.core.translation; + +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.type.PropertyStore; + +/** + * @author Roberto E. Escobar + */ +public interface ITranslator<T> { + + T convert(PropertyStore propertyStore) throws OseeCoreException; + + PropertyStore convert(T object) throws OseeCoreException; +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslatorId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslatorId.java index 8c98da11b20..22beecdfdc8 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslatorId.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/translation/ITranslatorId.java @@ -8,12 +8,12 @@ * Contributors: * Boeing - initial API and implementation *******************************************************************************/ -package org.eclipse.osee.framework.core.translation;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface ITranslatorId {
-
- public String getKey();
-}
+package org.eclipse.osee.framework.core.translation; + +/** + * @author Roberto E. Escobar + */ +public interface ITranslatorId { + + public String getKey(); +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/AbstractTrackingHandler.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/AbstractTrackingHandler.java index 6dd4134a60a..3dc539e5912 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/AbstractTrackingHandler.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/AbstractTrackingHandler.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.core.util;
-
-import java.util.Map;
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Andrew M. Finkbeiner
- * @author Roberto E. Escobar
- */
-public abstract class AbstractTrackingHandler {
-
- protected AbstractTrackingHandler() {
- }
-
- protected <T> T getService(Class<T> clazz, Map<Class<?>, Object> objectMap) {
- return clazz.cast(objectMap.get(clazz));
- }
-
- public abstract Class<?>[] getDependencies();
-
- public abstract void onActivate(BundleContext context, Map<Class<?>, Object> services);
-
- public abstract void onDeActivate();
-
+/******************************************************************************* + * 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.core.util; + +import java.util.Map; +import org.osgi.framework.BundleContext; + +/** + * @author Andrew M. Finkbeiner + * @author Roberto E. Escobar + */ +public abstract class AbstractTrackingHandler { + + protected AbstractTrackingHandler() { + } + + protected <T> T getService(Class<T> clazz, Map<Class<?>, Object> objectMap) { + return clazz.cast(objectMap.get(clazz)); + } + + public abstract Class<?>[] getDependencies(); + + public abstract void onActivate(BundleContext context, Map<Class<?>, Object> services); + + public abstract void onDeActivate(); + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/Conditions.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/Conditions.java index 8c87b0a292e..037e1ad2fe7 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/Conditions.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/Conditions.java @@ -1,87 +1,87 @@ -/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.eclipse.osee.framework.core.exception.OseeArgumentException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.GUID;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class Conditions {
-
- private Conditions() {
- }
-
- public static void checkNotNull(Object object, String objectName) throws OseeCoreException {
- if (object == null) {
- throw new OseeArgumentException(String.format("%s cannot be null", objectName));
- }
- }
-
- public static void checkNotNull(Object object, String objectName, String details, Object... data) throws OseeCoreException {
- if (object == null) {
- String message = String.format(details, data);
- throw new OseeArgumentException(String.format("%s cannot be null - %s", objectName, message));
- }
- }
-
- public static void checkNotNullOrEmpty(String object, String objectName) throws OseeCoreException {
- checkNotNull(object, objectName);
- if (object.length() == 0) {
- throw new OseeArgumentException(String.format("%s cannot be empty", objectName));
- }
- }
-
- public static void checkNotNullOrEmpty(String object, String objectName, String details, Object... data) throws OseeCoreException {
- checkNotNull(object, objectName);
- if (object.length() == 0) {
- String message = String.format(details, data);
- throw new OseeArgumentException(String.format("%s cannot be empty - %s", objectName, message));
- }
- }
-
- public static void checkExpressionFailOnTrue(boolean result, String message, Object... data) throws OseeCoreException {
- if (result) {
- throw new OseeArgumentException(String.format(message, data));
- }
- }
-
- public static String checkGuidCreateIfNeeded(String guid) {
- String toReturn = guid;
- if (guid == null) {
- toReturn = GUID.create();
- }
- return toReturn;
- }
-
- public static void checkDoesNotContainNulls(Object object, String message, Object... data) throws OseeCoreException {
- checkNotNull(object, message);
- Collection<?> toCheck = null;
- if (object instanceof Collection<?>) {
- toCheck = (Collection<?>) object;
- } else if (object instanceof Object[]) {
- toCheck = Arrays.asList((Object[]) object);
- }
- if (toCheck != null) {
- for (Object item : toCheck) {
- if (item == null) {
- throw new OseeArgumentException(String.format(message, data));
- }
- }
- } else {
- throw new OseeArgumentException("object is not an array or a collection");
- }
- }
-}
+/******************************************************************************* + * Copyright (c) 2009 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.core.util; + +import java.util.Arrays; +import java.util.Collection; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.GUID; + +/** + * @author Roberto E. Escobar + */ +public final class Conditions { + + private Conditions() { + } + + public static void checkNotNull(Object object, String objectName) throws OseeCoreException { + if (object == null) { + throw new OseeArgumentException(String.format("%s cannot be null", objectName)); + } + } + + public static void checkNotNull(Object object, String objectName, String details, Object... data) throws OseeCoreException { + if (object == null) { + String message = String.format(details, data); + throw new OseeArgumentException(String.format("%s cannot be null - %s", objectName, message)); + } + } + + public static void checkNotNullOrEmpty(String object, String objectName) throws OseeCoreException { + checkNotNull(object, objectName); + if (object.length() == 0) { + throw new OseeArgumentException(String.format("%s cannot be empty", objectName)); + } + } + + public static void checkNotNullOrEmpty(String object, String objectName, String details, Object... data) throws OseeCoreException { + checkNotNull(object, objectName); + if (object.length() == 0) { + String message = String.format(details, data); + throw new OseeArgumentException(String.format("%s cannot be empty - %s", objectName, message)); + } + } + + public static void checkExpressionFailOnTrue(boolean result, String message, Object... data) throws OseeCoreException { + if (result) { + throw new OseeArgumentException(String.format(message, data)); + } + } + + public static String checkGuidCreateIfNeeded(String guid) { + String toReturn = guid; + if (guid == null) { + toReturn = GUID.create(); + } + return toReturn; + } + + public static void checkDoesNotContainNulls(Object object, String message, Object... data) throws OseeCoreException { + checkNotNull(object, message); + Collection<?> toCheck = null; + if (object instanceof Collection<?>) { + toCheck = (Collection<?>) object; + } else if (object instanceof Object[]) { + toCheck = Arrays.asList((Object[]) object); + } + if (toCheck != null) { + for (Object item : toCheck) { + if (item == null) { + throw new OseeArgumentException(String.format(message, data)); + } + } + } else { + throw new OseeArgumentException("object is not an array or a collection"); + } + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpMessage.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpMessage.java index 49012a54c35..f8801bfcac5 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpMessage.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpMessage.java @@ -1,54 +1,54 @@ -/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
-import org.eclipse.osee.framework.core.translation.ITranslatorId;
-import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HttpMessage {
-
- private HttpMessage() {
- }
-
- @SuppressWarnings("unchecked")
- public static <J, K> J send(String urlString, IDataTranslationService service, ITranslatorId requestId, K requestData, ITranslatorId responseId) throws OseeCoreException {
- InputStream inputStream = null;
- try {
- inputStream = service.convertToStream(requestData, requestId);
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- AcquireResult result = HttpProcessor.post(new URL(urlString), inputStream, "text/xml", "UTF-8", buffer);
- if (result.wasSuccessful()) {
- if (responseId == null) {
- return (J) result;
- } else {
- return service.convert(new ByteArrayInputStream(buffer.toByteArray()), responseId);
- }
- } else {
- throw new OseeCoreException(String.format("Request [%s] failed.", urlString));
- }
- } catch (Exception ex) {
- throw new OseeWrappedException(String.format("Error with [%s]", requestId.toString()), ex);
- } finally {
- Lib.close(inputStream);
- }
- }
-}
+/******************************************************************************* + * Copyright (c) 2009 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.core.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.net.URL; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeWrappedException; +import org.eclipse.osee.framework.core.translation.IDataTranslationService; +import org.eclipse.osee.framework.core.translation.ITranslatorId; +import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult; +import org.eclipse.osee.framework.jdk.core.util.Lib; + +/** + * @author Roberto E. Escobar + */ +public class HttpMessage { + + private HttpMessage() { + } + + @SuppressWarnings("unchecked") + public static <J, K> J send(String urlString, IDataTranslationService service, ITranslatorId requestId, K requestData, ITranslatorId responseId) throws OseeCoreException { + InputStream inputStream = null; + try { + inputStream = service.convertToStream(requestData, requestId); + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + AcquireResult result = HttpProcessor.post(new URL(urlString), inputStream, "text/xml", "UTF-8", buffer); + if (result.wasSuccessful()) { + if (responseId == null) { + return (J) result; + } else { + return service.convert(new ByteArrayInputStream(buffer.toByteArray()), responseId); + } + } else { + throw new OseeCoreException(String.format("Request [%s] failed.", urlString)); + } + } catch (Exception ex) { + throw new OseeWrappedException(String.format("Error with [%s]", requestId.toString()), ex); + } finally { + Lib.close(inputStream); + } + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpProcessor.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpProcessor.java index c2b2eb5c186..5aa07ca0759 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpProcessor.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/HttpProcessor.java @@ -1,340 +1,340 @@ -/*******************************************************************************
- * 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.core.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
-import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.params.HttpMethodParams;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Roberto E. Escobar
- */
-public class HttpProcessor {
- private static final String CONTENT_TYPE = "content-type";
- private static final String CONTENT_ENCODING = "content-encoding";
-
- private static final HttpProcessor instance = new HttpProcessor();
-
- private final MultiThreadedHttpConnectionManager connectionManager;
- private final HttpClient httpClient;
-
- private HttpProcessor() {
- connectionManager = new MultiThreadedHttpConnectionManager();
- httpClient = new HttpClient(connectionManager);
- }
-
- private static HttpClient getHttpClient() {
- return instance.httpClient;
- }
-
- public static String acquireString(URL url) throws Exception {
- ByteArrayOutputStream sourceOutputStream = new ByteArrayOutputStream();
- try {
- AcquireResult result = HttpProcessor.acquire(url, sourceOutputStream);
- if (result.getCode() == HttpURLConnection.HTTP_OK) {
- return sourceOutputStream.toString();
- }
- } finally {
- sourceOutputStream.close();
- }
- return null;
- }
-
- public static boolean isAlive(String serverAddress, int port) {
- boolean result = false;
- try {
- String portString = Strings.emptyString();
- if (port > -1) {
- portString = String.format(":%s", String.valueOf(port));
- }
- URL url = new URL(String.format("http://%s%s", serverAddress, portString));
- GetMethod method = new GetMethod(url.toString());
-
- try {
- HttpMethodParams params = new HttpMethodParams();
- params.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(0, false));
- method.setParams(params);
- int responseCode = getHttpClient().executeMethod(method);
- if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) {
- result = true;
- }
- } finally {
- method.releaseConnection();
- }
- } catch (IOException ex) {
- // Do Nothing
- }
- return result;
- }
-
- public static URI save(URL url, InputStream inputStream, String contentType, String encoding) throws Exception {
- String locator = put(url, inputStream, contentType, encoding);
- return new URI(locator);
- }
-
- public static String put(URL url, InputStream inputStream, String contentType, String encoding) throws OseeCoreException {
- int statusCode = -1;
- String response = null;
- PutMethod method = new PutMethod(url.toString());
-
- InputStream responseInputStream = null;
- AcquireResult result = new AcquireResult();
- try {
- method.setRequestHeader(CONTENT_ENCODING, encoding);
- method.setRequestEntity(new InputStreamRequestEntity(inputStream, contentType));
-
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
-
- statusCode = getHttpClient().executeMethod(method);
- responseInputStream = method.getResponseBodyAsStream();
- result.setContentType(getContentType(method));
- result.setEncoding(method.getResponseCharSet());
- if (statusCode != HttpURLConnection.HTTP_CREATED) {
- String exceptionString = Lib.inputStreamToString(responseInputStream);
- throw new OseeCoreException(exceptionString);
- } else {
- responseInputStream = method.getResponseBodyAsStream();
- response = Lib.inputStreamToString(responseInputStream);
- }
-
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- try {
- if (responseInputStream != null) {
- responseInputStream.close();
- }
- } catch (Exception ex) {
- // Do Nothing;
- } finally {
- method.releaseConnection();
- }
- }
- return response;
- }
-
- public static AcquireResult post(URL url, InputStream inputStream, String contentType, String encoding, OutputStream outputStream) throws OseeCoreException {
- AcquireResult result = new AcquireResult();
- int statusCode = -1;
-
- PostMethod method = new PostMethod(url.toString());
-
- InputStream httpInputStream = null;
- try {
- method.setRequestHeader(CONTENT_ENCODING, encoding);
- method.setRequestEntity(new InputStreamRequestEntity(inputStream, contentType));
-
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
-
- statusCode = getHttpClient().executeMethod(method);
- httpInputStream = method.getResponseBodyAsStream();
- result.setContentType(getContentType(method));
- result.setEncoding(method.getResponseCharSet());
- if (statusCode == HttpStatus.SC_ACCEPTED || statusCode == HttpStatus.SC_OK) {
- Lib.inputStreamToOutputStream(httpInputStream, outputStream);
- } else {
- String exceptionString = Lib.inputStreamToString(httpInputStream);
- throw new OseeCoreException(exceptionString);
- }
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- try {
- result.setCode(statusCode);
- if (httpInputStream != null) {
- httpInputStream.close();
- }
- } catch (Exception ex) {
- // Do Nothing;
- } finally {
- method.releaseConnection();
- }
- }
- return result;
- }
-
- public static String post(URL url) throws Exception {
- AcquireResult result = new AcquireResult();
- String response = null;
- int statusCode = -1;
-
- PostMethod method = new PostMethod(url.toString());
-
- InputStream responseInputStream = null;
- try {
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
-
- statusCode = getHttpClient().executeMethod(method);
- responseInputStream = method.getResponseBodyAsStream();
- result.setContentType(getContentType(method));
- result.setEncoding(method.getResponseCharSet());
- if (statusCode != HttpStatus.SC_ACCEPTED) {
- String exceptionString = Lib.inputStreamToString(responseInputStream);
- throw new Exception(exceptionString);
- } else {
- responseInputStream = method.getResponseBodyAsStream();
- response = Lib.inputStreamToString(responseInputStream);
- }
- } catch (Exception ex) {
- throw new Exception(String.format("Error during POST [%s] - status code: [%s]", url, statusCode), ex);
- } finally {
- try {
- if (responseInputStream != null) {
- responseInputStream.close();
- }
- } catch (Exception ex) {
- // Do Nothing;
- } finally {
- method.releaseConnection();
- }
- }
- return response;
- }
-
- private static String getContentType(HttpMethodBase method) {
- String contentType = null;
- Header header = method.getResponseHeader(CONTENT_TYPE);
- if (header != null) {
- contentType = header.getValue();
- if (Strings.isValid(contentType)) {
- int index = contentType.indexOf(';');
- if (index > 0) {
- contentType = contentType.substring(0, index);
- }
- }
- }
- return contentType;
- }
-
- public static AcquireResult acquire(URL url, OutputStream outputStream) throws Exception {
- AcquireResult result = new AcquireResult();
- int statusCode = -1;
-
- GetMethod method = new GetMethod(url.toString());
-
- InputStream inputStream = null;
- try {
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
-
- statusCode = getHttpClient().executeMethod(method);
- if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_ACCEPTED) {
- inputStream = method.getResponseBodyAsStream();
- result.setEncoding(method.getResponseCharSet());
- result.setContentType(getContentType(method));
- Lib.inputStreamToOutputStream(inputStream, outputStream);
- }
- } catch (Exception ex) {
- throw new Exception(String.format("Error acquiring resource: [%s] - status code: [%s]", url, statusCode), ex);
- } finally {
- try {
- result.setCode(statusCode);
- if (inputStream != null) {
- inputStream.close();
- }
- } catch (Exception ex) {
- // Do Nothing;
- } finally {
- method.releaseConnection();
- }
- }
- return result;
- }
-
- public static String delete(URL url) throws Exception {
- String response = null;
- int statusCode = -1;
- DeleteMethod method = new DeleteMethod(url.toString());
-
- InputStream responseInputStream = null;
- try {
- method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
- statusCode = getHttpClient().executeMethod(method);
- if (statusCode == HttpStatus.SC_ACCEPTED) {
- responseInputStream = method.getResponseBodyAsStream();
- response = Lib.inputStreamToString(responseInputStream);
- }
- } catch (Exception ex) {
- throw new Exception(String.format("Error deleting resource: [%s] - status code: [%s]", url, statusCode), ex);
- } finally {
- try {
- if (responseInputStream != null) {
- responseInputStream.close();
- }
- } catch (Exception ex) {
- // Do Nothing;
- } finally {
- method.releaseConnection();
- }
- }
- return response;
- }
-
- public static final class AcquireResult {
- private int code;
- private String encoding;
- private String contentType;
-
- private AcquireResult() {
- super();
- this.code = -1;
- this.encoding = "";
- this.contentType = "";
- }
-
- public boolean wasSuccessful() {
- return code == HttpURLConnection.HTTP_OK || code == HttpURLConnection.HTTP_ACCEPTED;
- }
-
- public int getCode() {
- return code;
- }
-
- private void setCode(int code) {
- this.code = code;
- }
-
- public String getEncoding() {
- return encoding;
- }
-
- private void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- private void setContentType(String contentType) {
- this.contentType = contentType;
- }
- }
-}
+/******************************************************************************* + * 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.core.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URL; +import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpMethodBase; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; +import org.apache.commons.httpclient.methods.DeleteMethod; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.InputStreamRequestEntity; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.PutMethod; +import org.apache.commons.httpclient.params.HttpMethodParams; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.jdk.core.util.Strings; + +/** + * @author Roberto E. Escobar + */ +public class HttpProcessor { + private static final String CONTENT_TYPE = "content-type"; + private static final String CONTENT_ENCODING = "content-encoding"; + + private static final HttpProcessor instance = new HttpProcessor(); + + private final MultiThreadedHttpConnectionManager connectionManager; + private final HttpClient httpClient; + + private HttpProcessor() { + connectionManager = new MultiThreadedHttpConnectionManager(); + httpClient = new HttpClient(connectionManager); + } + + private static HttpClient getHttpClient() { + return instance.httpClient; + } + + public static String acquireString(URL url) throws Exception { + ByteArrayOutputStream sourceOutputStream = new ByteArrayOutputStream(); + try { + AcquireResult result = HttpProcessor.acquire(url, sourceOutputStream); + if (result.getCode() == HttpURLConnection.HTTP_OK) { + return sourceOutputStream.toString(); + } + } finally { + sourceOutputStream.close(); + } + return null; + } + + public static boolean isAlive(String serverAddress, int port) { + boolean result = false; + try { + String portString = Strings.emptyString(); + if (port > -1) { + portString = String.format(":%s", String.valueOf(port)); + } + URL url = new URL(String.format("http://%s%s", serverAddress, portString)); + GetMethod method = new GetMethod(url.toString()); + + try { + HttpMethodParams params = new HttpMethodParams(); + params.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(0, false)); + method.setParams(params); + int responseCode = getHttpClient().executeMethod(method); + if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) { + result = true; + } + } finally { + method.releaseConnection(); + } + } catch (IOException ex) { + // Do Nothing + } + return result; + } + + public static URI save(URL url, InputStream inputStream, String contentType, String encoding) throws Exception { + String locator = put(url, inputStream, contentType, encoding); + return new URI(locator); + } + + public static String put(URL url, InputStream inputStream, String contentType, String encoding) throws OseeCoreException { + int statusCode = -1; + String response = null; + PutMethod method = new PutMethod(url.toString()); + + InputStream responseInputStream = null; + AcquireResult result = new AcquireResult(); + try { + method.setRequestHeader(CONTENT_ENCODING, encoding); + method.setRequestEntity(new InputStreamRequestEntity(inputStream, contentType)); + + method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); + + statusCode = getHttpClient().executeMethod(method); + responseInputStream = method.getResponseBodyAsStream(); + result.setContentType(getContentType(method)); + result.setEncoding(method.getResponseCharSet()); + if (statusCode != HttpURLConnection.HTTP_CREATED) { + String exceptionString = Lib.inputStreamToString(responseInputStream); + throw new OseeCoreException(exceptionString); + } else { + responseInputStream = method.getResponseBodyAsStream(); + response = Lib.inputStreamToString(responseInputStream); + } + + } catch (Exception ex) { + OseeExceptions.wrapAndThrow(ex); + } finally { + try { + if (responseInputStream != null) { + responseInputStream.close(); + } + } catch (Exception ex) { + // Do Nothing; + } finally { + method.releaseConnection(); + } + } + return response; + } + + public static AcquireResult post(URL url, InputStream inputStream, String contentType, String encoding, OutputStream outputStream) throws OseeCoreException { + AcquireResult result = new AcquireResult(); + int statusCode = -1; + + PostMethod method = new PostMethod(url.toString()); + + InputStream httpInputStream = null; + try { + method.setRequestHeader(CONTENT_ENCODING, encoding); + method.setRequestEntity(new InputStreamRequestEntity(inputStream, contentType)); + + method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); + + statusCode = getHttpClient().executeMethod(method); + httpInputStream = method.getResponseBodyAsStream(); + result.setContentType(getContentType(method)); + result.setEncoding(method.getResponseCharSet()); + if (statusCode == HttpStatus.SC_ACCEPTED || statusCode == HttpStatus.SC_OK) { + Lib.inputStreamToOutputStream(httpInputStream, outputStream); + } else { + String exceptionString = Lib.inputStreamToString(httpInputStream); + throw new OseeCoreException(exceptionString); + } + } catch (Exception ex) { + OseeExceptions.wrapAndThrow(ex); + } finally { + try { + result.setCode(statusCode); + if (httpInputStream != null) { + httpInputStream.close(); + } + } catch (Exception ex) { + // Do Nothing; + } finally { + method.releaseConnection(); + } + } + return result; + } + + public static String post(URL url) throws Exception { + AcquireResult result = new AcquireResult(); + String response = null; + int statusCode = -1; + + PostMethod method = new PostMethod(url.toString()); + + InputStream responseInputStream = null; + try { + method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); + + statusCode = getHttpClient().executeMethod(method); + responseInputStream = method.getResponseBodyAsStream(); + result.setContentType(getContentType(method)); + result.setEncoding(method.getResponseCharSet()); + if (statusCode != HttpStatus.SC_ACCEPTED) { + String exceptionString = Lib.inputStreamToString(responseInputStream); + throw new Exception(exceptionString); + } else { + responseInputStream = method.getResponseBodyAsStream(); + response = Lib.inputStreamToString(responseInputStream); + } + } catch (Exception ex) { + throw new Exception(String.format("Error during POST [%s] - status code: [%s]", url, statusCode), ex); + } finally { + try { + if (responseInputStream != null) { + responseInputStream.close(); + } + } catch (Exception ex) { + // Do Nothing; + } finally { + method.releaseConnection(); + } + } + return response; + } + + private static String getContentType(HttpMethodBase method) { + String contentType = null; + Header header = method.getResponseHeader(CONTENT_TYPE); + if (header != null) { + contentType = header.getValue(); + if (Strings.isValid(contentType)) { + int index = contentType.indexOf(';'); + if (index > 0) { + contentType = contentType.substring(0, index); + } + } + } + return contentType; + } + + public static AcquireResult acquire(URL url, OutputStream outputStream) throws Exception { + AcquireResult result = new AcquireResult(); + int statusCode = -1; + + GetMethod method = new GetMethod(url.toString()); + + InputStream inputStream = null; + try { + method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); + + statusCode = getHttpClient().executeMethod(method); + if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_ACCEPTED) { + inputStream = method.getResponseBodyAsStream(); + result.setEncoding(method.getResponseCharSet()); + result.setContentType(getContentType(method)); + Lib.inputStreamToOutputStream(inputStream, outputStream); + } + } catch (Exception ex) { + throw new Exception(String.format("Error acquiring resource: [%s] - status code: [%s]", url, statusCode), ex); + } finally { + try { + result.setCode(statusCode); + if (inputStream != null) { + inputStream.close(); + } + } catch (Exception ex) { + // Do Nothing; + } finally { + method.releaseConnection(); + } + } + return result; + } + + public static String delete(URL url) throws Exception { + String response = null; + int statusCode = -1; + DeleteMethod method = new DeleteMethod(url.toString()); + + InputStream responseInputStream = null; + try { + method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); + statusCode = getHttpClient().executeMethod(method); + if (statusCode == HttpStatus.SC_ACCEPTED) { + responseInputStream = method.getResponseBodyAsStream(); + response = Lib.inputStreamToString(responseInputStream); + } + } catch (Exception ex) { + throw new Exception(String.format("Error deleting resource: [%s] - status code: [%s]", url, statusCode), ex); + } finally { + try { + if (responseInputStream != null) { + responseInputStream.close(); + } + } catch (Exception ex) { + // Do Nothing; + } finally { + method.releaseConnection(); + } + } + return response; + } + + public static final class AcquireResult { + private int code; + private String encoding; + private String contentType; + + private AcquireResult() { + super(); + this.code = -1; + this.encoding = ""; + this.contentType = ""; + } + + public boolean wasSuccessful() { + return code == HttpURLConnection.HTTP_OK || code == HttpURLConnection.HTTP_ACCEPTED; + } + + public int getCode() { + return code; + } + + private void setCode(int code) { + this.code = code; + } + + public String getEncoding() { + return encoding; + } + + private void setEncoding(String encoding) { + this.encoding = encoding; + } + + public String getContentType() { + return contentType; + } + + private void setContentType(String contentType) { + this.contentType = contentType; + } + } +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/ServiceDependencyTracker.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/ServiceDependencyTracker.java index 835483ef770..52cdda046e5 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/ServiceDependencyTracker.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/ServiceDependencyTracker.java @@ -1,119 +1,119 @@ -/*******************************************************************************
- * 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.core.util;
-
-import java.io.Closeable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * @author Andrew M. Finkbeiner
- * @author Roberto E. Escobar
- */
-public final class ServiceDependencyTracker implements Closeable {
- private static final Object NULL_SERVICE = new Object();
-
- private final BundleContext context;
- private final AbstractTrackingHandler handler;
- private final Map<Class<?>, Object> services;
- private final List<ServiceTracker> trackers;
-
- public ServiceDependencyTracker(BundleContext context, AbstractTrackingHandler handler) {
- this.services = new ConcurrentHashMap<Class<?>, Object>();
- this.trackers = new ArrayList<ServiceTracker>();
- this.context = context;
- this.handler = handler;
- }
-
- public void open() {
- Class<?>[] dependencies = handler.getDependencies();
- if (dependencies != null) {
- for (Class<?> clazz : dependencies) {
- services.put(clazz, NULL_SERVICE);
- trackers.add(new InternalServiceTracker(this, getBundleContext(), clazz));
- }
- for (ServiceTracker tracker : trackers) {
- tracker.open(true);
- }
- }
- }
-
- @Override
- public void close() {
- handler.onDeActivate();
- for (ServiceTracker tracker : trackers) {
- tracker.close();
- }
- }
-
- private BundleContext getBundleContext() {
- return context;
- }
-
- private void onAddingService(Class<?> classKey, Object service) {
- Object previous = services.put(classKey, service);
- if (isValidService(previous) && previous != service) {
- throw new IllegalStateException(String.format("Attempting to overwrite existing service reference: [%s]",
- previous.getClass().getName()));
- }
- if (areServicesReady()) {
- handler.onActivate(getBundleContext(), services);
- }
- }
-
- private boolean isValidService(Object service) {
- return service != null && !NULL_SERVICE.equals(service);
- }
-
- private boolean areServicesReady() {
- for (Object service : services.values()) {
- if (!isValidService(service)) {
- return false;
- }
- }
- return true;
- }
-
- private void onRemovingService(Class<?> classKey) {
- handler.onDeActivate();
- services.remove(classKey);
- }
-
- private final static class InternalServiceTracker extends ServiceTracker {
- private final ServiceDependencyTracker parentTracker;
- private final Class<?> serviceClass;
-
- public InternalServiceTracker(ServiceDependencyTracker parentTracker, BundleContext context, Class<?> serviceClass) {
- super(context, serviceClass.getName(), null);
- this.parentTracker = parentTracker;
- this.serviceClass = serviceClass;
- }
-
- @Override
- public Object addingService(ServiceReference reference) {
- Object object = super.addingService(reference);
- parentTracker.onAddingService(serviceClass, object);
- return object;
- }
-
- @Override
- public void removedService(ServiceReference reference, Object service) {
- parentTracker.onRemovingService(serviceClass);
- super.removedService(reference, service);
- }
- }
-
-}
+/******************************************************************************* + * 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.core.util; + +import java.io.Closeable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.util.tracker.ServiceTracker; + +/** + * @author Andrew M. Finkbeiner + * @author Roberto E. Escobar + */ +public final class ServiceDependencyTracker implements Closeable { + private static final Object NULL_SERVICE = new Object(); + + private final BundleContext context; + private final AbstractTrackingHandler handler; + private final Map<Class<?>, Object> services; + private final List<ServiceTracker> trackers; + + public ServiceDependencyTracker(BundleContext context, AbstractTrackingHandler handler) { + this.services = new ConcurrentHashMap<Class<?>, Object>(); + this.trackers = new ArrayList<ServiceTracker>(); + this.context = context; + this.handler = handler; + } + + public void open() { + Class<?>[] dependencies = handler.getDependencies(); + if (dependencies != null) { + for (Class<?> clazz : dependencies) { + services.put(clazz, NULL_SERVICE); + trackers.add(new InternalServiceTracker(this, getBundleContext(), clazz)); + } + for (ServiceTracker tracker : trackers) { + tracker.open(true); + } + } + } + + @Override + public void close() { + handler.onDeActivate(); + for (ServiceTracker tracker : trackers) { + tracker.close(); + } + } + + private BundleContext getBundleContext() { + return context; + } + + private void onAddingService(Class<?> classKey, Object service) { + Object previous = services.put(classKey, service); + if (isValidService(previous) && previous != service) { + throw new IllegalStateException(String.format("Attempting to overwrite existing service reference: [%s]", + previous.getClass().getName())); + } + if (areServicesReady()) { + handler.onActivate(getBundleContext(), services); + } + } + + private boolean isValidService(Object service) { + return service != null && !NULL_SERVICE.equals(service); + } + + private boolean areServicesReady() { + for (Object service : services.values()) { + if (!isValidService(service)) { + return false; + } + } + return true; + } + + private void onRemovingService(Class<?> classKey) { + handler.onDeActivate(); + services.remove(classKey); + } + + private final static class InternalServiceTracker extends ServiceTracker { + private final ServiceDependencyTracker parentTracker; + private final Class<?> serviceClass; + + public InternalServiceTracker(ServiceDependencyTracker parentTracker, BundleContext context, Class<?> serviceClass) { + super(context, serviceClass.getName(), null); + this.parentTracker = parentTracker; + this.serviceClass = serviceClass; + } + + @Override + public Object addingService(ServiceReference reference) { + Object object = super.addingService(reference); + parentTracker.onAddingService(serviceClass, object); + return object; + } + + @Override + public void removedService(ServiceReference reference, Object service) { + parentTracker.onRemovingService(serviceClass); + super.removedService(reference, service); + } + } + +} diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/TableWriterAdaptor.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/TableWriterAdaptor.java index 4004dba6215..a8e7de71d83 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/TableWriterAdaptor.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/TableWriterAdaptor.java @@ -1,177 +1,177 @@ -/*******************************************************************************
- * 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.core.util;
-
-import java.awt.Color;
-import java.io.OutputStream;
-import com.lowagie.text.Cell;
-import com.lowagie.text.DocWriter;
-import com.lowagie.text.Document;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.ElementTags;
-import com.lowagie.text.Font;
-import com.lowagie.text.FontFactory;
-import com.lowagie.text.PageSize;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Table;
-import com.lowagie.text.html.HtmlWriter;
-import com.lowagie.text.html.WebColors;
-import com.lowagie.text.pdf.BaseFont;
-import com.lowagie.text.pdf.PdfWriter;
-import com.lowagie.text.rtf.RtfWriter2;
-
-/**
- * @author Roberto E. Escobar
- */
-public class TableWriterAdaptor {
- public static final String ENCODING = "ISO-8859-1";
- public static final String PDF = "pdf";
- public static final String HTML = "html";
- public static final String RTF = "rtf";
-
- private final Document document;
- private Table table;
- private final OutputStream outputStream;
- private boolean complete;
- private String title;
- private DocWriter writer;
-
- public TableWriterAdaptor(String writerId, OutputStream outputStream) throws Exception {
- this(writerId, PageSize.LETTER.rotate(), outputStream);
- }
-
- public TableWriterAdaptor(String writerId, Rectangle rectangle, OutputStream outputStream) throws Exception {
- this.complete = false;
- this.document = new Document(rectangle);
- this.outputStream = outputStream;
- this.setDocWriter(writerId);
- }
-
- private void setDocWriter(String value) throws Exception {
- if (value.equalsIgnoreCase(PDF)) {
- this.writer = PdfWriter.getInstance(document, outputStream);
- // ((PdfWriter) writer).setPDFXConformance(PdfWriter.PDFX32002);
- ((PdfWriter) writer).setPdfVersion(PdfWriter.VERSION_1_6);
- } else if (value.equalsIgnoreCase(HTML)) {
- this.writer = HtmlWriter.getInstance(document, outputStream);
- } else if (value.equalsIgnoreCase(RTF)) {
- this.writer = RtfWriter2.getInstance(document, outputStream);
- }
- }
-
- public void writeHeader(String[] headers) throws Exception {
- table = new Table(headers.length);
- table.setBorder(1);
- table.setSpacing(1);
- table.setPadding(1);
- // this.table.setCellsFitPage(true);
- // this.table.setTableFitsPage(true);
- table.setBorderColor(new Color(0, 0, 0));
- writeHeader(table, headers);
- }
-
- public void writeHeader(Table table, String[] headers) throws Exception {
- for (String header : headers) {
- Cell cell = new Cell();
- cell.setHeader(true);
- cell.setColspan(1);
- cell.setBackgroundColor(WebColors.getRGBColor("#d9d9d9"));
- cell.setHorizontalAlignment(ElementTags.ALIGN_CENTER);
-
- Font font =
- FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.BOLD,
- WebColors.getRGBColor("#000000"));
- Paragraph paragraph = new Paragraph(header, font);
- paragraph.setAlignment(ElementTags.ALIGN_CENTER);
- cell.add(paragraph);
- table.addCell(cell);
- }
- }
-
- public void writeRow(String... cellData) {
- writeRow(this.table, cellData);
- }
-
- public void writeRow(Table table, String... cellData) {
- for (String cellText : cellData) {
- Cell cell = new Cell();
- cell.setHeader(false);
- cell.setColspan(1);
- Font font =
- FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.NORMAL,
- WebColors.getRGBColor("#000000"));
- Paragraph paragraph = new Paragraph(cellText, font);
- cell.add(paragraph);
- table.addCell(cell);
- }
- }
-
- public void writeTitle(String title) {
- this.title = title;
- }
-
- public Document getDocument() {
- return document;
- }
-
- public Document openDocument() {
- document.addTitle(title);
- document.addSubject("This report is automatically generated.");
- document.addKeywords("Metadata, iText");
- document.addCreationDate();
- if (writer instanceof PdfWriter) {
- PdfWriter pdfWriter = (PdfWriter) writer;
- pdfWriter.createXmpMetadata();
- }
- document.open();
- return document;
- }
-
- public void writeDocument() throws DocumentException {
- Font font =
- FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.BOLD,
- WebColors.getRGBColor("#000000"));
- Paragraph paragraph = new Paragraph(title, font);
- paragraph.setAlignment(ElementTags.ALIGN_CENTER);
- document.add(paragraph);
- document.add(table);
- }
-
- public void addTable(Table table) throws DocumentException {
- document.add(table);
- }
-
- public void close() {
- if (complete != true) {
- document.close();
- complete = true;
- }
- }
-
- public boolean isCompleted() {
- return complete;
- }
-
- public Table getTable() {
- return table;
- }
-
- // public String toString() {
- // try {
- // return outputStream.toString("ISO-8859-1");
- // } catch (Exception ex) {
- // ex.printStackTrace();
- // }
- // return "";
- // }
-
+/******************************************************************************* + * 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.core.util; + +import java.awt.Color; +import java.io.OutputStream; +import com.lowagie.text.Cell; +import com.lowagie.text.DocWriter; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.ElementTags; +import com.lowagie.text.Font; +import com.lowagie.text.FontFactory; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.Table; +import com.lowagie.text.html.HtmlWriter; +import com.lowagie.text.html.WebColors; +import com.lowagie.text.pdf.BaseFont; +import com.lowagie.text.pdf.PdfWriter; +import com.lowagie.text.rtf.RtfWriter2; + +/** + * @author Roberto E. Escobar + */ +public class TableWriterAdaptor { + public static final String ENCODING = "ISO-8859-1"; + public static final String PDF = "pdf"; + public static final String HTML = "html"; + public static final String RTF = "rtf"; + + private final Document document; + private Table table; + private final OutputStream outputStream; + private boolean complete; + private String title; + private DocWriter writer; + + public TableWriterAdaptor(String writerId, OutputStream outputStream) throws Exception { + this(writerId, PageSize.LETTER.rotate(), outputStream); + } + + public TableWriterAdaptor(String writerId, Rectangle rectangle, OutputStream outputStream) throws Exception { + this.complete = false; + this.document = new Document(rectangle); + this.outputStream = outputStream; + this.setDocWriter(writerId); + } + + private void setDocWriter(String value) throws Exception { + if (value.equalsIgnoreCase(PDF)) { + this.writer = PdfWriter.getInstance(document, outputStream); + // ((PdfWriter) writer).setPDFXConformance(PdfWriter.PDFX32002); + ((PdfWriter) writer).setPdfVersion(PdfWriter.VERSION_1_6); + } else if (value.equalsIgnoreCase(HTML)) { + this.writer = HtmlWriter.getInstance(document, outputStream); + } else if (value.equalsIgnoreCase(RTF)) { + this.writer = RtfWriter2.getInstance(document, outputStream); + } + } + + public void writeHeader(String[] headers) throws Exception { + table = new Table(headers.length); + table.setBorder(1); + table.setSpacing(1); + table.setPadding(1); + // this.table.setCellsFitPage(true); + // this.table.setTableFitsPage(true); + table.setBorderColor(new Color(0, 0, 0)); + writeHeader(table, headers); + } + + public void writeHeader(Table table, String[] headers) throws Exception { + for (String header : headers) { + Cell cell = new Cell(); + cell.setHeader(true); + cell.setColspan(1); + cell.setBackgroundColor(WebColors.getRGBColor("#d9d9d9")); + cell.setHorizontalAlignment(ElementTags.ALIGN_CENTER); + + Font font = + FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.BOLD, + WebColors.getRGBColor("#000000")); + Paragraph paragraph = new Paragraph(header, font); + paragraph.setAlignment(ElementTags.ALIGN_CENTER); + cell.add(paragraph); + table.addCell(cell); + } + } + + public void writeRow(String... cellData) { + writeRow(this.table, cellData); + } + + public void writeRow(Table table, String... cellData) { + for (String cellText : cellData) { + Cell cell = new Cell(); + cell.setHeader(false); + cell.setColspan(1); + Font font = + FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.NORMAL, + WebColors.getRGBColor("#000000")); + Paragraph paragraph = new Paragraph(cellText, font); + cell.add(paragraph); + table.addCell(cell); + } + } + + public void writeTitle(String title) { + this.title = title; + } + + public Document getDocument() { + return document; + } + + public Document openDocument() { + document.addTitle(title); + document.addSubject("This report is automatically generated."); + document.addKeywords("Metadata, iText"); + document.addCreationDate(); + if (writer instanceof PdfWriter) { + PdfWriter pdfWriter = (PdfWriter) writer; + pdfWriter.createXmpMetadata(); + } + document.open(); + return document; + } + + public void writeDocument() throws DocumentException { + Font font = + FontFactory.getFont("Times New Roman", BaseFont.CP1252, BaseFont.EMBEDDED, 9, Font.BOLD, + WebColors.getRGBColor("#000000")); + Paragraph paragraph = new Paragraph(title, font); + paragraph.setAlignment(ElementTags.ALIGN_CENTER); + document.add(paragraph); + document.add(table); + } + + public void addTable(Table table) throws DocumentException { + document.add(table); + } + + public void close() { + if (complete != true) { + document.close(); + complete = true; + } + } + + public boolean isCompleted() { + return complete; + } + + public Table getTable() { + return table; + } + + // public String toString() { + // try { + // return outputStream.toString("ISO-8859-1"); + // } catch (Exception ex) { + // ex.printStackTrace(); + // } + // return ""; + // } + }
\ No newline at end of file |