From jetspeed-dev-return-24594-apmail-portals-jetspeed-dev-archive=portals.apache.org@portals.apache.org Fri Nov 25 02:26:43 2005 Return-Path: Delivered-To: apmail-portals-jetspeed-dev-archive@www.apache.org Received: (qmail 99705 invoked from network); 25 Nov 2005 02:26:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Nov 2005 02:26:42 -0000 Received: (qmail 69594 invoked by uid 500); 25 Nov 2005 02:26:41 -0000 Delivered-To: apmail-portals-jetspeed-dev-archive@portals.apache.org Received: (qmail 69199 invoked by uid 500); 25 Nov 2005 02:26:39 -0000 Mailing-List: contact jetspeed-dev-help@portals.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jetspeed Developers List" Delivered-To: mailing list jetspeed-dev@portals.apache.org Received: (qmail 69185 invoked by uid 99); 25 Nov 2005 02:26:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2005 18:26:39 -0800 X-ASF-Spam-Status: No, hits=-9.2 required=10.0 tests=ALL_TRUSTED,MAILTO_TO_SPAM_ADDR,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 24 Nov 2005 18:27:59 -0800 Received: (qmail 99457 invoked by uid 65534); 25 Nov 2005 02:26:06 -0000 Message-ID: <20051125022606.99456.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r348854 [2/16] - in /portals/jetspeed-2/trunk/applications/j2-admin: ./ src/java/org/apache/jetspeed/portlets/entityeditor/ src/java/org/apache/jetspeed/portlets/localeselector/ src/java/org/apache/jetspeed/portlets/localeselector/resources... Date: Fri, 25 Nov 2005 02:25:20 -0000 To: jetspeed-dev@portals.apache.org From: taylor@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_it.properties URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_it.properties?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_it.properties (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_it.properties Thu Nov 24 18:24:19 2005 @@ -0,0 +1,42 @@ +# Copyright 2004 The Apache Software Foundation +# +# 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. +# +# Please contact me if you have any questions or suggestion : desmax74@yahoo.it +# +# Italian version by Dessì Massimiliano desmax74@yahoo.it. +# Vers 0.1 jetspeed 2.0 10/08/2004 +# +# $Id: LocaleSelectorResources_it.properties 348264 2005-11-22 22:06:45Z taylor $ +# + +# Label +localeselector.label.language=Lingua: +localeselector.label.change=cambia + +# Locale Name +localeselector.locale.hu=Hungarian +localeselector.locale.de=Tedesco +localeselector.locale.en=Inglese +localeselector.locale.es=Spagnolo +localeselector.locale.fr=Francese +localeselector.locale.it=Italiano +localeselector.locale.ja=Giapponese +localeselector.locale.ko=Coreano +localeselector.locale.nl=Olandese +localeselector.locale.sv=Svedese +localeselector.locale.zh=Cinese semplificato +localeselector.locale.zh_TW=Cinese tradizionale +localeselector.locale.ru=Russo +localeselector.locale.pt=Portoghese + Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ja.properties URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ja.properties?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ja.properties (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ja.properties Thu Nov 24 18:24:19 2005 @@ -0,0 +1,43 @@ +# Copyright 2004 The Apache Software Foundation +# +# 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. +# +# $Id: LocaleSelectorResources_ja.properties 348264 2005-11-22 22:06:45Z taylor $ +# +# LOCALIZATION MAINTAINER: +# Shinsuke Sugaya + +# portlet info +javax.portlet.title=\u8A00\u8A9E\u9078\u629E +javax.portlet.short-title=\u597D\u307F\u306E\u8A00\u8A9E\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306E\u30DD\u30FC\u30C8\u30EC\u30C3\u30C8\u3067\u3059\u3002 +javax.portlet.keywords=\u30ED\u30B1\u30FC\u30EB,\u8A00\u8A9E + +# Label +localeselector.label.language=\u8A00\u8A9E: +localeselector.label.change=\u5909\u66F4 + +# Locale Name +localeselector.locale.hu=Hungarian +localeselector.locale.de=\u30C9\u30A4\u30C4\u8A9E +localeselector.locale.en=\u82F1\u8A9E +localeselector.locale.es=\u30B9\u30DA\u30A4\u30F3\u8A9E +localeselector.locale.fr=\u30D5\u30E9\u30F3\u30B9\u8A9E +localeselector.locale.it=\u30A4\u30BF\u30EA\u30A2\u8A9E +localeselector.locale.ja=\u65E5\u672C\u8A9E +localeselector.locale.ko=\u97D3\u56FD\u8A9E +localeselector.locale.nl=\u30AA\u30E9\u30F3\u30C0\u8A9E +localeselector.locale.sv=\u30B9\u30A6\u30A7\u30FC\u30C7\u30F3\u8A9E +localeselector.locale.zh=\u7C21\u4F53\u5B57\u4E2D\u56FD\u8A9E +localeselector.locale.zh_TW=\u7E41\u4F53\u5B57\u4E2D\u56FD\u8A9E +localeselector.locale.ru=\u82F1\u8A9E +localeselector.locale.pt=\u30dd\u30eb\u30c8\u30ac\u30eb\u8a9e Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ko.properties URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ko.properties?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ko.properties (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ko.properties Thu Nov 24 18:24:19 2005 @@ -0,0 +1,46 @@ +# Copyright 2004 The Apache Software Foundation +# +# 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. +# +# $Id: LocaleSelectorResources_en.properties,v 1.2 2005/01/10 16:22:37 weaver Exp $ +# +# LOCALIZATION MAINTAINER: +# Jetspeed Development Team + +# portlet info +javax.portlet.title=Locale Selector +javax.portlet.short-title=This is a portlet to select your preferred locale +javax.portlet.keywords=Locale,Language + +# Label +localeselector.label.language=Language: +localeselector.label.change=Change + +# Locale Name + +localeselector.locale.de=German +localeselector.locale.en=English +localeselector.locale.es=Spanish +localeselector.locale.fr=French +localeselector.locale.hu=Hungarian +localeselector.locale.it=Italian +localeselector.locale.ja=Japanese +localeselector.locale.ko=Korean +localeselector.locale.nl=Dutch +localeselector.locale.pt=Portuguese +localeselector.locale.ru=Russian +localeselector.locale.sv=Swedish +localeselector.locale.zh=Simplified Chinese +localeselector.locale.zh_TW=Traditional Chinese + + Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_nl.properties URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_nl.properties?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_nl.properties (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_nl.properties Thu Nov 24 18:24:19 2005 @@ -0,0 +1,37 @@ +# Copyright 2004 The Apache Software Foundation +# +# 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. +# +# $Id: LocaleSelectorResources_nl.properties 348264 2005-11-22 22:06:45Z taylor $ +# + +# Label +localeselector.label.language=Taal: +localeselector.label.change=Wijzigen + +# Locale Name +localeselector.locale.hu=Hungarian +localeselector.locale.de=Duits +localeselector.locale.en=Engels +localeselector.locale.es=Spaans +localeselector.locale.fr=Frans +localeselector.locale.it=Italiaans +localeselector.locale.ja=Japans +localeselector.locale.ko=Koreaans +localeselector.locale.nl=Nederlands +localeselector.locale.sv=Zweeds +localeselector.locale.zh=Vereenvoudigd Chinees +localeselector.locale.zh_TW=Traditioneel Chinees +localeselector.locale.ru=Russisch +localeselector.locale.pt=Portugees + Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_pt.properties URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_pt.properties?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_pt.properties (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_pt.properties Thu Nov 24 18:24:19 2005 @@ -0,0 +1,45 @@ +# Copyright 2004 The Apache Software Foundation +# +# 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. +# +# $Id: LocaleSelectorResources_pt.properties 348264 2005-11-22 22:06:45Z taylor $ +# +# LOCALIZATION MAINTAINER: +# Jetspeed Development Team + +# portlet info +javax.portlet.title=Seletor De Locale +javax.portlet.short-title=Este \u00e9 um portlet para selecionar seu locale preferido +javax.portlet.keywords=Locale, L\u00edngua + +# Label +localeselector.label.language=L\u00edngua: +localeselector.label.change=Mudan\u00e7a + +# Locale Name +localeselector.locale.hu=Hungarian +localeselector.locale.de=Alem\u00e3o +localeselector.locale.en=Ingl\u00eas +localeselector.locale.es=Espanhol +localeselector.locale.fr=Franc\u00eas +localeselector.locale.it=Italiano +localeselector.locale.ja=Japon\u00eas +localeselector.locale.ko=Korean +localeselector.locale.nl=Holand\u00eas +localeselector.locale.sv=Sueco +localeselector.locale.zh=Chin\u00eas Simplificado +localeselector.locale.zh_TW=Chin\u00eas Tradicional +localeselector.locale.ru=Russian +localeselector.locale.pt=Portuguese + + Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh.properties URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh.properties?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh.properties (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh.properties Thu Nov 24 18:24:19 2005 @@ -0,0 +1,44 @@ +# Copyright 2004 The Apache Software Foundation +# +# 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. +# +# $Id: LocaleSelectorResources_zh.properties 348264 2005-11-22 22:06:45Z taylor $ +# +# LOCALIZATION MAINTAINER: +# Yi Shen + +# portlet info +javax.portlet.title=\u9009\u62e9\u60a8\u7684\u8bed\u8a00 +javax.portlet.short-title=\u9009\u62e9\u60a8\u7684\u9ed8\u8ba4\u8bed\u8a00 +javax.portlet.keywords=\u533a\u57df\u8bed\u8a00,\u8bed\u8a00 + +# Label +localeselector.label.language=\u8bed\u8a00: +localeselector.label.change=\u66f4\u6539 + +# Locale Name +localeselector.locale.hu=Hungarian +localeselector.locale.de=\u5fb7\u8bed +localeselector.locale.en=\u82f1\u8bed +localeselector.locale.es=\u897f\u73ed\u7259\u8bed +localeselector.locale.fr=\u6cd5\u8bed +localeselector.locale.it=\u610f\u5927\u5229\u8bed +localeselector.locale.ja=\u65e5\u8bed +localeselector.locale.ko=\u97e9\u56fd\u8bed +localeselector.locale.nl=\u8377\u5170\u8bed +localeselector.locale.sv=\u745e\u5178\u8bed +localeselector.locale.zh=\u7b80\u4f53\u4e2d\u6587 +localeselector.locale.zh_TW=\u7e41\u4f53\u4e2d\u6587 +localeselector.locale.ru=\u4fc4\u8bed +localeselector.locale.pt=\u8461\u8404\u7259\u8bed + Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh_TW.properties URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh_TW.properties?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh_TW.properties (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh_TW.properties Thu Nov 24 18:24:19 2005 @@ -0,0 +1,45 @@ +# Copyright 2004 The Apache Software Foundation +# +# 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. +# +# $Id: LocaleSelectorResources_en.properties,v 1.2 2005/01/10 16:22:37 weaver Exp $ +# +# LOCALIZATION MAINTAINER: +# Jetspeed Development Team + +# portlet info +javax.portlet.title=?????? +javax.portlet.short-title=This is a portlet to select your preferred locale +javax.portlet.keywords=Locale,Language + +# Label +localeselector.label.language=Language: +localeselector.label.change=Change + +# Locale Name +localeselector.locale.de=German +localeselector.locale.en=English +localeselector.locale.es=Spanish +localeselector.locale.fr=French +localeselector.locale.hu=Hungarian +localeselector.locale.it=Italian +localeselector.locale.ja=Japanese +localeselector.locale.ko=Korean +localeselector.locale.nl=Dutch +localeselector.locale.pt=Portuguese +localeselector.locale.ru=Russian +localeselector.locale.sv=Swedish +localeselector.locale.zh=Simplified Chinese +localeselector.locale.zh_TW=Traditional Chinese + + Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationLifecycleManager.java Thu Nov 24 18:24:19 2005 @@ -0,0 +1,283 @@ +/* Copyright 2004 Apache Software Foundation +* +* 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 org.apache.jetspeed.portlets.palm; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; +import javax.portlet.PortletConfig; +import javax.portlet.PortletContext; +import javax.portlet.PortletException; +import javax.portlet.PortletMode; +import javax.portlet.PortletRequest; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.apache.jetspeed.CommonPortletServices; +import org.apache.jetspeed.components.portletregistry.PortletRegistry; +import org.apache.jetspeed.components.portletregistry.RegistryException; +import org.apache.jetspeed.deployment.DeploymentManager; +import org.apache.jetspeed.factory.PortletFactory; +import org.apache.jetspeed.om.common.portlet.MutablePortletApplication; +import org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager; +import org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManagerResult; +import org.apache.portals.bridges.common.GenericServletPortlet; +import org.apache.portals.gems.util.StatusMessage; +import org.apache.portals.messaging.PortletMessaging; + +/** + * PALM Portlet + * + * @author Ate Douma + * @version $Id: PortletApplicationLifecycleManager.java 348264 2005-11-22 22:06:45Z taylor $ + */ +public class PortletApplicationLifecycleManager extends GenericServletPortlet +{ + private ApplicationServerManager asm; + private PortletRegistry registry; + private PortletFactory portletFactory; + private DeploymentManager dm; + private boolean serverManagerAvailable; + + public void init(PortletConfig config) + throws PortletException + { + super.init(config); + PortletContext context = getPortletContext(); + registry = (PortletRegistry)context.getAttribute(CommonPortletServices.CPS_REGISTRY_COMPONENT); + portletFactory = (PortletFactory)context.getAttribute(CommonPortletServices.CPS_PORTLET_FACTORY_COMPONENT); + dm = (DeploymentManager)context.getAttribute(CommonPortletServices.CPS_DEPLOYMENT_MANAGER_COMPONENT); + asm = (ApplicationServerManager)context.getAttribute(CommonPortletServices.CPS_APPLICATION_SERVER_MANAGER_COMPONENT); + if (null == registry) + { + throw new PortletException("Failed to find the Portlet Registry on portlet initialization"); + } + if (null == portletFactory) + { + throw new PortletException("Failed to find the Portlet Factory on portlet initialization"); + } + serverManagerAvailable = (asm != null && asm.isConnected()); + } + + public void doView(RenderRequest request, RenderResponse response) + throws PortletException, IOException + { + request.setAttribute("serverManagerAvailable",serverManagerAvailable?Boolean.TRUE:Boolean.FALSE); + + StatusMessage msg = (StatusMessage)PortletMessaging.consume(request, "PALM", "status"); + if (msg != null) + { + request.setAttribute("statusMsg", msg); + } + if ( request.getPortletSession().getAttribute("list") == null ) + { + List list = new ArrayList(); + Iterator apps = registry.getPortletApplications().iterator(); + while (apps.hasNext()) + { + MutablePortletApplication pa = (MutablePortletApplication)apps.next(); + PortletApplicationStatusBean bean = new PortletApplicationStatusBean(pa, portletFactory.isPortletApplicationRegistered(pa)); + list.add(bean); + } + request.getPortletSession().setAttribute("list",list); + } + + super.doView(request, response); + } + + public void processAction(ActionRequest request, ActionResponse response) + throws PortletException, IOException + { + if (request.getPortletMode() == PortletMode.VIEW) + { + String action = request.getParameter("action"); + String value = request.getParameter("value"); + + if ( !isEmpty(action)) + { + // enforce list is rebuild next doView + request.getPortletSession().removeAttribute("list"); + + if (!action.equals("refresh") && !isEmpty(value)) + { + MutablePortletApplication pa = registry.getPortletApplication(value); + if ( pa == null ) + { + publishStatusMessage(request, "PALM", "status", null, "Portlet Application "+pa.getName()+" no longer exists"); + } + else if ( pa.getApplicationType() == MutablePortletApplication.LOCAL ) + { + // TODO + } + else // ( pa.getApplicationType() == MutablePortletApplication.WEBAPP ) + { + if (action.equals("start")) + { + startPA(request,pa); + } + else if (action.equals("stop")) + { + stopPA(request,pa); + } + else if (action.equals("undeploy")) + { + undeployPA(request,pa); + } + else if (action.equals("delete")) + { + deletePA(request,pa); + } + } + } + } + } + } + + protected void publishStatusMessage(PortletRequest request, String portlet, String topic, Throwable e, String message) + { + if ( e != null ) + { + message = message + ": " + e.toString(); + Throwable cause = e.getCause(); + if (cause != null) + { + message = message + ", " + cause.getMessage(); + } + } + StatusMessage sm = new StatusMessage(message, StatusMessage.ERROR); + try + { + // TODO: fixme, bug in Pluto on portlet session + PortletMessaging.publish(request, portlet, topic, sm); + } + catch (Exception ee) + { + System.err.println("Failed to publish message: " + message); + } + } + + protected void startPA(ActionRequest request, MutablePortletApplication pa) + { + if ( portletFactory.isPortletApplicationRegistered(pa)) + { + publishStatusMessage(request, "PALM", "status", null, "Portlet Application "+pa.getName()+" already running"); + } + else if ( !serverManagerAvailable || !asm.isConnected() ) + { + publishStatusMessage(request, "PALM", "status", null, "Application Server Manager not available"); + } + else + { + try + { + ApplicationServerManagerResult result = asm.start(pa.getWebApplicationDefinition().getContextRoot()); + if ( !result.isOk() ) + { + publishStatusMessage(request, "PALM", "status", null, result.getMessage()); + } + } + catch (Exception e) + { + e.printStackTrace(); + publishStatusMessage(request, "PAM", "status", e, "Could not start Portlet Application "+pa.getName()); + } + } + } + + protected void stopPA(ActionRequest request, MutablePortletApplication pa) + { + if ( !portletFactory.isPortletApplicationRegistered(pa)) + { + publishStatusMessage(request, "PALM", "status", null, "Portlet Application "+pa.getName()+" no longer running"); + } + else if ( !serverManagerAvailable || !asm.isConnected() ) + { + publishStatusMessage(request, "PALM", "status", null, "Application Server Manager not available"); + } + else + { + try + { + ApplicationServerManagerResult result = asm.stop(pa.getWebApplicationDefinition().getContextRoot()); + if ( !result.isOk() ) + { + publishStatusMessage(request, "PALM", "status", null, result.getMessage()); + } + } + catch (Exception e) + { + e.printStackTrace(); + publishStatusMessage(request, "PALM", "status", e, "Could not stop Portlet Application "+pa.getName()); + } + } + } + + protected void undeployPA(ActionRequest request, MutablePortletApplication pa) + { + if ( !serverManagerAvailable || !asm.isConnected() ) + { + publishStatusMessage(request, "PALM", "status", null, "Application Server Manager not available"); + } + else + { + try + { + ApplicationServerManagerResult result = asm.undeploy(pa.getWebApplicationDefinition().getContextRoot()); + if ( !result.isOk() ) + { + publishStatusMessage(request, "PALM", "status", null, result.getMessage()); + } + } + catch (Exception e) + { + e.printStackTrace(); + publishStatusMessage(request, "PALM", "status", e, "Could not undeploy Portlet Application "+pa.getName()); + } + } + } + + protected void deletePA(ActionRequest request, MutablePortletApplication pa) + { + if ( portletFactory.isPortletApplicationRegistered(pa)) + { + publishStatusMessage(request, "PALM", "status", null, "Portlet Application "+pa.getName()+" is still running"); + } + else + { + try + { + registry.removeApplication(pa); + } + catch (RegistryException e) + { + e.printStackTrace(); + publishStatusMessage(request, "PALM", "status", e, "Could not delete Portlet Application "+pa.getName()); + } + } + } + + private boolean isEmpty(String s) + { + if (s == null) return true; + + if (s.trim().equals("")) return true; + + return false; + } +} Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationStatusBean.java URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationStatusBean.java?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationStatusBean.java (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/palm/PortletApplicationStatusBean.java Thu Nov 24 18:24:19 2005 @@ -0,0 +1,71 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * 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 org.apache.jetspeed.portlets.palm; + +import java.io.Serializable; + +import org.apache.jetspeed.om.common.portlet.MutablePortletApplication; + +/** + * PortletApplicationStatusBean + * + * @author Ate Douma + * @version $Id: PortletApplicationStatusBean.java 348264 2005-11-22 22:06:45Z taylor $ + */ +public class PortletApplicationStatusBean implements Serializable +{ + private String name; + private String path; + private String version; + private boolean local; + private boolean running; + + public PortletApplicationStatusBean(MutablePortletApplication pa, boolean running) + { + this.name = pa.getName(); + this.version = pa.getVersion(); + this.local = pa.getApplicationType() == MutablePortletApplication.LOCAL; + if (local) + { + this.path = ""; + } + else + { + this.path = pa.getWebApplicationDefinition().getContextRoot(); + } + this.running = running; + } + public String getPath() + { + return path; + } + public boolean isLocal() + { + return local; + } + public String getName() + { + return name; + } + public boolean isRunning() + { + return running; + } + public String getVersion() + { + return version; + } +} Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java Thu Nov 24 18:24:19 2005 @@ -0,0 +1,152 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * 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 org.apache.jetspeed.portlets.pam; + +import java.util.Collection; + +import org.apache.jetspeed.om.common.GenericMetadata; +import org.apache.jetspeed.om.common.portlet.PortletApplication; +import org.apache.pluto.om.common.ObjectID; +import org.apache.pluto.om.portlet.PortletDefinition; +import org.apache.pluto.om.portlet.PortletDefinitionList; +import org.apache.pluto.om.servlet.WebApplicationDefinition; + +/** + * This portlet is a browser over all the portlet applications in the system. + * + * @author Jeremy Ford + * @author David Sean Taylor + * @version $Id: PortletApplicationBean.java 348264 2005-11-22 22:06:45Z taylor $ + */ +public class PortletApplicationBean implements PortletApplication +{ + PortletApplication pa; + + + public PortletApplicationBean(PortletApplication pa) + { + this.pa = pa; + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getMetadata() + */ + public GenericMetadata getMetadata() + { + return pa.getMetadata(); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getName() + */ + public String getName() + { + return pa.getName(); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getPortletDefinitions() + */ + public Collection getPortletDefinitions() + { + return pa.getPortletDefinitions(); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getPortletDefinitionByName(java.lang.String) + */ + public PortletDefinition getPortletDefinitionByName(String name) + { + return pa.getPortletDefinitionByName(name); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getUserAttributeRefs() + */ + public Collection getUserAttributeRefs() + { + return pa.getUserAttributeRefs(); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getUserAttributes() + */ + public Collection getUserAttributes() + { + return pa.getUserAttributes(); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getApplicationIdentifier() + */ + public String getApplicationIdentifier() + { + return pa.getApplicationIdentifier(); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getDescription() + */ + public String getDescription() + { + return pa.getDescription(); + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.om.common.portlet.PortletApplication#getApplicationType() + */ + public int getApplicationType() + { + return pa.getApplicationType(); + } + + /* (non-Javadoc) + * @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getId() + */ + public ObjectID getId() + { + return pa.getId(); + } + + /* (non-Javadoc) + * @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getVersion() + */ + public String getVersion() + { + return pa.getVersion(); + } + + /* (non-Javadoc) + * @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getPortletDefinitionList() + */ + public PortletDefinitionList getPortletDefinitionList() + { + return pa.getPortletDefinitionList(); + } + + /* (non-Javadoc) + * @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getWebApplicationDefinition() + */ + public WebApplicationDefinition getWebApplicationDefinition() + { + return pa.getWebApplicationDefinition(); + } + + public Collection getJetspeedServices() + { + return pa.getJetspeedServices(); + } +} Added: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java?rev=348854&view=auto ============================================================================== --- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java (added) +++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java Thu Nov 24 18:24:19 2005 @@ -0,0 +1,222 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * 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 org.apache.jetspeed.portlets.pam; + +import java.io.IOException; +import java.util.Collection; +import java.util.Iterator; +import java.util.Locale; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; + +import javax.portlet.PortletConfig; +import javax.portlet.PortletContext; +import javax.portlet.PortletException; +import javax.portlet.PortletSession; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.apache.jetspeed.CommonPortletServices; +import org.apache.jetspeed.components.portletregistry.PortletRegistry; +import org.apache.jetspeed.om.common.portlet.MutablePortletApplication; +import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite; +import org.apache.jetspeed.search.SearchEngine; +import org.apache.jetspeed.search.SearchResults; +import org.apache.pluto.om.portlet.PortletDefinition; +import org.apache.portals.bridges.beans.TabBean; +import org.apache.portals.bridges.common.GenericServletPortlet; +import org.apache.webapp.admin.TreeControl; +import org.apache.webapp.admin.TreeControlNode; + +//import org.apache.jetspeed.cps.util.Streams; + +/** + * This portlet is a browser over all the portlet applications in the system. + * + * @author Jeremy Ford + * @author David Sean Taylor + * @version $Id: PortletApplicationBrowser.java 348264 2005-11-22 22:06:45Z taylor $ + */ +public class PortletApplicationBrowser extends GenericServletPortlet +{ + private String template; + private PortletContext context; + private PortletRegistry registry; + private SearchEngine searchEngine; + + public void init(PortletConfig config) + throws PortletException + { + super.init(config); + context = getPortletContext(); + registry = (PortletRegistry)context.getAttribute(CommonPortletServices.CPS_REGISTRY_COMPONENT); + if (null == registry) + { + throw new PortletException("Failed to find the Portlet Registry on portlet initialization"); + } + searchEngine = (SearchEngine)context.getAttribute(CommonPortletServices.CPS_SEARCH_COMPONENT); + if (null == searchEngine) + { + throw new PortletException("Failed to find the Search Engine on portlet initialization"); + } + } + + public void doView(RenderRequest request, RenderResponse response) + throws PortletException, IOException + { + response.setContentType("text/html"); + + TreeControl control = (TreeControl) request.getPortletSession().getAttribute("j2_tree"); + if(control == null) + { + Collection apps = registry.getPortletApplications(); + control = buildTree(apps, request.getLocale()); + request.getPortletSession().setAttribute("j2_tree", control); + } + request.setAttribute("j2_tree", control); + request.setAttribute("search_results", request.getPortletSession().getAttribute("search_results")); + + super.doView(request, response); + + } + + + public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException + { + TreeControl control = (TreeControl) actionRequest.getPortletSession().getAttribute("j2_tree"); + //assert control != null + if(control != null) + { + String searchString = actionRequest.getParameter("query"); + if(searchString != null) + { + SearchResults results = searchEngine.search(searchString); + actionRequest.getPortletSession().setAttribute("search_results", results.getResults()); + } + + String node = actionRequest.getParameter("node"); + if(node != null) + { + TreeControlNode controlNode = control.findNode(node); + if(controlNode != null) + { + controlNode.setExpanded(!controlNode.isExpanded()); + } + } + + String selectedNode = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_NODE); + if(selectedNode != null) + { + control.selectNode(selectedNode); + TreeControlNode child = control.findNode(selectedNode); + if(child != null) + { + MutablePortletApplication pa = null; + + String domain = child.getDomain(); + if(domain.equals("PA_APP_DOMAIN")) + { + pa = registry.getPortletApplicationByIdentifier(selectedNode); + if(pa != null) + { + actionRequest.getPortletSession().removeAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE); + } + } + else if(domain.equals("PD_DOMAIN")) + { + TreeControlNode parent = child.getParent(); + pa = registry.getPortletApplicationByIdentifier(parent.getName()); + + //set selected tab to portlets tab + if(pa != null) + { + //TODO: do we need to look up the pdef? Could we just pass the child name into setAttribute? + String pdefName = child.getName().substring(pa.getName().length() + 2); //remove pa prefix + PortletDefinition pdef = pa.getPortletDefinitionByName(pdefName); + actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, pdef.getName(), PortletSession.APPLICATION_SCOPE); + actionRequest.getPortletSession().setAttribute(PortletApplicationResources.REQUEST_SELECT_TAB, new TabBean("pa_portlets"), PortletSession.APPLICATION_SCOPE); + } + } + else + { + //warn about not recognized domain + } + + if (pa != null) + { + actionRequest.getPortletSession().setAttribute(PortletApplicationResources.PAM_CURRENT_PA, pa.getName(), PortletSession.APPLICATION_SCOPE); + } + } + } + } + } + + private TreeControl buildTree(Collection apps, Locale locale) + { + TreeControlNode root = + new TreeControlNode("ROOT-NODE", + null, + "J2_ROOT", + PortletApplicationResources.PORTLET_URL, + null, + true, + "J2_DOMAIN"); + + TreeControl control = new TreeControl(root); + + + TreeControlNode portletApps = + new TreeControlNode("APP_ROOT", + null, + "APP_ROOT", + PortletApplicationResources.PORTLET_URL, + null, + false, + "J2_DOMAIN"); + root.addChild(portletApps); + + Iterator it = apps.iterator(); + while (it.hasNext()) + { + MutablePortletApplication pa = (MutablePortletApplication)it.next(); + TreeControlNode appNode = new TreeControlNode(pa.getName(), + null, + pa.getName(), + PortletApplicationResources.PORTLET_URL, + null, + false, + "PA_APP_DOMAIN" ); + portletApps.addChild(appNode); + + Iterator pdefIter = pa.getPortletDefinitionList().iterator(); + while (pdefIter.hasNext()) + { + PortletDefinitionComposite portlet = (PortletDefinitionComposite) pdefIter.next(); + TreeControlNode portletNode = new TreeControlNode(pa.getName() + "::" + portlet.getName(), + null, + portlet.getDisplayNameText(locale), + PortletApplicationResources.PORTLET_URL, + null, + false, + "PD_DOMAIN"); + appNode.addChild(portletNode); + } + } + + return control; + } +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org For additional commands, e-mail: jetspeed-dev-help@portals.apache.org