1 22 package org.jboss.test.jca.inflow; 23 24 import java.net.InetAddress ; 25 import java.util.Properties ; 26 import javax.resource.ResourceException ; 27 import javax.resource.spi.ActivationSpec ; 28 import javax.resource.spi.InvalidPropertyException ; 29 import javax.resource.spi.ResourceAdapter ; 30 31 37 public class TestActivationSpec implements ActivationSpec 38 { 39 private ResourceAdapter ra; 40 41 private String name; 42 43 private int anInt; 44 45 private Integer anInteger; 46 47 private InetAddress localhost; 48 49 private Properties props; 50 51 55 public void validate() throws InvalidPropertyException 56 { 57 58 if( anInt <= 0 || anInt > 10 ) 59 throw new InvalidPropertyException ("anInt is not between 1-10"); 60 61 if( anInteger.intValue() <= 49 || anInteger.intValue() > 100 ) 62 throw new InvalidPropertyException ("anInt is not between 50-100"); 63 64 if( localhost.getHostAddress().equals("127.0.0.1") == false ) 65 throw new InvalidPropertyException ("localhost is not 127.0.0.1"); 66 67 if( props.size() == 0 ) 68 throw new InvalidPropertyException ("props has no values"); 69 } 70 71 public String getName() 72 { 73 return name; 74 } 75 public void setName(String name) 76 { 77 this.name = name; 78 } 79 80 public int getAnInt() 81 { 82 return anInt; 83 } 84 public void setAnInt(int anInt) 85 { 86 this.anInt = anInt; 87 } 88 89 public Integer getAnInteger() 90 { 91 return anInteger; 92 } 93 public void setAnInteger(Integer anInteger) 94 { 95 this.anInteger = anInteger; 96 } 97 98 public InetAddress getLocalhost() 99 { 100 return localhost; 101 } 102 public void setLocalhost(InetAddress localhost) 103 { 104 this.localhost = localhost; 105 } 106 107 public Properties getProps() 108 { 109 return props; 110 } 111 public void setProps(Properties props) 112 { 113 this.props = props; 114 } 115 116 public ResourceAdapter getResourceAdapter() 117 { 118 return ra; 119 } 120 121 public void setResourceAdapter(ResourceAdapter ra) throws ResourceException 122 { 123 this.ra = ra; 124 } 125 126 public String toString() 127 { 128 return "TestActivationSpec with name " + name; 129 } 130 } 131 | Popular Tags |