Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2013-10-02 21:00:23 +0000
committerRoberto E. Escobar2013-10-04 22:34:00 +0000
commit3c5c29ff94425b3706736104c33ff25fc336b121 (patch)
treeb04e2831771f1ba5d9942e7bb910f3269bec979e
parentf693f6d4496f0810a3b1cbb3183ef79b4f7785c7 (diff)
downloadorg.eclipse.osee-3c5c29ff94425b3706736104c33ff25fc336b121.tar.gz
org.eclipse.osee-3c5c29ff94425b3706736104c33ff25fc336b121.tar.xz
org.eclipse.osee-3c5c29ff94425b3706736104c33ff25fc336b121.zip
feature: Create org.eclipse.osee.template0.14.0.v201310042319_RC
-rw-r--r--features/org.eclipse.osee.x.core.feature/feature.xml7
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/.classpath7
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/.project28
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/META-INF/MANIFEST.MF11
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/build.properties5
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/pom.xml30
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/HtmlPageCreatorTest.java131
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateEngineTestSuite.java23
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateTestTokens.java50
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header.html2
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header_NoTokenOnFirstLine.html1
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/myTest.css1
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_MainPage.html5
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_Values.html7
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testHeaderPage.html2
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testMainPage_WithIncludeFile.html6
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_Include.html1
-rw-r--r--plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_KeyValue.html3
-rw-r--r--plugins/org.eclipse.osee.template.engine/.classpath7
-rw-r--r--plugins/org.eclipse.osee.template.engine/.project33
-rw-r--r--plugins/org.eclipse.osee.template.engine/META-INF/MANIFEST.MF14
-rw-r--r--plugins/org.eclipse.osee.template.engine/build.properties5
-rw-r--r--plugins/org.eclipse.osee.template.engine/pom.xml16
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/AppendableRule.java31
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/CompositeRule.java45
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/HtmlPageCreator.java197
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/IdentifiableOptionsRule.java35
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OptionsRule.java68
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OseeTemplateTokens.java45
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageFactory.java68
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/StringRule.java35
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/exception.html11
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/oseeCore.js57
-rw-r--r--plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/pageDeclaration.html3
-rw-r--r--plugins/org.eclipse.osee.x.core.parent/pom.xml3
35 files changed, 993 insertions, 0 deletions
diff --git a/features/org.eclipse.osee.x.core.feature/feature.xml b/features/org.eclipse.osee.x.core.feature/feature.xml
index 8f02b462f79..4720171cae1 100644
--- a/features/org.eclipse.osee.x.core.feature/feature.xml
+++ b/features/org.eclipse.osee.x.core.feature/feature.xml
@@ -151,4 +151,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.osee.template.engine"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/plugins/org.eclipse.osee.template.engine.test/.classpath b/plugins/org.eclipse.osee.template.engine.test/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.template.engine.test/.project b/plugins/org.eclipse.osee.template.engine.test/.project
new file mode 100644
index 00000000000..01007b08641
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.template.engine.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.template.engine.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.template.engine.test/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..65e6e9dcc11
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Template Engine Test
+Bundle-SymbolicName: org.eclipse.osee.template.engine.test
+Bundle-Version: 0.14.0.qualifier
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Fragment-Host: org.eclipse.osee.template.engine
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.junit,
+ org.junit.runner,
+ org.junit.runners
diff --git a/plugins/org.eclipse.osee.template.engine.test/build.properties b/plugins/org.eclipse.osee.template.engine.test/build.properties
new file mode 100644
index 00000000000..40db5d80b59
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ src/org/eclipse/osee/template/engine/html/
diff --git a/plugins/org.eclipse.osee.template.engine.test/pom.xml b/plugins/org.eclipse.osee.template.engine.test/pom.xml
new file mode 100644
index 00000000000..296a4c2778e
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/pom.xml
@@ -0,0 +1,30 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.x.core.parent</artifactId>
+ <version>0.14.0-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.x.core.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.template.engine.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <name>OSEE Template Engine Test - (Incubation)</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <testSuite>org.eclipse.osee.template.engine.test</testSuite>
+ <testClass>org.eclipse.osee.template.engine.OseeTemplateEngineTestSuite</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/HtmlPageCreatorTest.java b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/HtmlPageCreatorTest.java
new file mode 100644
index 00000000000..8f22db241f7
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/HtmlPageCreatorTest.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import static org.eclipse.osee.template.engine.OseeTemplateTestTokens.RealizePage_MainPageHtml;
+import static org.eclipse.osee.template.engine.OseeTemplateTestTokens.RealizePage_ValuesHtml;
+import static org.eclipse.osee.template.engine.OseeTemplateTestTokens.TestMainPage_WithIncludeFileHtml;
+import static org.eclipse.osee.template.engine.OseeTemplateTestTokens.TestValues_IncludeHtml;
+import static org.eclipse.osee.template.engine.OseeTemplateTestTokens.TestValues_KeyValueHtml;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.model.ResourceRegistry;
+import org.eclipse.osee.framework.core.model.ResourceToken;
+import org.eclipse.osee.framework.core.services.IResourceRegistry;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Unit Test for {@link HtmlPageCreator}
+ *
+ * @author Donald G. Dunne
+ */
+public class HtmlPageCreatorTest {
+
+ private static final IResourceRegistry registry = new ResourceRegistry();
+
+ @BeforeClass
+ public static void setup() {
+ OseeTemplateTestTokens.register(registry);
+ OseeTemplateTokens.register(registry);
+ }
+
+ @Test
+ public void testHtmlPageCreator_KeyValues() {
+ HtmlPageCreator page = PageFactory.newHtmlPageCreator(registry, "key", "value", "key2", "value2");
+ Assert.assertEquals("value", page.getValue("key"));
+ Assert.assertEquals("value2", page.getValue("key2"));
+ }
+
+ @Test
+ public void addSubstitution() {
+ StringRule rule = new StringRule("key", "value");
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.addSubstitution(rule);
+ Assert.assertEquals("value", page.getValue("key"));
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void readSubstitution_nullCheck() throws Exception {
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.readKeyValuePairs((ResourceToken) null);
+ }
+
+ @Test
+ public void readSubstitutions_keyValue() throws Exception {
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.readKeyValuePairs(TestValues_KeyValueHtml);
+
+ Assert.assertEquals(" <h1>value</h1>", page.getValue("key"));
+ Assert.assertEquals(" <h2>value2</h2>", page.getValue("key2"));
+ }
+
+ @Test
+ public void readSubstitutions_include() throws Exception {
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.readKeyValuePairs(TestValues_IncludeHtml);
+ Assert.assertEquals("<!-- testHeaderPage.html -->\n\n<b>header</b>\n", page.getValue("header"));
+ }
+
+ @Test
+ public void realizePage() throws Exception {
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.readKeyValuePairs(RealizePage_ValuesHtml);
+
+ String expected = "<!-- header.html -->\n\nmy header\n\n<h1>heading1</h1>\n\n <h2>heading2</h2>\n";
+ String results = page.realizePage(RealizePage_MainPageHtml);
+ Assert.assertEquals(expected, results);
+
+ page = PageFactory.newHtmlPageCreator(registry, RealizePage_ValuesHtml);
+ results = page.realizePage(RealizePage_MainPageHtml);
+ Assert.assertEquals(expected, results);
+
+ results = PageFactory.realizePage(registry, RealizePage_MainPageHtml, RealizePage_ValuesHtml);
+ Assert.assertEquals(expected, results);
+ }
+
+ @Test
+ public void realizePage_WithIncludes() throws Exception {
+ String results = PageFactory.realizePage(registry, TestMainPage_WithIncludeFileHtml);
+ Assert.assertTrue(results.contains("my header"));
+ Assert.assertTrue(results.contains("header_NoTokenOnFirstLine.html -->"));
+
+ Assert.assertTrue(results.contains("background-color"));
+ Assert.assertTrue(results.contains("myTest.css */"));
+ }
+
+ @Test
+ public void realizePage_NoTokenFirstLine() throws Exception {
+ String results = PageFactory.realizePage(registry, TestMainPage_WithIncludeFileHtml);
+ Assert.assertTrue(results.contains("my header"));
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void realizePage_noSubstitution() throws Exception {
+ PageFactory.realizePage(registry, RealizePage_MainPageHtml);
+ }
+
+ @Test
+ public void realizePage__KeyValues() throws Exception {
+ String expected = "headerA\n\nvalue1\n\nvalue2\n";
+ String results =
+ PageFactory.realizePage(registry, RealizePage_MainPageHtml, "header", "headerA", "key1", "value1", "key2",
+ "value2");
+ Assert.assertEquals(expected, results);
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.readKeyValuePairs(TestValues_KeyValueHtml);
+ Assert.assertEquals("{key2= <h2>value2</h2>, key= <h1>value</h1>}", page.toString());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateEngineTestSuite.java b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateEngineTestSuite.java
new file mode 100644
index 00000000000..3de8feb1163
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateEngineTestSuite.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Ryan D. Brooks
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({HtmlPageCreatorTest.class})
+public class OseeTemplateEngineTestSuite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateTestTokens.java b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateTestTokens.java
new file mode 100644
index 00000000000..b456f2f3471
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/OseeTemplateTestTokens.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import java.util.ArrayList;
+import org.eclipse.osee.framework.core.model.ClassBasedResourceToken;
+import org.eclipse.osee.framework.core.model.ResourceToken;
+import org.eclipse.osee.framework.core.services.IResourceRegistry;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public final class OseeTemplateTestTokens {
+ private static final ArrayList<ResourceToken> tokens = new ArrayList<ResourceToken>();
+
+ // @formatter:off
+ public static final ResourceToken TestValues_IncludeHtml = createToken(0x40000000000000F0L, "testValues_Include.html");
+ public static final ResourceToken TestHeaderPageHtml = createToken(0x40000000000000F1L, "testHeaderPage.html");
+ public static final ResourceToken TestValues_KeyValueHtml = createToken(0x40000000000000F2L, "testValues_KeyValue.html");
+ public static final ResourceToken RealizePage_MainPageHtml = createToken(0x40000000000000F3L, "realizePage_MainPage.html");
+ public static final ResourceToken Header_NoTokenOnFirstLineHtml = createToken(0x40000000000000F4L, "header_NoTokenOnFirstLine.html");
+ public static final ResourceToken TestMainPage_WithIncludeFileHtml = createToken(0x40000000000000F5L, "testMainPage_WithIncludeFile.html");
+ public static final ResourceToken HeaderHtml = createToken(0x40000000000000F6L, "header.html");
+ public static final ResourceToken RealizePage_ValuesHtml = createToken(0x40000000000000F7L, "realizePage_Values.html");
+ public static final ResourceToken MyTestCss = createToken(0x40000000000000F8L, "myTest.css");
+ // @formatter:on
+
+ private static ResourceToken createToken(Long uuid, String name) {
+ ResourceToken token = new ClassBasedResourceToken(uuid, name, OseeTemplateTestTokens.class, "html/");
+ tokens.add(token);
+ return token;
+ }
+
+ public static void register(IResourceRegistry registry) {
+ registry.registerAll(tokens);
+ }
+
+ private OseeTemplateTestTokens() {
+ // Constants
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header.html
new file mode 100644
index 00000000000..8dbcade852a
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header.html
@@ -0,0 +1,2 @@
+
+my header \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header_NoTokenOnFirstLine.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header_NoTokenOnFirstLine.html
new file mode 100644
index 00000000000..84942bf5747
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/header_NoTokenOnFirstLine.html
@@ -0,0 +1 @@
+my header \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/myTest.css b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/myTest.css
new file mode 100644
index 00000000000..fc071c58d3c
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/myTest.css
@@ -0,0 +1 @@
+body{ background-color: gray;} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_MainPage.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_MainPage.html
new file mode 100644
index 00000000000..8ac573de1ce
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_MainPage.html
@@ -0,0 +1,5 @@
+<?header?>
+
+<?key1?>
+
+<?key2?>
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_Values.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_Values.html
new file mode 100644
index 00000000000..4740e5950c3
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/realizePage_Values.html
@@ -0,0 +1,7 @@
+<?include id="header" path="40000000000000F6 header.html"?>
+<?key1?><h1>heading1</h1>
+<?key2?> <h2>heading2</h2>
+<?KeyWithTwoNewlines?>
+
+<?KeyWithOnlyOneNewline?>
+<?KeyWithabsolutelyNoValue?> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testHeaderPage.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testHeaderPage.html
new file mode 100644
index 00000000000..e6a5516ebd1
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testHeaderPage.html
@@ -0,0 +1,2 @@
+
+<b>header</b>
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testMainPage_WithIncludeFile.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testMainPage_WithIncludeFile.html
new file mode 100644
index 00000000000..4ba64d85b67
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testMainPage_WithIncludeFile.html
@@ -0,0 +1,6 @@
+
+<?include path="40000000000000F8 myTest.css"?>
+
+<?include path="40000000000000F4 header_NoTokenOnFirstLine.html"?>
+
+<b>my page</b>
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_Include.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_Include.html
new file mode 100644
index 00000000000..cb2fd495853
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_Include.html
@@ -0,0 +1 @@
+<?include id="header" path="40000000000000F1 testHeaderPage.html"?> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_KeyValue.html b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_KeyValue.html
new file mode 100644
index 00000000000..0e8d3c67c8f
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine.test/src/org/eclipse/osee/template/engine/html/testValues_KeyValue.html
@@ -0,0 +1,3 @@
+<?key?> <h1>value</h1>
+<?key2?>
+ <h2>value2</h2>
diff --git a/plugins/org.eclipse.osee.template.engine/.classpath b/plugins/org.eclipse.osee.template.engine/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.template.engine/.project b/plugins/org.eclipse.osee.template.engine/.project
new file mode 100644
index 00000000000..cace16c1c31
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.template.engine</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.template.engine/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.template.engine/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..43d0710f96d
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Template Engine (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.template.engine
+Bundle-Version: 0.14.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.core.runtime,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.services,
+ org.eclipse.osee.framework.core.util
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Export-Package: org.eclipse.osee.template.engine
diff --git a/plugins/org.eclipse.osee.template.engine/build.properties b/plugins/org.eclipse.osee.template.engine/build.properties
new file mode 100644
index 00000000000..40db5d80b59
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ src/org/eclipse/osee/template/engine/html/
diff --git a/plugins/org.eclipse.osee.template.engine/pom.xml b/plugins/org.eclipse.osee.template.engine/pom.xml
new file mode 100644
index 00000000000..4e3943a2e78
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/pom.xml
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.x.core.parent</artifactId>
+ <version>0.14.0-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.x.core.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.template.engine</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSEE Template Engine - (Incubation)</name>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/AppendableRule.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/AppendableRule.java
new file mode 100644
index 00000000000..ba6248c60ba
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/AppendableRule.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import org.eclipse.osee.framework.core.data.Named;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public abstract class AppendableRule implements Named {
+ private final String ruleName;
+
+ public AppendableRule(String ruleName) {
+ this.ruleName = ruleName;
+ }
+
+ @Override
+ public String getName() {
+ return ruleName;
+ }
+
+ public abstract void applyTo(Appendable appendable) throws Exception;
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/CompositeRule.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/CompositeRule.java
new file mode 100644
index 00000000000..c1c0654e58b
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/CompositeRule.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public final class CompositeRule extends AppendableRule {
+ private final List<AppendableRule> rules = new ArrayList<AppendableRule>();
+
+ public CompositeRule(String ruleName) {
+ super(ruleName);
+ }
+
+ @Override
+ public void applyTo(Appendable appendable) throws Exception {
+ for (AppendableRule rule : rules) {
+ rule.applyTo(appendable);
+ }
+ }
+
+ public void addRule(AppendableRule rule) {
+ rules.add(rule);
+ }
+
+ public boolean ruleExists(String ruleName) {
+ for (AppendableRule rule : rules) {
+ if (rule.getName().equals(ruleName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/HtmlPageCreator.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/HtmlPageCreator.java
new file mode 100644
index 00000000000..1309596b2b4
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/HtmlPageCreator.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Scanner;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.model.ResourceToken;
+import org.eclipse.osee.framework.core.services.IResourceRegistry;
+import org.eclipse.osee.framework.core.util.Conditions;
+
+/**
+ * Generates xhtml pages using both static and dynamic substitutions. Designed to be thread safe; however, this means
+ * the substitutions are shared so only reuse with multiple threads that can share the substitutions<br />
+ * http://www.w3.org/2007/07/xhtml-basic-ref.html <br />
+ * http://validator.w3.org/check <br />
+ *
+ * @author Ryan D. Brooks
+ */
+public final class HtmlPageCreator {
+ private static final Pattern xmlProcessingInstructionStartOrEnd = Pattern.compile("(\\?>)|(<\\?\\s*)");
+ private static final Pattern xmlProcessingInstructionStart = Pattern.compile("\\s*<\\?");
+ private static final Pattern emptyOrWhitespaceOnly = Pattern.compile("\\s*");
+ private static final Pattern newlineStart = Pattern.compile("\\A\\r?\\n?");
+ private static final Pattern newlineEnd = Pattern.compile("\\r?\\n?\\z");
+ private static final Pattern processingInstructionPath = Pattern.compile("path=\"([^ ]+)");
+ private static final Pattern processingInstructionId = Pattern.compile("id=\"([^\"]+)");
+ private static final int NumOfCharsInTypicalSmallPage = 7000;
+
+ private final IResourceRegistry registry;
+ private final ConcurrentHashMap<String, AppendableRule> substitutions =
+ new ConcurrentHashMap<String, AppendableRule>();
+
+ public HtmlPageCreator(IResourceRegistry registry) {
+ this.registry = registry;
+ }
+
+ public void addSubstitution(AppendableRule rule) {
+ substitutions.put(rule.getName(), rule);
+ }
+
+ public void addKeyValuePair(String ruleName, CharSequence substitution) {
+ addSubstitution(new StringRule(ruleName, substitution));
+ }
+
+ public void addKeyValuePairs(String... keyValues) {
+ for (int i = 0; i < keyValues.length; i += 2) {
+ addKeyValuePair(keyValues[i], keyValues[i + 1]);
+ }
+ }
+
+ public void addKeyValuePairs(Iterable<String> keyValuePairs) {
+ Iterator<String> iterator = keyValuePairs.iterator();
+ while (iterator.hasNext()) {
+ addKeyValuePair(iterator.next(), iterator.next());
+ }
+ }
+
+ public String getValue(String ruleName) {
+ return substitutions.get(ruleName).toString();
+ }
+
+ public void readKeyValuePairs(ResourceToken valuesResource) throws Exception {
+ Conditions.checkNotNull(valuesResource, "valuesResource");
+ InputStream keyValueStream = registry.getResource(valuesResource.getGuid());
+ readKeyValuePairs(keyValueStream);
+ }
+
+ public void readKeyValuePairs(InputStream keyValueStream) throws Exception {
+ Scanner scanner = new Scanner(keyValueStream, "UTF-8");
+ scanner.useDelimiter(xmlProcessingInstructionStartOrEnd);
+
+ try {
+ while (scanner.hasNext()) {
+ String token = scanner.next();
+ if (emptyOrWhitespaceOnly.matcher(token).matches()) {
+ continue;
+ }
+
+ String id;
+ CharSequence substitution;
+
+ if (token.startsWith("include")) {
+ id = getProcessingInstructionId(token);
+ substitution = new StringBuilder(NumOfCharsInTypicalSmallPage);
+ appendInclude((StringBuilder) substitution, token);
+ } else {
+ id = token;
+ if (scanner.hasNext()) {
+ substitution = trimToken(scanner.next());
+ } else {
+ substitution = "";
+ }
+ }
+
+ addKeyValuePair(id, substitution);
+ }
+ } finally {
+ scanner.close();
+ }
+ }
+
+ public String realizePage(ResourceToken templateResource) throws Exception {
+ return realizePage(registry.getResource(templateResource.getGuid())).toString();
+ }
+
+ private StringBuilder realizePage(InputStream template) throws Exception {
+ StringBuilder page = new StringBuilder(NumOfCharsInTypicalSmallPage);
+ Scanner scanner = new Scanner(template, "UTF-8");
+ try {
+ scanner.useDelimiter(xmlProcessingInstructionStartOrEnd);
+
+ boolean isProcessingInstruction = scanner.findInLine(xmlProcessingInstructionStart) != null;
+ while (scanner.hasNext()) {
+ processToken(page, scanner.next(), isProcessingInstruction);
+ isProcessingInstruction = !isProcessingInstruction;
+ }
+ } finally {
+ scanner.close();
+ }
+ return page;
+ }
+
+ private Long toUniversalId(String token) throws Exception {
+ Matcher pathMatcher = processingInstructionPath.matcher(token);
+ if (pathMatcher.find()) {
+ return Long.parseLong(pathMatcher.group(1), 16);
+ }
+ throw new OseeArgumentException("include path from token[%s] is in of the expected format", token);
+ }
+
+ private String getProcessingInstructionId(String token) throws Exception {
+ Matcher idMatcher = processingInstructionId.matcher(token);
+ if (idMatcher.find()) {
+ return idMatcher.group(1);
+ }
+ throw new OseeArgumentException("include id from token [%s] is in of the expected format", token);
+ }
+
+ private void processToken(StringBuilder page, String token, boolean isProcessingInstruction) throws Exception {
+ if (isProcessingInstruction) {
+ if (token.startsWith("include")) {
+ appendInclude(page, token);
+ } else if (token.startsWith("xml ")) {
+ page.append("<?");
+ page.append(token);
+ page.append("?>");
+ } else {
+ AppendableRule rule = substitutions.get(token);
+ Conditions.checkNotNull(rule, "rule", "no substitution was found for token %s", token);
+ rule.applyTo(page);
+ }
+ } else {
+ page.append(token);
+ }
+ }
+
+ private String trimToken(String token) {
+ Matcher newLineStartMatcher = newlineStart.matcher(token);
+ int beginIndex = newLineStartMatcher.find() ? newLineStartMatcher.end() : 0;
+
+ Matcher newLineEndMatcher = newlineEnd.matcher(token);
+ int endIndex = newLineEndMatcher.find() ? newLineEndMatcher.start() : token.length();
+
+ return beginIndex > endIndex ? "" : token.substring(beginIndex, endIndex);
+ }
+
+ private void appendInclude(Appendable page, String tokenStr) throws Exception {
+ Long universalId = toUniversalId(tokenStr);
+ ResourceToken token = registry.getResourceToken(universalId);
+ String name = token.getName();
+ boolean css = name.endsWith(".css");
+
+ page.append(css ? "/* " : "<!-- ");
+ page.append(name);
+ page.append(css ? " */\n" : " -->\n");
+ page.append(realizePage(token));
+ }
+
+ @Override
+ public String toString() {
+ return substitutions.toString();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/IdentifiableOptionsRule.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/IdentifiableOptionsRule.java
new file mode 100644
index 00000000000..e2bcac29e35
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/IdentifiableOptionsRule.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import org.eclipse.osee.framework.core.data.Identity;
+import org.eclipse.osee.framework.core.data.Named;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public final class IdentifiableOptionsRule<T extends Identity<String> & Named> extends OptionsRule<T> {
+ Iterable<T> options;
+
+ public IdentifiableOptionsRule(String ruleName, Iterable<T> options) {
+ this(ruleName, options, null);
+ }
+
+ public IdentifiableOptionsRule(String ruleName, Iterable<T> options, String listId) {
+ super(ruleName, listId);
+ this.options = options;
+ }
+
+ @Override
+ public Iterable<T> getOptions() {
+ return options;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OptionsRule.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OptionsRule.java
new file mode 100644
index 00000000000..8b9b37679df
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OptionsRule.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import org.eclipse.osee.framework.core.data.Identity;
+import org.eclipse.osee.framework.core.data.Named;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public abstract class OptionsRule<T extends Identity<String> & Named> extends AppendableRule {
+ private final String listId;
+
+ protected String getListId() {
+ return listId;
+ }
+
+ public OptionsRule(String ruleName) {
+ this(ruleName, null);
+ }
+
+ public OptionsRule(String ruleName, String listId) {
+ super(ruleName);
+ this.listId = listId;
+ }
+
+ @Override
+ public void applyTo(Appendable appendable) throws Exception {
+ if (listId == null) {
+ appendOptions(appendable);
+ } else {
+ appendable.append("\n<datalist id=\"");
+ appendable.append(listId);
+ appendable.append("\">\n");
+ appendOptions(appendable);
+ appendable.append("</datalist>\n");
+ }
+ }
+
+ /**
+ * This method is provided in the case where accessing the data returned by the implementation of getOptions()
+ * requires I/O or is otherwise computationally intensive, because getOptions() is not called until absolutely
+ * required. For simpler cases, the concrete class IdentifiableOptionsRule can be used where the options are just
+ * supplied in its constructor
+ *
+ * @return an Iterable that iterators over the list of options that each have a guid and a name
+ * @throws Exception
+ */
+ public abstract Iterable<T> getOptions() throws Exception;
+
+ private void appendOptions(Appendable appendable) throws Exception {
+ for (T option : getOptions()) {
+ appendable.append("<option value=\"");
+ appendable.append(option.getName());
+ appendable.append("\" guid=\"");
+ appendable.append(option.getGuid());
+ appendable.append("\">\n");
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OseeTemplateTokens.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OseeTemplateTokens.java
new file mode 100644
index 00000000000..71e9b722813
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/OseeTemplateTokens.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.model.ClassBasedResourceToken;
+import org.eclipse.osee.framework.core.model.ResourceToken;
+import org.eclipse.osee.framework.core.services.IResourceRegistry;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public final class OseeTemplateTokens {
+ private static final List<ResourceToken> tokens = new ArrayList<ResourceToken>();
+
+ // @formatter:off
+ public static final ResourceToken PageDeclarationHtml = createToken(0x4000000000000000L, "pageDeclaration.html");
+ public static final ResourceToken ExceptionHtml = createToken(0x4000000000000001L, "exception.html");
+ public static final ResourceToken OseeCoreJs = createToken(0x4000000000000002L, "oseeCore.js");
+ // @formatter:on
+
+ private static ResourceToken createToken(Long uuid, String name) {
+ ResourceToken token = new ClassBasedResourceToken(uuid, name, OseeTemplateTokens.class, "html/");
+ tokens.add(token);
+ return token;
+ }
+
+ public static void register(IResourceRegistry registry) {
+ registry.registerAll(tokens);
+ }
+
+ private OseeTemplateTokens() {
+ // Constants
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageFactory.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageFactory.java
new file mode 100644
index 00000000000..f0fb1cd17e5
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/PageFactory.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import org.eclipse.osee.framework.core.model.ResourceToken;
+import org.eclipse.osee.framework.core.services.IResourceRegistry;
+
+/**
+ * Factory containing convenience methods for both creating HtmlPageCreator objects and directly realizing a page in a
+ * single call
+ *
+ * @author Ryan D. Brooks
+ */
+public final class PageFactory {
+
+ public static HtmlPageCreator newHtmlPageCreator(IResourceRegistry registry, String... keyValues) {
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.addKeyValuePairs(keyValues);
+ return page;
+ }
+
+ public static HtmlPageCreator newHtmlPageCreator(IResourceRegistry registry, ResourceToken valuesResource, String... keyValues) throws Exception {
+ HtmlPageCreator page = newHtmlPageCreator(registry, keyValues);
+ page.readKeyValuePairs(valuesResource);
+ return page;
+ }
+
+ public static HtmlPageCreator newHtmlPageCreator(IResourceRegistry registry, Iterable<String> keyValues) {
+ HtmlPageCreator page = new HtmlPageCreator(registry);
+ page.addKeyValuePairs(keyValues);
+ return page;
+ }
+
+ public static HtmlPageCreator newHtmlPageCreator(IResourceRegistry registry, ResourceToken valuesResource, Iterable<String> keyValues) throws Exception {
+ HtmlPageCreator page = newHtmlPageCreator(registry, keyValues);
+ page.readKeyValuePairs(valuesResource);
+ return page;
+ }
+
+ public static String realizePage(IResourceRegistry registry, ResourceToken templateResource, String... keyValues) throws Exception {
+ HtmlPageCreator page = newHtmlPageCreator(registry, keyValues);
+ return page.realizePage(templateResource);
+ }
+
+ public static String realizePage(IResourceRegistry registry, ResourceToken templateResource, ResourceToken valuesResource, String... keyValues) throws Exception {
+ HtmlPageCreator page = newHtmlPageCreator(registry, valuesResource, keyValues);
+ return page.realizePage(templateResource);
+ }
+
+ public static String realizePage(IResourceRegistry registry, ResourceToken templateResource, Iterable<String> keyValues) throws Exception {
+ HtmlPageCreator page = newHtmlPageCreator(registry, keyValues);
+ return page.realizePage(templateResource);
+ }
+
+ public static String realizePage(IResourceRegistry registry, ResourceToken templateResource, ResourceToken valuesResource, Iterable<String> keyValues) throws Exception {
+ HtmlPageCreator page = newHtmlPageCreator(registry, valuesResource, keyValues);
+ return page.realizePage(templateResource);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/StringRule.java b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/StringRule.java
new file mode 100644
index 00000000000..c15aeee5961
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/StringRule.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.template.engine;
+
+import java.io.IOException;
+
+/**
+ * @author Ryan D. Brooks
+ */
+public final class StringRule extends AppendableRule {
+ private final CharSequence value;
+
+ public StringRule(String ruleName, CharSequence value) {
+ super(ruleName);
+ this.value = value;
+ }
+
+ @Override
+ public void applyTo(Appendable appendable) throws IOException {
+ appendable.append(value);
+ }
+
+ @Override
+ public String toString() {
+ return value.toString();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/exception.html b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/exception.html
new file mode 100644
index 00000000000..240f1001fa3
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/exception.html
@@ -0,0 +1,11 @@
+<?include path="4000000000000000 pageDeclaration.html"?>
+<head>
+ <title><?title?></title>
+</head>
+<body>
+ <h2><?title?></h2>
+ <pre>
+ <?stacktrace?>
+ </pre>
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/oseeCore.js b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/oseeCore.js
new file mode 100644
index 00000000000..a8065de2df6
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/oseeCore.js
@@ -0,0 +1,57 @@
+ function post(url, stateChangeHandler) {
+ httpRequest("POST", url, stateChangeHandler);
+ }
+
+ function post_with_parms(url, params, method) {
+ method = method || "post"; // Set method to post by default if not specified.
+
+ // The rest of this code assumes you are not using a library.
+ // It can be made less wordy if you use one.
+ var form = document.createElement("form");
+ form.setAttribute("method", method);
+ form.setAttribute("action", url);
+
+ for(var key in params) {
+ if(params.hasOwnProperty(key)) {
+ var hiddenField = document.createElement("input");
+ hiddenField.setAttribute("type", "hidden");
+ hiddenField.setAttribute("name", key);
+ hiddenField.setAttribute("value", params[key]);
+ console.log("key [" + key + "] value [" + params[key] + "]");
+
+ form.appendChild(hiddenField);
+ }
+ }
+
+ document.body.appendChild(form);
+ form.submit();
+ }
+
+ function get(url, stateChangeHandler) {
+ httpRequest("GET", url, stateChangeHandler);
+ }
+
+ function httpRequest(httpVerb, url, stateChangeHandler) {
+ var httpRequest = new XMLHttpRequest()
+ httpRequest.prevDataLength = 0;
+ httpRequest.onreadystatechange = stateChangeHandler;
+ httpRequest.open(httpVerb, url);
+ httpRequest.send();
+ }
+
+ function removeChildren(node) {
+ while (node.hasChildNodes()) {
+ node.removeChild(node.lastChild);
+ }
+ }
+
+ function getChildByAttributeValue(element, attribute, value) {
+ var children = element.children;
+ for(var i = 0; i < children.length; i++) {
+ var child = children[i];
+ if(child.getAttribute(attribute) == value) {
+ return child;
+ }
+ }
+ return null;
+ } \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/pageDeclaration.html b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/pageDeclaration.html
new file mode 100644
index 00000000000..f57cb47d115
--- /dev/null
+++ b/plugins/org.eclipse.osee.template.engine/src/org/eclipse/osee/template/engine/html/pageDeclaration.html
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.x.core.parent/pom.xml b/plugins/org.eclipse.osee.x.core.parent/pom.xml
index 0d9cf1eb2d8..393385af0cb 100644
--- a/plugins/org.eclipse.osee.x.core.parent/pom.xml
+++ b/plugins/org.eclipse.osee.x.core.parent/pom.xml
@@ -46,6 +46,9 @@
<module>../../plugins/org.eclipse.osee.mail</module>
<module>../../plugins/org.eclipse.osee.mail.test</module>
+ <module>../../plugins/org.eclipse.osee.template.engine</module>
+ <module>../../plugins/org.eclipse.osee.template.engine.test</module>
+
<module>../../plugins/org.eclipse.osee.vaadin</module>
<module>../../plugins/org.eclipse.osee.vaadin.widgets</module>
<module>../../plugins/org.eclipse.osee.vaadin.themes</module>

Back to the top