- public void validate(){
- super.validate();
- checkState(getAddress() != null,"Address must be set.");
- //checkState(getAddress().getIpv4Address() != null || getAddress().getIpv6Address() != null,"Address must be set.");
- checkState(getPort() != null,"Port must be set.");
- checkState(getDomRegistry() != null,"Dom Registry must be provided.");
- }
+ protected void customValidation() {
+ checkNotNull(getAddress(), addressJmxAttribute);
+ checkNotNull(getPort(), portJmxAttribute);
+ checkNotNull(getDomRegistry(), portJmxAttribute);
+ checkNotNull(getDomRegistry(), domRegistryJmxAttribute);
+
+ checkNotNull(getConnectionTimeoutMillis(), connectionTimeoutMillisJmxAttribute);
+ checkCondition(getConnectionTimeoutMillis() > 0, "must be > 0", connectionTimeoutMillisJmxAttribute);
+
+ checkNotNull(getBetweenAttemptsTimeoutMillis(), betweenAttemptsTimeoutMillisJmxAttribute);
+ checkCondition(getBetweenAttemptsTimeoutMillis() > 0, "must be > 0", betweenAttemptsTimeoutMillisJmxAttribute);
+
+ // FIXME BUG-944 remove backwards compatibility
+ if(getClientDispatcher() == null) {
+ checkCondition(getBossThreadGroup() != null, "Client dispatcher was not set, thread groups have to be set instead", bossThreadGroupJmxAttribute);
+ checkCondition(getWorkerThreadGroup() != null, "Client dispatcher was not set, thread groups have to be set instead", workerThreadGroupJmxAttribute);
+ }
+
+ // Check username + password in case of ssh
+ if(getTcpOnly() == false) {
+ checkNotNull(getUsername(), usernameJmxAttribute);
+ checkNotNull(getPassword(), passwordJmxAttribute);
+ }
+
+ // FIXME BUG 944 remove this warning
+ if(getBindingRegistry() == null) {
+ logger.warn("Configuration property: \"binding-registry\" not set for sal-netconf-connector (" + getIdentifier() + "). " +
+ "Netconf-connector now requires a dependency on \"binding-broker-osgi-registry\". " +
+ "The dependency is optional for now to preserve backwards compatibility, but will be mandatory in the future. " +
+ "Please set the property as in \"01-netconf-connector\" initial config file. " +
+ "The service will be retrieved from OSGi service registry now.");
+ }