1 22 package org.jboss.resource.deployment.ds; 23 24 import java.net.URL ; 25 26 import javax.management.ObjectName ; 27 28 import org.jboss.deployment.DeploymentException; 29 import org.jboss.deployment.DeploymentInfo; 30 import org.jboss.deployment.ObjectModelFactorySimpleSubDeployerSupport; 31 import org.jboss.deployment.SARDeployerMBean; 32 import org.jboss.deployment.SubDeployer; 33 import org.jboss.mx.util.MBeanProxyExt; 34 import org.jboss.resource.deployment.ds.builder.DsMetaDataBuilder; 35 import org.jboss.resource.deployment.ds.builder.DsMetaDataBuilderFactory; 36 import org.jboss.xb.binding.ObjectModelFactory; 37 38 44 public class DsSubDeployer extends ObjectModelFactorySimpleSubDeployerSupport implements DsSubDeployerMBean 45 { 46 47 48 protected ObjectName delegateName = SARDeployerMBean.OBJECT_NAME; 49 50 51 protected String packageSuffix; 52 53 54 protected String ddSuffix; 55 56 57 protected SubDeployer delegate; 58 59 60 private boolean validateDtds; 61 62 private String builderName; 63 64 private DsMetaDataBuilder builder = DsMetaDataBuilderFactory.getBuilder(""); 65 66 70 public DsSubDeployer() 71 { 72 73 } 74 75 public ObjectModelFactory getObjectModelFactory() 76 { 77 return new DsObjectModelFactory(); 78 } 79 80 public String getExtension() 81 { 82 return null; 83 } 84 85 public String getMetaDataURL() 86 { 87 return null; 88 } 89 90 public String getObjectName(DeploymentInfo di) throws DeploymentException 91 { 92 return null; 93 } 94 95 public String getDeploymentClass() 96 { 97 return null; 98 } 99 100 public String getDdSuffix() 101 { 102 return ddSuffix; 103 } 104 105 public ObjectName getDelegateName() 106 { 107 108 return delegateName; 109 110 } 111 112 public String getPackageSuffix() 113 { 114 return packageSuffix; 115 } 116 117 public boolean getValidateDTDs() 118 { 119 120 return validateDtds; 121 } 122 123 public void setDdSuffix(String ddSuffix) 124 { 125 126 this.ddSuffix = ddSuffix; 127 } 128 129 public void setDelegateName(ObjectName delegateName) 130 { 131 132 this.delegateName = delegateName; 133 } 134 135 public void setPackageSuffix(String packageSuffix) 136 { 137 138 this.packageSuffix = packageSuffix; 139 } 140 141 public void setValidateDTDs(boolean validate) 142 { 143 144 this.validateDtds = validate; 145 146 } 147 148 protected void parseMetaData(DeploymentInfo di, URL url) throws DeploymentException 149 { 150 try 151 { 152 di.metaData = builder.parse(url); 153 } 154 155 catch (DsDeployerException e) 156 { 157 throw new DeploymentException(e.getMessage(), e); 158 159 } 160 161 162 } 163 164 protected void startService() throws Exception 165 { 166 167 builder = DsMetaDataBuilderFactory.getBuilder(builderName); 168 169 170 } 171 172 protected void createService() throws Exception 173 { 174 175 super.createService(); 176 177 delegate = (SubDeployer) MBeanProxyExt.create(SubDeployer.class, delegateName, server); 178 179 } 180 181 protected void destroyService() throws Exception 182 { 183 super.destroyService(); 184 } 185 186 public boolean accepts(DeploymentInfo di) 187 { 188 189 String urlStr = di.url.toString(); 190 return (packageSuffix != null && (urlStr.endsWith(packageSuffix) || urlStr.endsWith(packageSuffix + "/"))) 191 || (ddSuffix != null && urlStr.endsWith(ddSuffix)); 192 } 193 194 public String getBuilderName() 195 { 196 return builderName; 197 } 198 199 public void setBuilderName(String builderName) 200 { 201 this.builderName = builderName; 202 } 203 } 204 | Popular Tags |