Search in sources :

Example 1 with Cmd

use of org.jboss.as.test.integration.ejb.mdb.dynamic.impl.Cmd 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");
    }
}
Also used : Command(org.jboss.as.test.integration.ejb.mdb.dynamic.api.Command) InvalidPropertyException(javax.resource.spi.InvalidPropertyException) Prompt(org.jboss.as.test.integration.ejb.mdb.dynamic.api.Prompt) Method(java.lang.reflect.Method) Cmd(org.jboss.as.test.integration.ejb.mdb.dynamic.impl.Cmd)

Aggregations

Method (java.lang.reflect.Method)1 InvalidPropertyException (javax.resource.spi.InvalidPropertyException)1 Command (org.jboss.as.test.integration.ejb.mdb.dynamic.api.Command)1 Prompt (org.jboss.as.test.integration.ejb.mdb.dynamic.api.Prompt)1 Cmd (org.jboss.as.test.integration.ejb.mdb.dynamic.impl.Cmd)1