This project has retired. For details please refer to its Attic page.
ApplicationContext xref
View Javadoc

1   /*
2    * $Id: ApplicationContext.java 1306435 2012-03-28 15:39:11Z nlebas $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.tiles.request;
22  
23  import java.util.Collection;
24  import java.util.Locale;
25  import java.util.Map;
26  
27  /**
28   * Defines a set of methods which tiles use to communicate to
29   * the tiles container and runtime environment.  There is only
30   * one application context per container.
31   *
32   * @version $Rev: 1306435 $ $Date: 2012-03-29 02:39:11 +1100 (Thu, 29 Mar 2012) $
33   */
34  public interface ApplicationContext {
35  
36      /**
37       * Returns the original, technology-dependent, context.
38       *
39       * @return The original application context.
40       */
41      Object getContext();
42  
43      /**
44       * Returns a mutable Map that maps application scope attribute names to
45       * their values.
46       *
47       * @return Map of key value pairs.
48       */
49      Map<String, Object> getApplicationScope();
50  
51      /**
52       * Return an immutable Map that maps context application initialization
53       * parameters to their values.
54       *
55       * @return initialization parameters
56       */
57      Map<String, String> getInitParams();
58  
59      /**
60       * Return the application resource mapped to the specified path.
61       *
62       * @param localePath path to the desired resource, including the Locale suffix.
63       * @return the first located resource which matches the given path or null if no such resource exists.
64       */
65      ApplicationResource getResource(String localePath);
66  
67      /**
68       * Return a localized version of an ApplicationResource.
69       *
70       * @param base the ApplicationResource.
71       * @param locale the desired Locale.
72       * @return the first located resource which matches the given path or null if no such resource exists.
73       */
74      ApplicationResource getResource(ApplicationResource base, Locale locale);
75  
76      /**
77       * Return the application resources mapped to the specified path.
78       *
79       * @param path to the desired resource.
80       * @return all resources which match the given path.
81       */
82      Collection<ApplicationResource> getResources(String path);
83  }