SLC Flow Spring XML format v1.2
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 22 Oct 2012 10:38:04 +0000 (10:38 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 22 Oct 2012 10:38:04 +0000 (10:38 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@5629 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

demo/modules/org.argeo.slc.demo.minimal/META-INF/spring/helloworld.xml
demo/slc_demo_rcp.properties
runtime/org.argeo.slc.core/META-INF/spring.schemas
runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/xml/FlowBeanDefinitionParser.java
runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/xml/SpecBeanDefinitionParser.java
runtime/org.argeo.slc.core/src/main/resources/org/argeo/slc/core/execution/xml/slc-flow-1.2.xsd [new file with mode: 0644]
runtime/org.argeo.slc.launcher/build.properties
runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java
runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/deploy/OsgiResourceSet.java
runtime/org.argeo.slc.support.simple/src/main/resources/org/argeo/slc/lib/linux/redhat.xml

index 605dd087a66cb34c0005418516cb9afd8aa28b4c..0d249dc9c9602600208b8e6c8227d895ee11cc8b 100644 (file)
@@ -3,7 +3,7 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
-       http://www.argeo.org/schema/slc-flow http://www.argeo.org/schema/slc-flow-0.12.xsd">\r
+       http://www.argeo.org/schema/slc-flow http://www.argeo.org/schema/slc-flow-1.2.xsd">\r
 \r
        <!-- Hello world -->\r
        <flow:flow name="hello">\r
                <bean p:message="Hello World!" class="org.argeo.slc.core.execution.tasks.Echo" />\r
        </flow:flow>\r
 \r
-       <flow:spec id="helloSpec">\r
-               <flow:primitive name="testKey" value="777" isParameter="false" />\r
-       </flow:spec>\r
 \r
-       <flow:flow name="HelloWorld/WithVar" spec="helloSpec">\r
+       <flow:flow name="HelloWorld/WithVar">\r
                <description>Print Hello World! with variable</description>\r
+               <flow:spec>\r
+                       <flow:primitive name="testKey" value="777" />\r
+               </flow:spec>\r
                <bean p:message="Hello World! @{testKey}" class="org.argeo.slc.core.execution.tasks.Echo">\r
                        <flow:variable proxy-target-class="false" />\r
                </bean>\r
index b0e35fd92231ab2ea3a082c3a8f59c737d8ac149..e711309935274ce0ce4bd0c6d4572b999d4b3903 100644 (file)
@@ -8,7 +8,6 @@ org.argeo.slc.agent,\
 org.argeo.slc.agent.jcr,\
 org.argeo.slc.support.maven,\
 org.argeo.slc.server.repo,\
-org.argeo.infra.slc.dist,\
 
 # Start internal web server
 #org.argeo.dep.osgi.catalina.start,\
@@ -19,8 +18,6 @@ slc.executionModules=org.argeo.slc.demo.ant,\
 org.argeo.slc.demo.basic,\
 org.argeo.slc.demo.minimal,\
 
-#spring.security.strategy=MODE_INHERITABLETHREADLOCAL
-
 eclipse.application=org.argeo.slc.client.rcp.application
 org.argeo.security.ui.initialPerspective=org.argeo.slc.client.ui.slcExecutionPerspective
 #org.argeo.security.ui.initialPerspective=org.argeo.slc.client.ui.dist.distributionPerspective
index 07987bbdd4ecf4ea3dd5f7b5beec939b7d28107b..229d4c5f6c75353a5beea5c4d54655f7f9e98cda 100644 (file)
@@ -1,2 +1,3 @@
-http\://www.argeo.org/schema/slc-flow.xsd=org/argeo/slc/core/execution/xml/slc-flow-0.12.xsd
+http\://www.argeo.org/schema/slc-flow.xsd=org/argeo/slc/core/execution/xml/slc-flow-1.2.xsd
+http\://www.argeo.org/schema/slc-flow-1.2.xsd=org/argeo/slc/core/execution/xml/slc-flow-1.2.xsd
 http\://www.argeo.org/schema/slc-flow-0.12.xsd=org/argeo/slc/core/execution/xml/slc-flow-0.12.xsd
index f2e961fbcd0745b2f618210d67c03ee75e14ae0a..23b05074840ef8b1ac9bc3eb0e0c397a0b96ccd0 100644 (file)
@@ -18,6 +18,8 @@ package org.argeo.slc.core.execution.xml;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.core.execution.DefaultExecutionFlow;
 import org.argeo.slc.execution.ExecutionFlow;
@@ -35,9 +37,10 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+/** Interprets the <flow:flow> tag */
 public class FlowBeanDefinitionParser extends
                AbstractSingleBeanDefinitionParser {
-       // private Log log = LogFactory.getLog(FlowBeanDefinitionParser.class);
+       private Log log = LogFactory.getLog(FlowBeanDefinitionParser.class);
 
        @SuppressWarnings("unchecked")
        @Override
@@ -45,7 +48,7 @@ public class FlowBeanDefinitionParser extends
                        BeanDefinitionBuilder builder) {
                String path = element.getAttribute("path");
                if (StringUtils.hasText(path))
-                       builder.addPropertyValue("path", path);
+                       log.warn("The 'path' attribute is not used anymore to build flows");
 
                String spec = element.getAttribute("spec");
                if (StringUtils.hasText(spec))
@@ -63,14 +66,17 @@ public class FlowBeanDefinitionParser extends
                builder.getBeanDefinition().setDescription(
                                DomUtils.getChildElementValueByTagName(element, "description"));
 
-               List<Element> execElems = new ArrayList<Element>();
                List<Element> argsElems = new ArrayList<Element>();
+               List<Element> execElems = new ArrayList<Element>();
+               List<Element> specElems = new ArrayList<Element>();
                NodeList nodeList = element.getChildNodes();
                for (int i = 0; i < nodeList.getLength(); i++) {
                        Node node = nodeList.item(i);
                        if (node instanceof Element) {
                                if (DomUtils.nodeNameEquals(node, "arg"))
                                        argsElems.add((Element) node);
+                               else if (DomUtils.nodeNameEquals(node, "spec"))
+                                       specElems.add((Element) node);
                                else if (!DomUtils.nodeNameEquals(node, "description"))
                                        execElems.add((Element) node);
                        }
@@ -91,6 +97,18 @@ public class FlowBeanDefinitionParser extends
                                        .addGenericArgumentValue(args);
                }
 
+               // Execution specs
+               if (StringUtils.hasText(spec) && specElems.size() != 0)
+                       throw new SlcException("A flow cannot have multiple specs");
+               if (specElems.size() == 1) {
+                       Object specObj = NamespaceUtils.parseBeanOrReference(
+                                       specElems.get(0), parserContext,
+                                       builder.getBeanDefinition());
+                       builder.getBeanDefinition().getConstructorArgumentValues()
+                                       .addGenericArgumentValue(specObj);
+               } else if (specElems.size() > 1)
+                       throw new SlcException("A flow cannot have multiple specs");
+
                // Executables
                if (execElems.size() != 0) {
                        ManagedList executables = new ManagedList(execElems.size());
@@ -116,8 +134,8 @@ public class FlowBeanDefinitionParser extends
                        } catch (ClassNotFoundException e) {
                                try {
                                        return (Class<? extends ExecutionFlow>) Thread
-                                                       .currentThread().getContextClassLoader().loadClass(
-                                                                       clss);
+                                                       .currentThread().getContextClassLoader()
+                                                       .loadClass(clss);
                                } catch (ClassNotFoundException e1) {
                                        throw new SlcException("Cannot load class " + clss, e);
                                }
index 7aa6d9faa78b1b4ca38734d8a8129ddcdebfbf42..704baccbb294c9c72f71cee63e4ccec4a5291cb3 100644 (file)
@@ -33,6 +33,7 @@ import org.springframework.util.StringUtils;
 import org.springframework.util.xml.DomUtils;
 import org.w3c.dom.Element;
 
+/** Interprets the <flow:spec> tag */
 public class SpecBeanDefinitionParser extends
                AbstractSingleBeanDefinitionParser {
        private Log log = LogFactory.getLog(SpecBeanDefinitionParser.class);
@@ -41,9 +42,9 @@ public class SpecBeanDefinitionParser extends
        @Override
        protected void doParse(Element element, ParserContext parserContext,
                        BeanDefinitionBuilder builder) {
-               builder.getBeanDefinition().setDescription(DomUtils.getChildElementValueByTagName(element, 
-               "description"));                
-               
+               builder.getBeanDefinition().setDescription(
+                               DomUtils.getChildElementValueByTagName(element, "description"));
+
                ManagedMap attributes = new ManagedMap();
 
                // Primitives
@@ -82,8 +83,8 @@ public class SpecBeanDefinitionParser extends
                                for (Element choiceElem : choices) {
                                        BeanDefinitionBuilder choiceBuilder = BeanDefinitionBuilder
                                                        .genericBeanDefinition(RefValueChoice.class);
-                                       choiceBuilder.addPropertyValue("name", choiceElem
-                                                       .getAttribute("name"));
+                                       choiceBuilder.addPropertyValue("name",
+                                                       choiceElem.getAttribute("name"));
                                        String desc = choiceElem.getAttribute("description");
                                        if (StringUtils.hasText(desc))
                                                choiceBuilder.addPropertyValue("description", desc);
@@ -93,8 +94,8 @@ public class SpecBeanDefinitionParser extends
                                refAttrBuilder.addPropertyValue("choices", choiceBeans);
                        }
 
-                       putInAttributes(attributes, refAttrElem, refAttrBuilder
-                                       .getBeanDefinition(), "ref");
+                       putInAttributes(attributes, refAttrElem,
+                                       refAttrBuilder.getBeanDefinition(), "ref");
                }
 
                builder.addPropertyValue("attributes", attributes);
@@ -102,9 +103,11 @@ public class SpecBeanDefinitionParser extends
 
        protected void addCommonProperties(Element element,
                        ParserContext parserContext, BeanDefinitionBuilder specAttr) {
+               addBooleanProperty("isImmutable", specAttr, element);
+               addBooleanProperty("isConstant", specAttr, element);
+               addBooleanProperty("isHidden", specAttr, element);
                addBooleanProperty("isParameter", specAttr, element);
                addBooleanProperty("isFrozen", specAttr, element);
-               addBooleanProperty("isHidden", specAttr, element);
 
                Object value = NamespaceUtils.parseValue(element, parserContext,
                                specAttr.getBeanDefinition(), "value");
diff --git a/runtime/org.argeo.slc.core/src/main/resources/org/argeo/slc/core/execution/xml/slc-flow-1.2.xsd b/runtime/org.argeo.slc.core/src/main/resources/org/argeo/slc/core/execution/xml/slc-flow-1.2.xsd
new file mode 100644 (file)
index 0000000..308c38f
--- /dev/null
@@ -0,0 +1,401 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+       xmlns:flow="http://www.argeo.org/schema/slc-flow" xmlns:beans="http://www.springframework.org/schema/beans"
+       targetNamespace="http://www.argeo.org/schema/slc-flow"
+       elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+       <xsd:import namespace="http://www.springframework.org/schema/beans"
+               schemaLocation="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" />
+
+       <xsd:annotation>
+               <xsd:documentation><![CDATA[
+       SLC Flow Schema, version 1.2
+       Authors: Mathieu Baudier
+       
+       This simplifies the definition of SLC flows and their integration with 
+       regular Spring beans.
+               ]]></xsd:documentation>
+       </xsd:annotation>
+
+       <xsd:element name="flow">
+               <xsd:annotation>
+                       <xsd:documentation><![CDATA[
+       Adds an SLC execution flow, using the default implementation.
+                       ]]></xsd:documentation>
+               </xsd:annotation>
+               <xsd:complexType>
+                       <xsd:complexContent>
+                               <xsd:extension base="beans:identifiedType">
+                                       <xsd:sequence>
+                                               <xsd:element ref="beans:description" minOccurs="0" />
+                                               <xsd:sequence>
+                                                       <xsd:element name="arg" minOccurs="0" maxOccurs="unbounded"
+                                                               type="flow:argType">
+                                                               <xsd:annotation>
+                                                                       <xsd:documentation><![CDATA[
+       Parameter for an execution flow which will override at instantiation the 
+       value of the parameter already defined as default value or in a parent bean.
+                                                                       ]]></xsd:documentation>
+                                                               </xsd:annotation>
+                                                       </xsd:element>
+                                               </xsd:sequence>
+                                               <xsd:sequence>
+                                                       <xsd:choice minOccurs="0" maxOccurs="unbounded">
+                                                               <xsd:element ref="beans:bean" />
+                                                               <xsd:element ref="beans:ref" />
+                                                               <xsd:element ref="flow:flow" />
+                                                               <xsd:element ref="flow:spec" />
+                                                       </xsd:choice>
+                                                       <!-- <xsd:any namespace="##other" processContents="strict" minOccurs="0" 
+                                                               maxOccurs="unbounded" /> -->
+                                               </xsd:sequence>
+                                       </xsd:sequence>
+                                       <xsd:attribute name="name" type="xsd:string">
+                                               <xsd:annotation>
+                                                       <xsd:documentation><![CDATA[
+       Name of the flow (alternative to ID).
+                                                       ]]></xsd:documentation>
+                                               </xsd:annotation>
+                                       </xsd:attribute>
+                                       <xsd:attribute name="class" type="xsd:string">
+                                               <xsd:annotation>
+                                                       <xsd:documentation><![CDATA[
+       Another implementation of execution flow.
+                                                       ]]></xsd:documentation>
+                                               </xsd:annotation>
+                                       </xsd:attribute>
+                                       <xsd:attribute name="path" type="xsd:string">
+                                               <!-- DEPRECATED: not used anymore -->
+                                               <xsd:annotation>
+                                                       <xsd:documentation><![CDATA[
+       The hierarchical path under which to register this flow.
+                                                       ]]></xsd:documentation>
+                                               </xsd:annotation>
+                                       </xsd:attribute>
+                                       <xsd:attribute name="spec" type="xsd:string">
+                                               <xsd:annotation>
+                                                       <xsd:documentation><![CDATA[
+       A reference to the related specification bean.
+                                                       ]]></xsd:documentation>
+                                               </xsd:annotation>
+                                       </xsd:attribute>
+                                       <xsd:attribute name="parent" type="xsd:string">
+                                               <xsd:annotation>
+                                                       <xsd:documentation><![CDATA[
+       The parent bean definition (in Spring sense).
+                                                       ]]></xsd:documentation>
+                                               </xsd:annotation>
+                                       </xsd:attribute>
+                                       <xsd:attribute name="abstract" type="xsd:boolean"
+                                               default="false">
+                                               <xsd:annotation>
+                                                       <xsd:documentation><![CDATA[
+       Whether this flow is abstract (in Spring sense).
+                                                       ]]></xsd:documentation>
+                                               </xsd:annotation>
+                                       </xsd:attribute>
+                               </xsd:extension>
+                       </xsd:complexContent>
+               </xsd:complexType>
+       </xsd:element>
+
+       <xsd:element name="spec">
+               <xsd:annotation>
+                       <xsd:documentation><![CDATA[
+       SLC flow specifications, defining the parameters and variables
+       which can be used in related flows, along with their default values and 
+       various constraints.
+                       ]]></xsd:documentation>
+               </xsd:annotation>
+               <xsd:complexType>
+                       <xsd:complexContent>
+                               <xsd:extension base="beans:identifiedType">
+                                       <xsd:sequence>
+                                               <xsd:element ref="beans:description" minOccurs="0" />
+                                               <xsd:choice minOccurs="0" maxOccurs="unbounded">
+                                                       <xsd:element name="primitive" type="flow:primitiveSpecAttributeType"
+                                                               minOccurs="0" maxOccurs="unbounded">
+                                                               <xsd:annotation>
+                                                                       <xsd:documentation><![CDATA[
+       A primitive specification attribute, that is, a plain standard value
+       and not a reference to an object.
+                                                                       ]]></xsd:documentation>
+                                                               </xsd:annotation>
+                                                       </xsd:element>
+                                                       <xsd:element name="ref" type="flow:refSpecAttributeType"
+                                                               minOccurs="0" maxOccurs="unbounded">
+                                                               <xsd:annotation>
+                                                                       <xsd:documentation><![CDATA[
+       A reference specification attribute, that is, a reference to another object.
+                                                                       ]]></xsd:documentation>
+                                                               </xsd:annotation>
+                                                       </xsd:element>
+                                               </xsd:choice>
+                                       </xsd:sequence>
+                               </xsd:extension>
+                       </xsd:complexContent>
+               </xsd:complexType>
+       </xsd:element>
+
+       <xsd:complexType name="specAttributeType">
+               <xsd:choice>
+                       <xsd:element name="value" minOccurs="0" maxOccurs="1">
+                               <xsd:annotation>
+                                       <xsd:documentation><![CDATA[
+       The default value of the attribute as an inner bean.
+                                       ]]></xsd:documentation>
+                               </xsd:annotation>
+                               <xsd:complexType>
+                                       <xsd:choice minOccurs="1" maxOccurs="1">
+                                               <xsd:element ref="beans:bean" />
+                                               <xsd:element ref="beans:ref" />
+                                               <xsd:element ref="beans:list" />
+                                               <xsd:element ref="beans:set" />
+                                               <xsd:element ref="beans:map" />
+                                               <xsd:element ref="beans:props" />
+                                       </xsd:choice>
+                               </xsd:complexType>
+                       </xsd:element>
+               </xsd:choice>
+               <xsd:attribute name="name" use="required" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       The name of the attribute, under which in can then be referenced.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="value" use="optional" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       The default value of the attribute.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="ref" use="optional" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       The default value of the attribute as a reference to another bean.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="isImmutable" use="optional" type="xsd:boolean"
+                       default="false">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       Whether the attribute is a parameter, that is, it has to be set at 
+       instantiation but can be modified afterwards for objects of scope execution.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="isParameter" use="optional" type="xsd:boolean"
+                       default="false">
+                       <!-- DEPRECATED: old name of isImmutable -->
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       Whether the attribute is a parameter, that is, it has to be set at 
+       instantiation but can be modified afterwards for objects of scope execution.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="isConstant" use="optional" type="xsd:boolean"
+                       default="false">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       Whether the attribute is frozen, that is, it cannot be modified at runtime.
+       A frozen attribute has to be a parameter.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="isFrozen" use="optional" type="xsd:boolean"
+                       default="false">
+                       <!-- DEPRECATED: old name of isConstant -->
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       Whether the attribute is frozen, that is, it cannot be modified at runtime.
+       A frozen attribute has to be a parameter.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="isHidden" use="optional" type="xsd:boolean"
+                       default="false">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       Whether the attribute is hidden, that is, it should not be displayed in UIs.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+       </xsd:complexType>
+
+       <xsd:complexType name="primitiveSpecAttributeType">
+               <xsd:complexContent>
+                       <xsd:extension base="flow:specAttributeType">
+                               <xsd:attribute name="type" default="string">
+                                       <xsd:annotation>
+                                               <xsd:documentation><![CDATA[
+       The type of the primitive specification attribute.
+                                               ]]></xsd:documentation>
+                                       </xsd:annotation>
+                                       <xsd:simpleType>
+                                               <xsd:restriction base="xsd:string">
+                                                       <xsd:enumeration value="string" />
+                                                       <xsd:enumeration value="integer" />
+                                                       <xsd:enumeration value="long" />
+                                                       <xsd:enumeration value="float" />
+                                                       <xsd:enumeration value="double" />
+                                                       <xsd:enumeration value="boolean" />
+                                               </xsd:restriction>
+                                       </xsd:simpleType>
+                               </xsd:attribute>
+                       </xsd:extension>
+               </xsd:complexContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="refSpecAttributeType">
+               <xsd:complexContent>
+                       <xsd:extension base="flow:specAttributeType">
+                               <xsd:choice>
+                                       <xsd:element name="choices" minOccurs="0" maxOccurs="1">
+                                               <xsd:annotation>
+                                                       <xsd:documentation><![CDATA[
+       Possible values to chose from, if ommitted, all the beans in the 
+       application context which implement the provided targetClass will 
+       be considered.
+                                                       ]]></xsd:documentation>
+                                               </xsd:annotation>
+                                               <xsd:complexType>
+                                                       <xsd:choice>
+                                                               <xsd:element name="choice" minOccurs="0" maxOccurs="unbounded"
+                                                                       type="flow:refChoiceType">
+                                                                       <xsd:annotation>
+                                                                               <xsd:documentation><![CDATA[
+       A choice for a reference specification attribute.
+                                                                               ]]></xsd:documentation>
+                                                                       </xsd:annotation>
+                                                               </xsd:element>
+                                                       </xsd:choice>
+                                               </xsd:complexType>
+                                       </xsd:element>
+                               </xsd:choice>
+                               <xsd:attribute name="targetClass" use="required" type="xsd:string">
+                                       <xsd:annotation>
+                                               <xsd:documentation><![CDATA[
+       The class that has to be implemented by the underlying object.
+                                       ]]></xsd:documentation>
+                                       </xsd:annotation>
+                               </xsd:attribute>
+                       </xsd:extension>
+               </xsd:complexContent>
+       </xsd:complexType>
+
+       <xsd:complexType name="refChoiceType">
+               <xsd:attribute name="name" use="required" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       The name of the related bean.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="description" use="optional" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       A human readable description of this choice.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+       </xsd:complexType>
+
+       <xsd:complexType name="argType">
+               <xsd:choice minOccurs="0" maxOccurs="1">
+                       <xsd:element ref="beans:bean" />
+                       <xsd:element ref="beans:ref" />
+                       <xsd:element ref="flow:param" />
+                       <xsd:element ref="beans:list" />
+                       <xsd:element ref="beans:set" />
+                       <xsd:element ref="beans:map" />
+                       <xsd:element ref="beans:props" />
+               </xsd:choice>
+               <xsd:attribute name="name" use="required" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       The name of the related parameter.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="value" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       The plain value of the related parameter.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+               <xsd:attribute name="ref" type="xsd:string">
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       The value of the related parameter as a reference to a bean.
+                               ]]></xsd:documentation>
+                       </xsd:annotation>
+               </xsd:attribute>
+       </xsd:complexType>
+
+       <xsd:attribute name="as-flow" type="xsd:string">
+               <xsd:annotation>
+                       <xsd:documentation><![CDATA[
+       If decorating an executable bean, it will generate an implicit SLC 
+       execution flow with the provided value as name.
+                       ]]></xsd:documentation>
+               </xsd:annotation>
+       </xsd:attribute>
+       <!-- <xsd:attribute name="var" type="xsd:boolean"> <xsd:annotation> <xsd:documentation><![CDATA[ 
+               If true, the decorated bean is set to scope execution and proxied. ]]></xsd:documentation> 
+               </xsd:annotation> </xsd:attribute> -->
+
+       <xsd:element name="variable">
+               <xsd:complexType>
+                       <xsd:annotation>
+                               <xsd:documentation><![CDATA[
+       Marks a bean definition as being variable, i.e. a scoped proxy of scope execution 
+                       ]]></xsd:documentation>
+                       </xsd:annotation>
+                       <xsd:attribute name="proxy-target-class" type="xsd:boolean"
+                               default="true">
+                               <xsd:annotation>
+                                       <xsd:documentation><![CDATA[
+                                               Are class-based (CGLIB) proxies to be created?
+                                               This is the default;
+                                               in order to switch to standard Java
+                                               interface-based proxies, turn this flag to
+                                               "false".
+                                       ]]></xsd:documentation>
+                               </xsd:annotation>
+                       </xsd:attribute>
+               </xsd:complexType>
+       </xsd:element>
+
+       <xsd:element name="param">
+               <xsd:annotation>
+                       <xsd:documentation><![CDATA[
+       If within a property tag of a bean, it will set the value of this property
+        with a reference to a parameter.
+                       ]]></xsd:documentation>
+               </xsd:annotation>
+               <xsd:complexType>
+                       <xsd:attribute name="name" type="xsd:string" use="required">
+                               <xsd:annotation>
+                                       <xsd:documentation><![CDATA[
+       The name of the related parameter.
+                                       ]]></xsd:documentation>
+                               </xsd:annotation>
+                       </xsd:attribute>
+                       <xsd:attribute name="instantiationManager" type="xsd:string"
+                               use="optional" default="instantiationManager">
+                               <xsd:annotation>
+                                       <xsd:documentation><![CDATA[
+       A reference to the instantiation manager to use instead of the default one
+       (expert usage).
+                                       ]]></xsd:documentation>
+                               </xsd:annotation>
+                       </xsd:attribute>
+               </xsd:complexType>
+       </xsd:element>
+
+</xsd:schema>
\ No newline at end of file
index 7aa34daeed9cf6b8c0779b45e85cbce19799c384..f0cc4f1b43c262c9693fede291318a41f0f351ef 100644 (file)
@@ -1,3 +1,2 @@
-additional.bundles = org.springframework.xml
 source.. = src/main/java/,\
            src/main/resources/
index b66f0940541bf7d1fffa5d4af3c171c5ea9aa1b5..f63acb5c06faac9f5a21054014fccba7314816c0 100644 (file)
@@ -275,7 +275,11 @@ public class JcrExecutionModulesListener implements ExecutionModulesListener,
                // execution spec
                ExecutionSpec executionSpec = efd.getExecutionSpec();
                String esName = executionSpec.getName();
-               if (!(esName == null || esName.equals(ExecutionSpec.INTERNAL_NAME))) {
+               if (esName == null || esName.equals(ExecutionSpec.INTERNAL_NAME)
+                               || esName.contains("#")/* automatically generated bean name */) {
+                       // internal spec node
+                       mapExecutionSpec(flowNode, executionSpec);
+               } else {
                        // reference spec node
                        Node executionSpecsNode = moduleNode.hasNode(SLC_EXECUTION_SPECS) ? moduleNode
                                        .getNode(SLC_EXECUTION_SPECS) : moduleNode
@@ -290,9 +294,6 @@ public class JcrExecutionModulesListener implements ExecutionModulesListener,
                                                executionSpec.getDescription());
                        mapExecutionSpec(executionSpecNode, executionSpec);
                        flowNode.setProperty(SLC_SPEC, executionSpecNode);
-               } else {
-                       // internal spec node
-                       mapExecutionSpec(flowNode, executionSpec);
                }
 
                // values
index 8660eee1c09dea0c3ca9fb535d3e5a3e0fc693f9..32073e78f48032144dfcefedbe76e42fde2a422c 100644 (file)
@@ -24,6 +24,10 @@ import org.springframework.osgi.io.OsgiBundleResourceLoader;
 import org.springframework.osgi.io.OsgiBundleResourcePatternResolver;
 import org.springframework.osgi.util.OsgiBundleUtils;
 
+/**
+ * Retrieves ressources from an OSGi bundle either the active one or another one
+ * referenced by its symbolic name.
+ */
 public class OsgiResourceSet extends DefaultResourceSet implements
                BundleContextAware {
        private BundleContext bundleContext;
index 66b85261f31491fbc61f60d3dc43b1b40010c0c3..98c1cc701018abaeadd46cf5d49bf7fb61c28aab 100644 (file)
@@ -1,34 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
-    Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
-    Licensed under the Apache License, Version 2.0 (the "License");\r
-    you may not use this file except in compliance with the License.\r
-    You may obtain a copy of the License at\r
-\r
-            http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-    Unless required by applicable law or agreed to in writing, software\r
-    distributed under the License is distributed on an "AS IS" BASIS,\r
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-    See the License for the specific language governing permissions and\r
-    limitations under the License.\r
-\r
--->\r
+<!-- Copyright (C) 2007-2012 Mathieu Baudier Licensed under the Apache License, \r
+       Version 2.0 (the "License"); you may not use this file except in compliance \r
+       with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 \r
+       Unless required by applicable law or agreed to in writing, software distributed \r
+       under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES \r
+       OR CONDITIONS OF ANY KIND, either express or implied. See the License for \r
+       the specific language governing permissions and limitations under the License. -->\r
 <beans xmlns="http://www.springframework.org/schema/beans"\r
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"\r
        xmlns:aop="http://www.springframework.org/schema/aop" xmlns:flow="http://www.argeo.org/schema/slc-flow"\r
        xsi:schemaLocation="\r
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd\r
-       http://www.argeo.org/schema/slc-flow http://www.argeo.org/schema/slc-flow-0.12.xsd">\r
+       http://www.argeo.org/schema/slc-flow http://www.argeo.org/schema/slc-flow-1.2.xsd">\r
 \r
        <bean id="hostManager" class="org.argeo.slc.lib.linux.RedhatHostManager">\r
                <property name="sshTarget" ref="sshTarget" />\r
                <property name="host" ref="host" />\r
        </bean>\r
 \r
+       <!-- Execution Flows -->\r
        <bean flow:as-flow="deployConfig" class="org.argeo.slc.core.execution.tasks.MethodCall"\r
                p:target-ref="hostManager" p:method="deployConfig" />\r
 \r
        <bean flow:as-flow="system/security/firewall" p:script="osgibundle:/scripts/firewall.sh"\r
                p:sshTarget-ref="sshTarget" class="org.argeo.slc.jsch.RemoteExec" />\r
 \r
+       <flow:spec id="authconfig.spec">\r
+               <flow:primitive name="ldapserver" />\r
+               <flow:primitive name="ldapbasedn" />\r
+       </flow:spec>\r
+\r
+       <flow:flow spec="">\r
+               <bean flow:as-flow="system/security/authconfig" p:sshTarget-ref="sshTarget"\r
+                       class="org.argeo.slc.jsch.RemoteExec">\r
+                       <property name="systemCall">\r
+                               <bean class="org.argeo.slc.core.execution.tasks.SystemCall">\r
+                                       <property name="command">\r
+                                               <list>\r
+                                                       <value>authconfig</value>\r
+                                                       <value>--enableldap</value>\r
+                                                       <value>--enableldapauth</value>\r
+                                                       <value>--enablecache</value>\r
+                                                       <value>--enablemkhomedir</value>\r
+                                                       <value>--ldapserver=@{ldapserver}</value>\r
+                                                       <value>--ldapbasedn=@{ldapbasedn}</value>\r
+                                                       <value>--passalgo=sha256</value>\r
+                                                       <value>--updateall</value>\r
+                                               </list>\r
+                                       </property>\r
+                               </bean>\r
+                       </property>\r
+               </bean>\r
+       </flow:flow>\r
+\r
 </beans>
\ No newline at end of file