View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.webscripts;
20  
21  import java.util.Collection;
22  import java.util.Map;
23  
24  
25  /**
26   * Web Scripts Registry
27   * 
28   * @author davidc
29   */
30  public interface Registry
31  {
32      /**
33       * Gets a Web Script Package
34       * 
35       * @param packagePath
36       * @return  web script path representing package
37       */
38      public Path getPackage(String packagePath);
39      
40      /**
41       * Gets a Web Script URL
42       * 
43       * @param uriPath
44       * @return  web script path representing uri
45       */
46      public Path getUri(String uriPath);
47      
48      /**
49       * Gets a Web Script Family
50       * 
51       * NOTE:
52       * - To get all families, pass /
53       * - To get a specific family, pass /{familyName}
54       * 
55       * @param familyPath
56       * @return  web script path representing family
57       */
58      public Path getFamily(String familyPath);
59      
60      /**
61       * Gets a Lifecycle Family, for example, all deprecated web scripts
62       * 
63       * NOTE:
64       * - To get all lifecycles, pass /
65       * - To get a specific lifecycle, pass /{lifecycleName}
66       * 
67       * @param lifecyclePath
68       * @return  web script path representing family
69       */
70      public Path getLifecycle(String lifecyclePath);
71      
72      /**
73       * Gets all Web Scripts
74       * 
75       * @return  web scripts
76       */
77      public Collection<WebScript> getWebScripts();
78  
79      /**
80       * Gets all Web Script definitions that failed to register
81       * 
82       * @return map of error by web script definition file path
83       */
84      public Map<String, String> getFailures();
85  
86      /**
87       * Gets a Web Script by Id
88       * 
89       * @param id  web script id
90       * @return  web script
91       */
92      public WebScript getWebScript(String id);
93  
94      /**
95       * Gets a Web Script given an HTTP Method and URI
96       * 
97       * @param method  http method
98       * @param uri  uri
99       * @return  script match (pair of script and uri that matched)
100      */
101     public Match findWebScript(String method, String uri);
102 
103     /**
104      * Resets the Web Script Registry
105      */
106     public void reset();
107 }