craigmcc 01/04/05 12:30:40
Modified: catalina/src/conf web_23.dtd
catalina/src/share/org/apache/catalina Context.java
catalina/src/share/org/apache/catalina/core
StandardContext.java
catalina/src/share/org/apache/catalina/startup
ContextConfig.java
jasper/src/share/org/apache/jasper/resources web_23.dtd
webapps/examples/WEB-INF web.xml
Added: catalina/src/share/org/apache/catalina/deploy
ContextLocalEjb.java
Log:
Implement the following changes in the web application deployment descriptor
DTD, per approval by the JSR-053 Expert Group:
* The <run-as> element now has <description> and <role-name> subelements.
* The new <local-ejb-ref> element describes an optional capability that
allows a web application to reference a local EJB, if supported by the
container.
Revision Changes Path
1.4 +50 -3 jakarta-tomcat-4.0/catalina/src/conf/web_23.dtd
Index: web_23.dtd
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/web_23.dtd,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- web_23.dtd 2001/03/22 17:19:37 1.3
+++ web_23.dtd 2001/04/05 19:30:39 1.4
@@ -6,7 +6,7 @@
<!ELEMENT web-app (icon?, display-name?, description?, distributable?,
context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*,
session-config?,
mime-mapping*, welcome-file-list?, error-page*, taglib*,
resource-env-ref*, resource-ref*, security-constraint*, login-config?,
security-role*,
-env-entry*, ejb-ref*)>
+env-entry*, ejb-ref*, ejb-local-ref*)>
<!--
Declares a filter in the web application. The filter is mapped to either a servlet
or a URL pattern in the filter-mapping element, using the filter-name value to
reference. Filters can access the initialization parameters declared in the deployment
descriptor at runtime via the FilterConfig interface.
@@ -574,11 +574,55 @@
<!--
-The run-as element must contain the name of a security role defined for this web
application. If the optional run-as element is used for a servlet definition, the
security identity of a call to any EJBs from the servlet must be propogated as the
security role with the same name.
+The ejb-local-ref element is used for the declaration of a reference to
+an enterprise bean's local home. The declaration consists of:
+ - an optional description
+ - the EJB reference name used in the code of the web component
+ that's referencing the enterprise bean
+ - the expected type of the referenced enterprise bean
+ - the expected local home and local interfaces of the referenced
+ enterprise bean
+ - optional ejb-link information, used to specify the referenced
+ enterprise bean
+
+Used by <web-app>
+-->
+
+<!ELEMENT ejb-local-ref (description?, ejb-ref-name, ejb-ref-type,
+ local-home, local, ejb-link?)>
+
+<!--
+
+The local element contains the fully-qualified name of the
+enterprise bean's local interface.
+
+Used by ejb-local-ref
+
+-->
+<!ELEMENT local (#PCDATA)>
+
+<!--
+
+The local-home element contains the fully-qualified name of the
+enterprise bean's local home interface.
+
+Used by ejb-local-ref
+-->
+<!ELEMENT local-home (#PCDATA)>
+
+
+
+
+<!--
+The run-as element, if defined for a servlet, overrides the security identity used
to call an EJB
+by that servlet in this web application. The role-name is one of the security roles
already
+defined for this web application.
+
+Used by: <servlet>
-->
+<!ELEMENT run-as (description?, role-name)>
-<!ELEMENT run-as (#PCDATA)>
<!--
@@ -664,4 +708,7 @@
<!ATTLIST home id ID #IMPLIED>
<!ATTLIST remote id ID #IMPLIED>
<!ATTLIST ejb-link id ID #IMPLIED>
+<!ATTLIST ejb-local-ref id ID #IMPLIED>
+<!ATTLIST local-home id ID #IMPLIED>
+<!ATTLIST local id ID #IMPLIED>
<!ATTLIST run-as id ID #IMPLIED>
1.16 +37 -4
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java
Index: Context.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Context.java 2001/02/26 03:49:23 1.15
+++ Context.java 2001/04/05 19:30:39 1.16
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
1.15 2001/02/26 03:49:23 glenn Exp $
- * $Revision: 1.15 $
- * $Date: 2001/02/26 03:49:23 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
1.16 2001/04/05 19:30:39 craigmcc Exp $
+ * $Revision: 1.16 $
+ * $Date: 2001/04/05 19:30:39 $
*
* ====================================================================
*
@@ -69,6 +69,7 @@
import org.apache.catalina.deploy.ApplicationParameter;
import org.apache.catalina.deploy.ContextEjb;
import org.apache.catalina.deploy.ContextEnvironment;
+import org.apache.catalina.deploy.ContextLocalEjb;
import org.apache.catalina.deploy.ContextResource;
import org.apache.catalina.deploy.ErrorPage;
import org.apache.catalina.deploy.FilterDef;
@@ -95,7 +96,7 @@
* <p>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.15 $ $Date: 2001/02/26 03:49:23 $
+ * @version $Revision: 1.16 $ $Date: 2001/04/05 19:30:39 $
*/
public interface Context extends Container {
@@ -410,6 +411,14 @@
/**
+ * Add a local EJB resource reference for this web application.
+ *
+ * @param ejb New local EJB resource reference
+ */
+ public void addLocalEjb(ContextLocalEjb ejb);
+
+
+ /**
* Add a new MIME mapping, replacing any existing mapping for
* the specified extension.
*
@@ -625,6 +634,22 @@
/**
+ * Return the local EJB resource reference with the specified name, if any;
+ * otherwise, return <code>null</code>.
+ *
+ * @param name Name of the desired EJB resource reference
+ */
+ public ContextLocalEjb findLocalEjb(String name);
+
+
+ /**
+ * Return the defined local EJB resource references for this application.
+ * If there are none, a zero-length array is returned.
+ */
+ public ContextLocalEjb[] findLocalEjbs();
+
+
+ /**
* Return the MIME type to which the specified extension is mapped,
* if any; otherwise return <code>null</code>.
*
@@ -880,6 +905,14 @@
* @param listener Class name of an InstanceListener class to be removed
*/
public void removeInstanceListener(String listener);
+
+
+ /**
+ * Remove any local EJB resource reference with the specified name.
+ *
+ * @param name Name of the EJB resource reference to remove
+ */
+ public void removeLocalEjb(String name);
/**
1.49 +71 -4
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
Index: StandardContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- StandardContext.java 2001/03/30 23:24:04 1.48
+++ StandardContext.java 2001/04/05 19:30:39 1.49
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.48 2001/03/30 23:24:04 craigmcc Exp $
- * $Revision: 1.48 $
- * $Date: 2001/03/30 23:24:04 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.49 2001/04/05 19:30:39 craigmcc Exp $
+ * $Revision: 1.49 $
+ * $Date: 2001/04/05 19:30:39 $
*
* ====================================================================
*
@@ -118,6 +118,7 @@
import org.apache.catalina.deploy.ApplicationParameter;
import org.apache.catalina.deploy.ContextEjb;
import org.apache.catalina.deploy.ContextEnvironment;
+import org.apache.catalina.deploy.ContextLocalEjb;
import org.apache.catalina.deploy.ContextResource;
import org.apache.catalina.deploy.ErrorPage;
import org.apache.catalina.deploy.FilterDef;
@@ -140,7 +141,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.48 $ $Date: 2001/03/30 23:24:04 $
+ * @version $Revision: 1.49 $ $Date: 2001/04/05 19:30:39 $
*/
public class StandardContext
@@ -311,6 +312,13 @@
/**
+ * The local EJB resource references for this web application, keyed by
+ * name.
+ */
+ private HashMap localEjbs = new HashMap();
+
+
+ /**
* The login configuration descriptor for this web application.
*/
private LoginConfig loginConfig = null;
@@ -1362,6 +1370,21 @@
/**
+ * Add a local EJB resource reference for this web application.
+ *
+ * @param ejb New EJB resource reference
+ */
+ public void addLocalEjb(ContextLocalEjb ejb) {
+
+ synchronized (localEjbs) {
+ localEjbs.put(ejb.getName(), ejb);
+ }
+ fireContainerEvent("addLocalEjb", ejb.getName());
+
+ }
+
+
+ /**
* Add a new MIME mapping, replacing any existing mapping for
* the specified extension.
*
@@ -1834,6 +1857,35 @@
/**
+ * Return the local EJB resource reference with the specified name, if any;
+ * otherwise, return <code>null</code>.
+ *
+ * @param name Name of the desired EJB resource reference
+ */
+ public ContextLocalEjb findLocalEjb(String name) {
+
+ synchronized (localEjbs) {
+ return ((ContextLocalEjb) localEjbs.get(name));
+ }
+
+ }
+
+
+ /**
+ * Return the defined local EJB resource references for this application.
+ * If there are none, a zero-length array is returned.
+ */
+ public ContextLocalEjb[] findLocalEjbs() {
+
+ synchronized (localEjbs) {
+ ContextLocalEjb results[] = new ContextLocalEjb[localEjbs.size()];
+ return ((ContextLocalEjb[]) localEjbs.values().toArray(results));
+ }
+
+ }
+
+
+ /**
* Return the MIME type to which the specified extension is mapped,
* if any; otherwise return <code>null</code>.
*
@@ -2589,6 +2641,21 @@
// Inform interested listeners
fireContainerEvent("removeInstanceListener", listener);
+
+ }
+
+
+ /**
+ * Remove any local EJB resource reference with the specified name.
+ *
+ * @param name Name of the EJB resource reference to remove
+ */
+ public void removeLocalEjb(String name) {
+
+ synchronized (localEjbs) {
+ localEjbs.remove(name);
+ }
+ fireContainerEvent("removeLocalEjb", name);
}
1.1
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextLocalEjb.java
Index: ContextLocalEjb.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/ContextLocalEjb.java,v
1.1 2001/04/05 19:30:40 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2001/04/05 19:30:40 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.catalina.deploy;
/**
* Representation of a local EJB resource reference for a web application, as
* represented in a <code><ejb-local-ref></code> element in the
* deployment descriptor.
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2001/04/05 19:30:40 $
*/
public final class ContextLocalEjb {
// ------------------------------------------------------------- Properties
/**
* The description of this EJB.
*/
private String description = null;
public String getDescription() {
return (this.description);
}
public void setDescription(String description) {
this.description = description;
}
/**
* The name of the EJB home implementation class.
*/
private String home = null;
public String getHome() {
return (this.home);
}
public void setHome(String home) {
this.home = home;
}
/**
* The link to a J2EE EJB definition.
*/
private String link = null;
public String getLink() {
return (this.link);
}
public void setLink(String link) {
this.link = link;
}
/**
* The name of the EJB local implementation class.
*/
private String local = null;
public String getLocal() {
return (this.local);
}
public void setLocal(String local) {
this.local = local;
}
/**
* The name of this EJB.
*/
private String name = null;
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
/**
* The name of the EJB bean implementation class.
*/
private String type = null;
public String getType() {
return (this.type);
}
public void setType(String type) {
this.type = type;
}
// --------------------------------------------------------- Public Methods
/**
* Return a String representation of this object.
*/
public String toString() {
StringBuffer sb = new StringBuffer("ContextLocalEjb[");
sb.append("name=");
sb.append(name);
if (description != null) {
sb.append(", description=");
sb.append(description);
}
if (type != null) {
sb.append(", type=");
sb.append(type);
}
if (home != null) {
sb.append(", home=");
sb.append(home);
}
if (link != null) {
sb.append(", link=");
sb.append(link);
}
if (local != null) {
sb.append(", local=");
sb.append(local);
}
sb.append("]");
return (sb.toString());
}
}
1.43 +23 -5
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
Index: ContextConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- ContextConfig.java 2001/03/22 17:19:58 1.42
+++ ContextConfig.java 2001/04/05 19:30:40 1.43
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.42 2001/03/22 17:19:58 craigmcc Exp $
- * $Revision: 1.42 $
- * $Date: 2001/03/22 17:19:58 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.43 2001/04/05 19:30:40 craigmcc Exp $
+ * $Revision: 1.43 $
+ * $Date: 2001/04/05 19:30:40 $
*
* ====================================================================
*
@@ -120,7 +120,7 @@
* of that Context, and the associated defined servlets.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.42 $ $Date: 2001/03/22 17:19:58 $
+ * @version $Revision: 1.43 $ $Date: 2001/04/05 19:30:40 $
*/
public final class ContextConfig
@@ -459,6 +459,24 @@
mapper.addRule("web-app/distributable",
new SetDistributableAction());
+ mapper.addRule("web-app/ejb-local-ref",
+ mapper.objectCreate("org.apache.catalina.deploy.ContextLocalEjb"));
+ mapper.addRule("web-app/ejb-local-ref",
+ mapper.addChild("addLocalEjb",
+ "org.apache.catalina.deploy.ContextLocalEjb"));
+ mapper.addRule("web-app/ejb-local-ref/description",
+ mapper.methodSetter("setDescription", 0));
+ mapper.addRule("web-app/ejb-local-ref/ejb-ref-name",
+ mapper.methodSetter("setName", 0));
+ mapper.addRule("web-app/ejb-local-ref/ejb-ref-type",
+ mapper.methodSetter("setType", 0));
+ mapper.addRule("web-app/ejb-local-ref/local-home",
+ mapper.methodSetter("setHome", 0));
+ mapper.addRule("web-app/ejb-local-ref/local",
+ mapper.methodSetter("setLocal", 0));
+ mapper.addRule("web-app/ejb-local-ref/ejb-link",
+ mapper.methodSetter("setLink", 0));
+
mapper.addRule("web-app/ejb-ref",
mapper.objectCreate("org.apache.catalina.deploy.ContextEjb"));
mapper.addRule("web-app/ejb-ref",
@@ -632,7 +650,7 @@
mapper.methodSetter("setJspFile", 0));
mapper.addRule("web-app/servlet/load-on-startup",
mapper.methodSetter("setLoadOnStartupString", 0));
- mapper.addRule("web-app/servlet/run-as",
+ mapper.addRule("web-app/servlet/run-as/role-name",
mapper.methodSetter("setRunAs", 0));
mapper.addRule("web-app/servlet/security-role-ref",
mapper.methodSetter("addSecurityReference", 2));
1.4 +50 -3
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/resources/web_23.dtd
Index: web_23.dtd
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/resources/web_23.dtd,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- web_23.dtd 2001/03/22 17:20:16 1.3
+++ web_23.dtd 2001/04/05 19:30:40 1.4
@@ -6,7 +6,7 @@
<!ELEMENT web-app (icon?, display-name?, description?, distributable?,
context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*,
session-config?,
mime-mapping*, welcome-file-list?, error-page*, taglib*,
resource-env-ref*, resource-ref*, security-constraint*, login-config?,
security-role*,
-env-entry*, ejb-ref*)>
+env-entry*, ejb-ref*, ejb-local-ref*)>
<!--
Declares a filter in the web application. The filter is mapped to either a servlet
or a URL pattern in the filter-mapping element, using the filter-name value to
reference. Filters can access the initialization parameters declared in the deployment
descriptor at runtime via the FilterConfig interface.
@@ -574,11 +574,55 @@
<!--
-The run-as element must contain the name of a security role defined for this web
application. If the optional run-as element is used for a servlet definition, the
security identity of a call to any EJBs from the servlet must be propogated as the
security role with the same name.
+The ejb-local-ref element is used for the declaration of a reference to
+an enterprise bean's local home. The declaration consists of:
+ - an optional description
+ - the EJB reference name used in the code of the web component
+ that's referencing the enterprise bean
+ - the expected type of the referenced enterprise bean
+ - the expected local home and local interfaces of the referenced
+ enterprise bean
+ - optional ejb-link information, used to specify the referenced
+ enterprise bean
+
+Used by <web-app>
+-->
+
+<!ELEMENT ejb-local-ref (description?, ejb-ref-name, ejb-ref-type,
+ local-home, local, ejb-link?)>
+
+<!--
+
+The local element contains the fully-qualified name of the
+enterprise bean's local interface.
+
+Used by ejb-local-ref
+
+-->
+<!ELEMENT local (#PCDATA)>
+
+<!--
+
+The local-home element contains the fully-qualified name of the
+enterprise bean's local home interface.
+
+Used by ejb-local-ref
+-->
+<!ELEMENT local-home (#PCDATA)>
+
+
+
+
+<!--
+The run-as element, if defined for a servlet, overrides the security identity used
to call an EJB
+by that servlet in this web application. The role-name is one of the security roles
already
+defined for this web application.
+
+Used by: <servlet>
-->
+<!ELEMENT run-as (description?, role-name)>
-<!ELEMENT run-as (#PCDATA)>
<!--
@@ -664,4 +708,7 @@
<!ATTLIST home id ID #IMPLIED>
<!ATTLIST remote id ID #IMPLIED>
<!ATTLIST ejb-link id ID #IMPLIED>
+<!ATTLIST ejb-local-ref id ID #IMPLIED>
+<!ATTLIST local-home id ID #IMPLIED>
+<!ATTLIST local id ID #IMPLIED>
<!ATTLIST run-as id ID #IMPLIED>
1.15 +23 -0 jakarta-tomcat-4.0/webapps/examples/WEB-INF/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/examples/WEB-INF/web.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- web.xml 2001/03/24 21:15:25 1.14
+++ web.xml 2001/04/05 19:30:40 1.15
@@ -88,6 +88,10 @@
<param-value>bar</param-value>
</init-param>
-->
+ <run-as>
+ <description>Security role for anonymous access</description>
+ <role-name>tomcat</role-name>
+ </run-as>
</servlet>
<servlet>
<servlet-name>
@@ -211,5 +215,24 @@
<env-entry-value>10</env-entry-value>
<env-entry-type>java.lang.Integer</env-entry-type>
</env-entry>
+
+ <!-- EJB Reference -->
+ <ejb-ref>
+ <description>Example EJB Reference</description>
+ <ejb-ref-name>ejb/Account</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <home>com.mycompany.mypackage.AccountHome</home>
+ <remote>com.mycompany.mypackage.Account</remote>
+ </ejb-ref>
+
+ <!-- Local EJB Reference -->
+ <ejb-local-ref>
+ <description>Example Local EJB Reference</description>
+ <ejb-ref-name>ejb/ProcessOrder</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home>com.mycompany.mypackage.ProcessOrderHome</local-home>
+ <local>com.mycompany.mypackage.ProcessOrder</local>
+ </ejb-local-ref>
+
</web-app>