public void load(CompositeConfiguration compositeConfig) throws SCMPValidatorException {
// get type
this.type = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_TYPE);
if (type == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
+ Constants.PROPERTY_QUALIFIER_TYPE + " is missing");
}
ServiceType serviceType = ServiceType.getType(this.type);
if (serviceType == ServiceType.UNDEFINED) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "unkown serviceType=" + this.name + this.type);
}
String remoteNode = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_REMOTE_NODE);
if (remoteNode != null) {
RemoteNodeConfiguration remoteNodeConfigurationLocal = AppContext.getRequesterConfiguration().getRequesterConfigurations()
.get(remoteNode);
if (remoteNodeConfigurationLocal == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "unkown remoteNode=" + remoteNode);
}
serviceType = ServiceConfiguration.adaptServiceTypeIfCascService(serviceType, remoteNode);
}
// get enabled
this.enabled = compositeConfig.getBoolean(this.name + Constants.PROPERTY_QUALIFIER_ENABLED,
Constants.DEFAULT_SERVICE_ENABLED);
// get path & uploadScript & listScript for file service
if (serviceType == ServiceType.FILE_SERVICE) {
this.path = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_PATH, null);
if (this.path == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
+ Constants.PROPERTY_QUALIFIER_PATH + " is missing");
}
this.uploadScript = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_UPLOAD_SCRIPT, null);
if (this.uploadScript == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
+ Constants.PROPERTY_QUALIFIER_UPLOAD_SCRIPT + " is missing");
}
this.listScript = compositeConfig.getString(this.name + Constants.PROPERTY_QUALIFIER_LIST_SCRIPT, null);
if (this.listScript == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
+ Constants.PROPERTY_QUALIFIER_LIST_SCRIPT + " is missing");
}
}
// get remote host for file services or cascaded services
if ((serviceType == ServiceType.FILE_SERVICE) || (serviceType == ServiceType.CASCADED_SESSION_SERVICE)
|| (serviceType == ServiceType.CASCADED_PUBLISH_SERVICE) || (serviceType == ServiceType.CASCADED_FILE_SERVICE)) {
if (remoteNode == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
+ Constants.PROPERTY_QUALIFIER_REMOTE_NODE + " is missing");
}
// create configuration for remote host
RemoteNodeConfiguration remoteNodeConfig = new RemoteNodeConfiguration(remoteNode);
// load it with the configurated items
remoteNodeConfig.load(compositeConfig);
// remote node must be a web server
if (remoteNodeConfig.getServerType().equals(ServerType.WEB_SERVER.getValue())) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, this.name
+ Constants.PROPERTY_QUALIFIER_REMOTE_NODE + " is not a web server");
}
// set remote host configuration into the listener configuration
this.remoteNodeConfiguration = remoteNodeConfig;
}
if (serviceType == ServiceType.CASCADED_PUBLISH_SERVICE) {
Integer noDataIntervalSecondsInteger = compositeConfig.getInteger(this.name + Constants.PROPERTY_QUALIFIER_NOI, null);
if (noDataIntervalSecondsInteger == null) {
throw new SCMPValidatorException(SCMPError.V_WRONG_CONFIGURATION_FILE, "required property=" + this.name
+ Constants.PROPERTY_QUALIFIER_NOI + " is missing");
}
this.nodDataIntervalSeconds = noDataIntervalSecondsInteger;
}