|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
StaleLinkException.java | - | 7.1% | 12.5% | 9.1% |
|
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry; | |
16 | ||
17 | import org.apache.hivemind.ApplicationRuntimeException; | |
18 | ||
19 | /** | |
20 | * Exception thrown by an {@link org.apache.tapestry.engine.IEngineService} when it discovers that | |
21 | * the an action link was for an out-of-date version of the page. | |
22 | * | |
23 | * <p>The application should redirect to the StaleLink page. | |
24 | * | |
25 | * | |
26 | * @author Howard Lewis Ship | |
27 | * | |
28 | **/ | |
29 | ||
30 | public class StaleLinkException extends ApplicationRuntimeException | |
31 | { | |
32 | private transient IPage _page; | |
33 | private String _pageName; | |
34 | private String _targetIdPath; | |
35 | private String _targetActionId; | |
36 | ||
37 | 0 | public StaleLinkException() |
38 | { | |
39 | 0 | super(null, null, null, null); |
40 | } | |
41 | ||
42 | /** | |
43 | * Constructor used when the action id is found, but the target id path | |
44 | * did not match the actual id path. | |
45 | * | |
46 | **/ | |
47 | ||
48 | 0 | public StaleLinkException(IComponent component, String targetActionId, String targetIdPath) |
49 | { | |
50 | 0 | super( |
51 | Tapestry.format( | |
52 | "StaleLinkException.action-mismatch", | |
53 | new String[] { targetActionId, component.getIdPath(), targetIdPath }), | |
54 | component, | |
55 | null, | |
56 | null); | |
57 | ||
58 | 0 | _page = component.getPage(); |
59 | 0 | _pageName = _page.getPageName(); |
60 | ||
61 | 0 | _targetActionId = targetActionId; |
62 | 0 | _targetIdPath = targetIdPath; |
63 | } | |
64 | ||
65 | /** | |
66 | * Constructor used when the target action id is not found. | |
67 | * | |
68 | **/ | |
69 | ||
70 | 0 | public StaleLinkException(IPage page, String targetActionId, String targetIdPath) |
71 | { | |
72 | 0 | this( |
73 | Tapestry.format( | |
74 | "StaleLinkException.component-mismatch", | |
75 | targetActionId, | |
76 | targetIdPath), | |
77 | page); | |
78 | ||
79 | 0 | _targetActionId = targetActionId; |
80 | 0 | _targetIdPath = targetIdPath; |
81 | } | |
82 | ||
83 | 4 | public StaleLinkException(String message, IComponent component) |
84 | { | |
85 | 4 | super(message, component, null, null); |
86 | } | |
87 | ||
88 | ||
89 | ||
90 | 0 | public String getPageName() |
91 | { | |
92 | 0 | return _pageName; |
93 | } | |
94 | ||
95 | /** | |
96 | * Returns the page referenced by the service URL, if known, | |
97 | * or null otherwise. | |
98 | * | |
99 | **/ | |
100 | ||
101 | 0 | public IPage getPage() |
102 | { | |
103 | 0 | return _page; |
104 | } | |
105 | ||
106 | 0 | public String getTargetActionId() |
107 | { | |
108 | 0 | return _targetActionId; |
109 | } | |
110 | ||
111 | 0 | public String getTargetIdPath() |
112 | { | |
113 | 0 | return _targetIdPath; |
114 | } | |
115 | ||
116 | } |
|