1 22 package org.jboss.system.metadata; 23 24 import java.util.Set ; 25 26 import org.jboss.dependency.spi.ControllerState; 27 import org.jboss.deployment.DeploymentException; 28 import org.jboss.util.UnreachableStatementException; 29 30 36 public class ServiceAttributeMetaData extends AbstractMetaDataVisitorNode 37 { 38 39 private String name; 40 41 42 private boolean trim; 43 44 45 private boolean replace; 46 47 48 private ServiceValueMetaData value; 49 50 55 public String getName() 56 { 57 return name; 58 } 59 60 65 public void setName(String name) 66 { 67 if (name == null) 68 throw new IllegalArgumentException ("Null name"); 69 this.name = name; 70 } 71 72 77 public boolean isReplace() 78 { 79 return replace; 80 } 81 82 87 public void setReplace(boolean replace) 88 { 89 this.replace = replace; 90 } 91 92 97 public boolean isTrim() 98 { 99 return trim; 100 } 101 102 107 public void setTrim(boolean trim) 108 { 109 this.trim = trim; 110 } 111 112 117 public ServiceValueMetaData getValue() 118 { 119 return value; 120 } 121 122 127 public void setValue(ServiceValueMetaData value) 128 { 129 if (value == null) 130 throw new IllegalArgumentException ("Null value"); 131 this.value = value; 132 } 133 134 141 public Object getValue(ServiceValueContext valueContext) throws Exception 142 { 143 valueContext.setTrim(isTrim()); 144 valueContext.setReplace(isReplace()); 145 try 146 { 147 return value.getValue(valueContext); 148 } 149 catch (Throwable t) 150 { 151 DeploymentException.rethrowAsDeploymentException("Error configuring attribute " + name, t); 152 throw new UnreachableStatementException(); 153 } 154 } 155 156 public void visit(ServiceMetaDataVisitor visitor) 157 { 158 visitor.setContextState(ControllerState.CONFIGURED); 159 visitor.visit(this); 160 } 161 162 protected void addChildren(Set <ServiceMetaDataVisitorNode> children) 163 { 164 children.add(value); 165 } 166 } 167 | Popular Tags |