1 64 65 package com.jcorporate.expresso.kernel; 66 67 import com.jcorporate.expresso.kernel.metadata.ComponentMetadata; 68 69 import java.util.Iterator ; 70 71 80 81 abstract public class EmbeddedComponent implements ExpressoComponent { 82 83 86 private ComponentMetadata myMetadata = null; 87 88 91 92 private Containable myParent = null; 93 94 95 98 public EmbeddedComponent() { 99 } 100 101 109 abstract public String getMetadataName(); 110 111 118 public synchronized ComponentMetadata getMetaData() { 119 if (myMetadata == null) { 120 ExpressoComponent ec = (ExpressoComponent) this.getParent(); 121 ComponentMetadata parentMetadata = ec.getMetaData(); 122 123 for (Iterator i = parentMetadata.getChildren().iterator(); i.hasNext();) { 124 ComponentMetadata oneChild = (ComponentMetadata) i.next(); 125 if (this.getMetadataName().equals(oneChild.getName())) { 126 myMetadata = oneChild; 127 break; 128 } 129 } 130 131 if (myMetadata == null) { 132 throw new IllegalArgumentException ("Unable to find metadata " + 133 "in parent corresponding to component named: " 134 + this.getMetadataName()); 135 } 136 } 137 138 return myMetadata; 139 } 140 141 142 147 public synchronized Containable getParent() { 148 return myParent; 149 } 150 151 157 public synchronized void setParent(Containable parent) { 158 myParent = parent; 159 } 160 161 162 } | Popular Tags |