All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.tsl2.nano.specification.PFlow Maven / Gradle / Ivy

Go to download

TSL2 Framework Specification (Pools of descripted and runnable Actions and Rules, Generic Tree)

The newest version!
package de.tsl2.nano.specification;

import java.io.File;
import java.io.Serializable;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import org.simpleframework.xml.Default;
import org.simpleframework.xml.DefaultType;

import de.tsl2.nano.core.ENV;
import de.tsl2.nano.core.util.FileUtil;
import de.tsl2.nano.execution.IPRunnable;
import de.tsl2.nano.util.Flow;
import de.tsl2.nano.util.Flow.ITask;

/**
 * Extends the basis {@link Flow} to be usable in the {@link Pool}.
 * 
 * @author ts
 */
@Default(value = DefaultType.FIELD, required = false)
public class PFlow extends Flow implements IPRunnable, Map> , IPrefixed {

	public PFlow() {
	}
	
	public PFlow(String name, String expression, LinkedHashMap parameter) {
		fromString(this, name, expression, DEFAULT_TASK_TYPE);
		persist(FileUtil.userDirFile(ENV.get(Pool.class).getDirectory(this.getClass()) + name + FILE_EXT));
	}
	
	public static PFlow load(File gravitoFile) {
		return load(gravitoFile, Task.class);
	}
	public static PFlow load(File gravitoFile, Class taskType) {
		return Flow.load(new PFlow(), gravitoFile, taskType);
	}

	@Override
	public Deque run(Map context, Object... extArgs) {
		return super.run(context);
	}

	@Override
	public Map getParameter() {
		//throw new UnsupportedOperationException();
		return new HashMap<>();
	}

	@Override
	public Map checkedArguments(Map args, boolean strict) {
		//throw new UnsupportedOperationException();
		return args;
	}

	@Override
	public String prefix() {
		return ">";
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy