private void setCommonProperties(Reference ref,
InstanceKeyDataSource ikds)
throws IOException, ClassNotFoundException {
RefAddr ra = ref.get("dataSourceName");
if (ra != null && ra.getContent() != null) {
ikds.setDataSourceName(ra.getContent().toString());
}
ra = ref.get("defaultAutoCommit");
if (ra != null && ra.getContent() != null) {
ikds.setDefaultAutoCommit(Boolean.valueOf(
ra.getContent().toString()).booleanValue());
}
ra = ref.get("defaultReadOnly");
if (ra != null && ra.getContent() != null) {
ikds.setDefaultReadOnly(Boolean.valueOf(
ra.getContent().toString()).booleanValue());
}
ra = ref.get("description");
if (ra != null && ra.getContent() != null) {
ikds.setDescription(ra.getContent().toString());
}
ra = ref.get("jndiEnvironment");
if (ra != null && ra.getContent() != null) {
byte[] serialized = (byte[]) ra.getContent();
ikds.jndiEnvironment =
(Properties) deserialize(serialized);
}
ra = ref.get("loginTimeout");
if (ra != null && ra.getContent() != null) {
ikds.setLoginTimeout(
Integer.parseInt(ra.getContent().toString()));
}
ra = ref.get("testOnBorrow");
if (ra != null && ra.getContent() != null) {
ikds.setTestOnBorrow(Boolean.valueOf(
ra.getContent().toString()).booleanValue());
}
ra = ref.get("testOnReturn");
if (ra != null && ra.getContent() != null) {
ikds.setTestOnReturn(Boolean.valueOf(
ra.getContent().toString()).booleanValue());
}
ra = ref.get("timeBetweenEvictionRunsMillis");
if (ra != null && ra.getContent() != null) {
ikds.setTimeBetweenEvictionRunsMillis(
Integer.parseInt(ra.getContent().toString()));
}
ra = ref.get("numTestsPerEvictionRun");
if (ra != null && ra.getContent() != null) {
ikds.setNumTestsPerEvictionRun(
Integer.parseInt(ra.getContent().toString()));
}
ra = ref.get("minEvictableIdleTimeMillis");
if (ra != null && ra.getContent() != null) {
ikds.setMinEvictableIdleTimeMillis(
Integer.parseInt(ra.getContent().toString()));
}
ra = ref.get("testWhileIdle");
if (ra != null && ra.getContent() != null) {
ikds.setTestWhileIdle(Boolean.valueOf(
ra.getContent().toString()).booleanValue());
}
ra = ref.get("validationQuery");
if (ra != null && ra.getContent() != null) {
ikds.setValidationQuery(ra.getContent().toString());
}
}