diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-09-03 14:03:46 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-09-03 14:05:32 +0300 |
commit | ae2c302f71554f49b3f57b649cec7450c652cf09 (patch) | |
tree | 07fb650350c169a3c23cfaaf59d3efc47d2e6786 | |
parent | 6f276f4451cb185919084181b54fb84532a1d984 (diff) | |
download | vaadin-framework-ae2c302f71554f49b3f57b649cec7450c652cf09.tar.gz vaadin-framework-ae2c302f71554f49b3f57b649cec7450c652cf09.zip |
Combine ApplicationPortlet and AAP and rename to VaadinPortlet (#9460)
-rw-r--r-- | WebContent/WEB-INF/portlet.xml | 4 | ||||
-rw-r--r-- | server/src/com/vaadin/server/ApplicationPortlet2.java | 50 | ||||
-rw-r--r-- | server/src/com/vaadin/server/PortletApplicationContext2.java | 2 | ||||
-rw-r--r-- | server/src/com/vaadin/server/PortletCommunicationManager.java | 17 | ||||
-rw-r--r-- | server/src/com/vaadin/server/VaadinPortlet.java (renamed from server/src/com/vaadin/server/AbstractApplicationPortlet.java) | 22 | ||||
-rw-r--r-- | server/src/com/vaadin/server/WrappedPortletRequest.java | 2 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java | 3 |
7 files changed, 25 insertions, 75 deletions
diff --git a/WebContent/WEB-INF/portlet.xml b/WebContent/WEB-INF/portlet.xml index f695551cf2..5faafc5c36 100644 --- a/WebContent/WEB-INF/portlet.xml +++ b/WebContent/WEB-INF/portlet.xml @@ -6,7 +6,7 @@ <portlet> <portlet-name>JSR286TestPortlet</portlet-name> <display-name>Vaadin Portlet 2.0 Test</display-name> - <portlet-class>com.vaadin.server.ApplicationPortlet2</portlet-class> + <portlet-class>com.vaadin.server.VaadinPortlet</portlet-class> <init-param> <name>application</name> <value>com.vaadin.tests.integration.JSR286PortletApplication</value> @@ -44,7 +44,7 @@ <portlet-name>Vaadin Liferay Theme Portlet</portlet-name> <display-name>Vaadin Liferay Theme</display-name> - <portlet-class>com.vaadin.server.ApplicationPortlet2</portlet-class> + <portlet-class>com.vaadin.server.VaadinPortlet</portlet-class> <init-param> <name>application</name> <value>com.vaadin.tests.integration.LiferayThemeDemo</value> diff --git a/server/src/com/vaadin/server/ApplicationPortlet2.java b/server/src/com/vaadin/server/ApplicationPortlet2.java deleted file mode 100644 index 3708d8fe0d..0000000000 --- a/server/src/com/vaadin/server/ApplicationPortlet2.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2011 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.server; - -import javax.portlet.PortletConfig; -import javax.portlet.PortletException; - -import com.vaadin.Application; -import com.vaadin.server.ServletPortletHelper.ApplicationClassException; - -/** - * TODO Write documentation, fix JavaDoc tags. - * - * @author peholmst - */ -public class ApplicationPortlet2 extends AbstractApplicationPortlet { - - private Class<? extends Application> applicationClass; - - @Override - public void init(PortletConfig config) throws PortletException { - super.init(config); - try { - applicationClass = ServletPortletHelper - .getApplicationClass(getDeploymentConfiguration()); - } catch (ApplicationClassException e) { - throw new PortletException(e); - } - } - - @Override - protected Class<? extends Application> getApplicationClass() { - return applicationClass; - } - -} diff --git a/server/src/com/vaadin/server/PortletApplicationContext2.java b/server/src/com/vaadin/server/PortletApplicationContext2.java index 366c5b160d..cea97bc939 100644 --- a/server/src/com/vaadin/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/server/PortletApplicationContext2.java @@ -254,7 +254,7 @@ public class PortletApplicationContext2 extends ApplicationContext { } /** - * This is for use by {@link AbstractApplicationPortlet} only. + * This is for use by {@link VaadinPortlet} only. * * TODO cleaner implementation, now "semi-static"! * diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index 697095d691..cb3a8eab80 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -97,8 +97,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { ResourceURL portletResourceUrl = getRenderResponse(context) .createResourceURL(); - portletResourceUrl - .setResourceID(AbstractApplicationPortlet.RESOURCE_URL_ID); + portletResourceUrl.setResourceID(VaadinPortlet.RESOURCE_URL_ID); defaults.put(ApplicationConstants.PORTLET_RESOUCE_URL_BASE, portletResourceUrl.toString()); @@ -113,10 +112,9 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { throws JSONException, IOException { // fixed base theme to use - all portal pages with Vaadin // applications will load this exactly once - String portalTheme = WrappedPortletRequest - .cast(context.getRequest()) - .getPortalProperty( - AbstractApplicationPortlet.PORTAL_PARAMETER_VAADIN_THEME); + String portalTheme = WrappedPortletRequest.cast( + context.getRequest()).getPortalProperty( + VaadinPortlet.PORTAL_PARAMETER_VAADIN_THEME); if (portalTheme != null && !portalTheme.equals(context.getThemeName())) { String portalThemeUri = getThemeUri(context, portalTheme); @@ -133,8 +131,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { DeploymentConfiguration deploymentConfiguration = context .getRequest().getDeploymentConfiguration(); return deploymentConfiguration.getApplicationOrSystemProperty( - AbstractApplicationPortlet.PORTLET_PARAMETER_STYLE, - null); + VaadinPortlet.PORTLET_PARAMETER_STYLE, null); } @Override @@ -164,8 +161,8 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { PortletContext portletContext = context.getPortletSession() .getPortletContext(); return portletContext.getResourceAsStream("/" - + AbstractApplicationPortlet.THEME_DIRECTORY_PATH + themeName - + "/" + resource); + + VaadinPortlet.THEME_DIRECTORY_PATH + themeName + "/" + + resource); } } diff --git a/server/src/com/vaadin/server/AbstractApplicationPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 7fc69b05f7..25512e9237 100644 --- a/server/src/com/vaadin/server/AbstractApplicationPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -55,6 +55,7 @@ import com.liferay.portal.kernel.util.PropsUtil; import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.server.AbstractCommunicationManager.Callback; +import com.vaadin.server.ServletPortletHelper.ApplicationClassException; import com.vaadin.ui.UI; /** @@ -65,8 +66,8 @@ import com.vaadin.ui.UI; * * @author peholmst */ -public abstract class AbstractApplicationPortlet extends GenericPortlet - implements Constants { +public class VaadinPortlet extends GenericPortlet implements + Constants { public static final String RESOURCE_URL_ID = "APP"; @@ -174,10 +175,10 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet public static class AbstractApplicationPortletWrapper implements Callback { - private final AbstractApplicationPortlet portlet; + private final VaadinPortlet portlet; public AbstractApplicationPortletWrapper( - AbstractApplicationPortlet portlet) { + VaadinPortlet portlet) { this.portlet = portlet; } @@ -322,7 +323,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet @Override public SystemMessages getSystemMessages() { - return AbstractApplicationPortlet.this.getSystemMessages(); + return VaadinPortlet.this.getSystemMessages(); } }; @@ -892,8 +893,11 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet return null; } - protected abstract Class<? extends Application> getApplicationClass() - throws ClassNotFoundException; + protected Class<? extends Application> getApplicationClass() + throws ApplicationClassException { + return ServletPortletHelper + .getApplicationClass(getDeploymentConfiguration()); + } protected Application getNewApplication(PortletRequest request) throws PortletException { @@ -904,7 +908,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet throw new PortletException("getNewApplication failed", e); } catch (final InstantiationException e) { throw new PortletException("getNewApplication failed", e); - } catch (final ClassNotFoundException e) { + } catch (final ApplicationClassException e) { throw new PortletException("getNewApplication failed", e); } } @@ -1035,7 +1039,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet } private static final Logger getLogger() { - return Logger.getLogger(AbstractApplicationPortlet.class.getName()); + return Logger.getLogger(VaadinPortlet.class.getName()); } } diff --git a/server/src/com/vaadin/server/WrappedPortletRequest.java b/server/src/com/vaadin/server/WrappedPortletRequest.java index 40a5c5f509..47a8e2c358 100644 --- a/server/src/com/vaadin/server/WrappedPortletRequest.java +++ b/server/src/com/vaadin/server/WrappedPortletRequest.java @@ -101,7 +101,7 @@ public class WrappedPortletRequest implements WrappedRequest { if (request instanceof ResourceRequest) { ResourceRequest resourceRequest = (ResourceRequest) request; String resourceID = resourceRequest.getResourceID(); - if (AbstractApplicationPortlet.RESOURCE_URL_ID.equals(resourceID)) { + if (VaadinPortlet.RESOURCE_URL_ID.equals(resourceID)) { String resourcePath = resourceRequest .getParameter(ApplicationConstants.V_RESOURCE_PATH); return resourcePath; diff --git a/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java b/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java index e98be99cbc..0d3dea28ac 100644 --- a/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java +++ b/server/tests/src/com/vaadin/tests/server/TestClassesSerializable.java @@ -40,8 +40,7 @@ public class TestClassesSerializable extends TestCase { "com\\.vaadin\\.event\\.FieldEvents", // "com\\.vaadin\\.event\\.LayoutEvents", // "com\\.vaadin\\.event\\.MouseEvents", // - "com\\.vaadin\\.server\\.AbstractApplicationPortlet", // - "com\\.vaadin\\.server\\.ApplicationPortlet2", // + "com\\.vaadin\\.server\\.VaadinPortlet", // "com\\.vaadin\\.server\\.Constants", // "com\\.vaadin\\.util\\.SerializerHelper", // fully static // class level filtering, also affecting nested classes and |