package org.jboss.test.jca.inflow;
import java.net.InetAddress;
import java.util.Properties;
import javax.resource.ResourceException;
import javax.resource.spi.ActivationSpec;
import javax.resource.spi.InvalidPropertyException;
import javax.resource.spi.ResourceAdapter;
public class TestActivationSpec implements ActivationSpec
{
private ResourceAdapter ra;
private String name;
private int anInt;
private Integer anInteger;
private InetAddress localhost;
private Properties props;
public void validate() throws InvalidPropertyException
{
if( anInt <= 0 || anInt > 10 )
throw new InvalidPropertyException("anInt is not between 1-10");
if( anInteger.intValue() <= 49 || anInteger.intValue() > 100 )
throw new InvalidPropertyException("anInt is not between 50-100");
if( localhost.getHostAddress().equals("127.0.0.1") == false )
throw new InvalidPropertyException("localhost is not 127.0.0.1");
if( props.size() == 0 )
throw new InvalidPropertyException("props has no values");
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public int getAnInt()
{
return anInt;
}
public void setAnInt(int anInt)
{
this.anInt = anInt;
}
public Integer getAnInteger()
{
return anInteger;
}
public void setAnInteger(Integer anInteger)
{
this.anInteger = anInteger;
}
public InetAddress getLocalhost()
{
return localhost;
}
public void setLocalhost(InetAddress localhost)
{
this.localhost = localhost;
}
public Properties getProps()
{
return props;
}
public void setProps(Properties props)
{
this.props = props;
}
public ResourceAdapter getResourceAdapter()
{
return ra;
}
public void setResourceAdapter(ResourceAdapter ra) throws ResourceException
{
this.ra = ra;
}
public String toString()
{
return "TestActivationSpec with name " + name;
}
}