[overlord-commits] Overlord SVN: r640 - in cdl/trunk/tools/plugins: org.jboss.tools.overlord.cdl.bpel/META-INF and 16 other directories.
overlord-commits at lists.jboss.org
overlord-commits at lists.jboss.org
Mon May 11 17:06:51 EDT 2009
Author: objectiser
Date: 2009-05-11 17:06:51 -0400 (Mon, 11 May 2009)
New Revision: 640
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELModelParserRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELTokenizer.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBModelParserRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBTokenizer.java
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELParser.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/plugin.xml
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/export/BPELLanguageModelStreamExportRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/plugin.xml
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/GenerateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ClasspathUtil.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/plugintest/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorTest.java
Log:
Updated to use plugins as OSGi services, and changed to use DefaultParser rather than specialising it for ESB and BPEL use.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF 2009-05-11 21:06:51 UTC (rev 640)
@@ -10,7 +10,7 @@
org.scribble.core,
org.scribble.lang.model,
org.eclipse.core.resources,
- org.scribble.osgi,
+ org.scribble.eclipse,
org.eclipse.jdt.core,
org.junit,
org.scribble.conversation.parser,
@@ -19,7 +19,8 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: www.jboss.org
-Scribble-Extensions: org.jboss.tools.overlord.cdl.bpel.parser.BPELParser,
+Scribble-Extensions: org.jboss.tools.overlord.cdl.bpel.parser.BPELTokenizer,
+ org.jboss.tools.overlord.cdl.bpel.parser.BPELModelParserRule,
org.jboss.tools.overlord.cdl.bpel.model.BPELNotation,
org.jboss.tools.overlord.cdl.bpel.model.change.LanguageToConversationModelChangeRule,
org.jboss.tools.overlord.cdl.bpel.model.change.ConversationModelChangeRule,
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/plugin.xml
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/plugin.xml 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/plugin.xml 2009-05-11 21:06:51 UTC (rev 640)
@@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension
- id="org.jboss.tools.overlord.cdl.bpel.extension"
- name="Overlord CDL BPEL model extension"
- point="org.scribble.extension">
- </extension>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -28,7 +28,7 @@
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
-import org.scribble.osgi.util.*;
+import org.scribble.eclipse.util.*;
import org.jboss.tools.overlord.cdl.bpel.dialogs.*;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -62,7 +62,7 @@
*/
protected void initialize(IFile res) {
ModelReference ref=
- org.scribble.osgi.model.admin.OSGIModelRepository.createReference(res);
+ org.scribble.eclipse.model.admin.OSGIModelRepository.createReference(res);
if (ref != null) {
ModelRepository mrep=(ModelRepository)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/export/BPELLanguageModelStreamExportRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/export/BPELLanguageModelStreamExportRule.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/export/BPELLanguageModelStreamExportRule.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -25,7 +25,8 @@
import org.scribble.export.ExportRule;
import org.scribble.export.ExporterContext;
import org.scribble.export.Formatter;
-import org.scribble.export.stream.DefaultModelStreamExportRule;
+import org.scribble.export.stream.AbstractModelStreamExportRule;
+import org.scribble.export.stream.StreamFormatter;
import org.scribble.extensions.RegistryInfo;
import org.scribble.model.ModelObject;
@@ -34,7 +35,7 @@
* BPELLanguageModel entity.
*/
@RegistryInfo(extension=ExportRule.class,notation=BPELNotation.NOTATION_CODE)
-public class BPELLanguageModelStreamExportRule extends DefaultModelStreamExportRule {
+public class BPELLanguageModelStreamExportRule extends AbstractModelStreamExportRule {
/**
* This method determines whether the exporter rule is appropriate
@@ -60,10 +61,11 @@
public void export(ModelObject modelObject, ExporterContext context)
throws java.io.IOException {
BPELLanguageModel model=(BPELLanguageModel)modelObject;
+ StreamFormatter formatter=(StreamFormatter)context.getFormatter();
try {
String text=XMLUtils.toText(model.getBPELProcess().getDOMElement());
- context.getFormatter().record(text.getBytes());
+ formatter.record(text.getBytes());
} catch(Exception e) {
throw new java.io.IOException("Failed to get BPEL process text");
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -59,7 +59,7 @@
// Initialize the model
ModelReference ref=
- org.scribble.osgi.model.admin.OSGIModelRepository.createReference(res);
+ org.scribble.eclipse.model.admin.OSGIModelRepository.createReference(res);
if (ref != null) {
ModelRepository mrep=(ModelRepository)
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELModelParserRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELModelParserRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELModelParserRule.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -0,0 +1,111 @@
+/*
+ * 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.cdl.bpel.parser;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.scribble.extensions.RegistryInfo;
+import org.scribble.model.Model;
+import org.scribble.model.admin.ModelListener;
+import org.scribble.parser.ParserContext;
+import org.scribble.parser.ParserRule;
+import org.scribble.parser.Token;
+import org.jboss.tools.overlord.cdl.bpel.model.BPELNotation;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+/**
+ * This class provides the model parser for the BPEL notation.
+ *
+ */
+ at RegistryInfo(extension=ParserRule.class,notation=BPELNotation.NOTATION_CODE)
+public class BPELModelParserRule extends org.scribble.conversation.parser.ConversationModelParserRule {
+
+ /**
+ * The default constructor.
+ */
+ public BPELModelParserRule() {
+ //super(ParserRuleType.File);
+ }
+
+ /**
+ * This method determines whether the parser rules is
+ * appropriate to return a model object of the required
+ * type.
+ *
+ * @param type The required type
+ * @return Whether the parser rule returns a
+ * model object of the required type
+ */
+ public boolean isSupported(Class<?> type) {
+ return(type.isAssignableFrom(Model.class));
+ }
+
+ /**
+ * This method parses the description to obtain
+ * a model object of the appropriate type.
+ *
+ * @param context The context
+ * @param l The listener
+ * @return The model object
+ */
+ public Object parse(ParserContext context, ModelListener l) {
+ DefaultBPELLanguageModel ret=null;
+
+ Token t=context.nextToken();
+
+ if (t != null && t.getObject() instanceof String) {
+ try {
+ String str=(String)t.getObject();
+
+ // Transform the text representation to DOM
+ DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
+ fact.setNamespaceAware(true);
+
+ DocumentBuilder builder=fact.newDocumentBuilder();
+
+ // Need to load original input stream and then
+ // provide a second input stream, as some input stream
+ // implementations don't support 'reset' operation,
+ // and therefore this was the only way to extract the
+ // content and also provide the stream to the XML
+ // document builder.
+ java.io.ByteArrayInputStream bais=
+ new java.io.ByteArrayInputStream(str.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(bais);
+
+ // Identify the model associated with the
+ // changed resource
+ ret = new DefaultBPELLanguageModel(context.getSource(),
+ doc.getDocumentElement(), str);
+
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "Failed to load model", e);
+ }
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.parser");
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELParser.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELParser.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELParser.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -1,88 +0,0 @@
-/*
- * 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.cdl.bpel.parser;
-
-import java.io.InputStream;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.apache.log4j.Logger;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-import org.scribble.extensions.*;
-import org.scribble.parser.Parser;
-
-/**
- * This BPEL implementation of the Parser interface.
- *
- * @author gary
- */
- at RegistryInfo(extension=Parser.class,notation=BPELNotation.NOTATION_CODE)
-public class BPELParser extends org.scribble.conversation.parser.ConversationParser {
-
- /**
- * This method parses the source located using the supplied
- * scribble reference, to return a model. If any
- * errors are detected, they will be reported to the parser
- * listener.
- *
- * @param ref The scribble source reference
- * @param is The input stream
- * @param l The model listener
- * @return The model, or null if not found
- */
- public Model parse(ModelReference ref, InputStream is,
- ModelListener l) {
- DefaultBPELLanguageModel ret=null;
-
- try {
- // Transform the text representation to DOM
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- DocumentBuilder builder=fact.newDocumentBuilder();
-
- byte[] b=new byte[is.available()];
- is.read(b);
-
- // Need to load original input stream and then
- // provide a second input stream, as some input stream
- // implementations don't support 'reset' operation,
- // and therefore this was the only way to extract the
- // content and also provide the stream to the XML
- // document builder.
- java.io.ByteArrayInputStream bais=new java.io.ByteArrayInputStream(b);
-
- org.w3c.dom.Document doc=builder.parse(bais);
-
- // Identify the model associated with the
- // changed resource
- ret = new DefaultBPELLanguageModel(ref, doc.getDocumentElement(),
- new String(b));
-
- } catch(Exception e) {
- logger.error("Failed to load model", e);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger(BPELParser.class);
-}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELTokenizer.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELTokenizer.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELTokenizer.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -0,0 +1,59 @@
+/*
+ * 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.cdl.bpel.parser;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELNotation;
+import org.scribble.extensions.RegistryInfo;
+import org.scribble.model.ModelReference;
+import org.scribble.parser.*;
+
+/**
+ * This is the BPEL based implementation of the tokenizer
+ * interface.
+ */
+ at RegistryInfo(extension=Tokenizer.class,notation=BPELNotation.NOTATION_CODE)
+public class BPELTokenizer extends DefaultTokenizer {
+
+ /**
+ * The default constructor.
+ */
+ public BPELTokenizer() {
+ }
+
+ /**
+ * This method obtains a list of tokens based on the
+ * contents of the input stream.
+ *
+ * @param ref The model reference for the input source
+ * @param is The input stream
+ * @return The list of tokens
+ * @throws java.io.IOException Failed to derive
+ */
+ public java.util.List<Token> getTokens(ModelReference ref,
+ java.io.InputStream is) throws java.io.IOException {
+ java.util.List<Token> ret=new java.util.Vector<Token>();
+
+ byte[] b=new byte[is.available()];
+ is.read(b);
+
+ Token t=new Token(new String(b));
+ ret.add(t);
+
+ return(ret);
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -88,7 +88,7 @@
result.addError(this,
new Throwable("Unable to locate resource: "+filename));
} else {
- org.scribble.parser.Parser p=new org.scribble.conversation.parser.ConversationParser();
+ org.scribble.parser.Parser p=new org.scribble.parser.DefaultParser();
org.scribble.model.ModelReference ref=
new org.scribble.model.ModelReference(ConversationNotation.NOTATION_CODE);
org.scribble.model.admin.ModelListener l=
@@ -233,7 +233,7 @@
result.addError(this,
new Throwable("Unable to locate resource: "+filename));
} else {
- org.scribble.parser.Parser p=new org.pi4soa.scribble.cdm.parser.CDMParser();
+ org.scribble.parser.Parser p=new org.scribble.parser.DefaultParser();
org.scribble.model.ModelReference ref=
new org.scribble.model.ModelReference(CDMNotation.NOTATION_CODE);
org.scribble.model.admin.ModelListener l=
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/META-INF/MANIFEST.MF 2009-05-11 21:06:51 UTC (rev 640)
@@ -10,7 +10,7 @@
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.jdt.core,
- org.scribble.osgi,
+ org.scribble.eclipse,
org.scribble.conversation.model,
org.scribble.lang.model,
org.scribble.core,
@@ -21,7 +21,8 @@
org.eclipse.ui.editors,
org.scribble.conversation.parser,
org.junit
-Scribble-Extensions: org.jboss.tools.overlord.cdl.runtime.jbossesb.parser.JBossESBParser,
+Scribble-Extensions: org.jboss.tools.overlord.cdl.runtime.jbossesb.parser.JBossESBTokenizer,
+ org.jboss.tools.overlord.cdl.runtime.jbossesb.parser.JBossESBModelParserRule,
org.jboss.tools.overlord.cdl.runtime.jbossesb.model.JBossESBNotation,
org.jboss.tools.overlord.cdl.runtime.jbossesb.editor.JBossESBConfigEditorManager,
org.jboss.tools.overlord.cdl.runtime.jbossesb.validation.ESBLanguageModelValidationRule,
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/plugin.xml
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/plugin.xml 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/plugin.xml 2009-05-11 21:06:51 UTC (rev 640)
@@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension
- id="org.jboss.tools.overlord.cdl.runtime.jbossesb.extension"
- name="Overlord CDL Runtime JBossESB model extension"
- point="org.scribble.extension">
- </extension>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/GenerateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/GenerateAction.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/actions/GenerateAction.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -29,7 +29,7 @@
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
-import org.scribble.osgi.util.*;
+import org.scribble.eclipse.util.*;
import org.jboss.tools.overlord.cdl.runtime.jbossesb.dialogs.*;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/dialogs/GenerateDialog.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -66,7 +66,7 @@
*/
protected void initialize(IFile res) {
ModelReference ref=
- org.scribble.osgi.model.admin.OSGIModelRepository.createReference(res);
+ org.scribble.eclipse.model.admin.OSGIModelRepository.createReference(res);
if (ref != null) {
ModelRepository mrep=(ModelRepository)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/editor/JBossESBConfigEditorManager.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -45,10 +45,10 @@
java.util.Map<String,Object> props) {
String uri=null;
org.eclipse.core.resources.IFile file=
- org.scribble.osgi.model.admin.OSGIModelRepository.getFile(mref);
+ org.scribble.eclipse.model.admin.OSGIModelRepository.getFile(mref);
if (file == null || file.exists() == false) {
- file = org.scribble.osgi.model.admin.OSGIModelRepository.getGlobalFile(mref);
+ file = org.scribble.eclipse.model.admin.OSGIModelRepository.getGlobalFile(mref);
}
if (file != null && file.exists()) {
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/export/ESBLanguageModelStreamExportRule.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -34,7 +34,7 @@
* ESBLanguageModel entity.
*/
@RegistryInfo(extension=ExportRule.class,notation=JBossESBNotation.NOTATION_CODE)
-public class ESBLanguageModelStreamExportRule extends DefaultModelStreamExportRule {
+public class ESBLanguageModelStreamExportRule extends AbstractModelStreamExportRule {
/**
* This method determines whether the exporter rule is appropriate
@@ -60,11 +60,12 @@
public void export(ModelObject modelObject, ExporterContext context)
throws java.io.IOException {
ESBLanguageModel model=(ESBLanguageModel)modelObject;
+ StreamFormatter formatter=(StreamFormatter)context.getFormatter();
try {
String text=getText(model.getESBConfiguration());
- context.getFormatter().record(text.getBytes());
+ formatter.record(text.getBytes());
} catch(Exception e) {
throw new java.io.IOException("Failed to get ESB configuration text");
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/Generator.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -78,7 +78,7 @@
// Initialize the model
ModelReference ref=
- org.scribble.osgi.model.admin.OSGIModelRepository.createReference(res);
+ org.scribble.eclipse.model.admin.OSGIModelRepository.createReference(res);
if (ref != null) {
ModelRepository mrep=(ModelRepository)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ClasspathUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ClasspathUtil.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/util/ClasspathUtil.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -18,7 +18,7 @@
package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.util;
import org.scribble.model.*;
-import org.scribble.osgi.model.admin.OSGIModelRepository;
+import org.scribble.eclipse.model.admin.OSGIModelRepository;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBModelParserRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBModelParserRule.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBModelParserRule.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -0,0 +1,111 @@
+/*
+ * 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.cdl.runtime.jbossesb.parser;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.scribble.extensions.RegistryInfo;
+import org.scribble.model.Model;
+import org.scribble.model.admin.ModelListener;
+import org.scribble.parser.ParserContext;
+import org.scribble.parser.ParserRule;
+import org.scribble.parser.Token;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.DefaultESBLanguageModel;
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.JBossESBNotation;
+
+/**
+ * This class provides the model parser for the JBossESB notation.
+ *
+ */
+ at RegistryInfo(extension=ParserRule.class,notation=JBossESBNotation.NOTATION_CODE)
+public class JBossESBModelParserRule extends org.scribble.conversation.parser.ConversationModelParserRule {
+
+ /**
+ * The default constructor.
+ */
+ public JBossESBModelParserRule() {
+ //super(ParserRuleType.File);
+ }
+
+ /**
+ * This method determines whether the parser rules is
+ * appropriate to return a model object of the required
+ * type.
+ *
+ * @param type The required type
+ * @return Whether the parser rule returns a
+ * model object of the required type
+ */
+ public boolean isSupported(Class<?> type) {
+ return(type.isAssignableFrom(Model.class));
+ }
+
+ /**
+ * This method parses the description to obtain
+ * a model object of the appropriate type.
+ *
+ * @param context The context
+ * @param l The listener
+ * @return The model object
+ */
+ public Object parse(ParserContext context, ModelListener l) {
+ DefaultESBLanguageModel ret=null;
+
+ Token t=context.nextToken();
+
+ if (t != null && t.getObject() instanceof String) {
+ try {
+ String str=(String)t.getObject();
+
+ // Transform the text representation to DOM
+ DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
+ fact.setNamespaceAware(true);
+
+ DocumentBuilder builder=fact.newDocumentBuilder();
+
+ // Need to load original input stream and then
+ // provide a second input stream, as some input stream
+ // implementations don't support 'reset' operation,
+ // and therefore this was the only way to extract the
+ // content and also provide the stream to the XML
+ // document builder.
+ java.io.ByteArrayInputStream bais=
+ new java.io.ByteArrayInputStream(str.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(bais);
+
+ // Identify the model associated with the
+ // changed resource
+ ret = new DefaultESBLanguageModel(context.getSource(),
+ doc.getDocumentElement(), str);
+
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "Failed to load model", e);
+ }
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.parser");
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBParser.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -1,91 +0,0 @@
-/*
- * 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.cdl.runtime.jbossesb.parser;
-
-import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
-import org.scribble.extensions.*;
-import org.scribble.parser.Parser;
-
-/**
- * This JBossESB implementation of the Parser interface.
- *
- * @author gary
- */
- at RegistryInfo(extension=Parser.class,notation=JBossESBNotation.NOTATION_CODE)
-public class JBossESBParser extends org.scribble.conversation.parser.ConversationParser {
-
- /**
- * This method parses the source located using the supplied
- * scribble reference, to return a model. If any
- * errors are detected, they will be reported to the parser
- * listener.
- *
- * @param ref The scribble source reference
- * @param is The input stream
- * @param l The model listener
- * @return The model, or null if not found
- */
- public Model parse(ModelReference ref, InputStream is,
- ModelListener l) {
- DefaultESBLanguageModel ret=null;
-
- try {
- // Transform the text representation to DOM
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- DocumentBuilder builder=fact.newDocumentBuilder();
-
- byte[] b=new byte[is.available()];
- is.read(b);
-
- // Need to load original input stream and then
- // provide a second input stream, as some input stream
- // implementations don't support 'reset' operation,
- // and therefore this was the only way to extract the
- // content and also provide the stream to the XML
- // document builder.
- java.io.ByteArrayInputStream bais=
- new java.io.ByteArrayInputStream(b);
-
- org.w3c.dom.Document doc=builder.parse(bais);
-
- // Identify the model associated with the
- // changed resource
- ret = new DefaultESBLanguageModel(ref, doc.getDocumentElement(),
- new String(b));
-
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to load model", e);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.parser");
-}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBTokenizer.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBTokenizer.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/parser/JBossESBTokenizer.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -0,0 +1,59 @@
+/*
+ * 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.cdl.runtime.jbossesb.parser;
+
+import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.JBossESBNotation;
+import org.scribble.extensions.RegistryInfo;
+import org.scribble.model.ModelReference;
+import org.scribble.parser.*;
+
+/**
+ * This is the JBossESB based implementation of the tokenizer
+ * interface.
+ */
+ at RegistryInfo(extension=Tokenizer.class,notation=JBossESBNotation.NOTATION_CODE)
+public class JBossESBTokenizer extends DefaultTokenizer {
+
+ /**
+ * The default constructor.
+ */
+ public JBossESBTokenizer() {
+ }
+
+ /**
+ * This method obtains a list of tokens based on the
+ * contents of the input stream.
+ *
+ * @param ref The model reference for the input source
+ * @param is The input stream
+ * @return The list of tokens
+ * @throws java.io.IOException Failed to derive
+ */
+ public java.util.List<Token> getTokens(ModelReference ref,
+ java.io.InputStream is) throws java.io.IOException {
+ java.util.List<Token> ret=new java.util.Vector<Token>();
+
+ byte[] b=new byte[is.available()];
+ is.read(b);
+
+ Token t=new Token(new String(b));
+ ret.add(t);
+
+ return(ret);
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/plugintest/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/plugintest/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorTest.java 2009-05-05 10:43:37 UTC (rev 639)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/plugintest/org/jboss/tools/overlord/cdl/runtime/jbossesb/generator/GeneratorTest.java 2009-05-11 21:06:51 UTC (rev 640)
@@ -72,7 +72,7 @@
result.addError(this,
new Throwable("Unable to locate resource: "+filename));
} else {
- org.scribble.parser.Parser p=new org.scribble.conversation.parser.ConversationParser();
+ org.scribble.parser.Parser p=new org.scribble.parser.DefaultParser();
org.scribble.model.ModelReference ref=
new org.scribble.model.ModelReference(ConversationNotation.NOTATION_CODE);
org.scribble.model.admin.DefaultModelListener l=
More information about the overlord-commits
mailing list