if (obj instanceof Reference) {
Reference ref = (Reference)obj;
String refClassName;
refClassName = ref.getClassName();
Destination destObj = null;
if (refClassName.equals(com.sun.messaging.Queue.class.getName())) {
destObj = new Queue();
} else {
if (refClassName.equals(com.sun.messaging.Topic.class.getName())) {
destObj = new Topic();
} else {
throw new MissingVersionNumberException();
}
}
//version number MUST exist and it MUST be the same as AO_VERSION_STR_JMQ1
RefAddr versionAddr = ref.get(REF_VERSION);
if (versionAddr == null) {
//version number does not exist
throw new MissingVersionNumberException();
} else {
String version = null;
if (!AO_VERSION_STR_JMQ1.equals(version = (String)versionAddr.getContent())) {
//version number does not match
throw new UnsupportedVersionNumberException(version);
}
((AdministeredObject)destObj).storedVersion = version;
}
RefAddr destAddr = ref.get(REF_DESTNAME);
if (destAddr != null) {
destObj.setProperty(DestinationConfiguration.imqDestinationName,
(String)destAddr.getContent());
return destObj;
} else {
throw new CorruptedConfigurationPropertiesException();
}