--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
include sdk.mk
.PHONY: clean all osgi jni
-all: osgi jni
+all: osgi-all
$(MAKE) -f Makefile-rcp.mk all
install: osgi-install
uninstall: osgi-uninstall
-jni:
- $(MAKE) -C jni
+#jni:
+# $(MAKE) -C jni
A2_CATEGORY = org.argeo.slc
BUNDLES = \
-org.argeo.slc.api \
+org.argeo.api.slc \
org.argeo.slc.runtime \
org.argeo.slc.cms \
+org.argeo.rt.cms \
lib/linux/org.argeo.slc.systemd \
swt/org.argeo.cms.e4 \
swt/rap/org.argeo.cms.e4.rap \
org.argeo.tp \
org.argeo.tp.httpd \
org.argeo.tp.sys \
-osgi/api/org.argeo.tp.osgi \
+osgi/equinox/org.argeo.tp.osgi \
osgi/equinox/org.argeo.tp.eclipse \
swt/rap/org.argeo.tp.swt \
swt/rap/org.argeo.tp.swt.workbench \
swt/rap/org.argeo.cms \
$(A2_CATEGORY)
-clean:
- rm -rf $(BUILD_BASE)
- $(MAKE) -C jni clean
+NATIVE_PACKAGES= \
+org_argeo_api_uuid_libuuid
+
+clean: osgi-clean
+# rm -rf $(BUILD_BASE)
+# $(MAKE) -C jni clean
$(MAKE) -f Makefile-rcp.mk clean
native-deps-debian:
DEP_CATEGORIES = \
org.argeo.tp \
-osgi/api/org.argeo.tp.osgi \
+osgi/equinox/org.argeo.tp.osgi \
osgi/equinox/org.argeo.tp.eclipse \
swt/rcp/org.argeo.tp.swt \
lib/linux/x86_64/swt/rcp/org.argeo.tp.swt \
+++ /dev/null
-include ../sdk.mk
-
-JNIDIRS = org_argeo_api_uuid_libuuid
-
-.PHONY: clean all
-
-all:
- $(foreach dir, $(JNIDIRS), $(MAKE) -C $(dir) all;)
-
-clean:
- $(foreach dir, $(JNIDIRS), $(MAKE) -C $(dir) clean;)
-
-
-
+++ /dev/null
-include $(SDK_SRC_BASE)/sdk/argeo-build/osgi.mk
-
-A2_NATIVE_CATEGORY=$(A2_OUTPUT)/lib/linux/$(shell uname -m)/$(A2_CATEGORY)
-TARGET_EXEC := libJava_$(NATIVE_PACKAGE).so
-
-LDFLAGS = -shared -fPIC -Wl,-soname,$(TARGET_EXEC).$(MAJOR).$(MINOR) $(ADDITIONAL_LIBS)
-CFLAGS = -O3 -fPIC
-
-SRC_DIRS := .
-
-#
-# Generic Argeo
-#
-BUILD_DIR := $(SDK_BUILD_BASE)/jni/$(NATIVE_PACKAGE)
-
-# Every folder in ./src will need to be passed to GCC so that it can find header files
-INC_DIRS := $(shell find $(SRC_DIRS) -type d) $(JAVA_HOME)/include $(JAVA_HOME)/include/linux $(ADDITIONAL_INCLUDES)
-
-
-.PHONY: clean all ide
-all: $(A2_NATIVE_CATEGORY)/$(TARGET_EXEC)
-
-clean:
- $(RM) $(A2_NATIVE_CATEGORY)/$(TARGET_EXEC)
-
-# Find all the C and C++ files we want to compile
-# Note the single quotes around the * expressions. Make will incorrectly expand these otherwise.
-SRCS := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c' -or -name '*.s')
-
-# String substitution for every C/C++ file.
-# As an example, hello.cpp turns into ./build/hello.cpp.o
-OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
-
-# String substitution (suffix version without %).
-# As an example, ./build/hello.cpp.o turns into ./build/hello.cpp.d
-DEPS := $(OBJS:.o=.d)
-
-# Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
-INC_FLAGS := $(addprefix -I,$(INC_DIRS))
-
-# The -MMD and -MP flags together generate Makefiles for us!
-# These files will have .d instead of .o as the output.
-CPPFLAGS := $(INC_FLAGS) -MMD -MP
-
-# The final build step.
-$(A2_NATIVE_CATEGORY)/$(TARGET_EXEC): $(OBJS)
- mkdir -p $(A2_NATIVE_CATEGORY)
- $(CC) $(OBJS) -o $@ $(LDFLAGS)
-
-# Build step for C source
-$(BUILD_DIR)/%.c.o: %.c
- mkdir -p $(dir $@)
- $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
-
-# Build step for C++ source
-$(BUILD_DIR)/%.cpp.o: %.cpp
- mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
-
-# Include the .d makefiles. The - at the front suppresses the errors of missing
-# Makefiles. Initially, all the .d files will be missing, and we don't want those
-# errors to show up.
--include $(DEPS)
-
-# MAKEFILE_DIR := $(dir $(firstword $(MAKEFILE_LIST)))
NATIVE_PACKAGE := org_argeo_api_uuid_libuuid
-ADDITIONAL_INCLUDES = /usr/include/uuid
-ADDITIONAL_LIBS = -luuid
+DEP_NATIVE=uuid
include ../../sdk.mk
-include ../jni.mk
-
+include $(SDK_SRC_BASE)/sdk/argeo-build/jni.mk
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.argeo.api.slc</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+/MANIFEST.MF
--- /dev/null
+bin.includes = META-INF/,.\r
+source..=src/\r
--- /dev/null
+package org.argeo.api.slc;
+
+import java.io.Serializable;
+
+/** @deprecated use {@link DefaultNameVersion} instead. */
+@Deprecated
+public class BasicNameVersion extends DefaultNameVersion implements
+ Serializable {
+ private static final long serialVersionUID = -5127304279136195127L;
+
+ public BasicNameVersion() {
+ }
+
+ /** Interprets string in OSGi-like format my.module.name;version=0.0.0 */
+ public BasicNameVersion(String nameVersion) {
+ int index = nameVersion.indexOf(";version=");
+ if (index < 0) {
+ setName(nameVersion);
+ setVersion(null);
+ } else {
+ setName(nameVersion.substring(0, index));
+ setVersion(nameVersion.substring(index + ";version=".length()));
+ }
+ }
+
+ public BasicNameVersion(String name, String version) {
+ super(name, version);
+ }
+
+ public BasicNameVersion(NameVersion nameVersion) {
+ super(nameVersion);
+ }
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/**
+ * Adds a dimension to {@link NameVersion} by adding an arbitrary category (e.g.
+ * Maven groupId, yum repository ID, etc.)
+ */
+public interface CategoryNameVersion extends NameVersion {
+ /** The category of the component. */
+ String getCategory();
+
+ static CategoryNameVersion parseCategoryNameVersion(String str) {
+ if (str == null || "".equals(str.trim()))
+ throw new IllegalArgumentException("At least one character required.");
+ String[] arr = str.trim().split(":");
+ if (arr.length > 3)
+ throw new IllegalArgumentException(str + " does not respect the [category]:[name]:[version] pattern");
+ DefaultCategoryNameVersion res = new DefaultCategoryNameVersion();
+ res.setCategory(arr[0]);
+ if (arr.length > 1)
+ res.setName(arr[1]);
+ if (arr.length > 2)
+ res.setVersion(arr[2]);
+ return res;
+ }
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/** Binary check on an arbitrary object. */
+public interface Condition<T> {
+ /**
+ * Checks the condition.
+ *
+ * @return true, if the condition is verified, false if not.
+ */
+ public Boolean check(T obj);
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/** Canonical implementation of {@link CategoryNameVersion} */
+public class DefaultCategoryNameVersion extends DefaultNameVersion implements CategoryNameVersion {
+ private String category;
+
+ public DefaultCategoryNameVersion() {
+ }
+
+ public DefaultCategoryNameVersion(String category, String name, String version) {
+ super(name, version);
+ this.category = category;
+ }
+
+ public DefaultCategoryNameVersion(String category, NameVersion nameVersion) {
+ super(nameVersion);
+ this.category = category;
+ }
+
+ @Override
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ @Override
+ public String toString() {
+ return category + ":" + super.toString();
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc;
+
+
+/** Canonical implementation of {@link NameVersion} */
+public class DefaultNameVersion implements NameVersion,
+ Comparable<NameVersion> {
+ private String name;
+ private String version;
+
+ public DefaultNameVersion() {
+ }
+
+ /** Interprets string in OSGi-like format my.module.name;version=0.0.0 */
+ public DefaultNameVersion(String nameVersion) {
+ int index = nameVersion.indexOf(";version=");
+ if (index < 0) {
+ setName(nameVersion);
+ setVersion(null);
+ } else {
+ setName(nameVersion.substring(0, index));
+ setVersion(nameVersion.substring(index + ";version=".length()));
+ }
+ }
+
+ public DefaultNameVersion(String name, String version) {
+ this.name = name;
+ this.version = version;
+ }
+
+ public DefaultNameVersion(NameVersion nameVersion) {
+ this.name = nameVersion.getName();
+ this.version = nameVersion.getVersion();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof NameVersion) {
+ NameVersion nameVersion = (NameVersion) obj;
+ return name.equals(nameVersion.getName())
+ && version.equals(nameVersion.getVersion());
+ } else
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return name + ":" + version;
+ }
+
+ public int compareTo(NameVersion o) {
+ if (o.getName().equals(name))
+ return version.compareTo(o.getVersion());
+ else
+ return name.compareTo(o.getName());
+ }
+}
--- /dev/null
+package org.argeo.api.slc;
+
+public enum ManifestConstants {
+ // OSGi
+ BUNDLE_SYMBOLICNAME("Bundle-SymbolicName"), //
+ BUNDLE_VERSION("Bundle-Version"), //
+ BUNDLE_LICENSE("Bundle-License"), //
+ EXPORT_PACKAGE("Export-Package"), //
+ IMPORT_PACKAGE("Import-Package"), //
+ // JAVA
+ AUTOMATIC_MODULE_NAME("Automatic-Module-Name"), //
+ // SLC
+ SLC_CATEGORY("SLC-Category"), //
+ SLC_ORIGIN_M2("SLC-Origin-M2"), //
+ SLC_ORIGIN_M2_MERGE("SLC-Origin-M2-Merge"), //
+ SLC_ORIGIN_M2_REPO("SLC-Origin-M2-Repo"), //
+ SLC_ORIGIN_MANIFEST_NOT_MODIFIED("SLC-Origin-ManifestNotModified"), //
+ SLC_ORIGIN_URI("SLC-Origin-URI"),//
+ ;
+
+ final String value;
+
+ private ManifestConstants(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc;
+
+import java.util.Iterator;
+
+/** A set of {@link NameVersion}. */
+public interface ModuleSet {
+ Iterator<? extends NameVersion> nameVersions();
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/**
+ * Abstraction of a name / version pair, typically used as coordinates for a
+ * software module either deployed or packaged as an archive.
+ */
+public interface NameVersion {
+ /** The name of the component. */
+ String getName();
+
+ /** The version of the component. */
+ String getVersion();
+
+ /**
+ * The forward compatible branch of this version, by default it is
+ * [major].[minor].
+ */
+ default String getBranch() {
+ String[] parts = getVersion().split("\\.");
+ if (parts.length < 2)
+ throw new IllegalStateException("Version " + getVersion() + " cannot be interpreted as branch.");
+ return parts[0] + "." + parts[1];
+ }
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/** Constants useful across all SLC components */
+public interface SlcConstants {
+ /** Read-write role. */
+ public final static String ROLE_SLC = "cn=org.argeo.slc.user,ou=roles,ou=node";
+
+ /** Read only unlogged user */
+ public final static String USER_ANONYMOUS = "anonymous";
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/** Basis for all SLC exceptions. This is an unchecked exception. */
+public class SlcException extends RuntimeException {
+ private static final long serialVersionUID = 6373738619304106445L;
+
+ /** Constructor. */
+ public SlcException(String message) {
+ super(message);
+ }
+
+ /** Constructor. */
+ public SlcException(String message, Throwable e) {
+ super(message, e);
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/** JCR names used by SLC */
+public interface SlcNames {
+ public final static String SLC_ = "slc:";
+
+ /*
+ * GENERAL
+ */
+ public final static String SLC_UUID = "slc:uuid";
+ public final static String SLC_STATUS = "slc:status";
+ // generic name for result parts of a given test result (slc:testResult)
+ // note that corresponding nodes can be retrieved using
+ // myTestResultNode.getNodes(SLC_RESULT_PART+"*") method
+ public final static String SLC_RESULT_PART = "slc:resultPart";
+ // Fixed name of the child node of a slc:testResult of type
+ // slc:check that aggregate status of all result parts of a given test
+ // result
+ public final static String SLC_AGGREGATED_STATUS = "slc:aggregatedStatus";
+
+ public final static String SLC_TYPE = "slc:type";
+ public final static String SLC_NAME = "slc:name";
+ public final static String SLC_VERSION = "slc:version";
+ public final static String SLC_CATEGORY = "slc:category";
+ public final static String SLC_VALUE = "slc:value";
+ public final static String SLC_ADDRESS = "slc:address";
+ public final static String SLC_METADATA = "slc:metadata";
+
+ public final static String SLC_TIMESTAMP = "slc:timestamp";
+ public final static String SLC_STARTED = "slc:started";
+ public final static String SLC_COMPLETED = "slc:completed";
+
+ public final static String SLC_VM = "slc:vm";
+ /*
+ * SLC RUNTIME
+ */
+ // execution
+ public final static String SLC_SPEC = "slc:spec";
+ public final static String SLC_EXECUTION_SPECS = "slc:executionSpecs";
+ public final static String SLC_FLOW = "slc:flow";
+ public final static String SLC_LOG = "slc:log";
+ public final static String SLC_AGENTS = "slc:agents";
+
+ // spec attribute
+ public final static String SLC_IS_IMMUTABLE = "slc:isImmutable";
+ public final static String SLC_IS_CONSTANT = "slc:isConstant";
+ public final static String SLC_IS_HIDDEN = "slc:isHidden";
+
+ // base directories
+ public final static String SLC_SYSTEM = "slc:system";
+ public final static String SLC_RESULTS = "slc:results";
+ public final static String SLC_MY_RESULTS = "slc:myResults";
+ public final static String SLC_PROCESSES = "slc:processes";
+
+ // result
+ public final static String SLC_SUCCESS = "slc:success";
+ public final static String SLC_MESSAGE = "slc:message";
+ public final static String SLC_TAG = "slc:tag";
+ public final static String SLC_ERROR_MESSAGE = "slc:errorMessage";
+ public final static String SLC_TEST_CASE = "slc:testCase";
+ public final static String SLC_TEST_CASE_TYPE = "slc:testCaseType";
+
+ // diff result
+ public final static String SLC_SUMMARY = "slc:summary";
+ public final static String SLC_ISSUES = "slc:issues";
+
+ /*
+ * SLC REPO
+ */
+ // shared
+ public final static String SLC_URL = "slc:url";
+ public final static String SLC_OPTIONAL = "slc:optional";
+ public final static String SLC_AS_STRING = "slc:asString";
+
+ // origin
+ public final static String SLC_ORIGIN = "slc:origin";
+ public final static String SLC_PROXY = "slc:proxy";
+
+ // slc:artifact
+ public final static String SLC_ARTIFACT_ID = "slc:artifactId";
+ public final static String SLC_GROUP_ID = "slc:groupId";
+ public final static String SLC_GROUP_BASE_ID = "slc:groupBaseId";
+ public final static String SLC_ARTIFACT_VERSION = "slc:artifactVersion";
+ public final static String SLC_ARTIFACT_EXTENSION = "slc:artifactExtension";
+ public final static String SLC_ARTIFACT_CLASSIFIER = "slc:artifactClassifier";
+
+ // slc:jarArtifact
+ public final static String SLC_MANIFEST = "slc:manifest";
+
+ // shared OSGi
+ public final static String SLC_SYMBOLIC_NAME = "slc:symbolic-name";
+ public final static String SLC_BUNDLE_VERSION = "slc:bundle-version";
+
+ // slc:osgiBaseVersion
+ public final static String SLC_MAJOR = "slc:major";
+ public final static String SLC_MINOR = "slc:minor";
+ public final static String SLC_MICRO = "slc:micro";
+ // slc:osgiVersion
+ public final static String SLC_QUALIFIER = "slc:qualifier";
+
+ // slc:exportedPackage
+ public final static String SLC_USES = "slc:uses";
+
+ // slc:modularDistribution
+ public final static String SLC_MODULES = "slc:modules";
+
+ // RPM
+ // slc:rpm
+ public final static String SLC_RPM_VERSION = "slc:rpmVersion";
+ public final static String SLC_RPM_RELEASE = "slc:rpmRelease";
+ public final static String SLC_RPM_ARCH = "slc:rpmArch";
+ public final static String SLC_RPM_ARCHIVE_SIZE = "slc:rpmArchiveSize";
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/** JCR node types used by SLC */
+public interface SlcTypes {
+
+ public final static String SLC_NAME_VERSION = "slc:nameVersion";
+ public final static String SLC_CATEGORIZED_NAME_VERSION = "slc:categorizedNameVersion";
+
+ public final static String SLC_AGENT_FACTORY = "slc:agentFactory";
+ public final static String SLC_AGENT = "slc:agent";
+ public final static String SLC_MODULE = "slc:module";
+ public final static String SLC_EXECUTION_MODULE = "slc:executionModule";
+ public final static String SLC_EXECUTION_SPEC = "slc:executionSpec";
+ public final static String SLC_EXECUTION_FLOW = "slc:executionFlow";
+ public final static String SLC_PROCESS = "slc:process";
+ public final static String SLC_REALIZED_FLOW = "slc:realizedFlow";
+
+ public final static String SLC_EXECUTION_SPEC_ATTRIBUTE = "slc:executionSpecAttribute";
+ public final static String SLC_PRIMITIVE_SPEC_ATTRIBUTE = "slc:primitiveSpecAttribute";
+ public final static String SLC_REF_SPEC_ATTRIBUTE = "slc:refSpecAttribute";
+
+ public final static String SLC_TEST_RESULT = "slc:testResult";
+ public final static String SLC_CHECK = "slc:check";
+ public final static String SLC_PROPERTY = "slc:property";
+ public final static String SLC_DIFF_RESULT = "slc:diffResult";
+
+ // Node types used for user defined and managed result UI tree
+ public final static String SLC_MY_RESULT_ROOT_FOLDER = "slc:myResultRootFolder";
+ public final static String SLC_RESULT_FOLDER = "slc:resultFolder";
+
+ // Log levels
+ public final static String SLC_LOG_ENTRY = "slc:logEntry";
+ public final static String SLC_LOG_TRACE = "slc:logTrace";
+ public final static String SLC_LOG_DEBUG = "slc:logDebug";
+ public final static String SLC_LOG_INFO = "slc:logInfo";
+ public final static String SLC_LOG_WARNING = "slc:logWarning";
+ public final static String SLC_LOG_ERROR = "slc:logError";
+
+ /*
+ * REPO
+ */
+ public final static String SLC_ARTIFACT = "slc:artifact";
+ public final static String SLC_ARTIFACT_VERSION_BASE = "slc:artifactVersion";
+ public final static String SLC_ARTIFACT_BASE = "slc:artifactBase";
+ public final static String SLC_GROUP_BASE = "slc:groupBase";
+ public final static String SLC_JAR_FILE = "slc:jarFile";
+ public final static String SLC_BUNDLE_ARTIFACT = "slc:bundleArtifact";
+ public final static String SLC_OSGI_VERSION = "slc:osgiVersion";
+ public final static String SLC_JAVA_PACKAGE = "slc:javaPackage";
+ public final static String SLC_EXPORTED_PACKAGE = "slc:exportedPackage";
+ public final static String SLC_IMPORTED_PACKAGE = "slc:importedPackage";
+ public final static String SLC_DYNAMIC_IMPORTED_PACKAGE = "slc:dynamicImportedPackage";
+ public final static String SLC_REQUIRED_BUNDLE = "slc:requiredBundle";
+ public final static String SLC_FRAGMENT_HOST = "slc:fragmentHost";
+
+ // Distribution management
+ // public final static String SLC_CATEGORY = "slc:category";
+ public final static String SLC_MODULAR_DISTRIBUTION_BASE = "slc:modularDistributionBase";
+ public final static String SLC_MODULAR_DISTRIBUTION = "slc:modularDistribution";
+ public final static String SLC_MODULE_COORDINATES = "slc:moduleCoordinates";
+
+ // origin
+ public final static String SLC_KNOWN_ORIGIN = "slc:knownOrigin";
+ public final static String SLC_PROXIED = "slc:proxied";
+
+ // rpm
+ public final static String SLC_RPM = "slc:rpm";
+}
--- /dev/null
+package org.argeo.api.slc;
+
+import java.io.InputStream;
+
+public interface StreamReadable {
+ public InputStream getInputStream();
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/** Exception for unsupported features or actions. */
+public class UnsupportedException extends SlcException {
+ static final long serialVersionUID = 1l;
+
+ /** Action not supported. */
+ public UnsupportedException() {
+ this("Action not supported");
+ }
+
+ /** Constructor with a message. */
+ public UnsupportedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor generating a message.
+ *
+ * @param nature
+ * the nature of the unsupported object
+ * @param obj
+ * the object itself (its class name will be used in message)
+ */
+ public UnsupportedException(String nature, Object obj) {
+ super("Unsupported " + nature + ": "
+ + (obj != null ? obj.getClass() : "[object is null]"));
+ }
+
+ /**
+ * Constructor generating a message.
+ *
+ * @param nature
+ * the nature of the unsupported object
+ * @param clss
+ * the class itself (will be used in message)
+ */
+ public UnsupportedException(String nature, Class<?> clss) {
+ super("Unsupported " + nature + ": " + clss);
+ }
+
+ /**
+ * Constructor generating a message.
+ *
+ * @param nature
+ * the nature of the unsupported object
+ * @param value
+ * the problematic value itself
+ */
+ public UnsupportedException(String nature, String value) {
+ super("Unsupported " + nature + ": " + value);
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc;
+
+/**
+ * Centralises constant values related to software systems, which are well
+ * defined and not expected to change within a major version cycle of SLC, but
+ * which are not necessarily defined in core Java.
+ */
+public interface WellKnownConstants {
+
+ /*
+ * OSGi
+ */
+ final static String OSGI_INSTANCE_AREA = "osgi.instance.area";
+ final static String OSGI_CONFIGURATION_AREA = "osgi.configuration.area";
+
+// final static String OSGI_HTTP_PORT = "org.osgi.service.http.port";
+}
--- /dev/null
+package org.argeo.api.slc.attachment;
+
+public interface Attachment {
+ public String getUuid();
+
+ public void setUuid(String uuid);
+
+ public String getName();
+
+ public String getContentType();
+}
--- /dev/null
+package org.argeo.api.slc.attachment;
+
+public interface AttachmentsEnabled {
+ public void addAttachment(Attachment attachment);
+}
--- /dev/null
+package org.argeo.api.slc.attachment;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public interface AttachmentsStorage {
+ public void retrieveAttachment(Attachment attachment,
+ OutputStream outputStream);
+
+ /** Does NOT close the provided input stream. */
+ public void storeAttachment(Attachment attachment, InputStream inputStream);
+}
--- /dev/null
+package org.argeo.api.slc.build;\r
+\r
+/** A packaged software component */\r
+public interface Distribution {\r
+ public String getDistributionId();\r
+\r
+}\r
--- /dev/null
+package org.argeo.api.slc.build;
+
+/** A software license */
+public interface License {
+ public String getName();
+
+ public String getUri();
+
+ public String getLink();
+
+ public String getText();
+}
--- /dev/null
+package org.argeo.api.slc.build;
+
+import org.argeo.api.slc.ModuleSet;
+import org.argeo.api.slc.NameVersion;
+
+/**
+ * A distribution of modules, that is components that can be identified by a
+ * name / version couple.
+ *
+ * @see NameVersion
+ */
+public interface ModularDistribution extends Distribution, NameVersion,
+ ModuleSet {
+ public Distribution getModuleDistribution(String moduleName,
+ String moduleVersion);
+
+ /** A descriptor such as P2, OBR or yum metadata. */
+ public Object getModulesDescriptor(String descriptorType);
+}
--- /dev/null
+<html>\r
+<head></head>\r
+<body>\r
+SLC Build: building of software systems.\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+import java.io.File;
+import java.util.Map;
+
+public interface DeployEnvironment {
+ public void unpackTo(Object packg, File targetLocation,
+ Map<String, String> filter);
+}
--- /dev/null
+package org.argeo.api.slc.deploy;\r
+\r
+import org.argeo.api.slc.build.Distribution;\r
+\r
+/** An instance of a software system. */\r
+public interface DeployedSystem extends TargetData {\r
+ /** Unique ID for this system instance. */\r
+ public String getDeployedSystemId();\r
+\r
+ /** Underlying packages */\r
+ public Distribution getDistribution();\r
+\r
+ /** Data required to initialize the instance (e.g. DB dump, etc.). */\r
+ public DeploymentData getDeploymentData();\r
+\r
+ /** Resources required by the system (ports, disk location, etc.) */\r
+ public TargetData getTargetData();\r
+}\r
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+public interface DeployedSystemManager<T extends DeployedSystem> {
+ public void setDeployedSystem(T deployedSystem);
+}
--- /dev/null
+package org.argeo.api.slc.deploy;\r
+\r
+import org.argeo.api.slc.build.Distribution;\r
+\r
+public interface Deployment extends Runnable{\r
+ public DeployedSystem getDeployedSystem();\r
+\r
+ public void setTargetData(TargetData targetData);\r
+\r
+ public void setDeploymentData(DeploymentData deploymentData);\r
+\r
+ public void setDistribution(Distribution distribution);\r
+}\r
--- /dev/null
+package org.argeo.api.slc.deploy;\r
+\r
+public interface DeploymentData {\r
+\r
+}\r
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+import org.argeo.api.slc.NameVersion;
+import org.argeo.api.slc.build.Distribution;
+
+public interface DynamicRuntime<M extends Module> extends
+ ModularDeployedSystem<M> {
+ public void shutdown();
+
+ public M installModule(Distribution distribution);
+
+ public void uninstallModule(NameVersion nameVersion);
+
+ public void updateModule(NameVersion nameVersion);
+
+ public void startModule(NameVersion nameVersion);
+
+}
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+public interface InstalledExecutables extends DeployedSystem {
+ public String getExecutablePath(String key);
+}
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+import java.util.List;
+
+public interface ModularDeployedSystem<M extends Module> extends DeployedSystem {
+ /** List the underlying deployed modules (in real time) */
+ public List<M> listModules();
+}
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+import org.argeo.api.slc.NameVersion;
+
+/**
+ * Represents a deployed module of a broader deployed system. A module is
+ * uniquely identifiable via a name / version.
+ */
+public interface Module extends DeployedSystem, NameVersion {
+ /** A serializable stateless description of the module */
+ public ModuleDescriptor getModuleDescriptor();
+}
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.argeo.api.slc.DefaultNameVersion;
+
+/** The description of a versioned module. */
+public class ModuleDescriptor extends DefaultNameVersion implements Serializable {
+ private static final long serialVersionUID = 4310820315478645419L;
+ private String title;
+ private String description;
+ private Map<String, String> metadata = new HashMap<String, String>();
+ private Boolean started = false;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /** @deprecated use {@link #getTitle()} instead */
+ public String getLabel() {
+ return title;
+ }
+
+ /** @deprecated use {@link #setTitle(String)} instead */
+ public void setLabel(String label) {
+ this.title = label;
+ }
+
+ public Map<String, String> getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Map<String, String> metadata) {
+ this.metadata = metadata;
+ }
+
+ public Boolean getStarted() {
+ return started;
+ }
+
+ public void setStarted(Boolean started) {
+ this.started = started;
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.deploy;
+
+import java.util.List;
+
+import org.argeo.api.slc.NameVersion;
+
+/** Provides access to deployed modules */
+public interface ModulesManager {
+ /** @return a full fledged module descriptor. */
+ public ModuleDescriptor getModuleDescriptor(String moduleName,
+ String version);
+
+ /**
+ * @return a list of minimal module descriptors of the deployed modules
+ */
+ public List<ModuleDescriptor> listModules();
+
+ /** Synchronously upgrades the module referenced by this name version */
+ public void upgrade(NameVersion nameVersion);
+
+ /** Starts the module */
+ public void start(NameVersion nameVersion);
+
+ /** Stops the module */
+ public void stop(NameVersion nameVersion);
+}
--- /dev/null
+package org.argeo.api.slc.deploy;\r
+\r
+public interface TargetData {\r
+\r
+}\r
--- /dev/null
+package org.argeo.api.slc.deploy;\r
+\r
+import java.io.File;\r
+import java.io.OutputStream;\r
+import java.util.List;\r
+\r
+/** Abstracts common versioning operations */\r
+public interface VersioningDriver {\r
+ public void getFileFromRepository(String repositoryBaseUrl,\r
+ String location, OutputStream out);\r
+\r
+ public List<String> getChangedPaths(File repositoryRoot, Long revision);\r
+\r
+ public String getRepositoryRoot(String repositoryUrl);\r
+\r
+ public String getRelativePath(String repositoryUrl);\r
+\r
+ public void updateToHead(File fileOrDir);\r
+\r
+ public void importFileOrDir(String repositoryUrl, File fileOrDir);\r
+\r
+ /**\r
+ * Checks out or update this versioned directory\r
+ * \r
+ * @return true if the content has changed, false otherwise\r
+ */\r
+ public Boolean checkout(String repositoryUrl, File destDir,\r
+ Boolean recursive);\r
+\r
+ public void createRepository(String filePath);\r
+\r
+ public void commit(File fileOrDir, String commitMessage);\r
+}\r
--- /dev/null
+<html>\r
+<head></head>\r
+<body>\r
+SLC Deploy: deployment of software systems.\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.io.Serializable;
+
+/** Value to be used by an execution */
+public abstract class AbstractExecutionValue implements Serializable {
+ private static final long serialVersionUID = 1558444746120706961L;
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.io.Serializable;
+
+/** Canonical implementation of the execution spec attribute booleans. */
+public abstract class AbstractSpecAttribute implements ExecutionSpecAttribute,
+ Serializable {
+ private static final long serialVersionUID = 6494963738891709440L;
+ private Boolean isImmutable = false;
+ private Boolean isConstant = false;
+ private Boolean isHidden = false;
+
+ private String description;
+
+ /** Has to be set at instantiation */
+ public Boolean getIsImmutable() {
+ return isImmutable;
+ }
+
+ public void setIsImmutable(Boolean isImmutable) {
+ this.isImmutable = isImmutable;
+ }
+
+ /** Cannot be overridden at runtime */
+ public Boolean getIsConstant() {
+ return isConstant;
+ }
+
+ public void setIsConstant(Boolean isConstant) {
+ this.isConstant = isConstant;
+ }
+
+ /** Should not be shown to the end user */
+ public Boolean getIsHidden() {
+ return isHidden;
+ }
+
+ public void setIsHidden(Boolean isHidden) {
+ this.isHidden = isHidden;
+ }
+
+ /*
+ * DEPRECATED
+ */
+ /** @deprecated use {@link #getIsImmutable()} instead */
+ public Boolean getIsParameter() {
+ return isImmutable;
+ }
+
+ /** @deprecated use {@link #getIsConstant()} instead */
+ public Boolean getIsFrozen() {
+ return isConstant;
+ }
+
+ /** @deprecated use {@link #setIsImmutable(Boolean)} instead */
+ public void setIsParameter(Boolean isParameter) {
+ this.isImmutable = isParameter;
+ }
+
+ /** @deprecated use {@link #setIsConstant(Boolean)} instead */
+ public void setIsFrozen(Boolean isFrozen) {
+ this.isConstant = isFrozen;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;\r
+\r
+/** Variables or references attached to an execution (typically thread bounded).*/\r
+public interface ExecutionContext {\r
+ public final static String VAR_EXECUTION_CONTEXT_ID = "slcVar.executionContext.id";\r
+ public final static String VAR_EXECUTION_CONTEXT_CREATION_DATE = "slcVar.executionContext.creationDate";\r
+ public final static String VAR_FLOW_ID = "slcVar.flow.id";\r
+ public final static String VAR_FLOW_NAME = "slcVar.flow.name";\r
+\r
+ public String getUuid();\r
+\r
+ /** @return the variable value, or <code>null</code> if not found. */\r
+ public Object getVariable(String key);\r
+\r
+ public void setVariable(String key, Object value);\r
+ \r
+ public void beforeFlow(ExecutionFlow executionFlow);\r
+ \r
+ public void afterFlow(ExecutionFlow executionFlow);\r
+}\r
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.Iterator;
+
+/** Abstraction of an execution that can be identified and configured. */
+public interface ExecutionFlow extends Runnable {
+ /** Retrieve an immutable parameter */
+ public Object getParameter(String key);
+
+ /** Whether this immutable parameter is set */
+ public Boolean isSetAsParameter(String key);
+
+ /** The specifications of the execution flow. */
+ public ExecutionSpec getExecutionSpec();
+
+ /**
+ * List sub-runnables that would be executed if run() method would be
+ * called.
+ */
+ public Iterator<Runnable> runnables();
+
+ /**
+ * If there is one and only one runnable wrapped return it, throw an
+ * exception otherwise.
+ */
+ public Runnable getRunnable();
+
+ /**
+ * The name of this execution flow. Can contains '/' which will be
+ * interpreted by UIs as a hierarchy;
+ */
+ public String getName();
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * Implements both archetype and implementation of a given process.
+ *
+ * At specification time, <code>executionSpec</code> represents the spec of the
+ * parameters accepted by the process, with, among others: type, default value
+ * and, optionally, possible values for each parameter. Thus ExecutionSpec might
+ * be a huge object. Note that when marshalling only a reference to a specific
+ * ExecutionSpec is stored in the XML to optimize performance and avoid
+ * redundancy between various ExecutionFlowDesciptor that might have the same
+ * ExecutionSpec.
+ *
+ * At runtime, we build a RealizedFlow which references an
+ * ExecutionFlowDescriptor. As it happens AFTER marshalling / unmarshalling
+ * process, the ExecutionSpec is null but we manage to retrieve the
+ * ExecutionSpec and store it in the RealizedFlow, whereas set values of the
+ * parameters are stored in the <code>values</code> map.
+ *
+ * Generally, values object are either a <code>PrimitiveAccessor</code> or a
+ * <code>RefValue</code> but can be other objects.
+ */
+public class ExecutionFlowDescriptor implements Serializable, Cloneable {
+ private static final long serialVersionUID = 7101944857038041216L;
+ private String name;
+ private String description;
+ private String path;
+ private Map<String, Object> values;
+ private ExecutionSpec executionSpec;
+
+ public ExecutionFlowDescriptor() {
+ }
+
+ public ExecutionFlowDescriptor(String name, String description,
+ Map<String, Object> values, ExecutionSpec executionSpec) {
+ this.name = name;
+ this.values = values;
+ this.executionSpec = executionSpec;
+ }
+
+ /** The referenced {@link ExecutionSpec} is NOT cloned. */
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return new ExecutionFlowDescriptor(name, description,
+ new HashMap<String, Object>(values), executionSpec);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @deprecated will be removed in SLC 2.x, the path should be the part of
+ * the name with '/'
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * @deprecated will be removed in SLC 2.0, the path should be the part of
+ * the name with '/'
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public Map<String, Object> getValues() {
+ return values;
+ }
+
+ public ExecutionSpec getExecutionSpec() {
+ return executionSpec;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValues(Map<String, Object> values) {
+ this.values = values;
+ }
+
+ public void setExecutionSpec(ExecutionSpec executionSpec) {
+ this.executionSpec = executionSpec;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof ExecutionFlowDescriptor)
+ return name.equals(((ExecutionFlowDescriptor) obj).getName());
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return (path != null && !path.trim().equals("") ? path + "/" : "")
+ + name;
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.Map;
+
+/**
+ * Maps back and forth between {@link ExecutionFlowDescriptor} and
+ * {@link ExecutionFlow}
+ */
+public interface ExecutionFlowDescriptorConverter {
+ public Map<String, Object> convertValues(
+ ExecutionFlowDescriptor executionFlowDescriptor);
+
+ public void addFlowsToDescriptor(ExecutionModuleDescriptor md,
+ Map<String, ExecutionFlow> executionFlows);
+
+ public ExecutionFlowDescriptor getExecutionFlowDescriptor(
+ ExecutionFlow executionFlow);
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+@Deprecated
+public interface ExecutionModule {
+/* public String getName();
+
+ public String getVersion();
+
+ public ExecutionModuleDescriptor getDescriptor();
+
+ public void execute(ExecutionFlowDescriptor descriptor);*/
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.deploy.ModuleDescriptor;
+
+/** Describes the information required to launch a flow */
+public class ExecutionModuleDescriptor extends ModuleDescriptor {
+ /** Metadata header identifying an SLC execution module */
+ public final static String SLC_EXECUTION_MODULE = "SLC-ExecutionModule";
+
+ private static final long serialVersionUID = -2394473464513029512L;
+ private List<ExecutionSpec> executionSpecs = new ArrayList<ExecutionSpec>();
+ private List<ExecutionFlowDescriptor> executionFlows = new ArrayList<ExecutionFlowDescriptor>();
+
+ public List<ExecutionSpec> getExecutionSpecs() {
+ return executionSpecs;
+ }
+
+ public List<ExecutionFlowDescriptor> getExecutionFlows() {
+ return executionFlows;
+ }
+
+ /**
+ * Returns a new {@link ExecutionModuleDescriptor} that can be used to build
+ * a {@link RealizedFlow}.
+ */
+ public ExecutionFlowDescriptor cloneFlowDescriptor(String name) {
+ ExecutionFlowDescriptor res = null;
+ for (ExecutionFlowDescriptor efd : executionFlows) {
+ if (efd.getName().equals(name)
+ || ("/" + efd.getName()).equals(name)) {
+ try {
+ res = (ExecutionFlowDescriptor) efd.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new SlcException("Cannot clone " + efd, e);
+ }
+ }
+ }
+ if (res == null)
+ throw new SlcException("Flow " + name + " not found.");
+ return res;
+ }
+
+ public RealizedFlow asRealizedFlow(String flow, Map<String, Object> values) {
+ RealizedFlow realizedFlow = new RealizedFlow();
+ realizedFlow.setFlowDescriptor(cloneFlowDescriptor(flow));
+ realizedFlow.setModuleName(getName());
+ realizedFlow.setModuleVersion(getVersion());
+ realizedFlow.getFlowDescriptor().getValues().putAll(values);
+ return realizedFlow;
+ }
+
+ public void setExecutionSpecs(List<ExecutionSpec> executionSpecs) {
+ this.executionSpecs = executionSpecs;
+ }
+
+ public void setExecutionFlows(List<ExecutionFlowDescriptor> executionFlows) {
+ this.executionFlows = executionFlows;
+ }
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import org.argeo.api.slc.deploy.ModuleDescriptor;
+
+/** Listen to events on execution modules. */
+public interface ExecutionModulesListener {
+ public void executionModuleAdded(ModuleDescriptor moduleDescriptor);
+
+ public void executionModuleRemoved(ModuleDescriptor moduleDescriptor);
+
+ public void executionFlowAdded(ModuleDescriptor moduleDescriptor,
+ ExecutionFlowDescriptor executionFlowDescriptor);
+
+ public void executionFlowRemoved(ModuleDescriptor moduleDescriptor,
+ ExecutionFlowDescriptor executionFlowDescriptor);
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.List;
+
+import org.argeo.api.slc.deploy.ModulesManager;
+
+/** Provides access to the execution modules */
+public interface ExecutionModulesManager extends ModulesManager {
+ /** Used to filter event notified to an execution notifier. */
+ public static String SLC_PROCESS_ID = "slc.process.id";
+
+ /** Unique launch module */
+ public static String UNIQUE_LAUNCH_MODULE_PROPERTY = "slc.launch.module";
+
+ /** Unique launch flow */
+ public static String UNIQUE_LAUNCH_FLOW_PROPERTY = "slc.launch.flow";
+
+ /** @return a full fledged module descriptor. */
+ public ExecutionModuleDescriptor getExecutionModuleDescriptor(
+ String moduleName, String version);
+
+ /**
+ * @return a list of minimal execution module descriptors (only the module
+ * meta data, not the flows)
+ */
+ public List<ExecutionModuleDescriptor> listExecutionModules();
+
+ /** Synchronously finds and executes an {@link ExecutionFlow}. */
+ public void execute(RealizedFlow realizedFlow);
+
+ // /** Notify of a status update status of the {@link ExecutionProcess} */
+// public void dispatchUpdateStatus(ExecutionProcess process,
+// String oldStatus, String newStatus);
+ //
+ // /** Notify that a step was added in an {@link ExecutionProcess} */
+ // public void dispatchAddSteps(ExecutionProcess process,
+ // List<ExecutionStep> steps);
+ //
+ // /**
+ // * Register a notifier which will be notified based on the provided
+ // * properties.
+ // */
+ // public void registerProcessNotifier(ExecutionProcessNotifier notifier,
+ // Map<String, String> properties);
+ //
+ // /** Unregisters a notifier */
+ // public void unregisterProcessNotifier(ExecutionProcessNotifier notifier,
+ // Map<String, String> properties);
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.List;
+
+/**
+ * A process is the functional representation of a combination of executions.
+ * While an execution is the actual java code running, a process exists before,
+ * during and after the execution actually took place, providing an entry point
+ * for the definition of executions, their monitoring (e.g. logging) and
+ * tracking. A process can be distributed or parallelized. <br/>
+ * NEW => INITIALIZED => SCHEDULED => RUNNING<br/>
+ * RUNNING => {COMPLETED | ERROR | KILLED}<br/>
+ * {COMPLETED | ERROR | KILLED} => PURGED<br/>
+ * UNKOWN : this is a bug if this status occurs<br/>
+ */
+public interface ExecutionProcess {
+ /** The process is not yet usable. */
+ public final static String NEW = "NEW";
+ /** The process is usable but not yet scheduled to run. */
+ public final static String INITIALIZED = "INITIALIZED";
+ /** The process is usable and scheduled to run, but not yet running. */
+ public final static String SCHEDULED = "SCHEDULED";
+ /** The process is currently running. */
+ public final static String RUNNING = "RUNNING";
+ /** The process has properly completed. */
+ public final static String COMPLETED = "COMPLETED";
+ /** The process failed because of an unexpected error. */
+ public final static String ERROR = "ERROR";
+ /** The process was killed explicitly or through a crash. */
+ public final static String KILLED = "KILLED";
+ /** The status cannot be retrieved (probably because of unexpected errors). */
+ public final static String UNKOWN = "UNKOWN";
+
+ /**
+ * Only a reference to the process has been kept, all monitoring data such
+ * as logs have been purged.
+ */
+ public final static String PURGED = "PURGED";
+
+ /** The UUID of this process. */
+ public String getUuid();
+
+ /** The current status of this process. */
+ public String getStatus();
+
+ /** Sets the current status of this process */
+ public void setStatus(String status);
+
+ public void addSteps(List<ExecutionStep> steps);
+
+ public List<RealizedFlow> getRealizedFlows();
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.io.File;
+import java.nio.file.Path;
+
+/** Provides write access to resources during execution */
+public interface ExecutionResources {
+ /** The base directory where this execution can write */
+ public File getWritableBaseDir();
+
+ /** Allocates a local file in the writable area and return it as a resource. */
+ public Path getWritableResource(String relativePath);
+
+ /**
+ * Allocates a local file in the writable area and return it as a fully
+ * qualified OS path.
+ */
+ public String getWritableOsPath(String relativePath);
+
+ /**
+ * Allocates a local file in the writable area and return it as a {@link File}.
+ */
+ public File getWritableOsFile(String relativePath);
+
+ /**
+ * Returns the resource as a file path. If the resource is not writable it is
+ * copied as a file in the writable area and the path to this local file is
+ * returned.
+ */
+ public String getAsOsPath(Path resource, Boolean overwrite);
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.Map;
+
+/**
+ * The class implementing this interface defines the map of attributes that are
+ * necessary for the corresponding ExecutionFlow.
+ */
+public interface ExecutionSpec {
+ /**
+ * The name for an internal spec (for backward compatibility where a
+ * non-null name is expected)
+ */
+ public final static String INTERNAL_NAME = "__SLC_EXECUTION_SPEC_INTERNAL";
+
+ /**
+ * The name identifying the execution spec within its application context.
+ * Can be null. An execution spec can be referenced only if its name is not
+ * null or different from {@link #INTERNAL_NAME}
+ */
+ public String getName();
+
+ /** An optional description. Can be null. */
+ public String getDescription();
+
+ /** The attributes managed by this execution spec */
+ public Map<String, ExecutionSpecAttribute> getAttributes();
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+/**
+ * Possible attribute of an execution flow.
+ *
+ * There are mainly two implementations :<br>
+ * + Primitive attributes (no predefined choice, the end user must compute a
+ * String, a Float, an Integer...)<br>
+ * + RefSpecAttribute which enable two things<br>
+ * ++ a reference to another object of the application context<br>
+ * ++ the display of some choices among which the end user can choose.<br>
+ *
+ * @see org.argeo.slc.core.execution.PrimitiveSpecAttribute
+ * @see org.argeo.slc.core.execution.RefSpecAttribute
+ * @see org.argeo.slc.core.execution.PrimitiveUtils : this class offers some
+ * helper, among others to cast the various type of primitive attribute.
+ */
+public interface ExecutionSpecAttribute {
+ /**
+ * Whether this attribute has to be set at instantiation of the flow and
+ * cannot be modified afterwards. If the attribute is not immutable (that
+ * is, this method returns false), it can be set at execution time.
+ */
+ public Boolean getIsImmutable();
+
+ /**
+ * Whether this attribute must be explicitly set and cannot be modified.
+ * This attribute is then basically a constant within a given application
+ * context. {@link #getValue()} cannot return null if the attribute is a
+ * constant.
+ */
+ public Boolean getIsConstant();
+
+ /** Whether this attribute will be hidden to end users. */
+ public Boolean getIsHidden();
+
+ /**
+ * The default value for this attribute. Can be null, except if
+ * {@link #getIsFrozen()} is <code>true</code>, in which case it represents
+ * the constant value of this attribute.
+ */
+ public Object getValue();
+
+ /** Description of this attribute, can be null */
+ public String getDescription();
+
+ /** @deprecated use {@link #getIsImmutable()} instead */
+ public Boolean getIsParameter();
+
+ /** @deprecated use {@link #getIsConstant()} instead */
+ public Boolean getIsFrozen();
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+/** Deal with nested level of executions using different variables. */
+public interface ExecutionStack {
+ /**
+ * @param name
+ * @return null if no object is found
+ */
+ public Object findScopedObject(String name);
+
+ public void addScopedObject(String name, Object obj);
+
+ public void enterFlow(ExecutionFlow executionFlow);
+
+ /** @return internal stack level UUID. */
+ public String getCurrentStackLevelUuid();
+
+ public Integer getStackSize();
+
+ public void leaveFlow(ExecutionFlow executionFlow);
+
+ Object findLocalVariable(String key);
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.Map;
+
+public interface ExecutionStackLevel {
+ public ExecutionFlow getExecutionFlow();
+
+ public Map<String, Object> getScopedObjects();
+
+ public String getUuid();
+
+ public Map<String, Object> getLocalVariables();
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;\r
+\r
+import java.io.Serializable;\r
+import java.util.Date;\r
+\r
+/**\r
+ * An atomic step to be notified in during an {@link ExecutionProcess}. Can be a\r
+ * log or the start/end of a phase, etc.\r
+ */\r
+public class ExecutionStep implements Serializable {\r
+ private static final long serialVersionUID = 798640526532912161L;\r
+\r
+ public final static String PHASE_START = "PHASE_START";\r
+ public final static String PHASE_END = "PHASE_END";\r
+ public final static String ERROR = "ERROR";\r
+ public final static String WARNING = "WARNING";\r
+ public final static String INFO = "INFO";\r
+ public final static String DEBUG = "DEBUG";\r
+ public final static String TRACE = "TRACE";\r
+\r
+ /** @deprecated */\r
+ public final static String START = "START";\r
+ /** @deprecated */\r
+ public final static String END = "END";\r
+\r
+ // TODO make the fields final and private when we don't need POJO support\r
+ // anymore (that\r
+ // is when SlcExecutionStep is removed)\r
+ protected String type;\r
+ protected String thread;\r
+ protected Date timestamp;\r
+ protected String log;\r
+\r
+ private String location;\r
+\r
+ /** Empty constructor */\r
+ public ExecutionStep() {\r
+ Thread currentThread = Thread.currentThread();\r
+ thread = currentThread.getName();\r
+ }\r
+\r
+ /** Creates a step at the current date */\r
+ public ExecutionStep(String location, String type, String log) {\r
+ this(location, new Date(), type, log);\r
+ }\r
+\r
+ /** Creates a step of the given type. */\r
+ public ExecutionStep(String location, Date timestamp, String type,\r
+ String log) {\r
+ this(location, timestamp, type, log, Thread.currentThread().getName());\r
+ }\r
+\r
+ public ExecutionStep(String location, Date timestamp, String type,\r
+ String log, String thread) {\r
+ this.location = location;\r
+ this.type = type;\r
+ this.timestamp = timestamp;\r
+ this.thread = thread;\r
+ this.log = addLog(log);\r
+ }\r
+\r
+ public String getType() {\r
+ return type;\r
+ }\r
+\r
+ public Date getTimestamp() {\r
+ return timestamp;\r
+ }\r
+\r
+ public String getThread() {\r
+ return thread;\r
+ }\r
+\r
+ /**\r
+ * Return the string that should be stored in the log field. Can be null if\r
+ * another mechanism is used to store log lines.\r
+ */\r
+ protected String addLog(String log) {\r
+ return log;\r
+ }\r
+\r
+ public String getLog() {\r
+ return log;\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ return "Execution step, thread=" + thread + ", type=" + type;\r
+ }\r
+\r
+ /** Typically the logging category */\r
+ public String getLocation() {\r
+ return location;\r
+ }\r
+\r
+}\r
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import org.argeo.api.slc.SlcException;
+
+/** The stack trace of such exceptions does not need to be displayed */
+public class FlowConfigurationException extends SlcException {
+ private static final long serialVersionUID = 8456260596346797321L;
+
+ public FlowConfigurationException(String message) {
+ super(message);
+ }
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.argeo.api.slc.DefaultNameVersion;
+import org.argeo.api.slc.NameVersion;
+
+/** A fully configured execution flow, ready to be executed. */
+public class RealizedFlow implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String moduleName;
+ private String moduleVersion;
+ private ExecutionFlowDescriptor flowDescriptor;
+
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ public void setModuleName(String moduleName) {
+ this.moduleName = moduleName;
+ }
+
+ public NameVersion getModuleNameVersion() {
+ return new DefaultNameVersion(getModuleName(), getModuleVersion());
+ }
+
+ public String getModuleVersion() {
+ return moduleVersion;
+ }
+
+ public void setModuleVersion(String moduleVersion) {
+ this.moduleVersion = moduleVersion;
+ }
+
+ public ExecutionFlowDescriptor getFlowDescriptor() {
+ return flowDescriptor;
+ }
+
+ public void setFlowDescriptor(ExecutionFlowDescriptor flowDescriptor) {
+ this.flowDescriptor = flowDescriptor;
+ }
+
+ /** Create a simple realized flow */
+ public static RealizedFlow create(String module, String version,
+ String flowName, Map<String, String> args) {
+ final RealizedFlow realizedFlow = new RealizedFlow();
+ realizedFlow.setModuleName(module);
+ // TODO deal with version
+ if (version == null)
+ version = "0.0.0";
+ realizedFlow.setModuleVersion(version);
+ ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor();
+ efd.setName(flowName);
+
+ // arguments
+ if (args != null && args.size() > 0) {
+ Map<String, Object> values = new HashMap<String, Object>();
+ for (String key : args.keySet()) {
+ String value = args.get(key);
+ values.put(key, value);
+ }
+ efd.setValues(values);
+ }
+
+ realizedFlow.setFlowDescriptor(efd);
+ return realizedFlow;
+ }
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.util.List;
+
+/** A spec attribute whose value is a reference to a full fledged object. */
+public class RefSpecAttribute extends AbstractSpecAttribute implements
+ Cloneable {
+ private static final long serialVersionUID = -3427797452955753574L;
+ private transient Class<?> targetClass = String.class;
+ /** Read only. */
+ private String targetClassName;
+ private transient Object value = null;
+
+ /** List to be chosen from */
+ private List<RefValueChoice> choices = null;
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ /** Default is {@link String} */
+ public Class<?> getTargetClass() {
+ return targetClass;
+ }
+
+ public void setTargetClass(Class<?> targetClass) {
+ this.targetClass = targetClass;
+ this.targetClassName = targetClass.getName();
+ }
+
+ public String getTargetClassName() {
+ return targetClassName;
+ }
+
+ /** @return can be null */
+ public List<RefValueChoice> getChoices() {
+ return choices;
+ }
+
+ public void setChoices(List<RefValueChoice> choices) {
+ this.choices = choices;
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ RefSpecAttribute rsa = new RefSpecAttribute();
+ rsa.setTargetClass(targetClass);
+ rsa.setChoices(choices);
+ return rsa;
+ }
+
+ @Override
+ public String toString() {
+ return "Ref spec attribute [" + targetClass + "]"
+ + (value != null ? "=" + value : "");
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+/** Reference value to be used by an execution */
+public class RefValue extends AbstractExecutionValue {
+ private static final long serialVersionUID = -8951231456757181687L;
+ private String ref;
+ private String type;
+
+ public RefValue() {
+ }
+
+ public RefValue(String ref) {
+ super();
+ this.ref = ref;
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return "Ref Value [" + type + "=" + ref + "]";
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.io.Serializable;
+
+/** A choice of ref value to be shown to the end user. */
+public class RefValueChoice implements Serializable {
+ private static final long serialVersionUID = -1133645722307507774L;
+ private String name;
+ private String description;
+
+ public RefValueChoice() {
+ }
+
+ public RefValueChoice(String name, String description) {
+ this.name = name;
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * A local agent can run SLC processes. It is responsible for creating their
+ * threads and integrating them with various UIs. It typically wraps
+ * {@link ExecutionModulesManager} which is used to run flows synchronously at a
+ * lower level.
+ */
+public interface SlcAgent {
+ /** Agent unique identifier */
+ public String getAgentUuid();
+
+ /** Execute / take part to this process */
+ public void process(ExecutionProcess process);
+
+ /**
+ * Asynchronously processes the flows defined as URIs, or interpret a single
+ * UUID URN as a scheduled or template process.
+ *
+ * @return the UUID of the process launched.
+ */
+ public String process(List<URI> uris);
+
+ /** Kills this process */
+ public void kill(String processUuid);
+
+ /**
+ * Wait for this process to finish. returns immediately if it does not
+ * exist.
+ *
+ * @param millis
+ * can be null
+ */
+ public void waitFor(String processUuid, Long millis);
+
+ /**
+ * Describe all the flows provided by this execution module. Typically
+ * called in order to build a realized flow.
+ */
+ public ExecutionModuleDescriptor getExecutionModuleDescriptor(
+ String moduleName, String version);
+
+ /** List all execution modules which can be processed by this agent. */
+ public List<ExecutionModuleDescriptor> listExecutionModuleDescriptors();
+
+ /** @return true if still alive. */
+ public boolean ping();
+}
--- /dev/null
+package org.argeo.api.slc.execution;
+
+/**
+ * Interpret a command line and run it in the underlying agent, with the proper
+ * authentication.
+ */
+public interface SlcAgentCli {
+ /**
+ * Synchronously executes.
+ *
+ * @return the UUID of the process
+ */
+ public String process(String[] args);
+}
--- /dev/null
+<html>\r
+<head></head>\r
+<body>\r
+Common classes of teh SLC framework.\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package org.argeo.api.slc.primitive;
+
+/** Abstraction of access to primitive values */
+public interface PrimitiveAccessor {
+ public final static String TYPE_STRING = "string";
+ /**
+ * As of Argeo 1, passwords are NOT stored encrypted, just hidden in the UI,
+ * but stored in plain text in JCR. Use keyring instead.
+ */
+ public final static String TYPE_PASSWORD = "password";
+ public final static String TYPE_INTEGER = "integer";
+ public final static String TYPE_LONG = "long";
+ public final static String TYPE_FLOAT = "float";
+ public final static String TYPE_DOUBLE = "double";
+ public final static String TYPE_BOOLEAN = "boolean";
+
+ public String getType();
+
+ public Object getValue();
+
+ public void setValue(Object value);
+}
--- /dev/null
+package org.argeo.api.slc.primitive;
+
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.AbstractSpecAttribute;
+
+/**
+ * A spec attribute wrapping a primitive value.
+ *
+ * @see PrimitiveAccessor
+ */
+public class PrimitiveSpecAttribute extends AbstractSpecAttribute implements
+ PrimitiveAccessor {
+ private static final long serialVersionUID = -566676381839825483L;
+ private String type = "string";
+ private Object value = null;
+
+ public PrimitiveSpecAttribute() {
+ }
+
+ public PrimitiveSpecAttribute(String type, Object value) {
+ this.type = type;
+ this.value = value;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ // check whether type is recognized.
+ if (PrimitiveUtils.typeAsClass(type) == null)
+ throw new SlcException("Unrecognized type " + type);
+ this.type = type;
+
+ }
+
+ @Override
+ public String toString() {
+ return "Primitive spec attribute [" + type + "]"
+ + (value != null ? "=" + value : "");
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.primitive;
+
+/** Converts to and from primitive types. */
+public class PrimitiveUtils {
+ /**
+ * @deprecated Use {@link PrimitiveAccessor#TYPE_STRING} instead
+ */
+ public final static String TYPE_STRING = PrimitiveAccessor.TYPE_STRING;
+ /**
+ * @deprecated Use {@link PrimitiveAccessor#TYPE_INTEGER} instead
+ */
+ public final static String TYPE_INTEGER = PrimitiveAccessor.TYPE_INTEGER;
+ /**
+ * @deprecated Use {@link PrimitiveAccessor#TYPE_LONG} instead
+ */
+ public final static String TYPE_LONG = PrimitiveAccessor.TYPE_LONG;
+ /**
+ * @deprecated Use {@link PrimitiveAccessor#TYPE_FLOAT} instead
+ */
+ public final static String TYPE_FLOAT = PrimitiveAccessor.TYPE_FLOAT;
+ /**
+ * @deprecated Use {@link PrimitiveAccessor#TYPE_DOUBLE} instead
+ */
+ public final static String TYPE_DOUBLE = PrimitiveAccessor.TYPE_DOUBLE;
+ /**
+ * @deprecated Use {@link PrimitiveAccessor#TYPE_BOOLEAN} instead
+ */
+ public final static String TYPE_BOOLEAN = PrimitiveAccessor.TYPE_BOOLEAN;
+
+ private PrimitiveUtils() {
+
+ }
+
+ /** @return the class or null if the provided type is not a primitive */
+ public static Class<?> typeAsClass(String type) {
+ if (PrimitiveAccessor.TYPE_STRING.equals(type))
+ return String.class;
+ else if (PrimitiveAccessor.TYPE_PASSWORD.equals(type))
+ return char[].class;
+ else if (PrimitiveAccessor.TYPE_INTEGER.equals(type))
+ return Integer.class;
+ else if (PrimitiveAccessor.TYPE_LONG.equals(type))
+ return Long.class;
+ else if (PrimitiveAccessor.TYPE_FLOAT.equals(type))
+ return Float.class;
+ else if (PrimitiveAccessor.TYPE_DOUBLE.equals(type))
+ return Double.class;
+ else if (PrimitiveAccessor.TYPE_BOOLEAN.equals(type))
+ return Boolean.class;
+ else
+ return null;
+ }
+
+ /** @return the type or null if the provided class is not a primitive */
+ public static String classAsType(Class<?> clss) {
+ if (String.class.isAssignableFrom(clss))
+ return PrimitiveAccessor.TYPE_STRING;
+ else if (char[].class.isAssignableFrom(clss))
+ return PrimitiveAccessor.TYPE_PASSWORD;
+ else if (Integer.class.isAssignableFrom(clss))
+ return PrimitiveAccessor.TYPE_INTEGER;
+ else if (Long.class.isAssignableFrom(clss))
+ return PrimitiveAccessor.TYPE_LONG;
+ else if (Float.class.isAssignableFrom(clss))
+ return PrimitiveAccessor.TYPE_FLOAT;
+ else if (Double.class.isAssignableFrom(clss))
+ return PrimitiveAccessor.TYPE_DOUBLE;
+ else if (Boolean.class.isAssignableFrom(clss))
+ return PrimitiveAccessor.TYPE_BOOLEAN;
+ else
+ return null;
+ }
+
+ /** Parse string as an object. Passwords are returned as String.*/
+ public static Object convert(String type, String str) {
+ if (PrimitiveAccessor.TYPE_STRING.equals(type)) {
+ return str;
+ } else if (PrimitiveAccessor.TYPE_PASSWORD.equals(type)) {
+ return str;
+ } else if (PrimitiveAccessor.TYPE_INTEGER.equals(type)) {
+ return (Integer.parseInt(str));
+ } else if (PrimitiveAccessor.TYPE_LONG.equals(type)) {
+ return (Long.parseLong(str));
+ } else if (PrimitiveAccessor.TYPE_FLOAT.equals(type)) {
+ return (Float.parseFloat(str));
+ } else if (PrimitiveAccessor.TYPE_DOUBLE.equals(type)) {
+ return (Double.parseDouble(str));
+ } else if (PrimitiveAccessor.TYPE_BOOLEAN.equals(type)) {
+ return (Boolean.parseBoolean(str));
+ } else {
+ return str;
+ }
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.primitive;
+
+import org.argeo.api.slc.execution.AbstractExecutionValue;
+
+/** Primitive value to be used by an execution. */
+public class PrimitiveValue extends AbstractExecutionValue implements
+ PrimitiveAccessor {
+ private static final long serialVersionUID = 533414290998374166L;
+
+ private String type;
+
+ private Object value;
+
+ public PrimitiveValue() {
+ }
+
+ public PrimitiveValue(String type, Object value) {
+ super();
+ this.type = type;
+ this.value = value;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+}
--- /dev/null
+package org.argeo.api.slc.test;\r
+\r
+\r
+/** A test run that can be executed */\r
+public interface ExecutableTestRun extends TestRun, Runnable {\r
+\r
+}\r
--- /dev/null
+package org.argeo.api.slc.test;\r
+\r
+import org.argeo.api.slc.SlcException;\r
+\r
+/**\r
+ * Exception to throw when a test definition cannot interpret the provided test\r
+ * data.\r
+ */\r
+public class IncompatibleTestDataException extends SlcException {\r
+ static final long serialVersionUID = 1l;\r
+\r
+ public IncompatibleTestDataException(TestData testData,\r
+ TestDefinition testDefinition) {\r
+ super("TestData " + testData.getClass()\r
+ + " is not compatible with TestDefinition "\r
+ + testDefinition.getClass());\r
+ }\r
+\r
+ public IncompatibleTestDataException(TestRun testRun) {\r
+ super("TestData " + ((TestData) testRun.getTestData()).getClass()\r
+ + " is not compatible with TestDefinition "\r
+ + ((TestDefinition) testRun.getTestDefinition()).getClass());\r
+ }\r
+}\r
--- /dev/null
+package org.argeo.api.slc.test;\r
+\r
+/**\r
+ * Any data required by a test in order to run: configuration, expected,\r
+ * reached, etc.\r
+ */\r
+public interface TestData {\r
+\r
+}\r
--- /dev/null
+package org.argeo.api.slc.test;\r
+\r
+public interface TestDataProvider {\r
+ public <T extends TestData> T getTestData(Class<T> clss, String key);\r
+}\r
--- /dev/null
+package org.argeo.api.slc.test;\r
+\r
+/**\r
+ * The programmatic definition of a test, which will be associated with\r
+ * transient objects within a test run.\r
+ */\r
+public interface TestDefinition extends TestStatus {\r
+ /** Performs the test. */\r
+ public void execute(TestRun testRun);\r
+}\r
--- /dev/null
+package org.argeo.api.slc.test;
+
+import java.util.Date;
+import java.util.Map;
+
+/** The result of a test */
+public interface TestResult extends TestStatus, TestRunAware {
+ public String getUuid();
+
+ /** Adds a part of the result. */
+ public void addResultPart(TestResultPart part);
+
+ /**
+ * Marks that the collection of test results is completed and free the
+ * related resources (also closing listeners).
+ */
+ public void close();
+
+ /**
+ * The date when this test result was closed. Can be null, which means the
+ * result is not closed.
+ */
+ public Date getCloseDate();
+
+ /** Additional arbitrary meta data */
+ public Map<String, String> getAttributes();
+}
--- /dev/null
+package org.argeo.api.slc.test;
+
+/** Listener to the operations on a test result. */
+public interface TestResultListener<T extends TestResult> {
+ /** Notified when a part was added to a test result. */
+ public void resultPartAdded(T testResult, TestResultPart testResultPart);
+
+ /** Stops listening and release the related resources. */
+ public void close(T testResult);
+}
--- /dev/null
+package org.argeo.api.slc.test;
+
+/**
+ * Part of a test result.
+ *
+ * @see TestResult
+ */
+public interface TestResultPart {
+ /** The status, as defined in {@link TestStatus}. */
+ public Integer getStatus();
+
+ /** The related message. */
+ public String getMessage();
+
+ /** The underlying <code>Exception</code>. Can be null. */
+ public String getExceptionMessage();
+}
--- /dev/null
+package org.argeo.api.slc.test;
+
+import org.argeo.api.slc.deploy.DeployedSystem;
+
+/** The actual run of a test */
+public interface TestRun {
+ /** Gets UUID */
+ public String getUuid();
+
+ /** Gets the related test definition. */
+ public <T extends TestDefinition> T getTestDefinition();
+
+ /** Gets the related test data */
+ public <T extends TestData> T getTestData();
+
+ /** Gets the related deployed system. */
+ public <T extends DeployedSystem> T getDeployedSystem();
+
+ /** Gets the related result where to record results. */
+ public <T extends TestResult> T getTestResult();
+}
--- /dev/null
+package org.argeo.api.slc.test;
+
+/** Allows a test run to notify other objects. */
+public interface TestRunAware {
+ /** Notifies the current test run. */
+ public void notifyTestRun(TestRun testRun);
+
+}
--- /dev/null
+package org.argeo.api.slc.test;
+
+/**
+ * Simple statuses. Ordering of the flags can be relied upon in aggregation: if
+ * one element is failed, the aggregation is failed. Is one element is in ERROR,
+ * the aggregation is in ERROR.
+ * <p>
+ * <ul>
+ * <li>{@link #PASSED}: the test succeeded</li>
+ * <li>{@link #FAILED}: the test could run, but did not reach the expected
+ * result</li>
+ * <li>{@link #ERROR}: an error during the test run prevented to get a
+ * significant information on the tested system.</li>
+ * </ul>
+ * </p>
+ */
+public interface TestStatus {
+ /** The flag for a passed test: 0 */
+ public final static Integer PASSED = 0;
+ /** The flag for a failed test: 1 */
+ public final static Integer FAILED = 1;
+ /**
+ * The flag for a test which could not properly run because of an error
+ * (there is no feedback on the behavior of the tested component): 2
+ */
+ public final static Integer ERROR = 2;
+ public final static String STATUSSTR_PASSED = "PASSED";
+ public final static String STATUSSTR_FAILED = "FAILED";
+ public final static String STATUSSTR_ERROR = "ERROR";
+
+}
--- /dev/null
+package org.argeo.api.slc.test;
+
+import org.argeo.api.slc.deploy.DeployedSystem;
+
+/** Test run whose various components can be externally set. */
+public interface WritableTestRun extends ExecutableTestRun {
+ public void setDeployedSystem(DeployedSystem deployedSystem);
+
+ public void setTestData(TestData testData);
+
+ public void setTestDefinition(TestDefinition testDefinition);
+
+ public void setTestResult(TestResult testResult);
+}
--- /dev/null
+package org.argeo.api.slc.test.context;\r
+\r
+import java.util.Map;\r
+\r
+/** Access to an SLC test context that is, maps of reached and expected values. */\r
+public interface ContextAware {\r
+ public final static String DEFAULT_SKIP_FLAG = "!";\r
+ public final static String DEFAULT_ANY_FLAG = "*";\r
+\r
+ /** Retrieves reached values. */\r
+ public Map<String, Object> getValues();\r
+\r
+ /** Set reached values. */\r
+ public void setValues(Map<String, Object> values);\r
+\r
+ /** Retrieves expected values. */\r
+ public Map<String, Object> getExpectedValues();\r
+\r
+ public String getContextSkipFlag();\r
+\r
+ public String getContextAnyFlag();\r
+}\r
--- /dev/null
+package org.argeo.api.slc.test.context;\r
+\r
+import java.util.Collection;\r
+\r
+public interface ParentContextAware extends ContextAware {\r
+ public Collection<ContextAware> getChildContexts();\r
+\r
+ public void addChildContext(ContextAware contextAware);\r
+}\r
--- /dev/null
+<html>\r
+<head></head>\r
+<body>\r
+Context variables to be passed between parts of tests.\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<html>\r
+<head></head>\r
+<body>\r
+SLC Test: test of software systems.\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.argeo.rt.cms</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <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>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
--- /dev/null
+Bundle-Activator: org.argeo.init.osgi.SubFrameworkActivator
+
+#Import-Package:\
+#org.eclipse.osgi.launch;resolution:=optional,\
+#*
+
+#org.argeo.api.cms,\
+#org.argeo.api.cms.directory,\
+#org.argeo.api.cms.keyring,\
+#org.argeo.api.cms.transaction,\
+#org.argeo.api.cms.ux,\
--- /dev/null
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null
+argeo.osgi.sources=\
+a2+reference:///\
+?osgi=equinox\
+&crypto=fips\
+&swt=rap\
+&exclude=org.argeo.tp\
+&exclude=org.argeo.tp.sys\
+&exclude=org.argeo.tp.httpd\
+&exclude=org.argeo.tp.sshd\
+
+argeo.http.port=7070
+argeo.ssh.port=2222
+
+argeo.osgi.start.2=\
+org.eclipse.equinox.http.servlet,\
+org.apache.felix.scr,\
+org.eclipse.equinox.console,\
+org.eclipse.rap.rwt.osgi,\
+
+argeo.osgi.start.3=\
+org.argeo.cms,\
+org.argeo.cms.ee,\
+org.argeo.cms.lib.sshd,\
+org.argeo.cms.lib.equinox,\
+org.argeo.cms.lib.jetty,\
+org.argeo.cms.swt.rap,\
+
+argeo.osgi.start.4=\
+org.argeo.cms.jcr
+
+argeo.osgi.start.5=\
+org.argeo.app.profile.acr.fs,\
+org.argeo.app.core,\
+org.argeo.app.jcr,\
+org.argeo.app.ui,\
+org.argeo.app.theme.default,\
+org.argeo.app.geo,\
+
+
+osgi.clean=true
+
+org.osgi.framework.system.packages.extra=\
+com.sun.jna,\
+com.sun.jna.internal,\
+com.sun.jna.ptr,\
+com.sun.jna.win32,\
+org.eclipse.angus.mail.mbox,\
+org.apache.tomcat.jni,\
+sun.security.util,\
+sun.security.internal.spec,\
+sun.security.provider,\
+sun.awt.X11,\
+com.sun.net.httpserver,\
+com.sun.jndi.ldap,\
+com.sun.jndi.ldap.sasl,\
+com.sun.jndi.dns,\
+com.sun.security.jgss,\
+com.sun.nio.file,\
+com.sun.nio.sctp
+
+## Launch context
+osgi.framework.useSystemProperties=false
+osgi.frameworkParentClassloader=app
+osgi.parentClassLoader=app
+osgi.contextClassLoaderParent=app
+
+# Disable Equinox Jetty autostart
+org.eclipse.equinox.http.jetty.autostart=false
+
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.api</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.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-/MANIFEST.MF
+++ /dev/null
-bin.includes = META-INF/,.\r
-source..=src/\r
+++ /dev/null
-package org.argeo.slc;
-
-import java.io.Serializable;
-
-/** @deprecated use {@link DefaultNameVersion} instead. */
-@Deprecated
-public class BasicNameVersion extends DefaultNameVersion implements
- Serializable {
- private static final long serialVersionUID = -5127304279136195127L;
-
- public BasicNameVersion() {
- }
-
- /** Interprets string in OSGi-like format my.module.name;version=0.0.0 */
- public BasicNameVersion(String nameVersion) {
- int index = nameVersion.indexOf(";version=");
- if (index < 0) {
- setName(nameVersion);
- setVersion(null);
- } else {
- setName(nameVersion.substring(0, index));
- setVersion(nameVersion.substring(index + ";version=".length()));
- }
- }
-
- public BasicNameVersion(String name, String version) {
- super(name, version);
- }
-
- public BasicNameVersion(NameVersion nameVersion) {
- super(nameVersion);
- }
-}
+++ /dev/null
-package org.argeo.slc;
-
-/**
- * Adds a dimension to {@link NameVersion} by adding an arbitrary category (e.g.
- * Maven groupId, yum repository ID, etc.)
- */
-public interface CategoryNameVersion extends NameVersion {
- /** The category of the component. */
- String getCategory();
-
- static CategoryNameVersion parseCategoryNameVersion(String str) {
- if (str == null || "".equals(str.trim()))
- throw new IllegalArgumentException("At least one character required.");
- String[] arr = str.trim().split(":");
- if (arr.length > 3)
- throw new IllegalArgumentException(str + " does not respect the [category]:[name]:[version] pattern");
- DefaultCategoryNameVersion res = new DefaultCategoryNameVersion();
- res.setCategory(arr[0]);
- if (arr.length > 1)
- res.setName(arr[1]);
- if (arr.length > 2)
- res.setVersion(arr[2]);
- return res;
- }
-}
+++ /dev/null
-package org.argeo.slc;
-
-/** Binary check on an arbitrary object. */
-public interface Condition<T> {
- /**
- * Checks the condition.
- *
- * @return true, if the condition is verified, false if not.
- */
- public Boolean check(T obj);
-}
+++ /dev/null
-package org.argeo.slc;
-
-/** Canonical implementation of {@link CategoryNameVersion} */
-public class DefaultCategoryNameVersion extends DefaultNameVersion implements CategoryNameVersion {
- private String category;
-
- public DefaultCategoryNameVersion() {
- }
-
- public DefaultCategoryNameVersion(String category, String name, String version) {
- super(name, version);
- this.category = category;
- }
-
- public DefaultCategoryNameVersion(String category, NameVersion nameVersion) {
- super(nameVersion);
- this.category = category;
- }
-
- @Override
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- @Override
- public String toString() {
- return category + ":" + super.toString();
- }
-
-}
+++ /dev/null
-package org.argeo.slc;
-
-
-/** Canonical implementation of {@link NameVersion} */
-public class DefaultNameVersion implements NameVersion,
- Comparable<NameVersion> {
- private String name;
- private String version;
-
- public DefaultNameVersion() {
- }
-
- /** Interprets string in OSGi-like format my.module.name;version=0.0.0 */
- public DefaultNameVersion(String nameVersion) {
- int index = nameVersion.indexOf(";version=");
- if (index < 0) {
- setName(nameVersion);
- setVersion(null);
- } else {
- setName(nameVersion.substring(0, index));
- setVersion(nameVersion.substring(index + ";version=".length()));
- }
- }
-
- public DefaultNameVersion(String name, String version) {
- this.name = name;
- this.version = version;
- }
-
- public DefaultNameVersion(NameVersion nameVersion) {
- this.name = nameVersion.getName();
- this.version = nameVersion.getVersion();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof NameVersion) {
- NameVersion nameVersion = (NameVersion) obj;
- return name.equals(nameVersion.getName())
- && version.equals(nameVersion.getVersion());
- } else
- return false;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public String toString() {
- return name + ":" + version;
- }
-
- public int compareTo(NameVersion o) {
- if (o.getName().equals(name))
- return version.compareTo(o.getVersion());
- else
- return name.compareTo(o.getName());
- }
-}
+++ /dev/null
-package org.argeo.slc;
-
-public enum ManifestConstants {
- // OSGi
- BUNDLE_SYMBOLICNAME("Bundle-SymbolicName"), //
- BUNDLE_VERSION("Bundle-Version"), //
- BUNDLE_LICENSE("Bundle-License"), //
- EXPORT_PACKAGE("Export-Package"), //
- IMPORT_PACKAGE("Import-Package"), //
- // JAVA
- AUTOMATIC_MODULE_NAME("Automatic-Module-Name"), //
- // SLC
- SLC_CATEGORY("SLC-Category"), //
- SLC_ORIGIN_M2("SLC-Origin-M2"), //
- SLC_ORIGIN_M2_MERGE("SLC-Origin-M2-Merge"), //
- SLC_ORIGIN_M2_REPO("SLC-Origin-M2-Repo"), //
- SLC_ORIGIN_MANIFEST_NOT_MODIFIED("SLC-Origin-ManifestNotModified"), //
- SLC_ORIGIN_URI("SLC-Origin-URI"),//
- ;
-
- final String value;
-
- private ManifestConstants(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return value;
- }
-
-}
+++ /dev/null
-package org.argeo.slc;
-
-import java.util.Iterator;
-
-/** A set of {@link NameVersion}. */
-public interface ModuleSet {
- Iterator<? extends NameVersion> nameVersions();
-}
+++ /dev/null
-package org.argeo.slc;
-
-/**
- * Abstraction of a name / version pair, typically used as coordinates for a
- * software module either deployed or packaged as an archive.
- */
-public interface NameVersion {
- /** The name of the component. */
- String getName();
-
- /** The version of the component. */
- String getVersion();
-
- /**
- * The forward compatible branch of this version, by default it is
- * [major].[minor].
- */
- default String getBranch() {
- String[] parts = getVersion().split("\\.");
- if (parts.length < 2)
- throw new IllegalStateException("Version " + getVersion() + " cannot be interpreted as branch.");
- return parts[0] + "." + parts[1];
- }
-}
+++ /dev/null
-package org.argeo.slc;
-
-/** Constants useful across all SLC components */
-public interface SlcConstants {
- /** Read-write role. */
- public final static String ROLE_SLC = "cn=org.argeo.slc.user,ou=roles,ou=node";
-
- /** Read only unlogged user */
- public final static String USER_ANONYMOUS = "anonymous";
-}
+++ /dev/null
-package org.argeo.slc;
-
-/** Basis for all SLC exceptions. This is an unchecked exception. */
-public class SlcException extends RuntimeException {
- private static final long serialVersionUID = 6373738619304106445L;
-
- /** Constructor. */
- public SlcException(String message) {
- super(message);
- }
-
- /** Constructor. */
- public SlcException(String message, Throwable e) {
- super(message, e);
- }
-
-}
+++ /dev/null
-package org.argeo.slc;
-
-/** JCR names used by SLC */
-public interface SlcNames {
- public final static String SLC_ = "slc:";
-
- /*
- * GENERAL
- */
- public final static String SLC_UUID = "slc:uuid";
- public final static String SLC_STATUS = "slc:status";
- // generic name for result parts of a given test result (slc:testResult)
- // note that corresponding nodes can be retrieved using
- // myTestResultNode.getNodes(SLC_RESULT_PART+"*") method
- public final static String SLC_RESULT_PART = "slc:resultPart";
- // Fixed name of the child node of a slc:testResult of type
- // slc:check that aggregate status of all result parts of a given test
- // result
- public final static String SLC_AGGREGATED_STATUS = "slc:aggregatedStatus";
-
- public final static String SLC_TYPE = "slc:type";
- public final static String SLC_NAME = "slc:name";
- public final static String SLC_VERSION = "slc:version";
- public final static String SLC_CATEGORY = "slc:category";
- public final static String SLC_VALUE = "slc:value";
- public final static String SLC_ADDRESS = "slc:address";
- public final static String SLC_METADATA = "slc:metadata";
-
- public final static String SLC_TIMESTAMP = "slc:timestamp";
- public final static String SLC_STARTED = "slc:started";
- public final static String SLC_COMPLETED = "slc:completed";
-
- public final static String SLC_VM = "slc:vm";
- /*
- * SLC RUNTIME
- */
- // execution
- public final static String SLC_SPEC = "slc:spec";
- public final static String SLC_EXECUTION_SPECS = "slc:executionSpecs";
- public final static String SLC_FLOW = "slc:flow";
- public final static String SLC_LOG = "slc:log";
- public final static String SLC_AGENTS = "slc:agents";
-
- // spec attribute
- public final static String SLC_IS_IMMUTABLE = "slc:isImmutable";
- public final static String SLC_IS_CONSTANT = "slc:isConstant";
- public final static String SLC_IS_HIDDEN = "slc:isHidden";
-
- // base directories
- public final static String SLC_SYSTEM = "slc:system";
- public final static String SLC_RESULTS = "slc:results";
- public final static String SLC_MY_RESULTS = "slc:myResults";
- public final static String SLC_PROCESSES = "slc:processes";
-
- // result
- public final static String SLC_SUCCESS = "slc:success";
- public final static String SLC_MESSAGE = "slc:message";
- public final static String SLC_TAG = "slc:tag";
- public final static String SLC_ERROR_MESSAGE = "slc:errorMessage";
- public final static String SLC_TEST_CASE = "slc:testCase";
- public final static String SLC_TEST_CASE_TYPE = "slc:testCaseType";
-
- // diff result
- public final static String SLC_SUMMARY = "slc:summary";
- public final static String SLC_ISSUES = "slc:issues";
-
- /*
- * SLC REPO
- */
- // shared
- public final static String SLC_URL = "slc:url";
- public final static String SLC_OPTIONAL = "slc:optional";
- public final static String SLC_AS_STRING = "slc:asString";
-
- // origin
- public final static String SLC_ORIGIN = "slc:origin";
- public final static String SLC_PROXY = "slc:proxy";
-
- // slc:artifact
- public final static String SLC_ARTIFACT_ID = "slc:artifactId";
- public final static String SLC_GROUP_ID = "slc:groupId";
- public final static String SLC_GROUP_BASE_ID = "slc:groupBaseId";
- public final static String SLC_ARTIFACT_VERSION = "slc:artifactVersion";
- public final static String SLC_ARTIFACT_EXTENSION = "slc:artifactExtension";
- public final static String SLC_ARTIFACT_CLASSIFIER = "slc:artifactClassifier";
-
- // slc:jarArtifact
- public final static String SLC_MANIFEST = "slc:manifest";
-
- // shared OSGi
- public final static String SLC_SYMBOLIC_NAME = "slc:symbolic-name";
- public final static String SLC_BUNDLE_VERSION = "slc:bundle-version";
-
- // slc:osgiBaseVersion
- public final static String SLC_MAJOR = "slc:major";
- public final static String SLC_MINOR = "slc:minor";
- public final static String SLC_MICRO = "slc:micro";
- // slc:osgiVersion
- public final static String SLC_QUALIFIER = "slc:qualifier";
-
- // slc:exportedPackage
- public final static String SLC_USES = "slc:uses";
-
- // slc:modularDistribution
- public final static String SLC_MODULES = "slc:modules";
-
- // RPM
- // slc:rpm
- public final static String SLC_RPM_VERSION = "slc:rpmVersion";
- public final static String SLC_RPM_RELEASE = "slc:rpmRelease";
- public final static String SLC_RPM_ARCH = "slc:rpmArch";
- public final static String SLC_RPM_ARCHIVE_SIZE = "slc:rpmArchiveSize";
-}
+++ /dev/null
-package org.argeo.slc;
-
-/** JCR node types used by SLC */
-public interface SlcTypes {
-
- public final static String SLC_NAME_VERSION = "slc:nameVersion";
- public final static String SLC_CATEGORIZED_NAME_VERSION = "slc:categorizedNameVersion";
-
- public final static String SLC_AGENT_FACTORY = "slc:agentFactory";
- public final static String SLC_AGENT = "slc:agent";
- public final static String SLC_MODULE = "slc:module";
- public final static String SLC_EXECUTION_MODULE = "slc:executionModule";
- public final static String SLC_EXECUTION_SPEC = "slc:executionSpec";
- public final static String SLC_EXECUTION_FLOW = "slc:executionFlow";
- public final static String SLC_PROCESS = "slc:process";
- public final static String SLC_REALIZED_FLOW = "slc:realizedFlow";
-
- public final static String SLC_EXECUTION_SPEC_ATTRIBUTE = "slc:executionSpecAttribute";
- public final static String SLC_PRIMITIVE_SPEC_ATTRIBUTE = "slc:primitiveSpecAttribute";
- public final static String SLC_REF_SPEC_ATTRIBUTE = "slc:refSpecAttribute";
-
- public final static String SLC_TEST_RESULT = "slc:testResult";
- public final static String SLC_CHECK = "slc:check";
- public final static String SLC_PROPERTY = "slc:property";
- public final static String SLC_DIFF_RESULT = "slc:diffResult";
-
- // Node types used for user defined and managed result UI tree
- public final static String SLC_MY_RESULT_ROOT_FOLDER = "slc:myResultRootFolder";
- public final static String SLC_RESULT_FOLDER = "slc:resultFolder";
-
- // Log levels
- public final static String SLC_LOG_ENTRY = "slc:logEntry";
- public final static String SLC_LOG_TRACE = "slc:logTrace";
- public final static String SLC_LOG_DEBUG = "slc:logDebug";
- public final static String SLC_LOG_INFO = "slc:logInfo";
- public final static String SLC_LOG_WARNING = "slc:logWarning";
- public final static String SLC_LOG_ERROR = "slc:logError";
-
- /*
- * REPO
- */
- public final static String SLC_ARTIFACT = "slc:artifact";
- public final static String SLC_ARTIFACT_VERSION_BASE = "slc:artifactVersion";
- public final static String SLC_ARTIFACT_BASE = "slc:artifactBase";
- public final static String SLC_GROUP_BASE = "slc:groupBase";
- public final static String SLC_JAR_FILE = "slc:jarFile";
- public final static String SLC_BUNDLE_ARTIFACT = "slc:bundleArtifact";
- public final static String SLC_OSGI_VERSION = "slc:osgiVersion";
- public final static String SLC_JAVA_PACKAGE = "slc:javaPackage";
- public final static String SLC_EXPORTED_PACKAGE = "slc:exportedPackage";
- public final static String SLC_IMPORTED_PACKAGE = "slc:importedPackage";
- public final static String SLC_DYNAMIC_IMPORTED_PACKAGE = "slc:dynamicImportedPackage";
- public final static String SLC_REQUIRED_BUNDLE = "slc:requiredBundle";
- public final static String SLC_FRAGMENT_HOST = "slc:fragmentHost";
-
- // Distribution management
- // public final static String SLC_CATEGORY = "slc:category";
- public final static String SLC_MODULAR_DISTRIBUTION_BASE = "slc:modularDistributionBase";
- public final static String SLC_MODULAR_DISTRIBUTION = "slc:modularDistribution";
- public final static String SLC_MODULE_COORDINATES = "slc:moduleCoordinates";
-
- // origin
- public final static String SLC_KNOWN_ORIGIN = "slc:knownOrigin";
- public final static String SLC_PROXIED = "slc:proxied";
-
- // rpm
- public final static String SLC_RPM = "slc:rpm";
-}
+++ /dev/null
-package org.argeo.slc;
-
-import java.io.InputStream;
-
-public interface StreamReadable {
- public InputStream getInputStream();
-}
+++ /dev/null
-package org.argeo.slc;
-
-/** Exception for unsupported features or actions. */
-public class UnsupportedException extends SlcException {
- static final long serialVersionUID = 1l;
-
- /** Action not supported. */
- public UnsupportedException() {
- this("Action not supported");
- }
-
- /** Constructor with a message. */
- public UnsupportedException(String message) {
- super(message);
- }
-
- /**
- * Constructor generating a message.
- *
- * @param nature
- * the nature of the unsupported object
- * @param obj
- * the object itself (its class name will be used in message)
- */
- public UnsupportedException(String nature, Object obj) {
- super("Unsupported " + nature + ": "
- + (obj != null ? obj.getClass() : "[object is null]"));
- }
-
- /**
- * Constructor generating a message.
- *
- * @param nature
- * the nature of the unsupported object
- * @param clss
- * the class itself (will be used in message)
- */
- public UnsupportedException(String nature, Class<?> clss) {
- super("Unsupported " + nature + ": " + clss);
- }
-
- /**
- * Constructor generating a message.
- *
- * @param nature
- * the nature of the unsupported object
- * @param value
- * the problematic value itself
- */
- public UnsupportedException(String nature, String value) {
- super("Unsupported " + nature + ": " + value);
- }
-
-}
+++ /dev/null
-package org.argeo.slc;
-
-/**
- * Centralises constant values related to software systems, which are well
- * defined and not expected to change within a major version cycle of SLC, but
- * which are not necessarily defined in core Java.
- */
-public interface WellKnownConstants {
-
- /*
- * OSGi
- */
- final static String OSGI_INSTANCE_AREA = "osgi.instance.area";
- final static String OSGI_CONFIGURATION_AREA = "osgi.configuration.area";
-
-// final static String OSGI_HTTP_PORT = "org.osgi.service.http.port";
-}
+++ /dev/null
-package org.argeo.slc.attachment;
-
-public interface Attachment {
- public String getUuid();
-
- public void setUuid(String uuid);
-
- public String getName();
-
- public String getContentType();
-}
+++ /dev/null
-package org.argeo.slc.attachment;
-
-public interface AttachmentsEnabled {
- public void addAttachment(Attachment attachment);
-}
+++ /dev/null
-package org.argeo.slc.attachment;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public interface AttachmentsStorage {
- public void retrieveAttachment(Attachment attachment,
- OutputStream outputStream);
-
- /** Does NOT close the provided input stream. */
- public void storeAttachment(Attachment attachment, InputStream inputStream);
-}
+++ /dev/null
-package org.argeo.slc.build;\r
-\r
-/** A packaged software component */\r
-public interface Distribution {\r
- public String getDistributionId();\r
-\r
-}\r
+++ /dev/null
-package org.argeo.slc.build;
-
-/** A software license */
-public interface License {
- public String getName();
-
- public String getUri();
-
- public String getLink();
-
- public String getText();
-}
+++ /dev/null
-package org.argeo.slc.build;
-
-import org.argeo.slc.ModuleSet;
-import org.argeo.slc.NameVersion;
-
-/**
- * A distribution of modules, that is components that can be identified by a
- * name / version couple.
- *
- * @see NameVersion
- */
-public interface ModularDistribution extends Distribution, NameVersion,
- ModuleSet {
- public Distribution getModuleDistribution(String moduleName,
- String moduleVersion);
-
- /** A descriptor such as P2, OBR or yum metadata. */
- public Object getModulesDescriptor(String descriptorType);
-}
+++ /dev/null
-<html>\r
-<head></head>\r
-<body>\r
-SLC Build: building of software systems.\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package org.argeo.slc.deploy;
-
-import java.io.File;
-import java.util.Map;
-
-public interface DeployEnvironment {
- public void unpackTo(Object packg, File targetLocation,
- Map<String, String> filter);
-}
+++ /dev/null
-package org.argeo.slc.deploy;\r
-\r
-import org.argeo.slc.build.Distribution;\r
-\r
-/** An instance of a software system. */\r
-public interface DeployedSystem extends TargetData {\r
- /** Unique ID for this system instance. */\r
- public String getDeployedSystemId();\r
-\r
- /** Underlying packages */\r
- public Distribution getDistribution();\r
-\r
- /** Data required to initialize the instance (e.g. DB dump, etc.). */\r
- public DeploymentData getDeploymentData();\r
-\r
- /** Resources required by the system (ports, disk location, etc.) */\r
- public TargetData getTargetData();\r
-}\r
+++ /dev/null
-package org.argeo.slc.deploy;
-
-public interface DeployedSystemManager<T extends DeployedSystem> {
- public void setDeployedSystem(T deployedSystem);
-}
+++ /dev/null
-package org.argeo.slc.deploy;\r
-\r
-import org.argeo.slc.build.Distribution;\r
-\r
-public interface Deployment extends Runnable{\r
- public DeployedSystem getDeployedSystem();\r
-\r
- public void setTargetData(TargetData targetData);\r
-\r
- public void setDeploymentData(DeploymentData deploymentData);\r
-\r
- public void setDistribution(Distribution distribution);\r
-}\r
+++ /dev/null
-package org.argeo.slc.deploy;\r
-\r
-public interface DeploymentData {\r
-\r
-}\r
+++ /dev/null
-package org.argeo.slc.deploy;
-
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.build.Distribution;
-
-public interface DynamicRuntime<M extends Module> extends
- ModularDeployedSystem<M> {
- public void shutdown();
-
- public M installModule(Distribution distribution);
-
- public void uninstallModule(NameVersion nameVersion);
-
- public void updateModule(NameVersion nameVersion);
-
- public void startModule(NameVersion nameVersion);
-
-}
+++ /dev/null
-package org.argeo.slc.deploy;
-
-public interface InstalledExecutables extends DeployedSystem {
- public String getExecutablePath(String key);
-}
+++ /dev/null
-package org.argeo.slc.deploy;
-
-import java.util.List;
-
-public interface ModularDeployedSystem<M extends Module> extends DeployedSystem {
- /** List the underlying deployed modules (in real time) */
- public List<M> listModules();
-}
+++ /dev/null
-package org.argeo.slc.deploy;
-
-import org.argeo.slc.NameVersion;
-
-/**
- * Represents a deployed module of a broader deployed system. A module is
- * uniquely identifiable via a name / version.
- */
-public interface Module extends DeployedSystem, NameVersion {
- /** A serializable stateless description of the module */
- public ModuleDescriptor getModuleDescriptor();
-}
+++ /dev/null
-package org.argeo.slc.deploy;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.argeo.slc.DefaultNameVersion;
-
-/** The description of a versioned module. */
-public class ModuleDescriptor extends DefaultNameVersion implements Serializable {
- private static final long serialVersionUID = 4310820315478645419L;
- private String title;
- private String description;
- private Map<String, String> metadata = new HashMap<String, String>();
- private Boolean started = false;
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- /** @deprecated use {@link #getTitle()} instead */
- public String getLabel() {
- return title;
- }
-
- /** @deprecated use {@link #setTitle(String)} instead */
- public void setLabel(String label) {
- this.title = label;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public Boolean getStarted() {
- return started;
- }
-
- public void setStarted(Boolean started) {
- this.started = started;
- }
-
-}
+++ /dev/null
-package org.argeo.slc.deploy;
-
-import java.util.List;
-
-import org.argeo.slc.NameVersion;
-
-/** Provides access to deployed modules */
-public interface ModulesManager {
- /** @return a full fledged module descriptor. */
- public ModuleDescriptor getModuleDescriptor(String moduleName,
- String version);
-
- /**
- * @return a list of minimal module descriptors of the deployed modules
- */
- public List<ModuleDescriptor> listModules();
-
- /** Synchronously upgrades the module referenced by this name version */
- public void upgrade(NameVersion nameVersion);
-
- /** Starts the module */
- public void start(NameVersion nameVersion);
-
- /** Stops the module */
- public void stop(NameVersion nameVersion);
-}
+++ /dev/null
-package org.argeo.slc.deploy;\r
-\r
-public interface TargetData {\r
-\r
-}\r
+++ /dev/null
-package org.argeo.slc.deploy;\r
-\r
-import java.io.File;\r
-import java.io.OutputStream;\r
-import java.util.List;\r
-\r
-/** Abstracts common versioning operations */\r
-public interface VersioningDriver {\r
- public void getFileFromRepository(String repositoryBaseUrl,\r
- String location, OutputStream out);\r
-\r
- public List<String> getChangedPaths(File repositoryRoot, Long revision);\r
-\r
- public String getRepositoryRoot(String repositoryUrl);\r
-\r
- public String getRelativePath(String repositoryUrl);\r
-\r
- public void updateToHead(File fileOrDir);\r
-\r
- public void importFileOrDir(String repositoryUrl, File fileOrDir);\r
-\r
- /**\r
- * Checks out or update this versioned directory\r
- * \r
- * @return true if the content has changed, false otherwise\r
- */\r
- public Boolean checkout(String repositoryUrl, File destDir,\r
- Boolean recursive);\r
-\r
- public void createRepository(String filePath);\r
-\r
- public void commit(File fileOrDir, String commitMessage);\r
-}\r
+++ /dev/null
-<html>\r
-<head></head>\r
-<body>\r
-SLC Deploy: deployment of software systems.\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.io.Serializable;
-
-/** Value to be used by an execution */
-public abstract class AbstractExecutionValue implements Serializable {
- private static final long serialVersionUID = 1558444746120706961L;
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.io.Serializable;
-
-/** Canonical implementation of the execution spec attribute booleans. */
-public abstract class AbstractSpecAttribute implements ExecutionSpecAttribute,
- Serializable {
- private static final long serialVersionUID = 6494963738891709440L;
- private Boolean isImmutable = false;
- private Boolean isConstant = false;
- private Boolean isHidden = false;
-
- private String description;
-
- /** Has to be set at instantiation */
- public Boolean getIsImmutable() {
- return isImmutable;
- }
-
- public void setIsImmutable(Boolean isImmutable) {
- this.isImmutable = isImmutable;
- }
-
- /** Cannot be overridden at runtime */
- public Boolean getIsConstant() {
- return isConstant;
- }
-
- public void setIsConstant(Boolean isConstant) {
- this.isConstant = isConstant;
- }
-
- /** Should not be shown to the end user */
- public Boolean getIsHidden() {
- return isHidden;
- }
-
- public void setIsHidden(Boolean isHidden) {
- this.isHidden = isHidden;
- }
-
- /*
- * DEPRECATED
- */
- /** @deprecated use {@link #getIsImmutable()} instead */
- public Boolean getIsParameter() {
- return isImmutable;
- }
-
- /** @deprecated use {@link #getIsConstant()} instead */
- public Boolean getIsFrozen() {
- return isConstant;
- }
-
- /** @deprecated use {@link #setIsImmutable(Boolean)} instead */
- public void setIsParameter(Boolean isParameter) {
- this.isImmutable = isParameter;
- }
-
- /** @deprecated use {@link #setIsConstant(Boolean)} instead */
- public void setIsFrozen(Boolean isFrozen) {
- this.isConstant = isFrozen;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDescription() {
- return description;
- }
-
-}
+++ /dev/null
-package org.argeo.slc.execution;\r
-\r
-/** Variables or references attached to an execution (typically thread bounded).*/\r
-public interface ExecutionContext {\r
- public final static String VAR_EXECUTION_CONTEXT_ID = "slcVar.executionContext.id";\r
- public final static String VAR_EXECUTION_CONTEXT_CREATION_DATE = "slcVar.executionContext.creationDate";\r
- public final static String VAR_FLOW_ID = "slcVar.flow.id";\r
- public final static String VAR_FLOW_NAME = "slcVar.flow.name";\r
-\r
- public String getUuid();\r
-\r
- /** @return the variable value, or <code>null</code> if not found. */\r
- public Object getVariable(String key);\r
-\r
- public void setVariable(String key, Object value);\r
- \r
- public void beforeFlow(ExecutionFlow executionFlow);\r
- \r
- public void afterFlow(ExecutionFlow executionFlow);\r
-}\r
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.Iterator;
-
-/** Abstraction of an execution that can be identified and configured. */
-public interface ExecutionFlow extends Runnable {
- /** Retrieve an immutable parameter */
- public Object getParameter(String key);
-
- /** Whether this immutable parameter is set */
- public Boolean isSetAsParameter(String key);
-
- /** The specifications of the execution flow. */
- public ExecutionSpec getExecutionSpec();
-
- /**
- * List sub-runnables that would be executed if run() method would be
- * called.
- */
- public Iterator<Runnable> runnables();
-
- /**
- * If there is one and only one runnable wrapped return it, throw an
- * exception otherwise.
- */
- public Runnable getRunnable();
-
- /**
- * The name of this execution flow. Can contains '/' which will be
- * interpreted by UIs as a hierarchy;
- */
- public String getName();
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- *
- * Implements both archetype and implementation of a given process.
- *
- * At specification time, <code>executionSpec</code> represents the spec of the
- * parameters accepted by the process, with, among others: type, default value
- * and, optionally, possible values for each parameter. Thus ExecutionSpec might
- * be a huge object. Note that when marshalling only a reference to a specific
- * ExecutionSpec is stored in the XML to optimize performance and avoid
- * redundancy between various ExecutionFlowDesciptor that might have the same
- * ExecutionSpec.
- *
- * At runtime, we build a RealizedFlow which references an
- * ExecutionFlowDescriptor. As it happens AFTER marshalling / unmarshalling
- * process, the ExecutionSpec is null but we manage to retrieve the
- * ExecutionSpec and store it in the RealizedFlow, whereas set values of the
- * parameters are stored in the <code>values</code> map.
- *
- * Generally, values object are either a <code>PrimitiveAccessor</code> or a
- * <code>RefValue</code> but can be other objects.
- */
-public class ExecutionFlowDescriptor implements Serializable, Cloneable {
- private static final long serialVersionUID = 7101944857038041216L;
- private String name;
- private String description;
- private String path;
- private Map<String, Object> values;
- private ExecutionSpec executionSpec;
-
- public ExecutionFlowDescriptor() {
- }
-
- public ExecutionFlowDescriptor(String name, String description,
- Map<String, Object> values, ExecutionSpec executionSpec) {
- this.name = name;
- this.values = values;
- this.executionSpec = executionSpec;
- }
-
- /** The referenced {@link ExecutionSpec} is NOT cloned. */
- @Override
- protected Object clone() throws CloneNotSupportedException {
- return new ExecutionFlowDescriptor(name, description,
- new HashMap<String, Object>(values), executionSpec);
- }
-
- public String getName() {
- return name;
- }
-
- /**
- * @deprecated will be removed in SLC 2.x, the path should be the part of
- * the name with '/'
- */
- public String getPath() {
- return path;
- }
-
- /**
- * @deprecated will be removed in SLC 2.0, the path should be the part of
- * the name with '/'
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- public Map<String, Object> getValues() {
- return values;
- }
-
- public ExecutionSpec getExecutionSpec() {
- return executionSpec;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setValues(Map<String, Object> values) {
- this.values = values;
- }
-
- public void setExecutionSpec(ExecutionSpec executionSpec) {
- this.executionSpec = executionSpec;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof ExecutionFlowDescriptor)
- return name.equals(((ExecutionFlowDescriptor) obj).getName());
- return false;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public String toString() {
- return (path != null && !path.trim().equals("") ? path + "/" : "")
- + name;
- }
-
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.Map;
-
-/**
- * Maps back and forth between {@link ExecutionFlowDescriptor} and
- * {@link ExecutionFlow}
- */
-public interface ExecutionFlowDescriptorConverter {
- public Map<String, Object> convertValues(
- ExecutionFlowDescriptor executionFlowDescriptor);
-
- public void addFlowsToDescriptor(ExecutionModuleDescriptor md,
- Map<String, ExecutionFlow> executionFlows);
-
- public ExecutionFlowDescriptor getExecutionFlowDescriptor(
- ExecutionFlow executionFlow);
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-@Deprecated
-public interface ExecutionModule {
-/* public String getName();
-
- public String getVersion();
-
- public ExecutionModuleDescriptor getDescriptor();
-
- public void execute(ExecutionFlowDescriptor descriptor);*/
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.argeo.slc.SlcException;
-import org.argeo.slc.deploy.ModuleDescriptor;
-
-/** Describes the information required to launch a flow */
-public class ExecutionModuleDescriptor extends ModuleDescriptor {
- /** Metadata header identifying an SLC execution module */
- public final static String SLC_EXECUTION_MODULE = "SLC-ExecutionModule";
-
- private static final long serialVersionUID = -2394473464513029512L;
- private List<ExecutionSpec> executionSpecs = new ArrayList<ExecutionSpec>();
- private List<ExecutionFlowDescriptor> executionFlows = new ArrayList<ExecutionFlowDescriptor>();
-
- public List<ExecutionSpec> getExecutionSpecs() {
- return executionSpecs;
- }
-
- public List<ExecutionFlowDescriptor> getExecutionFlows() {
- return executionFlows;
- }
-
- /**
- * Returns a new {@link ExecutionModuleDescriptor} that can be used to build
- * a {@link RealizedFlow}.
- */
- public ExecutionFlowDescriptor cloneFlowDescriptor(String name) {
- ExecutionFlowDescriptor res = null;
- for (ExecutionFlowDescriptor efd : executionFlows) {
- if (efd.getName().equals(name)
- || ("/" + efd.getName()).equals(name)) {
- try {
- res = (ExecutionFlowDescriptor) efd.clone();
- } catch (CloneNotSupportedException e) {
- throw new SlcException("Cannot clone " + efd, e);
- }
- }
- }
- if (res == null)
- throw new SlcException("Flow " + name + " not found.");
- return res;
- }
-
- public RealizedFlow asRealizedFlow(String flow, Map<String, Object> values) {
- RealizedFlow realizedFlow = new RealizedFlow();
- realizedFlow.setFlowDescriptor(cloneFlowDescriptor(flow));
- realizedFlow.setModuleName(getName());
- realizedFlow.setModuleVersion(getVersion());
- realizedFlow.getFlowDescriptor().getValues().putAll(values);
- return realizedFlow;
- }
-
- public void setExecutionSpecs(List<ExecutionSpec> executionSpecs) {
- this.executionSpecs = executionSpecs;
- }
-
- public void setExecutionFlows(List<ExecutionFlowDescriptor> executionFlows) {
- this.executionFlows = executionFlows;
- }
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import org.argeo.slc.deploy.ModuleDescriptor;
-
-/** Listen to events on execution modules. */
-public interface ExecutionModulesListener {
- public void executionModuleAdded(ModuleDescriptor moduleDescriptor);
-
- public void executionModuleRemoved(ModuleDescriptor moduleDescriptor);
-
- public void executionFlowAdded(ModuleDescriptor moduleDescriptor,
- ExecutionFlowDescriptor executionFlowDescriptor);
-
- public void executionFlowRemoved(ModuleDescriptor moduleDescriptor,
- ExecutionFlowDescriptor executionFlowDescriptor);
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.List;
-
-import org.argeo.slc.deploy.ModulesManager;
-
-/** Provides access to the execution modules */
-public interface ExecutionModulesManager extends ModulesManager {
- /** Used to filter event notified to an execution notifier. */
- public static String SLC_PROCESS_ID = "slc.process.id";
-
- /** Unique launch module */
- public static String UNIQUE_LAUNCH_MODULE_PROPERTY = "slc.launch.module";
-
- /** Unique launch flow */
- public static String UNIQUE_LAUNCH_FLOW_PROPERTY = "slc.launch.flow";
-
- /** @return a full fledged module descriptor. */
- public ExecutionModuleDescriptor getExecutionModuleDescriptor(
- String moduleName, String version);
-
- /**
- * @return a list of minimal execution module descriptors (only the module
- * meta data, not the flows)
- */
- public List<ExecutionModuleDescriptor> listExecutionModules();
-
- /** Synchronously finds and executes an {@link ExecutionFlow}. */
- public void execute(RealizedFlow realizedFlow);
-
- // /** Notify of a status update status of the {@link ExecutionProcess} */
-// public void dispatchUpdateStatus(ExecutionProcess process,
-// String oldStatus, String newStatus);
- //
- // /** Notify that a step was added in an {@link ExecutionProcess} */
- // public void dispatchAddSteps(ExecutionProcess process,
- // List<ExecutionStep> steps);
- //
- // /**
- // * Register a notifier which will be notified based on the provided
- // * properties.
- // */
- // public void registerProcessNotifier(ExecutionProcessNotifier notifier,
- // Map<String, String> properties);
- //
- // /** Unregisters a notifier */
- // public void unregisterProcessNotifier(ExecutionProcessNotifier notifier,
- // Map<String, String> properties);
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.List;
-
-/**
- * A process is the functional representation of a combination of executions.
- * While an execution is the actual java code running, a process exists before,
- * during and after the execution actually took place, providing an entry point
- * for the definition of executions, their monitoring (e.g. logging) and
- * tracking. A process can be distributed or parallelized. <br/>
- * NEW => INITIALIZED => SCHEDULED => RUNNING<br/>
- * RUNNING => {COMPLETED | ERROR | KILLED}<br/>
- * {COMPLETED | ERROR | KILLED} => PURGED<br/>
- * UNKOWN : this is a bug if this status occurs<br/>
- */
-public interface ExecutionProcess {
- /** The process is not yet usable. */
- public final static String NEW = "NEW";
- /** The process is usable but not yet scheduled to run. */
- public final static String INITIALIZED = "INITIALIZED";
- /** The process is usable and scheduled to run, but not yet running. */
- public final static String SCHEDULED = "SCHEDULED";
- /** The process is currently running. */
- public final static String RUNNING = "RUNNING";
- /** The process has properly completed. */
- public final static String COMPLETED = "COMPLETED";
- /** The process failed because of an unexpected error. */
- public final static String ERROR = "ERROR";
- /** The process was killed explicitly or through a crash. */
- public final static String KILLED = "KILLED";
- /** The status cannot be retrieved (probably because of unexpected errors). */
- public final static String UNKOWN = "UNKOWN";
-
- /**
- * Only a reference to the process has been kept, all monitoring data such
- * as logs have been purged.
- */
- public final static String PURGED = "PURGED";
-
- /** The UUID of this process. */
- public String getUuid();
-
- /** The current status of this process. */
- public String getStatus();
-
- /** Sets the current status of this process */
- public void setStatus(String status);
-
- public void addSteps(List<ExecutionStep> steps);
-
- public List<RealizedFlow> getRealizedFlows();
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.io.File;
-import java.nio.file.Path;
-
-/** Provides write access to resources during execution */
-public interface ExecutionResources {
- /** The base directory where this execution can write */
- public File getWritableBaseDir();
-
- /** Allocates a local file in the writable area and return it as a resource. */
- public Path getWritableResource(String relativePath);
-
- /**
- * Allocates a local file in the writable area and return it as a fully
- * qualified OS path.
- */
- public String getWritableOsPath(String relativePath);
-
- /**
- * Allocates a local file in the writable area and return it as a {@link File}.
- */
- public File getWritableOsFile(String relativePath);
-
- /**
- * Returns the resource as a file path. If the resource is not writable it is
- * copied as a file in the writable area and the path to this local file is
- * returned.
- */
- public String getAsOsPath(Path resource, Boolean overwrite);
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.Map;
-
-/**
- * The class implementing this interface defines the map of attributes that are
- * necessary for the corresponding ExecutionFlow.
- */
-public interface ExecutionSpec {
- /**
- * The name for an internal spec (for backward compatibility where a
- * non-null name is expected)
- */
- public final static String INTERNAL_NAME = "__SLC_EXECUTION_SPEC_INTERNAL";
-
- /**
- * The name identifying the execution spec within its application context.
- * Can be null. An execution spec can be referenced only if its name is not
- * null or different from {@link #INTERNAL_NAME}
- */
- public String getName();
-
- /** An optional description. Can be null. */
- public String getDescription();
-
- /** The attributes managed by this execution spec */
- public Map<String, ExecutionSpecAttribute> getAttributes();
-
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-/**
- * Possible attribute of an execution flow.
- *
- * There are mainly two implementations :<br>
- * + Primitive attributes (no predefined choice, the end user must compute a
- * String, a Float, an Integer...)<br>
- * + RefSpecAttribute which enable two things<br>
- * ++ a reference to another object of the application context<br>
- * ++ the display of some choices among which the end user can choose.<br>
- *
- * @see org.argeo.slc.core.execution.PrimitiveSpecAttribute
- * @see org.argeo.slc.core.execution.RefSpecAttribute
- * @see org.argeo.slc.core.execution.PrimitiveUtils : this class offers some
- * helper, among others to cast the various type of primitive attribute.
- */
-public interface ExecutionSpecAttribute {
- /**
- * Whether this attribute has to be set at instantiation of the flow and
- * cannot be modified afterwards. If the attribute is not immutable (that
- * is, this method returns false), it can be set at execution time.
- */
- public Boolean getIsImmutable();
-
- /**
- * Whether this attribute must be explicitly set and cannot be modified.
- * This attribute is then basically a constant within a given application
- * context. {@link #getValue()} cannot return null if the attribute is a
- * constant.
- */
- public Boolean getIsConstant();
-
- /** Whether this attribute will be hidden to end users. */
- public Boolean getIsHidden();
-
- /**
- * The default value for this attribute. Can be null, except if
- * {@link #getIsFrozen()} is <code>true</code>, in which case it represents
- * the constant value of this attribute.
- */
- public Object getValue();
-
- /** Description of this attribute, can be null */
- public String getDescription();
-
- /** @deprecated use {@link #getIsImmutable()} instead */
- public Boolean getIsParameter();
-
- /** @deprecated use {@link #getIsConstant()} instead */
- public Boolean getIsFrozen();
-
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-/** Deal with nested level of executions using different variables. */
-public interface ExecutionStack {
- /**
- * @param name
- * @return null if no object is found
- */
- public Object findScopedObject(String name);
-
- public void addScopedObject(String name, Object obj);
-
- public void enterFlow(ExecutionFlow executionFlow);
-
- /** @return internal stack level UUID. */
- public String getCurrentStackLevelUuid();
-
- public Integer getStackSize();
-
- public void leaveFlow(ExecutionFlow executionFlow);
-
- Object findLocalVariable(String key);
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.Map;
-
-public interface ExecutionStackLevel {
- public ExecutionFlow getExecutionFlow();
-
- public Map<String, Object> getScopedObjects();
-
- public String getUuid();
-
- public Map<String, Object> getLocalVariables();
-
-}
+++ /dev/null
-package org.argeo.slc.execution;\r
-\r
-import java.io.Serializable;\r
-import java.util.Date;\r
-\r
-/**\r
- * An atomic step to be notified in during an {@link ExecutionProcess}. Can be a\r
- * log or the start/end of a phase, etc.\r
- */\r
-public class ExecutionStep implements Serializable {\r
- private static final long serialVersionUID = 798640526532912161L;\r
-\r
- public final static String PHASE_START = "PHASE_START";\r
- public final static String PHASE_END = "PHASE_END";\r
- public final static String ERROR = "ERROR";\r
- public final static String WARNING = "WARNING";\r
- public final static String INFO = "INFO";\r
- public final static String DEBUG = "DEBUG";\r
- public final static String TRACE = "TRACE";\r
-\r
- /** @deprecated */\r
- public final static String START = "START";\r
- /** @deprecated */\r
- public final static String END = "END";\r
-\r
- // TODO make the fields final and private when we don't need POJO support\r
- // anymore (that\r
- // is when SlcExecutionStep is removed)\r
- protected String type;\r
- protected String thread;\r
- protected Date timestamp;\r
- protected String log;\r
-\r
- private String location;\r
-\r
- /** Empty constructor */\r
- public ExecutionStep() {\r
- Thread currentThread = Thread.currentThread();\r
- thread = currentThread.getName();\r
- }\r
-\r
- /** Creates a step at the current date */\r
- public ExecutionStep(String location, String type, String log) {\r
- this(location, new Date(), type, log);\r
- }\r
-\r
- /** Creates a step of the given type. */\r
- public ExecutionStep(String location, Date timestamp, String type,\r
- String log) {\r
- this(location, timestamp, type, log, Thread.currentThread().getName());\r
- }\r
-\r
- public ExecutionStep(String location, Date timestamp, String type,\r
- String log, String thread) {\r
- this.location = location;\r
- this.type = type;\r
- this.timestamp = timestamp;\r
- this.thread = thread;\r
- this.log = addLog(log);\r
- }\r
-\r
- public String getType() {\r
- return type;\r
- }\r
-\r
- public Date getTimestamp() {\r
- return timestamp;\r
- }\r
-\r
- public String getThread() {\r
- return thread;\r
- }\r
-\r
- /**\r
- * Return the string that should be stored in the log field. Can be null if\r
- * another mechanism is used to store log lines.\r
- */\r
- protected String addLog(String log) {\r
- return log;\r
- }\r
-\r
- public String getLog() {\r
- return log;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "Execution step, thread=" + thread + ", type=" + type;\r
- }\r
-\r
- /** Typically the logging category */\r
- public String getLocation() {\r
- return location;\r
- }\r
-\r
-}\r
+++ /dev/null
-package org.argeo.slc.execution;
-
-import org.argeo.slc.SlcException;
-
-/** The stack trace of such exceptions does not need to be displayed */
-public class FlowConfigurationException extends SlcException {
- private static final long serialVersionUID = 8456260596346797321L;
-
- public FlowConfigurationException(String message) {
- super(message);
- }
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.argeo.slc.DefaultNameVersion;
-import org.argeo.slc.NameVersion;
-
-/** A fully configured execution flow, ready to be executed. */
-public class RealizedFlow implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String moduleName;
- private String moduleVersion;
- private ExecutionFlowDescriptor flowDescriptor;
-
- public String getModuleName() {
- return moduleName;
- }
-
- public void setModuleName(String moduleName) {
- this.moduleName = moduleName;
- }
-
- public NameVersion getModuleNameVersion() {
- return new DefaultNameVersion(getModuleName(), getModuleVersion());
- }
-
- public String getModuleVersion() {
- return moduleVersion;
- }
-
- public void setModuleVersion(String moduleVersion) {
- this.moduleVersion = moduleVersion;
- }
-
- public ExecutionFlowDescriptor getFlowDescriptor() {
- return flowDescriptor;
- }
-
- public void setFlowDescriptor(ExecutionFlowDescriptor flowDescriptor) {
- this.flowDescriptor = flowDescriptor;
- }
-
- /** Create a simple realized flow */
- public static RealizedFlow create(String module, String version,
- String flowName, Map<String, String> args) {
- final RealizedFlow realizedFlow = new RealizedFlow();
- realizedFlow.setModuleName(module);
- // TODO deal with version
- if (version == null)
- version = "0.0.0";
- realizedFlow.setModuleVersion(version);
- ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor();
- efd.setName(flowName);
-
- // arguments
- if (args != null && args.size() > 0) {
- Map<String, Object> values = new HashMap<String, Object>();
- for (String key : args.keySet()) {
- String value = args.get(key);
- values.put(key, value);
- }
- efd.setValues(values);
- }
-
- realizedFlow.setFlowDescriptor(efd);
- return realizedFlow;
- }
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.util.List;
-
-/** A spec attribute whose value is a reference to a full fledged object. */
-public class RefSpecAttribute extends AbstractSpecAttribute implements
- Cloneable {
- private static final long serialVersionUID = -3427797452955753574L;
- private transient Class<?> targetClass = String.class;
- /** Read only. */
- private String targetClassName;
- private transient Object value = null;
-
- /** List to be chosen from */
- private List<RefValueChoice> choices = null;
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- /** Default is {@link String} */
- public Class<?> getTargetClass() {
- return targetClass;
- }
-
- public void setTargetClass(Class<?> targetClass) {
- this.targetClass = targetClass;
- this.targetClassName = targetClass.getName();
- }
-
- public String getTargetClassName() {
- return targetClassName;
- }
-
- /** @return can be null */
- public List<RefValueChoice> getChoices() {
- return choices;
- }
-
- public void setChoices(List<RefValueChoice> choices) {
- this.choices = choices;
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException {
- RefSpecAttribute rsa = new RefSpecAttribute();
- rsa.setTargetClass(targetClass);
- rsa.setChoices(choices);
- return rsa;
- }
-
- @Override
- public String toString() {
- return "Ref spec attribute [" + targetClass + "]"
- + (value != null ? "=" + value : "");
- }
-
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-/** Reference value to be used by an execution */
-public class RefValue extends AbstractExecutionValue {
- private static final long serialVersionUID = -8951231456757181687L;
- private String ref;
- private String type;
-
- public RefValue() {
- }
-
- public RefValue(String ref) {
- super();
- this.ref = ref;
- }
-
- public String getRef() {
- return ref;
- }
-
- public void setRef(String ref) {
- this.ref = ref;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return "Ref Value [" + type + "=" + ref + "]";
- }
-
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.io.Serializable;
-
-/** A choice of ref value to be shown to the end user. */
-public class RefValueChoice implements Serializable {
- private static final long serialVersionUID = -1133645722307507774L;
- private String name;
- private String description;
-
- public RefValueChoice() {
- }
-
- public RefValueChoice(String name, String description) {
- this.name = name;
- this.description = description;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * A local agent can run SLC processes. It is responsible for creating their
- * threads and integrating them with various UIs. It typically wraps
- * {@link ExecutionModulesManager} which is used to run flows synchronously at a
- * lower level.
- */
-public interface SlcAgent {
- /** Agent unique identifier */
- public String getAgentUuid();
-
- /** Execute / take part to this process */
- public void process(ExecutionProcess process);
-
- /**
- * Asynchronously processes the flows defined as URIs, or interpret a single
- * UUID URN as a scheduled or template process.
- *
- * @return the UUID of the process launched.
- */
- public String process(List<URI> uris);
-
- /** Kills this process */
- public void kill(String processUuid);
-
- /**
- * Wait for this process to finish. returns immediately if it does not
- * exist.
- *
- * @param millis
- * can be null
- */
- public void waitFor(String processUuid, Long millis);
-
- /**
- * Describe all the flows provided by this execution module. Typically
- * called in order to build a realized flow.
- */
- public ExecutionModuleDescriptor getExecutionModuleDescriptor(
- String moduleName, String version);
-
- /** List all execution modules which can be processed by this agent. */
- public List<ExecutionModuleDescriptor> listExecutionModuleDescriptors();
-
- /** @return true if still alive. */
- public boolean ping();
-}
+++ /dev/null
-package org.argeo.slc.execution;
-
-/**
- * Interpret a command line and run it in the underlying agent, with the proper
- * authentication.
- */
-public interface SlcAgentCli {
- /**
- * Synchronously executes.
- *
- * @return the UUID of the process
- */
- public String process(String[] args);
-}
+++ /dev/null
-<html>\r
-<head></head>\r
-<body>\r
-Common classes of teh SLC framework.\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package org.argeo.slc.primitive;
-
-/** Abstraction of access to primitive values */
-public interface PrimitiveAccessor {
- public final static String TYPE_STRING = "string";
- /**
- * As of Argeo 1, passwords are NOT stored encrypted, just hidden in the UI,
- * but stored in plain text in JCR. Use keyring instead.
- */
- public final static String TYPE_PASSWORD = "password";
- public final static String TYPE_INTEGER = "integer";
- public final static String TYPE_LONG = "long";
- public final static String TYPE_FLOAT = "float";
- public final static String TYPE_DOUBLE = "double";
- public final static String TYPE_BOOLEAN = "boolean";
-
- public String getType();
-
- public Object getValue();
-
- public void setValue(Object value);
-}
+++ /dev/null
-package org.argeo.slc.primitive;
-
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.AbstractSpecAttribute;
-
-/**
- * A spec attribute wrapping a primitive value.
- *
- * @see PrimitiveAccessor
- */
-public class PrimitiveSpecAttribute extends AbstractSpecAttribute implements
- PrimitiveAccessor {
- private static final long serialVersionUID = -566676381839825483L;
- private String type = "string";
- private Object value = null;
-
- public PrimitiveSpecAttribute() {
- }
-
- public PrimitiveSpecAttribute(String type, Object value) {
- this.type = type;
- this.value = value;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- // check whether type is recognized.
- if (PrimitiveUtils.typeAsClass(type) == null)
- throw new SlcException("Unrecognized type " + type);
- this.type = type;
-
- }
-
- @Override
- public String toString() {
- return "Primitive spec attribute [" + type + "]"
- + (value != null ? "=" + value : "");
- }
-
-}
+++ /dev/null
-package org.argeo.slc.primitive;
-
-/** Converts to and from primitive types. */
-public class PrimitiveUtils {
- /**
- * @deprecated Use {@link PrimitiveAccessor#TYPE_STRING} instead
- */
- public final static String TYPE_STRING = PrimitiveAccessor.TYPE_STRING;
- /**
- * @deprecated Use {@link PrimitiveAccessor#TYPE_INTEGER} instead
- */
- public final static String TYPE_INTEGER = PrimitiveAccessor.TYPE_INTEGER;
- /**
- * @deprecated Use {@link PrimitiveAccessor#TYPE_LONG} instead
- */
- public final static String TYPE_LONG = PrimitiveAccessor.TYPE_LONG;
- /**
- * @deprecated Use {@link PrimitiveAccessor#TYPE_FLOAT} instead
- */
- public final static String TYPE_FLOAT = PrimitiveAccessor.TYPE_FLOAT;
- /**
- * @deprecated Use {@link PrimitiveAccessor#TYPE_DOUBLE} instead
- */
- public final static String TYPE_DOUBLE = PrimitiveAccessor.TYPE_DOUBLE;
- /**
- * @deprecated Use {@link PrimitiveAccessor#TYPE_BOOLEAN} instead
- */
- public final static String TYPE_BOOLEAN = PrimitiveAccessor.TYPE_BOOLEAN;
-
- private PrimitiveUtils() {
-
- }
-
- /** @return the class or null if the provided type is not a primitive */
- public static Class<?> typeAsClass(String type) {
- if (PrimitiveAccessor.TYPE_STRING.equals(type))
- return String.class;
- else if (PrimitiveAccessor.TYPE_PASSWORD.equals(type))
- return char[].class;
- else if (PrimitiveAccessor.TYPE_INTEGER.equals(type))
- return Integer.class;
- else if (PrimitiveAccessor.TYPE_LONG.equals(type))
- return Long.class;
- else if (PrimitiveAccessor.TYPE_FLOAT.equals(type))
- return Float.class;
- else if (PrimitiveAccessor.TYPE_DOUBLE.equals(type))
- return Double.class;
- else if (PrimitiveAccessor.TYPE_BOOLEAN.equals(type))
- return Boolean.class;
- else
- return null;
- }
-
- /** @return the type or null if the provided class is not a primitive */
- public static String classAsType(Class<?> clss) {
- if (String.class.isAssignableFrom(clss))
- return PrimitiveAccessor.TYPE_STRING;
- else if (char[].class.isAssignableFrom(clss))
- return PrimitiveAccessor.TYPE_PASSWORD;
- else if (Integer.class.isAssignableFrom(clss))
- return PrimitiveAccessor.TYPE_INTEGER;
- else if (Long.class.isAssignableFrom(clss))
- return PrimitiveAccessor.TYPE_LONG;
- else if (Float.class.isAssignableFrom(clss))
- return PrimitiveAccessor.TYPE_FLOAT;
- else if (Double.class.isAssignableFrom(clss))
- return PrimitiveAccessor.TYPE_DOUBLE;
- else if (Boolean.class.isAssignableFrom(clss))
- return PrimitiveAccessor.TYPE_BOOLEAN;
- else
- return null;
- }
-
- /** Parse string as an object. Passwords are returned as String.*/
- public static Object convert(String type, String str) {
- if (PrimitiveAccessor.TYPE_STRING.equals(type)) {
- return str;
- } else if (PrimitiveAccessor.TYPE_PASSWORD.equals(type)) {
- return str;
- } else if (PrimitiveAccessor.TYPE_INTEGER.equals(type)) {
- return (Integer.parseInt(str));
- } else if (PrimitiveAccessor.TYPE_LONG.equals(type)) {
- return (Long.parseLong(str));
- } else if (PrimitiveAccessor.TYPE_FLOAT.equals(type)) {
- return (Float.parseFloat(str));
- } else if (PrimitiveAccessor.TYPE_DOUBLE.equals(type)) {
- return (Double.parseDouble(str));
- } else if (PrimitiveAccessor.TYPE_BOOLEAN.equals(type)) {
- return (Boolean.parseBoolean(str));
- } else {
- return str;
- }
- }
-
-}
+++ /dev/null
-package org.argeo.slc.primitive;
-
-import org.argeo.slc.execution.AbstractExecutionValue;
-
-/** Primitive value to be used by an execution. */
-public class PrimitiveValue extends AbstractExecutionValue implements
- PrimitiveAccessor {
- private static final long serialVersionUID = 533414290998374166L;
-
- private String type;
-
- private Object value;
-
- public PrimitiveValue() {
- }
-
- public PrimitiveValue(String type, Object value) {
- super();
- this.type = type;
- this.value = value;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
-}
+++ /dev/null
-package org.argeo.slc.test;\r
-\r
-\r
-/** A test run that can be executed */\r
-public interface ExecutableTestRun extends TestRun, Runnable {\r
-\r
-}\r
+++ /dev/null
-package org.argeo.slc.test;\r
-\r
-import org.argeo.slc.SlcException;\r
-\r
-/**\r
- * Exception to throw when a test definition cannot interpret the provided test\r
- * data.\r
- */\r
-public class IncompatibleTestDataException extends SlcException {\r
- static final long serialVersionUID = 1l;\r
-\r
- public IncompatibleTestDataException(TestData testData,\r
- TestDefinition testDefinition) {\r
- super("TestData " + testData.getClass()\r
- + " is not compatible with TestDefinition "\r
- + testDefinition.getClass());\r
- }\r
-\r
- public IncompatibleTestDataException(TestRun testRun) {\r
- super("TestData " + ((TestData) testRun.getTestData()).getClass()\r
- + " is not compatible with TestDefinition "\r
- + ((TestDefinition) testRun.getTestDefinition()).getClass());\r
- }\r
-}\r
+++ /dev/null
-package org.argeo.slc.test;\r
-\r
-/**\r
- * Any data required by a test in order to run: configuration, expected,\r
- * reached, etc.\r
- */\r
-public interface TestData {\r
-\r
-}\r
+++ /dev/null
-package org.argeo.slc.test;\r
-\r
-public interface TestDataProvider {\r
- public <T extends TestData> T getTestData(Class<T> clss, String key);\r
-}\r
+++ /dev/null
-package org.argeo.slc.test;\r
-\r
-/**\r
- * The programmatic definition of a test, which will be associated with\r
- * transient objects within a test run.\r
- */\r
-public interface TestDefinition extends TestStatus {\r
- /** Performs the test. */\r
- public void execute(TestRun testRun);\r
-}\r
+++ /dev/null
-package org.argeo.slc.test;
-
-import java.util.Date;
-import java.util.Map;
-
-/** The result of a test */
-public interface TestResult extends TestStatus, TestRunAware {
- public String getUuid();
-
- /** Adds a part of the result. */
- public void addResultPart(TestResultPart part);
-
- /**
- * Marks that the collection of test results is completed and free the
- * related resources (also closing listeners).
- */
- public void close();
-
- /**
- * The date when this test result was closed. Can be null, which means the
- * result is not closed.
- */
- public Date getCloseDate();
-
- /** Additional arbitrary meta data */
- public Map<String, String> getAttributes();
-}
+++ /dev/null
-package org.argeo.slc.test;
-
-/** Listener to the operations on a test result. */
-public interface TestResultListener<T extends TestResult> {
- /** Notified when a part was added to a test result. */
- public void resultPartAdded(T testResult, TestResultPart testResultPart);
-
- /** Stops listening and release the related resources. */
- public void close(T testResult);
-}
+++ /dev/null
-package org.argeo.slc.test;
-
-/**
- * Part of a test result.
- *
- * @see TestResult
- */
-public interface TestResultPart {
- /** The status, as defined in {@link TestStatus}. */
- public Integer getStatus();
-
- /** The related message. */
- public String getMessage();
-
- /** The underlying <code>Exception</code>. Can be null. */
- public String getExceptionMessage();
-}
+++ /dev/null
-package org.argeo.slc.test;
-
-import org.argeo.slc.deploy.DeployedSystem;
-
-/** The actual run of a test */
-public interface TestRun {
- /** Gets UUID */
- public String getUuid();
-
- /** Gets the related test definition. */
- public <T extends TestDefinition> T getTestDefinition();
-
- /** Gets the related test data */
- public <T extends TestData> T getTestData();
-
- /** Gets the related deployed system. */
- public <T extends DeployedSystem> T getDeployedSystem();
-
- /** Gets the related result where to record results. */
- public <T extends TestResult> T getTestResult();
-}
+++ /dev/null
-package org.argeo.slc.test;
-
-/** Allows a test run to notify other objects. */
-public interface TestRunAware {
- /** Notifies the current test run. */
- public void notifyTestRun(TestRun testRun);
-
-}
+++ /dev/null
-package org.argeo.slc.test;
-
-/**
- * Simple statuses. Ordering of the flags can be relied upon in aggregation: if
- * one element is failed, the aggregation is failed. Is one element is in ERROR,
- * the aggregation is in ERROR.
- * <p>
- * <ul>
- * <li>{@link #PASSED}: the test succeeded</li>
- * <li>{@link #FAILED}: the test could run, but did not reach the expected
- * result</li>
- * <li>{@link #ERROR}: an error during the test run prevented to get a
- * significant information on the tested system.</li>
- * </ul>
- * </p>
- */
-public interface TestStatus {
- /** The flag for a passed test: 0 */
- public final static Integer PASSED = 0;
- /** The flag for a failed test: 1 */
- public final static Integer FAILED = 1;
- /**
- * The flag for a test which could not properly run because of an error
- * (there is no feedback on the behavior of the tested component): 2
- */
- public final static Integer ERROR = 2;
- public final static String STATUSSTR_PASSED = "PASSED";
- public final static String STATUSSTR_FAILED = "FAILED";
- public final static String STATUSSTR_ERROR = "ERROR";
-
-}
+++ /dev/null
-package org.argeo.slc.test;
-
-import org.argeo.slc.deploy.DeployedSystem;
-
-/** Test run whose various components can be externally set. */
-public interface WritableTestRun extends ExecutableTestRun {
- public void setDeployedSystem(DeployedSystem deployedSystem);
-
- public void setTestData(TestData testData);
-
- public void setTestDefinition(TestDefinition testDefinition);
-
- public void setTestResult(TestResult testResult);
-}
+++ /dev/null
-package org.argeo.slc.test.context;\r
-\r
-import java.util.Map;\r
-\r
-/** Access to an SLC test context that is, maps of reached and expected values. */\r
-public interface ContextAware {\r
- public final static String DEFAULT_SKIP_FLAG = "!";\r
- public final static String DEFAULT_ANY_FLAG = "*";\r
-\r
- /** Retrieves reached values. */\r
- public Map<String, Object> getValues();\r
-\r
- /** Set reached values. */\r
- public void setValues(Map<String, Object> values);\r
-\r
- /** Retrieves expected values. */\r
- public Map<String, Object> getExpectedValues();\r
-\r
- public String getContextSkipFlag();\r
-\r
- public String getContextAnyFlag();\r
-}\r
+++ /dev/null
-package org.argeo.slc.test.context;\r
-\r
-import java.util.Collection;\r
-\r
-public interface ParentContextAware extends ContextAware {\r
- public Collection<ContextAware> getChildContexts();\r
-\r
- public void addChildContext(ContextAware contextAware);\r
-}\r
+++ /dev/null
-<html>\r
-<head></head>\r
-<body>\r
-Context variables to be passed between parts of tests.\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-<html>\r
-<head></head>\r
-<body>\r
-SLC Test: test of software systems.\r
-</body>\r
-</html>
\ No newline at end of file
+
Import-Package: \
org.apache.commons.logging,\
org.postgresql;version="[42,43)";resolution:=optional,\
-org.apache.commons.vfs2.*resolution:=optional,\
+org.apache.commons.vfs2.*;resolution:=optional,\
org.osgi.*;version="0.0.0",\
+javax.servlet,\
+javax.servlet.http,\
+javax.websocket,\
+javax.websocket.server,\
*
\ No newline at end of file
output.. = bin/
bin.includes = META-INF/,\
.
-additional.bundles = org.argeo.init
+++ /dev/null
-package org.argeo.slc.cms.deploy;
-
-import org.argeo.slc.deploy.DeployedSystem;
-
-public interface CmsDeployedSystem extends DeployedSystem {
-
-}
+++ /dev/null
-package org.argeo.slc.cms.deploy;
-
-import java.util.List;
-
-import org.argeo.slc.deploy.DeploymentData;
-
-public interface CmsDeploymentData extends DeploymentData {
- List<String> getModulesToActivate(int startLevel);
-}
+++ /dev/null
-package org.argeo.slc.cms.deploy;
-
-import java.nio.file.Path;
-
-import org.argeo.slc.deploy.TargetData;
-
-public interface CmsTargetData extends TargetData {
- Path getInstanceData();
-
- Integer getHttpPort();
-
-}
+++ /dev/null
-package org.argeo.slc.cms.deploy;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-public class SimpleCmsDeploymentData implements CmsDeploymentData {
- private Map<Integer, List<String>> startLevels = new TreeMap<>();
-
- @Override
- public List<String> getModulesToActivate(int startLevel) {
- startLevels.putIfAbsent(startLevel, new ArrayList<>());
- return startLevels.get(startLevel);
- }
-
-}
+++ /dev/null
-package org.argeo.slc.cms.deploy;
-
-import java.nio.file.Path;
-
-public class SimpleCmsTargetData implements CmsTargetData {
- private Path instanceData;
- private Integer httpPort;
-
- public SimpleCmsTargetData(Path instanceData, Integer httpPort) {
- this.instanceData = instanceData;
- this.httpPort = httpPort;
- }
-
- public Integer getHttpPort() {
- return httpPort;
- }
-
- public void setHttpPort(Integer httpPort) {
- this.httpPort = httpPort;
- }
-
- public Path getInstanceData() {
- return instanceData;
- }
-
- public void setInstanceData(Path instanceData) {
- this.instanceData = instanceData;
- }
-
-}
+++ /dev/null
-package org.argeo.slc.cms.deploy.osgi;
-
-import org.argeo.slc.build.Distribution;
-import org.argeo.slc.build.ModularDistribution;
-import org.argeo.slc.cms.deploy.CmsDeployedSystem;
-import org.argeo.slc.cms.deploy.CmsDeploymentData;
-import org.argeo.slc.cms.deploy.CmsTargetData;
-import org.argeo.slc.deploy.DeploymentData;
-import org.argeo.slc.deploy.TargetData;
-import org.osgi.framework.BundleContext;
-
-public class CmsOsgiDeployedSystem implements CmsDeployedSystem {
- private ModularDistribution distribution;
- private CmsTargetData targetData;
- private CmsDeploymentData deploymentData;
-
- private BundleContext systemBundleContext;
-
- public CmsOsgiDeployedSystem(BundleContext systemBundleContext, ModularDistribution distribution,
- CmsTargetData targetData, CmsDeploymentData deploymentData) {
- this.systemBundleContext = systemBundleContext;
-
- this.distribution = distribution;
- this.targetData = targetData;
- this.deploymentData = deploymentData;
- }
-
- @Override
- public String getDeployedSystemId() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Distribution getDistribution() {
- return distribution;
- }
-
- @Override
- public DeploymentData getDeploymentData() {
- return deploymentData;
- }
-
- @Override
- public TargetData getTargetData() {
- return targetData;
- }
-
-}
+++ /dev/null
-package org.argeo.slc.cms.deploy.osgi;
-
-import java.io.IOException;
-import java.lang.System.Logger;
-import java.lang.System.Logger.Level;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringJoiner;
-import java.util.TreeMap;
-
-import org.argeo.cms.CmsDeployProperty;
-import org.argeo.init.a2.A2Source;
-import org.argeo.init.a2.FsA2Source;
-import org.argeo.init.osgi.OsgiBoot;
-import org.argeo.init.osgi.OsgiRuntimeContext;
-import org.argeo.slc.WellKnownConstants;
-import org.argeo.slc.build.Distribution;
-import org.argeo.slc.cms.deploy.CmsDeployedSystem;
-import org.argeo.slc.cms.deploy.CmsDeploymentData;
-import org.argeo.slc.cms.deploy.CmsTargetData;
-import org.argeo.slc.cms.deploy.SimpleCmsDeploymentData;
-import org.argeo.slc.cms.deploy.SimpleCmsTargetData;
-import org.argeo.slc.cms.distribution.A2Distribution;
-import org.argeo.slc.deploy.DeployedSystem;
-import org.argeo.slc.deploy.Deployment;
-import org.argeo.slc.deploy.DeploymentData;
-import org.argeo.slc.deploy.TargetData;
-
-public class CmsOsgiDeployment implements Deployment {
- private final static Logger logger = System.getLogger(CmsOsgiDeployment.class.getName());
-
- private A2Distribution distribution;
- private CmsTargetData targetData;
- private CmsDeploymentData deploymentData;
-
- private CmsDeployedSystem deployedSystem;
-
- private OsgiRuntimeContext runtimeContext;
-
- @Override
- public void run() {
- try {
- Map<String, String> config = new TreeMap<>();
-
- // sources
- StringJoiner sourcesProperty = new StringJoiner(",");
- for (A2Source a2Source : distribution.getA2Sources()) {
- sourcesProperty.add(a2Source.getUri().toString());
- }
- config.put(OsgiBoot.PROP_ARGEO_OSGI_SOURCES, sourcesProperty.toString());
-
- // target
- config.put(WellKnownConstants.OSGI_INSTANCE_AREA,
- targetData.getInstanceData().toRealPath().toUri().toString());
- if (targetData.getHttpPort() != null) {
- config.put(CmsDeployProperty.HTTP_PORT.getProperty(), targetData.getHttpPort().toString());
- }
-
- Path configurationArea = Files.createTempDirectory("slc-cms-test");
- config.put(WellKnownConstants.OSGI_CONFIGURATION_AREA, configurationArea.toUri().toString());
-
- // modules activation
- for (int startLevel = 0; startLevel <= 6; startLevel++) {
- List<String> modules = deploymentData.getModulesToActivate(startLevel);
- if (modules.size() != 0) {
- String startProperty = String.join(",", modules);
- config.put(OsgiBoot.PROP_ARGEO_OSGI_START + "." + startLevel, startProperty);
- }
- }
-
- config.put("org.eclipse.equinox.http.jetty.autostart", "false");
- config.put("org.osgi.framework.bootdelegation",
- "com.sun.jndi.ldap,com.sun.jndi.ldap.sasl,com.sun.security.jgss,com.sun.jndi.dns,com.sun.nio.file,com.sun.nio.sctp");
- config.put("eclipse.ignoreApp", "true");
- config.put("osgi.noShutdown", "true");
-
- config.put("osgi.console", "2323");
-
- // initialise
- for (String key : config.keySet()) {
-// System.out.println(key + "=" + config.get(key));
- logger.log(Level.INFO, () -> key + "=" + config.get(key));
- }
-
- runtimeContext = new OsgiRuntimeContext(config);
- runtimeContext.run();
-
- deployedSystem = new CmsOsgiDeployedSystem(runtimeContext.getFramework().getBundleContext(), distribution,
- targetData, deploymentData);
-
- } catch (Exception e) {
- throw new IllegalStateException("Cannot run OSGi deployment", e);
- }
-
- }
-
- @Override
- public DeployedSystem getDeployedSystem() {
- return deployedSystem;
- }
-
- @Override
- public void setTargetData(TargetData targetData) {
- this.targetData = (CmsTargetData) targetData;
- }
-
- @Override
- public void setDeploymentData(DeploymentData deploymentData) {
- this.deploymentData = (CmsDeploymentData) deploymentData;
- }
-
- @Override
- public void setDistribution(Distribution distribution) {
- this.distribution = (A2Distribution) distribution;
- }
-
- public OsgiRuntimeContext getRuntimeContext() {
- return runtimeContext;
- }
-
- public static void main(String[] args) {
- try {
- Path userHome = Paths.get(System.getProperty("user.home"));
-
- // distribution
- Path a2Base = userHome.resolve("dev/git/unstable/output/a2");
- A2Distribution distribution = new A2Distribution();
- Map<String, String> xOr = new HashMap<>();
- xOr.put("osgi", "equinox");
- xOr.put("swt", "rap");
- distribution.getA2Sources().add(new FsA2Source(a2Base, xOr, true));
-
- // target data
- Path instanceData = userHome.resolve("dev/git/unstable/argeo-slc/sdk/exec/cms-deployment/data");
- Files.createDirectories(instanceData);
- Integer httpPort = 7070;
- SimpleCmsTargetData targetData = new SimpleCmsTargetData(instanceData, httpPort);
-
- // deployment data
- SimpleCmsDeploymentData deploymentData = new SimpleCmsDeploymentData();
- deploymentData.getModulesToActivate(2).add("org.eclipse.equinox.http.servlet");
- deploymentData.getModulesToActivate(2).add("org.apache.felix.scr");
- deploymentData.getModulesToActivate(2).add("org.eclipse.rap.rwt.osgi");
- deploymentData.getModulesToActivate(2).add("org.eclipse.equinox.console");
-
- deploymentData.getModulesToActivate(3).add("org.argeo.cms");
- deploymentData.getModulesToActivate(3).add("org.argeo.cms.ee");
- deploymentData.getModulesToActivate(3).add("org.argeo.cms.lib.sshd");
- deploymentData.getModulesToActivate(3).add("org.argeo.cms.lib.equinox");
- deploymentData.getModulesToActivate(3).add("org.argeo.cms.lib.jetty");
- deploymentData.getModulesToActivate(3).add("org.argeo.cms.swt.rap");
-
- deploymentData.getModulesToActivate(4).add("org.argeo.cms.jcr");
- deploymentData.getModulesToActivate(4).add("org.argeo.app.profile.acr.fs");
-
- deploymentData.getModulesToActivate(5).add("org.argeo.app.core");
- deploymentData.getModulesToActivate(5).add("org.argeo.app.ui");
- deploymentData.getModulesToActivate(5).add("org.argeo.app.theme.default");
-
- CmsOsgiDeployment deployment = new CmsOsgiDeployment();
- deployment.setDistribution(distribution);
- deployment.setTargetData(targetData);
- deployment.setDeploymentData(deploymentData);
- deployment.run();
-
- boolean multiple = false;
- if (multiple) {
-
- Path instanceData2 = userHome.resolve("dev/git/unstable/argeo-slc/sdk/exec/cms-deployment2/data");
- Files.createDirectories(instanceData2);
- Integer httpPort2 = 7071;
- SimpleCmsTargetData targetData2 = new SimpleCmsTargetData(instanceData2, httpPort2);
-
- CmsOsgiDeployment deployment2 = new CmsOsgiDeployment();
- deployment2.setDistribution(distribution);
- deployment2.setTargetData(targetData2);
- deployment2.setDeploymentData(deploymentData);
- deployment2.run();
- }
-
- deployment.getRuntimeContext().waitForStop(0);
-
- } catch (IOException | InterruptedException e) {
- e.printStackTrace();
- System.exit(1);
- }
- }
-
-}
+++ /dev/null
-package org.argeo.slc.cms.distribution;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.argeo.init.a2.A2Branch;
-import org.argeo.init.a2.A2Component;
-import org.argeo.init.a2.A2Contribution;
-import org.argeo.init.a2.A2Module;
-import org.argeo.init.a2.A2Source;
-import org.argeo.slc.CategoryNameVersion;
-import org.argeo.slc.DefaultCategoryNameVersion;
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.build.Distribution;
-import org.argeo.slc.build.ModularDistribution;
-
-public class A2Distribution implements ModularDistribution {
- private List<A2Source> a2Sources = new ArrayList<>();
-
- @Override
- public String getDistributionId() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getVersion() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Iterator<? extends NameVersion> nameVersions() {
- List<CategoryNameVersion> nameVersions = new ArrayList<>();
- for (A2Source a2Source : a2Sources) {
- for (A2Contribution a2Contribution : a2Source.listContributions(null)) {
- for (A2Component a2Component : a2Contribution.listComponents(null)) {
- for (A2Branch a2Branch : a2Component.listBranches(null)) {
- for (A2Module a2Module : a2Branch.listModules(null)) {
- CategoryNameVersion nameVersion = new DefaultCategoryNameVersion(a2Contribution.getId(),
- a2Component.getId(), a2Module.getVersion().toString());
- nameVersions.add(nameVersion);
- }
- }
- }
- }
- }
- return nameVersions.iterator();
- }
-
- @Override
- public Distribution getModuleDistribution(String moduleName, String moduleVersion) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Object getModulesDescriptor(String descriptorType) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<A2Source> getA2Sources() {
- return a2Sources;
- }
-
-
-}
+++ /dev/null
-package org.argeo.slc.cms.distribution;
-
-import org.argeo.init.a2.A2Module;
-import org.argeo.slc.build.Distribution;
-
-public class A2ModuleDistribution implements Distribution {
- private A2Module a2Module;
-
- @Override
- public String getDistributionId() {
- return a2Module.getCoordinates();
- }
-
-}
+++ /dev/null
-package org.argeo.slc.cms.test;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-public class CmsSmokeTest {
-
- public static void main(String[] args) throws IOException {
- Path instanceData;
- if (args.length > 0) {
- instanceData = Paths.get(args[0]);
- } else {
- instanceData = Files.createTempDirectory("cms-test");
- }
-
- }
-
-}
+++ /dev/null
-package org.argeo.slc.cms.test;
-
-/**
- * A program doing nothing and loading no classes, to be used as a baseline for
- * memory usage of the JVM.
- */
-public class MinimalJvm {
-
- synchronized void sleep() {
- try {
- wait();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) {
- new MinimalJvm().sleep();
- }
-
-}
+Bundle-Activator: org.argeo.slc.internal.runtime.osgi.SlcInitActivator
+
Import-Package: \
-org.argeo.slc.deploy,\
+org.argeo.api.slc.deploy,\
org.apache.commons.exec.*;resolution:=optional,\
*
\ No newline at end of file
--- /dev/null
+package org.argeo.slc.cms.deploy;
+
+import org.argeo.api.slc.deploy.DeployedSystem;
+
+public interface CmsDeployedSystem extends DeployedSystem {
+
+}
--- /dev/null
+package org.argeo.slc.cms.deploy;
+
+import java.util.List;
+
+import org.argeo.api.slc.deploy.DeploymentData;
+
+public interface CmsDeploymentData extends DeploymentData {
+ List<String> getModulesToActivate(int startLevel);
+}
--- /dev/null
+package org.argeo.slc.cms.deploy;
+
+import java.nio.file.Path;
+
+import org.argeo.api.slc.deploy.TargetData;
+
+public interface CmsTargetData extends TargetData {
+ Path getInstanceData();
+
+ String getHost();
+
+ Integer getHttpPort();
+
+}
--- /dev/null
+package org.argeo.slc.cms.deploy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class SimpleCmsDeploymentData implements CmsDeploymentData {
+ private Map<Integer, List<String>> startLevels = new TreeMap<>();
+
+ @Override
+ public List<String> getModulesToActivate(int startLevel) {
+ startLevels.putIfAbsent(startLevel, new ArrayList<>());
+ return startLevels.get(startLevel);
+ }
+
+}
--- /dev/null
+package org.argeo.slc.cms.deploy;
+
+import java.nio.file.Path;
+
+public class SimpleCmsTargetData implements CmsTargetData {
+ private Path instanceData;
+ private String host;
+ private Integer httpPort;
+
+ public SimpleCmsTargetData(Path instanceData, String host, Integer httpPort) {
+ this.instanceData = instanceData;
+ this.host = host;
+ this.httpPort = httpPort;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String hostname) {
+ this.host = hostname;
+ }
+
+ public Integer getHttpPort() {
+ return httpPort;
+ }
+
+ public void setHttpPort(Integer httpPort) {
+ this.httpPort = httpPort;
+ }
+
+ public Path getInstanceData() {
+ return instanceData;
+ }
+
+ public void setInstanceData(Path instanceData) {
+ this.instanceData = instanceData;
+ }
+
+}
--- /dev/null
+package org.argeo.slc.cms.deploy.osgi;
+
+import org.argeo.api.slc.build.Distribution;
+import org.argeo.api.slc.build.ModularDistribution;
+import org.argeo.api.slc.deploy.DeploymentData;
+import org.argeo.api.slc.deploy.TargetData;
+import org.argeo.slc.cms.deploy.CmsDeployedSystem;
+import org.argeo.slc.cms.deploy.CmsDeploymentData;
+import org.argeo.slc.cms.deploy.CmsTargetData;
+import org.osgi.framework.BundleContext;
+
+/** A deployed OSGi-based Argeo CMS system. */
+public class OsgiCmsDeployedSystem implements CmsDeployedSystem {
+ private ModularDistribution distribution;
+ private CmsTargetData targetData;
+ private CmsDeploymentData deploymentData;
+
+ // private BundleContext systemBundleContext;
+
+ public OsgiCmsDeployedSystem(BundleContext systemBundleContext, ModularDistribution distribution,
+ CmsTargetData targetData, CmsDeploymentData deploymentData) {
+ // this.systemBundleContext = systemBundleContext;
+
+ this.distribution = distribution;
+ this.targetData = targetData;
+ this.deploymentData = deploymentData;
+ }
+
+ @Override
+ public String getDeployedSystemId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Distribution getDistribution() {
+ return distribution;
+ }
+
+ @Override
+ public DeploymentData getDeploymentData() {
+ return deploymentData;
+ }
+
+ @Override
+ public TargetData getTargetData() {
+ return targetData;
+ }
+
+}
--- /dev/null
+package org.argeo.slc.cms.deploy.osgi;
+
+import java.io.IOException;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringJoiner;
+import java.util.TreeMap;
+
+import org.argeo.api.a2.A2Source;
+import org.argeo.api.a2.FsA2Source;
+import org.argeo.api.init.InitConstants;
+import org.argeo.api.init.RuntimeContext;
+import org.argeo.api.slc.WellKnownConstants;
+import org.argeo.api.slc.build.Distribution;
+import org.argeo.api.slc.deploy.DeployedSystem;
+import org.argeo.api.slc.deploy.Deployment;
+import org.argeo.api.slc.deploy.DeploymentData;
+import org.argeo.api.slc.deploy.TargetData;
+import org.argeo.init.osgi.OsgiRuntimeContext;
+import org.argeo.slc.cms.deploy.CmsDeployedSystem;
+import org.argeo.slc.cms.deploy.CmsDeploymentData;
+import org.argeo.slc.cms.deploy.CmsTargetData;
+import org.argeo.slc.cms.deploy.SimpleCmsDeploymentData;
+import org.argeo.slc.cms.distribution.A2Distribution;
+
+/** The process of deploying an OSGi based Argeo CMS system. */
+public class OsgiCmsDeployment implements Deployment {
+ private final static Logger logger = System.getLogger(OsgiCmsDeployment.class.getName());
+
+ private A2Distribution distribution;
+ private CmsTargetData targetData;
+ private CmsDeploymentData deploymentData;
+
+ private CmsDeployedSystem deployedSystem;
+
+ private OsgiRuntimeContext runtimeContext;
+
+ @Override
+ public void run() {
+ try {
+ Map<String, String> config = new TreeMap<>();
+
+ // sources
+ StringJoiner sourcesProperty = new StringJoiner(",");
+ for (A2Source a2Source : distribution.getA2Sources()) {
+ sourcesProperty.add(a2Source.getUri().toString());
+ }
+ config.put(InitConstants.PROP_ARGEO_OSGI_SOURCES, sourcesProperty.toString());
+
+ // target
+ config.put(WellKnownConstants.OSGI_INSTANCE_AREA,
+ targetData.getInstanceData().toRealPath().toUri().toString());
+
+ if (targetData.getHost() != null) {
+ config.put("argeo.host", targetData.getHost().toString());
+ }
+
+ if (targetData.getHttpPort() != null) {
+ config.put("argeo.http.port", targetData.getHttpPort().toString());
+ }
+
+ Path configurationArea = Files.createTempDirectory("slc-cms-test");
+ config.put(WellKnownConstants.OSGI_CONFIGURATION_AREA, configurationArea.toUri().toString());
+
+ // modules activation
+ for (int startLevel = 0; startLevel <= 6; startLevel++) {
+ List<String> modules = deploymentData.getModulesToActivate(startLevel);
+ if (modules.size() != 0) {
+ String startProperty = String.join(",", modules);
+ config.put(InitConstants.PROP_ARGEO_OSGI_START + "." + startLevel, startProperty);
+ }
+ }
+
+ config.put("org.eclipse.equinox.http.jetty.autostart", "false");
+ config.put("org.osgi.framework.system.packages.extra",
+ "sun.security.util,sun.security.internal.spec,sun.security.provider,com.sun.net.httpserver,com.sun.jndi.ldap,com.sun.jndi.ldap.sasl,com.sun.jndi.dns,com.sun.security.jgss,com.sun.nio.file,com.sun.nio.sctp");
+ config.put("eclipse.ignoreApp", "true");
+ config.put("osgi.noShutdown", "true");
+ config.put("osgi.clean", "true");
+ config.put("osgi.framework.useSystemProperties", "false");
+
+ config.put("argeo.directory", "dc=example,dc=com.ldif");
+
+ if (targetData instanceof OsgiCmsTargetData osgiCmsTargetData
+ && osgiCmsTargetData.getTelnetPort() != null) {
+ String hostStr = "";
+ if (targetData.getHost() != null) {
+ hostStr = targetData.getHost().toString() + ":";
+ }
+ config.put("osgi.console", hostStr + osgiCmsTargetData.getTelnetPort().toString());
+ }
+
+ // initialise
+ for (String key : config.keySet()) {
+// System.out.println(key + "=" + config.get(key));
+ logger.log(Level.TRACE, () -> key + "=" + config.get(key));
+ }
+
+ // FIXME use runtime manager
+ runtimeContext = new OsgiRuntimeContext(config);
+ runtimeContext.run();
+
+// deployedSystem = new OsgiCmsDeployedSystem(runtimeContext.getFramework().getBundleContext(), distribution,
+// targetData, deploymentData);
+
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot run OSGi deployment", e);
+ }
+
+ }
+
+ @Override
+ public DeployedSystem getDeployedSystem() {
+ return deployedSystem;
+ }
+
+ @Override
+ public void setTargetData(TargetData targetData) {
+ this.targetData = (CmsTargetData) targetData;
+ }
+
+ @Override
+ public void setDeploymentData(DeploymentData deploymentData) {
+ this.deploymentData = (CmsDeploymentData) deploymentData;
+ }
+
+ @Override
+ public void setDistribution(Distribution distribution) {
+ this.distribution = (A2Distribution) distribution;
+ }
+
+ public OsgiRuntimeContext getRuntimeContext() {
+ return runtimeContext;
+ }
+
+ public static void main(String[] args) {
+ RuntimeContext runtimeContext = test();
+ try {
+ runtimeContext.waitForStop(0);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static RuntimeContext test() {
+ try {
+ Path userHome = Paths.get(System.getProperty("user.home"));
+
+ // distribution
+ Path a2Base = userHome.resolve("dev/git/unstable/output/a2");
+ A2Distribution distribution = new A2Distribution();
+ Map<String, String> xOr = new HashMap<>();
+ xOr.put("osgi", "equinox");
+ xOr.put("swt", "rap");
+ xOr.put("log", "syslogger");
+ xOr.put("crypto", "fips");
+ distribution.getA2Sources().add(new FsA2Source(a2Base, xOr, true, null, null));
+
+ // target data
+ Path instanceData = userHome.resolve("dev/git/unstable/argeo-slc/sdk/exec/cms-deployment/data");
+ Files.createDirectories(instanceData);
+ OsgiCmsTargetData targetData = new OsgiCmsTargetData(instanceData, "host1", 7070, 2323);
+
+ // deployment data
+ SimpleCmsDeploymentData deploymentData = new SimpleCmsDeploymentData();
+ deploymentData.getModulesToActivate(2).add("org.eclipse.equinox.http.servlet");
+ deploymentData.getModulesToActivate(2).add("org.apache.felix.scr");
+ deploymentData.getModulesToActivate(2).add("org.eclipse.rap.rwt.osgi");
+ deploymentData.getModulesToActivate(2).add("org.eclipse.equinox.console");
+
+ deploymentData.getModulesToActivate(3).add("org.argeo.cms");
+ deploymentData.getModulesToActivate(3).add("org.argeo.cms.ee");
+ deploymentData.getModulesToActivate(3).add("org.argeo.cms.lib.sshd");
+ deploymentData.getModulesToActivate(3).add("org.argeo.cms.lib.equinox");
+ deploymentData.getModulesToActivate(3).add("org.argeo.cms.lib.jetty");
+ deploymentData.getModulesToActivate(3).add("org.argeo.cms.swt.rap");
+
+ deploymentData.getModulesToActivate(4).add("org.argeo.cms.jcr");
+ deploymentData.getModulesToActivate(4).add("org.argeo.app.profile.acr.fs");
+
+ deploymentData.getModulesToActivate(5).add("org.argeo.app.core");
+ deploymentData.getModulesToActivate(5).add("org.argeo.app.ui");
+ deploymentData.getModulesToActivate(5).add("org.argeo.app.theme.default");
+ deploymentData.getModulesToActivate(5).add("org.argeo.app.jcr");
+
+ deploymentData.getModulesToActivate(5).add("org.example.suite.theme");
+ deploymentData.getModulesToActivate(5).add("org.example.suite.core");
+ deploymentData.getModulesToActivate(5).add("org.example.suite.ui");
+ deploymentData.getModulesToActivate(5).add("org.example.suite.ui.rap");
+
+ OsgiCmsDeployment deployment = new OsgiCmsDeployment();
+ deployment.setDistribution(distribution);
+ deployment.setTargetData(targetData);
+ deployment.setDeploymentData(deploymentData);
+ deployment.run();
+
+ boolean multiple = true;
+ if (multiple) {
+ // wait a bit
+// Thread.sleep(5000);
+
+ Path instanceData2 = userHome.resolve("dev/git/unstable/argeo-slc/sdk/exec/cms-deployment2/data");
+ Files.createDirectories(instanceData2);
+ OsgiCmsTargetData targetData2 = new OsgiCmsTargetData(instanceData2, "host2", 7070, 2323);
+
+ OsgiCmsDeployment deployment2 = new OsgiCmsDeployment();
+ deployment2.setDistribution(distribution);
+ deployment2.setTargetData(targetData2);
+ deployment2.setDeploymentData(deploymentData);
+ deployment2.run();
+ }
+
+ return deployment.getRuntimeContext();
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ return null;
+ }
+ }
+
+}
--- /dev/null
+package org.argeo.slc.cms.deploy.osgi;
+
+import java.nio.file.Path;
+
+import org.argeo.slc.cms.deploy.SimpleCmsTargetData;
+
+public class OsgiCmsTargetData extends SimpleCmsTargetData {
+ private Integer telnetPort;
+
+ public OsgiCmsTargetData(Path instanceData, String host, Integer httpPort, Integer telnetPort) {
+ super(instanceData, host, httpPort);
+ this.telnetPort = telnetPort;
+ }
+
+ public Integer getTelnetPort() {
+ return telnetPort;
+ }
+
+ public void setTelnetPort(Integer telnetPort) {
+ this.telnetPort = telnetPort;
+ }
+
+}
--- /dev/null
+package org.argeo.slc.cms.distribution;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.argeo.api.a2.A2Branch;
+import org.argeo.api.a2.A2Component;
+import org.argeo.api.a2.A2Contribution;
+import org.argeo.api.a2.A2Module;
+import org.argeo.api.a2.A2Source;
+import org.argeo.api.slc.CategoryNameVersion;
+import org.argeo.api.slc.DefaultCategoryNameVersion;
+import org.argeo.api.slc.NameVersion;
+import org.argeo.api.slc.build.Distribution;
+import org.argeo.api.slc.build.ModularDistribution;
+
+public class A2Distribution implements ModularDistribution {
+ private List<A2Source> a2Sources = new ArrayList<>();
+
+ @Override
+ public String getDistributionId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Iterator<? extends NameVersion> nameVersions() {
+ List<CategoryNameVersion> nameVersions = new ArrayList<>();
+ for (A2Source a2Source : a2Sources) {
+ for (A2Contribution a2Contribution : a2Source.listContributions(null)) {
+ for (A2Component a2Component : a2Contribution.listComponents(null)) {
+ for (A2Branch a2Branch : a2Component.listBranches(null)) {
+ for (A2Module a2Module : a2Branch.listModules(null)) {
+ CategoryNameVersion nameVersion = new DefaultCategoryNameVersion(a2Contribution.getId(),
+ a2Component.getId(), a2Module.getVersion().toString());
+ nameVersions.add(nameVersion);
+ }
+ }
+ }
+ }
+ }
+ return nameVersions.iterator();
+ }
+
+ @Override
+ public Distribution getModuleDistribution(String moduleName, String moduleVersion) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getModulesDescriptor(String descriptorType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<A2Source> getA2Sources() {
+ return a2Sources;
+ }
+
+
+}
--- /dev/null
+package org.argeo.slc.cms.distribution;
+
+import org.argeo.api.a2.A2Module;
+import org.argeo.api.slc.build.Distribution;
+
+public class A2ModuleDistribution implements Distribution {
+ private A2Module a2Module;
+
+ @Override
+ public String getDistributionId() {
+ return a2Module.getCoordinates();
+ }
+
+}
--- /dev/null
+package org.argeo.slc.cms.test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class CmsSmokeTest {
+
+ public static void main(String[] args) throws IOException {
+ Path instanceData;
+ if (args.length > 0) {
+ instanceData = Paths.get(args[0]);
+ } else {
+ instanceData = Files.createTempDirectory("cms-test");
+ }
+
+ }
+
+}
--- /dev/null
+package org.argeo.slc.cms.test;
+
+/**
+ * A program doing nothing and loading no classes, to be used as a baseline for
+ * memory usage of the JVM.
+ */
+public class MinimalJvm {
+
+ synchronized void sleep() {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ new MinimalJvm().sleep();
+ }
+
+}
--- /dev/null
+package org.argeo.slc.internal.runtime.osgi;
+
+import org.argeo.api.init.RuntimeManager;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class SlcInitActivator implements BundleActivator {
+// private final static CmsLog log = CmsLog.getLog(SlcInitActivator.class);
+
+ private ServiceTracker<RuntimeManager, RuntimeManager> runtimeManagerSt;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+// Path userHome = Paths.get(System.getProperty("user.home"));
+
+// {
+// EquinoxFactory equinoxFactory = new EquinoxFactory();
+// Map<String, String> config = new HashMap<>();
+// config.put("osgi.console", "host1:2023");
+// config.put("osgi.frameworkParentClassloader", "app");
+// config.put("osgi.parentClassLoader", "app");
+// RuntimeManager.loadConfig(Paths.get("/usr/local/etc/argeo/user/cms/test3"), config);
+// Framework framework = equinoxFactory.newFramework(config);
+// framework.start();
+// OsgiBoot osgiBoot = new OsgiBoot(framework.getBundleContext());
+// osgiBoot.bootstrap(config);
+// }
+
+ // OsgiCmsDeployment.test();
+
+ runtimeManagerSt = new ServiceTracker<>(context, RuntimeManager.class, null) {
+
+ @Override
+ public RuntimeManager addingService(ServiceReference<RuntimeManager> reference) {
+ RuntimeManager runtimeManager = super.addingService(reference);
+ new Thread() {
+ public void run() {
+// try {
+// Thread.sleep(5000);
+// } catch (InterruptedException e) {
+// return;
+// }
+
+// runtimeManager.startRuntime("rcp/test1", (config) -> {
+// config.put("osgi.console", "host1:2023");
+// config.put(CmsDeployProperty.SSHD_PORT.getProperty(), "2222");
+//// config.put(CmsDeployProperty.HTTP_PORT.getProperty(), "7070");
+// config.put(CmsDeployProperty.HOST.getProperty(), "host1");
+//// config.put("argeo.osgi.start.6", "org.argeo.swt.minidesktop");
+// });
+
+ runtimeManager.startRuntime("rap/test2", (config) -> {
+ config.put("osgi.console", "host2:2023");
+ config.put("argeo.sshd.port", "2222");
+ config.put("argeo.http.port", "7070");
+ config.put("argeo.host", "host2");
+ String a2Source = config.get("argeo.osgi.sources");
+ config.put("argeo.osgi.sources", a2Source
+ + ",a2+reference:///home/mbaudier/dev/git/unstable/output/a2?include=eu.netiket.on.apaf");
+ config.put("argeo.osgi.start.6", "eu.netiket.on.apaf");
+//// config.put("argeo.directory", "ipa:///");
+ });
+ }
+ }.start();
+
+ return runtimeManager;
+ }
+
+ };
+ runtimeManagerSt.open(false);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
import java.util.Map;
-import org.argeo.slc.execution.ExecutionContext;
-import org.argeo.slc.execution.ExecutionFlow;
-import org.argeo.slc.execution.ExecutionFlowDescriptorConverter;
-import org.argeo.slc.execution.ExecutionModulesManager;
-import org.argeo.slc.execution.RealizedFlow;
+import org.argeo.api.slc.execution.ExecutionContext;
+import org.argeo.api.slc.execution.ExecutionFlow;
+import org.argeo.api.slc.execution.ExecutionFlowDescriptorConverter;
+import org.argeo.api.slc.execution.ExecutionModulesManager;
+import org.argeo.api.slc.execution.RealizedFlow;
/** Provides the base feature of an execution module manager. */
public abstract class AbstractExecutionModulesManager implements
import java.util.Map;
import java.util.UUID;
-import org.argeo.slc.DefaultNameVersion;
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionModuleDescriptor;
-import org.argeo.slc.execution.ExecutionModulesManager;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.execution.SlcAgent;
+import org.argeo.api.slc.DefaultNameVersion;
+import org.argeo.api.slc.NameVersion;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionModuleDescriptor;
+import org.argeo.api.slc.execution.ExecutionModulesManager;
+import org.argeo.api.slc.execution.ExecutionProcess;
+import org.argeo.api.slc.execution.SlcAgent;
/** Implements the base methods of an SLC agent. */
public class DefaultAgent implements SlcAgent {
import java.util.List;
import java.util.Map;
-import org.argeo.slc.DefaultNameVersion;
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionFlowDescriptor;
-import org.argeo.slc.execution.ExecutionModuleDescriptor;
-import org.argeo.slc.execution.ExecutionSpec;
-import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.execution.SlcAgent;
-import org.argeo.slc.execution.SlcAgentCli;
+import org.argeo.api.slc.DefaultNameVersion;
+import org.argeo.api.slc.NameVersion;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionFlowDescriptor;
+import org.argeo.api.slc.execution.ExecutionModuleDescriptor;
+import org.argeo.api.slc.execution.ExecutionSpec;
+import org.argeo.api.slc.execution.ExecutionSpecAttribute;
+import org.argeo.api.slc.execution.SlcAgent;
+import org.argeo.api.slc.execution.SlcAgentCli;
/**
* Authenticates thread and executes synchronously a command line execution.
import java.util.List;
import java.util.Map;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionContext;
-import org.argeo.slc.execution.ExecutionFlow;
-import org.argeo.slc.execution.ExecutionSpec;
-import org.argeo.slc.execution.ExecutionSpecAttribute;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionContext;
+import org.argeo.api.slc.execution.ExecutionFlow;
+import org.argeo.api.slc.execution.ExecutionSpec;
+import org.argeo.api.slc.execution.ExecutionSpecAttribute;
/** Default implementation of an execution flow. */
public class DefaultExecutionFlow implements ExecutionFlow {
import java.util.List;
import java.util.Map;
-import org.argeo.slc.execution.ExecutionSpec;
-import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.execution.RefSpecAttribute;
-import org.argeo.slc.execution.RefValueChoice;
+import org.argeo.api.slc.execution.ExecutionSpec;
+import org.argeo.api.slc.execution.ExecutionSpecAttribute;
+import org.argeo.api.slc.execution.RefSpecAttribute;
+import org.argeo.api.slc.execution.RefValueChoice;
/** Spring based implementation of execution specifications. */
public class DefaultExecutionSpec implements ExecutionSpec, Serializable {
import java.util.Stack;
import java.util.UUID;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionFlow;
-import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.execution.ExecutionStack;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionFlow;
+import org.argeo.api.slc.execution.ExecutionSpecAttribute;
+import org.argeo.api.slc.execution.ExecutionStack;
/** Canonical implementation of an execution stack. */
public class DefaultExecutionStack implements ExecutionStack {
import java.util.List;
import java.util.UUID;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.execution.ExecutionStep;
-import org.argeo.slc.execution.RealizedFlow;
+import org.argeo.api.slc.execution.ExecutionProcess;
+import org.argeo.api.slc.execution.ExecutionStep;
+import org.argeo.api.slc.execution.RealizedFlow;
/** Canonical implementation of an {@link ExecutionProcess} as a bean. */
public class DefaultProcess implements ExecutionProcess {
import javax.security.auth.Subject;
-import org.argeo.slc.execution.ExecutionFlowDescriptor;
-import org.argeo.slc.execution.ExecutionModulesManager;
-import org.argeo.slc.execution.ExecutionStep;
-import org.argeo.slc.execution.FlowConfigurationException;
-import org.argeo.slc.execution.RealizedFlow;
+import org.argeo.api.slc.execution.ExecutionFlowDescriptor;
+import org.argeo.api.slc.execution.ExecutionModulesManager;
+import org.argeo.api.slc.execution.ExecutionStep;
+import org.argeo.api.slc.execution.FlowConfigurationException;
+import org.argeo.api.slc.execution.RealizedFlow;
/** Thread of a single execution */
public class ExecutionThread extends Thread {
import java.lang.System.Logger.Level;
import java.util.Stack;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionFlow;
-import org.argeo.slc.execution.ExecutionSpecAttribute;
-import org.argeo.slc.execution.RefSpecAttribute;
-import org.argeo.slc.primitive.PrimitiveSpecAttribute;
-import org.argeo.slc.primitive.PrimitiveUtils;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionFlow;
+import org.argeo.api.slc.execution.ExecutionSpecAttribute;
+import org.argeo.api.slc.execution.RefSpecAttribute;
+import org.argeo.api.slc.primitive.PrimitiveSpecAttribute;
+import org.argeo.api.slc.primitive.PrimitiveUtils;
/** Manage parameters that need to be set during the instantiation of a flow */
public class InstantiationManager {
import javax.security.auth.Subject;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionModulesManager;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.execution.ExecutionStep;
-import org.argeo.slc.execution.RealizedFlow;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionModulesManager;
+import org.argeo.api.slc.execution.ExecutionProcess;
+import org.argeo.api.slc.execution.ExecutionStep;
+import org.argeo.api.slc.execution.RealizedFlow;
/**
* Main thread coordinating an {@link ExecutionProcess}, launching parallel or
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.execution.ExecutionStep;
+import org.argeo.api.slc.execution.ExecutionProcess;
+import org.argeo.api.slc.execution.ExecutionStep;
/** The thread group attached to a given {@link SlcExecution}. */
public class ProcessThreadGroup extends ThreadGroup {
package org.argeo.slc.runtime.tasks;
-import org.argeo.slc.test.TestResult;
+import org.argeo.api.slc.test.TestResult;
public class CloseTestResult implements Runnable {
private TestResult testResult;
import java.nio.file.Path;
import org.apache.commons.io.FileUtils;
-import org.argeo.slc.SlcException;
+import org.argeo.api.slc.SlcException;
public class Echo implements Runnable {
private final static Logger defaultLogger = System.getLogger(Echo.class.getName());
package org.argeo.slc.runtime.tasks;
-import org.argeo.slc.SlcException;
+import org.argeo.api.slc.SlcException;
/** Conditional execution */
public class If implements Runnable {
import java.util.Properties;
import org.apache.commons.io.IOUtils;
-import org.argeo.slc.SlcException;
+import org.argeo.api.slc.SlcException;
/** A Java Virtual Machine process. */
public class JvmProcess extends SystemCall {
import org.apache.commons.exec.ShutdownHookProcessDestroyer;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.UnsupportedException;
-import org.argeo.slc.execution.ExecutionResources;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.UnsupportedException;
+import org.argeo.api.slc.execution.ExecutionResources;
+import org.argeo.api.slc.test.TestResult;
+import org.argeo.api.slc.test.TestStatus;
import org.argeo.slc.runtime.test.SimpleResultPart;
-import org.argeo.slc.test.TestResult;
-import org.argeo.slc.test.TestStatus;
/** Execute an OS specific system call. */
public class SystemCall implements Runnable {
package org.argeo.slc.runtime.test;
-import org.argeo.slc.test.TestData;
+import org.argeo.api.slc.test.TestData;
public class BasicTestData implements TestData {
private Object expected;
package org.argeo.slc.runtime.test;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.test.IncompatibleTestDataException;
-import org.argeo.slc.test.TestData;
-import org.argeo.slc.test.TestDefinition;
-import org.argeo.slc.test.TestResult;
-import org.argeo.slc.test.TestRun;
-import org.argeo.slc.test.TestStatus;
-import org.argeo.slc.test.context.ContextAware;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.test.IncompatibleTestDataException;
+import org.argeo.api.slc.test.TestData;
+import org.argeo.api.slc.test.TestDefinition;
+import org.argeo.api.slc.test.TestResult;
+import org.argeo.api.slc.test.TestRun;
+import org.argeo.api.slc.test.TestStatus;
+import org.argeo.api.slc.test.context.ContextAware;
/** Understands basic test data and context aware test data. */
public class BasicTestDefinition implements TestDefinition {
import java.util.Map;
import java.util.TreeMap;
-import org.argeo.slc.test.TestResult;
-import org.argeo.slc.test.TestStatus;
-import org.argeo.slc.test.context.ContextAware;
-import org.argeo.slc.test.context.ParentContextAware;
+import org.argeo.api.slc.test.TestResult;
+import org.argeo.api.slc.test.TestStatus;
+import org.argeo.api.slc.test.context.ContextAware;
+import org.argeo.api.slc.test.context.ParentContextAware;
/** Utilities for comparing and synchronising contexts. */
public class ContextUtils {
import java.io.Serializable;
-import org.argeo.slc.test.TestResultPart;
-import org.argeo.slc.test.TestRun;
-import org.argeo.slc.test.TestRunAware;
-import org.argeo.slc.test.TestStatus;
+import org.argeo.api.slc.test.TestResultPart;
+import org.argeo.api.slc.test.TestRun;
+import org.argeo.api.slc.test.TestRunAware;
+import org.argeo.api.slc.test.TestStatus;
/**
* <p>
import java.util.UUID;
import java.util.Vector;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.test.TestResult;
-import org.argeo.slc.test.TestResultPart;
-import org.argeo.slc.test.TestRun;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.test.TestResult;
+import org.argeo.api.slc.test.TestResultPart;
+import org.argeo.api.slc.test.TestRun;
/**
* Basic implementation of a test result containing only a list of result parts.
import java.util.UUID;
-import org.argeo.slc.deploy.DeployedSystem;
-import org.argeo.slc.test.ExecutableTestRun;
-import org.argeo.slc.test.TestData;
-import org.argeo.slc.test.TestDefinition;
-import org.argeo.slc.test.TestResult;
-import org.argeo.slc.test.WritableTestRun;
+import org.argeo.api.slc.deploy.DeployedSystem;
+import org.argeo.api.slc.test.ExecutableTestRun;
+import org.argeo.api.slc.test.TestData;
+import org.argeo.api.slc.test.TestDefinition;
+import org.argeo.api.slc.test.TestResult;
+import org.argeo.api.slc.test.WritableTestRun;
/**
* A basic bean implementation of a <code>WritableTestRun</code>, holding
package org.argeo.slc.runtime.test;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.test.TestStatus;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.test.TestStatus;
public abstract class SlcTestUtils {
public static String statusToString(Integer status) {
package org.argeo.slc.runtime.test;
-import org.argeo.slc.UnsupportedException;
-import org.argeo.slc.test.TestData;
-import org.argeo.slc.test.TestDataProvider;
+import org.argeo.api.slc.UnsupportedException;
+import org.argeo.api.slc.test.TestData;
+import org.argeo.api.slc.test.TestDataProvider;
/** Utilities for dealing with test datas. */
public class TestDataUtils {
-Subproject commit cabcc3462226b71849ca42301c21e05b63f150c2
+Subproject commit 979b11e352bda7d783c921a62e8cb5ed950a7564
major=2
minor=3
-micro=14
+micro=15
qualifier=
Bundle-Copyright= \
--- /dev/null
+argeo.osgi.start.5=\
+org.argeo.init,\
+org.argeo.rt.cms,\
javax.websocket.server,\
org.eclipse.jetty.util.component,\
org.eclipse.jetty.ee8.nested,\
+org.eclipse.jetty.session,\
+org.eclipse.jetty.ee8.security,\
*
\ No newline at end of file
import java.lang.management.ManagementFactory;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.HashMap;
import java.util.Objects;
import javax.servlet.ServletContextEvent;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.rap.rwt.application.Application;
import org.eclipse.rap.rwt.application.Application.OperationMode;
import org.eclipse.rap.rwt.application.ApplicationConfiguration;
import org.eclipse.rap.rwt.application.ApplicationRunner;
import org.eclipse.rap.rwt.application.EntryPoint;
+import org.eclipse.rap.rwt.application.EntryPointFactory;
import org.eclipse.rap.rwt.engine.RWTServlet;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
// rwt-resources requires a file system
try {
tempDir = Files.createTempDirectory("argeo-rwtRunner");
+ context.setAttribute(ApplicationConfiguration.RESOURCE_ROOT_LOCATION, tempDir.resolve("www").toString());
// FIXME we need a base directory
// context.setBaseResource(new PathResource(tempDir.resolve("www")));
} catch (IOException e) {
RwtRunner rwtRunner = new RwtRunner();
String entryPoint = "app";
- ApplicationConfiguration applicationConfiguration = (application) -> {
- application.setOperationMode(OperationMode.SWT_COMPATIBILITY);
- application.addEntryPoint("/" + entryPoint, () -> new EntryPoint() {
- @Override
- public int createUI() {
- MiniDesktopManager miniDesktopManager = new MiniDesktopManager(false, false);
- miniDesktopManager.init();
- miniDesktopManager.run();
- return 0;
- }
- }, null);
+ ApplicationConfiguration applicationConfiguration = new ApplicationConfiguration() {
+
+ @Override
+ public void configure(Application application) {
+ application.setOperationMode(OperationMode.SWT_COMPATIBILITY);
+ application.addEntryPoint("/" + entryPoint, new EntryPointFactory() {
+
+ @Override
+ public EntryPoint create() {
+ return new EntryPoint() {
+ @Override
+ public int createUI() {
+ MiniDesktopManager miniDesktopManager = new MiniDesktopManager(false, false);
+ miniDesktopManager.init();
+ miniDesktopManager.run();
+ return 0;
+ }
+ };
+ }
+ }, new HashMap<>());
+ }
};
rwtRunner.setApplicationConfiguration(applicationConfiguration);