Service service = null;
switch (serviceType) {
case CASCADED_SESSION_SERVICE:
Server server = AppContext.getServerRegistry().getServer(remotNodeName);
if (server == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, " host=" + remotNodeName
+ " configured for service=" + serviceName + " is not configured");
}
service = new CascadedSessionService(serviceName, (CascadedSC) server);
break;
case CASCADED_PUBLISH_SERVICE:
server = AppContext.getServerRegistry().getServer(remotNodeName);
if (server == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, " host=" + remotNodeName
+ " configured for service=" + serviceName + " is not configured");
}
service = new CascadedPublishService(serviceName, (CascadedSC) server, serviceConfiguration
.getNoDataIntervalSeconds());
break;
case CASCADED_FILE_SERVICE:
server = AppContext.getServerRegistry().getServer(remotNodeName);
if (server == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, " host=" + remotNodeName
+ " configured for service=" + serviceName + " is not configured");
}
service = new CascadedFileService(serviceName, (CascadedSC) server);
break;
case SESSION_SERVICE:
service = new SessionService(serviceName);
break;
case PUBLISH_SERVICE:
service = new PublishService(serviceName);
break;
case FILE_SERVICE:
server = AppContext.getServerRegistry().getServer(remotNodeName);
if (server == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, " host=" + remotNodeName
+ " configured for service=" + serviceName + " is not configured");
}
service = new FileService(serviceName, (FileServer) server, serviceConfiguration.getPath(), serviceConfiguration
.getUploadScript(), serviceConfiguration.getListScript());
break;
case UNDEFINED:
default:
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE,
"wrong serviceType, serviceName/serviceType=" + serviceName + Constants.SLASH + serviceTypeString);
}
service.setEnabled(serviceConfiguration.getEnabled());
serviceRegistry.addService(service.getName(), service);
}