diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-15 20:48:16 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-15 20:48:16 +0000 |
commit | 964599075e940f75b7d0e3d7c801b8d836a6f678 (patch) | |
tree | 3333731611b295555c68c63f2a7a7f52eda327fb | |
parent | 72995b913d55d1766c3bf77086c8d09d5e1a3659 (diff) |
Porting javascript extensibility from 1.x
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@836416 13f79535-47bb-0310-9956-ffa450edef68
7 files changed, 83 insertions, 50 deletions
diff --git a/java/sca/modules/web-javascript-dojo/META-INF/MANIFEST.MF b/java/sca/modules/web-javascript-dojo/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..72e50d6c58 --- /dev/null +++ b/java/sca/modules/web-javascript-dojo/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0
+Tool: Bnd-0.0.357
+Bundle-Name: Apache Tuscany SCA Web JavaScript (DOJO)
+Created-By: 1.6.0_15 (Apple Inc.)
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bnd-LastModified: 1258084980430
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA Web JavaScript
+Import-Package: javax.xml.namespace,
+ org.apache.tuscany.sca.assembly;version="2.0.0",
+ org.apache.tuscany.sca.assembly.xml;version="2.0.0",
+ org.apache.tuscany.sca.core;version="2.0.0",
+ org.apache.tuscany.sca.extensibility,
+ org.apache.tuscany.sca.monitor;version="2.0.0",
+ org.apache.tuscany.sca.runtime;version="2.0.0"
+Bundle-SymbolicName: org.apache.tuscany.sca.core.web.javascript.dojo
+Bundle-DocURL: http://www.apache.org/
+
diff --git a/java/sca/modules/web-javascript-dojo/pom.xml b/java/sca/modules/web-javascript-dojo/pom.xml index 47460d3005..3986c1d760 100644 --- a/java/sca/modules/web-javascript-dojo/pom.xml +++ b/java/sca/modules/web-javascript-dojo/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-modules</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> @@ -33,19 +33,19 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-core</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-host-http</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> - <version>2.4</version> <!-- to keep compatible with older servlet containers --> + <version>2.5</version> <!-- to keep compatible with older servlet containers --> <scope>provided</scope> </dependency> diff --git a/java/sca/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java b/java/sca/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java index 987ef466fc..ba4ddc4b2c 100644 --- a/java/sca/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java +++ b/java/sca/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java @@ -34,12 +34,16 @@ public class DojoModuleActivator implements ModuleActivator { private static final String tuscanyBaseUri = URI.create("/tuscany").toString(); private static final String tuscanyUri = URI.create("/tuscany/*").toString(); - + private ServletHost servletHost; - public void start(ExtensionPointRegistry registry) { + public DojoModuleActivator(ExtensionPointRegistry registry) { ServletHostExtensionPoint servletHosts = registry.getExtensionPoint(ServletHostExtensionPoint.class); - this.servletHost = servletHosts.getServletHosts().get(0); + + this.servletHost = servletHosts.getServletHosts().get(0); + } + + public void start() { if (servletHost == null) { throw new IllegalStateException("Can't find ServletHost reference !"); @@ -67,7 +71,7 @@ public class DojoModuleActivator implements ModuleActivator { } - public void stop(ExtensionPointRegistry registry) { + public void stop() { Servlet servlet = servletHost.getServletMapping(dojoBaseUri); if(servlet != null) { servletHost.removeServletMapping(dojoBaseUri); @@ -80,5 +84,4 @@ public class DojoModuleActivator implements ModuleActivator { servletHost = null; } - } diff --git a/java/sca/modules/web-javascript/META-INF/MANIFEST.MF b/java/sca/modules/web-javascript/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..f45638fedb --- /dev/null +++ b/java/sca/modules/web-javascript/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0
+Tool: Bnd-0.0.357
+Bundle-Name: Apache Tuscany SCA Web JavaScript
+Created-By: 1.6.0_15 (Apple Inc.)
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 2.0.0
+Bnd-LastModified: 1258084980430
+Bundle-ManifestVersion: 2
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Description: Apache Tuscany SCA Web JavaScript
+Import-Package: javax.xml.namespace,
+ org.apache.tuscany.sca.assembly;version="2.0.0",
+ org.apache.tuscany.sca.assembly.xml;version="2.0.0",
+ org.apache.tuscany.sca.core;version="2.0.0",
+ org.apache.tuscany.sca.extensibility,
+ org.apache.tuscany.sca.monitor;version="2.0.0",
+ org.apache.tuscany.sca.runtime;version="2.0.0"
+Bundle-SymbolicName: org.apache.tuscany.sca.core.web.javascript
+Bundle-DocURL: http://www.apache.org/
+Export-Package: org.apache.tuscany.sca.web.javascript;version="2.0.0"
+
diff --git a/java/sca/modules/web-javascript/pom.xml b/java/sca/modules/web-javascript/pom.xml index 62518e3406..dbaa36fbc8 100644 --- a/java/sca/modules/web-javascript/pom.xml +++ b/java/sca/modules/web-javascript/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-modules</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> @@ -33,7 +33,7 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-core</artifactId> - <version>1.6-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </dependency> <dependency> @@ -42,26 +42,5 @@ <version>4.5</version> <scope>test</scope> </dependency> - </dependencies> - - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <configuration> - <instructions> - <Bundle-Version>${tuscany.version}</Bundle-Version> - <Bundle-SymbolicName>org.apache.tuscany.sca.core.web</Bundle-SymbolicName> - <Bundle-Description>${pom.name}</Bundle-Description> - <Export-Package>org.apache.tuscany.sca.core.web</Export-Package> - <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - </project> diff --git a/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java b/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java index 79ddab1c60..51f243ebcf 100644 --- a/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java +++ b/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java @@ -22,10 +22,10 @@ package org.apache.tuscany.sca.web.javascript; import java.io.IOException; import java.lang.reflect.Constructor; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import javax.xml.namespace.QName; @@ -35,9 +35,6 @@ import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; -import org.apache.tuscany.sca.monitor.impl.ProblemImpl; /** @@ -72,10 +69,18 @@ public class DefaultComponentJavaScriptGeneratorExtensionPoint implements Compon * @param model */ private void error(String message, Object model, Exception ex) { + /* if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "web-javascript-validation-messages", Severity.ERROR, model, message, ex); + Problem problem = + monitor.createProblem(this.getClass().getName(), + Messages.RESOURCE_BUNDLE, + Severity.ERROR, + model, + message, + ex); monitor.problem(problem); - } + } + */ } public void addComponentJavaScriptGenerator(ComponentJavaScriptGenerator componentScriptGenerator) { @@ -120,7 +125,7 @@ public class DefaultComponentJavaScriptGeneratorExtensionPoint implements Compon } // Get the proxy factories declarations - Set<ServiceDeclaration> factoryDeclarations = null; + Collection<ServiceDeclaration> factoryDeclarations = null; try { factoryDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ComponentJavaScriptGenerator.class); } catch (IOException e) { diff --git a/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java b/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java index 6ec7577d52..60f69615ed 100644 --- a/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java +++ b/java/sca/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java @@ -21,22 +21,19 @@ package org.apache.tuscany.sca.web.javascript; import java.io.IOException; import java.lang.reflect.Constructor; +import java.util.Collection; import java.util.HashMap; import java.util.Map; -import java.util.Set; import javax.xml.namespace.QName; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; -import org.apache.tuscany.sca.monitor.impl.ProblemImpl; /** * Default extension point for javascript proxy factories @@ -67,10 +64,18 @@ public class DefaultJavascriptProxyFactoryExtensionPoint implements JavascriptPr * @param model */ private void error(String message, Object model, Exception ex) { + /* if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "web-javascript-validation-messages", Severity.ERROR, model, message, ex); + Problem problem = + monitor.createProblem(this.getClass().getName(), + Messages.RESOURCE_BUNDLE, + Severity.WARNING, + model, + message, + (Object[])messageParameters); monitor.problem(problem); - } + } + */ } public void addProxyFactory(JavascriptProxyFactory javascriptProxyfactory) { @@ -111,7 +116,7 @@ public class DefaultJavascriptProxyFactoryExtensionPoint implements JavascriptPr if (bindingType.isInterface()) { // Dynamically load a factory class declared under META-INF/services try { - Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(bindingType); + Class<?> factoryClass = ServiceDiscovery.getInstance().getServiceDeclaration(bindingType).getClass(); if (factoryClass != null) { try { @@ -121,7 +126,7 @@ public class DefaultJavascriptProxyFactoryExtensionPoint implements JavascriptPr } catch (NoSuchMethodException e) { // Constructor taking the model factory extension point - Constructor<?> constructor = factoryClass.getConstructor(ModelFactoryExtensionPoint.class); + Constructor<?> constructor = factoryClass.getConstructor(FactoryExtensionPoint.class); factory = (JavascriptProxyFactory) constructor.newInstance(this); } @@ -135,7 +140,7 @@ public class DefaultJavascriptProxyFactoryExtensionPoint implements JavascriptPr // Call the newInstance static method on the factory abstract class try { - factory = (JavascriptProxyFactory) ServiceDiscovery.getInstance().newFactoryClassInstance(bindingType); + factory = (JavascriptProxyFactory) ServiceDiscovery.getInstance().getServiceDeclaration(bindingType); } catch (Exception e) { throw new IllegalArgumentException(e); } @@ -186,7 +191,7 @@ public class DefaultJavascriptProxyFactoryExtensionPoint implements JavascriptPr } // Get the proxy factories declarations - Set<ServiceDeclaration> factoryDeclarations = null; + Collection<ServiceDeclaration> factoryDeclarations = null; try { factoryDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(JavascriptProxyFactory.class); } catch (IOException e) { |