[savara-commits] savara SVN: r310 - in trunk/tools: plugins/org.jboss.savara.protocol.contract/META-INF and 11 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jul 7 10:25:00 EDT 2010


Author: objectiser
Date: 2010-07-07 10:24:59 -0400 (Wed, 07 Jul 2010)
New Revision: 310

Added:
   trunk/tools/plugins/org.jboss.savara.protocol.contract/META-INF/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/META-INF/MANIFEST.MF
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGeneratorFactory.java
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/osgi/
   trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/osgi/Activator.java
   trunk/tools/tests/org.jboss.savara.protocol.contract.tests/
   trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.classpath
   trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.project
   trunk/tools/tests/org.jboss.savara.protocol.contract.tests/Copyright.txt
   trunk/tools/tests/org.jboss.savara.protocol.contract.tests/build.properties
Log:
Initial contract generation plugins.

Added: trunk/tools/plugins/org.jboss.savara.protocol.contract/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/META-INF/MANIFEST.MF	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss SAVARA Protocol Contract Plugin
+Bundle-SymbolicName: org.jboss.savara.protocol.contract
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.savara.protocol.contract.osgi.Activator
+Bundle-Vendor: www.jboss.org
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.osgi.framework;version="1.3.0"
+Require-Bundle: org.scribble.core,
+ org.scribble.conversation.model,
+ org.jboss.savara.contract.model
+Export-Package: org.jboss.savara.protocol.contract

Added: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java	                        (rev 0)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGenerator.java	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,43 @@
+/*
+ * 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.savara.protocol.contract;
+
+import org.jboss.savara.contract.model.Contract;
+import org.scribble.conversation.model.Conversation;
+import org.scribble.model.Role;
+
+/**
+ * This interface represents the service that generates a contract
+ * from a protocol defining the behaviour of multiple interacting roles.
+ * 
+ */
+public interface ContractGenerator {
+
+	/**
+	 * This method generates a contract associated with a supplied protocol
+	 * and optional role. If the protocol represents a local model, then
+	 * the role will be derived from the local model. If the protocol represents
+	 * a global model, then a role must be supplied.
+	 * 
+	 * @param cm The protocol
+	 * @param role The optional role
+	 * @return The contract
+	 */
+	public Contract generate(Conversation cm, Role role) throws IllegalArgumentException;
+	
+}

Added: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGeneratorFactory.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGeneratorFactory.java	                        (rev 0)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/ContractGeneratorFactory.java	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,38 @@
+/*
+ * 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.savara.protocol.contract;
+
+import org.jboss.savara.protocol.contract.impl.ContractGeneratorImpl;
+
+/**
+ * This class provides access to a contract generator.
+ * 
+ */
+public class ContractGeneratorFactory {
+
+	/**
+	 * This method returns an instance of the ContractGenerator
+	 * interface.
+	 * 
+	 * @return The contract generator
+	 */
+	public static ContractGenerator getContractGenerator() {
+		return(new ContractGeneratorImpl());
+	}
+	
+}

Added: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties	                        (rev 0)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/Messages.properties	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,20 @@
+#/*
+# * 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.
+# */
+
+SAVARAPC-00001=Conversation must be supplied
+SAVARAPC-00002=Role has not been defined

Added: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java	                        (rev 0)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/impl/ContractGeneratorImpl.java	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,64 @@
+/*
+ * 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.savara.protocol.contract.impl;
+
+import java.text.MessageFormat;
+
+import org.jboss.savara.contract.model.Contract;
+import org.jboss.savara.protocol.contract.ContractGenerator;
+import org.scribble.conversation.model.Conversation;
+import org.scribble.model.Role;
+
+/**
+ * This class generates a contract from a protocol defining the behaviour of
+ * multiple interacting roles.
+ * 
+ */
+public class ContractGeneratorImpl implements ContractGenerator {
+
+	/**
+	 * This method generates a contract associated with a supplied protocol
+	 * and optional role. If the protocol represents a local model, then
+	 * the role will be derived from the local model. If the protocol represents
+	 * a global model, then a role must be supplied.
+	 * 
+	 * @param cm The protocol
+	 * @param role The optional role
+	 * @return The contract
+	 */
+	public Contract generate(Conversation cm, Role role) throws IllegalArgumentException {
+		
+		// Check parameters
+		if (cm == null) {
+			throw new IllegalArgumentException(MessageFormat.format(
+					java.util.PropertyResourceBundle.getBundle(
+						"org.jboss.savara.protocol.contract.Messages").
+							getString("SAVARAPC-00001"), (Object)null));
+			
+		} else if ((cm.getLocatedName() == null || cm.getLocatedName().getRole() == null) &&
+									role == null) {
+			throw new IllegalArgumentException(MessageFormat.format(
+					java.util.PropertyResourceBundle.getBundle(
+						"org.jboss.savara.protocol.contract.Messages").
+							getString("SAVARAPC-00002"), (Object)null));
+		}
+		
+		return(null);
+	}
+	
+}

Added: trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/osgi/Activator.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/osgi/Activator.java	                        (rev 0)
+++ trunk/tools/plugins/org.jboss.savara.protocol.contract/src/java/org/jboss/savara/protocol/contract/osgi/Activator.java	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,39 @@
+/*
+ * 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.savara.protocol.contract.osgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+	}
+
+}

Added: trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.classpath
===================================================================
--- trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.classpath	                        (rev 0)
+++ trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.classpath	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.project
===================================================================
--- trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.project	                        (rev 0)
+++ trunk/tools/tests/org.jboss.savara.protocol.contract.tests/.project	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.jboss.savara.protocol.contract.tests</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: trunk/tools/tests/org.jboss.savara.protocol.contract.tests/Copyright.txt
===================================================================
--- trunk/tools/tests/org.jboss.savara.protocol.contract.tests/Copyright.txt	                        (rev 0)
+++ trunk/tools/tests/org.jboss.savara.protocol.contract.tests/Copyright.txt	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */

Added: trunk/tools/tests/org.jboss.savara.protocol.contract.tests/build.properties
===================================================================
--- trunk/tools/tests/org.jboss.savara.protocol.contract.tests/build.properties	                        (rev 0)
+++ trunk/tools/tests/org.jboss.savara.protocol.contract.tests/build.properties	2010-07-07 14:24:59 UTC (rev 310)
@@ -0,0 +1,4 @@
+source.. = src/java/
+output.. = bin/
+bin.includes = META-INF/,\
+               .



More information about the savara-commits mailing list