[jboss-svn-commits] JBL Code SVN: r8866 - in labs/jbossesb/trunk/product: console/resources/WEB-INF and 7 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jan 16 09:38:11 EST 2007
Author: tfennelly
Date: 2007-01-16 09:36:35 -0500 (Tue, 16 Jan 2007)
New Revision: 8866
Added:
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformationView.java
labs/jbossesb/trunk/product/console/view/flash/
labs/jbossesb/trunk/product/console/view/flash/console-demo-01.html
labs/jbossesb/trunk/product/console/view/flash/console-demo-01.swf
labs/jbossesb/trunk/product/console/view/transform/test-transformation.xhtml
labs/jbossesb/trunk/product/lib/ext/milyn-smooks-csv-0.1.jar
labs/jbossesb/trunk/product/lib/ext/opencsv-1.6.jar
Modified:
labs/jbossesb/trunk/product/console/build.properties
labs/jbossesb/trunk/product/console/build.xml
labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/hibernate.cfg.xml
labs/jbossesb/trunk/product/console/resources/WEB-INF/navigation.xml
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchange.java
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/SmooksResourceList.java
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameter.java
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameterSpec.java
labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceSpec.java
labs/jbossesb/trunk/product/console/view/about.xhtml
labs/jbossesb/trunk/product/console/view/home.xhtml
labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml
labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml
labs/jbossesb/trunk/product/console/view/transform/smooks-config.jsp
Log:
Merged over the console "Test Transformation" wizard from the workspace/tfennelly2 branch as per http://jira.jboss.com/jira/browse/JBESB-341.
Fixed http://jira.jboss.com/jira/browse/JBESB-281.
Modified: labs/jbossesb/trunk/product/console/build.properties
===================================================================
--- labs/jbossesb/trunk/product/console/build.properties 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/build.properties 2007-01-16 14:36:35 UTC (rev 8866)
@@ -1,8 +1,7 @@
-deploy.dir=/home/tfennelly/jboss-4.0.4.GA/server/default/deploy
-#deploy.dir=/home/tfennelly/packages/apache-tomcat-5.5.20/webapps
-
-db.host=localhost
-db.port=5432
-db.name=jbossesb
-db.username=postgres
-db.password=password
+deploy.dir=H:/jboss-4.0.4.GA/server/default/deploy
+
+db.host=localhost
+db.port=5432
+db.name=jbossesb
+db.username=postgres
+db.password=password
Modified: labs/jbossesb/trunk/product/console/build.xml
===================================================================
--- labs/jbossesb/trunk/product/console/build.xml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/build.xml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -52,7 +52,7 @@
<!-- Package -->
<delete file="${build.console.dir}/${package.name}.war" />
<copy todir="${resources.dir}/WEB-INF/lib">
- <fileset dir="${product.lib.ext.dir}" includes="milyn*.jar" />
+ <fileset dir="${product.lib.ext.dir}" includes="milyn*.jar,opencsv*.jar" />
</copy>
<jar destfile="${resources.dir}/WEB-INF/lib/${package.name}.jar">
<fileset dir="${resources.dir}/WEB-INF/classes" />
@@ -65,7 +65,7 @@
<fileset dir="${basedir}" includes="distro/**" />
<fileset dir="${basedir}" includes="import.sql" />
</jar>
- <delete dir="${resources.dir}/WEB-INF/lib" includes="milyn*.jar,${package.name}.jar" />
+ <delete dir="${resources.dir}/WEB-INF/lib" includes="milyn*.jar,opencsv*.jar,${package.name}.jar" />
</target>
<target name="assertTestsFailed" if="test.failed">
Modified: labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/hibernate.cfg.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/hibernate.cfg.xml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/classes/hibernate.cfg.xml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -3,22 +3,21 @@
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
- <session-factory name="java:/esbDatabase">
- <property name="show_sql">false</property>
- <property name="connection.datasource">java:/jbossesb-console-Datasource</property>
- <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
- <property name="hbm2ddl.auto">update</property>
- <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <property name="transaction.flush_before_completion">true</property>
- <property name="connection.release_mode">after_statement</property>
- <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
- <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
-
- <mapping class="org.jboss.soa.esb.admin.console.exchange.participant.Participant"/>
- <mapping class="org.jboss.soa.esb.admin.console.contract.MessageContract"/>
- <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResource"/>
- <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResourceParameter"/>
- <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResourceSpec"/>
- <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResourceParameterSpec"/>
- </session-factory>
+ <session-factory name="java:/esbDatabase">
+ <property name="show_sql">false</property>
+ <property name="connection.datasource">java:/DefaultDS</property>
+ <property name="hbm2ddl.auto">create-drop</property>
+ <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
+ <property name="transaction.flush_before_completion">true</property>
+ <property name="connection.release_mode">after_statement</property>
+ <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+
+ <mapping class="org.jboss.soa.esb.admin.console.exchange.participant.Participant"/>
+ <mapping class="org.jboss.soa.esb.admin.console.contract.MessageContract"/>
+ <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResource"/>
+ <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResourceParameter"/>
+ <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResourceSpec"/>
+ <mapping class="org.jboss.soa.esb.admin.console.transform.TransformationResourceParameterSpec"/>
+ </session-factory>
</hibernate-configuration>
Modified: labs/jbossesb/trunk/product/console/resources/WEB-INF/navigation.xml
===================================================================
--- labs/jbossesb/trunk/product/console/resources/WEB-INF/navigation.xml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/resources/WEB-INF/navigation.xml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -102,6 +102,12 @@
<to-view-id>/transform/update-resource-parameter.xhtml</to-view-id>
<redirect />
</navigation-case>
+
+ <navigation-case>
+ <from-outcome>test-transformation</from-outcome>
+ <to-view-id>/transform/test-transformation.xhtml</to-view-id>
+ <redirect />
+ </navigation-case>
<navigation-case>
<from-outcome>smooks-config</from-outcome>
Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchange.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchange.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/MessageExchange.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -22,6 +22,8 @@
package org.jboss.soa.esb.admin.console.exchange;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
@@ -207,6 +209,33 @@
return stringBuffer.toString();
}
+ /**
+ * Get the profile list based on this message exchange.
+ * @return The list of profiles.
+ */
+ public String[] getUseragentProfiles() {
+ List<String> profiles = new ArrayList<String>();
+ String[] profileArray;
+
+ if(fromMessageType != null) {
+ profiles.add(FROM_TYPE + fromMessageType);
+ }
+ if(from != null) {
+ profiles.add(FROM + from);
+ }
+ if(toMessageType != null) {
+ profiles.add(TO_TYPE + toMessageType);
+ }
+ if(to != null) {
+ profiles.add(TO + to);
+ }
+
+ profileArray = new String[profiles.size()];
+ profiles.toArray(profileArray);
+
+ return profileArray;
+ }
+
/**
* Reset the message exchange.
*/
Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/exchange/SelectMessageExchange.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -76,29 +76,19 @@
/**
* Initialise all the component members.
*/
- @Create
public void initialise() {
- if(messageExchange == null || !isMessageExchangeSelected()) {
+ if(messageExchange == null) {
messageExchange = new MessageExchange();
- Contexts.getSessionContext().set(MessageExchange.class.getName(), "set");
-
- fromParticipants = esbDatabase.createQuery("from Participant order by name").list();
- toParticipants = esbDatabase.createQuery("from Participant order by name").list();
fromMessageTypes = null;
toMessageTypes = null;
}
- }
- /**
- * Reinitialise all the component members.
- */
- public void reinitialise() {
- messageExchange = null;
- initialise();
+ fromParticipants = esbDatabase.createQuery("from Participant order by name").list();
+ toParticipants = esbDatabase.createQuery("from Participant order by name").list();
}
public String showFrom() {
- reinitialise();
+ resetExchange();
return "select-message-exchange-from";
}
@@ -111,6 +101,7 @@
}
public String finish() {
+ setExchange();
return SeamViewIdStack.getInstance().popViewId();
}
@@ -163,11 +154,21 @@
* @return
*/
public String cancel() {
- messageExchange = new MessageExchange();
- Contexts.getSessionContext().set(MessageExchange.class.getName(), "notset");
+ resetExchange();
return "home";
}
+
+ private void setExchange() {
+ Contexts.getSessionContext().set(MessageExchange.class.getName(), "set");
+ Contexts.getSessionContext().set(MessageExchange.class.getName() + "#instance", messageExchange);
+ }
+
+ private void resetExchange() {
+ messageExchange = null;
+ Contexts.getSessionContext().set(MessageExchange.class.getName(), "notset");
+ initialise();
+ }
/**
* Is the {@link MessageExchange} selected on the current session.
@@ -178,4 +179,16 @@
return (set != null && set.equals("set"));
}
+
+ /**
+ * Get the current MessageExchange instance.
+ * @return The current MessageExchange instance.
+ */
+ public static MessageExchange getMessageExchange() {
+ if(isMessageExchangeSelected()) {
+ return (MessageExchange) Contexts.getSessionContext().get(MessageExchange.class.getName() + "#instance");
+ }
+
+ throw new IllegalStateException("Call to 'getMessageExchange()' before an exchange has been selected. The calling code needs to protect itself against this condition!");
+ }
}
Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/SmooksResourceList.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/SmooksResourceList.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/SmooksResourceList.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -23,14 +23,13 @@
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.List;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.Logger;
-import org.hibernate.MappingException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
@@ -38,6 +37,8 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
@@ -51,11 +52,16 @@
private static Logger logger = Logger.getLogger(SmooksResourceList.class);
public static String getList() {
+ return getList(HibernateUtil.getSessionFactory().openSession());
+ }
+
+ public static String getList(Session session) {
StringBuffer stringBuffer = new StringBuffer();
- Session session = HibernateUtil.getSessionFactory().openSession();
List resList;
- session.beginTransaction();
+ stringBuffer.append("<?xml version=\"1.0\"?>\n");
+ stringBuffer.append("<!DOCTYPE smooks-resource-list PUBLIC \"-//MILYN//DTD SMOOKS 1.0//EN\" \"http://www.milyn.org/dtd/smooksres-list-1.0.dtd\">\n");
+ stringBuffer.append("<smooks-resource-list>\n");
resList = session.createQuery("from TransformationResource").list();
if(resList != null && !resList.isEmpty()) {
@@ -67,9 +73,9 @@
} else {
stringBuffer.append("<!-- No configurations found. -->");
}
+
+ stringBuffer.append("\n</smooks-resource-list>");
- session.getTransaction().commit();
-
return stringBuffer.toString();
}
@@ -149,8 +155,7 @@
throw new IllegalStateException("Failed to locate 'hibernate.cfg.xml' in the root fo the classpath.");
}
- DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document configDoc = docBuilder.parse(hibernateConfigStream);
+ Document configDoc = XmlUtil.parseStream(hibernateConfigStream, hibernateEntityResolver, false, false);
// Set the hibernate properties and mappings. There must be a "proper" way to do
// this!! I tried without doing this and I got exceptions all over the place.
@@ -196,4 +201,29 @@
}
}
+ private static HibernateEntityResolver hibernateEntityResolver = new HibernateEntityResolver();
+ private static class HibernateEntityResolver implements EntityResolver {
+
+ /* (non-Javadoc)
+ * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
+ */
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ try {
+ URI resourceURI = new URI(systemId);
+ InputStream resStream;
+
+ resStream = HibernateEntityResolver.class.getResourceAsStream("/org/hibernate" + resourceURI.getPath());
+ if(resStream == null) {
+ logger.warn("Failed to resolve Hibernate system entity [" + systemId + "].");
+ return null;
+ }
+
+ return new InputSource(resStream);
+ } catch (URISyntaxException e) {
+ logger.warn("The entity systemId was expected to be a valid URI. Was [" + systemId + "].");
+ }
+
+ return null;
+ }
+ }
}
Added: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformation.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.admin.console.transform;
+
+import static org.jboss.seam.ScopeType.SESSION;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.log4j.Logger;
+import org.hibernate.Session;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.soa.esb.admin.console.SeamViewIdStack;
+import org.jboss.soa.esb.admin.console.exchange.MessageExchange;
+import org.jboss.soa.esb.admin.console.exchange.SelectMessageExchange;
+import org.milyn.SmooksException;
+import org.milyn.SmooksStandalone;
+import org.xml.sax.SAXException;
+
+/**
+ * Test Transformation action listener.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ at Name("testTransformation")
+ at Scope(SESSION)
+public class TestTransformation {
+
+ private static Logger logger = Logger.getLogger(TestTransformation.class);
+
+ @In(create=true)
+ private Session esbDatabase;
+
+ @In(required=false) @Out(scope=SESSION)
+ private TestTransformationView testView;
+
+ public String show() {
+ if(testView == null) {
+ // How do we get Seam to autocreate the instance?? Tried the create=true annotation but no joy!
+ testView = new TestTransformationView();
+ }
+
+ if(!SelectMessageExchange.isMessageExchangeSelected()) {
+ SeamViewIdStack.getInstance().pushViewId("test-transformation");
+ return "select-message-exchange";
+ }
+
+ return "test-transformation";
+ }
+
+ public void applyResources() throws UnsupportedEncodingException {
+ SmooksStandalone smooks = new SmooksStandalone("UTF-8");
+ ByteArrayInputStream config = new ByteArrayInputStream(SmooksResourceList.getList(esbDatabase).getBytes("UTF-8"));
+ ByteArrayInputStream input = new ByteArrayInputStream(testView.getInput().getBytes("UTF-8"));
+ MessageExchange exchange = SelectMessageExchange.getMessageExchange();
+
+ try {
+ smooks.registerResources("Console Resources", config);
+ } catch (Throwable t) {
+ logger.error("Error loading transformation resources.", t);
+ testView.setOutput("Error Loading Transformation Resources...\n\n" + t.getClass().getName() + ": " + t.getMessage() + "\n\nCheck Java console.");
+ return;
+ }
+
+ try {
+ smooks.registerUseragent(exchange.getExchangeUseragentString(), exchange.getUseragentProfiles());
+ } catch (Throwable t) {
+ logger.error("Error registering Smooks message profiles.", t);
+ testView.setOutput("Error registering Smooks message profiles...\n\n" + t.getClass().getName() + ": " + t.getMessage() + "\n\nCheck Java console.");
+ return;
+ }
+
+ try {
+ String output = smooks.filterAndSerialize(exchange.getExchangeUseragentString(), input);
+ testView.setOutput(format(output));
+ } catch (Throwable t) {
+ logger.error("Error in applying Transformation/Analysis resources to message.", t);
+ if(t instanceof SmooksException && t.getCause() instanceof SAXException) {
+ testView.setOutput("Transformation Exception...\n\n" + t.getClass().getName() + ": " + t.getMessage() + "\n\nCheck Java console.\n\nNOTE: This particular error was caused by a " + t.getCause().getClass().getName() + " exception which can result from attempting to parse the incomming message with the wrong SAX Parser. If the message is not an XML message, you must specify an appropriate parser.");
+ } else {
+ testView.setOutput("Transformation Exception...\n\n" + t.getClass().getName() + ": " + t.getMessage() + "\n\nCheck Java console.");
+ }
+ }
+ }
+
+ private static TransformerFactory factory = TransformerFactory.newInstance();
+
+ /**
+ * Attempt to format the output.
+ * @param output Output to be formatted.
+ * @return Output.
+ */
+ private String format(String output) {
+ StreamSource source = new StreamSource(new ByteArrayInputStream(output.getBytes()));
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+
+ try {
+ Transformer transformer;
+
+ // There's a bug in Java 5 re this code (formatting).
+ // See http://forum.java.sun.com/thread.jspa?threadID=562510&start=0 and it explains the
+ // whys of the following code.
+ transformer = factory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4");
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.transform(source, new StreamResult(outStream));
+
+ return outStream.toString();
+ } catch (Exception e) {
+ return output;
+ }
+ }
+}
Added: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformationView.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformationView.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TestTransformationView.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.soa.esb.admin.console.transform;
+
+import org.jboss.seam.annotations.Name;
+
+/**
+ * Test Transformation View.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ at Name("testTransformationView")
+public class TestTransformationView {
+
+ private String input;
+ private String output;
+
+ /**
+ * @return Returns the input.
+ */
+ public String getInput() {
+ return input;
+ }
+ /**
+ * @param input The input to set.
+ */
+ public void setInput(String input) {
+ this.input = input;
+ }
+ /**
+ * @return Returns the output.
+ */
+ public String getOutput() {
+ return output;
+ }
+ /**
+ * @param output The output to set.
+ */
+ public void setOutput(String output) {
+ this.output = output;
+ }
+}
Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameter.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameter.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameter.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -26,6 +26,7 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
@@ -46,7 +47,7 @@
private TransformationResource transResource;
private String name;
private String type;
- private byte[] value;
+ private String value;
public TransformationResourceParameter() {
}
@@ -116,24 +117,21 @@
* @param valueAsString The valueAsString to set.
*/
public void setValueAsString(String value) {
- if(value == null) {
- this.value = null;
- } else {
- this.value = value.getBytes();
- }
+ this.value = value;
}
/**
* @return Returns the value.
*/
- public byte[] getValue() {
+ @Lob
+ public String getValue() {
return value;
}
/**
* @param value The value to set.
*/
- public void setValue(byte[] value) {
+ public void setValue(String value) {
this.value = value;
}
Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameterSpec.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameterSpec.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceParameterSpec.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -26,6 +26,7 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
@@ -44,22 +45,23 @@
private static final long serialVersionUID = 1L;
private String id;
private String name;
- private byte[] description;
+ private String description;
private boolean required;
private String type;
- private byte[] value;
+ private String value;
private TransformationResourceSpec resourceSpec;
/**
* @return Returns the description.
*/
- public byte[] getDescription() {
+ @Lob
+ public String getDescription() {
return description;
}
/**
* @param description The description to set.
*/
- public void setDescription(byte[] description) {
+ public void setDescription(String description) {
this.description = description;
}
@@ -72,10 +74,7 @@
return new String(description);
}
public void setDescriptionAsString(String description) {
- if(description == null) {
- this.description = null;
- }
- this.description = description.getBytes();
+ this.description = description;
}
/**
@@ -132,13 +131,14 @@
/**
* @return Returns the value.
*/
- public byte[] getValue() {
+ @Lob
+ public String getValue() {
return value;
}
/**
* @param value The value to set.
*/
- public void setValue(byte[] value) {
+ public void setValue(String value) {
this.value = value;
}
/**
@@ -147,19 +147,13 @@
@NotNull
@Transient
public String getValueAsString() {
- if(value == null) {
- return null;
- }
- return new String(value);
+ return value;
}
/**
* @param valueAsString The valueAsString to set.
*/
public void setValueAsString(String value) {
- if(value == null) {
- this.value = null;
- }
- this.value = value.getBytes();
+ this.value = value;
}
/**
* @return Returns the type.
@@ -195,6 +189,6 @@
*/
@Transient
public boolean isPreset() {
- return (value != null && value.length > 0);
+ return (value != null && value.length() > 0);
}
}
Modified: labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceSpec.java
===================================================================
--- labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceSpec.java 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/src/org/jboss/soa/esb/admin/console/transform/TransformationResourceSpec.java 2007-01-16 14:36:35 UTC (rev 8866)
@@ -28,6 +28,7 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Transient;
@@ -47,7 +48,7 @@
private static final long serialVersionUID = 1L;
private String id;
private String name;
- private byte[] description;
+ private String description;
private String path;
private String selector;
private String namespace;
@@ -121,13 +122,14 @@
/**
* @return Returns the description.
*/
- public byte[] getDescription() {
+ @Lob
+ public String getDescription() {
return description;
}
/**
* @param description The description to set.
*/
- public void setDescription(byte[] description) {
+ public void setDescription(String description) {
this.description = description;
}
@NotNull
@@ -139,10 +141,7 @@
return new String(description);
}
public void setDescriptionAsString(String description) {
- if(description == null) {
- this.description = null;
- }
- this.description = description.getBytes();
+ this.description = description;
}
/**
* @return Returns the name.
Modified: labs/jbossesb/trunk/product/console/view/about.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/about.xhtml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/view/about.xhtml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -13,7 +13,8 @@
<a href="#features">1. Features</a><br/>
<a href="#configuring">2. Configuring JBoss ESB Transformations</a><br/>
<a href="#custom-java">3. Creating and Using Customer Java Transformations</a><br/>
- <a href="#faqs">4. FAQs</a>
+ <a href="#faqs">4. FAQs</a><br/>
+ <a href="#flash-demos">5. Flash Demos</a>
<div id="jboss-esb-trans-analysis" class="section">
@@ -167,6 +168,16 @@
</pre>
</div>
</div>
+
+ <div class="section">
+ <h2 id="flash-demos">5. Flash Demos</h2>
+ <div class="section">
+ <a href="flash/console-demo-01.html">Demo 1</a>: A basic demo that walks you through most of the main
+ concepts within JBoss ESB Transformations.
+ <p/>
+ </div>
+ </div>
+
</div>
</div>
Added: labs/jbossesb/trunk/product/console/view/flash/console-demo-01.html
===================================================================
--- labs/jbossesb/trunk/product/console/view/flash/console-demo-01.html 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/view/flash/console-demo-01.html 2007-01-16 14:36:35 UTC (rev 8866)
@@ -0,0 +1,15 @@
+<!-- saved from url=(0014)about:internet -->
+<HTML>
+<BODY>
+<center>
+<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="1227" HEIGHT="982" CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0">
+<PARAM NAME=movie VALUE="console-demo-01.swf">
+<PARAM NAME=play VALUE=true>
+<PARAM NAME=loop VALUE=false>
+<PARAM NAME=quality VALUE=low>
+<EMBED SRC="console-demo-01.swf" WIDTH=1227 HEIGHT=982 quality=low loop=false TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
+</EMBED>
+</OBJECT>
+</center>
+</BODY>
+</HTML>
Added: labs/jbossesb/trunk/product/console/view/flash/console-demo-01.swf
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/console/view/flash/console-demo-01.swf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbossesb/trunk/product/console/view/home.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/home.xhtml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/view/home.xhtml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -30,6 +30,7 @@
<ul>
<li><s:link action="#{newResource.selectResourceSpec}" value="Configure New Resource" /></li>
<li><s:link action="#{manageResources.list}" value="Manage Configurations" /></li>
+ <li><s:link action="#{testTransformation.show}" value="Test Transformation" /></li>
<li><s:link action="#{resourceImport.show}" value="Import Configurations" /></li>
</ul>
</div>
Modified: labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/view/transform/add-resource-parameter.xhtml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -57,7 +57,7 @@
<!-- sidebar -->
<ui:define name="sidebar">
- <b><h:form><h:commandButton value="Set Message Exchange" action="#{messageExchangeSelect.showFromParticipants}" /></h:form></b>
+ <b><h:form><h:commandButton value="Reset Message Exchange" action="#{messageExchangeSelect.showFrom}" /></h:form></b>
<p/>
<h1>Create Transformation/Analysis Configuration</h1>
Create a message transformation/analysis configuration for the chosen Message Exchange.
Modified: labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/view/transform/list-resources.xhtml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -59,6 +59,7 @@
<!-- sidebar -->
<ui:define name="sidebar">
+ <b><h:form><h:commandButton value="Test Transformation" action="#{testTransformation.show}" /></h:form></b>
<b><h:form><h:commandButton value="Reset Message Exchange" action="#{messageExchangeSelect.showFrom}" /></h:form></b>
<p/>
</ui:define>
Modified: labs/jbossesb/trunk/product/console/view/transform/smooks-config.jsp
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/smooks-config.jsp 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/view/transform/smooks-config.jsp 2007-01-16 14:36:35 UTC (rev 8866)
@@ -1,8 +1 @@
-<?xml version="1.0"?>
-<!DOCTYPE smooks-resource-list PUBLIC "-//MILYN//DTD SMOOKS 1.0//EN" "http://www.milyn.org/dtd/smooksres-list-1.0.dtd">
-
-<smooks-resource-list>
-
- <%=org.jboss.soa.esb.admin.console.transform.SmooksResourceList.getList()%>
-
-</smooks-resource-list>
+<%=org.jboss.soa.esb.admin.console.transform.SmooksResourceList.getList()%>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/console/view/transform/test-transformation.xhtml
===================================================================
--- labs/jbossesb/trunk/product/console/view/transform/test-transformation.xhtml 2007-01-16 14:23:37 UTC (rev 8865)
+++ labs/jbossesb/trunk/product/console/view/transform/test-transformation.xhtml 2007-01-16 14:36:35 UTC (rev 8866)
@@ -0,0 +1,56 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition 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:s="http://jboss.com/products/seam/taglib"
+ template="template.xhtml">
+
+<!-- content -->
+<ui:define name="content">
+ <h:form>
+ <s:validateAll>
+ <div class="section">
+ <h2>Test Transformation</h2>
+ <div class="entry">
+ <div class="label"><h:outputLabel for="InputMessage">Input Message --> <br/></h:outputLabel></div>
+ <b>from</b>: <u>#{messageExchange.from}</u><br/>
+ <b>type</b>: <u>#{messageExchange.fromMessageType}</u>
+ <div class="input">
+ <h:inputTextarea id="InputMessage" value="#{testView.input}" cols="100" rows="20" required="true" />
+ <br/><span class="errors"><h:message for="InputMessage" /></span>
+ </div>
+ </div>
+ <div class="entry errors"><h:messages globalOnly="true"/></div>
+ <div class="entry">
+ <div class="label"><f:verbatim> </f:verbatim></div>
+ <div class="input">
+ <h:commandButton value="Apply Resources To Message" action="#{testTransformation.applyResources}" class="button"/>
+ </div>
+ </div>
+ <div class="entry">
+ <div class="label"><h:outputLabel for="OutputMessage">Output Message --> </h:outputLabel></div>
+ <b>to</b>: <u>#{messageExchange.to}</u><br/>
+ <b>type</b>: <u>#{messageExchange.toMessageType}</u>
+ <div class="input">
+ <h:inputTextarea id="OutputMessage" value="#{testView.output}" cols="100" rows="20" />
+ <br/><span class="errors"><h:message for="OutputMessage" /></span>
+ </div>
+ </div>
+ </div>
+ </s:validateAll>
+ </h:form>
+</ui:define>
+
+<!-- sidebar -->
+<ui:define name="sidebar">
+ <b><h:form><h:commandButton value="Configure New Resource" action="#{newResource.selectResourceSpec}" /></h:form></b>
+ <b><h:form><h:commandButton value="Manage Configurations" action="#{manageResources.list}" /></h:form></b>
+ <b><h:form><h:commandButton value="Reset Message Exchange" action="#{messageExchangeSelect.showFrom}" /></h:form></b>
+ <p/>
+ <h1>Test Transformation/Analysis Configuration</h1>
+ Test the application of the Transformation/Analysis Resources targeted at the current Message Exchange using a sample input message.
+ <p/>
+</ui:define>
+
+</ui:composition>
Added: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-csv-0.1.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/lib/ext/milyn-smooks-csv-0.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/lib/ext/opencsv-1.6.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/lib/ext/opencsv-1.6.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-svn-commits
mailing list