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     * © Copyright IBM Corporation 2007, 2008.  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    
014    package com.ibm.rational.wvcm.stp;
015    
016    import javax.wvcm.Resource;
017    import javax.wvcm.ResourceList;
018    import javax.wvcm.WvcmException;
019    import javax.wvcm.PropertyNameList.PropertyName;
020    
021    /**
022     * An exception used to convey information about an operation that failed on
023     * some, but not necessarily all, resources processed by the operation.
024     */
025    public abstract class StpPartialResultsException extends StpPropertyException
026    {
027        /**
028         * Returns the list of resources on which the operation succeeded.
029         *
030         * @return A ResourceList containing a proxy for each resource on which
031         * the operation succeeded. Any requested properties will be defined by
032         * these proxies.
033         */
034        public ResourceList<Resource> resourceList()
035        {
036            return ((PartialResultsData)data()).resourceList();
037        }
038    
039        /**
040         * Returns whether or not the ResourceList of successful resources and the 
041         * list of nested exceptions account for all the resources
042         * that were supposed to be operated on. If this field is <b>true</b>,
043         * there may be resources on which the operation was not performed and hence
044         * are neither reported as succeeding or as failing; the failure mode of the 
045         * operation was such that the remaining operands could not be processed. 
046         *
047         * @return <b>true</b> if all the potential operands could not be enumerated;
048         * <b>false</b> if all the operands could be enumerated but the operation
049         * failed on at least one of them.
050         */
051        public boolean enumerationError()
052        {
053            return ((PartialResultsData)data()).enumerationError();
054        }
055    
056        /**
057         * Constructs this exception object for its subclasses.
058         * 
059         * @param resource The Resource argument to WvcmException
060         * @param reasonCode The ReasonCode argument to WvcmException
061         * @param nestedExceptions The Throwable[] argument to WvcmException
062         * 
063         * @see javax.wvcm.WvcmException
064         */
065        protected StpPartialResultsException(Resource resource,
066                                          ReasonCode reasonCode,
067                                          Throwable[] nestedExceptions)
068        {
069            super(resource, reasonCode, nestedExceptions);
070        }
071    
072        /** 
073         * The interface for the data implementation object for this type of 
074         * exception
075         */
076        public interface PartialResultsData extends PropertyData {
077            public boolean enumerationError();
078            public ResourceList<Resource> resourceList();
079        }
080    }