use of org.omg.CosNaming.BindingIteratorHolder 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.BindingIteratorHolder 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.BindingIteratorHolder 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;
}
Aggregations