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.petalslink.dsb.kernel.registry.BaseEndpointRegistry.java

/**
 * {@inheritDoc}//from w w  w.  ja v a2s  .  c  om
 */
public QName[] getInterfacesForEndpoint(ServiceEndpoint endpoint) {
    if (this.log.isDebugEnabled()) {
        this.log.debug("Entering method : getInterfacesForEndpoint with params endpoint = " + endpoint);
    }

    if (endpoint == null) {
        throw new NullArgumentException("endpoint");
    }

    QName[] result = null;

    if (endpoint.getInterfaces() == null) {
        // try to get it from the registry...
        try {
            Endpoint e = this.client.get(this.getKey(endpoint), true);
            if ((e != null) && (e.getInterface() != null)) {
                result = endpoint.getInterfaces();
            }
        } catch (RegistryException e) {
            e.printStackTrace();
        }

    }
    return result;
}

From source file:org.pivot4j.impl.PivotModelImpl.java

/**
 * @see org.pivot4j.state.Bookmarkable#restoreState(java.io.Serializable)
 *//*  w ww  .j av  a 2s  .co  m*/
public synchronized void restoreState(Serializable state) {
    if (state == null) {
        throw new NullArgumentException("state");
    }

    Serializable[] states = (Serializable[]) state;

    setMdx((String) states[0]);

    if (!isInitialized()) {
        initialize();
    }

    // sorting
    if (states[1] == null) {
        this.sortPosMembers = null;
    } else {
        try {
            Cube cube = getCube();

            Serializable[] sortStates = (Serializable[]) states[1];

            String[] sortPosUniqueNames = (String[]) sortStates[0];
            if (sortPosUniqueNames == null) {
                this.sortPosMembers = null;
            } else {
                this.sortPosMembers = new ArrayList<Member>(sortPosUniqueNames.length);

                for (int i = 0; i < sortPosUniqueNames.length; i++) {
                    Member member = cube.lookupMember(
                            IdentifierNode.parseIdentifier(sortPosUniqueNames[i]).getSegmentList());
                    if (member == null) {
                        if (logger.isWarnEnabled()) {
                            logger.warn("Sort position member not found {}", sortPosUniqueNames[i]);
                        }

                        break;
                    }

                    sortPosMembers.add(member);
                }

                this.topBottomCount = (Integer) sortStates[1];
                this.sortCriteria = (SortCriteria) sortStates[2];
                this.sorting = (Boolean) sortStates[3];
            }
        } catch (OlapException e) {
            throw new PivotException(e);
        }
    }

    this.cellSet = null;

    queryAdapter.restoreState(states[2]);

    this.defaultNonEmpty = (Boolean) states[3];
}

From source file:org.pivot4j.impl.PivotModelImpl.java

/**
 * @see org.pivot4j.state.Configurable#saveSettings(org.apache.commons.configuration.HierarchicalConfiguration)
 *//*from w  w  w . j  a v  a2s.  co  m*/
@Override
public synchronized void saveSettings(HierarchicalConfiguration configuration) {
    if (configuration == null) {
        throw new NullArgumentException("configuration");
    }

    if (configuration.getLogger() == null) {
        configuration.setLogger(LogFactory.getLog(getClass()));
    }

    if (isInitialized()) {
        configuration.addProperty("mdx", getCurrentMdx());
    } else {
        configuration.addProperty("mdx", mdxQuery);
    }

    if (sorting) {
        configuration.addProperty("sort[@enabled]", sorting);

        if (queryAdapter.getQuaxToSort() != null) {
            configuration.addProperty("sort[@ordinal]", queryAdapter.getQuaxToSort().getOrdinal());
        }

        if (sortCriteria != null) {
            configuration.addProperty("sort[@criteria]", sortCriteria.name());
            configuration.addProperty("sort[@topBottomCount]", topBottomCount);
            if (isSorting() && sortPosMembers != null) {
                int index = 0;
                for (Member member : sortPosMembers) {
                    configuration.addProperty(String.format("sort.member(%s)", index++),
                            member.getUniqueName());
                }
            }
        }
    }

    if (queryAdapter != null && queryAdapter.isAxesSwapped()) {
        configuration.addProperty("axesSwapped", true);
    }

    // TODO This setting can potentially be present in the
    // pivot4j-config.xml, in which case, it would be saved with the report
    // thus making subsequent changing of the default value ineffective.
    // We should wait till we find a way to handle such a scenario better
    // later.
    //
    // if (defaultNonEmpty) {
    // configuration.addProperty("nonEmpty[@default]", true);
    // }
}

From source file:org.pivot4j.impl.PivotModelImpl.java

/**
 * @see org.pivot4j.state.Configurable#restoreSettings(org.apache.commons.configuration.HierarchicalConfiguration)
 *///from   www .  ja va  2 s  .co  m
@Override
public synchronized void restoreSettings(HierarchicalConfiguration configuration) {
    if (configuration == null) {
        throw new NullArgumentException("configuration");
    }

    this.defaultNonEmpty = configuration.getBoolean("nonEmpty[@default]", false);

    String mdx = configuration.getString("mdx");

    setMdx(mdx);

    if (mdx == null) {
        return;
    }

    if (!isInitialized()) {
        initialize();
    }

    this.sorting = configuration.getBoolean("sort[@enabled]", false);

    this.sortPosMembers = null;
    this.sortCriteria = SortCriteria.ASC;
    this.topBottomCount = 10;

    Quax quaxToSort = null;

    if (sorting) {
        List<Object> sortPosUniqueNames = configuration.getList("sort.member");
        if (sortPosUniqueNames != null && !sortPosUniqueNames.isEmpty()) {
            try {
                Cube cube = getCube();

                this.sortPosMembers = new ArrayList<Member>(sortPosUniqueNames.size());

                for (Object uniqueName : sortPosUniqueNames) {
                    Member member = cube.lookupMember(
                            IdentifierNode.parseIdentifier(uniqueName.toString()).getSegmentList());
                    if (member == null) {
                        if (logger.isWarnEnabled()) {
                            logger.warn("Sort position member not found " + uniqueName);
                        }

                        break;
                    }

                    sortPosMembers.add(member);
                }
            } catch (OlapException e) {
                throw new PivotException(e);
            }
        }

        this.topBottomCount = configuration.getInt("sort[@topBottomCount]", 10);

        String sortName = configuration.getString("sort[@criteria]");
        if (sortName != null) {
            this.sortCriteria = SortCriteria.valueOf(sortName);
        }

        int ordinal = configuration.getInt("sort[@ordinal]", -1);

        if (ordinal > 0) {
            for (Axis axis : queryAdapter.getAxes()) {
                Quax quax = queryAdapter.getQuax(axis);
                if (quax.getOrdinal() == ordinal) {
                    quaxToSort = quax;
                    break;
                }
            }
        }
    }

    queryAdapter.setQuaxToSort(quaxToSort);

    boolean axesSwapped = configuration.getBoolean("axesSwapped", false);

    queryAdapter.setAxesSwapped(axesSwapped);

    this.cellSet = null;
}

From source file:org.pivot4j.impl.Quax.java

/**
 * @param ordinal//from   w  w w .ja v a 2  s  .  c  om
 * @param model
 */
public Quax(int ordinal, PivotModelImpl model) {
    if (model == null) {
        throw new NullArgumentException("model");
    }

    this.ordinal = ordinal;
    this.model = model;
}

From source file:org.pivot4j.impl.QuaxUtil.java

/**
 * @param cube//  w w w.  j  a  v  a2  s  .c om
 * @param cache
 */
public QuaxUtil(Cube cube, MemberHierarchyCache cache) {
    if (cube == null) {
        throw new NullArgumentException("cube");
    }

    this.cube = cube;

    if (cache == null) {
        this.cache = new MemberHierarchyCache(cube);
    } else {
        this.cache = cache;
    }

    this.olapUtils = new OlapUtils(cube);
    olapUtils.setMemberHierarchyCache(cache);
}

From source file:org.pivot4j.impl.QueryAdapter.java

/**
 * @param model/*  w w  w . j  ava  2s . c om*/
 */
public QueryAdapter(PivotModelImpl model) {
    if (model == null) {
        throw new NullArgumentException("model");
    }

    this.model = model;
}

From source file:org.pivot4j.ui.AbstractContentRenderCallback.java

/**
 * @param stream//  w  w w .j av  a  2s  . c  om
 */
public AbstractContentRenderCallback(OutputStream stream) {
    if (stream == null) {
        throw new NullArgumentException("out");
    }

    this.stream = stream;
}

From source file:org.pivot4j.ui.AbstractMarkupRenderCallback.java

/**
 * @param writer//from w  w w  . j av a  2  s .  c o m
 */
public AbstractMarkupRenderCallback(Writer writer) {
    if (writer == null) {
        throw new NullArgumentException("writer");
    }

    this.writer = new PrintWriter(writer);
}