use of org.omg.CosNaming.BindingListHolder in project ACS by ACS-Community.
the class EventModel method discoverNotifyServicesAndChannels.
/**
* Discovers services and bindings, retrieving only once the list of all
* bindings from the naming service.
*/
private synchronized boolean discoverNotifyServicesAndChannels() {
boolean ret = true;
BindingListHolder bl = new BindingListHolder();
BindingIteratorHolder bi = new BindingIteratorHolder();
try {
// Get names of all objects bound in the naming service
nctx.list(-1, bl, bi);
// Extract the useful binding information Id and Kind
Map<String, String> bindingMap = new HashMap<String, String>();
for (Binding binding : bl.value) {
bindingMap.put(binding.binding_name[0].id, binding.binding_name[0].kind);
}
// notify services
discoverNotifyServices(bindingMap);
// channels (NCs)
discoverChannels(bindingMap);
} catch (Exception e) {
ret = false;
}
return ret;
}
use of org.omg.CosNaming.BindingListHolder in project ACS by ACS-Community.
the class Helper method getChannelTimestamp.
/**
* Returns the current channel's timestamp registered in the Naming Service.
*/
public Date getChannelTimestamp() {
Date timestamp = new Date(0);
BindingListHolder bl = new BindingListHolder();
BindingIteratorHolder bi = new BindingIteratorHolder();
String chNameAndDomain = combineChannelAndDomainName(channelName, domainName);
try {
// Get names of all objects bound in the naming service
getNamingService().list(-1, bl, bi);
// Extract the useful binding information Id and Kind
for (Binding binding : bl.value) {
if (binding.binding_name[0].kind.equals(NC_KIND_NCSUPPORT.value)) {
if (binding.binding_name[0].id.startsWith(chNameAndDomain)) {
String sts = binding.binding_name[0].id.substring(chNameAndDomain.length() + 1);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
try {
timestamp = df.parse(sts);
} catch (ParseException e) {
}
}
}
}
} catch (Exception e) {
}
return timestamp;
}
use of org.omg.CosNaming.BindingListHolder in project ACS by ACS-Community.
the class ConsumerWithComponentClientTestCaseTest method namingBindingsContain.
private boolean namingBindingsContain(String firstBindingName) {
BindingListHolder blh = new BindingListHolder();
ncHelper.getNamingService().list(100, blh, new BindingIteratorHolder());
for (Binding binding : blh.value) {
if (binding.binding_name[0].id.equals(firstBindingName)) {
return true;
}
}
return false;
}
use of org.omg.CosNaming.BindingListHolder in project narayana by jbosstm.
the class NamingServiceClient method test.
@Ignore
public void test() throws InvalidName {
String[] args = new String[2];
args[0] = "-ORBInitRef";
args[1] = "NameService=corbaloc::localhost:3528/NameService";
Properties props = new Properties();
props.put("org.omg.CORBA.ORBInitialPort", "3528");
props.put("org.omg.CORBA.ORBInitialHost", "localhost");
ORB orb = ORB.init(args, props);
NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
BindingListHolder bl = new BindingListHolder();
BindingIteratorHolder blIt = new BindingIteratorHolder();
nc.list(1000, bl, blIt);
Binding[] bindings = bl.value;
List<String> toResolve = new ArrayList<String>();
toResolve.add("TransactionManagerService");
for (int i = 0; i < bindings.length; i++) {
int lastIx = bindings[i].binding_name.length - 1;
// check to see if this is a naming context
if (bindings[i].binding_type == BindingType.ncontext) {
log.info("Context: " + bindings[i].binding_name[lastIx].id);
} else {
log.info("Object: " + bindings[i].binding_name[lastIx].id);
}
toResolve.remove(bindings[i].binding_name[lastIx].id);
}
assertTrue(toResolve.isEmpty());
}
Aggregations