View Javadoc
1   /*
2    * Copyright (C) 2007-2012 Argeo GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.argeo.slc.core.execution.generator;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  /**
22   * Stores information relative to a Runnable.
23   * Allows to structure the information as a tree, each node
24   * storing data as a Map.
25   */
26  public interface RunnableDataNode {
27  
28  	/**
29  	 * @return a Map containing the data associated with this node.
30  	 * Data associated with parent nodes are expected
31  	 * to be contained in the returned Map
32  	 */
33  	public Map<String, Object> getData();	
34  
35  	/**
36  	 * @return the name of the bean to create.
37  	 * Can be null if no bean shall be created for the 
38  	 * <code>RunnableDataNode</code> (e.g. is is a sub-node)
39  	 */
40  	public String getBeanName();
41  	
42  	/**
43  	 * @return the path of the flow bean to create.
44  	 * Can be null if the bean to created is not an
45  	 * <code>ExecutionFlow</code> or if no bean shall be created for the 
46  	 * <code>RunnableDataNode</code> (e.g. is is a sub-node)
47  	 */
48  	public String getPath();
49  		
50  	/**
51  	 * @return whether the <code>RunnableDataNode</code> has
52  	 * children or not.
53  	 * Expected to be equivalent to <code>getChildren().empty()</code>
54  	 */
55  	public boolean isLeaf();
56  
57  	/**
58  	 * @return the list of <code>RunnableDataNode</code> children.
59  	 * Can be empty. Shall not be null.
60  	 */
61  	public List<RunnableDataNode> getChildren();
62  	
63  	/**
64  	 * @return the <code>RunnableDataNode</code> parent.
65  	 * Can be null if no parent is defined (top node).
66  	 */
67  	public RunnableDataNode getParent();
68  	
69  	/**
70  	 * Sets the <code>RunnableDataNode</code> parent
71  	 * @param parent
72  	 */
73  	public void setParent(RunnableDataNode parent);	
74  }