return null;
}
ObjectKey key = orb.getObjectKeyFactory().create(
theKeyString.getBytes() );
IORTemplate iortemp = IORFactories.makeIORTemplate( key.getTemplate() );
java.util.Iterator iterator = theEndpointInfo.iterator( );
while( iterator.hasNext( ) ) {
IIOPEndpointInfo element =
(IIOPEndpointInfo) iterator.next( );
IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb, element.getHost(),
element.getPort() );
GIOPVersion giopVersion = GIOPVersion.getInstance( (byte)element.getMajor(),
(byte)element.getMinor());
IIOPProfileTemplate profileTemplate = null;
if (giopVersion.equals(GIOPVersion.V1_0)) {
profileTemplate = IIOPFactories.makeIIOPProfileTemplate(
orb, giopVersion, addr);
profileList1_0.add(profileTemplate);
} else {
if (profileMap.get(giopVersion) == null) {
profileTemplate = IIOPFactories.makeIIOPProfileTemplate(
orb, giopVersion, addr);
profileMap.put(giopVersion, profileTemplate);
} else {
profileTemplate = (IIOPProfileTemplate)profileMap.get(giopVersion);
AlternateIIOPAddressComponent iiopAddressComponent =
IIOPFactories.makeAlternateIIOPAddressComponent(addr);
profileTemplate.add(iiopAddressComponent);
}
}
}
GIOPVersion giopVersion = orb.getORBData().getGIOPVersion();
IIOPProfileTemplate pTemplate = (IIOPProfileTemplate)profileMap.get(giopVersion);
if (pTemplate != null) {
iortemp.add(pTemplate); // Add profile for GIOP version used by this ORB
profileMap.remove(giopVersion); // Now remove this value from the map
}
// Create a comparator that can sort in decending order (1.2, 1.1, ...)
Comparator comp = new Comparator() {
public int compare(Object o1, Object o2) {
GIOPVersion gv1 = (GIOPVersion)o1;
GIOPVersion gv2 = (GIOPVersion)o2;
return (gv1.lessThan(gv2) ? 1 : (gv1.equals(gv2) ? 0 : -1));
};
};
// Now sort using the above comparator
List list = new ArrayList(profileMap.keySet());
Collections.sort(list, comp);
// Add the profiles in the sorted order
Iterator iter = list.iterator();
while (iter.hasNext()) {
IIOPProfileTemplate pt = (IIOPProfileTemplate)profileMap.get(iter.next());
iortemp.add(pt);
}
// Finally add the 1.0 profiles
iortemp.addAll(profileList1_0);
IOR ior = iortemp.makeIOR( orb, "", key.getId() ) ;
return ORBUtility.makeObjectReference( ior ) ;
}