Package de.fu_berlin.inf.dpp.exceptions

Examples of de.fu_berlin.inf.dpp.exceptions.StreamServiceNotValidException


     */
    protected void validate() throws StreamServiceNotValidException {

        if (getServiceName() == null
            || !getServiceName().matches("\\A[a-zA-Z]+\\z"))
            throw new StreamServiceNotValidException(
                "Service-name is empty or contains invalid characters.", this);

        if (getStreamsPerSession() <= 0)
            throw new StreamServiceNotValidException(
                "A session can not have less than one stream.", this);

        if (getChunkSize().length < getStreamsPerSession())
            throw new StreamServiceNotValidException(
                "Chunk-size has to be set for every stream.", this);

        if (getMaximumDelay().length < getStreamsPerSession())
            throw new StreamServiceNotValidException(
                "Delays have to be set for every stream.", this);

        if (getBufferSize().length < getStreamsPerSession())
            throw new StreamServiceNotValidException(
                "Buffer-sizes have to be set for every stream.", this);

        for (int chunkSize : getChunkSize()) {
            if (chunkSize < 0)
                throw new StreamServiceNotValidException(
                    "Chunk-sizes have to be greater-than-or-equal 0.", this);
        }

        for (long delay : getMaximumDelay()) {
            if (delay < 0)
                throw new StreamServiceNotValidException(
                    "Delay has to be greater-than-or-equal 0.", this);
        }

        for (int bufferSize : getChunkSize()) {
            if (bufferSize <= 0)
                throw new StreamServiceNotValidException(
                    "Chunk-size has to be greater than 0.", this);
        }

    }
View Full Code Here

TOP

Related Classes of de.fu_berlin.inf.dpp.exceptions.StreamServiceNotValidException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.