001/*
002 * Copyright 2002-2014 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.web.portlet.context;
018
019import javax.portlet.PortletConfig;
020import javax.portlet.PortletContext;
021
022import org.springframework.context.ConfigurableApplicationContext;
023import org.springframework.web.context.WebApplicationContext;
024
025/**
026 * Interface to be implemented by configurable portlet application contexts.
027 * Supported by {@link org.springframework.web.portlet.FrameworkPortlet}.
028 *
029 * <p>Note: The setters of this interface need to be called before an
030 * invocation of the {@link #refresh} method inherited from
031 * {@link org.springframework.context.ConfigurableApplicationContext}.
032 * They do not cause an initialization of the context on their own.
033 *
034 * @author Juergen Hoeller
035 * @author William G. Thompson, Jr.
036 * @author John A. Lewis
037 * @since 2.0
038 * @see #refresh
039 * @see org.springframework.web.context.ContextLoader#createWebApplicationContext
040 * @see org.springframework.web.portlet.FrameworkPortlet#createPortletApplicationContext
041 * @see org.springframework.web.context.ConfigurableWebApplicationContext
042 */
043public interface ConfigurablePortletApplicationContext
044                extends WebApplicationContext, ConfigurableApplicationContext {
045
046        /**
047         * Prefix for ApplicationContext ids that refer to portlet name.
048         */
049        String APPLICATION_CONTEXT_ID_PREFIX = WebApplicationContext.class.getName() + ":";
050
051        /**
052         * Name of the PortletContext environment bean in the factory.
053         * @see javax.portlet.PortletContext
054         */
055        String PORTLET_CONTEXT_BEAN_NAME = "portletContext";
056
057        /**
058         * Name of the PortletConfig environment bean in the factory.
059         * @see javax.portlet.PortletConfig
060         */
061        String PORTLET_CONFIG_BEAN_NAME = "portletConfig";
062
063
064        /**
065         * Set the PortletContext for this portlet application context.
066         * <p>Does not cause an initialization of the context: refresh needs to be
067         * called after the setting of all configuration properties.
068         * @see #refresh()
069         */
070        void setPortletContext(PortletContext portletContext);
071
072        /**
073         * Return the standard Portlet API PortletContext for this application.
074         */
075        PortletContext getPortletContext();
076
077        /**
078         * Set the PortletConfig for this portlet application context.
079         * @see #refresh()
080         */
081        void setPortletConfig(PortletConfig portletConfig);
082
083        /**
084         * Return the PortletConfig for this portlet application context, if any.
085         */
086        PortletConfig getPortletConfig();
087
088        /**
089         * Set the namespace for this portlet application context,
090         * to be used for building a default context config location.
091         */
092        void setNamespace(String namespace);
093
094        /**
095         * Return the namespace for this web application context, if any.
096         */
097        String getNamespace();
098
099        /**
100         * Set the config locations for this portlet application context in init-param style,
101         * i.e. with distinct locations separated by commas, semicolons or whitespace.
102         * <p>If not set, the implementation is supposed to use a default for the
103         * given namespace.
104         */
105        void setConfigLocation(String configLocation);
106
107        /**
108         * Set the config locations for this portlet application context.
109         * <p>If not set, the implementation is supposed to use a default for the
110         * given namespace.
111         */
112        void setConfigLocations(String... configLocations);
113
114        /**
115         * Return the config locations for this web application context,
116         * or {@code null} if none specified.
117         */
118        String[] getConfigLocations();
119
120}