Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BaseExchangeData.java')
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BaseExchangeData.java178
1 files changed, 89 insertions, 89 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;
+ }
+}

Back to the top