From: Mathieu Baudier Date: Fri, 13 Feb 2015 08:26:33 +0000 (+0000) Subject: Move SLC API X-Git-Tag: argeo-slc-2.1.7~116 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=550e77c02caecd7b9aec42b3889e9751bb91623e;p=gpl%2Fargeo-slc.git Move SLC API git-svn-id: https://svn.argeo.org/slc/trunk@7834 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/org.argeo.slc.api/src/org/argeo/slc/BasicNameVersion.java b/org.argeo.slc.api/src/org/argeo/slc/BasicNameVersion.java new file mode 100644 index 000000000..9d8e71af0 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/BasicNameVersion.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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); + } +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/CategorizedNameVersion.java b/org.argeo.slc.api/src/org/argeo/slc/CategorizedNameVersion.java new file mode 100644 index 000000000..fd7d56d78 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/CategorizedNameVersion.java @@ -0,0 +1,10 @@ +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 CategorizedNameVersion extends NameVersion { + /** The category of the component. */ + public String getCategory(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/Condition.java b/org.argeo.slc.api/src/org/argeo/slc/Condition.java new file mode 100644 index 000000000..f5199ce4f --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/Condition.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc; + +/** Binary check on an arbitrary object. */ +public interface Condition { + /** + * Checks the condition. + * + * @return true, if the condition is verified, false if not. + */ + public Boolean check(T obj); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/DefaultNameVersion.java b/org.argeo.slc.api/src/org/argeo/slc/DefaultNameVersion.java new file mode 100644 index 000000000..fe230e66e --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/DefaultNameVersion.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc; + + +/** Canonical implementation of {@link NameVersion} */ +public class DefaultNameVersion implements NameVersion, + Comparable { + private String name; + private String version; + + public DefaultNameVersion() { + } + + 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() + version.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()); + } +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/ModuleSet.java b/org.argeo.slc.api/src/org/argeo/slc/ModuleSet.java new file mode 100644 index 000000000..fd125a244 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/ModuleSet.java @@ -0,0 +1,8 @@ +package org.argeo.slc; + +import java.util.Iterator; + +/** A set of {@link NameVersion}. */ +public interface ModuleSet { + Iterator nameVersions(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/NameVersion.java b/org.argeo.slc.api/src/org/argeo/slc/NameVersion.java new file mode 100644 index 000000000..0086cbb16 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/NameVersion.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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. */ + public String getName(); + + /** The version of the component. */ + public String getVersion(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/SlcConstants.java b/org.argeo.slc.api/src/org/argeo/slc/SlcConstants.java new file mode 100644 index 000000000..2b26e878f --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/SlcConstants.java @@ -0,0 +1,10 @@ +package org.argeo.slc; + +/** Constants useful across all SLC components */ +public interface SlcConstants { + /** Read-write role. */ + public final static String ROLE_SLC = "ROLE_SLC"; + + /** Read only unlogged user */ + public final static String USER_ANONYMOUS = "anonymous"; +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/SlcException.java b/org.argeo.slc.api/src/org/argeo/slc/SlcException.java new file mode 100644 index 000000000..408bd06df --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/SlcException.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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); + } + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/StreamReadable.java b/org.argeo.slc.api/src/org/argeo/slc/StreamReadable.java new file mode 100644 index 000000000..302a226e9 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/StreamReadable.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc; + +import java.io.InputStream; + +public interface StreamReadable { + public InputStream getInputStream(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/UnsupportedException.java b/org.argeo.slc.api/src/org/argeo/slc/UnsupportedException.java new file mode 100644 index 000000000..fe6332209 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/UnsupportedException.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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); + } + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/build/Distribution.java b/org.argeo.slc.api/src/org/argeo/slc/build/Distribution.java new file mode 100644 index 000000000..9e233e223 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/build/Distribution.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.build; + +/** A packaged software component */ +public interface Distribution { + public String getDistributionId(); + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/build/License.java b/org.argeo.slc.api/src/org/argeo/slc/build/License.java new file mode 100644 index 000000000..d115f450b --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/build/License.java @@ -0,0 +1,12 @@ +package org.argeo.slc.build; + +/** A software license */ +public interface License { + public String getName(); + + public String getUri(); + + public String getLink(); + + public String getText(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/build/ModularDistribution.java b/org.argeo.slc.api/src/org/argeo/slc/build/ModularDistribution.java new file mode 100644 index 000000000..0b917aa49 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/build/ModularDistribution.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/build/package.html b/org.argeo.slc.api/src/org/argeo/slc/build/package.html new file mode 100644 index 000000000..5da205278 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/build/package.html @@ -0,0 +1,6 @@ + + + +SLC Build: building of software systems. + + \ No newline at end of file diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/AbstractDeployedSystem.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/AbstractDeployedSystem.java new file mode 100644 index 000000000..4bb603b55 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/AbstractDeployedSystem.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import org.argeo.slc.UnsupportedException; +import org.argeo.slc.build.Distribution; + +public abstract class AbstractDeployedSystem implements DeployedSystem { + public String getDeployedSystemId() { + // TODO Auto-generated method stub + return null; + } + + public DeploymentData getDeploymentData() { + throw new UnsupportedException("Method not supported"); + } + + public Distribution getDistribution() { + throw new UnsupportedException("Method not supported"); + } + + public TargetData getTargetData() { + throw new UnsupportedException("Method not supported"); + } + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployEnvironment.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployEnvironment.java new file mode 100644 index 000000000..2dce868d1 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployEnvironment.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import java.io.File; +import java.util.Map; + +public interface DeployEnvironment { + public void unpackTo(Object packg, File targetLocation, + Map filter); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployedSystem.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployedSystem.java new file mode 100644 index 000000000..89c1708c5 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployedSystem.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import org.argeo.slc.build.Distribution; + +/** An instance of a software system. */ +public interface DeployedSystem extends TargetData { + /** Unique ID for this system instance. */ + public String getDeployedSystemId(); + + /** Underlying packages */ + public Distribution getDistribution(); + + /** Data required to initialize the instance (e.g. DB dump, etc.). */ + public DeploymentData getDeploymentData(); + + /** Resources required by the system (ports, disk location, etc.) */ + public TargetData getTargetData(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployedSystemManager.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployedSystemManager.java new file mode 100644 index 000000000..092ac5548 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeployedSystemManager.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +public interface DeployedSystemManager { + public void setDeployedSystem(T deployedSystem); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/Deployment.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/Deployment.java new file mode 100644 index 000000000..99f4e1037 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/Deployment.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import org.argeo.slc.build.Distribution; + +public interface Deployment extends Runnable{ + public DeployedSystem getDeployedSystem(); + + public void setTargetData(TargetData targetData); + + public void setDeploymentData(DeploymentData deploymentData); + + public void setDistribution(Distribution distribution); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/DeploymentData.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeploymentData.java new file mode 100644 index 000000000..e5b0f4044 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/DeploymentData.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +public interface DeploymentData { + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/DynamicRuntime.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/DynamicRuntime.java new file mode 100644 index 000000000..231d52af9 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/DynamicRuntime.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import org.argeo.slc.NameVersion; +import org.argeo.slc.build.Distribution; + +public interface DynamicRuntime extends + ModularDeployedSystem { + public void shutdown(); + + public M installModule(Distribution distribution); + + public void uninstallModule(NameVersion nameVersion); + + public void updateModule(NameVersion nameVersion); + + public void startModule(NameVersion nameVersion); + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/InstalledExecutables.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/InstalledExecutables.java new file mode 100644 index 000000000..0f9601c19 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/InstalledExecutables.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +public interface InstalledExecutables extends DeployedSystem { + public String getExecutablePath(String key); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/ModularDeployedSystem.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/ModularDeployedSystem.java new file mode 100644 index 000000000..6805eec00 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/ModularDeployedSystem.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import java.util.List; + +public interface ModularDeployedSystem extends DeployedSystem { + /** List the underlying deployed modules (in real time) */ + public List listModules(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/Module.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/Module.java new file mode 100644 index 000000000..2a0bd4d23 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/Module.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/ModuleDescriptor.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/ModuleDescriptor.java new file mode 100644 index 000000000..a0bddd1e5 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/ModuleDescriptor.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.argeo.slc.BasicNameVersion; + +/** The description of a versioned module. */ +public class ModuleDescriptor extends BasicNameVersion implements Serializable { + private static final long serialVersionUID = 4310820315478645419L; + private String title; + private String description; + private Map metadata = new HashMap(); + 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 getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + public Boolean getStarted() { + return started; + } + + public void setStarted(Boolean started) { + this.started = started; + } + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/ModulesManager.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/ModulesManager.java new file mode 100644 index 000000000..d7ec9453f --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/ModulesManager.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 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); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/TargetData.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/TargetData.java new file mode 100644 index 000000000..8472e7e3b --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/TargetData.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +public interface TargetData { + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/VersioningDriver.java b/org.argeo.slc.api/src/org/argeo/slc/deploy/VersioningDriver.java new file mode 100644 index 000000000..52659b7d5 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/VersioningDriver.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.deploy; + +import java.io.File; +import java.io.OutputStream; +import java.util.List; + +/** Abstracts common versioning operations */ +public interface VersioningDriver { + public void getFileFromRepository(String repositoryBaseUrl, + String location, OutputStream out); + + public List getChangedPaths(File repositoryRoot, Long revision); + + public String getRepositoryRoot(String repositoryUrl); + + public String getRelativePath(String repositoryUrl); + + public void updateToHead(File fileOrDir); + + public void importFileOrDir(String repositoryUrl, File fileOrDir); + + /** + * Checks out or update this versioned directory + * + * @return true if the content has changed, false otherwise + */ + public Boolean checkout(String repositoryUrl, File destDir, + Boolean recursive); + + public void createRepository(String filePath); + + public void commit(File fileOrDir, String commitMessage); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/deploy/package.html b/org.argeo.slc.api/src/org/argeo/slc/deploy/package.html new file mode 100644 index 000000000..f3a4c5bd6 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/deploy/package.html @@ -0,0 +1,6 @@ + + + +SLC Deploy: deployment of software systems. + + \ No newline at end of file diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionContext.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionContext.java new file mode 100644 index 000000000..056614314 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionContext.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +/** Variables or references attached to an execution (typically thread bounded).*/ +public interface ExecutionContext { + public final static String VAR_EXECUTION_CONTEXT_ID = "slcVar.executionContext.id"; + public final static String VAR_EXECUTION_CONTEXT_CREATION_DATE = "slcVar.executionContext.creationDate"; + public final static String VAR_FLOW_ID = "slcVar.flow.id"; + public final static String VAR_FLOW_NAME = "slcVar.flow.name"; + + public String getUuid(); + + /** @return the variable value, or null if not found. */ + public Object getVariable(String key); + + public void setVariable(String key, Object value); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlow.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlow.java new file mode 100644 index 000000000..520f249df --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlow.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 runnables(); + + /** + * If there is one and only one runnable wrapped return it, throw an + * exeception otherwise. + */ + public Runnable getRunnable(); + + /** + * The name of this execution flow. Can contains '/' which will be + * interpreted by UIs as a hierarchy; + */ + public String getName(); + + /** + * @deprecated will be removed in SLC 2.0, the path should be the part of + * the name with '/' + */ + public String getPath(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlowDescriptor.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlowDescriptor.java new file mode 100644 index 000000000..e3eea046f --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlowDescriptor.java @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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, executionSpec 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 values map. + * + * Generally, values object are either a PrimitiveAccessor or a + * RefValue 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 values; + private ExecutionSpec executionSpec; + + public ExecutionFlowDescriptor() { + } + + public ExecutionFlowDescriptor(String name, String description, + Map 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(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 getValues() { + return values; + } + + public ExecutionSpec getExecutionSpec() { + return executionSpec; + } + + public void setName(String name) { + this.name = name; + } + + public void setValues(Map 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; + } + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlowDescriptorConverter.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlowDescriptorConverter.java new file mode 100644 index 000000000..f43e14de3 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionFlowDescriptorConverter.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +import java.util.Map; + +/** + * Maps back and forth between {@link ExecutionFlowDescriptor} and + * {@link ExecutionFlow} + */ +public interface ExecutionFlowDescriptorConverter { + public Map convertValues( + ExecutionFlowDescriptor executionFlowDescriptor); + + public void addFlowsToDescriptor(ExecutionModuleDescriptor md, + Map executionFlows); + + public ExecutionFlowDescriptor getExecutionFlowDescriptor( + ExecutionFlow executionFlow); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModule.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModule.java new file mode 100644 index 000000000..79d788b34 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModule.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +@Deprecated +public interface ExecutionModule { +/* public String getName(); + + public String getVersion(); + + public ExecutionModuleDescriptor getDescriptor(); + + public void execute(ExecutionFlowDescriptor descriptor);*/ +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModuleDescriptor.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModuleDescriptor.java new file mode 100644 index 000000000..4de026822 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModuleDescriptor.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 executionSpecs = new ArrayList(); + private List executionFlows = new ArrayList(); + + public List getExecutionSpecs() { + return executionSpecs; + } + + public List 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 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 executionSpecs) { + this.executionSpecs = executionSpecs; + } + + public void setExecutionFlows(List executionFlows) { + this.executionFlows = executionFlows; + } +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModulesListener.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModulesListener.java new file mode 100644 index 000000000..52b52a649 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModulesListener.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModulesManager.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModulesManager.java new file mode 100644 index 000000000..06681747a --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionModulesManager.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 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 steps); + // + // /** + // * Register a notifier which will be notified based on the provided + // * properties. + // */ + // public void registerProcessNotifier(ExecutionProcessNotifier notifier, + // Map properties); + // + // /** Unregisters a notifier */ + // public void unregisterProcessNotifier(ExecutionProcessNotifier notifier, + // Map properties); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionProcess.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionProcess.java new file mode 100644 index 000000000..550c16484 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionProcess.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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.
+ * NEW => INITIALIZED => SCHEDULED => RUNNING
+ * RUNNING => {COMPLETED | ERROR | KILLED}
+ * {COMPLETED | ERROR | KILLED} => PURGED
+ * UNKOWN : this is a bug if this status occurs
+ */ +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 steps); + + public List getRealizedFlows(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionSpec.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionSpec.java new file mode 100644 index 000000000..49d7c795f --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionSpec.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 getAttributes(); + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionSpecAttribute.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionSpecAttribute.java new file mode 100644 index 000000000..a430e5bb0 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionSpecAttribute.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +/** + * Possible attribute of an execution flow. + * + * There are mainly two implementations :
+ * + Primitive attributes (no predefined choice, the end user must compute a + * String, a Float, an Integer...)
+ * + RefSpecAttribute which enable two things
+ * ++ a reference to another object of the application context
+ * ++ the display of some choices among which the end user can choose.
+ * + * @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 true, 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(); + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStack.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStack.java new file mode 100644 index 000000000..c4e88b93d --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStack.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +/** Deal with nested level of executions using different vartiables. */ +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); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStackLevel.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStackLevel.java new file mode 100644 index 000000000..7729d591a --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStackLevel.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +import java.util.Map; + +public interface ExecutionStackLevel { + public ExecutionFlow getExecutionFlow(); + + public Map getScopedObjects(); + + public String getUuid(); + + public Map getLocalVariables(); + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStep.java b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStep.java new file mode 100644 index 000000000..628a3b69d --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/ExecutionStep.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +import java.io.Serializable; +import java.util.Date; + +/** + * An atomic step to be notified in during an {@link ExecutionProcess}. Can be a + * log or the start/end of a phase, etc. + */ +public class ExecutionStep implements Serializable { + private static final long serialVersionUID = 798640526532912161L; + + public final static String PHASE_START = "PHASE_START"; + public final static String PHASE_END = "PHASE_END"; + public final static String ERROR = "ERROR"; + public final static String WARNING = "WARNING"; + public final static String INFO = "INFO"; + public final static String DEBUG = "DEBUG"; + public final static String TRACE = "TRACE"; + + /** @deprecated */ + public final static String START = "START"; + /** @deprecated */ + public final static String END = "END"; + + // TODO make the fields final and private when we don't need POJO support + // anymore (that + // is when SlcExecutionStep is removed) + protected String type; + protected String thread; + protected Date timestamp; + protected String log; + + private String location; + + /** Empty constructor */ + public ExecutionStep() { + Thread currentThread = Thread.currentThread(); + thread = currentThread.getName(); + } + + /** Creates a step at the current date */ + public ExecutionStep(String location, String type, String log) { + this(location, new Date(), type, log); + } + + /** Creates a step of the given type. */ + public ExecutionStep(String location, Date timestamp, String type, + String log) { + this(location, timestamp, type, log, Thread.currentThread().getName()); + } + + public ExecutionStep(String location, Date timestamp, String type, + String log, String thread) { + this.location = location; + this.type = type; + this.timestamp = timestamp; + this.thread = thread; + this.log = addLog(log); + } + + public String getType() { + return type; + } + + public Date getTimestamp() { + return timestamp; + } + + public String getThread() { + return thread; + } + + /** + * Return the string that should be stored in the log field. Can be null if + * another mechanism is used to store log lines. + */ + protected String addLog(String log) { + return log; + } + + public String getLog() { + return log; + } + + @Override + public String toString() { + return "Execution step, thread=" + thread + ", type=" + type; + } + + /** Typically the logging category */ + public String getLocation() { + return location; + } + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/RealizedFlow.java b/org.argeo.slc.api/src/org/argeo/slc/execution/RealizedFlow.java new file mode 100644 index 000000000..bf6f3d3ca --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/RealizedFlow.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.execution; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.argeo.slc.BasicNameVersion; +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 BasicNameVersion(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 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 values = new HashMap(); + for (String key : args.keySet()) { + String value = args.get(key); + values.put(key, value); + } + efd.setValues(values); + } + + realizedFlow.setFlowDescriptor(efd); + return realizedFlow; + } +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/SlcAgent.java b/org.argeo.slc.api/src/org/argeo/slc/execution/SlcAgent.java new file mode 100644 index 000000000..c96d4a884 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/SlcAgent.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 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 listExecutionModuleDescriptors(); + + /** @return true if still alive. */ + public boolean ping(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/execution/SlcAgentCli.java b/org.argeo.slc.api/src/org/argeo/slc/execution/SlcAgentCli.java new file mode 100644 index 000000000..497d1104d --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/execution/SlcAgentCli.java @@ -0,0 +1,14 @@ +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); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/package.html b/org.argeo.slc.api/src/org/argeo/slc/package.html new file mode 100644 index 000000000..db808c822 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/package.html @@ -0,0 +1,6 @@ + + + +Common classes of teh SLC framework. + + \ No newline at end of file diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/ExecutableTestRun.java b/org.argeo.slc.api/src/org/argeo/slc/test/ExecutableTestRun.java new file mode 100644 index 000000000..a70b592d9 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/ExecutableTestRun.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test; + + +/** A test run that can be executed */ +public interface ExecutableTestRun extends TestRun, Runnable { + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/IncompatibleTestDataException.java b/org.argeo.slc.api/src/org/argeo/slc/test/IncompatibleTestDataException.java new file mode 100644 index 000000000..4cc6ddde1 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/IncompatibleTestDataException.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test; + +import org.argeo.slc.SlcException; + +/** + * Exception to throw when a test definition cannot interpret the provided test + * data. + */ +public class IncompatibleTestDataException extends SlcException { + static final long serialVersionUID = 1l; + + public IncompatibleTestDataException(TestData testData, + TestDefinition testDefinition) { + super("TestData " + testData.getClass() + + " is not compatible with TestDefinition " + + testDefinition.getClass()); + } + + public IncompatibleTestDataException(TestRun testRun) { + super("TestData " + ((TestData) testRun.getTestData()).getClass() + + " is not compatible with TestDefinition " + + ((TestDefinition) testRun.getTestDefinition()).getClass()); + } +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestData.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestData.java new file mode 100644 index 000000000..1b3f46687 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestData.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test; + +/** + * Any data required by a test in order to run: configuration, expected, + * reached, etc. + */ +public interface TestData { + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestDataProvider.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestDataProvider.java new file mode 100644 index 000000000..711c17730 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestDataProvider.java @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test; + +public interface TestDataProvider { + public T getTestData(Class clss, String key); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestDefinition.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestDefinition.java new file mode 100644 index 000000000..5fea1dc98 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestDefinition.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test; + +/** + * The programmatic definition of a test, which will be associated with + * transient objects within a test run. + */ +public interface TestDefinition extends TestStatus { + /** Performs the test. */ + public void execute(TestRun testRun); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestResult.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestResult.java new file mode 100644 index 000000000..d3ef62bb8 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestResult.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 getAttributes(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestResultListener.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestResultListener.java new file mode 100644 index 000000000..788e1b8ad --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestResultListener.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test; + +/** Listener to the operations on a test result. */ +public interface TestResultListener { + /** 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); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestResultPart.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestResultPart.java new file mode 100644 index 000000000..aeac4ad63 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestResultPart.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 Exception. Can be null. */ + public String getExceptionMessage(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestRun.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestRun.java new file mode 100644 index 000000000..0935a5511 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestRun.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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 getTestDefinition(); + + /** Gets the related test data */ + public T getTestData(); + + /** Gets the related deployed system. */ + public T getDeployedSystem(); + + /** Gets the related result where to record results. */ + public T getTestResult(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestRunAware.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestRunAware.java new file mode 100644 index 000000000..3330cc847 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestRunAware.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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); + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/TestStatus.java b/org.argeo.slc.api/src/org/argeo/slc/test/TestStatus.java new file mode 100644 index 000000000..e7ebecfa8 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/TestStatus.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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. + *

+ *

    + *
  • {@link #PASSED}: the test succeeded
  • + *
  • {@link #FAILED}: the test could run, but did not reach the expected + * result
  • + *
  • {@link #ERROR}: an error during the test run prevented to get a + * significant information on the tested system.
  • + *
+ *

+ */ +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"; + +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/WritableTestRun.java b/org.argeo.slc.api/src/org/argeo/slc/test/WritableTestRun.java new file mode 100644 index 000000000..e11395025 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/WritableTestRun.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/context/ContextAware.java b/org.argeo.slc.api/src/org/argeo/slc/test/context/ContextAware.java new file mode 100644 index 000000000..cd9897e11 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/context/ContextAware.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test.context; + +import java.util.Map; + +/** Access to an SLC test context that is, maps of reached and expected values. */ +public interface ContextAware { + public final static String DEFAULT_SKIP_FLAG = "!"; + public final static String DEFAULT_ANY_FLAG = "*"; + + /** Retrieves reached values. */ + public Map getValues(); + + /** Set reached values. */ + public void setValues(Map values); + + /** Retrieves expected values. */ + public Map getExpectedValues(); + + public String getContextSkipFlag(); + + public String getContextAnyFlag(); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/context/ParentContextAware.java b/org.argeo.slc.api/src/org/argeo/slc/test/context/ParentContextAware.java new file mode 100644 index 000000000..0da990d31 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/context/ParentContextAware.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2007-2012 Argeo GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.argeo.slc.test.context; + +import java.util.Collection; + +public interface ParentContextAware extends ContextAware { + public Collection getChildContexts(); + + public void addChildContext(ContextAware contextAware); +} diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/context/package.html b/org.argeo.slc.api/src/org/argeo/slc/test/context/package.html new file mode 100644 index 000000000..cd08d63f3 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/context/package.html @@ -0,0 +1,6 @@ + + + +Context variables to be passed between parts of tests. + + \ No newline at end of file diff --git a/org.argeo.slc.api/src/org/argeo/slc/test/package.html b/org.argeo.slc.api/src/org/argeo/slc/test/package.html new file mode 100644 index 000000000..c70d2d151 --- /dev/null +++ b/org.argeo.slc.api/src/org/argeo/slc/test/package.html @@ -0,0 +1,6 @@ + + + +SLC Test: test of software systems. + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index f9ab9df16..4063097e1 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,12 @@ org.argeo.commons argeo-commons - 1.2.3 + 2.1.17-SNAPSHOT org.argeo.slc argeo-slc pom Argeo SLC - SLC is a framework integrating various build, deployment and testing technologies in order to build specific application life cycle management systems. 2.1.1-SNAPSHOT 2.1 @@ -17,14 +16,17 @@ 2.1.1-SNAPSHOT - runtime - modules - plugins - lib - dep - archetypes - dist - demo + org.argeo.slc.api + + + + + + + + + + http://projects.argeo.org/slc/ @@ -106,7 +108,7 @@ limitations under the License. argeo-commons - http://repo.argeo.org/data/public/java/argeo-commons-1.2 + http://repo.argeo.org/data/public/java/argeo-commons-2.1 true daily diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java deleted file mode 100644 index 9d8e71af0..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/BasicNameVersion.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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); - } -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/CategorizedNameVersion.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/CategorizedNameVersion.java deleted file mode 100644 index fd7d56d78..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/CategorizedNameVersion.java +++ /dev/null @@ -1,10 +0,0 @@ -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 CategorizedNameVersion extends NameVersion { - /** The category of the component. */ - public String getCategory(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/Condition.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/Condition.java deleted file mode 100644 index f5199ce4f..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/Condition.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc; - -/** Binary check on an arbitrary object. */ -public interface Condition { - /** - * Checks the condition. - * - * @return true, if the condition is verified, false if not. - */ - public Boolean check(T obj); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/DefaultNameVersion.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/DefaultNameVersion.java deleted file mode 100644 index fe230e66e..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/DefaultNameVersion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc; - - -/** Canonical implementation of {@link NameVersion} */ -public class DefaultNameVersion implements NameVersion, - Comparable { - private String name; - private String version; - - public DefaultNameVersion() { - } - - 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() + version.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()); - } -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/ModuleSet.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/ModuleSet.java deleted file mode 100644 index fd125a244..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/ModuleSet.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.argeo.slc; - -import java.util.Iterator; - -/** A set of {@link NameVersion}. */ -public interface ModuleSet { - Iterator nameVersions(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/NameVersion.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/NameVersion.java deleted file mode 100644 index 0086cbb16..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/NameVersion.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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. */ - public String getName(); - - /** The version of the component. */ - public String getVersion(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/SlcConstants.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/SlcConstants.java deleted file mode 100644 index 2b26e878f..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/SlcConstants.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.argeo.slc; - -/** Constants useful across all SLC components */ -public interface SlcConstants { - /** Read-write role. */ - public final static String ROLE_SLC = "ROLE_SLC"; - - /** Read only unlogged user */ - public final static String USER_ANONYMOUS = "anonymous"; -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/SlcException.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/SlcException.java deleted file mode 100644 index 408bd06df..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/SlcException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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); - } - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/StreamReadable.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/StreamReadable.java deleted file mode 100644 index 302a226e9..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/StreamReadable.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc; - -import java.io.InputStream; - -public interface StreamReadable { - public InputStream getInputStream(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/UnsupportedException.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/UnsupportedException.java deleted file mode 100644 index fe6332209..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/UnsupportedException.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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); - } - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/Distribution.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/Distribution.java deleted file mode 100644 index 9e233e223..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/Distribution.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.build; - -/** A packaged software component */ -public interface Distribution { - public String getDistributionId(); - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/License.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/License.java deleted file mode 100644 index d115f450b..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/License.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.argeo.slc.build; - -/** A software license */ -public interface License { - public String getName(); - - public String getUri(); - - public String getLink(); - - public String getText(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/ModularDistribution.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/ModularDistribution.java deleted file mode 100644 index 0b917aa49..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/ModularDistribution.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/package.html b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/package.html deleted file mode 100644 index 5da205278..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/build/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -SLC Build: building of software systems. - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/AbstractDeployedSystem.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/AbstractDeployedSystem.java deleted file mode 100644 index 4bb603b55..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/AbstractDeployedSystem.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import org.argeo.slc.UnsupportedException; -import org.argeo.slc.build.Distribution; - -public abstract class AbstractDeployedSystem implements DeployedSystem { - public String getDeployedSystemId() { - // TODO Auto-generated method stub - return null; - } - - public DeploymentData getDeploymentData() { - throw new UnsupportedException("Method not supported"); - } - - public Distribution getDistribution() { - throw new UnsupportedException("Method not supported"); - } - - public TargetData getTargetData() { - throw new UnsupportedException("Method not supported"); - } - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployEnvironment.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployEnvironment.java deleted file mode 100644 index 2dce868d1..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployEnvironment.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import java.io.File; -import java.util.Map; - -public interface DeployEnvironment { - public void unpackTo(Object packg, File targetLocation, - Map filter); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployedSystem.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployedSystem.java deleted file mode 100644 index 89c1708c5..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployedSystem.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import org.argeo.slc.build.Distribution; - -/** An instance of a software system. */ -public interface DeployedSystem extends TargetData { - /** Unique ID for this system instance. */ - public String getDeployedSystemId(); - - /** Underlying packages */ - public Distribution getDistribution(); - - /** Data required to initialize the instance (e.g. DB dump, etc.). */ - public DeploymentData getDeploymentData(); - - /** Resources required by the system (ports, disk location, etc.) */ - public TargetData getTargetData(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployedSystemManager.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployedSystemManager.java deleted file mode 100644 index 092ac5548..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeployedSystemManager.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -public interface DeployedSystemManager { - public void setDeployedSystem(T deployedSystem); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java deleted file mode 100644 index 99f4e1037..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Deployment.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import org.argeo.slc.build.Distribution; - -public interface Deployment extends Runnable{ - public DeployedSystem getDeployedSystem(); - - public void setTargetData(TargetData targetData); - - public void setDeploymentData(DeploymentData deploymentData); - - public void setDistribution(Distribution distribution); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeploymentData.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeploymentData.java deleted file mode 100644 index e5b0f4044..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DeploymentData.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -public interface DeploymentData { - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DynamicRuntime.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DynamicRuntime.java deleted file mode 100644 index 231d52af9..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/DynamicRuntime.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import org.argeo.slc.NameVersion; -import org.argeo.slc.build.Distribution; - -public interface DynamicRuntime extends - ModularDeployedSystem { - public void shutdown(); - - public M installModule(Distribution distribution); - - public void uninstallModule(NameVersion nameVersion); - - public void updateModule(NameVersion nameVersion); - - public void startModule(NameVersion nameVersion); - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/InstalledExecutables.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/InstalledExecutables.java deleted file mode 100644 index 0f9601c19..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/InstalledExecutables.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -public interface InstalledExecutables extends DeployedSystem { - public String getExecutablePath(String key); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModularDeployedSystem.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModularDeployedSystem.java deleted file mode 100644 index 6805eec00..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModularDeployedSystem.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import java.util.List; - -public interface ModularDeployedSystem extends DeployedSystem { - /** List the underlying deployed modules (in real time) */ - public List listModules(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Module.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Module.java deleted file mode 100644 index 2a0bd4d23..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/Module.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModuleDescriptor.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModuleDescriptor.java deleted file mode 100644 index a0bddd1e5..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModuleDescriptor.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.argeo.slc.BasicNameVersion; - -/** The description of a versioned module. */ -public class ModuleDescriptor extends BasicNameVersion implements Serializable { - private static final long serialVersionUID = 4310820315478645419L; - private String title; - private String description; - private Map metadata = new HashMap(); - 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 getMetadata() { - return metadata; - } - - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - public Boolean getStarted() { - return started; - } - - public void setStarted(Boolean started) { - this.started = started; - } - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModulesManager.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModulesManager.java deleted file mode 100644 index d7ec9453f..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/ModulesManager.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 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); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/TargetData.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/TargetData.java deleted file mode 100644 index 8472e7e3b..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/TargetData.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -public interface TargetData { - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/VersioningDriver.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/VersioningDriver.java deleted file mode 100644 index 52659b7d5..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/VersioningDriver.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.deploy; - -import java.io.File; -import java.io.OutputStream; -import java.util.List; - -/** Abstracts common versioning operations */ -public interface VersioningDriver { - public void getFileFromRepository(String repositoryBaseUrl, - String location, OutputStream out); - - public List getChangedPaths(File repositoryRoot, Long revision); - - public String getRepositoryRoot(String repositoryUrl); - - public String getRelativePath(String repositoryUrl); - - public void updateToHead(File fileOrDir); - - public void importFileOrDir(String repositoryUrl, File fileOrDir); - - /** - * Checks out or update this versioned directory - * - * @return true if the content has changed, false otherwise - */ - public Boolean checkout(String repositoryUrl, File destDir, - Boolean recursive); - - public void createRepository(String filePath); - - public void commit(File fileOrDir, String commitMessage); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/package.html b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/package.html deleted file mode 100644 index f3a4c5bd6..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/deploy/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -SLC Deploy: deployment of software systems. - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionContext.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionContext.java deleted file mode 100644 index 056614314..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionContext.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -/** Variables or references attached to an execution (typically thread bounded).*/ -public interface ExecutionContext { - public final static String VAR_EXECUTION_CONTEXT_ID = "slcVar.executionContext.id"; - public final static String VAR_EXECUTION_CONTEXT_CREATION_DATE = "slcVar.executionContext.creationDate"; - public final static String VAR_FLOW_ID = "slcVar.flow.id"; - public final static String VAR_FLOW_NAME = "slcVar.flow.name"; - - public String getUuid(); - - /** @return the variable value, or null if not found. */ - public Object getVariable(String key); - - public void setVariable(String key, Object value); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java deleted file mode 100644 index 520f249df..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlow.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 runnables(); - - /** - * If there is one and only one runnable wrapped return it, throw an - * exeception otherwise. - */ - public Runnable getRunnable(); - - /** - * The name of this execution flow. Can contains '/' which will be - * interpreted by UIs as a hierarchy; - */ - public String getName(); - - /** - * @deprecated will be removed in SLC 2.0, the path should be the part of - * the name with '/' - */ - public String getPath(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptor.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptor.java deleted file mode 100644 index e3eea046f..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptor.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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, executionSpec 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 values map. - * - * Generally, values object are either a PrimitiveAccessor or a - * RefValue 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 values; - private ExecutionSpec executionSpec; - - public ExecutionFlowDescriptor() { - } - - public ExecutionFlowDescriptor(String name, String description, - Map 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(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 getValues() { - return values; - } - - public ExecutionSpec getExecutionSpec() { - return executionSpec; - } - - public void setName(String name) { - this.name = name; - } - - public void setValues(Map 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; - } - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptorConverter.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptorConverter.java deleted file mode 100644 index f43e14de3..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionFlowDescriptorConverter.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -import java.util.Map; - -/** - * Maps back and forth between {@link ExecutionFlowDescriptor} and - * {@link ExecutionFlow} - */ -public interface ExecutionFlowDescriptorConverter { - public Map convertValues( - ExecutionFlowDescriptor executionFlowDescriptor); - - public void addFlowsToDescriptor(ExecutionModuleDescriptor md, - Map executionFlows); - - public ExecutionFlowDescriptor getExecutionFlowDescriptor( - ExecutionFlow executionFlow); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModule.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModule.java deleted file mode 100644 index 79d788b34..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModule.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -@Deprecated -public interface ExecutionModule { -/* public String getName(); - - public String getVersion(); - - public ExecutionModuleDescriptor getDescriptor(); - - public void execute(ExecutionFlowDescriptor descriptor);*/ -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModuleDescriptor.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModuleDescriptor.java deleted file mode 100644 index 4de026822..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModuleDescriptor.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 executionSpecs = new ArrayList(); - private List executionFlows = new ArrayList(); - - public List getExecutionSpecs() { - return executionSpecs; - } - - public List 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 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 executionSpecs) { - this.executionSpecs = executionSpecs; - } - - public void setExecutionFlows(List executionFlows) { - this.executionFlows = executionFlows; - } -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModulesListener.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModulesListener.java deleted file mode 100644 index 52b52a649..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModulesListener.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModulesManager.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModulesManager.java deleted file mode 100644 index 06681747a..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionModulesManager.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 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 steps); - // - // /** - // * Register a notifier which will be notified based on the provided - // * properties. - // */ - // public void registerProcessNotifier(ExecutionProcessNotifier notifier, - // Map properties); - // - // /** Unregisters a notifier */ - // public void unregisterProcessNotifier(ExecutionProcessNotifier notifier, - // Map properties); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionProcess.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionProcess.java deleted file mode 100644 index 550c16484..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionProcess.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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.
- * NEW => INITIALIZED => SCHEDULED => RUNNING
- * RUNNING => {COMPLETED | ERROR | KILLED}
- * {COMPLETED | ERROR | KILLED} => PURGED
- * UNKOWN : this is a bug if this status occurs
- */ -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 steps); - - public List getRealizedFlows(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionSpec.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionSpec.java deleted file mode 100644 index 49d7c795f..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionSpec.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 getAttributes(); - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionSpecAttribute.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionSpecAttribute.java deleted file mode 100644 index a430e5bb0..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionSpecAttribute.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -/** - * Possible attribute of an execution flow. - * - * There are mainly two implementations :
- * + Primitive attributes (no predefined choice, the end user must compute a - * String, a Float, an Integer...)
- * + RefSpecAttribute which enable two things
- * ++ a reference to another object of the application context
- * ++ the display of some choices among which the end user can choose.
- * - * @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 true, 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(); - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStack.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStack.java deleted file mode 100644 index c4e88b93d..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStack.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -/** Deal with nested level of executions using different vartiables. */ -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); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStackLevel.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStackLevel.java deleted file mode 100644 index 7729d591a..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStackLevel.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -import java.util.Map; - -public interface ExecutionStackLevel { - public ExecutionFlow getExecutionFlow(); - - public Map getScopedObjects(); - - public String getUuid(); - - public Map getLocalVariables(); - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStep.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStep.java deleted file mode 100644 index 628a3b69d..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/ExecutionStep.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -import java.io.Serializable; -import java.util.Date; - -/** - * An atomic step to be notified in during an {@link ExecutionProcess}. Can be a - * log or the start/end of a phase, etc. - */ -public class ExecutionStep implements Serializable { - private static final long serialVersionUID = 798640526532912161L; - - public final static String PHASE_START = "PHASE_START"; - public final static String PHASE_END = "PHASE_END"; - public final static String ERROR = "ERROR"; - public final static String WARNING = "WARNING"; - public final static String INFO = "INFO"; - public final static String DEBUG = "DEBUG"; - public final static String TRACE = "TRACE"; - - /** @deprecated */ - public final static String START = "START"; - /** @deprecated */ - public final static String END = "END"; - - // TODO make the fields final and private when we don't need POJO support - // anymore (that - // is when SlcExecutionStep is removed) - protected String type; - protected String thread; - protected Date timestamp; - protected String log; - - private String location; - - /** Empty constructor */ - public ExecutionStep() { - Thread currentThread = Thread.currentThread(); - thread = currentThread.getName(); - } - - /** Creates a step at the current date */ - public ExecutionStep(String location, String type, String log) { - this(location, new Date(), type, log); - } - - /** Creates a step of the given type. */ - public ExecutionStep(String location, Date timestamp, String type, - String log) { - this(location, timestamp, type, log, Thread.currentThread().getName()); - } - - public ExecutionStep(String location, Date timestamp, String type, - String log, String thread) { - this.location = location; - this.type = type; - this.timestamp = timestamp; - this.thread = thread; - this.log = addLog(log); - } - - public String getType() { - return type; - } - - public Date getTimestamp() { - return timestamp; - } - - public String getThread() { - return thread; - } - - /** - * Return the string that should be stored in the log field. Can be null if - * another mechanism is used to store log lines. - */ - protected String addLog(String log) { - return log; - } - - public String getLog() { - return log; - } - - @Override - public String toString() { - return "Execution step, thread=" + thread + ", type=" + type; - } - - /** Typically the logging category */ - public String getLocation() { - return location; - } - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/RealizedFlow.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/RealizedFlow.java deleted file mode 100644 index bf6f3d3ca..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/RealizedFlow.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.execution; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.argeo.slc.BasicNameVersion; -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 BasicNameVersion(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 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 values = new HashMap(); - for (String key : args.keySet()) { - String value = args.get(key); - values.put(key, value); - } - efd.setValues(values); - } - - realizedFlow.setFlowDescriptor(efd); - return realizedFlow; - } -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/SlcAgent.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/SlcAgent.java deleted file mode 100644 index c96d4a884..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/SlcAgent.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 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 listExecutionModuleDescriptors(); - - /** @return true if still alive. */ - public boolean ping(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/SlcAgentCli.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/SlcAgentCli.java deleted file mode 100644 index 497d1104d..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/execution/SlcAgentCli.java +++ /dev/null @@ -1,14 +0,0 @@ -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); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/package.html b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/package.html deleted file mode 100644 index db808c822..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -Common classes of teh SLC framework. - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java deleted file mode 100644 index a70b592d9..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/ExecutableTestRun.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test; - - -/** A test run that can be executed */ -public interface ExecutableTestRun extends TestRun, Runnable { - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/IncompatibleTestDataException.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/IncompatibleTestDataException.java deleted file mode 100644 index 4cc6ddde1..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/IncompatibleTestDataException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test; - -import org.argeo.slc.SlcException; - -/** - * Exception to throw when a test definition cannot interpret the provided test - * data. - */ -public class IncompatibleTestDataException extends SlcException { - static final long serialVersionUID = 1l; - - public IncompatibleTestDataException(TestData testData, - TestDefinition testDefinition) { - super("TestData " + testData.getClass() - + " is not compatible with TestDefinition " - + testDefinition.getClass()); - } - - public IncompatibleTestDataException(TestRun testRun) { - super("TestData " + ((TestData) testRun.getTestData()).getClass() - + " is not compatible with TestDefinition " - + ((TestDefinition) testRun.getTestDefinition()).getClass()); - } -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestData.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestData.java deleted file mode 100644 index 1b3f46687..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestData.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test; - -/** - * Any data required by a test in order to run: configuration, expected, - * reached, etc. - */ -public interface TestData { - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestDataProvider.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestDataProvider.java deleted file mode 100644 index 711c17730..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestDataProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test; - -public interface TestDataProvider { - public T getTestData(Class clss, String key); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestDefinition.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestDefinition.java deleted file mode 100644 index 5fea1dc98..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestDefinition.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test; - -/** - * The programmatic definition of a test, which will be associated with - * transient objects within a test run. - */ -public interface TestDefinition extends TestStatus { - /** Performs the test. */ - public void execute(TestRun testRun); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResult.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResult.java deleted file mode 100644 index d3ef62bb8..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResult.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 getAttributes(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResultListener.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResultListener.java deleted file mode 100644 index 788e1b8ad..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResultListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test; - -/** Listener to the operations on a test result. */ -public interface TestResultListener { - /** 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); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResultPart.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResultPart.java deleted file mode 100644 index aeac4ad63..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestResultPart.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 Exception. Can be null. */ - public String getExceptionMessage(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestRun.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestRun.java deleted file mode 100644 index 0935a5511..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestRun.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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 getTestDefinition(); - - /** Gets the related test data */ - public T getTestData(); - - /** Gets the related deployed system. */ - public T getDeployedSystem(); - - /** Gets the related result where to record results. */ - public T getTestResult(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestRunAware.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestRunAware.java deleted file mode 100644 index 3330cc847..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestRunAware.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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); - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestStatus.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestStatus.java deleted file mode 100644 index e7ebecfa8..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/TestStatus.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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. - *

- *

    - *
  • {@link #PASSED}: the test succeeded
  • - *
  • {@link #FAILED}: the test could run, but did not reach the expected - * result
  • - *
  • {@link #ERROR}: an error during the test run prevented to get a - * significant information on the tested system.
  • - *
- *

- */ -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"; - -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/WritableTestRun.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/WritableTestRun.java deleted file mode 100644 index e11395025..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/WritableTestRun.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -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); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/ContextAware.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/ContextAware.java deleted file mode 100644 index cd9897e11..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/ContextAware.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test.context; - -import java.util.Map; - -/** Access to an SLC test context that is, maps of reached and expected values. */ -public interface ContextAware { - public final static String DEFAULT_SKIP_FLAG = "!"; - public final static String DEFAULT_ANY_FLAG = "*"; - - /** Retrieves reached values. */ - public Map getValues(); - - /** Set reached values. */ - public void setValues(Map values); - - /** Retrieves expected values. */ - public Map getExpectedValues(); - - public String getContextSkipFlag(); - - public String getContextAnyFlag(); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/ParentContextAware.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/ParentContextAware.java deleted file mode 100644 index 0da990d31..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/ParentContextAware.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.slc.test.context; - -import java.util.Collection; - -public interface ParentContextAware extends ContextAware { - public Collection getChildContexts(); - - public void addChildContext(ContextAware contextAware); -} diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/package.html b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/package.html deleted file mode 100644 index cd08d63f3..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/context/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -Context variables to be passed between parts of tests. - - \ No newline at end of file diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/package.html b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/package.html deleted file mode 100644 index c70d2d151..000000000 --- a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/test/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - - -SLC Test: test of software systems. - - \ No newline at end of file