Commit 3ca482cf authored by Jay Jay Billings's avatar Jay Jay Billings
Browse files

Fixing project structure, classpath, and build issues.


Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parent e056b369
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/classes" path="src"> <classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" path="test"/> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<classpathentry kind="src" path="main"/> <attributes>
<classpathentry kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/> <attribute name="maven.pomderived" value="true"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> </attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes> <attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar" sourcepath="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/inject/guice/4.1.0/guice-4.1.0.jar" sourcepath="M2_REPO/com/google/inject/guice/4.1.0/guice-4.1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/19.0/guava-19.0.jar" sourcepath="M2_REPO/com/google/guava/guava/19.0/guava-19.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2.jar" sourcepath="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2.jar" sourcepath="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/junit/jupiter/junit-jupiter-api/5.6.0/junit-jupiter-api-5.6.0.jar" sourcepath="M2_REPO/org/junit/jupiter/junit-jupiter-api/5.6.0/junit-jupiter-api-5.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar" sourcepath="M2_REPO/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar" sourcepath="M2_REPO/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/junit/platform/junit-platform-commons/1.6.0/junit-platform-commons-1.6.0.jar" sourcepath="M2_REPO/org/junit/platform/junit-platform-commons/1.6.0/junit-platform-commons-1.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/junit/jupiter/junit-jupiter-engine/5.6.0/junit-jupiter-engine-5.6.0.jar" sourcepath="M2_REPO/org/junit/jupiter/junit-jupiter-engine/5.6.0/junit-jupiter-engine-5.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/junit/platform/junit-platform-engine/1.6.0/junit-platform-engine-1.6.0.jar" sourcepath="M2_REPO/org/junit/platform/junit-platform-engine/1.6.0/junit-platform-engine-1.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/junit/platform/junit-platform-launcher/1.6.0/junit-platform-launcher-1.6.0.jar" sourcepath="M2_REPO/org/junit/platform/junit-platform-launcher/1.6.0/junit-platform-launcher-1.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/junit/platform/junit-platform-runner/1.6.0/junit-platform-runner-1.6.0.jar" sourcepath="M2_REPO/org/junit/platform/junit-platform-runner/1.6.0/junit-platform-runner-1.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/4.13/junit-4.13.jar" sourcepath="M2_REPO/junit/junit/4.13/junit-4.13-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/junit/platform/junit-platform-suite-api/1.6.0/junit-platform-suite-api-1.6.0.jar" sourcepath="M2_REPO/org/junit/platform/junit-platform-suite-api/1.6.0/junit-platform-suite-api-1.6.0-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
......
eclipse.preferences.version=1
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
encoding/src=UTF-8
...@@ -2,21 +2,25 @@ ...@@ -2,21 +2,25 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.ice.renderer</groupId> <groupId>org.eclipse.ice</groupId>
<artifactId>org.eclipse.ice.renderer</artifactId> <artifactId>org.eclipse.ice.renderer</artifactId>
<version>3.0.0-SNAPSHOT</version> <version>3.0.0-SNAPSHOT</version>
<name>Renderer Prototype</name> <name>Renderer Prototype</name>
<description>This is a prototype rendering utility for Eclipse ICE 3.0 and other projects.</description> <description>This is a prototype rendering utility for Eclipse ICE 3.0 and other projects.</description>
<properties> <properties>
<junit.jupiter.version>5.6.0</junit.jupiter.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.platform.version>1.6.0</junit.platform.version> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
<junit.jupiter.version>5.6.2</junit.jupiter.version>
</properties> </properties>
<build> <build>
<sourceDirectory>src</sourceDirectory> <sourceDirectory>src</sourceDirectory>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.8.1</version>
<configuration> <configuration>
<release>11</release> <release>11</release>
</configuration> </configuration>
...@@ -24,21 +28,6 @@ ...@@ -24,21 +28,6 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version> <version>2.22.2</version>
<dependencies>
<!-- integrates JUnit5 with surefire -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<!-- ensures that a JUnit5-aware test engine is available on the classpath
when running Surefire -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
</dependencies>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
...@@ -67,25 +56,13 @@ ...@@ -67,25 +56,13 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version> <version>5.3.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version> <version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -98,5 +75,10 @@ ...@@ -98,5 +75,10 @@
<artifactId>slf4j-simple</artifactId> <artifactId>slf4j-simple</artifactId>
<version>1.7.25</version> <version>1.7.25</version>
</dependency> </dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.2</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -23,9 +23,6 @@ import com.fasterxml.jackson.databind.JsonNode; ...@@ -23,9 +23,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
/** /**
*
* TODO: validation, Validator exclusion from JSON,
*
* This is a basic data container that conveniently weds the data with * This is a basic data container that conveniently weds the data with
* co-located metadata such as names, descriptions, ids, and other values. * co-located metadata such as names, descriptions, ids, and other values.
* *
...@@ -55,7 +52,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -55,7 +52,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
* Clients may retrieve or add their own properties/keywords using the * Clients may retrieve or add their own properties/keywords using the
* 'setProperty' operation. Accessors are available for the default properties * 'setProperty' operation. Accessors are available for the default properties
* as well, as convenience methods. Clients may also designate whether or not * as well, as convenience methods. Clients may also designate whether or not
* data elements are required and secret. * data elements are required and secret. Please note that the convenience
* methods for default properties throw exceptions to enforce non-null values.
* *
* Clients are expected to set their own validators and validators are not * Clients are expected to set their own validators and validators are not
* initialized by default. * initialized by default.
...@@ -516,7 +514,8 @@ public class DataElement<T extends Serializable> implements Serializable { ...@@ -516,7 +514,8 @@ public class DataElement<T extends Serializable> implements Serializable {
// here. It matches the version in the old ICE 2.x product line, but I // here. It matches the version in the old ICE 2.x product line, but I
// incremented the initial hash seed to 31 from 11 since this is for version 3. // incremented the initial hash seed to 31 from 11 since this is for version 3.
int hash = 31; int hash = 31;
// The 31 below is just coincidental and part of the original source where I read // The 31 below is just coincidental and part of the original source where I
// read
// about hash codes. // about hash codes.
hash = 31 * hash + privateId.hashCode(); hash = 31 * hash + privateId.hashCode();
hash = 31 * hash + dataProps.hashCode(); hash = 31 * hash + dataProps.hashCode();
......
...@@ -16,6 +16,22 @@ import java.util.function.BiConsumer; ...@@ -16,6 +16,22 @@ import java.util.function.BiConsumer;
import javax.inject.Inject; import javax.inject.Inject;
/** /**
* This class is a basic controller that connects data and UI classes in a
* simple, pre-determined way. Data can be provided through the DataElement<V>
* class and functionality for working with UI elements of type T can be
* provided as call back functions (bi-consumers).
*
* This class relies on dependency injection to locate and instantiate
* dependencies of types T and V. Both can be overwritten using the associated
* setters. However, call back functions must be injected with the
* setDrawMethod() function.
*
* No special lifecycle management is provided by this class. Instead, the
* expectation is that the viewer T can handle updates directly.
*
* Also how does that class relate to this
* one and the VaadinRenderer?
*
* @author Jay Jay Billings * @author Jay Jay Billings
* *
*/ */
...@@ -23,10 +39,10 @@ public class Renderer<T, V extends Serializable> { ...@@ -23,10 +39,10 @@ public class Renderer<T, V extends Serializable> {
@Inject @Inject
private T viewer; private T viewer;
@Inject @Inject
private DataElement<V> dataElement; private DataElement<V> dataElement;
private BiConsumer<T, DataElement<V>> drawMethod; private BiConsumer<T, DataElement<V>> drawMethod;
public void setViewer(T view) { public void setViewer(T view) {
...@@ -37,11 +53,11 @@ public class Renderer<T, V extends Serializable> { ...@@ -37,11 +53,11 @@ public class Renderer<T, V extends Serializable> {
dataElement = data; dataElement = data;
} }
public void setDrawMethod(BiConsumer<T,DataElement<V>> drawFunction) { public void setDrawMethod(BiConsumer<T, DataElement<V>> drawFunction) {
drawMethod = drawFunction; drawMethod = drawFunction;
} }
public void render() { public void render() {
drawMethod.accept(viewer,dataElement); drawMethod.accept(viewer, dataElement);
} }
} }
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
*******************************************************************************/ *******************************************************************************/
package gov.ornl.rse.renderer.client.test; package gov.ornl.rse.renderer.client.test;
import java.io.Serializable;
import org.eclipse.ice.renderer.DataElement; import org.eclipse.ice.renderer.DataElement;
public interface IRendererClient<T> { public interface IRendererClient<T extends Serializable> {
/** /**
* This operation sets the data that should be rendered. * This operation sets the data that should be rendered.
...@@ -21,7 +22,7 @@ public interface IRendererClient<T> { ...@@ -21,7 +22,7 @@ public interface IRendererClient<T> {
* @param otherData The data element that should be rendered. This function * @param otherData The data element that should be rendered. This function
* overwrites the existing data on the client and server. * overwrites the existing data on the client and server.
*/ */
void setData(DataElement<T> otherData); public void setData(DataElement<T> otherData);
/** /**
* This function returns the present version of the DataElement * This function returns the present version of the DataElement
...@@ -30,6 +31,6 @@ public interface IRendererClient<T> { ...@@ -30,6 +31,6 @@ public interface IRendererClient<T> {
* there is a chance that the most recent updates from the client have * there is a chance that the most recent updates from the client have
* not been committed due to latency. * not been committed due to latency.
*/ */
DataElement<T> getData(); public DataElement<T> getData();
} }
\ No newline at end of file
...@@ -11,7 +11,12 @@ ...@@ -11,7 +11,12 @@
*******************************************************************************/ *******************************************************************************/
package gov.ornl.rse.renderer.client.test; package gov.ornl.rse.renderer.client.test;
import java.util.function.BiConsumer;
import javax.inject.Inject;
import org.eclipse.ice.renderer.DataElement; import org.eclipse.ice.renderer.DataElement;
import org.eclipse.ice.renderer.Renderer;
import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route; import com.vaadin.flow.router.Route;
...@@ -19,18 +24,30 @@ import com.vaadin.flow.router.Route; ...@@ -19,18 +24,30 @@ import com.vaadin.flow.router.Route;
@Route @Route
public class MainView extends VerticalLayout { public class MainView extends VerticalLayout {
@Inject
Renderer<VaadinRendererClient<String>,String> renderer;
public MainView() { public MainView() {
// Nothing to do here - just sample setup
DataElement<String> nameElem = new DataElement<String>(); DataElement<String> nameElem = new DataElement<String>();
nameElem.setName("Ross' name"); try {
nameElem.setDescription("Ross' name described by a data element"); nameElem.setName("Ross' name");
nameElem.setData("Ross Whitfield"); nameElem.setDescription("Ross' name described by a data element");
nameElem.setData("Ross Whitfield");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
VaadinRendererClient<String> client = new VaadinRendererClient<String>(); BiConsumer<VaadinRendererClient<String>, DataElement<String>> drawViewFunc = (v, w) -> {
client.setData(nameElem); v.setData(w);
add(v);
};
renderer.setDataElement(nameElem);
renderer.setDrawMethod(drawViewFunc);
add(client); renderer.render();
} }
} }
\ No newline at end of file
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
*******************************************************************************/ *******************************************************************************/
package gov.ornl.rse.renderer.client.test; package gov.ornl.rse.renderer.client.test;
import java.io.Serializable;
import org.eclipse.ice.renderer.DataElement; import org.eclipse.ice.renderer.DataElement;
import com.vaadin.flow.component.Component; import com.vaadin.flow.component.Component;
...@@ -25,14 +27,14 @@ import elemental.json.Json; ...@@ -25,14 +27,14 @@ import elemental.json.Json;
import elemental.json.JsonObject; import elemental.json.JsonObject;
/** /**
* This is a Vbase class for renderer clients tailored to Vaadin. It provides * This is a base class for renderer clients tailored to Vaadin. It provides
* the basic accessors for the data member. * the basic accessors for the data member.
* *
* @author Jay Jay Billings * @author Jay Jay Billings
*/ */
@Tag("renderer-template") @Tag("renderer-template")
@JsModule("./src/renderer.ts") @JsModule("./src/renderer.ts")
public class VaadinRendererClient<T> extends Component implements IRendererClient<T> { public class VaadinRendererClient<T extends Serializable> extends Component implements IRendererClient<T> {
/** /**
* version UID * version UID
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment