You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by vk...@apache.org on 2009/04/24 18:40:37 UTC
svn commit: r768356 - in /portals/jetspeed-2/applications/j2-admin/trunk: ./
src/main/java/org/apache/jetspeed/portlets/rpad/
src/main/java/org/apache/jetspeed/portlets/rpad/portlet/
src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/ src...
Author: vkumar
Date: Fri Apr 24 16:40:36 2009
New Revision: 768356
URL: http://svn.apache.org/viewvc?rev=768356&view=rev
Log:
Adding Wicket version of RPAD (Remote portlet application deployer)
Removing JSF and Myfaces dependencies
Removing old RPAD config and un-used code
Added:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor$RepositoryPanel.html (with props)
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.html (with props)
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java (with props)
Removed:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RepositoryConfigHandler.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/RPADPortletFilter.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/util/FacesMessageUtil.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/web/deployer/DisplayPortletsPage.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/web/deployer/DisplayRepositoriesPage.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/web/deployer/EditRepositoryPage.java
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/rpad-config.xml
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/PortletApplication.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADApplication.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.html
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/Repository.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RepositoryManager.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/PortletDeployer.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/impl/JetspeedPortletDeployer.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleConfigHandler.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleRepository.java
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml
Modified: portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/pom.xml?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/pom.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/pom.xml Fri Apr 24 16:40:36 2009
@@ -93,7 +93,6 @@
<velocity.version>1.5</velocity.version>
<xerces.version>2.3.0</xerces.version>
<xml-apis.version>1.0.b2</xml-apis.version>
- <myfaces.version>1.1.5</myfaces.version>
<wicket.version>1.4-rc2</wicket.version>
</properties>
@@ -202,17 +201,6 @@
</exclusions>
</dependency>
<dependency>
- <groupId>myfaces</groupId>
- <artifactId>myfaces-api</artifactId>
- <version>${myfaces.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
@@ -243,24 +231,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>myfaces</groupId>
- <artifactId>myfaces-impl</artifactId>
- <version>${myfaces.version}</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>myfaces</groupId>
- <artifactId>tomahawk</artifactId>
- <version>${myfaces.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
<groupId>velocity-tools</groupId>
<artifactId>velocity-tools</artifactId>
<version>${velocity-tools.version}</version>
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/PortletApplication.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/PortletApplication.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/PortletApplication.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/PortletApplication.java Fri Apr 24 16:40:36 2009
@@ -16,12 +16,13 @@
*/
package org.apache.jetspeed.portlets.rpad;
+import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
-public class PortletApplication
+public class PortletApplication implements Serializable
{
private Date created = null;
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADApplication.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADApplication.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADApplication.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADApplication.java Fri Apr 24 16:40:36 2009
@@ -35,4 +35,11 @@
{
return RemotePortletAppDeployer.class;
}
+
+ @Override
+ protected void init()
+ {
+ super.init();
+ mountBookmarkablePage("/builder", RPADEditor.class);
+ }
}
\ No newline at end of file
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor$RepositoryPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor%24RepositoryPanel.html?rev=768356&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor$RepositoryPanel.html (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor$RepositoryPanel.html Fri Apr 24 16:40:36 2009
@@ -0,0 +1,38 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+
+ -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<wicket:panel>
+<div wicket:id="feedback"></div>
+<form wicket:id="repoForm">
+<table width="95%" border="0">
+ <tr>
+ <td><span wicket:id="repoName"/></td>
+ <td><input wicket:id="repoNameText"/></td>
+ </tr>
+ <tr>
+ <td><span wicket:id="repoUrl"/></td>
+ <td><input wicket:id="repoUrlText"/></td>
+ </tr>
+ <tr>
+ <td colspan="2"><input type="button" wicket:id="save" value="Save"/></td>
+ </tr>
+</table>
+</form>
+</wicket:panel>
+</html>
\ No newline at end of file
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor$RepositoryPanel.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.html?rev=768356&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.html (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.html Fri Apr 24 16:40:36 2009
@@ -0,0 +1,45 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+
+ -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<wicket:head></wicket:head>
+<table width="95%" border="0" wicket:id="tableGroup">
+ <thead>
+ <tr>
+ <th scope="col" align="left" width="20%">Name</th>
+ <th scope="col" align="left">Url</th>
+ <th scope="col" align="left">Action</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr wicket:id="repositories">
+ <td align="left"><span wicket:id="name">[name]</span></td>
+ <td align="left"><span wicket:id="url">[version]</span></td>
+ <td align="left"><a wicket:id="edit">Edit</a></td>
+ <td align="left"><a wicket:id="remove">Remove</a></td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td wicket:id="navigator"></td>
+ </tr>
+ </tfoot>
+</table>
+ <input type="button" wicket:id="newRepo" value="New repository"/>
+<div wicket:id="modalwindow"></div>
+</html>
\ No newline at end of file
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java?rev=768356&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java Fri Apr 24 16:40:36 2009
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.rpad;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.PortletRequest;
+import javax.portlet.ReadOnlyException;
+import javax.portlet.RenderRequest;
+import javax.portlet.ValidatorException;
+
+import org.apache.jetspeed.portlets.AdminPortletWebPage;
+import org.apache.jetspeed.portlets.rpad.portlet.deployer.PortletDeployer;
+import org.apache.jetspeed.portlets.rpad.portlet.deployer.impl.JetspeedPortletDeployer;
+import org.apache.jetspeed.portlets.rpad.simple.SimpleRepository;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.PageableListView;
+import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.PropertyModel;
+
+/**
+ * @author <a href="mailto:vkumar@apache.org">Vivek Kumar</a>
+ * @version $Id$
+ */
+public class RPADEditor extends AdminPortletWebPage
+{
+
+ private RepositoryManager repositoryManager;
+
+ private static final String REPO_PREFIX = "repo_";
+
+ public RPADEditor()
+ {
+ final PortletDeployer deployer = new JetspeedPortletDeployer();
+ IModel getRepo = new LoadableDetachableModel()
+ {
+
+ protected Object load()
+ {
+ return getRepo();
+ }
+ };
+ final WebMarkupContainer tableGroup = new WebMarkupContainer(
+ "tableGroup");
+ final ModalWindow metaDataModalWindow = new ModalWindow("modalwindow");
+ final PageableListView listview = new PageableListView("repositories",
+ getRepo, 10)
+ {
+ @Override
+ protected void populateItem(final ListItem item)
+ {
+ final Repository repo = (Repository) item.getModelObject();
+ item.add(new Label("name", repo.getName()));
+ item.add(new Label("url", repo.getConfigPath()));
+ item.add(new AjaxLink("edit", item.getModel())
+ {
+
+ @Override
+ public void onClick(AjaxRequestTarget target)
+ {
+ metaDataModalWindow.setContent(new RepositoryPanel(
+ metaDataModalWindow.getContentId(), repo,
+ tableGroup));
+ metaDataModalWindow.show(target);
+ }
+ });
+ item.add(new AjaxLink("remove", item.getModel()){
+
+ @Override
+ public void onClick(AjaxRequestTarget target)
+ {
+ try
+ {
+ getPortletRequest().getPreferences().reset(REPO_PREFIX + repo.getName());
+ getRepositoryManager().reload(RemotePortletAppDeployer.getReposList(getPortletRequest()));
+ target.addComponent(tableGroup);
+ } catch (ReadOnlyException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+ };
+ listview.setOutputMarkupId(true);
+
+ tableGroup.setOutputMarkupId(true);
+ tableGroup.add(new PagingNavigator("navigator", listview));
+ tableGroup.add(listview);
+ add(metaDataModalWindow);
+ add(tableGroup);
+ add(new AjaxLink("newRepo"){
+
+ @Override
+ public void onClick(AjaxRequestTarget target)
+ {
+ metaDataModalWindow.setContent(new RepositoryPanel(
+ metaDataModalWindow.getContentId(), new SimpleRepository("",""),
+ tableGroup));
+ metaDataModalWindow.show(target);
+ }
+ });
+ }
+
+ public RepositoryManager getRepositoryManager()
+ {
+ if (repositoryManager == null)
+ {
+ repositoryManager = RepositoryManager.getInstance(RemotePortletAppDeployer.getReposList(getPortletRequest()));
+ }
+ return repositoryManager;
+ }
+
+ private List<Repository> getRepo()
+ {
+ return getRepositoryManager().getRepositories();
+ }
+
+ private class RepositoryPanel extends Panel
+ {
+
+ private String repoName;
+
+ private String repoUrl;
+
+ /**
+ * @return the repoName
+ */
+ public String getRepoName()
+ {
+ return repoName;
+ }
+
+ /**
+ * @param repoName
+ * the repoName to set
+ */
+ public void setRepoName(String repoName)
+ {
+ this.repoName = repoName;
+ }
+
+ /**
+ * @return the repoUrl
+ */
+ public String getRepoUrl()
+ {
+ return repoUrl;
+ }
+
+ /**
+ * @param repoUrl
+ * the repoUrl to set
+ */
+ public void setRepoUrl(String repoUrl)
+ {
+ this.repoUrl = repoUrl;
+ }
+
+ public RepositoryPanel(String id, Repository repo,
+ final WebMarkupContainer container)
+ {
+ super(id);
+ this.repoName = repo.getName();
+ this.repoUrl = repo.getConfigPath();
+ final FeedbackPanel feedback = new FeedbackPanel("feedback");
+ feedback.setOutputMarkupId(true);
+ add(feedback);
+ final Form repoFrom = new Form("repoForm");
+ repoFrom.add(new Label("repoName", "Repository Name"));
+ repoFrom.add(new Label("repoUrl", "Repository URL"));
+ repoFrom.add(new TextField("repoNameText", new PropertyModel(this,
+ "repoName")).setRequired(true));
+ repoFrom.add(new TextField("repoUrlText", new PropertyModel(this,
+ "repoUrl")).setRequired(true));
+ repoFrom.add(new AjaxButton("save", repoFrom)
+ {
+
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form)
+ {
+ saveRepo(getRepoName(), getRepoUrl());
+ target.addComponent(container);
+ ((ModalWindow) RepositoryPanel.this.getParent())
+ .close(target);
+ }
+
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form)
+ {
+ target.addComponent(feedback);
+ }
+ });
+ add(repoFrom);
+
+ }
+ }
+
+ private void saveRepo(String name, String repoUrl)
+ {
+ try
+ {
+ getPortletRequest().getPreferences().setValue(REPO_PREFIX + name, repoUrl);
+ getPortletRequest().getPreferences().store();
+ getRepositoryManager().reload(RemotePortletAppDeployer.getReposList(getPortletRequest()));
+ } catch (ReadOnlyException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ValidatorException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RPADEditor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.html?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.html Fri Apr 24 16:40:36 2009
@@ -17,23 +17,12 @@
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<title>RPAD</title>
-</head>
-
-<body>
-
- <form wicket:id="form">
-
+<wicket:head></wicket:head>
+<form wicket:id="form">
Repository: <select wicket:id="repositorySelection">
- <option>repo1</option>
- <option>repo2</option>
</select>
<input wicket:id="selectButton" type="submit" value="Select" />
-
</form>
-
<table width="95%" border="0" wicket:id="tableGroup">
<thead>
<tr>
@@ -52,7 +41,7 @@
<td align="left"><span wicket:id="name">[name]</span></td>
<td align="left"><span wicket:id="version">[version]</span></td>
<td align="left"><span wicket:id="type">[type]</span></td>
- <td align="left"><span wicket:id="action">[action]</span></td>
+ <td align="left"><a wicket:id="action">Deploy</a></td>
</tr>
</tbody>
<tfoot>
@@ -61,7 +50,6 @@
</tr>
</tfoot>
</table>
-
-</body>
-
+<div wicket:id="status"></div>
+<div wicket:id="ticker"></div>
</html>
\ No newline at end of file
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RemotePortletAppDeployer.java Fri Apr 24 16:40:36 2009
@@ -16,122 +16,240 @@
*/
package org.apache.jetspeed.portlets.rpad;
-import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
-import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
+import javax.portlet.PortletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.jetspeed.portlets.AdminPortletWebPage;
+import org.apache.jetspeed.portlets.rpad.portlet.deployer.PortletDeployer;
+import org.apache.jetspeed.portlets.rpad.portlet.deployer.impl.JetspeedPortletDeployer;
+import org.apache.jetspeed.portlets.rpad.simple.SimpleRepository;
+import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.PageableListView;
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.util.time.Duration;
-public class RemotePortletAppDeployer extends WebPage
+public class RemotePortletAppDeployer extends AdminPortletWebPage
{
- /** available sites for selection. */
- @SuppressWarnings("unchecked")
- private static final List SITES = Arrays.asList(new String[] {"Dave's Repository", "Jody's Repository", "Whole lotta Repository" });
-
- @SuppressWarnings("unchecked")
- public RemotePortletAppDeployer()
- {
- Form form = new Form("form");
- form.add(new DropDownChoice("repositorySelection", SITES));
-
- Button selectButton = new Button("selectButton") {
- private static final long serialVersionUID = 1L;
- public void onSubmit() {
- info("select.onSubmit executed");
- }
- };
-
- form.add(selectButton);
- add(form);
-
- IModel getRepo = new LoadableDetachableModel()
- {
- protected Object load() {
- return getRepo();
- }
- };
-
- PageableListView listview = new PageableListView("repositories", getRepo, 6)
- {
- private static final long serialVersionUID = 1L;
-
- // This method is called for each 'entry' in the list.
- @Override
- protected void populateItem(final ListItem item) {
- final Repository repository = (Repository)item.getModelObject();
- item.add(new Label("groupId", repository.groupId));
- item.add(new Label("artifactId",repository.artifactId));
- item.add(new Label("name", repository.name));
- item.add(new Label("version", repository.version));
- item.add(new Label("type", repository.type));
- item.add(new Label("action", repository.action));
-
- }
- };
-
- WebMarkupContainer tableGroup = new WebMarkupContainer("tableGroup");
+
+ /** available sites for selection. */
+ @SuppressWarnings("unchecked")
+ private List repositories;
+ private String message;
+ private String ticker;
+
+ private List<PortletApplication> portletApplications;
+
+ private Repository selectedRepository;
+ final PortletDeployer deployer;
+
+ private RepositoryManager repositoryManager;
+
+ @SuppressWarnings("unchecked")
+ public RemotePortletAppDeployer()
+ {
+ deployer = new JetspeedPortletDeployer();
+ Form form = new Form("form");
+ repositories = getRepositoryManager().getRepositories();
+ form.add(new DropDownChoice("repositorySelection", new PropertyModel(
+ this, "selectedRepository"), repositories, new ChoiceRenderer(
+ "name", "name")));
+
+ Button selectButton = new Button("selectButton")
+ {
+
+ private static final long serialVersionUID = 1L;
+
+ public void onSubmit()
+ {
+
+ }
+ };
+
+ form.add(selectButton);
+ add(form);
+
+ IModel getRepo = new LoadableDetachableModel()
+ {
+
+ protected Object load()
+ {
+ return getRepo();
+ }
+ };
+
+ final PageableListView listview = new PageableListView("repositories",
+ getRepo, 10)
+ {
+
+ private static final long serialVersionUID = 1L;
+
+ // This method is called for each 'entry' in the list.
+ @Override
+ protected void populateItem(final ListItem item)
+ {
+ final PortletApplication application = (PortletApplication) item
+ .getModelObject();
+ item.add(new Label("groupId", application.getGroupId()));
+ item.add(new Label("artifactId", application.getArtifactId()));
+ item.add(new Label("name", application.getName()));
+ item.add(new Label("version", application.getName()));
+ item.add(new Label("type", application.getPackaging()));
+ Link actionLink = new Link("action", item.getModel())
+ {
+
+ public void onClick()
+ {
+ PortletApplication portletApplication = (PortletApplication) getModelObject();
+ deployer.deploy(portletApplication, getServiceLocator()
+ .getDeploymentManager());
+ }
+ };
+ actionLink.setVisibilityAllowed(true);
+ actionLink.setOutputMarkupId(true);
+ if(deployer.getStatus() == PortletDeployer.DEPLOYING)
+ {
+ actionLink.setVisible(false);
+ }
+ item.add(actionLink);
+ }
+ };
+ listview.setOutputMarkupId(true);
+ final WebMarkupContainer tableGroup = new WebMarkupContainer("tableGroup");
tableGroup.setOutputMarkupId(true);
- tableGroup.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
+ //tableGroup.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
tableGroup.add(new PagingNavigator("navigator", listview));
tableGroup.add(listview);
+ final MultiLineLabel statusLabel = new MultiLineLabel("status",
+ new PropertyModel(this, "message"));
+ statusLabel.setOutputMarkupId(true);
+ final Label tickerLabel =new Label("ticker",new PropertyModel(this,"ticker"));
+ tickerLabel.setOutputMarkupId(true);
+ add(new AbstractAjaxTimerBehavior(Duration.seconds(3))
+ {
+ protected void onTimer(AjaxRequestTarget target)
+ {
+ setMessage(deployer.getMessage());
+ target.addComponent(tickerLabel);
+ target.addComponent(statusLabel);
+ target.addComponent(tableGroup);
+ }
+ });
+ add(statusLabel);
+ add(tickerLabel);
add(tableGroup);
-
+
}
-
- // mock data for testing listview
- private List<Repository> getRepo()
- {
- List<Repository> repositories = new ArrayList<Repository>();
- {
- repositories.add(new Repository("org.apache.portals.jody", "Jody", "Jody", "2.0", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.dave", "Dave", "Dave", "2.1", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.jody", "Hippo", "Hippo", "1.7", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.jody", "Jehosophat", "Jody", "2.2", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.dave", "Niels", "Dave", "2.3", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.jody", "Ted", "Hippo", "1.3", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.jody", "Jehosphat", "Jody", "2.4", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.dave", "Bob", "Dave", "2.5", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.jody", "Al", "Hippo", "6.7", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.jody", "Jocelyn", "Jody", "2.6", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.dave", "Amy", "Dave", "2.7", "war", "Deploy"));
- repositories.add(new Repository("org.apache.portals.jody", "Shea", "Hippo", "1.8", "war", "Deploy"));
- }
- return repositories;
- }
-
- // some arbitrary class for data.
- class Repository {
- String groupId;
- String artifactId;
- String name;
- String version;
- String type;
- String action;
-
- //field names
- Repository(String gId, String aId, String emailAddr, String version, String rtype, String raction) {
- this.groupId = gId;
- this.artifactId = aId;
- this.name = emailAddr;
- this.version = version;
- this.type = rtype;
- this.action = raction;
- }
+
+ // mock data for testing listview
+ private List<PortletApplication> getRepo()
+ {
+ if (getSelectedRepository() != null
+ && !StringUtils.isBlank(getSelectedRepository().getName()))
+ {
+ portletApplications = getRepositoryManager()
+ .getPortletApplications(getSelectedRepository().getName());
+ } else
+ {
+ portletApplications = getRepositoryManager()
+ .getPortletApplications();
+
+ }
+ return portletApplications;
+ }
+
+ /**
+ * @return the selectedRepository
+ */
+ public Repository getSelectedRepository()
+ {
+ return selectedRepository;
}
-}
+ /**
+ * @param selectedRepository
+ * the selectedRepository to set
+ */
+ public void setSelectedRepository(Repository selectedRepository)
+ {
+ this.selectedRepository = selectedRepository;
+ }
+ public RepositoryManager getRepositoryManager()
+ {
+ if (repositoryManager == null)
+ {
+ repositoryManager = RepositoryManager.getInstance(getReposList(getPortletRequest()));
+ }
+ return repositoryManager;
+ }
+
+ /**
+ * @return the message
+ */
+ public String getMessage()
+ {
+ return message;
+ }
-
+
+ /**
+ * @param message the message to set
+ */
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ /**
+ * @return the ticker
+ */
+ public String getTicker()
+ {
+ if(deployer.getStatus()!=deployer.READY)
+ {
+ if(ticker.length()<5)
+ {
+ ticker+=".";
+ }else{
+ ticker= ".";
+ }
+ }else{
+ ticker="";
+ }
+ return ticker;
+ }
+ public static final Map<String,Repository> getReposList(PortletRequest request)
+ {
+ Map<String,Repository> portletRepositry = new HashMap<String, Repository>();
+ String repoName;
+ Enumeration<String> repoNames = request.getPreferences().getNames();
+ while(repoNames.hasMoreElements())
+ {
+ repoName = (String)repoNames.nextElement();
+ if(repoName.startsWith("repo_"))
+ {
+ portletRepositry.put(repoName.split("_")[1],new SimpleRepository(repoName.split("_")[1],request.getPreferences().getValue(repoName,"")));
+ }
+
+ }
+ return portletRepositry;
+ }
+}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/Repository.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/Repository.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/Repository.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/Repository.java Fri Apr 24 16:40:36 2009
@@ -16,13 +16,16 @@
*/
package org.apache.jetspeed.portlets.rpad;
+import java.io.Serializable;
import java.util.List;
-public interface Repository
+public interface Repository extends Serializable
{
public void init();
public String getName();
+
+ public String getConfigPath();
public void setAvailable(boolean b);
@@ -31,7 +34,7 @@
public PortletApplication getPortletApplication(String groupId,
String artifactId, String version, String packaging);
- public List getPortletApplications();
+ public List<PortletApplication> getPortletApplications();
public String toXMLString();
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RepositoryManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RepositoryManager.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RepositoryManager.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/RepositoryManager.java Fri Apr 24 16:40:36 2009
@@ -16,92 +16,60 @@
*/
package org.apache.jetspeed.portlets.rpad;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
-public class RepositoryManager
+public class RepositoryManager implements Serializable
{
+
/**
* Logger for this class
*/
private static final Logger log = LoggerFactory.getLogger(RepositoryManager.class);
- private String configFileName;
+ private static boolean init = false;
- private Map repositories;
+ private Map<String, Repository> repositories;
private static RepositoryManager repositoryManager;
- public static void init(String configFileName) throws RPADException
+ public RepositoryManager(Map<String, Repository> repos)
{
- repositoryManager = new RepositoryManager(configFileName);
+ this.repositories = repos;
}
- public static RepositoryManager getInstance()
+ public void load()
{
- if (repositoryManager == null)
+ Iterator<String> repoNames = repositories.keySet().iterator();
+ Repository localRepository = null;
+ while (repoNames.hasNext())
{
- throw new IllegalStateException(
- "init() needs to be called before getInstance().");
+ localRepository = (Repository) repositories.get(repoNames.next());
+ localRepository.init();
}
- return repositoryManager;
+ init = true;
}
- public RepositoryManager(String configFileName) throws RPADException
+ public static RepositoryManager getInstance(Map<String, Repository> repos)
{
- this.configFileName = configFileName;
- load();
- }
-
- protected void load() throws RPADException
- {
- try
- {
- SAXParserFactory spfactory = SAXParserFactory.newInstance();
- SAXParser parser = spfactory.newSAXParser();
- RepositoryConfigHandler repoConfigHandler = new RepositoryConfigHandler();
- parser.parse(new File(configFileName), repoConfigHandler);
- repositories = repoConfigHandler.getRepositories();
- }
- catch (ParserConfigurationException e)
- {
- throw new RPADException("Could not configure a parser.", e);
- }
- catch (SAXException e)
- {
- throw new RPADException("An exception occurrs on SAX parser.", e);
- }
- catch (IOException e)
+ if (repositoryManager == null)
{
- throw new RPADException(
- "An exception occurrs when accessing a configuration file: "
- + configFileName, e);
+ repositoryManager = new RepositoryManager(repos);
}
+ return repositoryManager;
}
- public void reload() throws RPADException
+ public void reload(Map<String, Repository> repos)
{
- synchronized (repositories)
- {
- load();
- }
+ repositories = repos;
+ repositoryManager = new RepositoryManager(repos);
+ load();
}
public void addRepository(String name, Repository repository)
@@ -109,10 +77,8 @@
{
synchronized (repositories)
{
- if (repositories.containsKey(name))
- {
- throw new RPADException(name + "exists.");
- }
+ if (repositories.containsKey(name)) { throw new RPADException(name
+ + "exists."); }
repositories.put(name, repository);
store();
}
@@ -127,88 +93,35 @@
{
synchronized (repositories)
{
- if (!repositories.containsKey(name))
- {
- throw new RPADException(name + "does not exist.");
- }
+ if (!repositories.containsKey(name)) { throw new RPADException(name
+ + "does not exist."); }
repositories.remove(name);
store();
}
}
- public List getRepositories()
+ public List<Repository> getRepositories()
{
+ if (!init) load();
return new ArrayList(repositories.values());
}
public void store() throws RPADException
{
- synchronized (repositories)
- {
- BufferedWriter writer = null;
- try
- {
- try
- {
- writer = new BufferedWriter(new OutputStreamWriter(
- new FileOutputStream(configFileName), "UTF-8"));
- }
- catch (UnsupportedEncodingException e)
- {
- writer = new BufferedWriter(new OutputStreamWriter(
- new FileOutputStream(configFileName)));
- }
- writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- writer.write("<repositories>\n");
- for (Iterator i = repositories.entrySet().iterator(); i
- .hasNext();)
- {
- Map.Entry entry = (Map.Entry) i.next();
- if (log.isDebugEnabled())
- {
- log.debug("Storing a repository: " + entry.getKey());
- }
-
- Repository repo = (Repository) entry.getValue();
- writer.write(repo.toXMLString());
- }
- writer.write("</repositories>\n");
- writer.flush();
- }
- catch (FileNotFoundException e)
- {
- throw new RPADException("Could not find " + configFileName, e);
- }
- catch (IOException e)
- {
- throw new RPADException("Could not write " + configFileName, e);
- }
- finally
- {
- if (writer != null)
- {
- try
- {
- writer.close();
- }
- catch (IOException e)
- {
- }
- }
- }
- }
}
- public List getPortletApplications()
+ public List<PortletApplication> getPortletApplications()
{
- ArrayList list = new ArrayList();
+ if (!init) load();
+ ArrayList<PortletApplication> list = new ArrayList<PortletApplication>();
for (Iterator i = repositories.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
Repository repo = (Repository) entry.getValue();
if (repo.isAvailable())
{
- List portlets = repo.getPortletApplications();
+ List<PortletApplication> portlets = repo
+ .getPortletApplications();
if (portlets != null)
{
list.addAll(portlets);
@@ -218,14 +131,15 @@
return list;
}
- public List getPortletApplications(String name)
+ public List<PortletApplication> getPortletApplications(String name)
{
- ArrayList list = new ArrayList();
+ if (!init) load();
+ ArrayList<PortletApplication> list = new ArrayList<PortletApplication>();
Repository repo = getRepository(name);
if (repo != null && repo.isAvailable())
{
- List portlets = repo.getPortletApplications();
+ List<PortletApplication> portlets = repo.getPortletApplications();
if (portlets != null)
{
list.addAll(portlets);
@@ -234,5 +148,5 @@
return list;
}
- //TODO search
+ // TODO search
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/PortletDeployer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/PortletDeployer.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/PortletDeployer.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/PortletDeployer.java Fri Apr 24 16:40:36 2009
@@ -16,15 +16,19 @@
*/
package org.apache.jetspeed.portlets.rpad.portlet.deployer;
+import java.io.Serializable;
+
+import org.apache.jetspeed.deployment.DeploymentManager;
import org.apache.jetspeed.portlets.rpad.PortletApplication;
-public interface PortletDeployer
+public interface PortletDeployer extends Serializable
{
public static final int READY = 0;
-
public static final int DEPLOYING = 1;
public int getStatus();
- public void deploy(PortletApplication portlet);
+ public void deploy(PortletApplication portlet, DeploymentManager manager);
+
+ public String getMessage();
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/impl/JetspeedPortletDeployer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/impl/JetspeedPortletDeployer.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/impl/JetspeedPortletDeployer.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/portlet/deployer/impl/JetspeedPortletDeployer.java Fri Apr 24 16:40:36 2009
@@ -27,17 +27,13 @@
import java.net.URL;
import java.util.Calendar;
-import javax.faces.context.FacesContext;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.jetspeed.CommonPortletServices;
import org.apache.jetspeed.deployment.DeploymentException;
import org.apache.jetspeed.deployment.DeploymentManager;
import org.apache.jetspeed.deployment.DeploymentStatus;
import org.apache.jetspeed.portlets.rpad.PortletApplication;
import org.apache.jetspeed.portlets.rpad.portlet.deployer.PortletDeployer;
-import org.apache.jetspeed.portlets.rpad.portlet.util.FacesMessageUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class JetspeedPortletDeployer implements PortletDeployer
{
@@ -45,9 +41,8 @@
* Logger for this class
*/
private static final Logger log = LoggerFactory.getLogger(JetspeedPortletDeployer.class);
-
private int status;
-
+ private String message = "Ready";
private long startTime = 0;
public JetspeedPortletDeployer()
@@ -60,33 +55,21 @@
return status;
}
- synchronized public void deploy(PortletApplication portlet)
+ synchronized public void deploy(PortletApplication portlet, DeploymentManager manager)
{
if (status != READY)
{
- //TODO check timeout
-
- //TODO i18n
- FacesMessageUtil
- .addWarnMessage("Other deployment process is running.");
return;
}
DeployerThread deployer = new DeployerThread();
- deployer.setDeploymentManager((DeploymentManager) FacesContext
- .getCurrentInstance().getExternalContext().getApplicationMap()
- .get(CommonPortletServices.CPS_DEPLOYMENT_MANAGER_COMPONENT));
+ deployer.setDeploymentManager(manager);
deployer.setPortletApplication(portlet);
try
{
deployer.start();
- //TODO i18n
- FacesMessageUtil.addInfoMessage("Started a deployment process.");
}
catch (Exception e)
{
- //TODO i18n
- FacesMessageUtil
- .addErrorMessage("Could not start deployment process.");
log.error("Could not start deployment process.", e);
}
}
@@ -94,15 +77,16 @@
public class DeployerThread extends Thread
{
private DeploymentManager deploymentManager;
-
private PortletApplication portletApplication;
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see java.lang.Thread#run()
*/
public void run()
{
status = DEPLOYING;
+ setMessage("Stat deploying");
try
{
startTime = Calendar.getInstance().getTimeInMillis();
@@ -111,51 +95,48 @@
String binaryUrl = portletApplication.getBinaryUrl();
if (binaryUrl != null && !binaryUrl.equals(""))
{
+ setMessage("Stat dowloading from " + binaryUrl);
File targetFile = null;
try
{
- File tempFile = File.createTempFile("rpad_", "."
- + portletApplication.getPackaging());
- FileOutputStream out = new FileOutputStream(
- tempFile);
- drain(getInputStream(portletApplication
- .getBinaryUrl()), out);
+ File tempFile = File.createTempFile("rpad_", "." + portletApplication.getPackaging());
+ FileOutputStream out = new FileOutputStream(tempFile);
+ drain(getInputStream(portletApplication.getBinaryUrl()), out);
try
{
- targetFile = new File(tempFile.getParentFile(),
- portletApplication.getArtifactId()
- + "."
- + portletApplication
- .getPackaging());
+ targetFile = new File(tempFile.getParentFile(), portletApplication.getArtifactId() + "." + portletApplication.getPackaging());
tempFile.renameTo(targetFile);
}
catch (Exception e)
{
targetFile = tempFile;
}
- if (getDeploymentManager().deploy(targetFile)
- .getStatus() == DeploymentStatus.STATUS_OKAY)
+ setMessage(portletApplication.getName() + " deploying start");
+ if (getDeploymentManager().deploy(targetFile).getStatus() == DeploymentStatus.STATUS_OKAY)
{
- log.info(portletApplication.getName()
- + " was deployed.");
+ log.info(portletApplication.getName() + " was deployed.");
+ setMessage(portletApplication.getName() + " was deployed.");
}
else
{
- log.error("Could not deploy "
- + portletApplication.getName());
+ setMessage(portletApplication.getName() + " was deployed.");
+ log.error("Could not deploy " + portletApplication.getName());
}
}
catch (FileNotFoundException e)
{
- log.error(e.getMessage(),e);
+ setMessage("download fail from from " + binaryUrl);
+ log.error(e.getMessage(), e);
}
catch (IOException e)
{
- log.error(e.getMessage(),e);
+ setMessage("download fail from from " + binaryUrl);
+ log.error(e.getMessage(), e);
}
catch (DeploymentException e)
{
- log.error(e.getMessage(),e);
+ setMessage("download fail from from " + binaryUrl);
+ log.error(e.getMessage(), e);
}
if (targetFile != null && targetFile.exists())
{
@@ -164,8 +145,8 @@
}
else
{
- log.error("The target url is invalid. The path is "
- + binaryUrl);
+ setMessage("The target url is invalid. The path is " + binaryUrl);
+ log.error("The target url is invalid. The path is " + binaryUrl);
}
}
else
@@ -175,10 +156,12 @@
}
catch (Exception e)
{
+ setMessage(e.getMessage());
log.error("Unexpected exception.", e);
}
finally
{
+ setMessage("Ready");
status = READY;
}
}
@@ -192,7 +175,8 @@
}
/**
- * @param portletApplication the portletApplication to set
+ * @param portletApplication
+ * the portletApplication to set
*/
public void setPortletApplication(PortletApplication portletApplication)
{
@@ -216,13 +200,13 @@
}
/**
- * @param deploymentManager the deploymentManager to set
+ * @param deploymentManager
+ * the deploymentManager to set
*/
public void setDeploymentManager(DeploymentManager deploymentManager)
{
this.deploymentManager = deploymentManager;
}
-
}
protected void drain(InputStream in, OutputStream out) throws IOException
@@ -231,7 +215,6 @@
{
byte[] buf = new byte[8192];
int len = in.read(buf);
-
while (len != -1)
{
out.write(buf, 0, len);
@@ -294,4 +277,13 @@
return null;
}
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleConfigHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleConfigHandler.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleConfigHandler.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleConfigHandler.java Fri Apr 24 16:40:36 2009
@@ -27,43 +27,36 @@
public class SimpleConfigHandler extends DefaultHandler
{
-
- private List portletApplications;
-
+ private List<PortletApplication> portletApplications;
private PortletApplication portletApplication;
-
private List qNameList;
public SimpleConfigHandler()
{
- portletApplications = new ArrayList();
+ portletApplications = new ArrayList<PortletApplication>();
qNameList = new ArrayList();
}
- public void startElement(String uri, String localName, String qName,
- Attributes attributes)
+ public void startElement(String uri, String localName, String qName, Attributes attributes)
{
if ("repository".equals(qName))
{
- //TODO version
- //TODO id
+ // TODO version
+ // TODO id
}
else if ("portlet".equals(qName))
{
portletApplication = new PortletApplication();
-
String artifactId = attributes.getValue("id");
if (artifactId != null)
{
portletApplication.setArtifactId(artifactId);
}
-
String groupId = attributes.getValue("group");
if (groupId != null)
{
portletApplication.setGroupId(groupId);
}
-
String version = attributes.getValue("version");
if (version != null)
{
@@ -82,7 +75,6 @@
{
return;
}
-
String value = new String(ch, start, length);
String qName = (String) qNameList.get(qNameList.size() - 1);
String parentQName;
@@ -148,8 +140,8 @@
{
portletApplication.setImageUrl(value);
}
- //TODO dependencies
- //TODO license
+ // TODO dependencies
+ // TODO license
else if ("compiledJDKVersion".equals(qName))
{
portletApplication.setCompiledJDKVersion(value);
@@ -162,7 +154,6 @@
portletApplication.addSupportedLocale(l);
}
}
-
}
private Locale getLocaleFromString(String localeString)
@@ -197,19 +188,16 @@
portletApplications.add(portletApplication);
portletApplication = null;
}
-
synchronized (qNameList)
{
if (qNameList.size() < 1)
{
throw new IllegalStateException("The stacked QName is 0.");
}
- String stackedQName = (String) qNameList
- .remove(qNameList.size() - 1);
+ String stackedQName = (String) qNameList.remove(qNameList.size() - 1);
if (!qName.equals(stackedQName))
{
- throw new IllegalStateException("The expected QName is "
- + stackedQName + ". But the current value is " + qName);
+ throw new IllegalStateException("The expected QName is " + stackedQName + ". But the current value is " + qName);
}
}
}
@@ -217,15 +205,16 @@
/**
* @return the portletApplications
*/
- public List getPortletApplications()
+ public List<PortletApplication> getPortletApplications()
{
return portletApplications;
}
/**
- * @param portletApplications the portletApplications to set
+ * @param portletApplications
+ * the portletApplications to set
*/
- public void setPortletApplications(List portletApplications)
+ public void setPortletApplications(List<PortletApplication> portletApplications)
{
this.portletApplications = portletApplications;
}
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleRepository.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleRepository.java?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleRepository.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/rpad/simple/SimpleRepository.java Fri Apr 24 16:40:36 2009
@@ -23,16 +23,15 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.jetspeed.portlets.rpad.PortletApplication;
import org.apache.jetspeed.portlets.rpad.Repository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
public class SimpleRepository implements Repository
@@ -41,17 +40,15 @@
* Logger for this class
*/
private static final Logger log = LoggerFactory.getLogger(SimpleRepository.class);
-
private String name;
-
private String configPath;
-
- private List portletApplications;
-
+ private List<PortletApplication> portletApplications;
private boolean available;
- public SimpleRepository()
+ public SimpleRepository(String name, String configPath)
{
+ this.name = name;
+ this.configPath = configPath;
available = false;
}
@@ -61,12 +58,11 @@
{
log.debug("Loading a repository: " + configPath);
}
-
if (configPath == null)
{
throw new IllegalStateException("The configuration path is null.");
}
- //load config
+ // load config
try
{
InputSource inputSource = getInputSource(configPath);
@@ -86,14 +82,14 @@
{
log.debug("No portlet application.");
}
- portletApplications = new ArrayList();
+ portletApplications = new ArrayList<PortletApplication>();
}
available = true;
}
catch (Exception e)
{
log.error("Could not load a repository.", e);
- portletApplications = new ArrayList();
+ portletApplications = new ArrayList<PortletApplication>();
available = false;
}
}
@@ -120,8 +116,7 @@
{
try
{
- return new InputSource(new FileInputStream(new File(path
- .substring(5))));
+ return new InputSource(new FileInputStream(new File(path.substring(5))));
}
catch (FileNotFoundException e)
{
@@ -131,24 +126,16 @@
return null;
}
- public PortletApplication getPortletApplication(String groupId,
- String artifactId, String version, String packaging)
+ public PortletApplication getPortletApplication(String groupId, String artifactId, String version, String packaging)
{
- if (groupId != null && artifactId != null && version != null
- && packaging != null)
+ if (groupId != null && artifactId != null && version != null && packaging != null)
{
- Iterator ite = portletApplications.iterator();
- while (ite.hasNext())
- {
- PortletApplication portletApp = (PortletApplication) ite.next();
- if (groupId.equals(portletApp.getGroupId())
- && artifactId.equals(portletApp.getArtifactId())
- && version.equals(portletApp.getVersion())
- && packaging.equals(portletApp.getPackaging()))
+ for (PortletApplication pApps : portletApplications)
+ if (groupId.equals(pApps.getGroupId()) && artifactId.equals(pApps.getArtifactId()) && version.equals(pApps.getVersion()) &&
+ packaging.equals(pApps.getPackaging()))
{
- return portletApp;
+ return pApps;
}
- }
}
return null;
}
@@ -162,7 +149,8 @@
}
/**
- * @param configPath the configPath to set
+ * @param configPath
+ * the configPath to set
*/
public void setConfigPath(String configPath)
{
@@ -172,7 +160,7 @@
/**
* @return the portletApplications
*/
- public List getPortletApplications()
+ public List<PortletApplication> getPortletApplications()
{
return portletApplications;
}
@@ -186,7 +174,8 @@
}
/**
- * @param name the name to set
+ * @param name
+ * the name to set
*/
public void setName(String name)
{
@@ -196,16 +185,11 @@
public String toXMLString()
{
return " <repository>\n" //
- + " <name>"
- + getName()
- + "</name>\n" //
- + " <class name=\""
- + "org.apache.jetspeed.portlets.rpad.simple.SimpleRepository"
- + "\"/>\n" //
- + " <property name=\"configPath\">"
- + getConfigPath()
- + "</property>\n" //
- + " </repository>\n";
+ +
+ " <name>" + getName() + "</name>\n" //
+ + " <class name=\"" + "org.apache.jetspeed.portlets.rpad.simple.SimpleRepository" + "\"/>\n" //
+ + " <property name=\"configPath\">" + getConfigPath() + "</property>\n" //
+ + " </repository>\n";
}
/**
@@ -217,7 +201,8 @@
}
/**
- * @param available the available to set
+ * @param available
+ * the available to set
*/
public void setAvailable(boolean available)
{
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml Fri Apr 24 16:40:36 2009
@@ -936,12 +936,17 @@
<value>/rpad</value>
</init-param>
<init-param>
+ <name>editPage</name>
+ <value>/rpad/builder</value>
+ </init-param>
+ <init-param>
<name>principalParam</name>
<value>user</value>
</init-param>
<expiration-cache>300</expiration-cache>
<supports>
<mime-type>*/*</mime-type>
+ <portlet-mode>EDIT</portlet-mode>
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
@@ -952,6 +957,16 @@
<short-title>RPAD</short-title>
<keywords>RPAD,Portlet Repository</keywords>
</portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>PALab</name>
+ <value>http://pal.sourceforge.jp/portlet-repository.xml</value>
+ </preference>
+ <preference>
+ <name>Apache Portals</name>
+ <value>http://www.bluesunrise.com/rpa/portlet-repository.xml</value>
+ </preference>
+ </portlet-preferences>
</portlet>
<portlet>
@@ -1314,9 +1329,8 @@
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
- <!--<resource-bundle>org.apache.jetspeed.portlets.security.JetspeedPrincipalManagementUsers</resource-bundle> -->
<portlet-info>
- <title>Wicket User Browser</title>
+ <title>User Browser</title>
<short-title>Users</short-title>
<keywords>admin,security,users</keywords>
</portlet-info>
@@ -1340,7 +1354,7 @@
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
- <title>Wicket Group Browser</title>
+ <title>Group Browser</title>
<short-title>Groups</short-title>
<keywords>admin,security,groups, group</keywords>
</portlet-info>
@@ -1364,7 +1378,7 @@
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
- <title>Wicket Role Browser</title>
+ <title>Role Browser</title>
<short-title>Roles</short-title>
<keywords>admin,security,roles,role</keywords>
</portlet-info>
Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml?rev=768356&r1=768355&r2=768356&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/web.xml Fri Apr 24 16:40:36 2009
@@ -19,69 +19,16 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Jetspeed-2 Portal Administration Portlets</display-name>
<description>Administration Portlets for the Jetspeed-2 Enterprise Portal</description>
-
- <!-- for deploying on Websphere: disable Websphere default portletcontainer -->
- <context-param>
+
+ <!-- for deploying on Websphere: disable Websphere default portletcontainer -->
+ <context-param>
<param-name>com.ibm.websphere.portletcontainer.PortletDeploymentEnabled</param-name>
<param-value>false</param-value>
</context-param>
- <context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.application.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/faces-config.xml</param-value>
- </context-param>
- <context-param>
- <description>
- This parameter tells MyFaces if javascript code should be allowed in the
- rendered HTML output.
- If javascript is allowed, command_link anchors will have javascript code
- that submits the corresponding form.
- If javascript is not allowed, the state saving info and nested parameters
- will be added as url parameters.
- Default: "true"
- </description>
- <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
- <param-value>true</param-value>
- </context-param>
-
- <context-param>
- <description>
- This parameter tells MyFaces if javascript code should be allowed in the
- rendered HTML output.
- If javascript is allowed, command_link anchors will have javascript code
- that submits the corresponding form.
- If javascript is not allowed, the state saving info and nested parameters
- will be added as url parameters.
- Default: "false"
-
- Setting this param to true should be combined with STATE_SAVING_METHOD "server" for
- best results.
-
- This is an EXPERIMENTAL feature. You also have to enable the detector filter/filter mapping below to get
- JavaScript detection working.
- </description>
- <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
- <param-value>false</param-value>
- </context-param>
-
- <context-param>
- <description>
- If true, rendered HTML code will be formatted, so that it is "human readable".
- i.e. additional line separators and whitespace will be written, that do not
- influence the HTML code.
- Default: "true"
- </description>
- <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
- <param-value>true</param-value>
- </context-param>
-
<context-param>
<param-name>webAppRootKey</param-name>
- <param-value>org.apache.portals.applications.j2-admin.applicationRoot</param-value>
+ <param-value>org.apache.portals.applications.j2-admin.applicationRoot</param-value>
</context-param>
<context-param>
@@ -102,7 +49,7 @@
<param-value>org.apache.jetspeed.portlets.security.JetspeedPrincipalManagementApplication</param-value>
</init-param>
</filter>
-
+
<filter>
<filter-name>WicketProfilerAdminApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
@@ -190,10 +137,23 @@
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
+ <filter>
+ <filter-name>RPADPortlet</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.jetspeed.portlets.rpad.RPADApplication</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>RPADPortlet</filter-name>
+ <url-pattern>/rpad/*</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+
<!-- Listener, that does all the startup work (configuration, init). -->
- <listener>
- <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
- </listener>
<listener>
<listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
@@ -207,13 +167,6 @@
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
- <!-- Faces Servlet -->
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
<!-- Define Velocity Servlet -->
<servlet>
<servlet-name>velocity</servlet-name>
@@ -265,12 +218,6 @@
<url-pattern>/WEB-INF/servlet/view</url-pattern>
</servlet-mapping>
- <!-- extension mapping -->
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- </servlet-mapping>
-
<jsp-config>
<!-- Tag libraries -->
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org