int ranking = service.ranking();
String autoExport = service.autoExport();
ServiceProperty[] serviceProperties = service.serviceProperties();
RegistrationListener[] regListeners = service.registerationListeners();
Tservice tservice = new Tservice();
// can not think of configuring depends on for service
tservice.setDependsOn(null);
// use the bean id as the ref value since we are exposing service for the bean
tservice.setRefAttribute(id);
if (autoExport.length() > 0) {
tservice.setAutoExport(autoExport);
}
if (ranking > 0) {
tservice.setRanking(ranking);
}
for (Class<?> interf : interfaces) {
Tinterfaces tInterfaces = new Tinterfaces();
if (interf != null) {
tInterfaces.getValue().add(interf.getName());
}
tservice.setInterfaces(tInterfaces);
}
// process service property. only key value as string are supported for now
for (ServiceProperty sp : serviceProperties) {
if (sp != null) {
String key = sp.key();
String value = sp.value();
if (key.length() > 0 && value.length() > 0) {
TservicePropertyEntry tsp = new TservicePropertyEntry();
tsp.setKey(key);
tsp.setValueAttribute(value);
tservice.getServiceProperties().getEntry().add(tsp);
}
}
}
for (RegistrationListener regListener : regListeners) {
String ref = regListener.ref();
if (ref.length() > 0) {
TregistrationListener tregListener = reglMap.get(ref);
tregListener.setRefAttribute(ref);
tservice.getRegistrationListener().add(tregListener);
} else {
throw new BlueprintAnnotationException("No ref id for service registration listener " + " for " + clazz.getName());
}
}