Java Code Examples for org.fourthline.cling.model.ModelUtil#isValidUDAName()

The following examples show how to use org.fourthline.cling.model.ModelUtil#isValidUDAName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StateVariable.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
public List<ValidationError> validate() {
    List<ValidationError> errors = new ArrayList();

    if (getName() == null || getName().length() == 0) {
        errors.add(new ValidationError(
                getClass(),
                "name",
                "StateVariable without name of: " + getService()
        ));
    } else if (!ModelUtil.isValidUDAName(getName())) {
        log.warning("UPnP specification violation of: " + getService().getDevice());
        log.warning("Invalid state variable name: " + this);
    }

    errors.addAll(getTypeDetails().validate());

    return errors;
}
 
Example 2
Source File: StateVariable.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
public List<ValidationError> validate() {
    List<ValidationError> errors = new ArrayList();

    if (getName() == null || getName().length() == 0) {
        errors.add(new ValidationError(
                getClass(),
                "name",
                "StateVariable without name of: " + getService()
        ));
    } else if (!ModelUtil.isValidUDAName(getName())) {
        log.warning("UPnP specification violation of: " + getService().getDevice());
        log.warning("Invalid state variable name: " + this);
    }

    errors.addAll(getTypeDetails().validate());

    return errors;
}
 
Example 3
Source File: ActionArgument.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public List<ValidationError> validate() {
    List<ValidationError> errors = new ArrayList();

    if (getName() == null || getName().length() == 0) {
        errors.add(new ValidationError(
                getClass(),
                "name",
                "Argument without name of: " + getAction()
        ));
    } else if (!ModelUtil.isValidUDAName(getName())) {
        log.warning("UPnP specification violation of: " + getAction().getService().getDevice());
        log.warning("Invalid argument name: " + this);
    } else if (getName().length() > 32) {
        log.warning("UPnP specification violation of: " + getAction().getService().getDevice());
        log.warning("Argument name should be less than 32 characters: " + this);
    }

    if (getDirection() == null) {
        errors.add(new ValidationError(
                getClass(),
                "direction",
                "Argument '"+getName()+"' requires a direction, either IN or OUT"
        ));
    }

    if (isReturnValue() && getDirection() != ActionArgument.Direction.OUT) {
        errors.add(new ValidationError(
                getClass(),
                "direction",
                "Return value argument '" + getName() + "' must be direction OUT"
        ));
    }

    return errors;
}
 
Example 4
Source File: SoapActionType.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public SoapActionType(String namespace, String type, Integer version, String actionName) {
    this.namespace = namespace;
    this.type = type;
    this.version = version;
    this.actionName = actionName;

    if (actionName != null && !ModelUtil.isValidUDAName(actionName)) {
        throw new IllegalArgumentException("Action name contains illegal characters: " + actionName);
    }
}
 
Example 5
Source File: ActionArgument.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public List<ValidationError> validate() {
    List<ValidationError> errors = new ArrayList();

    if (getName() == null || getName().length() == 0) {
        errors.add(new ValidationError(
                getClass(),
                "name",
                "Argument without name of: " + getAction()
        ));
    } else if (!ModelUtil.isValidUDAName(getName())) {
        log.warning("UPnP specification violation of: " + getAction().getService().getDevice());
        log.warning("Invalid argument name: " + this);
    } else if (getName().length() > 32) {
        log.warning("UPnP specification violation of: " + getAction().getService().getDevice());
        log.warning("Argument name should be less than 32 characters: " + this);
    }

    if (getDirection() == null) {
        errors.add(new ValidationError(
                getClass(),
                "direction",
                "Argument '"+getName()+"' requires a direction, either IN or OUT"
        ));
    }

    if (isReturnValue() && getDirection() != ActionArgument.Direction.OUT) {
        errors.add(new ValidationError(
                getClass(),
                "direction",
                "Return value argument '" + getName() + "' must be direction OUT"
        ));
    }

    return errors;
}
 
Example 6
Source File: SoapActionType.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public SoapActionType(String namespace, String type, Integer version, String actionName) {
    this.namespace = namespace;
    this.type = type;
    this.version = version;
    this.actionName = actionName;

    if (actionName != null && !ModelUtil.isValidUDAName(actionName)) {
        throw new IllegalArgumentException("Action name contains illegal characters: " + actionName);
    }
}