import org.apache.tools.ant.Project;\r
import org.apache.tools.ant.ProjectHelper;\r
\r
-import org.argeo.slc.core.structure.StructureElement;\r
import org.argeo.slc.core.structure.StructurePath;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
\r
-/** Utilities to manipulate the structure registry in SLC Ant.*/\r
+/** Utilities to manipulate the structure registry in SLC Ant. */\r
public class AntRegistryUtil {\r
private static Log log = LogFactory.getLog(AntRegistryUtil.class);\r
\r
\r
Project p = new Project();\r
p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
+ p.setBaseDir(antFile.getParentFile());\r
p.init();\r
ProjectHelper helper = new SlcProjectHelper();\r
p.addReference("ant.projectHelper", helper);\r
\r
Project p = new Project();\r
p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
+ p.setBaseDir(antFile.getParentFile());\r
p.init();\r
ProjectHelper helper = new SlcProjectHelper();\r
p.addReference("ant.projectHelper", helper);\r
\r
public static void main(String[] args) {\r
File antFile = new File(\r
- "C:/dev/workspaces/default/org.argeo.slc/src/test/ant/build.xml");\r
- System\r
- .setProperty(SlcAntConfig.APPLICATION_CONTEXT_PROPERTY,\r
- "C:/dev/workspaces/default/org.argeo.slc/src/test/ant/applicationContext.xml");\r
+ "C:/dev/workspaces/default/org.argeo.slc/src/test/slc/root/Category1/SubCategory2/build.xml");\r
StructureRegistry registry = AntRegistryUtil.readRegistry(antFile);\r
\r
StringBuffer buf = new StringBuffer("");\r
\r
int count = 0;\r
List<StructurePath> activePaths = new Vector<StructurePath>();\r
- for (StructureElement element : registry.listElements()) {\r
- buf.append(element.getPath());\r
+ for (StructurePath path : registry.listPaths()) {\r
+ buf.append(path);\r
if (count != 0 && count % 3 == 0) {\r
// skip\r
} else {\r
- activePaths.add(element.getPath());\r
+ activePaths.add(path);\r
buf.append(" <");\r
}\r
buf.append('\n');\r
runActive(antFile, activePaths);\r
\r
}\r
-\r
}\r
/** Path to the root Spring application context */\r
public static String APPLICATION_CONTEXT_PROPERTY = "org.argeo.slc.ant.applicationContext";\r
\r
- private final File confDir;\r
- private final File rootDir;\r
- private final File workDir;\r
-\r
/** Retrieve all properties and set them as project user properties */\r
- public SlcAntConfig(Project project, File slcRootFile) {\r
+ public static void initProject(Project project, File slcRootFile) {\r
Properties p = loadFile(slcRootFile.getAbsolutePath());\r
\r
+ final File confDir;\r
+ final File workDir;\r
// Root dir\r
- rootDir = slcRootFile.getParentFile();\r
+ final File rootDir = slcRootFile.getParentFile();\r
project.setUserProperty(ROOT_DIR_PROPERTY, rootDir.getAbsolutePath());\r
\r
// Conf dir\r
}\r
}\r
\r
- private Properties loadFile(String path) {\r
+ private static Properties loadFile(String path) {\r
Properties p = new Properties();\r
try {\r
FileInputStream in = new FileInputStream(path);\r
return p;\r
}\r
\r
- public File getConfDir() {\r
- return confDir;\r
- }\r
-\r
- public File getRootDir() {\r
- return rootDir;\r
- }\r
-\r
- public File getWorkDir() {\r
- return workDir;\r
- }\r
-\r
}\r
if (slcRootFile == null) {\r
throw new SlcAntException("Cannot find SLC root file");\r
}\r
- SlcAntConfig slcAntConfig = new SlcAntConfig(project, slcRootFile);\r
+ SlcAntConfig.initProject(project, slcRootFile);\r
\r
// init Spring application context\r
String acPath = project\r
super.parse(project, source);\r
\r
addSlcTasks(project);\r
- \r
+\r
// create structure root\r
- String projectDescription = project.getDescription() != null ? project\r
- .getDescription() : "Root";\r
- TreeSElement element = TreeSElement.createRootElelment(\r
- getProjectPathName(project), projectDescription);\r
- registry.register(element);\r
+ TreeSElement element = new TreeSElement(project.getDescription(),\r
+ "Root");\r
+ registry.register(getProjectPath(project), element);\r
\r
}\r
\r
/** Get the path of a project (root). */\r
public static TreeSPath getProjectPath(Project project) {\r
- return TreeSPath.createChild(null, getProjectPathName(project));\r
+ return TreeSPath.createRootPath(getProjectPathName(project));\r
}\r
\r
private static String getProjectPathName(Project project) {\r
project.addTaskDefinition(name, Class.forName(taskdefs\r
.getProperty(name)));\r
} catch (ClassNotFoundException e) {\r
- log.error("Unknown class for task "+name, e);\r
+ log.error("Unknown class for task " + name, e);\r
}\r
}\r
}\r
\r
private String bean;\r
\r
+ // cache bean instance to avoid reading it twice if it is a prototype\r
+ private Object beanInstance = null;\r
+\r
/** The <u>name</u> of the underlying bean, as set throught the attribute. */\r
public String getBean() {\r
return bean;\r
}\r
\r
/**\r
- * Retrieve the instance of the bean. <b>If teh underlying Spring bean is a\r
- * prototype, it will instanciated each time.</b>\r
+ * Retrieve the instance of the bean. <b>The value is cached.</b>\r
*/\r
- protected Object getBeanInstance() {\r
- Object obj = getContext().getBean(bean);\r
-\r
- BeanWrapper wrapper = new BeanWrapperImpl(obj);\r
- for (OverrideArg override : overrides) {\r
- wrapper.setPropertyValue(override.getName(), override.getObject());\r
+ public Object getBeanInstance() {\r
+ if (beanInstance == null) {\r
+ beanInstance = getContext().getBean(bean);\r
+\r
+ BeanWrapper wrapper = new BeanWrapperImpl(beanInstance);\r
+ for (OverrideArg override : overrides) {\r
+ wrapper.setPropertyValue(override.getName(), override\r
+ .getObject());\r
+ }\r
}\r
-\r
- return obj;\r
+ return beanInstance;\r
}\r
\r
- /** Creates an override subtag.*/\r
+ /** Creates an override subtag. */\r
public OverrideArg createOverride() {\r
OverrideArg propertyArg = new OverrideArg();\r
overrides.add(propertyArg);\r
return propertyArg;\r
}\r
\r
- /** The related Spring application context.*/\r
+ /** The related Spring application context. */\r
protected ApplicationContext getContext() {\r
return (ApplicationContext) getProject().getReference(\r
SlcProjectHelper.REF_ROOT_CONTEXT);\r
+++ /dev/null
-package org.argeo.slc.ant.structure;\r
-\r
-import org.argeo.slc.ant.spring.AbstractSpringArg;\r
-import org.argeo.slc.core.structure.StructureElement;\r
-import org.argeo.slc.core.structure.StructureRegistry;\r
-import org.argeo.slc.core.structure.tree.TreeSAware;\r
-import org.argeo.slc.core.structure.tree.TreeSElement;\r
-\r
-/** Ant types allowing to propagate structure informations.*/\r
-public abstract class SAwareArg extends AbstractSpringArg{\r
- //private TreeSAware parentSAware;\r
-\r
- @Override\r
- protected Object getBeanInstance() {\r
- Object obj = super.getBeanInstance();\r
-/*\r
- if (obj instanceof TreeSAware && parentSAware != null) {\r
- TreeSAware sAware = (TreeSAware) obj;\r
- TreeSElement parentElement = (TreeSElement) parentSAware\r
- .getElement();\r
- String name = getBean() + parentElement.getChildren().size();\r
- TreeSElement element = parentElement.createChild(name,\r
- getDescription() != null ? getDescription()\r
- : "<no bean desc>");\r
- sAware.setElement(element);\r
-\r
- parentSAware.addToPropagationList(sAware);\r
-// StructureRegistry registry = (StructureRegistry) getProject()\r
-// .getReference(SlcProjectHelper.REF_STRUCTURE_REGISTRY);\r
-// registry.register(parentSAware);\r
- }\r
- */\r
- return obj;\r
- }\r
-\r
- public void init(TreeSAware parentSAware){\r
- \r
- Object obj = super.getBeanInstance();\r
- \r
- if (obj instanceof TreeSAware && parentSAware != null) {\r
- TreeSAware sAware = (TreeSAware) obj;\r
- TreeSElement parentElement = (TreeSElement) parentSAware\r
- .getElement();\r
- String name = getBean() + parentElement.getChildren().size();\r
- TreeSElement element = parentElement.createChild(name,\r
- getDescription() != null ? getDescription()\r
- : "<no bean desc>");\r
- sAware.setElement(element);\r
-\r
- parentSAware.addToPropagationList(sAware);\r
-// StructureRegistry registry = (StructureRegistry) getProject()\r
-// .getReference(SlcProjectHelper.REF_STRUCTURE_REGISTRY);\r
-// registry.register(parentSAware);\r
- }\r
- }\r
- \r
-// public void setParentSAware(TreeSAware parentSAware) {\r
-// this.parentSAware = parentSAware;\r
-// }\r
-\r
-\r
- public StructureElement getElement() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- public void onRegister(StructureRegistry registry) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
-\r
- \r
-}\r
import org.apache.tools.ant.Target;\r
\r
import org.argeo.slc.ant.SlcProjectHelper;\r
+import org.argeo.slc.ant.spring.AbstractSpringArg;\r
import org.argeo.slc.ant.spring.AbstractSpringTask;\r
+import org.argeo.slc.core.structure.StructureAware;\r
import org.argeo.slc.core.structure.StructurePath;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
import org.argeo.slc.core.structure.tree.DefaultTreeSAware;\r
-import org.argeo.slc.core.structure.tree.TreeSAware;\r
import org.argeo.slc.core.structure.tree.TreeSElement;\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
\r
/** Ant task that can be registered within a structure. */\r
public abstract class SAwareTask extends AbstractSpringTask {\r
- protected final TreeSAware sAware = new DefaultTreeSAware();\r
- protected final List<SAwareArg> sAwareArgs = new Vector<SAwareArg>();\r
+ private final DefaultTreeSAware sAware = new DefaultTreeSAware();\r
+ private final List<AbstractSpringArg> sAwareArgs = new Vector<AbstractSpringArg>();\r
\r
@Override\r
public void init() throws BuildException {\r
StructureRegistry registry = getRegistry();\r
Target target = getOwningTarget();\r
- TreeSElement projectElement = (TreeSElement) registry\r
- .getElement(SlcProjectHelper.getProjectPath(getProject()));\r
+\r
+ TreeSPath targetPath = createTargetPath(target);\r
TreeSElement targetElement = (TreeSElement) registry\r
.getElement(createTargetPath(target));\r
\r
if (targetElement == null) {\r
- // create target element\r
- targetElement = projectElement.createChild(target.getName(), target\r
- .getDescription() != null ? target.getDescription()\r
- : "<no target>");\r
- registry.register(targetElement);\r
+ targetElement = new TreeSElement(target.getDescription(),\r
+ "<no target desc>");\r
+ registry.register(targetPath, targetElement);\r
}\r
\r
- TreeSElement taskElement = targetElement.createChild(getTaskName()\r
- + targetElement.getChildren().size(),\r
- getDescription() != null ? getDescription() : "<no task desc>");\r
+ TreeSElement taskElement = new TreeSElement(getDescription(),\r
+ "<no task desc>");\r
sAware.setElement(taskElement);\r
}\r
\r
+ protected void addSAwareArg(AbstractSpringArg arg) {\r
+ sAwareArgs.add(arg);\r
+ }\r
+\r
@Override\r
/**\r
* Called by Ant at runtime. Decides whether to call the actions depending\r
* @see StructureRegistry\r
*/\r
public final void execute() throws BuildException {\r
- for(SAwareArg arg : sAwareArgs){\r
- arg.init(sAware);\r
+ // init registered args\r
+ for (AbstractSpringArg arg : sAwareArgs) {\r
+ Object obj = arg.getBeanInstance();\r
+\r
+ if (obj instanceof StructureAware && sAware != null) {\r
+ StructureAware sAwareT = (StructureAware) obj;\r
+ sAware.addToPropagationList(arg.getBean(), sAwareT);\r
+ }\r
}\r
- \r
- getRegistry().register(sAware);\r
- \r
+\r
+ // register the task in the structure\r
+ TreeSPath targetPath = createTargetPath(getOwningTarget());\r
+ TreeSPath taskPath = targetPath.createChild(getTaskName()\r
+ + targetPath.listChildren(getRegistry()).size());\r
+ getRegistry().register(taskPath, sAware);\r
+\r
+ // execute depending on the registry mode\r
String mode = getRegistry().getMode();\r
if (mode.equals(StructureRegistry.ALL)) {\r
executeActions(mode);\r
} else if (mode.equals(StructureRegistry.ACTIVE)) {\r
List<StructurePath> activePaths = getRegistry().getActivePaths();\r
- \r
- StructurePath targetPath = createTargetPath(getOwningTarget());\r
- if(activePaths.contains(targetPath)){\r
- if (activePaths.contains(sAware.getElement().getPath())) {\r
+\r
+ if (activePaths.contains(targetPath)) {\r
+ if (activePaths.contains(taskPath)) {\r
executeActions(mode);\r
}\r
- } \r
+ }\r
}\r
\r
}\r
}\r
\r
/** Creates the path for a given Ant target. */\r
- protected static StructurePath createTargetPath(Target target) {\r
+ protected static TreeSPath createTargetPath(Target target) {\r
TreeSPath projectPath = SlcProjectHelper.getProjectPath(target\r
.getProject());\r
- return TreeSPath.createChild(projectPath, target.getName());\r
+ return projectPath.createChild(target.getName());\r
}\r
}\r
\r
import org.apache.tools.ant.BuildException;\r
\r
-import org.argeo.slc.ant.structure.SAwareArg;\r
+import org.argeo.slc.ant.spring.AbstractSpringArg;\r
import org.argeo.slc.ant.structure.SAwareTask;\r
import org.argeo.slc.core.deploy.DeployedSystem;\r
import org.argeo.slc.core.test.TestData;\r
\r
public TestDefinitionArg createTestDefinition() {\r
testDefinitionArg = new TestDefinitionArg();\r
- sAwareArgs.add(testDefinitionArg);\r
+ addSAwareArg(testDefinitionArg);\r
return testDefinitionArg;\r
}\r
\r
public TestDataArg createTestData() {\r
testDataArg = new TestDataArg();\r
- sAwareArgs.add(testDataArg);\r
+ addSAwareArg(testDataArg);\r
return testDataArg;\r
}\r
\r
\r
}\r
\r
-class TestDefinitionArg extends SAwareArg {\r
- private TestDefinition testDefinition;\r
-\r
+class TestDefinitionArg extends AbstractSpringArg {\r
public TestDefinition getTestDefinition() {\r
- if (testDefinition == null) {\r
- // don't call Spring each time in order not to multi-instantiate\r
- // prototype\r
- testDefinition = (TestDefinition) getBeanInstance();\r
- }\r
- return testDefinition;\r
+ return (TestDefinition) getBeanInstance();\r
}\r
}\r
\r
-class TestDataArg extends SAwareArg {\r
- private TestData testData;\r
-\r
+class TestDataArg extends AbstractSpringArg {\r
public TestData getTestData() {\r
- if (testData == null) {\r
- // don't call Spring each time in order not to multi-instantiate\r
- // prototype\r
- testData = (TestData) getBeanInstance();\r
- }\r
- return testData;\r
+ return (TestData) getBeanInstance();\r
}\r
\r
}\r
return new Vector<StructureElement>(elements);\r
}\r
\r
- public void register(StructureElement element) {\r
+ public List<StructurePath> listPaths() {\r
+ return new Vector<StructurePath>(paths);\r
+ }\r
+\r
+ public void register(StructurePath path,StructureElement element) {\r
StructureElement treeSElement = element;\r
elements.add(treeSElement);\r
- paths.add( treeSElement.getPath());\r
- log.debug("Registered " + treeSElement.getPath() + " (desc: "\r
+ paths.add( path);\r
+ log.debug("Registered " + path + " (desc: "\r
+ treeSElement.getDescription() + " position: "\r
+ elements.size() + ")");\r
}\r
\r
- public void register(StructureAware structureAware) {\r
- register(structureAware.getElement());\r
- structureAware.onRegister(this);\r
+ public void register(StructurePath path,StructureAware structureAware) {\r
+ register(path,structureAware.getElement());\r
+ structureAware.onRegister(this,path);\r
}\r
\r
public StructureElement getElement(StructurePath path) {\r
+++ /dev/null
-package org.argeo.slc.core.structure;\r
-\r
-import java.util.List;\r
-\r
-/** Structure aware object able to propagate registration.*/\r
-public interface PropagatingSAware extends StructureAware {\r
- /**\r
- * Adds a structure aware to which registration should be propagated. The\r
- * passed object will be registered when this object will be\r
- * registered itself, so it should not have been registered before. <b>It doesn't\r
- * have to be consistent with the tree structure defined by tree based\r
- * registry elements (although it will often make more sense)</b>.\r
- */\r
- public void addToPropagationList(StructureAware sAware);\r
-\r
- /** Returns the list of structure aware to propagate to. */\r
- public List<StructureAware> getPropagationList();\r
-\r
-}\r
public StructureElement getElement();\r
\r
/** Called <b>after</b> registration. */\r
- public void onRegister(StructureRegistry registry);\r
+ public void onRegister(StructureRegistry registry, StructurePath path);\r
}\r
\r
/** Atomic element holding the reference to the element which is structured. */\r
public interface StructureElement {\r
- /** Path to this element. */\r
- public StructurePath getPath();\r
-\r
/** Description of this element. */\r
public String getDescription();\r
}\r
public static String READ = "READ";\r
/** All mode: everything is executed regardless of the active paths. */\r
public static String ALL = "ALL";\r
- /** Active mode: only teh active paths are executed. */\r
+ /** Active mode: only the active paths are executed. */\r
public static String ACTIVE = "ACTIVE";\r
\r
/** Adds an element to the registry. */\r
- public void register(StructureElement element);\r
+ public void register(StructurePath path, StructureElement element);\r
\r
/**\r
* Adds the wrapped element of a <code>SructureAware</code>, and\r
* propagates the registration.\r
*/\r
- public void register(StructureAware structureAware);\r
+ public void register(StructurePath path, StructureAware structureAware);\r
\r
/** Lists <b>all</b> registered elements. */\r
public List<StructureElement> listElements();\r
\r
+ /** Lists <b>all</b> registered elements. */\r
+ public List<StructurePath> listPaths();\r
+\r
/** Gets a element based on its path. */\r
public StructureElement getElement(StructurePath path);\r
\r
+++ /dev/null
-package org.argeo.slc.core.structure;\r
-\r
-\r
-/** Structure aware object in which the wrapped element can be externally set. */\r
-public interface WritableSAware extends StructureAware {\r
- /** Sets the wrapped element. */\r
- public void setElement(StructureElement element);\r
-\r
-}\r
\r
import org.argeo.slc.core.structure.StructureAware;\r
import org.argeo.slc.core.structure.StructureElement;\r
+import org.argeo.slc.core.structure.StructurePath;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
\r
/**\r
* registries, using <code>TreeSPath</code>. Convenient to be wrapped in\r
* classes which cannot extend it.\r
*/\r
-public class DefaultTreeSAware implements TreeSAware {\r
+public class DefaultTreeSAware implements StructureAware {\r
private StructureElement element;\r
+ private List<String> names = new Vector<String>();\r
private List<StructureAware> children = new Vector<StructureAware>();\r
\r
public StructureElement getElement() {\r
this.element = element;\r
}\r
\r
- public void onRegister(StructureRegistry registry) {\r
+ public void onRegister(StructureRegistry registry, StructurePath path) {\r
+ int index = 0;\r
for (StructureAware sAware : children) {\r
- registry.register(sAware.getElement());\r
- sAware.onRegister(registry);\r
+ TreeSPath childPath = ((TreeSPath) path).createChild(names\r
+ .get(index)\r
+ + index);\r
+ registry.register(childPath, sAware.getElement());\r
+ sAware.onRegister(registry, childPath);\r
+ index++;\r
}\r
}\r
\r
- public void addToPropagationList(StructureAware sAware) {\r
+ public void addToPropagationList(String name, StructureAware sAware) {\r
+ names.add(name);\r
children.add(sAware);\r
}\r
\r
+++ /dev/null
-package org.argeo.slc.core.structure.tree;\r
-\r
-import org.argeo.slc.core.structure.PropagatingSAware;\r
-import org.argeo.slc.core.structure.WritableSAware;\r
-\r
-/**\r
- * Provides methods to externally propagate tree related informations in tree\r
- * based registries.\r
- * \r
- * @see TreeSElement\r
- */\r
-public interface TreeSAware extends WritableSAware, PropagatingSAware {\r
-\r
-}\r
package org.argeo.slc.core.structure.tree;\r
\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
import org.argeo.slc.core.structure.StructureElement;\r
-import org.argeo.slc.core.structure.StructurePath;\r
\r
/**\r
* Implementation of <code>StructureElement</code> for tree based registries,\r
*/\r
public class TreeSElement implements StructureElement {\r
private String description;\r
- private TreeSPath path;\r
-\r
- private List<TreeSElement> children = new Vector<TreeSElement>();\r
\r
+ public TreeSElement(String description){\r
+ this.description = description;\r
+ }\r
+ \r
+ public TreeSElement(String description, String defaultDescription){\r
+ this(description!=null?description:defaultDescription);\r
+ }\r
+ \r
public String getDescription() {\r
return description;\r
}\r
this.description = description;\r
}\r
\r
- public StructurePath getPath() {\r
- return path;\r
- }\r
-\r
- public List<TreeSElement> getChildren() {\r
- return children;\r
- }\r
-\r
- public TreeSElement createChild(String name, String description) {\r
- TreeSElement element = new TreeSElement();\r
- element.path = TreeSPath.createChild((TreeSPath) this.getPath(), name);\r
- element.description = description;\r
- children.add(element);\r
- return element;\r
- }\r
-\r
- public static TreeSElement createRootElelment(String name,\r
- String description) {\r
- TreeSElement element = new TreeSElement();\r
- element.path = TreeSPath.createChild(null, name);\r
- element.description = description;\r
- return element;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (obj instanceof StructureElement) {\r
- StructureElement element = (StructureElement) obj;\r
- return getPath().equals(element.getPath());\r
- }\r
- return false;\r
- }\r
-\r
}\r
package org.argeo.slc.core.structure.tree;\r
\r
+import java.util.List;\r
import java.util.StringTokenizer;\r
+import java.util.Vector;\r
\r
import org.argeo.slc.core.structure.StructurePath;\r
+import org.argeo.slc.core.structure.StructureRegistry;\r
\r
/**\r
* Path for tree based <code>StructureRegistry</code> implementations.\r
return name;\r
}\r
\r
- /** Create a child path based on a parent path and a name. */\r
- public static TreeSPath createChild(TreeSPath parent, String name) {\r
+ /** Create a path without parent. */\r
+ public static TreeSPath createRootPath(String name) {\r
TreeSPath path = new TreeSPath();\r
- path.parent = parent;\r
+ path.parent = null;\r
+ path.name = name;\r
+ return path;\r
+ }\r
+\r
+ /** Create a child . */\r
+ public TreeSPath createChild(String name) {\r
+ TreeSPath path = new TreeSPath();\r
+ path.parent = this;\r
path.name = name;\r
return path;\r
}\r
TreeSPath currPath = null;\r
while (st.hasMoreTokens()) {\r
if (currPath == null) {// begin\r
- currPath = createChild(null, st.nextToken());\r
+ currPath = createRootPath(st.nextToken());\r
} else {\r
- currPath = createChild(currPath, st.nextToken());\r
+ currPath = currPath.createChild(st.nextToken());\r
}\r
}\r
return currPath;\r
}\r
\r
+ public List<TreeSPath> listChildren(StructureRegistry registry){\r
+ return listChildrenPaths(registry, this);\r
+ }\r
+ \r
+ public static List<TreeSPath> listChildrenPaths(StructureRegistry registry,\r
+ TreeSPath path) {\r
+ List<TreeSPath> paths = new Vector<TreeSPath>();\r
+ List<StructurePath> allPaths = registry.listPaths();\r
+ for (StructurePath sPath : allPaths) {\r
+ TreeSPath pathT = (TreeSPath) sPath;\r
+ if (pathT.parent != null && pathT.parent.equals(path)) {\r
+ paths.add(pathT);\r
+ }\r
+ }\r
+ return paths;\r
+ }\r
+\r
@Override\r
public String toString() {\r
return getAsUniqueString();\r
package org.argeo.slc.testslc;\r
\r
+import org.argeo.slc.core.structure.StructurePath;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
import org.argeo.slc.core.structure.tree.DefaultTreeSAware;\r
-import org.argeo.slc.core.structure.tree.TreeSAware;\r
import org.argeo.slc.core.structure.tree.TreeSElement;\r
import org.argeo.slc.core.test.TestData;\r
\r
private Object reached;\r
private Object expected;\r
\r
+ public DummyTestData(){\r
+ setElement(new TreeSElement("This is a dummy test data"));\r
+ }\r
+ \r
public Object getReached() {\r
return reached;\r
}\r
}\r
\r
@Override\r
- public void onRegister(StructureRegistry registry) {\r
- if (expected instanceof TreeSAware) {\r
- TreeSAware sAware = (TreeSAware) expected;\r
- TreeSElement element = ((TreeSElement) getElement()).createChild(\r
- "expected" + getPropagationList().size(), "<no desc>");\r
+ public void onRegister(StructureRegistry registry, StructurePath path) {\r
+ if (expected instanceof DefaultTreeSAware) {\r
+ DefaultTreeSAware sAware = (DefaultTreeSAware) expected;\r
+ TreeSElement element = new TreeSElement("This is an expected");\r
+ element.setDescription("<no desc>");\r
sAware.setElement(element);\r
- addToPropagationList(sAware);\r
+ addToPropagationList("expected",sAware);\r
}\r
- super.onRegister(registry);\r
+ super.onRegister(registry, path);\r
}\r
\r
\r