Author: objectiser
Date: 2008-08-07 07:31:06 -0400 (Thu, 07 Aug 2008)
New Revision: 223
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/AntBuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/BuildSystem.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/MavenBuildSystem.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/TestESBLanguageModel.java
Log:
Support for Ant and Maven build systems, and now generating the deployment.xml and
jbmq-queue-service.xml.
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/AntBuildSystem.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/AntBuildSystem.java
(rev 0)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/AntBuildSystem.java 2008-08-07
11:31:06 UTC (rev 223)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.
+ */
+package org.jboss.tools.overlord.jbossesb.dialogs;
+
+/**
+ * This class represents the Ant build system.
+ */
+public class AntBuildSystem implements BuildSystem {
+
+ private static final String BUILD_FILE = "build.xml";
+ private static final String ANT = "Ant";
+ private static final String ESB_CONFIG_PATH = "src/conf/jboss-esb.xml";
+ private static final String DEPLOYMENT_PATH = "src/conf/deployment.xml";
+ private static final String JBMQ_CONFIG_PATH =
"src/conf/jbmq-queue-service.xml";
+ private static final String JAVA_SOURCE_PATH = "src/java";
+
+ /**
+ * This method represents the name of the build
+ * system.
+ *
+ * @return The name
+ */
+ public String getName() {
+ return(ANT);
+ }
+
+ /**
+ * This method returns the build configuration file
+ * path.
+ *
+ * @return The build configuration file path
+ */
+ public String getBuildFilePath() {
+ return(BUILD_FILE);
+ }
+
+ /**
+ * This method returns the contents for the build
+ * configuration file.
+ *
+ * @param projectName The project name
+ * @return The build file contents
+ */
+ public String getBuildFileContents(String projectName) {
+ StringBuffer ret=new StringBuffer();
+
+ ret.append("<project name=\""+projectName+
+ "\" default=\"startdb\" basedir=\".\">\r\n");
+
+ ret.append("</project>\r\n");
+
+ return(ret.toString());
+ }
+
+ /**
+ * This method returns the ESB configuration file
+ * path.
+ *
+ * @return The ESB configuration file path
+ */
+ public String getESBConfigFilePath() {
+ return(ESB_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the deployment file
+ * path.
+ *
+ * @return The deployment file path
+ */
+ public String getDeploymentFilePath() {
+ return(DEPLOYMENT_PATH);
+ }
+
+ /**
+ * This method returns the JBMQ configuration file
+ * path.
+ *
+ * @return The JBMQ configuration file path
+ */
+ public String getJBMQConfigFilePath() {
+ return(JBMQ_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the Java source path.
+ *
+ * @return The Java source path
+ */
+ public String getJavaSourcePath() {
+ return(JAVA_SOURCE_PATH);
+ }
+
+}
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/BuildSystem.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/BuildSystem.java
(rev 0)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/BuildSystem.java 2008-08-07
11:31:06 UTC (rev 223)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.
+ */
+package org.jboss.tools.overlord.jbossesb.dialogs;
+
+/**
+ * This interface represents a build system used when
+ * generating the ESB projects.
+ */
+public interface BuildSystem {
+
+ /**
+ * This method represents the name of the build
+ * system.
+ *
+ * @return The name
+ */
+ public String getName();
+
+ /**
+ * This method returns the build configuration file
+ * path.
+ *
+ * @return The build configuration file path
+ */
+ public String getBuildFilePath();
+
+ /**
+ * This method returns the contents for the build
+ * configuration file.
+ *
+ * @param projectName The project name
+ * @return The build file contents
+ */
+ public String getBuildFileContents(String projectName);
+
+ /**
+ * This method returns the ESB configuration file
+ * path.
+ *
+ * @return The ESB configuration file path
+ */
+ public String getESBConfigFilePath();
+
+ /**
+ * This method returns the deployment file
+ * path.
+ *
+ * @return The deployment file path
+ */
+ public String getDeploymentFilePath();
+
+ /**
+ * This method returns the JBMQ configuration file
+ * path.
+ *
+ * @return The JBMQ configuration file path
+ */
+ public String getJBMQConfigFilePath();
+
+ /**
+ * This method returns the Java source path.
+ *
+ * @return The Java source path
+ */
+ public String getJavaSourcePath();
+
+}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java 2008-08-07
03:33:23 UTC (rev 222)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java 2008-08-07
11:31:06 UTC (rev 223)
@@ -32,8 +32,7 @@
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
-import org.jboss.tools.overlord.jbossesb.model.DefaultESBLanguageModel;
-import org.jboss.tools.overlord.jbossesb.model.ESBLanguageModel;
+import org.jboss.tools.overlord.jbossesb.model.*;
import org.jboss.tools.overlord.jbossesb.model.util.ConversationUtil;
import org.jboss.tools.overlord.jbossesb.model.util.InteractionUtil;
import org.scribble.conversation.model.ConversationModel;
@@ -54,8 +53,6 @@
*/
public class GenerateDialog extends org.eclipse.jface.dialogs.Dialog {
- private static final String ESB_CONFIG_PATH = "src/conf/jboss-esb.xml";
- private static final String JAVA_SOURCE_LOCATION = "src/java";
private static final String CLASSPATH_FILENAME = ".classpath";
private static final String OUTPUT_LOCATION = "classes";
@@ -69,6 +66,9 @@
m_file = file;
+ m_buildSystems.add(new AntBuildSystem());
+ m_buildSystems.add(new MavenBuildSystem());
+
initialize(m_file);
}
@@ -131,7 +131,7 @@
group.setLayoutData(gd);
layout = new GridLayout();
- layout.numColumns = 2;
+ layout.numColumns = 4;
group.setLayout(layout);
// Labels
@@ -139,7 +139,7 @@
label.setText("Service Role");
gd = new GridData();
- gd.horizontalSpan = 1;
+ gd.horizontalSpan = 2;
gd.widthHint = 150;
label.setLayoutData(gd);
@@ -147,7 +147,7 @@
label.setText("Project Name");
gd = new GridData();
- gd.horizontalSpan = 1;
+ gd.horizontalSpan = 2;
gd.widthHint = 150;
label.setLayoutData(gd);
@@ -160,7 +160,7 @@
button.setSelection(true);
gd = new GridData();
- gd.horizontalSpan = 1;
+ gd.horizontalSpan = 2;
gd.widthHint = 150;
button.setLayoutData(gd);
@@ -180,7 +180,7 @@
projectName.setText(m_roles.get(i).getName());
gd = new GridData();
- gd.horizontalSpan = 1;
+ gd.horizontalSpan = 2;
gd.widthHint = 300;
projectName.setLayoutData(gd);
@@ -200,7 +200,7 @@
gd = new GridData();
gd.horizontalSpan = 1;
- gd.widthHint = 150;
+ gd.widthHint = 100;
button.setLayoutData(gd);
button.addSelectionListener(new SelectionListener() {
@@ -222,7 +222,7 @@
gd = new GridData();
gd.horizontalSpan = 1;
- gd.widthHint = 150;
+ gd.widthHint = 100;
button.setLayoutData(gd);
button.addSelectionListener(new SelectionListener() {
@@ -239,6 +239,27 @@
}
});
+ label = new Label(group, SWT.RIGHT);
+ label.setText("Build: ");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 100;
+ label.setLayoutData(gd);
+
+ m_build=new Combo(group, SWT.DROP_DOWN);
+
+ for (int i=0; i < m_buildSystems.size(); i++) {
+ m_build.add(m_buildSystems.get(i).getName());
+ }
+
+ m_build.select(0);
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 100;
+ m_build.setLayoutData(gd);
+
return(composite);
}
@@ -326,6 +347,10 @@
error("Failed to generate ESB artefacts", e);
}
}
+
+ protected BuildSystem getSelectedBuildSystem() {
+ return(m_buildSystems.get(m_build.getSelectionIndex()));
+ }
protected void generateRole(Role role, String projectName)
throws Exception {
@@ -365,7 +390,7 @@
generateRoleProject(projectName,
target.getESBConfiguration(),
- lcm);
+ lcm, target);
} else {
logger.severe("Unable to find model generator");
}
@@ -374,14 +399,15 @@
}
protected void generateRoleProject(String projectName,
- org.w3c.dom.Element esbConfig, ConversationModel localcm)
- throws Exception {
+ org.w3c.dom.Element esbConfig, ConversationModel localcm,
+ ESBLanguageModel model) throws Exception {
final IJavaProject jproj=createJavaProject(projectName);
if (jproj != null && esbConfig != null) {
// Store ESB configuration
- IPath esbConfigPath=jproj.getPath().append(new Path(ESB_CONFIG_PATH));
+ IPath esbConfigPath=jproj.getPath().append(
+ new Path(getSelectedBuildSystem().getESBConfigFilePath()));
IFile
esbConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(esbConfigPath);
createParentFolder(esbConfigFile);
@@ -415,13 +441,119 @@
return true;
}
});
+
+ generateBuildConfigurationFile(jproj);
+
+ generateDeploymentFile(jproj, model);
+ generateJBMQConfigurationFile(jproj, model);
}
}
+ protected void generateBuildConfigurationFile(IJavaProject jproj)
+ throws Exception {
+
+ IPath buildConfigPath=jproj.getPath().append(
+ new Path(getSelectedBuildSystem().getBuildFilePath()));
+
+ IFile
buildConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(buildConfigPath);
+ createParentFolder(buildConfigFile);
+ buildConfigFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ String
config=getSelectedBuildSystem().getBuildFileContents(jproj.getProject().getName());
+
+ if (config != null) {
+ buildConfigFile.setContents(new java.io.ByteArrayInputStream(
+ config.getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ }
+ }
+
+
+ protected void generateJBMQConfigurationFile(IJavaProject jproj,
+ ESBLanguageModel model) throws Exception {
+
+ IPath buildConfigPath=jproj.getPath().append(
+ new Path(getSelectedBuildSystem().getJBMQConfigFilePath()));
+
+ IFile
buildConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(buildConfigPath);
+ createParentFolder(buildConfigFile);
+ buildConfigFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ StringBuffer buf=new StringBuffer();
+ buf.append("<server>\r\n");
+
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (iter.hasNext()) {
+ ESBService service=iter.next();
+
+ String dest=model.getJMSDefinition(service.getJMSBusIdRef());
+
+ if (dest != null) {
+ buf.append("\t<mbean
code=\"org.jboss.mq.server.jmx.Queue\"\r\n");
+ buf.append("\t\t\tname=\""+service.getCategory()+".destination:service=Queue,name="+dest+"\">\r\n");
+ buf.append("\t\t<depends
optional-attribute-name=\"DestinationManager\">\r\n");
+ buf.append("\t\t\tjboss.mq:service=DestinationManager\r\n");
+ buf.append("\t\t</depends>\r\n");
+ buf.append("\t</mbean>\r\n");
+ } else {
+ logger.severe("Failed to find destination for JMS bus id '"+
+ service.getJMSBusIdRef()+"'");
+ }
+ }
+
+ buf.append("</server>\r\n");
+
+ buildConfigFile.setContents(new java.io.ByteArrayInputStream(
+ buf.toString().getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ }
+
+ protected void generateDeploymentFile(IJavaProject jproj,
+ ESBLanguageModel model) throws Exception {
+
+ IPath deploymentPath=jproj.getPath().append(
+ new Path(getSelectedBuildSystem().getDeploymentFilePath()));
+
+ IFile
deploymentFile=jproj.getProject().getWorkspace().getRoot().getFile(deploymentPath);
+ createParentFolder(deploymentFile);
+ deploymentFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ StringBuffer buf=new StringBuffer();
+ buf.append("<jbossesb-deployment>\r\n");
+
+ java.util.Iterator<ESBService> iter=model.getServices().iterator();
+
+ while (iter.hasNext()) {
+ ESBService service=iter.next();
+
+ String dest=model.getJMSDefinition(service.getJMSBusIdRef());
+
+ if (dest != null) {
+ buf.append("\t<depends>"+service.getCategory()+
+ ".destination:service=Queue,name="+dest+
+ "</depends>\r\n");
+ } else {
+ logger.severe("Failed to find destination for JMS bus id '"+
+ service.getJMSBusIdRef()+"'");
+ }
+ }
+
+ buf.append("</jbossesb-deployment>\r\n");
+
+ deploymentFile.setContents(new java.io.ByteArrayInputStream(
+ buf.toString().getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ }
+
protected void generateBusinessObjectType(IJavaProject jproj,
Conversation conversation) throws Exception {
- IPath sourceLocation=jproj.getPath().append(new Path(JAVA_SOURCE_LOCATION));
+ IPath sourceLocation=jproj.getPath().append(
+ new Path(getSelectedBuildSystem().getJavaSourcePath()));
String javaClass=ConversationUtil.getBusinessObjectType(conversation);
@@ -650,7 +782,8 @@
IPath outputLocation=jproj.getPath().append(new Path(OUTPUT_LOCATION));
IPath classpathLocation=jproj.getPath().append(new Path(CLASSPATH_FILENAME));
- IPath sourceLocation=jproj.getPath().append(new Path(JAVA_SOURCE_LOCATION));
+ IPath sourceLocation=jproj.getPath().append(
+ new Path(getSelectedBuildSystem().getJavaSourcePath()));
// create and set the output and source paths first
IFolder outputFolder=
jproj.getProject().getWorkspace().getRoot().getFolder(outputLocation);
@@ -860,10 +993,12 @@
}
private static Logger logger =
Logger.getLogger("org.jboss.tools.overlord.jbossesb.dialogs");
-
+
private IFile m_file=null;
private ConversationModel m_conversationModel=null;
private java.util.List<Role> m_roles=null;
private java.util.List<Button> m_roleButtons=new
java.util.Vector<Button>();
private java.util.List<Text> m_projectNames=new java.util.Vector<Text>();
+ private Combo m_build=null;
+ private java.util.List<BuildSystem> m_buildSystems=new
java.util.Vector<BuildSystem>();
}
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/MavenBuildSystem.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/MavenBuildSystem.java
(rev 0)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/MavenBuildSystem.java 2008-08-07
11:31:06 UTC (rev 223)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.
+ */
+package org.jboss.tools.overlord.jbossesb.dialogs;
+
+/**
+ * This class represents the Ant build system.
+ */
+public class MavenBuildSystem implements BuildSystem {
+
+ private static final String BUILD_FILE = "pom.xml";
+ private static final String MAVEN = "Maven";
+ private static final String ESB_CONFIG_PATH =
"src/main/resources/META-INF/jboss-esb.xml";
+ private static final String DEPLOYMENT_PATH =
"src/main/resources/META-INF/deployment.xml";
+ private static final String JBMQ_CONFIG_PATH =
"src/main/resources/jbmq-queue-service.xml";
+ private static final String JAVA_SOURCE_PATH = "src/main/java";
+
+ /**
+ * This method represents the name of the build
+ * system.
+ *
+ * @return The name
+ */
+ public String getName() {
+ return(MAVEN);
+ }
+
+ /**
+ * This method returns the build configuration file
+ * path.
+ *
+ * @return The build configuration file path
+ */
+ public String getBuildFilePath() {
+ return(BUILD_FILE);
+ }
+
+ /**
+ * This method returns the contents for the build
+ * configuration file.
+ *
+ * @param projectName The project name
+ * @return The build file contents
+ */
+ public String getBuildFileContents(String projectName) {
+ StringBuffer ret=new StringBuffer();
+
+ ret.append("<project
xmlns=\"http://maven.apache.org/POM/4.0.0\"\r\n");
+
ret.append("\t\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-in...;
+
ret.append("\t\txsi:schemaLocation=\"http://maven.apache.org/PO...
http://maven.apache.org/maven-v4_0_0.xsd\">\r\n");
+
+ ret.append("</project>\r\n");
+
+ return(ret.toString());
+ }
+
+ /**
+ * This method returns the ESB configuration file
+ * path.
+ *
+ * @return The ESB configuration file path
+ */
+ public String getESBConfigFilePath() {
+ return(ESB_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the deployment file
+ * path.
+ *
+ * @return The deployment file path
+ */
+ public String getDeploymentFilePath() {
+ return(DEPLOYMENT_PATH);
+ }
+
+ /**
+ * This method returns the JBMQ configuration file
+ * path.
+ *
+ * @return The JBMQ configuration file path
+ */
+ public String getJBMQConfigFilePath() {
+ return(JBMQ_CONFIG_PATH);
+ }
+
+ /**
+ * This method returns the Java source path.
+ *
+ * @return The Java source path
+ */
+ public String getJavaSourcePath() {
+ return(JAVA_SOURCE_PATH);
+ }
+
+}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBLanguageModel.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBLanguageModel.java 2008-08-07
03:33:23 UTC (rev 222)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBLanguageModel.java 2008-08-07
11:31:06 UTC (rev 223)
@@ -432,6 +432,41 @@
return(ret);
}
+ /**
+ * This method returns the JMS destination associated with
+ * the supplied JMS Bus Id.
+ *
+ * @param jmsBusId The JMS bus id
+ * @return The JMS definition, or null if not found
+ */
+ public String getJMSDefinition(String jmsBusId) {
+ String ret=null;
+
+ org.w3c.dom.Element elem=findJMSBus(jmsBusId);
+
+ if (elem != null) {
+ org.w3c.dom.NodeList nl=
+ elem.getElementsByTagName(JMS_MESSAGE_FILTER_ELEMENT);
+
+ if (nl.getLength() != 0 &&
+ nl.item(0) instanceof org.w3c.dom.Element) {
+ org.w3c.dom.Element filter=(org.w3c.dom.Element)
+ nl.item(0);
+
+ if (filter.hasAttribute(DEST_NAME_ATTR)) {
+ ret = filter.getAttribute(DEST_NAME_ATTR);
+
+ // If prefixed, then strip prefix away
+ if (ret.startsWith(DEST_NAME_PREFIX)) {
+ ret = ret.substring(DEST_NAME_PREFIX.length());
+ }
+ }
+ }
+ }
+
+ return(ret);
+ }
+
protected void addJMSBus(String jmsBusId, String dest) {
org.w3c.dom.Element jmsBus=
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBLanguageModel.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBLanguageModel.java 2008-08-07
03:33:23 UTC (rev 222)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/ESBLanguageModel.java 2008-08-07
11:31:06 UTC (rev 223)
@@ -118,4 +118,13 @@
*/
public org.w3c.dom.Element getESBConfiguration();
+ /**
+ * This method returns the JMS destination associated with
+ * the supplied JMS Bus Id.
+ *
+ * @param jmsBusId The JMS bus id
+ * @return The JMS definition, or null if not found
+ */
+ public String getJMSDefinition(String jmsBusId);
+
}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/TestESBLanguageModel.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/TestESBLanguageModel.java 2008-08-07
03:33:23 UTC (rev 222)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/test/org/jboss/tools/overlord/jbossesb/model/TestESBLanguageModel.java 2008-08-07
11:31:06 UTC (rev 223)
@@ -105,6 +105,11 @@
return null;
}
+ public String getJMSDefinition(String jmsBusId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
private java.util.Map<String,ESBService> m_services=new
java.util.Hashtable<String,ESBService>();
private ESBService m_gatewayService=null;
private org.w3c.dom.Element m_esbConfig=null;