KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > engine > builder > FlowArtifactLookupException


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.springframework.webflow.engine.builder;
17
18 import org.springframework.util.ClassUtils;
19 import org.springframework.util.StringUtils;
20 import org.springframework.webflow.core.FlowException;
21 import org.springframework.webflow.execution.FlowExecutionException;
22
23 /**
24  * A flow artifact lookup exception is thrown when an artifact (such as a flow, state,
25  * action, etc.) required by the webflow system cannot be obtained.
26  * <p>
27  * Flow artifact lookup exceptions indicate unrecoverable problems with the flow
28  * definition, e.g. a required action of a flow cannot be found. They're not used
29  * to signal problems related to execution of a client request. A
30  * {@link FlowExecutionException} is used for that.
31  *
32  * @see org.springframework.webflow.execution.FlowExecutionException
33  *
34  * @author Keith Donald
35  * @author Erwin Vervaet
36  */

37 public class FlowArtifactLookupException extends FlowException {
38
39     /**
40      * The id of the artifact that could not be retrieved.
41      */

42     private String JavaDoc artifactId;
43
44     /**
45      * The type of artifact that could not be retrieved.
46      */

47     private Class JavaDoc artifactType;
48
49     /**
50      * Create a new flow artifact lookup exception.
51      * @param artifactId the id of the artifact
52      * @param artifactType the expected artifact type
53      */

54     public FlowArtifactLookupException(String JavaDoc artifactId, Class JavaDoc artifactType) {
55         this(artifactId, artifactType, null, null);
56     }
57
58     /**
59      * Create a new flow artifact lookup exception.
60      * @param artifactId the id of the artifact
61      * @param artifactType the expected artifact type
62      * @param cause the underlying cause of this exception
63      */

64     public FlowArtifactLookupException(String JavaDoc artifactId, Class JavaDoc artifactType, Throwable JavaDoc cause) {
65         this(artifactId, artifactType, null, cause);
66     }
67
68     /**
69      * Create a new flow artifact lookup exception.
70      * @param artifactId the id of the artifact
71      * @param artifactType the expected artifact type
72      * @param message descriptive message
73      */

74     public FlowArtifactLookupException(String JavaDoc artifactId, Class JavaDoc artifactType, String JavaDoc message) {
75         this(artifactId, artifactType, message, null);
76     }
77
78     /**
79      * Create a new flow artifact lookup exception.
80      * @param artifactId the id of the artifact
81      * @param artifactType the expected artifact type
82      * @param message descriptive message
83      * @param cause the underlying cause of this exception
84      */

85     public FlowArtifactLookupException(String JavaDoc artifactId, Class JavaDoc artifactType, String JavaDoc message, Throwable JavaDoc cause) {
86         super((StringUtils.hasText(message) ? message : "Unable to obtain a " + ClassUtils.getShortName(artifactType)
87                 + " flow artifact with id '" + artifactId + "': make sure there is a valid [" + artifactType
88                 + "] exported with this id"), cause);
89         this.artifactType = artifactType;
90         this.artifactId = artifactId;
91     }
92
93     /**
94      * Returns the id of the artifact that cannot be found.
95      */

96     public String JavaDoc getArtifactId() {
97         return artifactId;
98     }
99
100     /**
101      * Returns the expected artifact type.
102      */

103     public Class JavaDoc getArtifactType() {
104         return artifactType;
105     }
106 }
Popular Tags