Author: objectiser
Date: 2010-12-20 15:01:32 -0500 (Mon, 20 Dec 2010)
New Revision: 511
Added:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java
Removed:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/CDMProtocolParser.java
Log:
Changed resource locator to be in scribble common bundle, and changed the
BPELToProtocolModelGenerator to be a ProtocolParser implementation instead - so parser
used to obtain protocol model, and generator used to convert protocol model to other
representation.
Deleted:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -1,66 +0,0 @@
-/*
- * Copyright 2005-8 Pi4 Technologies Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Change History:
- * 24 Jul 2008 : Initial version created by gary
- */
-package org.savara.bpel.model.generator;
-
-import org.savara.bpel.BPELDefinitions;
-import org.savara.bpel.model.TProcess;
-import org.savara.bpel.model.generator.protocol.DefaultConversionContext;
-import org.savara.model.ProtocolDefinitions;
-import org.savara.model.generator.ModelGenerator;
-import org.savara.util.ResourceLocator;
-import org.scribble.common.logging.Journal;
-import org.scribble.protocol.model.*;
-
-/**
- * This class represents the BPEL to Protocol implementation of the model
- * generator interface.
- */
-public class BPELToProtocolModelGenerator implements ModelGenerator {
-
- public boolean isSupported(String sourceType, String targetType) {
- return(sourceType.equals(ProtocolDefinitions.PROTOCOL_TYPE) &&
- targetType.equals(BPELDefinitions.BPEL_TYPE));
- }
-
- public Object generate(Object source, Journal journal, ResourceLocator locator) {
- ProtocolModel ret=new ProtocolModel();
- TProcess process=(TProcess)source;
-
- //ret.derivedFrom(this);
- //ret.getBlock().derivedFrom(this);
-
- Protocol protocol=new Protocol();
-
- // Configure model name
- protocol.setName(process.getName());
-
- // Define implements reference for conversation type
- //String convType=getConversationType();
- String role=null;
-
- // Convert the process contents
- DefaultConversionContext context=new DefaultConversionContext(role, process, locator);
-
- context.convert(process, protocol.getBlock().getContents());
-
- return(ret);
- }
-
-}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -24,7 +24,7 @@
import org.savara.bpel.model.change.BPELModelChangeContext;
import org.savara.model.ProtocolDefinitions;
import org.savara.model.generator.ModelGenerator;
-import org.savara.util.ResourceLocator;
+import org.scribble.common.resource.ResourceLocator;
import org.scribble.common.logging.Journal;
import org.scribble.protocol.model.*;
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -20,7 +20,7 @@
import org.savara.bpel.model.TProcess;
import org.savara.bpel.model.TScope;
import org.savara.bpel.model.TVariable;
-import org.savara.util.ResourceLocator;
+import org.scribble.common.resource.ResourceLocator;
import org.scribble.protocol.model.Activity;
public interface ConversionContext {
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -20,7 +20,7 @@
import org.savara.bpel.model.TProcess;
import org.savara.bpel.model.TScope;
import org.savara.bpel.model.TVariable;
-import org.savara.util.ResourceLocator;
+import org.scribble.common.resource.ResourceLocator;
import org.scribble.protocol.model.Activity;
/**
Copied:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java
(from rev 508,
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/BPELToProtocolModelGenerator.java)
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java
(rev 0)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005-8 Pi4 Technologies Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Change History:
+ * 24 Jul 2008 : Initial version created by gary
+ */
+package org.savara.bpel.parser;
+
+import org.savara.bpel.BPELDefinitions;
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.generator.protocol.DefaultConversionContext;
+import org.savara.bpel.util.BPELModelUtil;
+import org.scribble.common.resource.ResourceLocator;
+import org.scribble.common.logging.Journal;
+import org.scribble.protocol.model.*;
+import org.scribble.protocol.parser.ProtocolParser;
+
+/**
+ * This class represents the BPEL to Protocol implementation of the model
+ * generator interface.
+ */
+public class BPELProtocolParser implements ProtocolParser {
+
+ public boolean isSupported(String sourceType) {
+ return(sourceType.equals(BPELDefinitions.BPEL_TYPE));
+ }
+
+ public ProtocolModel parse(java.io.InputStream is, Journal journal, ResourceLocator
locator)
+ throws java.io.IOException {
+ ProtocolModel ret=new ProtocolModel();
+
+ // Load BPEL from the input stream
+
+ TProcess process=BPELModelUtil.deserialize(is);
+
+ //ret.derivedFrom(this);
+ //ret.getBlock().derivedFrom(this);
+
+ Protocol protocol=new Protocol();
+
+ // Configure model name
+ protocol.setName(process.getName());
+
+ // Define implements reference for conversation type
+ //String convType=getConversationType();
+ String role=null;
+
+ // Convert the process contents
+ DefaultConversionContext context=new DefaultConversionContext(role, process, locator);
+
+ context.convert(process, protocol.getBlock().getContents());
+
+ return(ret);
+ }
+
+}
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/InteractionUtil.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -34,7 +34,7 @@
import org.savara.bpel.model.TScope;
import org.savara.bpel.model.TSequence;
import org.savara.bpel.model.change.InteractionPatterns;
-import org.savara.util.ResourceLocator;
+import org.scribble.common.resource.ResourceLocator;
import org.savara.util.XMLUtils;
import org.scribble.protocol.model.*;
Modified:
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/generator/ModelGenerator.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -19,7 +19,7 @@
*/
package org.savara.model.generator;
-import org.savara.util.ResourceLocator;
+import org.scribble.common.resource.ResourceLocator;
import org.scribble.common.logging.Journal;
/**
Deleted:
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/util/ResourceLocator.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -1,37 +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.savara.util;
-
-/**
- * This interface represents a resource locator that can be used to
- * load artifacts relative to another resource being processed.
- *
- */
-public interface ResourceLocator {
-
- /**
- * This method can be used to retrieve the URI of a resource which
- * is located at the specified URI, potentially relative to a resource
- * that is being processed.
- *
- * @param uri The relative URI of the resource to load
- * @return The URI, or null if not found
- */
- public java.net.URI getResourceURI(String uri);
-
-}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/CDMProtocolParser.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/CDMProtocolParser.java 2010-12-20
17:51:24 UTC (rev 510)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/CDMProtocolParser.java 2010-12-20
20:01:32 UTC (rev 511)
@@ -19,7 +19,6 @@
*/
package org.savara.pi4soa.cdm.parser;
-import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -30,6 +29,7 @@
import org.scribble.common.logging.Journal;
import org.scribble.protocol.model.ProtocolModel;
import org.scribble.protocol.parser.ProtocolParser;
+import org.scribble.common.resource.ResourceLocator;
/**
* This class provides the model parser for the CDM notation.
@@ -43,7 +43,12 @@
public CDMProtocolParser() {
}
- public ProtocolModel parse(InputStream is, Journal journal) {
+ public boolean isSupported(String sourceType) {
+ return("cdm".equals(sourceType));
+ }
+
+ public ProtocolModel parse(java.io.InputStream is, Journal journal, ResourceLocator
locator)
+ throws java.io.IOException {
ProtocolModel ret=null;
if (is != null) {