use of org.apache.knox.gateway.services.ServiceType in project knox by apache.
the class DeploymentFactory method injectServices.
private static void injectServices(Object contributor) {
if (gatewayServices != null) {
Statement stmt;
for (ServiceType serviceType : gatewayServices.getServiceTypes()) {
try {
// TODO: this is just a temporary injection solution
// TODO: test for the existence of the setter before attempting it
// TODO: avoid exception throwing when there is no setter
stmt = new Statement(contributor, "set" + serviceType.getServiceTypeName(), new Object[] { gatewayServices.getService(serviceType) });
stmt.execute();
} catch (NoSuchMethodException e) {
// TODO: eliminate the possibility of this being thrown up front
} catch (Exception e) {
// Maybe it makes sense to throw exception
log.failedToInjectService(serviceType.getServiceTypeName(), e);
throw new DeploymentException("Failed to inject service.", e);
}
}
}
}
Aggregations