1 16 package scriptella.configuration; 17 18 import scriptella.spi.DialectIdentifier; 19 import scriptella.spi.Resource; 20 21 22 28 public abstract class ScriptingElement extends XmlConfigurableBase { 29 private String connectionId; 30 private String ifExpr; 31 private DialectBasedContentEl contentEl; 32 private ScriptingElement parent; 33 34 protected ScriptingElement(ScriptingElement parent) { 35 this.parent = parent; 36 } 37 38 public String getConnectionId() { 39 return connectionId; 40 } 41 42 public void setConnectionId(final String connectionId) { 43 this.connectionId = connectionId; 44 } 45 46 public Location getLocation() { 47 return super.getLocation(); 48 } 49 50 public String getIf() { 51 return ifExpr; 52 } 53 54 public void setIf(final String ifExpr) { 55 this.ifExpr = ifExpr; 56 } 57 58 public Resource getContent() { 59 return contentEl.getContent(null); 60 } 61 62 63 public Resource getDialectContent(DialectIdentifier id) { 64 return contentEl.getContent(id); 65 } 66 67 public ScriptingElement getParent() { 68 return parent; 69 } 70 71 public void configure(final XmlElement element) { 72 setLocation(element); 73 setProperty(element, "connection-id", "connectionId"); 74 setProperty(element, "if"); 75 contentEl = new DialectBasedContentEl(element); 76 contentEl.setLocation(getLocation()); 77 } 78 79 80 public String toString() { 81 return "connectionId='" + connectionId + '\'' + 82 ", location=" + getLocation() + 83 ", ifExpr='" + ifExpr + '\''; 84 85 } 86 } 87 | Popular Tags |