Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Started implementing Task tests, Task, and associated classes.
Browse files Browse the repository at this point in the history
Also put a note in PersonSpec about documentation and enumerations.

Signed-off-by: Jay Jay Billings <billingsjj@ornl.gov>
  • Loading branch information
Jay Jay Billings committed Aug 3, 2020
1 parent 02d4b14 commit cb7ee4f
Show file tree
Hide file tree
Showing 11 changed files with 463 additions and 23 deletions.
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2020- UT-Battelle, LLC.
* 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:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*******************************************************************************/
package org.eclipse.ice.renderer;

/**
*
* @author Jay Jay Billings
*
*/
public enum PersonEnum {

TALL,

SHORT
}
Expand Up @@ -8,25 +8,41 @@
@Persisted(collection = "people")
public class PersonSpec {
/**
* The person's age.
* The person's age.
*
* This doc will be copied to the implementation.
*/
@DataField.Default("42")
@DataField private int age;

/**
* The person's first name.
*
* This doc will be copied to the implementation.
*/
@DataField.Default(value = "Bob", isString = true)
@DataField private String firstName;

/**
* The person's last name.
*
* This doc will be copied to the implementation.
*/
@DataField.Default(value = "Builder", isString = true)
@DataField private String lastName;

/**
* An example constant value. This one probably doesn't actually make sense.
*
* This doc will be copied to the implementation.
*/
@DataField public static final String COLLECTION = "people";

/**
* Basic enumeration example. Note that the fully qualified value name needs
* to be added and the first time the enumeration is used the build needs
* to be run.
*/
@DataField.Default(value="org.eclipse.ice.renderer.PersonEnum.TALL");
@DataField public PersonEnum height;
}
14 changes: 5 additions & 9 deletions org.eclipse.ice.tasks/.classpath
Expand Up @@ -13,19 +13,14 @@
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<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>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
Expand All @@ -36,20 +31,21 @@
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" 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/JavaSE-11"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
19 changes: 19 additions & 0 deletions org.eclipse.ice.tasks/pom.xml
Expand Up @@ -19,6 +19,20 @@

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<annotationProcessorPaths>
<path>
<groupId>org.eclipse.ice</groupId>
<artifactId>org.eclipse.ice.dev.annotations</artifactId>
<version>3.0.0-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
Expand Down Expand Up @@ -49,6 +63,11 @@
<version>3.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.ice</groupId>
<artifactId>org.eclipse.ice.dev.annotations</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
Expand Up @@ -43,19 +43,22 @@
*
* Tasks store state data externally and do not control their own storage. Thus
* the must be configured when built to store state to the proper location. If
* no state controller is provided, tasks will attempt to store state locally
* by default. State storage is separate from data storage, which is tracked by
* individual data models.
* no state controller is provided, tasks will attempt to store state in
* memory. State data storage is separate from client data storage, which is
* tracked by individual data models. State data refers specifically to data
* that tracks the status of the Task, not data that is used as input or
* gathered as output from the action which is generally referred to as action
* or client data.
*
* Tasks can be observed by listeners (see {@link ITaskListener}). Events are
* dispatched asynchronously and listeners are not consulted for command and
* control.
*
* Data is injected into tasks using a setter instead of including it directly
* in the run() operation. This supports option-operand separation and a
* specific case of its use is in the execution of multiple tasks
* simultaneously without the caller knowing anything about the data
* configuration.
* Client data is injected into tasks using a setter instead of including it
* directly in the run() operation. This supports option-operand separation and
* a specific case of its use is in the execution of multiple tasks
* simultaneously without the caller knowing anything about the client data
* configuration and types.
*
* Thoughts on provenance tracking? ICE 2.0 used a log file.
*
Expand All @@ -71,16 +74,18 @@
public interface ITask<T extends IDataElement<T>> {

/**
* This operation sets the data on which the task should execute.
* This operation sets the action or client data on which the task should
* execute.
* @param taskData The data for the task
*/
public void setData(T taskData);
public void setActionData(T actionData);

/**
* This operation gets the data on which the task is working.
* @return the data
* This operation gets the action or client data on which the task is
* working.
* @return the data used with the action
*/
public T getData();
public T getActionData();

/**
* This function sets the Action that the task executes.
Expand Down Expand Up @@ -115,5 +120,13 @@ public interface ITask<T extends IDataElement<T>> {
* @return the state
*/
public TaskState getState();

/**
* This operation returns the full set of state data for the Task. This
* includes all data available for a standard identifiable data element.
* @return the full set of state data for the task.
*/
public TaskStateData getTaskStateData();


}
@@ -0,0 +1,83 @@
/******************************************************************************
* Copyright (c) 2020- UT-Battelle, LLC.
* 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:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*****************************************************************************/
package org.eclipse.ice.tasks;

import org.eclipse.ice.data.IDataElement;

/**
* The basic implementation of ITask.
*
* @author Jay Jay Billings
*
*/
public class Task<T extends IDataElement<T>> implements ITask<T> {

/**
* Constructor
*
* @param stateData the task state data must be provided on initialization
* because tasks do not manage any data. See
* {@link org.eclipse.ice.tasks.ITask}.
*/
public Task(TaskStateData stateData) {

}

@Override
public void setActionData(T actionData) {
// TODO Auto-generated method stub

}

@Override
public T getActionData() {
// TODO Auto-generated method stub
return null;
}

@Override
public void setAction(Action<T> taskAction) {
// TODO Auto-generated method stub

}

@Override
public void addHook(Hook<T> hook) {
// TODO Auto-generated method stub

}

@Override
public TaskState execute() {
// TODO Auto-generated method stub
return null;
}

@Override
public TaskState cancel() {
// TODO Auto-generated method stub
return null;
}

@Override
public TaskState getState() {
// TODO Auto-generated method stub
return null;
}

@Override
public TaskStateData getTaskStateData() {
// TODO Auto-generated method stub
return null;
}

}
@@ -0,0 +1,40 @@
/******************************************************************************
* Copyright (c) 2020- UT-Battelle, LLC.
* 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:
* Initial API and implementation and/or initial documentation -
* Jay Jay Billings
*****************************************************************************/
package org.eclipse.ice.tasks;

import org.eclipse.ice.dev.annotations.DataElement;
import org.eclipse.ice.dev.annotations.DataField;

/**
* The task state data spec that defines the state data for tasks. Note that
* the actual TaskStateData class is autogenerated from this specification.
*
* Further note that this spec does not define any type of persistence for the
* task state data. That is consistent with requirement from ITask that tasks
* store state in memory by default if no otherwise configured state data is
* provided. This is properly handled by creating a Data Model with an
* @Persisted annotation on its TaskStateData.
*
* @author Jay Jay Billings
*
*/
@DataElement(name="TaskStateData")
public class TaskStateDataSpec {

/**
* The state of the task
*/
@DataField.Default(value = "org.eclipse.ice.tasks.TaskState.INITIALIZED")
@DataField
private TaskState taskState;

}

0 comments on commit cb7ee4f

Please sign in to comment.