Rename {Default=>Standard}PortletEnvironment

Issue: SPR-8348
This commit is contained in:
Chris Beams 2011-05-20 03:57:35 +00:00
parent f893b62a9b
commit c481d2e9fb
7 changed files with 31 additions and 30 deletions

View File

@ -74,7 +74,7 @@ import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.context.support.StaticWebApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.portlet.context.AbstractRefreshablePortletApplicationContext;
import org.springframework.web.portlet.context.DefaultPortletEnvironment;
import org.springframework.web.portlet.context.StandardPortletEnvironment;
import org.springframework.web.portlet.context.StaticPortletApplicationContext;
import org.springframework.web.portlet.context.XmlPortletApplicationContext;
@ -556,7 +556,7 @@ public class EnvironmentIntegrationTests {
public void staticPortletApplicationContext() {
StaticPortletApplicationContext ctx = new StaticPortletApplicationContext();
assertHasDefaultPortletEnvironment(ctx);
assertHasStandardPortletEnvironment(ctx);
registerEnvironmentBeanDefinition(ctx);
@ -633,16 +633,17 @@ public class EnvironmentIntegrationTests {
}
private void assertHasStandardServletEnvironment(WebApplicationContext ctx) {
// ensure a default web environment exists
// ensure a default servlet environment exists
Environment defaultEnv = ctx.getEnvironment();
assertThat(defaultEnv, notNullValue());
assertThat(defaultEnv, instanceOf(StandardServletEnvironment.class));
}
private void assertHasDefaultPortletEnvironment(WebApplicationContext ctx) {
private void assertHasStandardPortletEnvironment(WebApplicationContext ctx) {
// ensure a default portlet environment exists
Environment defaultEnv = ctx.getEnvironment();
assertThat(defaultEnv, notNullValue());
assertThat(defaultEnv, instanceOf(DefaultPortletEnvironment.class));
assertThat(defaultEnv, instanceOf(StandardPortletEnvironment.class));
}
private void assertHasEnvironment(ApplicationContext ctx, Environment expectedEnv) {

View File

@ -39,7 +39,7 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceEditor;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.StringUtils;
import org.springframework.web.portlet.context.DefaultPortletEnvironment;
import org.springframework.web.portlet.context.StandardPortletEnvironment;
import org.springframework.web.portlet.context.PortletContextResourceLoader;
/**
@ -76,7 +76,7 @@ public abstract class GenericPortletBean extends GenericPortlet implements Envir
*/
private final Set<String> requiredProperties = new HashSet<String>();
private Environment environment = new DefaultPortletEnvironment();
private Environment environment = new StandardPortletEnvironment();
/**
@ -167,7 +167,7 @@ public abstract class GenericPortletBean extends GenericPortlet implements Envir
/**
* {@inheritDoc}
* <p>Any environment set here overrides the {@link DefaultPortletEnvironment}
* <p>Any environment set here overrides the {@link StandardPortletEnvironment}
* provided by default.
*/
public void setEnvironment(Environment environment) {

View File

@ -152,11 +152,11 @@ public abstract class AbstractRefreshablePortletApplicationContext extends Abstr
}
/**
* Create and return a new {@link DefaultPortletEnvironment}.
* Create and return a new {@link StandardPortletEnvironment}.
*/
@Override
protected ConfigurableEnvironment createEnvironment() {
return new DefaultPortletEnvironment();
return new StandardPortletEnvironment();
}
/**

View File

@ -200,13 +200,13 @@ public abstract class PortletApplicationContextUtils {
WebApplicationContextUtils.initServletPropertySources(propertySources, servletContext);
if(portletContext != null && propertySources.contains(DefaultPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME)) {
propertySources.replace(DefaultPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME,
new PortletContextPropertySource(DefaultPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME, portletContext));
if(portletContext != null && propertySources.contains(StandardPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME)) {
propertySources.replace(StandardPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME,
new PortletContextPropertySource(StandardPortletEnvironment.PORTLET_CONTEXT_PROPERTY_SOURCE_NAME, portletContext));
}
if(portletConfig != null && propertySources.contains(DefaultPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME)) {
propertySources.replace(DefaultPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME,
new PortletConfigPropertySource(DefaultPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME, portletConfig));
if(portletConfig != null && propertySources.contains(StandardPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME)) {
propertySources.replace(StandardPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME,
new PortletConfigPropertySource(StandardPortletEnvironment.PORTLET_CONFIG_PROPERTY_SOURCE_NAME, portletConfig));
}
}

View File

@ -32,16 +32,16 @@ import org.springframework.web.context.support.StandardServletEnvironment;
* applications. All Portlet-related {@code ApplicationContext} classes initialize an instance
* by default.
*
* <p>Contributes {@code ServletContext}-, {@code PortletContext}-, and {@code PortletConfig}-based
* {@link PropertySource} instances. See the {@link #DefaultPortletEnvironment()} constructor
* for details.
* <p>Contributes {@code ServletContext}-, {@code PortletContext}-, and
* {@code PortletConfig}-based {@link PropertySource} instances. See the
* {@link #customizePropertySources} method for details.
*
* @author Chris Beams
* @since 3.1
* @see StandardEnvironment
* @see StandardServletEnvironment
*/
public class DefaultPortletEnvironment extends StandardEnvironment {
public class StandardPortletEnvironment extends StandardEnvironment {
/** Portlet context init parameters property source name: {@value} */
public static final String PORTLET_CONTEXT_PROPERTY_SOURCE_NAME = "portletContextInitParams";
@ -59,14 +59,14 @@ public class DefaultPortletEnvironment extends StandardEnvironment {
* </ul>
* <p>Properties present in {@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} will
* take precedence over those in {@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME},
* which takes precedence over those in
* {@linkplain StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}.
* <p>Properties in any of the above will take precedence over system properties and environment
* variables contributed by the {@link StandardEnvironment} superclass.
* which takes precedence over those in {@linkplain
* StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}.
* <p>Properties in any of the above will take precedence over system properties and
* environment variables contributed by the {@link StandardEnvironment} superclass.
* <p>The property sources are added as stubs for now, and will be
* {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully initialized}
* once the actual {@link PortletConfig}, {@link PortletContext}, and {@link ServletContext}
* objects are available.
* {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully
* initialized} once the actual {@link PortletConfig}, {@link PortletContext}, and
* {@link ServletContext} objects are available.
* @see StandardEnvironment#customizePropertySources
* @see PortletConfigPropertySource
* @see PortletContextPropertySource

View File

@ -65,11 +65,11 @@ public class StaticPortletApplicationContext extends StaticApplicationContext
/**
* Return a new {@link DefaultPortletEnvironment}
* Return a new {@link StandardPortletEnvironment}
*/
@Override
protected ConfigurableEnvironment createEnvironment() {
return new DefaultPortletEnvironment();
return new StandardPortletEnvironment();
}
/**

View File

@ -45,7 +45,7 @@ import org.springframework.jndi.JndiPropertySource;
* @author Chris Beams
* @since 3.1
* @see StandardEnvironment
* @see DefaultPortletEnvironment
* @see StandardPortletEnvironment
*/
public class StandardServletEnvironment extends StandardEnvironment {