Author: glandais Date: 2008-01-24 18:01:24 +0000 (Thu, 24 Jan 2008) New Revision: 506 Added: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java trunk/simexplorer-is-web/src/main/webapp/ElementDelete.tml trunk/simexplorer-is-web/src/main/webapp/ElementExport.tml trunk/simexplorer-is-web/src/main/webapp/ElementRights.tml trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml Modified: trunk/simexplorer-is-web/pom.xml trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java Log: Delete, export, rights, exception pages Modified: trunk/simexplorer-is-web/pom.xml =================================================================== --- trunk/simexplorer-is-web/pom.xml 2008-01-24 18:00:48 UTC (rev 505) +++ trunk/simexplorer-is-web/pom.xml 2008-01-24 18:01:24 UTC (rev 506) @@ -75,6 +75,7 @@ <groupId>jboss</groupId> <artifactId>jbossall-client</artifactId> <version>4.2.2.GA</version> + <scope>provided</scope> </dependency> </dependencies> </project> \ No newline at end of file Added: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java (rev 0) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,63 @@ +/* +* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.ui.web.pages; + +import org.apache.tapestry.ComponentResources; +import org.apache.tapestry.annotations.Persist; +import org.apache.tapestry.ioc.annotations.Inject; + +import fr.cemagref.simexplorer.is.entities.data.LoggableElement; +import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; +import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; + +public class ElementDelete extends UserPage { + + @Inject + private ComponentResources resources; + + @Persist + private LoggableElement element; + + /** + * Prepare page + * + * @param uuid + * Id of element to display + * @param version + * Version of element to display + * @throws Exception + */ + public void setup(String uuid, String version) throws Exception { + element = RemoteStorageService.getStorageService().getElement( + getToken(), uuid, version); + } + +// public Object onDelete() throws Exception { +// RemoteStorageService.getStorageService().deleteElement(getToken(), +// element.getMetaData().getUuid(), +// element.getMetaData().getVersion()); +// return null; +// } +// +// public Object onDeleteAll() throws Exception { +// RemoteStorageService.getStorageService().deleteElement(getToken(), +// element.getMetaData().getUuid()); +// return null; +// } + +} Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-01-24 18:00:48 UTC (rev 505) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-01-24 18:01:24 UTC (rev 506) @@ -62,8 +62,17 @@ private LoggableElement element; @InjectPage + private ElementExport elementExport; + + @InjectPage private ElementHistory elementHistory; - + + @InjectPage + private ElementDelete elementDelete; + + @InjectPage + private ElementRights elementRights; + /** * Prepare page * @@ -120,7 +129,9 @@ StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); String version = st.nextToken(); - return exportElement(uuid, version); + elementExport.setup(uuid, version); + // exportElement(uuid, version) + return elementExport; } public Object onHistory(String context) throws Exception { @@ -131,11 +142,20 @@ return elementHistory; } + public Object onDelete(String context) throws Exception { + StringTokenizer st = new StringTokenizer(context, ","); + String uuid = st.nextToken(); + String version = st.nextToken(); + elementDelete.setup(uuid, version); + return elementDelete; + } + public Object onRights(String context) throws Exception { StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); String version = st.nextToken(); - return null; + elementRights.setup(uuid, version); + return elementRights; } private Object downloadElement(String uuid, String version) @@ -196,8 +216,8 @@ sb.append(generateString(anAction, anAction, element)); } sb.append("<br>"); + // TODO add security sb.append(generateString("rights", "rights", element)); - // TODO add security res = sb.substring(4); return res; @@ -239,7 +259,7 @@ node.setColumns(generateStringArray("Application exploration", element .getMetaData().getName(), element.getMetaData().getVersion() - .toString(), element, "export", "history")); + .toString(), element, "export", "history", "delete")); List<TreeNode> children = new ArrayList<TreeNode>(); TreeNode node1 = new TreeNode(); @@ -278,7 +298,7 @@ explorationDataNode.setColumns(generateStringArray("Exploration data", explorationData.getMetaData().getName(), explorationData .getMetaData().getVersion().toString(), - explorationData, "history")); + explorationData, "history", "delete")); List<TreeNode> children = new ArrayList<TreeNode>(); @@ -343,7 +363,7 @@ componentNode.setColumns(generateStringArray("Component", component .getMetaData().getName(), component.getMetaData().getVersion() - .toString(), component, "history")); + .toString(), component, "history", "delete")); List<TreeNode> children = new ArrayList<TreeNode>(); Added: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java (rev 0) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,50 @@ +/* +* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.ui.web.pages; + +import org.apache.tapestry.ComponentResources; +import org.apache.tapestry.annotations.Persist; +import org.apache.tapestry.ioc.annotations.Inject; + +import fr.cemagref.simexplorer.is.entities.data.LoggableElement; +import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; +import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; + +public class ElementExport extends UserPage { + + @Inject + private ComponentResources resources; + + @Persist + private LoggableElement element; + + /** + * Prepare page + * + * @param uuid + * Id of element to display + * @param version + * Version of element to display + * @throws Exception + */ + public void setup(String uuid, String version) throws Exception { + element = RemoteStorageService.getStorageService().getElement( + getToken(), uuid, version); + } + +} Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-01-24 18:00:48 UTC (rev 505) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-01-24 18:01:24 UTC (rev 506) @@ -57,9 +57,8 @@ public List<String> getHeaders() { List<String> result = new ArrayList<String>(); result.add("Version"); - result.add("Author"); - result.add("Name"); result.add("Description"); + result.add("Date"); return result; } @@ -73,7 +72,7 @@ Arrays.sort(versions, new MetadataVersionComparator()); TreeNode rootNode = new TreeNode(); rootNode.setType(TreeNode.TYPE_FOLDER); - rootNode.setColumns(generateStringArray("History", "")); + rootNode.setColumns(generateStringArray("History")); rootNode.setObject(new Version("")); rootNode.setChildren(new ArrayList<TreeNode>()); for (MetaDataEntity mde : versions) { @@ -123,7 +122,9 @@ private TreeNode generateLeaf(MetaDataEntity mde) { TreeNode node = new TreeNode(); - node.setColumns(generateStringArray(mde.getVersion().toString())); + // FIXME date tostring + node.setColumns(generateStringArray(mde.getVersion().toString(), mde + .getDescription(), mde.getCreationDate().toString())); node.setObject(mde.getVersion()); node.setType(TreeNode.TYPE_DOCUMENT); return node; Added: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java (rev 0) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,50 @@ +/* +* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.ui.web.pages; + +import org.apache.tapestry.ComponentResources; +import org.apache.tapestry.annotations.Persist; +import org.apache.tapestry.ioc.annotations.Inject; + +import fr.cemagref.simexplorer.is.entities.data.LoggableElement; +import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; +import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; + +public class ElementRights extends UserPage { + + @Inject + private ComponentResources resources; + + @Persist + private LoggableElement element; + + /** + * Prepare page + * + * @param uuid + * Id of element to display + * @param version + * Version of element to display + * @throws Exception + */ + public void setup(String uuid, String version) throws Exception { + element = RemoteStorageService.getStorageService().getElement( + getToken(), uuid, version); + } + +} Added: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java (rev 0) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,44 @@ +/* +* ##% Copyright (C) 2008 Code Lutin, Gabriel Landais +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* ##% */ +package fr.cemagref.simexplorer.is.ui.web.pages; + +import java.io.FileNotFoundException; + +import org.apache.tapestry.services.ExceptionReporter; + +public class ExceptionReport extends + org.apache.tapestry.corelib.pages.ExceptionReport implements + ExceptionReporter { + + private boolean unknown; + + @Override + public void reportException(Throwable exception) { + if (exception instanceof FileNotFoundException) { + unknown = false; + } else { + unknown = true; + super.reportException(exception); + } + } + + public boolean isUnknown() { + return unknown; + } + +} Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java 2008-01-24 18:00:48 UTC (rev 505) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java 2008-01-24 18:01:24 UTC (rev 506) @@ -39,7 +39,12 @@ properties .put("java.naming.factory.url.pkgs", "org.jnp.interfaces"); - Context context = new InitialContext(properties); + Context context = null; + try { + context = new InitialContext(properties); + } catch (Exception e) { + context = new InitialContext(); + } services.put(serviceName, context.lookup(serviceName)); } return services.get(serviceName); Added: trunk/simexplorer-is-web/src/main/webapp/ElementDelete.tml =================================================================== --- trunk/simexplorer-is-web/src/main/webapp/ElementDelete.tml (rev 0) +++ trunk/simexplorer-is-web/src/main/webapp/ElementDelete.tml 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,4 @@ +<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" + title="message:windowtitle"> + +</t:layout> Added: trunk/simexplorer-is-web/src/main/webapp/ElementExport.tml =================================================================== --- trunk/simexplorer-is-web/src/main/webapp/ElementExport.tml (rev 0) +++ trunk/simexplorer-is-web/src/main/webapp/ElementExport.tml 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,4 @@ +<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" + title="message:windowtitle"> + +</t:layout> Added: trunk/simexplorer-is-web/src/main/webapp/ElementRights.tml =================================================================== --- trunk/simexplorer-is-web/src/main/webapp/ElementRights.tml (rev 0) +++ trunk/simexplorer-is-web/src/main/webapp/ElementRights.tml 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,4 @@ +<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" + title="message:windowtitle"> + +</t:layout> Added: trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml =================================================================== --- trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml (rev 0) +++ trunk/simexplorer-is-web/src/main/webapp/ExceptionReport.tml 2008-01-24 18:01:24 UTC (rev 506) @@ -0,0 +1,50 @@ +<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> +<head> +<title>Application Exception</title> +</head> +<body> +<h1 class="t-exception-report">An unexpected application exception +has occurred.</h1> + + +<div class="t-exception-report"> +<ul> + <t:loop source="stack" value="info"> + <li><span class="t-exception-class-name">${info.className}</span> + + <t:if test="info.message"> + <div class="t-exception-message">${info.message}</div> + </t:if> <t:if test="showPropertyList"> + <dl> + <t:loop source="info.propertyNames" value="propertyName"> + <dt>${propertyName}</dt> + <dd><t:renderobject object="propertyValue" /></dd> + </t:loop> + <t:if test="info.stackTrace"> + <dt>Stack trace</dt> + <dd> + <ul class="t-stack-trace"> + <t:loop source="info.stackTrace" value="frame"> + <li>${frame}</li> + </t:loop> + </ul> + </dd> + </t:if> + </dl> + </t:if></li> + </t:loop> +</ul> +</div> +<div class="t-env-data"> +<h2>Request</h2> +<t:renderobject object="request" /> <t:if test="hasSession"> + <h2>Session</h2> + <dl> + <t:loop source="session.attributeNames" value="attributeName"> + <dt>${attributeName}</dt> + <dd><t:renderobject object="attributeValue" /></dd> + </t:loop> + </dl> +</t:if></div> +</body> +</html>