You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2008/11/13 17:15:26 UTC
svn commit: r713748 - in /geronimo/plugins/tuscany/trunk: ./
geronimo-tuscany/ geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/
samples/helloworld-jsp/src/main/webapp/WEB-INF/ tuscany-tomcat/
tuscany-tomcat/src/main/plan/
Author: vamsic007
Date: Thu Nov 13 08:15:25 2008
New Revision: 713748
URL: http://svn.apache.org/viewvc?rev=713748&view=rev
Log:
GERONIMO-4343 Tuscany Geronimo plugin bring up
o Adding a ModuleBuilderExtension for tomcat-deployer.
o For now, hook up the MBE by modifying var/config/config.xml as given in http://www.mail-archive.com/dev@geronimo.apache.org/msg66316.html . Make sure the server is stopped before modifying config.xml.
Added:
geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java (with props)
geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite (with props)
Modified:
geronimo/plugins/tuscany/trunk/geronimo-tuscany/pom.xml
geronimo/plugins/tuscany/trunk/pom.xml
geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/geronimo-web.xml
geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml
geronimo/plugins/tuscany/trunk/tuscany-tomcat/src/main/plan/plan.xml
Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/pom.xml?rev=713748&r1=713747&r2=713748&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/pom.xml (original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/pom.xml Thu Nov 13 08:15:25 2008
@@ -44,6 +44,10 @@
<groupId>org.apache.geronimo.framework</groupId>
<artifactId>geronimo-service-builder</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-naming-builder</artifactId>
+ </dependency>
<!-- Tuscany dependencies -->
<dependency>
Added: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java?rev=713748&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java (added)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java Thu Nov 13 08:15:25 2008
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.geronimo.tuscany;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.Collection;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.zip.ZipEntry;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.IOUtil;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.Repository;
+
+/**
+ * A ModuleBuilderExtension to process SCA artifacts.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyModuleBuilderExtension implements ModuleBuilderExtension {
+ private Environment defaultEnvironment;
+ private AbstractNameQuery embeddedSCADomainQuery;
+ private NamingBuilder namingBuilders;
+
+ public TuscanyModuleBuilderExtension(Environment defaultEnvironment, AbstractNameQuery embeddedSCADomainQuery, NamingBuilder namingBuilders) {
+ this.defaultEnvironment = defaultEnvironment;
+ this.embeddedSCADomainQuery = embeddedSCADomainQuery;
+ this.namingBuilders = namingBuilders;
+ }
+
+ public void createModule(Module module, Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+ System.out.println("Inside TuscanyModuleBuilderExtension.createModule");
+ // TODO: Merge environment only for SCA enhanced apps.
+ EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
+ }
+
+ public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException {
+ }
+
+ public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
+ }
+
+ public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
+ System.out.println("Inside TuscanyModuleBuilderExtension.addGBeans");
+ Naming naming = earContext.getNaming();
+
+ // Add EmbeddedRuntimeGBean to the application config.
+ AbstractName moduleName = earContext.getModuleName();
+ AbstractName abstractName = naming.createChildName(moduleName, "EmbeddedRuntime", "GBean");
+ GBeanInfo gBeanInfo = GBeanInfo.getGBeanInfo(EmbeddedRuntimeGBean.class.getName(), cl);
+ GBeanData data = new GBeanData(abstractName, gBeanInfo);
+ data.setReferencePattern("embeddedSCADomainRef", embeddedSCADomainQuery);
+ data.setReferencePattern("Repository", new AbstractNameQuery(Repository.class.getName()));
+
+ // FIXME: Eliminate this hack.
+ // HACK: Create a JAR file with the web.composite file and place it as META-INF/application-composite.jar
+ // to deploy to the SCA domain
+ File webCompositeFile = new File(earContext.getBaseDir(), "WEB-INF/web.composite");
+ File appCompositeJarFile = new File(earContext.getBaseDir(), "META-INF/application-composite.jar");
+ JarOutputStream jarOut = null;
+ FileInputStream fin = null;
+ try {
+ fin = new FileInputStream(webCompositeFile);
+ jarOut = new JarOutputStream(new FileOutputStream(appCompositeJarFile));
+ jarOut.putNextEntry(new ZipEntry("web.composite"));
+ int b;
+ while((b = fin.read()) != -1) {
+ jarOut.write(b);
+ }
+ jarOut.closeEntry();
+ } catch (Exception e) {
+ throw new DeploymentException(e);
+ } finally {
+ IOUtil.close(fin);
+ IOUtil.close(jarOut);
+ }
+
+ data.setAttribute("jarFileName", "META-INF/application-composite.jar");
+ try {
+ earContext.addGBean(data);
+ } catch (GBeanAlreadyExistsException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(TuscanyModuleBuilderExtension.class, NameFactory.MODULE_BUILDER);
+ infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true);
+ infoBuilder.addAttribute("embeddedSCADomainQuery", AbstractNameQuery.class, true, true);
+ infoBuilder.addReference("NamingBuilders", NamingBuilder.class, NameFactory.MODULE_BUILDER);
+
+ infoBuilder.setConstructor(new String[]{
+ "defaultEnvironment",
+ "embeddedSCADomainQuery",
+ "NamingBuilders"});
+ GBEAN_INFO = infoBuilder.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+}
Propchange: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/plugins/tuscany/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/pom.xml?rev=713748&r1=713747&r2=713748&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/pom.xml (original)
+++ geronimo/plugins/tuscany/trunk/pom.xml Thu Nov 13 08:15:25 2008
@@ -253,6 +253,11 @@
<version>${geronimoVersion}</version>
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-naming-builder</artifactId>
+ <version>${geronimoVersion}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.framework</groupId>
<artifactId>geronimo-service-builder</artifactId>
<version>${geronimoVersion}</version>
Modified: geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/geronimo-web.xml?rev=713748&r1=713747&r2=713748&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/geronimo-web.xml (original)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/geronimo-web.xml Thu Nov 13 08:15:25 2008
@@ -21,18 +21,12 @@
<environment>
<moduleId>
<groupId>test</groupId>
- <artifactId>helloworld-sample</artifactId>
+ <artifactId>helloworld-jsp</artifactId>
<version>2.0</version>
<type>car</type>
</moduleId>
- <dependencies>
- <dependency>
- <groupId> org.apache.geronimo.plugins</groupId>
- <artifactId>tuscany-tomcat</artifactId>
- <type>car</type>
- </dependency>
- </dependencies>
+ <dependencies/>
<hidden-classes/>
- <non-overridable-classes/>
+ <non-overridable-classes/>
</environment>
</web-app>
Added: geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite?rev=713748&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite (added)
+++ geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite Thu Nov 13 08:15:25 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ name="Helloworld-web">
+
+ <component name="foo">
+ <implementation.web web-uri="helloworld-jsp.war"/>
+ <reference name="service" target="HelloworldComponent" />
+ </component>
+
+</composite>
Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/plugins/tuscany/trunk/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.composite
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml?rev=713748&r1=713747&r2=713748&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml (original)
+++ geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml Thu Nov 13 08:15:25 2008
@@ -129,6 +129,11 @@
</dependency>
<dependency>
<groupId>org.apache.geronimo.configs</groupId>
+ <artifactId>j2ee-deployer</artifactId>
+ <type>car</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.configs</groupId>
<artifactId>jasper</artifactId>
<type>car</type>
</dependency>
Modified: geronimo/plugins/tuscany/trunk/tuscany-tomcat/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/tuscany-tomcat/src/main/plan/plan.xml?rev=713748&r1=713747&r2=713748&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/tuscany-tomcat/src/main/plan/plan.xml (original)
+++ geronimo/plugins/tuscany/trunk/tuscany-tomcat/src/main/plan/plan.xml Thu Nov 13 08:15:25 2008
@@ -54,4 +54,21 @@
<gbean name="GeronimoSCADomain" class="org.apache.geronimo.tuscany.EmbeddedSCADomainGBean">
<attribute name="domainUri">http://localhost/</attribute>
</gbean>
+ <gbean name="TuscanyModuleBuilderExtension" class="org.apache.geronimo.tuscany.TuscanyModuleBuilderExtension">
+ <attribute name="embeddedSCADomainQuery">?name=GeronimoSCADomain</attribute>
+ <reference name="NamingBuilders">
+ <name>NamingBuilders</name>
+ </reference>
+ <xml-attribute name="defaultEnvironment">
+ <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.plugins</groupId>
+ <artifactId>tuscany-tomcat</artifactId>
+ <type>car</type>
+ </dependency>
+ </dependencies>
+ </environment>
+ </xml-attribute>
+ </gbean>
</module>