geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r660557 [1/2] - in /geronimo/sandbox/quartz-plugin: ./ base/ base/console/ base/console/src/ base/console/src/java/ base/console/src/java/org/ base/console/src/java/org/gplugins/ base/console/src/java/org/gplugins/console/ base/console/src/...
Date Tue, 27 May 2008 15:23:16 GMT
Author: ammulder
Date: Tue May 27 08:22:56 2008
New Revision: 660557

URL: http://svn.apache.org/viewvc?rev=660557&view=rev
Log:
Donate the Quartz plugin to Apache

Added:
    geronimo/sandbox/quartz-plugin/
    geronimo/sandbox/quartz-plugin/base/
    geronimo/sandbox/quartz-plugin/base/console/
    geronimo/sandbox/quartz-plugin/base/console/pom.xml
    geronimo/sandbox/quartz-plugin/base/console/src/
    geronimo/sandbox/quartz-plugin/base/console/src/java/
    geronimo/sandbox/quartz-plugin/base/console/src/java/org/
    geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/
    geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/
    geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/quartz/
    geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/quartz/QuartzPortlet.java
    geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/util/
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/portlet.xml
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/tld/
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/tld/portlet.tld
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/view/
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/view/quartz/
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/view/quartz/list.jsp
    geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/web.xml
    geronimo/sandbox/quartz-plugin/base/deployer/
    geronimo/sandbox/quartz-plugin/base/deployer/pom.xml
    geronimo/sandbox/quartz-plugin/base/deployer/src/
    geronimo/sandbox/quartz-plugin/base/deployer/src/conf/
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/AddQuartzToJ2EEModule.java
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/NamingHelper.java
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployer.java
    geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployerGBean.java
    geronimo/sandbox/quartz-plugin/base/deployer/src/resources/
    geronimo/sandbox/quartz-plugin/base/deployer/src/resources/META-INF/
    geronimo/sandbox/quartz-plugin/base/deployer/src/schema/
    geronimo/sandbox/quartz-plugin/base/deployer/src/schema/geronimo-quartz-0.2.xsd
    geronimo/sandbox/quartz-plugin/base/deployer/src/schema/xmlconfig.xml
    geronimo/sandbox/quartz-plugin/base/deployer/src/test/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/META-INF/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/META-INF/geronimo-quartz.xml
    geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/WEB-INF/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/WEB-INF/web.xml
    geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/quartz/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/quartz/jobs/
    geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/quartz/jobs/TestJob.java
    geronimo/sandbox/quartz-plugin/base/scheduler/
    geronimo/sandbox/quartz-plugin/base/scheduler/pom.xml
    geronimo/sandbox/quartz-plugin/base/scheduler/src/
    geronimo/sandbox/quartz-plugin/base/scheduler/src/conf/
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/QuartzEJBRef.java
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/QuartzJob.java
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/QuartzJobFactory.java
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/QuartzJobGBean.java
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/QuartzScheduler.java
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/QuartzSchedulerGBean.java
    geronimo/sandbox/quartz-plugin/base/scheduler/src/java/org/gplugins/quartz/QuartzThreadPool.java
    geronimo/sandbox/quartz-plugin/base/scheduler/src/resources/
    geronimo/sandbox/quartz-plugin/base/scheduler/src/resources/META-INF/
    geronimo/sandbox/quartz-plugin/dependencies/
    geronimo/sandbox/quartz-plugin/dependencies/pom.xml
    geronimo/sandbox/quartz-plugin/plugins/
    geronimo/sandbox/quartz-plugin/plugins/console-jetty/
    geronimo/sandbox/quartz-plugin/plugins/console-jetty/src/
    geronimo/sandbox/quartz-plugin/plugins/console-jetty/src/plan/
    geronimo/sandbox/quartz-plugin/plugins/console-jetty/src/plan/geronimo-web.xml
    geronimo/sandbox/quartz-plugin/plugins/console-tomcat/
    geronimo/sandbox/quartz-plugin/plugins/console-tomcat/src/
    geronimo/sandbox/quartz-plugin/plugins/console-tomcat/src/plan/
    geronimo/sandbox/quartz-plugin/plugins/console-tomcat/src/plan/geronimo-web.xml
    geronimo/sandbox/quartz-plugin/plugins/deployer/
    geronimo/sandbox/quartz-plugin/plugins/deployer/pom.xml
    geronimo/sandbox/quartz-plugin/plugins/deployer/src/
    geronimo/sandbox/quartz-plugin/plugins/deployer/src/plan/
    geronimo/sandbox/quartz-plugin/plugins/deployer/src/plan/geronimo-service.xml
    geronimo/sandbox/quartz-plugin/plugins/deployer/src/resources/
    geronimo/sandbox/quartz-plugin/plugins/deployer/src/resources/META-INF/
    geronimo/sandbox/quartz-plugin/plugins/deployer/src/resources/META-INF/geronimo-plugin.xml
    geronimo/sandbox/quartz-plugin/plugins/pom.xml
    geronimo/sandbox/quartz-plugin/plugins/scheduler/
    geronimo/sandbox/quartz-plugin/plugins/scheduler/pom.xml
    geronimo/sandbox/quartz-plugin/plugins/scheduler/src/
    geronimo/sandbox/quartz-plugin/plugins/scheduler/src/plan/
    geronimo/sandbox/quartz-plugin/plugins/scheduler/src/plan/geronimo-service.xml
    geronimo/sandbox/quartz-plugin/plugins/scheduler/src/resources/
    geronimo/sandbox/quartz-plugin/plugins/scheduler/src/resources/META-INF/
    geronimo/sandbox/quartz-plugin/plugins/scheduler/src/resources/META-INF/geronimo-plugin.xml
    geronimo/sandbox/quartz-plugin/pom.xml

Added: geronimo/sandbox/quartz-plugin/base/console/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/console/pom.xml?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/console/pom.xml (added)
+++ geronimo/sandbox/quartz-plugin/base/console/pom.xml Tue May 27 08:22:56 2008
@@ -0,0 +1,102 @@
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>gplugins</groupId>
+        <artifactId>quartz-parent</artifactId>
+        <version>1.0</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>quartz-console-service</artifactId>
+    <packaging>war</packaging>
+    <name>Quartz Admin Console for Geronimo</name>
+
+    <build>
+        <sourceDirectory>src/java</sourceDirectory>
+        <testSourceDirectory>src/test</testSourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+        <testResources>
+            <testResource>
+                <directory>src/test-resources</directory>
+            </testResource>
+        </testResources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <warSourceDirectory>src/webapp</warSourceDirectory>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <!-- ========== These go into WEB-INF/lib ============== -->
+
+        <dependency>
+            <groupId>taglibs</groupId>
+            <artifactId>standard</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>jstl</groupId>
+            <artifactId>jstl</artifactId>
+        </dependency>
+
+        <!-- ========== These DO NOT go into WEB-INF/lib ============== -->
+
+        <dependency>
+            <groupId>gplugins</groupId>
+            <artifactId>quartz-scheduler-service</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>mx4j</groupId>
+            <artifactId>mx4j</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>opensymphony</groupId>
+            <artifactId>quartz</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>portlet-api</groupId>
+            <artifactId>portlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

Added: geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/quartz/QuartzPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/quartz/QuartzPortlet.java?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/quartz/QuartzPortlet.java (added)
+++ geronimo/sandbox/quartz-plugin/base/console/src/java/org/gplugins/console/quartz/QuartzPortlet.java Tue May 27 08:22:56 2008
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  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.
+ */
+package org.gplugins.console.quartz;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.gplugins.quartz.QuartzScheduler;
+import org.quartz.JobDetail;
+import org.quartz.Trigger;
+import org.quartz.SchedulerException;
+
+/**
+ * A portlet that displays Quartz configuration
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 21:48:27 -0500 (Sat, 10 Dec 2005) $
+ */
+public class QuartzPortlet extends GenericPortlet {
+    private final static Log log = LogFactory.getLog(QuartzPortlet.class);
+    protected PortletRequestDispatcher listView;
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        PortletContext pc = portletConfig.getPortletContext();
+        listView = pc.getRequestDispatcher("/WEB-INF/view/quartz/list.jsp");
+        super.init(portletConfig);
+    }
+
+    protected void doView(RenderRequest renderRequest,
+                          RenderResponse renderResponse) throws PortletException, IOException {
+        List jobs = new ArrayList();
+        try {
+            QuartzScheduler scheduler = (QuartzScheduler) new InitialContext().lookup("java:comp/env/Scheduler");
+            Map map = scheduler.getScheduledJobs();
+            log.info("Found "+map.size()+" scheduled jobs");
+            for (Iterator it = map.keySet().iterator(); it.hasNext();) {
+                JobDetail job = (JobDetail) it.next();
+                scheduler.getJob(job.getName());
+                Trigger trigger = (Trigger) map.get(job);
+                jobs.add(job);
+            }
+        } catch (SchedulerException e) {
+            log.error("Unable to retrieve Quartz schedule jobs");
+        } catch (NamingException e) {
+            log.error("Unable to access Quartz scheduler in JNDI");
+        }
+        renderRequest.setAttribute("jobs", jobs);
+        listView.include(renderRequest, renderResponse);
+    }
+}

Added: geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/portlet.xml?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/portlet.xml (added)
+++ geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/portlet.xml Tue May 27 08:22:56 2008
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2004 The Apache Software Foundation
+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.
+-->
+<portlet-app
+    xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+    version="1.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
+                        http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
+
+     <portlet>
+        <description>Configuration for Quartz Scheduler</description>
+        <portlet-name>Quartz</portlet-name>
+        <display-name>Quartz Jobs</display-name>
+
+        <portlet-class>org.gplugins.console.quartz.QuartzPortlet</portlet-class>
+
+        <expiration-cache>-1</expiration-cache>
+
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+            <!--<portlet-mode>HELP</portlet-mode>-->
+        </supports>
+
+        <supported-locale>en</supported-locale>
+
+        <portlet-info>
+            <title>Quartz Jobs</title>
+            <short-title>Quartz</short-title>
+            <keywords>Quartz Job Scheduler</keywords>
+        </portlet-info>
+    </portlet>
+    
+</portlet-app>
\ No newline at end of file

Added: geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/tld/portlet.tld
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/tld/portlet.tld?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/tld/portlet.tld (added)
+++ geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/tld/portlet.tld Tue May 27 08:22:56 2008
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib PUBLIC
+  "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
+  "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
+<!-- 
+Copyright 2004 The Apache Software Foundation
+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.
+-->
+<taglib>
+    <tlibversion>1.0</tlibversion>
+    <jspversion>1.1</jspversion>
+    <shortname>Tags for portlets</shortname>
+    <tag>
+        <name>defineObjects</name>
+        <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass>
+        <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass>
+        <bodycontent>empty</bodycontent>
+    </tag>
+    <tag>
+        <name>param</name>
+        <tagclass>org.apache.pluto.tags.ParamTag</tagclass>
+        <bodycontent>empty</bodycontent>
+        <attribute>
+            <name>name</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>value</name>
+            <required>true</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>actionURL</name>
+        <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
+        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+        <bodycontent>JSP</bodycontent>
+        <attribute>
+            <name>windowState</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>portletMode</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>secure</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>var</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>renderURL</name>
+        <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass>
+        <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+        <bodycontent>JSP</bodycontent>
+        <attribute>
+            <name>windowState</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>portletMode</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>secure</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>var</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+    </tag>
+    <tag>
+        <name>namespace</name>
+        <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass>
+        <bodycontent>empty</bodycontent>
+    </tag>
+</taglib>
\ No newline at end of file

Added: geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/view/quartz/list.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/view/quartz/list.jsp?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/view/quartz/list.jsp (added)
+++ geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/view/quartz/list.jsp Tue May 27 08:22:56 2008
@@ -0,0 +1,10 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<portlet:defineObjects/>
+
+<p>This is the Quartz portlet.  Here are the current scheduled jobs:</p>
+<ul>
+    <c:forEach items="${jobs}" var="job">
+        <li>${job.name}</li>
+    </c:forEach>
+</ul>

Added: geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/web.xml?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/web.xml (added)
+++ geronimo/sandbox/quartz-plugin/base/console/src/webapp/WEB-INF/web.xml Tue May 27 08:22:56 2008
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.4"
+         xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+    <servlet>
+        <description>Pluto Quartz Portlet</description>
+        <display-name>Quartz Portlet</display-name>
+        <servlet-name>Quartz</servlet-name>
+        <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
+        <init-param>
+            <param-name>portlet-class</param-name>
+            <param-value>org.gplugins.console.quartz.QuartzPortlet</param-value>
+        </init-param>
+        <init-param>
+            <param-name>portlet-guid</param-name>
+            <param-value>quartz-console.Quartz</param-value>
+        </init-param>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>Quartz</servlet-name>
+        <url-pattern>/Quartz/*</url-pattern>
+    </servlet-mapping>
+
+    <jsp-config>
+        <taglib>
+            <taglib-uri>http://java.sun.com/portlet</taglib-uri>
+            <taglib-location>/WEB-INF/tld/portlet.tld</taglib-location>
+        </taglib>
+    </jsp-config>
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Secure Portlets</web-resource-name>
+            <url-pattern>/</url-pattern>
+            <http-method>GET</http-method>
+            <http-method>POST</http-method>
+            <http-method>PUT</http-method>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>admin</role-name>
+        </auth-constraint>
+    </security-constraint>
+    <login-config>
+        <auth-method>BASIC</auth-method>
+        <realm-name>geronimo-properties-realm</realm-name>
+    </login-config>
+    <security-role>
+        <role-name>admin</role-name>
+    </security-role>
+</web-app>

Added: geronimo/sandbox/quartz-plugin/base/deployer/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/pom.xml?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/pom.xml (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/pom.xml Tue May 27 08:22:56 2008
@@ -0,0 +1,140 @@
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>gplugins</groupId>
+        <artifactId>quartz-parent</artifactId>
+        <version>1.0</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>quartz-deployer-service</artifactId>
+    <name>Geronimo Quartz Deployer</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>xmlbeans-maven-plugin</artifactId>
+                <version>2.0.1-SNAPSHOT</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>xmlbeans</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <download>true</download>
+                    <sourceSchemas>geronimo-quartz-0.2.xsd</sourceSchemas>
+                    <schemaDirectory>src/schema</schemaDirectory>
+                    <xmlConfigs>
+                        <xmlConfig implementation="java.io.File">src/schema/xmlconfig.xml</xmlConfig>
+                    </xmlConfigs>
+                </configuration>
+            </plugin>
+        </plugins>
+        <sourceDirectory>src/java</sourceDirectory>
+        <testSourceDirectory>src/test</testSourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+        <testResources>
+            <testResource>
+                <directory>src/test-resources</directory>
+            </testResource>
+        </testResources>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>gplugins</groupId>
+            <artifactId>common</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>gplugins</groupId>
+            <artifactId>quartz-scheduler-service</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>xmlbeans</groupId>
+            <artifactId>xbean</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-deployment</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-service-builder</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-common</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-naming-builder</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-j2ee-builder</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-j2ee-schema</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-j2ee</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-system</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>opensymphony</groupId>
+            <artifactId>quartz</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/AddQuartzToJ2EEModule.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/AddQuartzToJ2EEModule.java?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/AddQuartzToJ2EEModule.java (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/AddQuartzToJ2EEModule.java Tue May 27 08:22:56 2008
@@ -0,0 +1,141 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.
+ */
+package org.gplugins.quartz.deployment;
+
+import java.net.URL;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.DeploymentWatcher;
+import org.apache.geronimo.kernel.config.EditableConfigurationManager;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.gplugins.quartz.QuartzScheduler;
+import org.gplugins.quartz.deployment.xbeans.JobType;
+import org.gplugins.quartz.deployment.xbeans.JobsDocument;
+import org.gplugins.quartz.deployment.xbeans.JobsType;
+import org.gplugins.common.StoredModuleUtil;
+
+/**
+ * A DeploymentWatcher that lets you include Quartz Jobs as part of a J2EE
+ * application module.  For example, a Web App could include a
+ * META-INF/geronimo-quartz.xml file and the jobs in there would be
+ * deployed as part of the web app.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class AddQuartzToJ2EEModule implements DeploymentWatcher {
+    private final static Log log = LogFactory.getLog(AddQuartzToJ2EEModule.class);
+    private final EditableConfigurationManager manager;
+    private final QuartzJobDeployer deployer;
+    private final Artifact schedulerModuleName;
+
+    public AddQuartzToJ2EEModule(QuartzJobDeployer deployer, QuartzScheduler scheduler, EditableConfigurationManager manager, Kernel kernel) {
+        this.deployer = deployer;
+        this.manager = manager;
+        schedulerModuleName = kernel.getAbstractNameFor(scheduler).getArtifact();
+    }
+
+    public void deployed(Artifact moduleID) {
+        ConfigurationStore store = manager.getStoreForConfiguration(moduleID);
+        boolean loaded = manager.isLoaded(moduleID);
+        try {
+            ConfigurationData original = store.loadConfiguration(moduleID);
+            ConfigurationModuleType type = original.getModuleType();
+            if(type.getValue() == ConfigurationModuleType.EJB.getValue() || type.getValue() == ConfigurationModuleType.WAR.getValue()) {
+                ConfigurationData module = StoredModuleUtil.updateConfigurationData(original, manager);
+                Configuration config;
+                Set paths = store.resolve(moduleID, null, "META-INF/geronimo-quartz.xml");
+                if(paths.size() > 0) {
+                    URL path = (URL)paths.iterator().next();
+                    JobsDocument doc = deployer.processPlanURL(path);
+                    if(doc != null) { // There are Quartz settings
+                        // Update the environment with the new dependencies
+                        module.getEnvironment().addDependency(schedulerModuleName, ImportType.ALL);
+                        JobsType parent = doc.getJobs();
+                        Environment jobsEnvironment = deployer.processEnvironment(parent.getEnvironment());
+                        StoredModuleUtil.addEnvironment(module, jobsEnvironment);
+                        // Update the ClassLoader with the new dependencies
+                        StoredModuleUtil.rewriteModule(manager, store, module);
+                        manager.loadConfiguration(moduleID);
+                        config = manager.getConfiguration(moduleID);
+                        module = StoredModuleUtil.updateConfigurationData(store.loadConfiguration(moduleID), manager);
+                        // Write the new GBeans into the module
+                        JobType[] jobs = parent.getJobArray();
+                        GBeanData[] gbeans = deployer.processJobs(jobs, moduleID, config);
+                        for (int i = 0; i < gbeans.length; i++) {
+                            module.addGBean(gbeans[i]);
+                        }
+                        // Write the final module
+                        StoredModuleUtil.rewriteModule(manager, store, module);
+                        // Done
+                        log.info("Installed "+gbeans.length+" Quartz Job"+(gbeans.length == 1 ? "" : "s")+" for "+moduleID);
+                        return;
+                    }
+                }
+            }
+            log.debug("No Quartz jobs found in J2EE module "+moduleID);
+        } catch (Exception e) {
+            e.printStackTrace();
+            if(e instanceof RuntimeException) {
+                throw (RuntimeException)e;
+            } else {
+                throw new RuntimeException("Unable to check for Quartz settings for module "+moduleID, e);
+            }
+        } finally {
+            try {
+                if(loaded && !manager.isLoaded(moduleID)) {
+                    manager.loadConfiguration(moduleID);
+                } else if(!loaded && manager.isLoaded(moduleID)) {
+                    manager.unloadConfiguration(moduleID);
+                }
+            } catch (Exception e) {
+                throw new RuntimeException("Unable to load or unload updated module", e);
+            }
+        }
+    }
+
+    public void undeployed(Artifact moduleID) {}
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Add Quartz to J2EE Modules", AddQuartzToJ2EEModule.class);
+        infoFactory.addInterface(DeploymentWatcher.class);
+        infoFactory.addAttribute("kernel", Kernel.class, false, false);
+        infoFactory.addReference("ConfigurationManager", EditableConfigurationManager.class, "ConfigurationManager");
+        infoFactory.addReference("QuartzJobDeployer", QuartzJobDeployer.class, "ConfigBuilder");
+        infoFactory.addReference("QuartzScheduler", QuartzScheduler.class, "GBean");
+        infoFactory.setConstructor(new String[]{"QuartzJobDeployer", "QuartzScheduler",
+                                  "ConfigurationManager", "kernel"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/NamingHelper.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/NamingHelper.java?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/NamingHelper.java (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/NamingHelper.java Tue May 27 08:22:56 2008
@@ -0,0 +1,144 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.
+ */
+package org.gplugins.quartz.deployment;
+
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.j2ee.deployment.RefContext;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefType;
+import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanRefType;
+import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
+import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
+import org.gplugins.common.ReferenceResolver;
+import org.gplugins.quartz.deployment.xbeans.EjbRefType;
+import org.gplugins.quartz.deployment.xbeans.GbeanRefType;
+import org.gplugins.quartz.deployment.xbeans.PatternType;
+import org.gplugins.quartz.deployment.xbeans.ResourceRefType;
+
+import javax.naming.Reference;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Helper to work around bugs in Geronimo; will eventually defer to server code more extensively
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class NamingHelper {
+    public static Map getEjbLocalRefs(Configuration config, RefContext rc, EjbRefType[] refs) {
+        Map map = new HashMap();
+        for (int i = 0; i < refs.length; i++) {
+            EjbRefType ref = refs[i];
+            org.apache.geronimo.xbeans.j2ee.EjbRefType j2ee = org.apache.geronimo.xbeans.j2ee.EjbRefType.Factory.newInstance();
+            j2ee.addNewEjbRefName();
+            j2ee.getEjbRefName().setStringValue(ref.getProperty());
+            j2ee.addNewEjbRefType();
+            j2ee.getEjbRefType().setStringValue(ref.getEjbType());
+            j2ee.addNewRemote();
+            j2ee.getRemote().setStringValue(ref.getLocal());
+            j2ee.addNewHome();
+            j2ee.getHome().setStringValue(ref.getLocalHome());
+            GerEjbRefType ger = GerEjbRefType.Factory.newInstance();
+            ger.setRefName(ref.getProperty());
+            ger.addNewPattern();
+            if(ref.getPattern().isSetArtifactId()) ger.getPattern().setArtifactId(ref.getPattern().getArtifactId());
+            if(ref.getPattern().isSetGroupId()) ger.getPattern().setGroupId(ref.getPattern().getGroupId());
+            if(ref.getPattern().isSetModule()) ger.getPattern().setModule(ref.getPattern().getModule());
+            ger.getPattern().setName(ref.getPattern().getName());
+            if(ref.getPattern().isSetVersion()) ger.getPattern().setVersion(ref.getPattern().getVersion());
+            Reference result = addEJBRef(config, rc, URI.create(""), j2ee, ger, config.getConfigurationClassLoader());
+            if(result != null) {
+                map.put("org.gplugins.quartz.ejb." + ref.getProperty(), result);
+            }
+            // Code to try with EJB local refs -- not sure if this will work and G is too buggy to try right now
+//            EjbLocalRefType j2ee = EjbLocalRefType.Factory.newInstance();
+//            j2ee.addNewEjbRefName();
+//            j2ee.getEjbRefName().setStringValue(ref.getProperty());
+//            j2ee.addNewEjbRefType();
+//            j2ee.getEjbRefType().setStringValue(ref.getEjbType());
+//            j2ee.addNewLocal();
+//            j2ee.getLocal().setStringValue(ref.getLocal());
+//            j2ee.addNewLocalHome();
+//            j2ee.getLocalHome().setStringValue(ref.getLocalHome());
+//            GerEjbLocalRefType ger = GerEjbLocalRefType.Factory.newInstance();
+//            ger.setRefName(ref.getProperty());
+//            ger.setEjbLink(ref.getEjbLink());
+//            Reference result = addEJBLocalRef(dc.getConfiguration(), rc, URI.create(""), j2ee, ger, dc.getClassLoader());
+//            map.put("org.gplugins.quartz.ejb."+ref.getProperty(), result);
+        }
+        return map;
+    }
+
+    public static Map getResourceRefs(Configuration config, RefContext rc, ResourceRefType[] refs) throws DeploymentException {
+        Map map = new HashMap();
+        for (int i = 0; i < refs.length; i++) {
+            ResourceRefType ref = refs[i];
+            org.apache.geronimo.xbeans.j2ee.ResourceRefType j2ee = org.apache.geronimo.xbeans.j2ee.ResourceRefType.Factory.newInstance();
+            j2ee.addNewResRefName();
+            j2ee.getResRefName().setStringValue(ref.getProperty());
+            j2ee.addNewResType();
+            j2ee.getResType().setStringValue(ref.getResType());
+            j2ee.addNewResAuth();
+            j2ee.getResAuth().setStringValue(ref.getResAuth() == null ? "Application" : ref.getResAuth());
+            j2ee.addNewResSharingScope();
+            j2ee.getResSharingScope().setStringValue(ref.getResSharingScope());
+            GerResourceRefType ger = GerResourceRefType.Factory.newInstance();
+            ger.setRefName(ref.getProperty());
+            ger.addNewPattern();
+            if(ref.getPattern().isSetArtifactId()) ger.getPattern().setArtifactId(ref.getPattern().getArtifactId());
+            if(ref.getPattern().isSetGroupId()) ger.getPattern().setGroupId(ref.getPattern().getGroupId());
+            if(ref.getPattern().isSetModule()) ger.getPattern().setModule(ref.getPattern().getModule());
+            ger.getPattern().setName(ref.getPattern().getName());
+            if(ref.getPattern().isSetVersion()) ger.getPattern().setVersion(ref.getPattern().getVersion());
+            Reference result = ReferenceResolver.createResourceRef(config, rc, URI.create(""), j2ee, ger, config.getConfigurationClassLoader());
+            if(result != null) {
+                map.put("org.gplugins.quartz.resource." + ref.getProperty(), result);
+            }
+        }
+        return map;
+    }
+
+    public static Map getGBeanRefs(Configuration config, GbeanRefType[] refs) throws DeploymentException {
+        Map map = new HashMap();
+        for (int i = 0; i < refs.length; i++) {
+            GbeanRefType ref = refs[i];
+            GerGbeanRefType ger = GerGbeanRefType.Factory.newInstance();
+            ger.setRefName(ref.getProperty());
+            for (int j = 0; j < ref.getPatternArray().length; j++) {
+                PatternType pattern = ref.getPatternArray()[j];
+                GerPatternType gp = ger.addNewPattern();
+                if(pattern.isSetArtifactId()) gp.setArtifactId(pattern.getArtifactId());
+                if(pattern.isSetGroupId()) gp.setGroupId(pattern.getGroupId());
+                if(pattern.isSetModule()) gp.setModule(pattern.getModule());
+                gp.setName(pattern.getName());
+                if(pattern.isSetVersion()) gp.setVersion(pattern.getVersion());
+            }
+            ger.setRefTypeArray(ref.getRefTypeArray());
+            Reference result = ReferenceResolver.createGBeanRef(config, ger, config.getConfigurationClassLoader());
+            if(result != null) {
+                map.put("org.gplugins.quartz.gbean." + ref.getProperty(), result);
+            }
+        }
+        return map;
+    }
+
+    public static Reference addEJBRef(Configuration conf, RefContext rc, URI module, org.apache.geronimo.xbeans.j2ee.EjbRefType j2ee,
+                                      GerEjbRefType ger, ClassLoader loader) {
+        return null;
+    }
+}

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployer.java?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployer.java (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployer.java Tue May 27 08:22:56 2008
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.
+ */
+package org.gplugins.quartz.deployment;
+
+import java.io.IOException;
+import java.net.URL;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.ConfigurationBuilder;
+import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.gplugins.quartz.deployment.xbeans.JobType;
+import org.gplugins.quartz.deployment.xbeans.JobsDocument;
+
+/**
+ * Some additional features that the Quartz deployer GBean has over a regular
+ * ConfigurationBuilder (mainly to be used when mangling existing modules).
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public interface QuartzJobDeployer extends ConfigurationBuilder {
+    Environment processEnvironment(EnvironmentType environmentType);
+
+    JobsDocument processPlanURL(URL url) throws DeploymentException, IOException;
+
+    GBeanData[] processJobs(JobType[] jobs, Artifact parentModule, Configuration config) throws DeploymentException;
+}

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployerGBean.java?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployerGBean.java (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/java/org/gplugins/quartz/deployment/QuartzJobDeployerGBean.java Tue May 27 08:22:56 2008
@@ -0,0 +1,325 @@
+/**
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  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.
+ */
+package org.gplugins.quartz.deployment;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.jar.JarFile;
+import javax.xml.namespace.QName;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.ConfigurationBuilder;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.deployment.xbeans.ArtifactType;
+import org.apache.geronimo.deployment.xbeans.EnvironmentType;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+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.gbean.SingleElementCollection;
+import org.apache.geronimo.j2ee.deployment.EJBReferenceBuilder;
+import org.apache.geronimo.j2ee.deployment.RefContext;
+import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder;
+import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.gplugins.quartz.QuartzJobGBean;
+import org.gplugins.quartz.deployment.xbeans.JobType;
+import org.gplugins.quartz.deployment.xbeans.JobsDocument;
+import org.gplugins.quartz.deployment.xbeans.JobsType;
+
+/**
+ * Deploys Quartz jobs at runtime
+ *
+ * @version $Rev: 355877 $ $Date: 2005-12-10 21:48:27 -0500 (Sat, 10 Dec 2005) $
+ */
+public class QuartzJobDeployerGBean implements ConfigurationBuilder, QuartzJobDeployer {
+    private static final QName SERVICE_QNAME = JobsDocument.type.getDocumentElementName();
+
+    private final Environment defaultEnvironment;
+    private final Collection repositories;
+    private final Naming naming;
+    private final ConfigurationManager configurationManager;
+    private final AbstractNameQuery schedulerName;
+    private final SingleElementCollection ejbRefBuilder;
+    private final SingleElementCollection resourceRefBuilder;
+    private final SingleElementCollection serviceRefBuilder;
+
+    public QuartzJobDeployerGBean(Environment defaultEnvironment, Collection repositories, AbstractNameQuery schedulerName,
+                             Kernel kernel, Collection ejbRefBuilder, Collection resourceRefBuilder, Collection serviceRefBuilder) {
+        this(defaultEnvironment, repositories, schedulerName, kernel, new SingleElementCollection(ejbRefBuilder),
+                new SingleElementCollection(resourceRefBuilder), new SingleElementCollection(serviceRefBuilder));
+    }
+
+    public QuartzJobDeployerGBean(Environment defaultEnvironment, Collection repositories, AbstractNameQuery schedulerName,
+                             Kernel kernel, SingleElementCollection ejbRefBuilder, SingleElementCollection resourceRefBuilder,
+                             SingleElementCollection serviceRefBuilder) {
+        this.defaultEnvironment = defaultEnvironment;
+        this.repositories = repositories;
+        this.schedulerName = schedulerName;
+        naming = kernel.getNaming();
+        configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+        this.ejbRefBuilder = ejbRefBuilder;
+        this.resourceRefBuilder = resourceRefBuilder;
+        this.serviceRefBuilder = serviceRefBuilder;
+    }
+
+    public Object getDeploymentPlan(File planFile, JarFile jarFile, ModuleIDBuilder idBuilder) throws DeploymentException {
+        if (planFile == null && jarFile == null) {
+            return null;
+        }
+        URL plan;
+        try {
+            if (planFile != null) {
+                plan = planFile.toURL();
+            } else {
+                plan = DeploymentUtil.createJarURL(jarFile, "META-INF/geronimo-quartz.xml");
+            }
+            JobsDocument moduleDoc =  processPlanURL(plan);
+
+            if(moduleDoc == null) { // Not a Quartz deployment!
+                return null;
+            }
+
+            // If there's no artifact ID and we won't be able to figure one out later, use the plan file name.  Bit of a hack.
+            if (jarFile == null && (moduleDoc.getJobs().getEnvironment() == null ||
+                    moduleDoc.getJobs().getEnvironment().getModuleId() == null ||
+                    moduleDoc.getJobs().getEnvironment().getModuleId().getArtifactId() == null)) {
+                if (moduleDoc.getJobs().getEnvironment() == null) {
+                    moduleDoc.getJobs().addNewEnvironment();
+                }
+                if (moduleDoc.getJobs().getEnvironment().getModuleId() == null) {
+                    moduleDoc.getJobs().getEnvironment().addNewModuleId();
+                }
+                String name = planFile.getName();
+                int pos = name.lastIndexOf('.');
+                if (pos > -1) {
+                    name = name.substring(0, pos);
+                }
+                moduleDoc.getJobs().getEnvironment().getModuleId().setArtifactId(name);
+            }
+            return moduleDoc == null ? null : moduleDoc.getJobs();
+        } catch (MalformedURLException e) {
+            throw new DeploymentException("Unable to read plan for from "+planFile+" or "+jarFile);
+        } catch (IOException e) {
+            throw new DeploymentException("no plan at " + planFile, e);
+        }
+    }
+
+    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
+        JobsType configType = (JobsType) plan;
+        EnvironmentType environmentType = configType.getEnvironment();
+        Environment environment = processEnvironment(environmentType);
+        idBuilder.resolve(environment, module == null ? "" : new File(module.getName()).getName(), "car");
+        if(!environment.getConfigId().isResolved()) {
+            throw new IllegalStateException("Module ID is not fully populated ("+environment.getConfigId()+")");
+        }
+        return environment.getConfigId();
+    }
+
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, Object plan, JarFile jar, Collection configurationStores, ArtifactResolver artifactResolver, ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
+        JobsType configType = (JobsType) plan;
+
+        return buildConfiguration(inPlaceDeployment, configId, configType, jar, configurationStores, artifactResolver, targetConfigurationStore);
+    }
+
+    public JobsDocument processPlanURL(URL url) throws DeploymentException, IOException {
+        try {
+            XmlObject xmlObject;
+            try {
+                xmlObject = XmlBeansUtil.parse(url);
+            } catch (FileNotFoundException e) {
+                // Most likely it has a JAR but no plan, and nothing at META-INF/geronimo-quartz.xml,
+                // therefore it's not a quartz job deployment
+                return null;
+            }
+            if (xmlObject == null) {
+                return null;
+            }
+
+            XmlCursor cursor = xmlObject.newCursor();
+            try {
+                cursor.toFirstChild();
+                if (!SERVICE_QNAME.equals(cursor.getName())) {
+                    return null;
+                }
+            } finally {
+                cursor.dispose();
+            }
+            JobsDocument moduleDoc;
+            if (xmlObject instanceof JobsDocument) {
+                moduleDoc = (JobsDocument) xmlObject;
+            } else {
+                moduleDoc = (JobsDocument) xmlObject.changeType(JobsDocument.type);
+            }
+            Collection errors = new ArrayList();
+            if (!moduleDoc.validate(XmlBeansUtil.createXmlOptions(errors))) {
+                throw new DeploymentException("Invalid deployment descriptor: " + errors + "\nDescriptor: " + moduleDoc.toString());
+            }
+            return moduleDoc;
+        } catch (XmlException e) {
+            throw new DeploymentException("Could not parse xml in plan", e);
+        }
+
+    }
+
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, JobsType moduleType, JarFile jar, Collection configurationStores, ArtifactResolver artifactResolver, ConfigurationStore targetConfigurationStore) throws DeploymentException, IOException {
+        ArtifactType type = moduleType.getEnvironment().isSetModuleId() ? moduleType.getEnvironment().getModuleId() : moduleType.getEnvironment().addNewModuleId();
+        type.setArtifactId(configId.getArtifactId());
+        type.setGroupId(configId.getGroupId());
+        type.setType(configId.getType());
+        type.setVersion(configId.getVersion().toString());
+        Environment environment = processEnvironment(moduleType.getEnvironment());
+        if(!environment.getConfigId().isResolved()) {
+            throw new IllegalStateException("Module ID should be fully resolved by now (not "+environment.getConfigId()+")");
+        }
+        File outfile;
+        try {
+            outfile = targetConfigurationStore.createNewConfigurationDir(configId);
+        } catch (ConfigurationAlreadyExistsException e) {
+            throw new DeploymentException(e);
+        }
+
+        ConfigurationManager configurationManager = this.configurationManager;
+        if (configurationManager == null) {
+            configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories);
+        }
+        DeploymentContext context = new DeploymentContext(outfile,
+                inPlaceDeployment && null != jar ? DeploymentUtil.toFile(jar) : null,
+                environment,
+                ConfigurationModuleType.SERVICE,
+                naming,
+                configurationManager,
+                repositories
+        );
+        if(jar != null) {
+            File file = new File(jar.getName());
+            context.addIncludeAsPackedJar(URI.create(file.getName()), jar);
+        }
+        try {
+            addJobs(moduleType.getJobArray(), configId, context);
+            return context;
+        } catch (RuntimeException t) {
+            context.close();
+            throw t;
+        } catch (Error e) {
+            context.close();
+            throw e;
+        }
+    }
+
+    public Environment processEnvironment(EnvironmentType environmentType) {
+        return EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
+    }
+
+    private void addJobs(JobType[] jobs, Artifact parentModule, DeploymentContext context) throws DeploymentException {
+        GBeanData[] datas = processJobs(jobs, parentModule, context.getConfiguration());
+        for (int i = 0; i < datas.length; i++) {
+            try {
+                context.addGBean(datas[i]);
+            } catch (GBeanAlreadyExistsException e) {
+                throw new DeploymentException("Cannot add Quartz job '"+jobs[i].getJobName()+"' for module "+parentModule+"; a job with that name already exists.");
+            }
+        }
+    }
+
+    public GBeanData[] processJobs(JobType[] jobs, Artifact parentModule, Configuration config) throws DeploymentException {
+        ClassLoader loader = config.getConfigurationClassLoader();
+        RefContext refContext = new RefContext((EJBReferenceBuilder)ejbRefBuilder.getElement(),
+                (ResourceReferenceBuilder)resourceRefBuilder.getElement(),
+                (ServiceReferenceBuilder)serviceRefBuilder.getElement());
+        List list = new ArrayList();
+        for (int i = 0; i < jobs.length; i++) {
+            JobType job = jobs[i];
+            GBeanData data = processJob(job, loader, parentModule);
+            Map map = new HashMap();
+            map.putAll(NamingHelper.getEjbLocalRefs(config, refContext, job.getEjbRefArray()));
+            map.putAll(NamingHelper.getResourceRefs(config, refContext, job.getResourceRefArray()));
+            map.putAll(NamingHelper.getGBeanRefs(config, job.getGbeanRefArray()));
+            data.setAttribute("jobData", map);
+            list.add(data);
+        }
+        return (GBeanData[]) list.toArray(new GBeanData[list.size()]);
+    }
+
+    private GBeanData processJob(JobType job, ClassLoader cl, Artifact parentModule) {
+        GBeanInfo gBeanInfo = GBeanInfo.getGBeanInfo(QuartzJobGBean.class.getName(), cl);
+        String namePart = job.getJobName();
+        AbstractName moduleName = naming.createRootName(parentModule, parentModule.toString(), "ServiceModule");
+        AbstractName abstractName = naming.createChildName(moduleName, namePart, "GBean");
+        GBeanData data = new GBeanData(abstractName, gBeanInfo);
+        data.setReferencePattern("QuartzScheduler", schedulerName);
+        data.setAttribute("name", job.getJobName());
+        data.setAttribute("jobClass", job.getJobClass());
+        data.setAttribute("cronExpression", job.getCronExpression());
+        return data;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Quartz Deployer", QuartzJobDeployerGBean.class, "ConfigBuilder");
+
+        infoFactory.addInterface(QuartzJobDeployer.class);
+
+        infoFactory.addAttribute("defaultEnvironment", Environment.class, true);
+        infoFactory.addAttribute("schedulerName", AbstractNameQuery.class, true, true);
+        infoFactory.addAttribute("kernel", Kernel.class, false, false);
+        infoFactory.addReference("Repository", Repository.class, "Repository");
+
+        infoFactory.addReference("EJBReferenceBuilder", EJBReferenceBuilder.class, "ModuleBuilder");
+        infoFactory.addReference("ResourceReferenceBuilder", ResourceReferenceBuilder.class, "ModuleBuilder");
+        infoFactory.addReference("ServiceReferenceBuilder", ServiceReferenceBuilder.class, "ModuleBuilder");
+
+        infoFactory.setConstructor(new String[]{"defaultEnvironment", "Repository", "schedulerName", "kernel",
+                                                "EJBReferenceBuilder", "ResourceReferenceBuilder",
+                                                "ServiceReferenceBuilder"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/schema/geronimo-quartz-0.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/schema/geronimo-quartz-0.2.xsd?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/schema/geronimo-quartz-0.2.xsd (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/schema/geronimo-quartz-0.2.xsd Tue May 27 08:22:56 2008
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    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.
+-->
+
+<xs:schema
+        targetNamespace="http://geronimo.apache.org/xml/ns/plugins/quartz-0.2"
+        xmlns:job="http://geronimo.apache.org/xml/ns/plugins/quartz-0.2"
+        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
+        xmlns:xs="http://www.w3.org/2001/XMLSchema"
+        elementFormDefault="qualified"
+        attributeFormDefault="unqualified"
+        >
+
+    <xs:annotation>
+        <xs:documentation>
+            Schema for a Quartz scheduled job.
+        </xs:documentation>
+    </xs:annotation>
+
+    <xs:import namespace="http://geronimo.apache.org/xml/ns/deployment-1.1" schemaLocation="geronimo-module-1.1.xsd"/>
+
+    <!--   Top-level elements   -->
+
+    <xs:element name="jobs" type="job:jobsType">
+        <xs:annotation>
+            <xs:documentation>
+                A list of jobs to schedule with Quartz
+            </xs:documentation>
+        </xs:annotation>
+    </xs:element>
+
+    <xs:complexType name="jobsType">
+        <xs:sequence>
+            <xs:element ref="sys:environment"/>
+            <xs:element name="job" type="job:jobType" minOccurs="1" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        A job to schedule with Quartz
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="jobType">
+        <xs:sequence>
+            <xs:element name="job-name" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        A unique name used to identify the Quartz job
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="job-class" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The fully-qualified class name of the Quartz job
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:choice>
+                <xs:element name="cron-expression" type="xs:string">
+                    <xs:annotation>
+                        <xs:documentation>
+                            A CRON-formatted expression for when the job should run
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+            </xs:choice>
+            <xs:element name="ejb-ref" type="job:ejbRefType" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Configures an EJB reference that will be set on the job instance
+                        via dependency injection.  That is, you specify a property name
+                        and an EJB, and the setter for that property will be called with
+                        the EJB Local Home interface (and must take a parameter of the
+                        same type as the EJB Local Home interface).
+
+                        WARNING: Does not work in Geronimo 1.1: wait until 1.1.1
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="resource-ref" type="job:resourceRefType" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Configures a resource reference that will be set on the job instance
+                        via dependency injection.  That is, you specify a property name
+                        and a database pool or JMS connection factory, and the setter for that
+                        property will be called with the resource's interface (and must take a
+                        parameter of the same type as the res-type interface).
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="gbean-ref" type="job:gbeanRefType" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Configures a GBean reference that will be set on the job instance
+                        via dependency injection.  That is, you specify a property name
+                        and a GBean interface and name pattern, and the setter for that
+                        property will be called with the GBean's interface (and must take a
+                        parameter of the same type as at least one of the GBean interfaces).
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="ejbRefType">
+        <xs:sequence>
+            <xs:element name="property" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The name of the property on the job that this EJB
+                        reference should be injected into.  There must be a
+                        setter with the right name for the property (e.g.
+                        if the property is foo or Foo, there must be a setter
+                        setFoo that takes an argument whose type is the local
+                        home interface of the EJB).
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="ejb-type" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        Should be set to "Session" or "Entity".
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="local-home" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The fully-qualified Java class name of the EJB's local
+                        home interface.  The property that this will be injected
+                        into should have this type.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="local" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The fully-qualified Java class name of the EJB's local
+                        interface.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="pattern" type="job:patternType">
+                <xs:annotation>
+                    <xs:documentation>
+                        Identifies the EJB within the server that this reference
+                        points to.  Normally only the "name" child element is
+                        necessary.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="resourceRefType">
+        <xs:sequence>
+            <xs:element name="property" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The name of the property on the job that this resource
+                        reference should be injected into.  There must be a
+                        setter with the right name for the property (e.g.
+                        if the property is foo or Foo, there must be a setter
+                        setFoo that takes an argument of the correct type).
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="res-type" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The fully-qualified Java class name of the interface that
+                        the resource implements.  Normally this is one of:
+                              javax.sql.DataSource
+                              javax.jms.ConnectionFactory
+                              javax.jms.QueueConnectionFactory
+                              javax.jms.TopicConnectionFactory
+                              javax.mail.Session
+                        It may also be the type of a custom J2EE Connector's
+                        connection factory interface, etc.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="res-auth" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        Can be set to "Application" or "Container" per the J2EE
+                        definition of resource references (default is Application).
+
+                        This is normally not pertinent unless you are using a
+                        custom J2EE Connector -- JDBC, JMS, and JavaMail resources
+                        normally have any necessary authentication information
+                        configured into them at deployment time and ignore this
+                        option.
+
+                        The default is "Application".
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="res-sharing-scope" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        Can be set to "Shareable" or "Unshareable" per the J2EE
+                        definition of resource references (default is Shareable).
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="pattern" type="job:patternType">
+                <xs:annotation>
+                    <xs:documentation>
+                        Identifies the resource within the server that this reference
+                        points to.  Normally only the "name" child element is
+                        necessary.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="gbeanRefType">
+        <xs:sequence>
+            <xs:element name="property" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The name of the property on the job that this GBean
+                        reference should be injected into.  There must be a
+                        setter with the right name for the property (e.g.
+                        if the property is foo or Foo, there must be a setter
+                        setFoo that takes an argument of the correct type,
+                        which is normally one of the interfaces listed in
+                        the ref-type element).
+                    </xs:documentation>
+                </xs:annotation>
+
+            </xs:element>
+            <xs:element name="ref-type" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        The fully-qualified class name of a Java interface that the
+                        GBean implements.  Multiple interfaces may be listed (assuming
+                        the GBean in question implements them all), in which case the
+                        resulting reference can be cast to any of the specified
+                        interfaces.
+
+                        For example, to create a reference to the Quartz Scheduler GBean,
+                        you would set this to:  org.gplugins.quartz.QuartzScheduler
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:choice minOccurs="0" maxOccurs="unbounded">
+                <xs:element name="pattern" type="job:patternType">
+                    <xs:annotation>
+                        <xs:documentation>
+                            Identifies the GBean within the server that this reference
+                            points to.  Normally only the "name" child element is
+                            necessary.
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+            </xs:choice>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="patternType">
+        <xs:sequence>
+            <xs:element name="groupId" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        If the resource name and type are not enough to uniquely
+                        identify the resource, then the groupId, artifactId, and
+                        version can be used to identify the module that the
+                        target resource is in.  The values specified should match
+                        the components of the moduleId for the target module.
+                        The version may be omitted to select any available version.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="artifactId" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        If the resource name and type are not enough to uniquely
+                        identify the resource, then the groupId, artifactId, and
+                        version can be used to identify the module that the
+                        target resource is in.  The values specified should match
+                        the components of the moduleId for the target module.
+                        The version may be omitted to select any available version.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="version" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        If the resource name and type are not enough to uniquely
+                        identify the resource, then the groupId, artifactId, and
+                        version can be used to identify the module that the
+                        target resource is in.  The values specified should match
+                        the components of the moduleId for the target module.
+                        The version may be omitted to select any available version.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="module" type="xs:string" minOccurs="0">
+                <xs:annotation>
+                    <xs:documentation>
+                        Should only be used when the resource is in a child module
+                        within an EAR, and must be distinguished from other resources
+                        in different modules in the same EAR.  This value should be
+                        the file name of the module within the EAR.  It is rarely
+                        necessary.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="name" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The name of the component that this reference is referring to.
+                        For a database pool or JMS connection factory, this matches the
+                        pool name or connection factory name specified when creating the
+                        resource in the console, or the connectiondefinition-instance/name
+                        specified in the deployment plan.  For an EJB this is the EJB
+                        name, and for a GBean it is the name specified in the "gbean"
+                        element where the GBean was declared.
+
+                        If the name and type are not enough to uniquely identify the
+                        resource in question, the other elements in the pattern can be
+                        used to specify the module that the resource is in, potentially
+                        including the module name within an EAR.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+</xs:schema>
+

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/schema/xmlconfig.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/schema/xmlconfig.xml?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/schema/xmlconfig.xml (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/schema/xmlconfig.xml Tue May 27 08:22:56 2008
@@ -0,0 +1,7 @@
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
+
+    <xb:namespace uri="http://geronimo.apache.org/xml/ns/plugins/quartz-0.2">
+        <xb:package>org.gplugins.quartz.deployment.xbeans</xb:package>
+    </xb:namespace>
+
+</xb:config>
\ No newline at end of file

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/META-INF/geronimo-quartz.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/META-INF/geronimo-quartz.xml?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/META-INF/geronimo-quartz.xml (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/META-INF/geronimo-quartz.xml Tue May 27 08:22:56 2008
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jobs xmlns="http://geronimo.apache.org/xml/ns/plugins/quartz-0.2">
+    <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
+        <moduleId>
+            <artifactId>TestJob</artifactId>
+        </moduleId>
+        <dependencies>
+            <dependency>
+                 <groupId>geronimo</groupId>
+                 <artifactId>system-database</artifactId>
+             </dependency>
+        </dependencies>
+    </environment>
+    <job>
+        <job-name>Test Quartz Job</job-name>
+        <job-class>org.gplugins.quartz.jobs.TestJob</job-class>
+        <cron-expression>0/15 * * * * ?</cron-expression>
+        <resource-ref>
+            <property>TestDatabase</property>
+            <res-type>javax.sql.DataSource</res-type>
+            <pattern>
+                <name>SystemDatasource</name>
+            </pattern>
+        </resource-ref>
+        <gbean-ref>
+            <property>ServerInfo</property>
+            <ref-type>org.apache.geronimo.system.serverinfo.ServerInfo</ref-type>
+            <pattern>
+                <name>ServerInfo</name>
+            </pattern>
+        </gbean-ref>
+    </job>
+</jobs>

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/WEB-INF/web.xml?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/WEB-INF/web.xml (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/test-resources/WEB-INF/web.xml Tue May 27 08:22:56 2008
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+            http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+        version="2.4">
+
+</web-app>
\ No newline at end of file

Added: geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/quartz/jobs/TestJob.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/quartz/jobs/TestJob.java?rev=660557&view=auto
==============================================================================
--- geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/quartz/jobs/TestJob.java (added)
+++ geronimo/sandbox/quartz-plugin/base/deployer/src/test/org/gplugins/quartz/jobs/TestJob.java Tue May 27 08:22:56 2008
@@ -0,0 +1,57 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.
+ */
+package org.gplugins.quartz.jobs;
+
+import java.util.Date;
+import javax.sql.DataSource;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ * A test job to demonstrate resource injection, etc.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class TestJob implements Job {
+    private DataSource database;
+    private ServerInfo serverInfo;
+
+    public void setTestDatabase(DataSource database) {
+        this.database = database;
+    }
+
+    public void setServerInfo(ServerInfo serverInfo) {
+        this.serverInfo = serverInfo;
+    }
+
+    public void execute(JobExecutionContext context) throws JobExecutionException {
+        System.out.println("TEST JOB is running at "+new Date());
+
+        if(database == null) {
+            System.out.println(" * No data source available");
+        } else {
+            System.out.println(" * Data source is "+database);
+        }
+        if(serverInfo == null) {
+            System.out.println(" * No ServerInfo GBean available");
+        } else {
+            System.out.println(" * ServerInfo GBean is "+serverInfo);
+        }
+    }
+}



Mime
View raw message