001/*
002 * file StpPartialResultsException.java
003 *
004 * Licensed Materials - Property of IBM
005 * Restricted Materials of IBM 
006 *
007 * com.ibm.rational.wvcm.stp.StpPartialResultsException
008 *
009 * (C) Copyright IBM Corporation 2007, 2011.  All Rights Reserved.
010 * Note to U.S. Government Users Restricted Rights:  Use, duplication or 
011 * disclosure restricted by GSA ADP  Schedule Contract with IBM Corp.
012 */
013
014package com.ibm.rational.wvcm.stp;
015
016import javax.wvcm.Resource;
017import javax.wvcm.ResourceList;
018
019/**
020 * An exception used to convey information about an operation that failed on
021 * some, but not necessarily all, resources processed by the operation.
022 */
023public abstract class StpPartialResultsException extends StpPropertyException
024{
025    /**
026     * Returns the list of resources on which the operation succeeded.
027     *
028     * @return A ResourceList containing a proxy for each resource on which
029     * the operation succeeded. Any requested properties will be defined by
030     * these proxies.
031     */
032    public ResourceList<?> resourceList()
033    {
034        return ((PartialResultsData)data()).resourceList();
035    }
036
037    /**
038     * Returns whether or not the ResourceList of successful resources and the 
039     * list of nested exceptions account for all the resources
040     * that were supposed to be operated on. If this field is <b>true</b>,
041     * there may be resources on which the operation was not performed and hence
042     * are neither reported as succeeding or as failing; the failure mode of the 
043     * operation was such that the remaining operands could not be processed. 
044     *
045     * @return <b>true</b> if all the potential operands could not be enumerated;
046     * <b>false</b> if all the operands could be enumerated but the operation
047     * failed on at least one of them.
048     */
049    public boolean enumerationError()
050    {
051        return ((PartialResultsData)data()).enumerationError();
052    }
053
054    /**
055     * Constructs this exception object for its subclasses.
056     * 
057     * @param resource The Resource argument to WvcmException
058     * @param reasonCode The ReasonCode argument to WvcmException
059     * @param nestedExceptions The Throwable[] argument to WvcmException
060     * 
061     * @see javax.wvcm.WvcmException
062     */
063    protected StpPartialResultsException(Resource resource,
064                                      ReasonCode reasonCode,
065                                      Throwable[] nestedExceptions)
066    {
067        super(resource, reasonCode, nestedExceptions);
068    }
069
070    /** 
071     * The interface for the data implementation object for this type of 
072     * exception
073     */
074    public interface PartialResultsData extends PropertyData {
075        public boolean enumerationError();
076        public ResourceList<?> resourceList();
077    }
078}