001    /*
002     * Copyright (c) 2005 Stephen J. McConnell
003     *
004     * Licensed  under the  Apache License,  Version 2.0  (the "License");
005     * you may not use  this file  except in  compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *   http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed  under the  License is distributed on an "AS IS" BASIS,
012     * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
013     * implied.
014     *
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package net.dpml.metro.runtime;
020    
021    import java.net.URI;
022    import java.net.URISyntaxException;
023    
024    import net.dpml.component.ControlException;
025    
026    /**
027     * Exception indicating an controller related error.  A controller exception
028     * delcares the URI of the controller form which the exception was initiated.
029     *
030     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
031     * @version 1.0.4
032     */
033    public class ControllerException extends ControlException
034    {
035       /**
036        * Serial version identifier.
037        */
038        static final long serialVersionUID = 1L;
039    
040       /**
041        * Creation of a new ControllerRuntimeException.
042        *
043        * @param message the description of the exception 
044        */
045        public ControllerException( String message )
046        {
047            this( message, null );
048        }
049    
050       /**
051        * Creation of a new ControllerRuntimeException.
052        *
053        * @param message the description of the exception 
054        * @param cause the causal exception
055        */
056        public ControllerException( String message, Throwable cause )
057        {
058            super( CONTROLLER_URI, message, cause );
059        }
060    
061        private static final URI CONTROLLER_URI = createControllerURI();
062        
063        private static URI createControllerURI()
064        {
065            try
066            {
067                return new URI( "artifact:part:dpml/metro/dpml-metro-runtime#1.0.4" );
068            }
069            catch( URISyntaxException e )
070            {
071                return null;
072            }
073        }
074    }
075