public class EventHandlerValidator extends java.lang.Object implements ServiceConfigurationValidator
Title: Open Service Framework
Description: A validator that checks the Service Class
for well-formed Event Handler
methods.
Copyright: Copyright (c) 2008
Company: StreamScape Technologies
Constructor and Description |
---|
EventHandlerValidator() |
EventHandlerValidator(ConfigurationObject sco) |
Modifier and Type | Method and Description |
---|---|
ConfigurationObject |
getServiceConfiguration() |
ServiceConfigurationValidatorResults |
getValidationResultSet() |
void |
setServiceConfiguration(ConfigurationObject sco) |
ServiceConfigurationValidatorResults |
validate()
The
validate() method must be implemented by the developer in order to perform validation on the Service Configuration
Properties . |
public EventHandlerValidator(ConfigurationObject sco)
public EventHandlerValidator()
public final void setServiceConfiguration(ConfigurationObject sco)
public final ConfigurationObject getServiceConfiguration()
public final ServiceConfigurationValidatorResults getValidationResultSet()
public ServiceConfigurationValidatorResults validate()
ServiceConfigurationValidator
validate()
method must be implemented by the developer in order to perform validation on the Service Configuration
Properties
. A typical implementation would work on a list of configuration property values. For example:
public ServiceConfigurationValidatorResults validate() { Enumeration properties = getProperties().getPropertyNames(); while(properties.hasMoreElements()) { ServiceConfigurationProperty prop = (ServiceConfigurationProperty) properties.nextElement(); this.eval(prop); } return this.getValidationResultSet(); }
Then later in the code.. ..
private void eval(ServiceConfigurationProperty p) { String type = p.getType(); // Validate if a property is required if( (p.isRequired()) && (p.getValue().equalsIgnoreCase("")) ) { ServiceConfigurationValidatorResults.ValidatorResult result = this.getValidationResultSet().createValidationResult(p.getName()); result.setType(ServiceConfigurationValidatorResults.Type.PROPERTY_SEVERE); result.setMessage("Property is a required property but no value was specified." ); this.getValidationResultSet().addResult(result); } // Validate for types if(p.getType().equalsIgnoreCase(Types.STRING)) { .. Some logic here } else if(p.getType().equalsIgnoreCase(Types.XML)) { .. Some logic here } . . }
validate
in interface ServiceConfigurationValidator
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.