1 package org.jboss.test.profileservice.simple1; 2 3 import java.io.IOException ; 4 import java.net.URL ; 5 import java.util.Collection ; 6 import java.util.Collections ; 7 import java.util.HashMap ; 8 import java.util.Map ; 9 10 import org.jboss.deployers.spi.management.ManagedObject; 11 import org.jboss.deployers.spi.structure.DeploymentContext; 12 import org.jboss.profileservice.spi.DeploymentTemplate; 13 import org.jboss.profileservice.spi.NoSuchDeploymentException; 14 import org.jboss.profileservice.spi.Profile; 15 import org.jboss.profileservice.spi.PropertyInfo; 16 import org.jboss.profileservice.spi.SimpleType; 17 18 24 public class ProfileImpl2 25 implements Profile 26 { 27 private HashMap <String , DeploymentContext> deployments; 28 29 public ProfileImpl2() throws IOException 30 { 31 deployments = new HashMap <String , DeploymentContext>(); 32 String deployDir = SecurityActions.getSystemProperty("jbosstest.deploy.dir"); 33 URL libURL; 34 if( deployDir == null ) 35 { 36 URL classes = getClass().getProtectionDomain().getCodeSource().getLocation(); 38 libURL = new URL (classes, "../lib-not-found/"); 39 } 40 else 41 { 42 libURL = new URL (deployDir); 43 } 44 45 DeploymentImpl p0 = new DeploymentImpl(); 46 p0.setName("DefaultDS"); 47 p0.setRootURL(libURL); 48 String [] files = {"p0-not-here.jar"}; 49 p0.setFiles(files); 50 102 103 DeploymentImpl p1 = new DeploymentImpl(); 104 p1.setName("notxDS"); 105 p1.setRootURL(libURL); 106 String [] files2 = {"p1-not-here.jar"}; 107 p1.setFiles(files); 108 140 ManagedObject notxDataSource = new ManagedObject(); 141 PropertyInfo jndiNameProperty = new PropertyInfoImpl("jndiName", SimpleType.STRING); 142 jndiNameProperty.setFields(new String [] { 143 "org.jboss.profileservice.description", 153 "org.jboss.profileservice.label", 154 "org.jboss.profileservice.requiredNotEmpty", 157 "org.jboss.profileservice.typicalLength" 158 }, 159 new Object [] { 160 "The name the Datasource will be registered under in JNDI", 170 "JNDI Name", 171 Boolean.TRUE, 174 new Integer (30) 175 }); 176 177 notxDataSource.addPropertyRef(jndiNameProperty); 178 179 PropertyInfo useJavaContextProperty = new PropertyInfoImpl("useJavaContext", SimpleType.BOOLEAN); 180 useJavaContextProperty.setFields(new String [] { 181 "defaultValue", 182 "org.jboss.profileservice.description", 191 "org.jboss.profileservice.label", 192 "org.jboss.profileservice.requiredNotEmpty", 195 }, 197 new Object [] { 198 Boolean.TRUE, 199 "Whether the Datasource should be registered under java: in JNDI", 208 "Use java: context", 209 Boolean.TRUE, 212 }); 214 notxDataSource.addPropertyRef(useJavaContextProperty); 215 216 217 223 229 } 230 231 public String getVersion() 232 { 233 return "1.0.0"; 234 } 235 236 public DeploymentTemplate getTemplate(String name) 237 { 238 return null; 239 } 240 241 public void addDeployment(DeploymentContext d) 242 { 243 throw new UnsupportedOperationException ("simple1 is read-only"); 244 } 245 246 public void removeDeployment(String name) 247 { 248 throw new UnsupportedOperationException ("simple1 is read-only"); 249 } 250 251 public Collection <DeploymentContext> getDeployments() 252 { 253 return Collections.unmodifiableCollection(deployments.values()); 254 } 255 256 public Map <String , Object > getConfig() 257 { 258 return null; 259 } 260 261 public DeploymentContext getDeployment(String name) 262 throws NoSuchDeploymentException 263 { 264 DeploymentContext d = deployments.get(name); 265 if( d == null ) 266 throw new NoSuchDeploymentException(name); 267 return d; 268 } 269 270 public void addBootstrap(DeploymentContext d) 271 { 272 throw new org.jboss.util.NotImplementedException("addBootstrap"); 274 } 275 276 public void addDeployer(DeploymentContext d) 277 { 278 throw new org.jboss.util.NotImplementedException("addDeployer"); 280 } 281 282 public DeploymentContext getBootstrap(String name) throws NoSuchDeploymentException 283 { 284 throw new org.jboss.util.NotImplementedException("getBootstrap"); 286 } 287 288 public Collection <DeploymentContext> getBootstraps() 289 { 290 throw new org.jboss.util.NotImplementedException("getBootstraps"); 292 } 293 294 public DeploymentContext getDeployer(String name) throws NoSuchDeploymentException 295 { 296 throw new org.jboss.util.NotImplementedException("getDeployer"); 298 } 299 300 public Collection <DeploymentContext> getDeployers() 301 { 302 throw new org.jboss.util.NotImplementedException("getDeployers"); 304 } 305 306 public void removeBootstrap(String name) 307 { 308 throw new org.jboss.util.NotImplementedException("removeBootstrap"); 310 } 311 312 public void removeDeployer(String name) 313 { 314 throw new org.jboss.util.NotImplementedException("removeDeployer"); 316 } 317 } 318 | Popular Tags |