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.ControlRuntimeException;
025    
026    /**
027     * Exception indicating an unexpected controller related runtime error.  A controller 
028     * runtime exception delcares the URI of the controller form which the exception 
029     * was initiated.
030     *
031     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
032     * @version 1.2.0
033     */
034    public class ControllerRuntimeException extends ControlRuntimeException 
035    {
036       /**
037        * Serial version identifier.
038        */
039        static final long serialVersionUID = 1L;
040    
041       /**
042        * Creation of a new ControllerRuntimeException.
043        *
044        * @param message the description of the exception 
045        */
046        public ControllerRuntimeException( String message )
047        {
048            this( message, null );
049        }
050    
051       /**
052        * Creation of a new ControllerRuntimeException.
053        *
054        * @param message the description of the exception 
055        * @param cause the causal exception
056        */
057        public ControllerRuntimeException( String message, Throwable cause )
058        {
059            super( CONTROLLER_URI, message, cause );
060        }
061    
062        private static final URI CONTROLLER_URI = createControllerURI();
063        
064        private static URI createControllerURI()
065        {
066            try
067            {
068                return new URI( "artifact:part:dpml/metro/dpml-metro-runtime#1.2.0" );
069            }
070            catch( URISyntaxException e )
071            {
072                return null;
073            }
074        }
075        
076    }
077