1 package org
.argeo
.slc
.core
.structure
;
4 import java
.util
.Vector
;
6 import org
.apache
.commons
.logging
.Log
;
7 import org
.apache
.commons
.logging
.LogFactory
;
9 /** Default implementation of a <code>StructureRegistry</code>.*/
10 public class DefaultSRegistry
implements StructureRegistry
{
11 private static Log log
= LogFactory
.getLog(DefaultSRegistry
.class);
13 private List
<StructureElement
> elements
= new Vector
<StructureElement
>();
14 private List
<StructurePath
> paths
= new Vector
<StructurePath
>();
15 private String mode
= StructureRegistry
.ALL
;
17 private List
<StructurePath
> activePaths
;
19 public List
<StructureElement
> listElements() {
20 return new Vector
<StructureElement
>(elements
);
23 public void register(StructureElement element
) {
24 StructureElement treeSElement
= element
;
25 elements
.add(treeSElement
);
26 paths
.add( treeSElement
.getPath());
27 log
.debug("Registered " + treeSElement
.getPath() + " (desc: "
28 + treeSElement
.getDescription() + " position: "
29 + elements
.size() + ")");
32 public void register(StructureAware structureAware
) {
33 register(structureAware
.getElement());
34 structureAware
.onRegister(this);
37 public StructureElement
getElement(StructurePath path
) {
38 int index
= paths
.indexOf(path
);
40 return elements
.get(index
);
46 public String
getMode() {
50 public void setMode(String mode
) {
54 public List
<StructurePath
> getActivePaths() {
58 public void setActivePaths(List
<StructurePath
> activePaths
) {
59 this.activePaths
= activePaths
;