Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2014-03-28 22:16:19 +0000
committerRyan D. Brooks2014-03-28 22:16:19 +0000
commit042e50f7f7bcacdb092cc8ee562fc03ad4ed0027 (patch)
tree4c43520a5ed3f3791e45800f02608f192ab1220e
parent426b0123f9f2dc63b2c03f61c7da453ac4df0835 (diff)
downloadorg.eclipse.osee-042e50f7f7bcacdb092cc8ee562fc03ad4ed0027.tar.gz
org.eclipse.osee-042e50f7f7bcacdb092cc8ee562fc03ad4ed0027.tar.xz
org.eclipse.osee-042e50f7f7bcacdb092cc8ee562fc03ad4ed0027.zip
refactor: Improve efficiency by directly using token in PageCreator
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/ResourceToken.java10
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageCreator.java7
2 files changed, 13 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/ResourceToken.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/ResourceToken.java
index 5ce96c2fed7..5d34684b505 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/ResourceToken.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/ResourceToken.java
@@ -11,6 +11,8 @@
package org.eclipse.osee.framework.jdk.core.type;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
/**
@@ -23,4 +25,12 @@ public abstract class ResourceToken extends NamedIdentity<Long> {
}
public abstract URL getUrl();
+
+ public InputStream getInputStream() {
+ try {
+ return getUrl().openStream();
+ } catch (IOException ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageCreator.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageCreator.java
index efaf49937e7..983c1cbb7f8 100644
--- a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageCreator.java
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageCreator.java
@@ -79,9 +79,8 @@ public final class PageCreator {
return null;
}
- public void readKeyValuePairs(ResourceToken valuesResource) {
- InputStream keyValueStream = registry.getResource(valuesResource.getGuid());
- readKeyValuePairs(keyValueStream);
+ public void readKeyValuePairs(ResourceToken keyValueResource) {
+ readKeyValuePairs(keyValueResource.getInputStream());
}
public void readKeyValuePairs(InputStream keyValueStream) {
@@ -134,7 +133,7 @@ public final class PageCreator {
}
private Appendable realizePage(ResourceToken templateResource, Appendable page, boolean processInstructions) {
- return realizePage(registry.getResource(templateResource.getGuid()), page, processInstructions);
+ return realizePage(templateResource.getInputStream(), page, processInstructions);
}
private Appendable realizePage(InputStream template, Appendable page, boolean processInstructions) {

Back to the top