1 /*
2 * $Id: ApplicationAccess.java 1291847 2012-02-21 15:09:30Z 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
24 /**
25 * Entry point to get information about the application.
26 *
27 * @version $Rev: 1064782 $ $Date: 2011-01-28 18:08:52 +0100 (Fri, 28 Jan 2011) $
28 */
29 public final class ApplicationAccess {
30
31 /**
32 * The attribute name that will be used to store the application context itself.
33 */
34 public static final String APPLICATION_CONTEXT_ATTRIBUTE =
35 ApplicationContext.class.getName() + ".ATTRIBUTE";
36
37 /**
38 * Constructor.
39 */
40 private ApplicationAccess() {
41 }
42
43 /**
44 * Registers an application context. It will be registered into itself as an
45 * attribute, using the {@link #APPLICATION_CONTEXT_ATTRIBUTE} name.
46 *
47 * @param applicationContext The application context to register.
48 */
49 public static void register(ApplicationContext applicationContext) {
50 applicationContext.getApplicationScope().put(
51 APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);
52 }
53
54 }