[embjopr-commits] EMBJOPR SVN: r66 - in trunk/core/src/main: java/org/jboss/on/embedded/manager/history and 4 other directories.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Tue Dec 9 00:13:32 EST 2008


Author: ips
Date: 2008-12-09 00:13:32 -0500 (Tue, 09 Dec 2008)
New Revision: 66

Added:
   trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
Modified:
   trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java
   trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationServerServiceImpl.java
   trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java
   trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java
   trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java
   trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
   trunk/core/src/main/webapp/WEB-INF/pages.xml
Log:
maps inside operation results can now be viewed (https://jira.jboss.org/jira/browse/EMBJOPR-52)


Modified: trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java	2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java	2008-12-09 05:13:32 UTC (rev 66)
@@ -54,7 +54,7 @@
 
         if (operationDefinition != null)
         {
-            String jobName = "" + jobNameId.incrementAndGet();
+            String jobName = String.valueOf(jobNameId.incrementAndGet());
             operationHistory =
                     new ResourceOperationHistory(jobName,
                             "",
@@ -63,13 +63,14 @@
                             parameters,
                             resource,
                             null); //GroupOperationHistory
+            operationHistory.setId(operationHistory.getJobId().hashCode());
             addToMaps(operationHistory, resource, resourceType);
         }
 
         return operationHistory;
     }
 
-    private OperationDefinition getOperationDefinition(String operationName, ResourceType resourceType)
+    private static OperationDefinition getOperationDefinition(String operationName, ResourceType resourceType)
     {
         Set<OperationDefinition> operationDefinitions = resourceType.getOperationDefinitions();
         OperationDefinition operationDefinition = null;
@@ -82,6 +83,7 @@
         }
         return operationDefinition;
     }
+    
     protected String getJobId(OperationHistory history)
     {
         return history.getJobId().toString();

Modified: trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationServerServiceImpl.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationServerServiceImpl.java	2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationServerServiceImpl.java	2008-12-09 05:13:32 UTC (rev 66)
@@ -53,6 +53,7 @@
         history.setStatus(OperationRequestStatus.SUCCESS);        
         if (history instanceof ResourceOperationHistory)
         {
+           results.setId(history.getId());
            ((ResourceOperationHistory)history).setResults(results);
         }
     }

Modified: trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java	2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java	2008-12-09 05:13:32 UTC (rev 66)
@@ -21,7 +21,6 @@
 
 import org.rhq.core.domain.resource.Resource;
 import org.rhq.core.domain.resource.ResourceType;
-import org.jboss.on.embedded.manager.history.HistoryManager;
 
 import java.util.ArrayList;
 import java.util.Collection;

Modified: trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java	2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java	2008-12-09 05:13:32 UTC (rev 66)
@@ -26,7 +26,6 @@
 
 public interface HistoryManager<T>
 {
-
     public T getHistory(String historyId);
 
     public Collection<T> getAllHistory();

Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java	2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java	2008-12-09 05:13:32 UTC (rev 66)
@@ -47,6 +47,8 @@
 import java.util.Comparator;
 import java.util.List;
 import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
 
 import javax.faces.application.FacesMessage;
 
@@ -79,6 +81,8 @@
     @Out(required = false)
     private List<ResourceOperationHistory> operationHistory;
 
+    Map<Integer, ResourceOperationHistory> operationHistoryMap = new HashMap<Integer, ResourceOperationHistory>();
+
     @Out(required = false)
     private OperationDefinition selectedOperation;
 
@@ -112,7 +116,8 @@
             initSelectedOperationInfo();
             return "missingParams";
         } else {
-            OperationHistory newOperationHistory = this.historyManager.addOperationHistory(operationDef.getName(), null, this.currentResource, resourceType);
+            OperationHistory newOperationHistory = this.historyManager.addOperationHistory(operationDef.getName(), null,
+                    this.currentResource, resourceType);
             newOperationHistory.setParameters(this.selectedOperationParameters);
             ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
             String jobId = newOperationHistory.getJobId().toString();
@@ -174,6 +179,10 @@
         return styleClass;
     }
 
+    public ResourceOperationHistory getOperationHistory(int jobId) {
+        return this.operationHistoryMap.get(jobId);
+    }
+
     private ResourceType getResourceType() {
         currentResource = commonActionUtil.getCurrentResource();
         //noinspection UnnecessaryLocalVariable
@@ -194,9 +203,10 @@
         if (opHistories != null)
         {
             operationHistory = new ArrayList<ResourceOperationHistory>();
-            for (OperationHistory opHistory : opHistories)
-            {
-                this.operationHistory.add((ResourceOperationHistory)opHistory);
+            for (OperationHistory opHistory : opHistories) {
+                ResourceOperationHistory resourceOpHistory = (ResourceOperationHistory)opHistory;
+                this.operationHistory.add(resourceOpHistory);
+                this.operationHistoryMap.put(resourceOpHistory.getId(), resourceOpHistory);
             }
 
             Collections.sort(operationHistory, new Comparator<OperationHistory>()
@@ -225,6 +235,12 @@
         }
     }
 
+    public Map<Integer, ResourceOperationHistory> getOperationHistoryMap()
+    {
+
+        return operationHistoryMap;
+    }
+
     private void initSelectedOperationInfo()
     {
         ResourceType resourceType = getResourceType();

Modified: trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/classes/messages.properties	2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/webapp/WEB-INF/classes/messages.properties	2008-12-09 05:13:32 UTC (rev 66)
@@ -137,6 +137,8 @@
 control.resourceInstance.previous.parameters=Parameters
 control.resourceInstance.previous.results=Results
 control.resourceInstance.previous.error=Error
+control.resourceInstance.previous.map.button.ok=OK
+control.resourceInstance.previous.map.buttonLabel.ok=Return to Control Tab
 
 #This is a workaround for JBMANCON-370. This can be deleted once 
 #JBMANCON-370 is resolved.

Modified: trunk/core/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/pages.xml	2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/webapp/WEB-INF/pages.xml	2008-12-09 05:13:32 UTC (rev 66)
@@ -140,7 +140,11 @@
 
         <!-- Run this method before rendering the page. -->
         <action execute="#{operationAction.initOperationsAndHistory()}"/>
-        
+
+        <navigation from-action="#{ConfigHelperUIBean.accessMap}">
+            <render view-id="/secure/viewResultsMap.xhtml"/>
+        </navigation>
+
         <navigation from-action="#{operationAction.invokeOperation()}">
             <rule if-outcome="missingParams">
                 <render view-id="/secure/operationParameters.xhtml"/>

Added: trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/viewResultsMap.xhtml	                        (rev 0)
+++ trunk/core/src/main/webapp/secure/viewResultsMap.xhtml	2008-12-09 05:13:32 UTC (rev 66)
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ Embedded Jopr Project
+  ~ Copyright (C) 2006-2008 Red Hat, Inc.
+  ~ All rights reserved.
+  ~
+  ~ This program is free software; you can redistribute it and/or modify
+  ~ it under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This 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
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this program; if not, write to the Free Software
+  ~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  -->
+<!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"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:s="http://jboss.com/products/seam/taglib"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:onc="http://jboss.org/on/component">
+
+THIS TEXT WILL BE REMOVED.
+
+<ui:composition template="/layout.xhtml">
+
+    THIS TEXT WILL BE REMOVED AS WELL.
+
+    <ui:define name="pagetitle">
+        '#{operationAction.getOperationHistory(param.configId).operationDefinition.displayName}' Operation -
+        Results Item: #{param.listName}[#{param.listIndex}]
+    </ui:define>
+
+    <ui:define name="body">
+
+        <p>
+            Below is the #{param.listName}[#{param.listIndex}] item from the results of the
+            execution of the #{operationAction.getOperationHistory(param.configId).operationDefinition.displayName}
+            operation.
+        </p>
+
+        <p/>
+
+        <h:form id="resourceConfigurationForm" onsubmit="prepareInputsForSubmission(this)">
+
+            <onc:config configurationDefinition="#{operationAction.getOperationHistory(param.configId).operationDefinition.resultsConfigurationDefinition}"
+                        configuration="#{operationAction.getOperationHistory(param.configId).results}"
+                        listName="#{param.listName}"
+                        listIndex="#{param.listIndex}"
+                        readOnly="true"/>
+
+            <h:panelGrid columns="1" styleClass="buttons-table" columnClasses="button-cell">
+                <h:panelGroup layout="block">
+                   <div title="#{messages['control.resourceInstance.previous.map.buttonLabel.ok']}"
+                        onclick="history.back()" class="buttonmed">
+                        #{messages['control.resourceInstance.previous.map.button.ok']}
+                   </div>
+                </h:panelGroup>
+            </h:panelGrid>
+
+        </h:form>
+
+    </ui:define>
+
+</ui:composition>
+
+THIS TEXT WILL BE REMOVED AS WELL.
+
+</html>
+        
\ No newline at end of file


Property changes on: trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + Date Author Id Revision HeadURL
Name: svn:eol-style
   + LF




More information about the embjopr-commits mailing list