throw new CorbaHostException(e);
}
}
public void registerServant(String uri, Object servantObject) throws CorbaHostException {
CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
ORB orb = createORB(details.getHost(), details.getPort(), false);
try {
NamingContext namingCtx = getNamingContext(orb, details.getNameService());
for (int i = 0; i < details.getNamePath().size() - 1; i++) {
NameComponent nc = new NameComponent(details.getNamePath().get(i), "");
NameComponent[] path = new NameComponent[] {nc};
try {
namingCtx = NamingContextHelper.narrow(namingCtx.resolve(path));
} catch (Exception e) {
namingCtx = namingCtx.bind_new_context(path);
}
}
NameComponent finalName =
new NameComponent(details.getNamePath().get(details.getNamePath().size() - 1), "");
try {
namingCtx.resolve(new NameComponent[] {finalName});
// no exception means that some object is already registered
// under this name, we need to crash here
throw new CorbaHostException(CorbaHostException.BINDING_IN_USE);