Example usage for org.apache.commons.lang NullArgumentException NullArgumentException

List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.lang NullArgumentException NullArgumentException.

Prototype

public NullArgumentException(String argName) 

Source Link

Document

Instantiates with the given argument name.

Usage

From source file:org.chililog.server.engine.RepositoryStorageWorker.java

/**
 * /*w w  w  . java  2s .c  o  m*/
 * Basic constructor
 * 
 * @param name
 *            name to give this thread
 * @param repo
 *            Repository that we are writing
 * @throws Exception
 *             if error
 */
public RepositoryStorageWorker(String name, Repository repo) throws Exception {
    super(name);

    if (repo == null) {
        throw new NullArgumentException("repo");
    }
    _repo = repo;
    _deadLetterAddress = AppProperties.getInstance().getMqDeadLetterAddress();

    // Load parsers
    for (RepositoryParserConfigBO repoParserInfo : repo.getRepoConfig().getParsers()) {
        if (repoParserInfo.getAppliesTo() == AppliesTo.All) {
            _catchAllParser = EntryParserFactory.getParser(repo.getRepoConfig(), repoParserInfo);
        } else if (repoParserInfo.getAppliesTo() != AppliesTo.None) {
            _filteredParsers.add(EntryParserFactory.getParser(repo.getRepoConfig(), repoParserInfo));
        }
    }

    // If there is no catch all, then set it to the default one (that does no parsing)
    if (_catchAllParser == null) {
        _catchAllParser = EntryParserFactory.getDefaultParser(repo.getRepoConfig());
    }

    return;
}

From source file:org.copperengine.core.persistent.cassandra.CassandraSessionManagerImpl.java

public CassandraSessionManagerImpl(Collection<String> hosts, Integer port, String keyspace) {
    if (hosts == null || hosts.isEmpty())
        throw new NullArgumentException("hosts");
    if (keyspace == null || keyspace.isEmpty())
        throw new NullArgumentException("keyspace");
    this.hosts = hosts;
    this.port = port;
    this.keyspace = keyspace;
}

From source file:org.copperengine.core.persistent.cassandra.CassandraSessionManagerPojo.java

public CassandraSessionManagerPojo(final Session session, final Cluster cluster) {
    if (session == null)
        throw new NullArgumentException("session");
    if (cluster == null)
        throw new NullArgumentException("cluster");
    this.session = session;
    this.cluster = cluster;
}

From source file:org.copperengine.core.persistent.cassandra.CassandraStorage.java

public CassandraStorage(final CassandraSessionManager sessionManager, final Executor executor,
        final RuntimeStatisticsCollector runtimeStatisticsCollector, final ConsistencyLevel consistencyLevel) {
    if (sessionManager == null)
        throw new NullArgumentException("sessionManager");

    if (consistencyLevel == null)
        throw new NullArgumentException("consistencyLevel");

    if (executor == null)
        throw new NullArgumentException("executor");

    if (runtimeStatisticsCollector == null)
        throw new NullArgumentException("runtimeStatisticsCollector");

    this.executor = executor;
    this.consistencyLevel = consistencyLevel;
    this.session = sessionManager.getSession();
    this.cluster = sessionManager.getCluster();
    this.runtimeStatisticsCollector = runtimeStatisticsCollector;

}

From source file:org.copperengine.core.persistent.hybrid.StorageCache.java

public StorageCache(Storage delegate) {
    if (delegate == null)
        throw new NullArgumentException("delegate");
    this.delegate = delegate;

    wfCache = new ConcurrentHashMap<>();
    earCache = new ConcurrentHashMap<>();
}

From source file:org.dresdenocl.essentialocl.expressions.factory.EssentialOclFactory.java

/**
 * <p>/* w w w .jav  a  2  s.  co m*/
 * Creates a {@link CollectionRange}.
 * </p>
 * 
 * @param first
 *          The {@link OclExpression} for the first element.
 * @param last
 *          The {@link OclExpression} for the last element.
 * @return A {@link CollectionRange} instance.
 */
public CollectionRange createCollectionRange(OclExpression first, OclExpression last) {

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createCollectionRange(first=" + first + ", last=" + last //$NON-NLS-1$ //$NON-NLS-2$
                + ") - enter"); //$NON-NLS-1$
    }

    if (first == null || last == null) {
        throw new NullArgumentException("first or last"); //$NON-NLS-1$
    }

    CollectionRange collectionRange;

    collectionRange = ExpressionsFactory.INSTANCE.createCollectionRange();
    collectionRange.setFirst(first);
    collectionRange.setLast(last);

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createCollectionRange() - exit - return value=" //$NON-NLS-1$
                + collectionRange);
    }

    return collectionRange;
}

From source file:org.dresdenocl.essentialocl.expressions.factory.EssentialOclFactory.java

/**
 * <p>/*from   w  ww . ja v  a2s .co m*/
 * Creates a new {@link Constraint}. The name is optional. but the other
 * parameters need to have valid values.
 * </p>
 * 
 * @param name
 *          An optional name for the {@link Constraint}.
 * @param kind
 *          One of the constants defined in {@link ConstraintKind}.
 * @param specification
 *          The {@link Expression} that specifies the {@link Constraint}.
 * @param constrainedElement
 *          At least one element that is the target of the {@link Constraint}.
 * 
 * @return A {@link Constraint} instance.
 */
public Constraint createConstraint(String name, ConstraintKind kind, Expression specification,
        Feature definedFeature, ConstrainableElement... constrainedElement) {

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createConstraint(name=" + name + ", kind=" + kind //$NON-NLS-1$ //$NON-NLS-2$
                + ", specification=" + specification + ", constrainedElement=" //$NON-NLS-1$//$NON-NLS-2$
                + ArrayUtils.toString(constrainedElement) + ") - enter"); //$NON-NLS-1$
    }

    if (kind == null || specification == null || constrainedElement == null) {
        throw new NullArgumentException("kind or specification or constrainedElement"); //$NON-NLS-1$
    }

    Constraint constraint = PivotModelFactory.eINSTANCE.createConstraint();

    constraint.setName(name);
    constraint.setKind(kind);
    constraint.setSpecification(specification);
    constraint.setDefinedFeature(definedFeature);
    constraint.getConstrainedElement().addAll(Arrays.asList(constrainedElement));

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createConstraint() - exit - return value=" + constraint); //$NON-NLS-1$
    }

    return constraint;

}

From source file:org.dresdenocl.essentialocl.expressions.factory.EssentialOclFactory.java

/**
 * <p>/*from w  w w. ja  va 2 s. co m*/
 * Creates a new {@link ExpressionInOcl}. The body expression and the context
 * variable must not be <code>null</code>. The result and parameter variables
 * are optional since they are only required for constraints whose context is
 * an operation.
 * </p>
 * 
 * @param body
 *          The body expression as a {@link String} in OCL concrete syntax.
 * @param bodyExpression
 *          The {@link OclExpression} that is the body of the
 *          {@link ExpressionInOcl}.
 * @param context
 *          The {@link Variable} representing the contextual classifier.
 * @param result
 *          The result {@link Variable} of an operation {@link Constraint} .
 * @param parameter
 *          The parameters of an operation {@link Constraint}.
 * 
 * @return An {@link ExpressionInOcl} instance.
 */
public ExpressionInOcl createExpressionInOcl(String body, OclExpression bodyExpression, Variable context,
        Variable result, Variable... parameter) {

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createExpressionInOcl(bodyExpression=" + bodyExpression //$NON-NLS-1$
                + ", context=" + context + ", result=" + result + ", parameter=" //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
                + ArrayUtils.toString(parameter) + ") - enter"); //$NON-NLS-1$
    }

    if (bodyExpression == null || context == null) {
        throw new NullArgumentException("bodyExpression or context"); //$NON-NLS-1$
    }

    ExpressionInOcl expressionInOcl;

    expressionInOcl = ExpressionsFactory.INSTANCE.createExpressionInOcl();
    expressionInOcl.setBodyExpression(bodyExpression);
    expressionInOcl.setContext(context);

    if (StringUtils.isNotEmpty(body)) {
        expressionInOcl.setBody(body.replaceAll("\r\n|\r|\n", " "));
    }

    if (result != null) {
        expressionInOcl.setResult(result);
    }

    if (parameter != null) {
        expressionInOcl.getParameter().addAll(Arrays.asList(parameter));
    }

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createExpressionInOcl() - exit - return value=" //$NON-NLS-1$
                + expressionInOcl);
    }

    return expressionInOcl;
}

From source file:org.dresdenocl.essentialocl.expressions.factory.EssentialOclFactory.java

/**
 * <p>/*from ww w . j av  a  2  s .  c o m*/
 * Creates an {@link IfExp}.
 * </p>
 * 
 * @param condition
 *          The condition {@link OclExpression}.
 * @param thenExpression
 *          The then {@link OclExpression}.
 * @param elseExpression
 *          The else {@link OclExpression}.
 * @return An {@link IfExp} instance.
 */
public IfExp createIfExp(OclExpression condition, OclExpression thenExpression, OclExpression elseExpression) {

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createIfExp(condition=" + condition + ", thenExpression=" //$NON-NLS-1$ //$NON-NLS-2$
                + thenExpression + ", elseExpression=" + elseExpression //$NON-NLS-1$
                + ") - enter"); //$NON-NLS-1$
    }

    if (condition == null || thenExpression == null || elseExpression == null) {
        throw new NullArgumentException("condition or thenExpression or elseExpression"); //$NON-NLS-1$
    }

    IfExp ifExp = ExpressionsFactory.INSTANCE.createIfExp();

    ifExp.setCondition(condition);
    ifExp.setThenExpression(thenExpression);
    ifExp.setElseExpression(elseExpression);

    ifExp.setOclLibrary(oclLibrary);

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createIfExp() - exit - return value=" + ifExp); //$NON-NLS-1$
    }
    return ifExp;

}

From source file:org.dresdenocl.essentialocl.expressions.factory.EssentialOclFactory.java

/**
 * <p>/*from   w  w  w .ja  v  a2 s .co  m*/
 * Creates a new {@link IterateExp}.
 * </p>
 * 
 * @param source
 *          The source {@link OclExpression}.
 * @param name
 *          The name of the {@link IterateExp}.
 * @param body
 *          The body {@link OclExpression} of the {@link IterateExp}.
 * @param result
 *          The result {@link Variable}.
 * @param iterator
 *          The optional iterator {@link Variable}s as an array.
 * @return The {@link IterateExp} instance.
 */
public IterateExp createIterateExp(OclExpression source, OclExpression body, Variable result,
        Variable... iterator) {

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createIterateExp(source=" + source + ", body=" + body //$NON-NLS-1$ //$NON-NLS-2$
                + ", result=" + result + ", iterator=" //$NON-NLS-1$//$NON-NLS-2$
                + ArrayUtils.toString(iterator) + ") - enter"); //$NON-NLS-1$
    }

    if (source == null || body == null || result == null) {
        throw new NullArgumentException("source or body or result"); //$NON-NLS-1$
    }

    IterateExp iterateExp = ExpressionsFactory.INSTANCE.createIterateExp();

    iterateExp.setSource(source);
    iterateExp.setBody(body);
    iterateExp.setResult(result);

    if (iterator != null) {
        iterateExp.getIterator().addAll(Arrays.asList(iterator));
    }

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("createIterateExp() - exit - return value=" + iterateExp); //$NON-NLS-1$
    }

    return iterateExp;
}