use of javax.resource.spi.InvalidPropertyException in project teiid by teiid.
the class CouchbaseManagedConnectionFactory method createConnectionFactory.
@SuppressWarnings("serial")
@Override
public BasicConnectionFactory<CouchbaseConnectionImpl> createConnectionFactory() throws ResourceException {
final CouchbaseEnvironment environment = DefaultCouchbaseEnvironment.builder().managementTimeout(managementTimeout).queryTimeout(queryTimeout).viewTimeout(viewTimeout).kvTimeout(kvTimeout).searchTimeout(searchTimeout).connectTimeout(connectTimeout).dnsSrvEnabled(dnsSrvEnabled).build();
if (this.connectionString == null) {
// $NON-NLS-1$
throw new InvalidPropertyException(UTIL.getString("no_server"));
}
if (this.keyspace == null) {
// $NON-NLS-1$
throw new InvalidPropertyException(UTIL.getString("no_keyspace"));
}
if (this.namespace == null) {
// $NON-NLS-1$
throw new InvalidPropertyException(UTIL.getString("no_namespace"));
}
final ScanConsistency consistency = ScanConsistency.valueOf(scanConsistency);
TimeUnit unit = TimeUnit.MILLISECONDS;
if (this.timeUnit != null) {
try {
unit = TimeUnit.valueOf(timeUnit);
} catch (IllegalArgumentException e) {
// $NON-NLS-1$
throw new InvalidPropertyException(UTIL.getString("invalid_timeUnit", timeUnit));
}
}
final TimeUnit timeoutUnit = unit;
return new BasicConnectionFactory<CouchbaseConnectionImpl>() {
@Override
public CouchbaseConnectionImpl getConnection() throws ResourceException {
return new CouchbaseConnectionImpl(environment, connectionString, keyspace, password, timeoutUnit, namespace, consistency);
}
};
}
use of javax.resource.spi.InvalidPropertyException in project tomee by apache.
the class JobSpec method validate.
// -- ActivationSpec methods
@SuppressWarnings("unchecked")
@Override
public void validate() throws InvalidPropertyException {
if (invalidProperty != null) {
throw invalidProperty;
}
final int i = hashCode();
detail = JobBuilder.newJob(QuartzResourceAdapter.JobEndpoint.class).withIdentity("Job" + i, Scheduler.DEFAULT_GROUP).withDescription(description).requestRecovery(recoverable).storeDurably(durable).build();
final TriggerBuilder tb = TriggerBuilder.newTrigger().forJob(detail).withIdentity("Trigger" + i, Scheduler.DEFAULT_GROUP).withDescription(description);
if (startTime != null) {
tb.startAt(parse(startTime));
}
if (endTime != null) {
tb.endAt(parse(endTime));
}
if (calendarName != null) {
tb.modifiedByCalendar(calendarName);
}
final CronScheduleBuilder csb = CronScheduleBuilder.cronSchedule(getCronExpression());
if (timeZone != null) {
csb.inTimeZone(TimeZone.getTimeZone(timeZone));
}
trigger = tb.withSchedule(csb).build();
try {
((CronTriggerImpl) trigger).validate();
} catch (final SchedulerException e) {
throw new InvalidPropertyException(e);
}
}
use of javax.resource.spi.InvalidPropertyException in project wildfly by wildfly.
the class TelnetActivationSpec method validate.
@Override
public void validate() throws InvalidPropertyException {
if (beanClassName == null)
throw new InvalidPropertyException("beanClass is null");
final Class<?> beanClass = beanClass();
// Set Prompt
final Prompt prompt = beanClass.getAnnotation(Prompt.class);
if (prompt != null) {
this.prompt = prompt.value();
}
// Get Commands
final Method[] methods = beanClass.getMethods();
for (Method method : methods) {
if (method.isAnnotationPresent(Command.class)) {
final Command command = method.getAnnotation(Command.class);
cmds.add(new Cmd(command.value(), method));
}
}
// Validate
if (this.prompt == null || this.prompt.length() == 0) {
this.prompt = "prompt>";
}
if (this.cmds.size() == 0) {
throw new InvalidPropertyException("No @Command methods");
}
}
Aggregations