Author: thomas.heute(a)jboss.com
Date: 2010-02-11 11:42:31 -0500 (Thu, 11 Feb 2010)
New Revision: 1645
Removed:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigRemoval.java
Log:
Forgot to create JIRA, missed the deleted files (file renaming).
Should avoid impulsive commits...
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java 2010-02-11
16:38:15 UTC (rev 1644)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java 2010-02-11
16:42:31 UTC (rev 1645)
@@ -1,134 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.RootContainer.PortalContainerPostInitTask;
-import org.exoplatform.portal.resource.config.xml.SkinConfigParser;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.gatein.wci.WebAppEvent;
-import org.gatein.wci.WebAppLifeCycleEvent;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.servlet.ServletContext;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public class GateinSkinConfigDeployer extends AbstractResourceHandler
-{
-
- private final SkinService skinService;
-
- private static final String GATEIN_CONFIG_RESOURCE =
"/WEB-INF/gatein-resources.xml";
-
- private static Log LOG = ExoLogger.getExoLogger(GateinSkinConfigDeployer.class);
-
- /**
- * The name of the portal container
- */
- private final String portalContainerName;
-
- public GateinSkinConfigDeployer(String portalContainerName, SkinService _skinService)
- {
- this.skinService = _skinService;
- this.portalContainerName = portalContainerName;
- }
-
- @Override
- public void onEvent(WebAppEvent event)
- {
- if (event instanceof WebAppLifeCycleEvent)
- {
- WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
- if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
- {
- ServletContext scontext = null;
- try
- {
- scontext = event.getWebApp().getServletContext();
- InputStream is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
- if (is == null)
- return;
- try
- {
- is.close();
- }
- catch (Exception ex)
- {
- // ignore me
- }
- final PortalContainerPostInitTask task = new
PortalContainerPostInitTask()
- {
-
- public void execute(ServletContext scontext, PortalContainer
portalContainer)
- {
- register(scontext, portalContainer);
- skinService.registerContext(scontext);
- }
- };
- PortalContainer.addInitTask(scontext, task, portalContainerName);
- }
- catch (Exception ex)
- {
- LOG.error("An error occurs while registering '" +
GATEIN_CONFIG_RESOURCE + "' from the context '"
- + (scontext == null ? "unknown" :
scontext.getServletContextName()) + "'", ex);
- }
- }
- }
- }
-
- private void register(ServletContext scontext, PortalContainer container)
- {
- InputStream is = null;
- try
- {
- is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
- SkinConfigParser.processConfigResource(is, skinService, scontext);
- }
- catch (Exception ex)
- {
- LOG.error("An error occurs while registering '" +
GATEIN_CONFIG_RESOURCE + "' from the context '"
- + (scontext == null ? "unknown" : scontext.getServletContextName())
+ "'", ex);
- }
- finally
- {
- if (is != null)
- {
- try
- {
- is.close();
- }
- catch (IOException e)
- {
- // ignore me
- }
- }
- }
- }
-}
Deleted:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigRemoval.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigRemoval.java 2010-02-11
16:38:15 UTC (rev 1644)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigRemoval.java 2010-02-11
16:42:31 UTC (rev 1645)
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.exoplatform.portal.resource;
-
-import java.util.List;
-import java.util.Set;
-
-import org.gatein.wci.WebAppEvent;
-import org.gatein.wci.WebAppLifeCycleEvent;
-
-/**
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
- * @version $Id$
- *
- */
-public class GateinSkinConfigRemoval extends AbstractResourceHandler
-{
-
- private SkinService service;
-
- private String portalContainerName;
-
- public GateinSkinConfigRemoval(String _portalContainerName, SkinService _service)
- {
- this.portalContainerName = _portalContainerName;
- this.service = _service;
- }
-
- /**
- * @see
org.exoplatform.portal.resource.AbstractResourceHandler#onEvent(org.gatein.wci.WebAppEvent)
- */
- @Override
- public void onEvent(WebAppEvent event)
- {
- // TODO Auto-generated method stub
- if (event instanceof WebAppLifeCycleEvent)
- {
- WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
- if (waEvent.getType() == WebAppLifeCycleEvent.REMOVED)
- {
- String webApp = event.getWebApp().getServletContext().getContextPath();
- removeWebAppSkin(webApp);
- }
- }
- }
-
- private void removeWebAppSkin(String webApp)
- {
- try
- {
- removePortalSkins(webApp);
- removePortletSkins(webApp);
- removeSkinName(webApp);
-
- // Update the 'skinDependentManager'
- SkinDependentManager.clearAssociatedSkins(webApp);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- private void removePortalSkins(String webApp) throws Exception
- {
- List<SkinKey> portalSkins = SkinDependentManager.getPortalSkins(webApp);
- service.remove(portalSkins);
- }
-
- private void removePortletSkins(String webApp) throws Exception
- {
- List<SkinKey> portletSkins = SkinDependentManager.getPortletSkins(webApp);
- service.remove(portletSkins);
- }
-
- /**
- * Remove skinName defined by the webApp, if no other webApps supports the
- * skinName
- */
- private void removeSkinName(String webApp) throws Exception
- {
- Set<String> supportedSkins = SkinDependentManager.getSkinNames(webApp);
- if (supportedSkins != null)
- {
- for (String skin : supportedSkins)
- {
- if (SkinDependentManager.skinNameIsRemovable(skin, webApp))
- {
- service.removeSupportedSkin(skin);
- }
- }
- }
- }
-
-}