View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
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.jdiagnose.library.web.breadcrumb;
17  
18  import java.util.List;
19  import java.util.Map;
20  import java.util.Properties;
21  import java.util.Set;
22  
23  import javax.servlet.http.HttpServletRequest;
24  
25  /***
26   * @author jmccrindle
27   */
28  public class JDiagnoseTrail implements Trail {
29  
30      private DefaultTrail trail = null;
31      private PropertiesCrumbFactory propertiesCrumbFactory = null;
32      private MapCrumbFactory mapCrumbFactory = null;
33      private UriCrumbStrategy uriCrumbStrategy = null;
34      
35      public JDiagnoseTrail() {
36          uriCrumbStrategy = new UriCrumbStrategy();
37          mapCrumbFactory = new MapCrumbFactory();
38          propertiesCrumbFactory = new PropertiesCrumbFactory(mapCrumbFactory);
39          trail = new DefaultTrail(uriCrumbStrategy, propertiesCrumbFactory);
40      }
41      
42      /* (non-Javadoc)
43       * @see org.jdiagnose.library.web.breadcrumb.Trail#getBreadcrumb(javax.servlet.http.HttpServletRequest)
44       */
45      public List getBreadcrumb(HttpServletRequest request) {
46          return trail.getBreadcrumb(request);
47      }
48      
49      public void setFactories(Map factories) {
50          mapCrumbFactory.setFactories(factories);
51      }
52      
53      public void setProperties(Properties properties) {
54          propertiesCrumbFactory.setProperties(properties);
55      }
56      
57      public void setPrefixes(Set prefixes) {
58          uriCrumbStrategy.setPrefixes(prefixes);
59      }
60      
61      public void setSuffix(String suffix) {
62          uriCrumbStrategy.setSuffix(suffix);
63      }
64  }