[wise-commits] wise SVN: r450 - in webgui/branches: cdi-jsf and 11 other directories.

wise-commits at lists.jboss.org wise-commits at lists.jboss.org
Fri Jan 18 12:28:10 EST 2013


Author: alessio.soldano at jboss.com
Date: 2013-01-18 12:28:10 -0500 (Fri, 18 Jan 2013)
New Revision: 450

Added:
   webgui/branches/cdi-jsf/
   webgui/branches/cdi-jsf/README.md
   webgui/branches/cdi-jsf/pom.xml
   webgui/branches/cdi-jsf/src/
   webgui/branches/cdi-jsf/src/main/
   webgui/branches/cdi-jsf/src/main/java/
   webgui/branches/cdi-jsf/src/main/java/org/
   webgui/branches/cdi-jsf/src/main/java/org/jboss/
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Operation.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Port.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Service.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/WiseGuiBean.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ComplexWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/DurationWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EnumerationWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/GroupWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ParameterizedWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/QNameWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElementFactory.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElementBuilder.java
   webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/XMLGregorianWiseTreeElement.java
   webgui/branches/cdi-jsf/src/main/webapp/
   webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/
   webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/beans.xml
   webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/faces-config.xml
   webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/web.xml
   webgui/branches/cdi-jsf/src/main/webapp/index.xhtml
   webgui/branches/cdi-jsf/src/main/webapp/templates/
   webgui/branches/cdi-jsf/src/main/webapp/templates/template.xhtml
Log:
Initial checkout of alternative Wise GUI


Added: webgui/branches/cdi-jsf/README.md
===================================================================
--- webgui/branches/cdi-jsf/README.md	                        (rev 0)
+++ webgui/branches/cdi-jsf/README.md	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,69 @@
+JBoss Wise GUI
+==================================================================
+
+System requirements
+-------------------
+
+All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven 3.0 or better.
+
+The application this project produces is designed to be run on JBoss Enterprise Application Platform 6 or JBoss AS 7. 
+
+ 
+Configure Maven
+---------------
+
+If you have not yet done so, you must [Configure Maven](../README.md#mavenconfiguration) before testing the quickstarts.
+
+
+Start JBoss Enterprise Application Platform 6 or JBoss AS 7 with the Web Profile
+-------------------------
+
+1. Open a command line and navigate to the root of the JBoss server directory.
+2. The following shows the command line to start the server with the web profile:
+
+        For Linux:   JBOSS_HOME/bin/standalone.sh
+        For Windows: JBOSS_HOME\bin\standalone.bat
+
+ 
+Build and Deploy the Quickstart
+-------------------------
+
+_NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line. See [Build and Deploy the Quickstarts](../README.md#buildanddeploy) for complete instructions and additional options._
+
+1. Make sure you have started the JBoss Server as described above.
+2. Open a command line and navigate to the root directory of this quickstart.
+3. Type this command to build and deploy the archive:
+
+        mvn clean package jboss-as:deploy
+
+4. This will deploy `target/wise-gui.war` to the running instance of the server.
+
+
+Access the application 
+---------------------
+
+The application will be running at the following URL:  <http://localhost:8080/wise-gui/>.
+
+
+Undeploy the Archive
+--------------------
+
+1. Make sure you have started the JBoss Server as described above.
+2. Open a command line and navigate to the root directory of this quickstart.
+3. When you are finished testing, type this command to undeploy the archive:
+
+        mvn jboss-as:undeploy
+
+
+Run the Quickstart in JBoss Developer Studio or Eclipse
+-------------------------------------
+You can also start the server and deploy the quickstarts from Eclipse using JBoss tools. For more information, see [Use JBoss Developer Studio or Eclipse to Run the Quickstarts](../README.md#useeclipse) 
+
+
+Debug the Application
+------------------------------------
+
+If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them.
+
+        mvn dependency:sources
+        mvn dependency:resolve -Dclassifier=javadoc

Added: webgui/branches/cdi-jsf/pom.xml
===================================================================
--- webgui/branches/cdi-jsf/pom.xml	                        (rev 0)
+++ webgui/branches/cdi-jsf/pom.xml	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,154 @@
+<?xml version="1.0"?>
+<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc. 
+    and/or its affiliates, and individual contributors by the @authors tag. See 
+    the copyright.txt in the distribution for a full listing of individual contributors. 
+    Licensed under the Apache License, Version 2.0 (the "License"); you may not 
+    use this file except in compliance with the License. You may obtain a copy 
+    of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+
+   <groupId>org.jboss.wise.gui</groupId>
+   <artifactId>wise-gui</artifactId>
+   <version>1.0.0-SNAPSHOT</version>
+   <packaging>war</packaging>
+   <name>JBoss Wise GUI</name>
+   <description>A GUI for JBoss Wise Core</description>
+
+   <url>http://jboss.org/wise</url>
+   <licenses>
+      <license>
+         <name>Apache License, Version 2.0</name>
+         <distribution>repo</distribution>
+         <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+      </license>
+   </licenses>
+
+   <properties>
+      <!-- Explicitly declaring the source encoding eliminates the following 
+         message: -->
+      <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered 
+         resources, i.e. build is platform dependent! -->
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+      <!-- JBoss dependency versions -->
+      <version.org.jboss.as.plugins.maven.plugin>7.3.Final</version.org.jboss.as.plugins.maven.plugin>
+      <version.org.jboss.spec.jboss.javaee.6.0>3.0.0.Final</version.org.jboss.spec.jboss.javaee.6.0>
+       
+      <version.org.richfaces>4.2.0.Final</version.org.richfaces>
+      <version.wise.core>2.0.0-SNAPSHOT</version.wise.core>
+
+      <!-- other plugin versions -->
+      <version.compiler.plugin>2.3.1</version.compiler.plugin>
+
+      <!-- maven-compiler-plugin -->
+      <maven.compiler.target>1.6</maven.compiler.target>
+      <maven.compiler.source>1.6</maven.compiler.source>
+   </properties>
+
+   <dependencyManagement>
+      <dependencies>
+         <!-- Define the version of JBoss' Java EE 6 APIs we want to import. 
+            Any dependencies from org.jboss.spec will have their version defined by this 
+            BOM -->
+         <!-- JBoss distributes a complete set of Java EE 6 APIs including
+            a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
+            a collection) of artifacts. We use this here so that we always get the correct
+            versions of artifacts. Here we use the jboss-javaee-6.0 stack (you can
+            read this as the JBoss stack of the Java EE 6 APIs). You can actually
+            use this stack with any version of JBoss AS that implements Java EE 6, not
+            just JBoss AS 7! -->
+         <dependency>
+            <groupId>org.jboss.spec</groupId>
+            <artifactId>jboss-javaee-6.0</artifactId>
+            <version>${version.org.jboss.spec.jboss.javaee.6.0}</version>
+            <type>pom</type>
+            <scope>import</scope>
+         </dependency>
+         <!-- Similarly to the JBoss Java EE 6 BOM above, the RichFaces BOM specifies the
+           versions of artifacts required for using RichFaces in your project. -->
+         <dependency>
+              <groupId>org.richfaces</groupId>
+              <artifactId>richfaces-bom</artifactId>
+              <version>${version.org.richfaces}</version>
+              <type>pom</type>
+              <scope>import</scope>
+         </dependency>
+         
+         <dependency>
+              <groupId>org.jboss.wise</groupId>
+              <artifactId>wise-core-cxf</artifactId>
+              <version>${version.wise.core}</version>
+         </dependency>
+
+      </dependencies>
+   </dependencyManagement>
+
+   <dependencies>
+
+      <!-- Import the CDI API, we use provided scope as the API is included in JBoss AS 7 -->
+      <dependency>
+         <groupId>javax.enterprise</groupId>
+         <artifactId>cdi-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <!-- Import the Common Annotations API (JSR-250), we use provided scope as the API is included in JBoss AS 7 -->
+      <dependency>
+         <groupId>org.jboss.spec.javax.annotation</groupId>
+         <artifactId>jboss-annotations-api_1.1_spec</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <!-- Import the JSF API, we use provided scope as the API is included in JBoss AS 7 -->
+      <dependency>
+         <groupId>org.jboss.spec.javax.faces</groupId>
+         <artifactId>jboss-jsf-api_2.1_spec</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <!-- Import the RichFaces core library -->
+      <dependency>
+         <groupId>org.richfaces.core</groupId>
+         <artifactId>richfaces-core-impl</artifactId>
+      </dependency>
+      <!-- Import the RichFaces components -->
+      <dependency>
+         <groupId>org.richfaces.ui</groupId>
+         <artifactId>richfaces-components-ui</artifactId>
+      </dependency>
+      
+      <dependency>
+         <groupId>org.jboss.wise</groupId>
+         <artifactId>wise-core-cxf</artifactId>
+      </dependency>
+
+   </dependencies>
+
+   <build>
+      <!-- Set the name of the war, used as the context root when the app is deployed -->
+      <finalName>wise-gui</finalName>
+      <plugins>
+         <plugin>
+            <groupId>org.jboss.as.plugins</groupId>
+            <artifactId>jboss-as-maven-plugin</artifactId>
+            <version>${version.org.jboss.as.plugins.maven.plugin}</version>
+         </plugin>
+         <!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation processors -->
+         <plugin>
+            <artifactId>maven-compiler-plugin</artifactId>
+             <version>${version.compiler.plugin}</version>
+             <configuration>
+                 <source>${maven.compiler.source}</source>
+                 <target>${maven.compiler.target}</target>
+            </configuration>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>
+

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/ClientConversationBean.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,241 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui;
+
+import java.io.Serializable;
+import java.lang.reflect.Type;
+import java.net.ConnectException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.StringTokenizer;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.jboss.wise.core.client.InvocationResult;
+import org.jboss.wise.core.client.WSDynamicClient;
+import org.jboss.wise.core.client.WSEndpoint;
+import org.jboss.wise.core.client.WSMethod;
+import org.jboss.wise.core.client.WSService;
+import org.jboss.wise.core.client.WebParameter;
+import org.jboss.wise.core.client.builder.WSDynamicClientBuilder;
+import org.jboss.wise.core.client.factories.WSDynamicClientFactory;
+import org.jboss.wise.gui.treeElement.WiseTreeElement;
+import org.jboss.wise.gui.treeElement.WiseTreeElementBuilder;
+import org.richfaces.component.UITree;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.model.TreeNodeImpl;
+
+ at Named
+ at ConversationScoped
+public class ClientConversationBean implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    
+    private static WSDynamicClientBuilder clientBuilder;
+    
+    @Inject Conversation conversation;
+    private WSDynamicClient client;
+    private String wsdlUrl;
+    private List<Service> services;
+    private String currentOperation;
+    private TreeNodeImpl inputTree;
+    private TreeNodeImpl outputTree;
+    private UITree inTree;
+    private UITree outTree;
+    
+    public void init() throws ConnectException {
+	client = getClientBuilder().tmpDir("/tmp/wise").verbose(true).keepSource(true).wsdlURL(getWsdlUrl()).build();
+	conversation.begin(); //TODO!!!
+	
+	services = convertServicesToGui(client.processServices());
+    }
+    
+    public void parseOperationParameters() {
+	StringTokenizer st = new StringTokenizer(currentOperation, ";");
+	String serviceName = st.nextToken();
+	String portName = st.nextToken();
+	String operationName = st.nextToken();
+	try {
+	    inputTree = convertOperationParametersToGui(client.getWSMethod(serviceName, portName, operationName));
+	} catch (Exception e) {
+	    throw new RuntimeException(e);
+	}
+    }
+    
+    public void performInvocation() {
+	StringTokenizer st = new StringTokenizer(currentOperation, ";");
+	String serviceName = st.nextToken();
+	String portName = st.nextToken();
+	String operationName = st.nextToken();
+	try {
+	    WSMethod wsMethod = client.getWSMethod(serviceName, portName, operationName);
+	    Map<String, Object> params = new HashMap<String, Object>();
+	    for (Iterator<Object> it = inputTree.getChildrenKeysIterator(); it.hasNext(); ) {
+		WiseTreeElement wte = (WiseTreeElement)inputTree.getChild(it.next());
+		params.put(wte.getName(), wte.toObject());
+	    }
+	    outputTree = convertOperationResultToGui(wsMethod.invoke(params));
+	} catch (Exception e) {
+	    throw new RuntimeException(e);
+	}
+	
+    }
+    
+    private static TreeNodeImpl convertOperationParametersToGui(WSMethod wsMethod) {
+	WiseTreeElementBuilder builder = new WiseTreeElementBuilder();
+	TreeNodeImpl rootElement = new TreeNodeImpl();
+	Collection<? extends WebParameter> parameters = wsMethod.getWebParams().values();
+	for (WebParameter parameter : parameters) {
+	    WiseTreeElement wte = builder.buildTreeFromType(parameter.getType(), parameter.getName(), null); //TODO client for parameterized types...
+	    rootElement.addChild(wte.getId(), wte);
+	}
+	return rootElement;
+    }
+    
+    private static TreeNodeImpl convertOperationResultToGui(InvocationResult result) {
+	WiseTreeElementBuilder builder = new WiseTreeElementBuilder();
+	TreeNodeImpl rootElement = new TreeNodeImpl();
+	for (Entry<String, Object> res : result.getResult().entrySet()) {
+	    Object resObj = res.getValue();
+	    WiseTreeElement wte = builder.buildTreeFromType(resObj.getClass(), res.getKey(), null, resObj); //TODO client for parameterized types...
+	    rootElement.addChild(wte.getId(), wte);
+	}
+	return rootElement;
+    }
+    
+    private static List<Service> convertServicesToGui(Map<String, WSService> servicesMap) {
+	List<Service> services = new LinkedList<Service>();
+	for (Entry<String, WSService> serviceEntry : servicesMap.entrySet()) {
+	    Service service = new Service();
+	    services.add(service);
+	    service.setName(serviceEntry.getKey());
+	    List<Port> ports = new LinkedList<Port>();
+	    service.setPorts(ports);
+	    for (Entry<String, WSEndpoint> endpointEntry : serviceEntry.getValue().processEndpoints().entrySet()) {
+		Port port = new Port();
+		port.setName(endpointEntry.getKey());
+		ports.add(port);
+		List<Operation> operations = new LinkedList<Operation>();
+		port.setOperations(operations);
+		for (Entry<String, WSMethod> methodEntry : endpointEntry.getValue().getWSMethods().entrySet()) {
+		    Operation operation = new Operation();
+		    operation.setName(methodEntry.getKey());
+		    StringBuilder sb = new StringBuilder();
+		    sb.append(methodEntry.getKey());
+		    sb.append("(");
+		    Iterator<? extends WebParameter> paramIt = methodEntry.getValue().getWebParams().values().iterator();
+		    while (paramIt.hasNext()) {
+			WebParameter param = paramIt.next();
+			Type type = param.getType();
+			sb.append(type instanceof Class<?> ? ((Class<?>)type).getSimpleName() : type.toString());
+			sb.append(" ");
+			sb.append(param.getName());
+			if (paramIt.hasNext()) {
+			    sb.append(", ");
+			}
+		    }
+		    sb.append(")");
+		    operation.setFullName(sb.toString());
+		    operations.add(operation);
+		}
+	    }
+	}
+	return services;
+    }
+    
+    public void close() {
+	conversation.end(); //TODO!!!
+	if (client != null) {
+	    client.close();
+	}
+    }
+    
+    public void updateCurrentOperation(ItemChangeEvent event){
+	  setCurrentOperation(event.getNewItemName());
+	}
+    
+    public String getWsdlUrl() {
+        return wsdlUrl;
+    }
+
+    public void setWsdlUrl(String wsdlUrl) {
+        this.wsdlUrl = wsdlUrl;
+    }
+
+    public List<Service> getServices() {
+        return services;
+    }
+
+    public void setServices(List<Service> services) {
+        this.services = services;
+    }
+
+    public String getCurrentOperation() {
+        return currentOperation;
+    }
+
+    public void setCurrentOperation(String currentOperation) {
+        this.currentOperation = currentOperation;
+    }
+
+    public UITree getInTree() {
+        return inTree;
+    }
+
+    public void setInTree(UITree inTree) {
+        this.inTree = inTree;
+    }
+
+    public UITree getOutTree() {
+        return outTree;
+    }
+
+    public void setOutTree(UITree outTree) {
+        this.outTree = outTree;
+    }
+
+    public TreeNodeImpl getInputTree() {
+        return inputTree;
+    }
+
+    public void setInputTree(TreeNodeImpl inputTree) {
+        this.inputTree = inputTree;
+    }
+
+    public TreeNodeImpl getOutputTree() {
+        return outputTree;
+    }
+
+    public void setOutputTree(TreeNodeImpl outputTree) {
+        this.outputTree = outputTree;
+    }
+
+    private static synchronized WSDynamicClientBuilder getClientBuilder() {
+	if (clientBuilder == null) {
+	    clientBuilder = WSDynamicClientFactory.getJAXWSClientBuilder();
+	}
+	return clientBuilder;
+    }
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Operation.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Operation.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Operation.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui;
+
+import java.io.Serializable;
+
+public class Operation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String name;
+    private String fullName;
+
+    public String getFullName() {
+        return fullName;
+    }
+
+    public void setFullName(String fullName) {
+        this.fullName = fullName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Port.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Port.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Port.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class Port implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String name;
+    private List<Operation> operations;
+
+    public List<Operation> getOperations() {
+        return operations;
+    }
+
+    public void setOperations(List<Operation> operations) {
+        this.operations = operations;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Service.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Service.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/Service.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class Service implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String name;
+    private List<Port> ports;
+
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public List<Port> getPorts() {
+        return ports;
+    }
+    public void setPorts(List<Port> ports) {
+        this.ports = ports;
+    }
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/WiseGuiBean.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/WiseGuiBean.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/WiseGuiBean.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * <p>
+ * {@link WiseGuiBean} is the JSF backing bean for the application, holding the input data to be
+ * re-displayed.
+ * </p>
+ * 
+ */
+ at Named
+ at SessionScoped
+public class WiseGuiBean implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @Inject
+    private ClientConversationBean client;
+
+    
+    
+    
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ComplexWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ComplexWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ComplexWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.jboss.logging.Logger;
+import org.jboss.wise.core.exception.WiseRuntimeException;
+import org.jboss.wise.core.utils.IDGenerator;
+import org.jboss.wise.core.utils.ReflectionUtils;
+
+/**
+ * A WiseTreeElement for non primitive/simple types.
+ * 
+ * @author Alessio Soldano, alessio.soldano at jboss.com
+ * 
+ */
+public class ComplexWiseTreeElement extends WiseTreeElement {
+
+    private static final long serialVersionUID = 1L;
+
+    private ComplexWiseTreeElement() {
+	this.kind = COMPLEX;
+	this.id = IDGenerator.nextVal();
+    }
+
+    public ComplexWiseTreeElement(Type classType, String name) {
+	this.id = IDGenerator.nextVal();
+	this.kind = COMPLEX;
+	this.classType = classType;
+	this.nil = false;
+	this.name = name;
+
+    }
+
+    public WiseTreeElement clone() {
+	ComplexWiseTreeElement element = new ComplexWiseTreeElement();
+	Iterator<Object> keyIt = this.getChildrenKeysIterator();
+	while (keyIt.hasNext()) {
+	    WiseTreeElement child = (WiseTreeElement)this.getChild(keyIt.next());
+	    element.addChild(child.getId(), child.clone());
+	}
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	return element;
+    }
+
+    @SuppressWarnings("unchecked")
+    public Object toObject() {
+	Object obj = null;
+	try {
+	    Class<?> cl = (Class<?>) classType;
+	    obj = cl.newInstance();
+	    
+	    Iterator<Object> keyIt = this.getChildrenKeysIterator();
+	    while (keyIt.hasNext()) {
+		WiseTreeElement child = (WiseTreeElement)this.getChild(keyIt.next());
+		String setter = ReflectionUtils.setterMethodName(child.getName(), child.isTypeBoolean());
+		String getter = ReflectionUtils.getterMethodName(child.getName(), child.isTypeBoolean());
+
+		Logger.getLogger(this.getClass()).debug("Setter: " + setter);
+		Method method;
+		if (child instanceof GroupWiseTreeElement) {
+		    Logger.getLogger(this.getClass()).debug("Child is a group...");
+		    method = cl.getMethod(getter, (Class[]) null);
+		    Collection<?> col = (Collection<?>) method.invoke(obj, (Object[]) null);
+		    col.addAll((List) child.toObject());
+		} else {
+		    Logger.getLogger(this.getClass()).debug("Child is not a group...");
+		    Object childObject = child.toObject();
+		    if (child instanceof ParameterizedWiseTreeElement) {
+			method = cl.getMethod(setter, (Class<?>) ((ParameterizedType) child.getClassType()).getRawType());
+		    } else {
+			if (childObject == null) {
+			    continue;
+			}
+			Class<?> fieldClass = (Class<?>) child.getClassType();
+			if (Duration.class.isAssignableFrom(fieldClass)) {
+			    method = cl.getMethod(setter, Duration.class);
+			} else if (XMLGregorianCalendar.class.isAssignableFrom(fieldClass)) {
+			    method = cl.getMethod(setter, XMLGregorianCalendar.class);
+			} else {
+			    method = cl.getMethod(setter, fieldClass);
+			}
+
+		    }
+		    method.invoke(obj, childObject);
+		    // TODO!!! Remove the following check once we're confident
+		    method = cl.getMethod(getter, (Class[]) null);
+		    Logger.getLogger(this.getClass()).debug("[FIXME: remove check] risultato getter " + getter + ": " + method.invoke(obj, (Object[]) null));
+		}
+	    }
+	} catch (Exception e) {
+	    throw new WiseRuntimeException("Error converting element to object", e);
+	}
+	return obj;
+    }
+
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/DurationWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/DurationWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/DurationWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+
+import org.jboss.wise.core.exception.WiseRuntimeException;
+
+/**
+ * A simple tree element to handle durations.
+ * 
+ * @author alessio.soldano at jboss.com
+ * 
+ */
+public class DurationWiseTreeElement extends SimpleWiseTreeElement {
+
+    private static final long serialVersionUID = 5492389675960954725L;
+
+    public DurationWiseTreeElement() {
+	this.kind = DURATION;
+    }
+
+    public DurationWiseTreeElement(Class<?> classType, String name, String value) {
+	this.kind = DURATION;
+	this.classType = classType;
+	this.nil = value == null;
+	this.name = name;
+	this.value = value;
+    }
+
+    @Override
+    public WiseTreeElement clone() {
+	DurationWiseTreeElement element = new DurationWiseTreeElement();
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	element.setValue(this.value);
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	return element;
+    }
+
+    @Override
+    public void parseObject(Object obj) {
+	if (obj != null) {
+	    this.setValue(((Duration) obj).toString());
+	} else {
+	    this.setValue(null);
+	}
+    }
+
+    @Override
+    public Object toObject() {
+	Object result = null;
+	try {
+	    result = DatatypeFactory.newInstance().newDuration(Long.parseLong(value));
+	} catch (DatatypeConfigurationException e) {
+	    throw new WiseRuntimeException("Error converting element to object, type format error?", e);
+	}
+	return result;
+    }
+}
\ No newline at end of file

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EnumerationWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EnumerationWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/EnumerationWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.wise.core.exception.WiseRuntimeException;
+
+/**
+ * A simple tree element to handle enumerations.
+ * 
+ * @author alessio.soldano at jboss.com
+ */
+public class EnumerationWiseTreeElement extends SimpleWiseTreeElement {
+
+    private static final long serialVersionUID = 5492389675960954725L;
+
+    public EnumerationWiseTreeElement() {
+	this.kind = ENUMERATION;
+    }
+
+    public EnumerationWiseTreeElement(Class<?> classType, String name, String value) {
+	this.kind = ENUMERATION;
+	this.classType = classType;
+	this.nil = value == null;
+	this.name = name;
+	this.value = value;
+    }
+
+    @Override
+    public WiseTreeElement clone() {
+	EnumerationWiseTreeElement element = new EnumerationWiseTreeElement();
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	element.setValue(this.value);
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	return element;
+    }
+
+    @Override
+    public void parseObject(Object obj) {
+	if (obj != null) {
+	    try {
+		Method method = obj.getClass().getMethod("value");
+		this.value = (String) method.invoke(obj);
+		this.nil = value == null;
+	    } catch (Exception e) {
+		throw new WiseRuntimeException("Type format error", e);
+	    }
+	} else {
+	    this.setValue(null);
+	}
+    }
+
+    /**
+     * Gets the valid values of the enumeration corresponding to this tree
+     * element.
+     * 
+     * @return
+     */
+    public Map<String, String> getValidValue() {
+	HashMap<String, String> returnMap = new HashMap<String, String>();
+	for (Object obj : ((Class<?>) classType).getEnumConstants()) {
+	    System.out.print("class:" + obj.getClass());
+	    String valueOfEnum;
+	    try {
+		Method method = obj.getClass().getMethod("value");
+		valueOfEnum = (String) method.invoke(obj);
+		returnMap.put(valueOfEnum, valueOfEnum);
+	    } catch (Exception e) {
+		throw new WiseRuntimeException("Type format error", e);
+	    }
+	}
+	return returnMap;
+    }
+
+    @Override
+    public Object toObject() {
+	Class<?> cl = (Class<?>) classType;
+	try {
+	    if (this.isNil()) {
+		return null;
+	    }
+	    Method method = cl.getMethod("fromValue", String.class);
+	    Object obj = method.invoke(null, value);
+	    System.out.print("returning:" + obj);
+	    System.out.print("returning:" + obj.getClass());
+	    return obj;
+	} catch (Exception e) {
+	    throw new WiseRuntimeException("Type format error", e);
+	}
+    }
+}
\ No newline at end of file

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/GroupWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/GroupWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/GroupWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.lang.reflect.Type;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.jboss.wise.core.utils.IDGenerator;
+
+/**
+ * This tree element is for arrays and collections of elements
+ * 
+ * @author Alessio Soldano, alessio.soldano at jboss.com
+ */
+public class GroupWiseTreeElement extends WiseTreeElement {
+
+    private static final long serialVersionUID = 1L;
+
+    private WiseTreeElement prototype;
+
+    private GroupWiseTreeElement() {
+	this.kind = GROUP;
+	this.id = IDGenerator.nextVal();
+    }
+
+    public GroupWiseTreeElement(Type classType, String name, WiseTreeElement prototype) {
+	this.kind = GROUP;
+	this.id = IDGenerator.nextVal();
+	this.classType = classType;
+	this.nil = false;
+	this.name = name;
+	this.prototype = prototype;
+    }
+
+    public WiseTreeElement getPrototype() {
+	return prototype;
+    }
+
+    public void setPrototype(WiseTreeElement prototype) {
+	this.prototype = prototype;
+    }
+
+    public WiseTreeElement clone() {
+	GroupWiseTreeElement element = new GroupWiseTreeElement();
+	Iterator<Object> keyIt = this.getChildrenKeysIterator();
+	while (keyIt.hasNext()) {
+	    WiseTreeElement child = (WiseTreeElement)this.getChild(keyIt.next());
+	    element.addChild(child.getId(), child.clone());
+	}
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	if (this.prototype != null) {
+	    element.setPrototype((WiseTreeElement) this.prototype.clone());
+	}
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	return element;
+    }
+
+    /**
+     * To be used to add a brand new child to this component
+     * 
+     * @return
+     */
+    public WiseTreeElement incrementChildren() {
+	WiseTreeElement component = (WiseTreeElement) prototype.clone();
+	component.setRemovable(true);
+	addChild(component.getId(), component);
+	return component;
+    }
+
+    public Object toObject() {
+	LinkedList<Object> returnList = new LinkedList<Object>();
+	Iterator<Object> keyIt = this.getChildrenKeysIterator();
+	while (keyIt.hasNext()) {
+	    WiseTreeElement child = (WiseTreeElement)this.getChild(keyIt.next());
+	    returnList.add(child.toObject());
+	}
+	return returnList;
+    }
+
+    public int getSize() {
+	Iterator<Object> keyIt = this.getChildrenKeysIterator();
+	int i = 0;
+	while (keyIt.hasNext()) {
+	    i++;
+	    keyIt.next();
+	}
+	return i;
+    }
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ParameterizedWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ParameterizedWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/ParameterizedWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.lang.reflect.ParameterizedType;
+import java.util.Iterator;
+
+import org.jboss.wise.core.client.WSDynamicClient;
+import org.jboss.wise.core.exception.WiseRuntimeException;
+import org.jboss.wise.core.utils.IDGenerator;
+
+/**
+ * A tree element to handle JAXBElement<T>.
+ * 
+ * @author alessio.soldano at jboss.com
+ */
+public class ParameterizedWiseTreeElement extends WiseTreeElement {
+
+    private static final long serialVersionUID = 5492389675960954725L;
+
+    private WSDynamicClient client;
+
+    private Class<?> scope;
+
+    private String namespace;
+
+    public ParameterizedWiseTreeElement() {
+	this.kind = PARAMETERIZED;
+	this.id = IDGenerator.nextVal();
+    }
+
+    public ParameterizedWiseTreeElement(ParameterizedType classType, String name, WSDynamicClient client, Class<?> scope, String namespace) {
+	this.kind = PARAMETERIZED;
+	this.id = IDGenerator.nextVal();
+	this.classType = classType;
+	this.nil = false;
+	this.name = name;
+	this.client = client;
+	this.scope = scope;
+	this.namespace = namespace;
+    }
+
+    @Override
+    public WiseTreeElement clone() {
+	ParameterizedWiseTreeElement element = new ParameterizedWiseTreeElement();
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	element.setClient(this.client);
+	element.setScope(this.scope);
+	element.setNamespace(this.namespace);
+	Iterator<Object> keyIt = this.getChildrenKeysIterator();
+	while (keyIt.hasNext()) { // actually 1 child only
+	    WiseTreeElement child = (WiseTreeElement)this.getChild(keyIt.next());
+	    element.addChild(child.getId(), (WiseTreeElement) child.clone());
+	}
+	return element;
+    }
+
+    @Override
+    public Object toObject() throws WiseRuntimeException {
+	return null;
+//	if (client == null) {
+//	    throw new WiseRuntimeException("null client: impossible conversion of ParameterizedWiseTreeElemnt to object");
+//	}
+//	return isLeaf() ? null : client.instanceXmlElementDecl(this.name, this.scope, this.namespace, this.getChildrenAsList().get(0).toObject());
+    }
+
+    public void setClient(WSDynamicClient client) {
+	this.client = client;
+    }
+
+    public void setScope(Class<?> scope) {
+	this.scope = scope;
+    }
+
+    public void setNamespace(String namespace) {
+	this.namespace = namespace;
+    }
+
+    public String getNamespace() {
+	return namespace;
+    }
+}
\ No newline at end of file

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/QNameWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/QNameWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/QNameWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A simple tree element to handle QName instances.
+ * 
+ * @author Alessio Soldano, alessio.soldano at jboss.com
+ */
+public class QNameWiseTreeElement extends SimpleWiseTreeElement {
+
+    private static final long serialVersionUID = 1L;
+
+    private String localPart;
+
+    private String nameSpace;
+
+    private QNameWiseTreeElement() {
+	this.kind = QNAME;
+    }
+
+    public QNameWiseTreeElement(Class<?> classType, String name, String localPart, String nameSpace) {
+	super();
+	this.kind = QNAME;
+	this.classType = classType;
+	this.name = name;
+	this.localPart = localPart;
+	this.nameSpace = nameSpace;
+    }
+
+    @Override
+    public String getValue() {
+	return "{" + nameSpace + "}" + localPart;
+    }
+
+    public WiseTreeElement clone() {
+	QNameWiseTreeElement element = new QNameWiseTreeElement();
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	element.setLocalPart(localPart);
+	element.setNameSpace(nameSpace);
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	return element;
+    }
+
+    public String getNameSpace() {
+	return nameSpace;
+    }
+
+    public void setNameSpace(String nameSpace) {
+	this.nameSpace = nameSpace;
+    }
+
+    public String getLocalPart() {
+	return localPart;
+    }
+
+    public void setLocalPart(String localPart) {
+	this.localPart = localPart;
+    }
+
+    @Override
+    public void parseObject(Object obj) {
+	if (obj != null) {
+	    this.localPart = (((QName) obj).getLocalPart());
+	    this.nameSpace = (((QName) obj).getNamespaceURI());
+	} else {
+	    this.localPart = null;
+	    this.nameSpace = null;
+	}
+    }
+
+    @Override
+    public Object toObject() {
+	return new QName(nameSpace, localPart);
+    }
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,172 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URLEncoder;
+
+import org.jboss.logging.Logger;
+import org.jboss.wise.core.exception.WiseRuntimeException;
+import org.jboss.wise.core.utils.IDGenerator;
+import org.jboss.wise.core.utils.JavaUtils;
+
+import sun.misc.BASE64Encoder;
+
+/**
+ * A WiseTreeElement for simple types, like primitives and their corresponding
+ * classes. This is to be used for types having a simple value.
+ * 
+ * @author Alessio Soldano, alessio.soldano at jboss.com
+ * 
+ */
+public class SimpleWiseTreeElement extends WiseTreeElement {
+
+    private static final long serialVersionUID = 1L;
+
+    protected String value;
+
+    public SimpleWiseTreeElement() {
+	super(true);
+	this.kind = SIMPLE;
+	this.id = IDGenerator.nextVal();
+    }
+
+    public SimpleWiseTreeElement(Class<?> classType, String name, String value) {
+	super(true);
+	this.kind = SIMPLE;
+	this.id = IDGenerator.nextVal();
+	this.classType = classType;
+	this.name = name;
+	this.value = value;
+	this.nillable = !classType.isPrimitive(); // primitive are not nillable
+	this.nil = (value == null && nillable); // thus they can't be nil
+    }
+
+    /**
+     * Returns the String value of the instance corresponding to this element.
+     * 
+     * @return The value
+     */
+    public String getValue() {
+	return value;
+    }
+
+    /**
+     * This is the same as getValue except only the first 40 characters are
+     * considered. This is needed to preview invocation results.
+     * 
+     * @return The substring(0,40) of the value
+     */
+    public String getShortValue() {
+	if (getValue() == null) {
+	    return null;
+	}
+	if (getValue().length() <= 40) {
+	    return getValue();
+	}
+	return getValue().substring(0, 40) + "...";
+    }
+
+    /**
+     * This is the same as getValue except it double encode (BASE64 + URL) the
+     * value.
+     * 
+     * @return The encoded value
+     */
+    public String getLongValue() {
+	if (getValue() == null) {
+	    return null;
+	}
+	BASE64Encoder enc = new BASE64Encoder();
+	try {
+	    return URLEncoder.encode(enc.encode(getValue().getBytes()), "UTF-8");
+	} catch (UnsupportedEncodingException e) {
+	    throw new WiseRuntimeException(e);
+	}
+    }
+
+    public void setValue(String value) {
+	this.value = value;
+    }
+
+    public WiseTreeElement clone() {
+	SimpleWiseTreeElement element = new SimpleWiseTreeElement();
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	element.setValue(this.value);
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	return element;
+    }
+
+    /**
+     * Gets the value for this element parsing a given object instance. This is
+     * to be used to set the element value after the service invocation.
+     * 
+     * @param obj
+     */
+    public void parseObject(Object obj) {
+	this.setValue(obj == null ? null : obj.toString());
+	this.nil = (obj == null && nillable);
+    }
+
+    public Object toObject() {
+	if (value == null) {
+	    return null;
+	}
+
+	if (this.isNil()) {
+	    return null;
+	}
+
+	Class<?> cl = (Class<?>) classType;
+	if (cl.isPrimitive()) {
+	    cl = JavaUtils.getWrapperType(cl);
+	    Logger.getLogger(this.getClass()).debug("Wrapper class assigned: " + cl);
+	}
+	if ("java.lang.String".equalsIgnoreCase(cl.getName())) {
+	    return new String(value);
+	} else if ("java.lang.Boolean".equalsIgnoreCase(cl.getName())) {
+	    return new Boolean(value);
+	} else if ("java.lang.Byte".equalsIgnoreCase(cl.getName())) {
+	    return new Byte(value);
+	} else if ("java.lang.Character".equalsIgnoreCase(cl.getName())) {
+	    return new Character(value.charAt(0));
+	} else if ("java.lang.Double".equalsIgnoreCase(cl.getName())) {
+	    return new Double(value);
+	} else if ("java.lang.Float".equalsIgnoreCase(cl.getName())) {
+	    return new Float(value);
+	} else if ("java.lang.Integer".equalsIgnoreCase(cl.getName())) {
+	    return new Integer(value);
+	} else if ("java.lang.Long".equalsIgnoreCase(cl.getName())) {
+	    return new Long(value);
+	} else if ("java.lang.Short".equalsIgnoreCase(cl.getName())) {
+	    return new Short(value);
+	} else if ("java.math.BigDecimal".equalsIgnoreCase(cl.getName())) {
+	    return BigDecimal.valueOf(Double.parseDouble(value));
+	} else if ("java.math.BigInteger".equalsIgnoreCase(cl.getName())) {
+	    return BigInteger.valueOf(Long.parseLong(value));
+	} else if ("java.lang.Object".equalsIgnoreCase(cl.getName())) {
+	    return (Object) value;
+	} else {
+	    throw new WiseRuntimeException("Class type not supported: " + cl);
+	}
+    }
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElementFactory.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElementFactory.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/SimpleWiseTreeElementFactory.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+
+/**
+ * @author alessio.soldano at jboss.com
+ */
+public class SimpleWiseTreeElementFactory {
+
+    public static SimpleWiseTreeElement create(Class<?> classType, String name) {
+	if (classType.isEnum()) {
+	    return new EnumerationWiseTreeElement(classType, name, null);
+	} else if (QName.class.isAssignableFrom(classType)) {
+	    return new QNameWiseTreeElement(classType, name, null, null);
+	} else if (XMLGregorianCalendar.class.isAssignableFrom(classType)) {
+	    return new XMLGregorianWiseTreeElement(classType, name, null);
+	} else if (Duration.class.isAssignableFrom(classType)) {
+	    return new DurationWiseTreeElement(classType, name, null);
+	} else {
+	    return new SimpleWiseTreeElement(classType, name, null);
+	}
+
+    }
+
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.io.Serializable;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.richfaces.model.TreeNode;
+import org.richfaces.model.TreeNodeImpl;
+
+/**
+ * The abstract tree element, extended by all the custom tree element. Provides
+ * common TreeNode implementation.
+ * 
+ * @author alessio.soldano at jboss.com
+ * 
+ */
+public abstract class WiseTreeElement extends TreeNodeImpl implements TreeNode, Serializable, Cloneable {
+
+    private static final long serialVersionUID = 5298756163814063425L;
+    public static final String SIMPLE = "simple";
+    public static final String COMPLEX = "complex";
+    public static final String DURATION = "Duration";
+    public static final String ENUMERATION = "Enumeration";
+    public static final String GROUP = "group";
+    public static final String PARAMETERIZED = "Parameterized";
+    public static final String QNAME = "qname";
+    public static final String ROOT = "root";
+    public static final String XML_GREGORIAN_CAL = "XMLGregorianCalendar";
+
+    protected Object id;
+    protected String name;
+    protected String kind; // simple, complex, array, date, etc
+
+    protected boolean nil; //whether this elements has the attribute xsi:nil set to "true"
+    protected boolean nillable = true; //for primitives and explicitly not nillable elements
+    private boolean removable = false; // to be used on array elements
+
+    protected Type classType;
+
+    protected WiseTreeElement() {
+	super();
+    }
+    
+    protected WiseTreeElement(boolean isLeaf) {
+	super(isLeaf);
+    }
+    
+    public String getKind() {
+	return this.kind;
+    }
+
+    public void setKind(String kind) {
+	this.kind = kind;
+    }
+
+    public boolean isRemovable() {
+	return removable;
+    }
+
+    public void setRemovable(boolean removable) {
+	this.removable = removable;
+    }
+
+    public Type getClassType() {
+	return classType;
+    }
+    
+    public boolean isTypeBoolean() {
+	return "Boolean".equalsIgnoreCase(this.getType());
+    }
+
+    public void setClassType(Type classType) {
+	this.classType = classType;
+    }
+
+    public String getName() {
+	return name;
+    }
+
+    public void setName(String name) {
+	this.name = name;
+    }
+
+    public boolean isNil() {
+	return nil;
+    }
+
+    public void setNil(boolean nil) {
+	this.nil = nil;
+    }
+
+    public Object getId() {
+	return id;
+    }
+
+    public boolean isNillable() {
+	return nillable;
+    }
+
+    public void setNillable(boolean nillable) {
+	this.nillable = nillable;
+    }
+
+    public boolean isNotNillable() {
+	return !this.isNillable();
+    }
+
+    public boolean isNotNil() {
+	return !this.isNil();
+    }
+
+    public void setNotNil(boolean notNil) {
+	this.setNil(!notNil);
+    }
+
+    public String getType() {
+	if (this.classType instanceof ParameterizedType) {
+	    return ((Class<?>) ((ParameterizedType) this.classType).getRawType()).getSimpleName();
+	} else {
+	    return ((Class<?>) this.classType).getSimpleName();
+	}
+
+    }
+
+    /** ** Abstract method *** */
+
+    /**
+     * Every WiseTreeElement must be cloneable; this is required to handle
+     * element's add and removal into/from arrays and collections.
+     */
+    @Override
+    public abstract WiseTreeElement clone();
+
+    /**
+     * This is required to convert a tree element into the corresponding object
+     * instance.
+     * 
+     * @return The object corresponding to this element
+     */
+    public abstract Object toObject();
+
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElementBuilder.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElementBuilder.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/WiseTreeElementBuilder.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collection;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+
+import org.jboss.logging.Logger;
+import org.jboss.wise.core.client.WSDynamicClient;
+import org.jboss.wise.core.exception.WiseRuntimeException;
+import org.jboss.wise.core.utils.IDGenerator;
+import org.jboss.wise.core.utils.ReflectionUtils;
+
+/**
+ * Builds WiseTreeElements given a type or class
+ * 
+ * (Type/Class) + [Object] ===> Tree
+ * 
+ * @author alessio.soldano at jboss.com
+ */
+public class WiseTreeElementBuilder {
+
+    public WiseTreeElement buildTreeFromType(Type type, String name, WSDynamicClient client) {
+	return buildTreeFromType(type, name, client, null, null, null);
+    }
+    
+    public WiseTreeElement buildTreeFromType(Type type, String name, WSDynamicClient client, Object obj) {
+	return buildTreeFromType(type, name, client, obj, null, null);
+    }
+
+    private WiseTreeElement buildTreeFromType(Type type, String name, WSDynamicClient client, Object obj, Class<?> scope, String namespace) {
+	Logger.getLogger(this.getClass()).debug("=> Converting parameter '" + name + "', type '" + type + "'");
+	if (type instanceof ParameterizedType) {
+	    Logger.getLogger(this.getClass()).debug("Parameterized type...");
+	    ParameterizedType pt = (ParameterizedType) type;
+	    return this.buildParameterizedType(pt, name, obj, client, scope, namespace);
+	} else {
+	    Logger.getLogger(this.getClass()).debug("Not a parameterized type... casting to Class");
+	    return this.buildFromClass((Class<?>) type, name, obj, client);
+
+	}
+    }
+
+    @SuppressWarnings("rawtypes")
+    private WiseTreeElement buildParameterizedType(ParameterizedType pt, String name, Object obj, WSDynamicClient client, Class<?> scope, String namespace) {
+	if (Collection.class.isAssignableFrom((Class<?>) pt.getRawType())) {
+	    WiseTreeElement prototype = this.buildTreeFromType(pt.getActualTypeArguments()[0], name, client, null);
+	    GroupWiseTreeElement group = new GroupWiseTreeElement(pt, name, prototype);
+	    if (obj != null) {
+		for (Object o : (Collection) obj) {
+		    group.addChild(IDGenerator.nextVal(), this.buildTreeFromType(pt.getActualTypeArguments()[0], name, client, o));
+		}
+	    }
+	    return group;
+	} else {
+	    ParameterizedWiseTreeElement parameterized = new ParameterizedWiseTreeElement(pt, name, client, scope, namespace);
+	    if (obj != null && obj instanceof JAXBElement) {
+		obj = ((JAXBElement)obj).getValue();
+	    }
+	    WiseTreeElement element = this.buildTreeFromType(pt.getActualTypeArguments()[0], name, client, obj);
+	    parameterized.addChild(element.getId(), element);
+	    return parameterized;
+	}
+    }
+
+    private WiseTreeElement buildFromClass(Class<?> cl, String name, Object obj, WSDynamicClient client) {
+
+	if (cl.isArray()) {
+	    Logger.getLogger(this.getClass()).debug("* array");
+	    Logger.getLogger(this.getClass()).debug("Component type: " + cl.getComponentType());
+	    throw new WiseRuntimeException("Converter doesn't support this Object[] yet.");
+	}
+
+	if (cl.isEnum() || cl.isPrimitive() || cl.getName().equals(String.class.getName())) { // || !cl.getPackage().getName().equals(WSDynamicClient.WISE_TARGET_PACKAGE)) { //TODO ???
+	    Logger.getLogger(this.getClass()).debug("* simple");
+	    SimpleWiseTreeElement element = SimpleWiseTreeElementFactory.create(cl, name);
+	    element.parseObject(obj);
+	    return element;
+	} else { // complex
+	    Logger.getLogger(this.getClass()).debug("* complex");
+	    ComplexWiseTreeElement complex = new ComplexWiseTreeElement(cl, name);
+
+	    for (Field field : ReflectionUtils.getAllFields(cl)) {
+		XmlElement elemAnnotation = field.getAnnotation(XmlElement.class);
+		XmlElementRef refAnnotation = field.getAnnotation(XmlElementRef.class);
+		String fieldName = null;
+		String namespace = null;
+		if (elemAnnotation != null && !elemAnnotation.name().startsWith("#")) {
+		    fieldName =  elemAnnotation.name();
+		}
+		if (refAnnotation != null) {
+		    fieldName = refAnnotation.name();
+		    namespace = refAnnotation.namespace();
+		}
+		if (fieldName == null) {
+		    fieldName = field.getName();
+		}
+		//String fieldName = (annotation != null && !annotation.name().startsWith("#")) ? annotation.name() : field.getName();
+		Object fieldValue = null;
+		if (obj != null) {
+		    try {
+			Method getter = cl.getMethod(ReflectionUtils.getGetter(field), (Class[]) null);
+			fieldValue = getter.invoke(obj, (Object[]) null);
+		    } catch (Exception e) {
+			throw new WiseRuntimeException("Error calling getter method for field " + field, e);
+		    }
+		}
+		WiseTreeElement element = this.buildTreeFromType(field.getGenericType(), fieldName, client, fieldValue, cl, namespace);
+		complex.addChild(element.getId(), element);
+	    }
+	    return complex;
+	}
+    }
+}

Added: webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/XMLGregorianWiseTreeElement.java
===================================================================
--- webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/XMLGregorianWiseTreeElement.java	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/java/org/jboss/wise/gui/treeElement/XMLGregorianWiseTreeElement.java	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the 
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.wise.gui.treeElement;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.jboss.wise.core.exception.WiseRuntimeException;
+
+/**
+ * A simple tree element to handle calendars.
+ * 
+ * @author alessio.soldano at jboss.com
+ */
+public class XMLGregorianWiseTreeElement extends SimpleWiseTreeElement {
+
+    private static final long serialVersionUID = 5492389675960954725L;
+
+    private Date valueDate;
+
+    public XMLGregorianWiseTreeElement() {
+	this.kind = XML_GREGORIAN_CAL;
+    }
+
+    public XMLGregorianWiseTreeElement(Class<?> classType, String name, String value) {
+	this.kind = XML_GREGORIAN_CAL;
+	this.classType = classType;
+	this.nil = value == null;
+	this.name = name;
+	this.value = value;
+    }
+
+    @Override
+    public WiseTreeElement clone() {
+	XMLGregorianWiseTreeElement element = new XMLGregorianWiseTreeElement();
+	element.setName(this.name);
+	element.setNil(this.nil);
+	element.setClassType(this.classType);
+	element.setValue(this.value);
+	element.setRemovable(this.isRemovable());
+	element.setNillable(this.isNillable());
+	element.setValueDate(this.valueDate);
+	return element;
+    }
+
+    @Override
+    public void parseObject(Object obj) {
+	if (obj != null) {
+	    this.setValueDate(((XMLGregorianCalendar) obj).toGregorianCalendar().getTime());
+	    this.setValue(((XMLGregorianCalendar) obj).toString());
+	} else {
+	    this.setValueDate(null);
+	    this.setValue(null);
+	}
+	this.nil = obj == null;
+    }
+
+    @Override
+    public Object toObject() {
+	Object result = null;
+
+	if (!(this.isNil() || this.getValueDate() == null)) {
+	    // TODO!! consider creating a validator to prevent empty string
+	    // for dates,
+	    // as empy string shouldn't be converted to null, we should
+	    // throw exception
+	    // instead...
+	    try {
+		GregorianCalendar gregCal = new GregorianCalendar();
+		gregCal.setTime(this.getValueDate());
+		result = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregCal);
+	    } catch (DatatypeConfigurationException e) {
+		throw new WiseRuntimeException("Type format error", e);
+	    }
+	}
+	return result;
+    }
+
+    public Date getValueDate() {
+	return valueDate;
+    }
+
+    public void setValueDate(Date valueDate) {
+	this.valueDate = valueDate;
+    }
+}

Added: webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/beans.xml	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/beans.xml	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,18 @@
+<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc. 
+    and/or its affiliates, and individual contributors by the @authors tag. See 
+    the copyright.txt in the distribution for a full listing of individual contributors. 
+    Licensed under the Apache License, Version 2.0 (the "License"); you may not 
+    use this file except in compliance with the License. You may obtain a copy 
+    of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<!-- Marker file indicating CDI 1.0 should be enabled -->
+
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee 
+      http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>

Added: webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/faces-config.xml	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/faces-config.xml	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,20 @@
+<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc. 
+    and/or its affiliates, and individual contributors by the @authors tag. See 
+    the copyright.txt in the distribution for a full listing of individual contributors. 
+    Licensed under the Apache License, Version 2.0 (the "License"); you may not 
+    use this file except in compliance with the License. You may obtain a copy 
+    of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<!-- Marker file indicating JSF 2.0 should be enabled in the application -->
+
+<faces-config version="2.0"
+   xmlns="http://java.sun.com/xml/ns/javaee"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="
+      http://java.sun.com/xml/ns/javaee
+      http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+      
+</faces-config>

Added: webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/web.xml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/web.xml	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/webapp/WEB-INF/web.xml	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright 2012, Red Hat, Inc. 
+    and/or its affiliates, and individual contributors by the @authors tag. See 
+    the copyright.txt in the distribution for a full listing of individual contributors. 
+    Licensed under the Apache License, Version 2.0 (the "License"); you may not 
+    use this file except in compliance with the License. You may obtain a copy 
+    of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+  <!-- Set the PROJECT_STAGE to 'Development' to receive constructive error messages during development.
+  Change the PROJECT_STAGE to 'Production' when putting the application into production -->
+  <context-param>
+    <param-name>javax.faces.PROJECT_STAGE</param-name>
+    <param-value>Development</param-value>
+  </context-param>
+
+  <!-- add a welcome-file-list entry to allow JSF pages to be used as welcome files -->
+  <welcome-file-list>
+    <welcome-file>faces/index.xhtml</welcome-file>
+  </welcome-file-list>
+</web-app>

Added: webgui/branches/cdi-jsf/src/main/webapp/index.xhtml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/index.xhtml	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/webapp/index.xhtml	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,182 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:a4j="http://richfaces.org/a4j"
+      xmlns:c="http://java.sun.com/jstl/core"
+      xmlns:rich="http://richfaces.org/rich">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+    <ui:define name="title">JBoss Wise GUI</ui:define>
+
+    <ui:define name="body">
+        <fieldset style="width:600px">
+            <legend>Wise GUI</legend>
+            <p>
+                Please start by providing the WSDL URL you want to consume
+            </p>
+
+            <p>
+                The provided url will be used to retrieve a wsdl which will then be parsed to present you the available endpoints.
+            </p>
+            <rich:panel header="WSDL selection">
+                <h:form id="wsdlSelection">
+                    <h:outputLabel value="URL:" for="wsdlUrlInput"/>
+                    <h:inputText id="wsdlUrlInput" value="#{clientConversationBean.wsdlUrl}" />
+                    <a4j:commandButton value="OK" render="opSelectionPanel" action="#{clientConversationBean.init}" />
+                </h:form>
+            </rich:panel>
+            <br />
+            <a4j:outputPanel id="opSelectionPanel">
+            <rich:panel header="Operation selection">
+                <h:form id="epSelection">
+                    <rich:panelMenu itemMode="ajax" groupMode="ajax" groupExpandedLeftIcon="triangleUp" rendered="#{not empty clientConversationBean.services}"
+                        groupCollapsedLeftIcon="triangleDown" topGroupExpandedRightIcon="chevronUp"
+                        topGroupCollapsedRightIcon="chevronDown" itemLeftIcon="disc" itemChangeListener="#{clientConversationBean.updateCurrentOperation}">
+                        <c:forEach var="service" items="#{clientConversationBean.services}" >
+                            <rich:panelMenuGroup label="#{service.name}" expanded="true">
+                                <c:forEach var="port" items="#{service.ports}" >
+                                    <rich:panelMenuGroup label="#{port.name}" expanded="true">
+                                        <c:forEach var="operation" items="#{port.operations}" >
+                                            <rich:panelMenuItem label="#{operation.fullName}" name="#{service.name};#{port.name};#{operation.name}"
+                                                action="#{clientConversationBean.parseOperationParameters}"/>
+                                        </c:forEach>
+                                    </rich:panelMenuGroup>
+                                </c:forEach>
+                            </rich:panelMenuGroup>
+                        </c:forEach>
+                    </rich:panelMenu>
+                    <a4j:outputPanel ajaxRendered="true">
+                        <rich:panel rendered="#{not empty clientConversationBean.currentOperation}">
+                            <h:outputText value="#{clientConversationBean.currentOperation} selected" id="current" />
+                        </rich:panel>
+                    </a4j:outputPanel>
+                </h:form>
+            </rich:panel>
+            <br />
+            <a4j:outputPanel id="parInputPanel" ajaxRendered="true">
+            
+            <rich:accordion switchType="client">
+            <rich:accordionItem header="Request:">
+            
+            <rich:panel header="Parameters input" rendered="#{not empty clientConversationBean.inputTree}">
+                <h:form id="parInput">
+                    <rich:tree id="richTree" var="node" value="#{clientConversationBean.inputTree}" nodeType="#{node.kind}" 
+				switchType="ajax" binding="#{clientConversationBean.inTree}">
+				        <rich:treeNode type="simple">
+				        	<h:outputText value="#{node.type} : #{node.name} " />
+					        <h:selectBooleanCheckbox id="foo-chk" value="#{node.notNil}" disabled="#{node.notNillable}" />
+					        <h:inputText value="#{node.value}" id="foo" label="" rendered="#{node.type!='boolean' and node.type!='Boolean'}" columns="10" onfocus="document.getElementById(this.id + '-chk').checked=true" />
+					        <h:selectOneMenu value="#{node.value}" rendered="#{node.type=='boolean' or node.type=='Boolean'}">
+        						<f:selectItem itemValue="true" itemLabel="true" />
+						        <f:selectItem itemValue="false" itemLabel="false" />
+        					</h:selectOneMenu>
+					        <h:outputText value="&nbsp;" />
+<!--					        <a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
+						        rendered="#{node.removable}">
+						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
+					        </a4j:commandLink>  -->
+				        </rich:treeNode>
+				        <rich:treeNode type="group">
+					        <h:outputText value="[#{node.prototype.type}]" styleClass="tipoCampo" />
+        					<h:selectBooleanCheckbox value="#{node.notNil}" disabled="true" />
+		        			<h:outputText value="&nbsp;" />
+<!--				        	<a4j:commandLink name="Add" action="#{WSDLManager.addChild(node)}" reRender="richTree">
+						        <h:graphicImage styleClass="plus" value="images/small/Plus.png" />
+        					</a4j:commandLink>
+		        			<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
+				        		rendered="#{node.removable}">
+						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
+        					</a4j:commandLink> -->
+		        		</rich:treeNode>
+				        <rich:treeNode type="complex">
+					        <h:outputText value="#{node.type} : #{node.name} " />
+					        <h:selectBooleanCheckbox value="#{node.notNil}" disabled="#{node.notNillable}" />
+        					<h:outputText value="&nbsp;" />
+					        <h:outputText value="&nbsp;" />
+<!--					        <a4j:commandLink action="#{WSDLManager.removeChild(node)}" reRender="richTree"
+						        rendered="#{node.removable}">
+						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
+					        </a4j:commandLink>  -->
+				        </rich:treeNode>
+				        <rich:treeNode type="Parameterized">
+					        <h:outputText value="{#{node.namespace}} " />
+					        <h:selectBooleanCheckbox value="#{node.notNil}" disabled="true" />
+				        </rich:treeNode>
+				        <rich:treeNode type="XMLGregorianCalendar">
+        					        <h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+		        			<h:selectBooleanCheckbox id="foo2-chk" value="#{node.notNil}" disabled="#{node.notNillable}" />
+				        	<rich:calendar id="foo2" value="#{node.valueDate}" oncollapse="document.getElementById(this.id + '-chk').checked=true;return true;"
+						        popup="true"
+        						showInput="true" enableManualInput="false" />
+<!--		        			<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
+				        		rendered="#{node.removable}">
+						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
+        					</a4j:commandLink> -->
+		        		</rich:treeNode>
+				        <rich:treeNode type="Duration">
+        					<h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+		        			<h:selectBooleanCheckbox id="foo3-chk" value="#{node.notNil}" disabled="#{node.notNillable}" />
+				        	<h:inputText id="foo3" value="#{node.value}" onfocus="document.getElementById(this.id + '-chk').checked=true"/>
+        					<h:outputText value="(MilliSeconds)" target="_blank" />
+		        			<h:outputText value="&nbsp;" />
+<!--				        	<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
+						        rendered="#{node.removable}">
+        						<h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
+		        			</a4j:commandLink> -->
+				        </rich:treeNode>
+        				<rich:treeNode type="qname">
+		        			<h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+				        	<h:selectBooleanCheckbox id="foo4-chk" value="#{node.notNil}" disabled="#{node.notNillable}" />
+        					<h:outputText value="nameSpace: " />
+		        			<h:inputText id="foo4" value="#{node.nameSpace}" onfocus="document.getElementById(this.id + '-chk').checked=true"/>
+				        	<h:outputText value=" localPart: " />
+        					<h:inputText value="#{node.localPart}" />
+		        			<h:outputText value="&nbsp;" />
+<!--				        	<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
+						        rendered="#{node.removable}">
+        						<h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
+		        			</a4j:commandLink> -->
+				        </rich:treeNode>
+        				<rich:treeNode type="Enumeration">
+		        			<h:outputText value="#{node.type} : #{node.name} " styleClass="tipoCampo" />
+				        	<h:selectBooleanCheckbox id="foo5-chk" value="#{node.notNil}" disabled="#{node.notNillable}" />
+        					<h:selectOneMenu id="foo5" value="#{node.value}" onfocus="document.getElementById(this.id + '-chk').checked=true">
+		        				<f:selectItems value="#{node.validValue}" />
+				        	</h:selectOneMenu>
+        					<h:outputText value="&nbsp;" />
+<!--		        			<a4j:commandLink action="#{WSDLManager.removeChild(node)}" rerender="richTree"
+				        		rendered="#{node.removable}">
+						        <h:graphicImage styleClass="minus" value="images/small/Minus.png" rendered="#{node.removable}" />
+        					</a4j:commandLink> -->
+		        		</rich:treeNode>
+        		    </rich:tree>
+                    <a4j:commandButton value="Perform invocation" render="opSelectionPanel" action="#{clientConversationBean.performInvocation}" />
+                </h:form>
+            </rich:panel>
+            
+            </rich:accordionItem>
+            <rich:accordionItem header="Response:">
+            <rich:panel header="Parameters output" rendered="#{not empty clientConversationBean.outputTree}">
+            </rich:panel>
+            </rich:accordionItem>
+            </rich:accordion>
+            
+            </a4j:outputPanel>
+            
+            </a4j:outputPanel>
+            
+            
+            
+            
+            
+        </fieldset>
+
+    </ui:define>
+</ui:composition>
+</body>
+</html>

Added: webgui/branches/cdi-jsf/src/main/webapp/templates/template.xhtml
===================================================================
--- webgui/branches/cdi-jsf/src/main/webapp/templates/template.xhtml	                        (rev 0)
+++ webgui/branches/cdi-jsf/src/main/webapp/templates/template.xhtml	2013-01-18 17:28:10 UTC (rev 450)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<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:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j">
+
+<h:head>
+    <title>wise-gui</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+</h:head>
+
+<h:body>
+    <ui:insert name="body">Default content</ui:insert>
+</h:body>
+</html>



More information about the wise-commits mailing list