From scm-return-17038-apmail-geronimo-scm-archive=geronimo.apache.org@geronimo.apache.org Wed Jan 17 20:04:56 2007 Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 56105 invoked from network); 17 Jan 2007 20:04:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jan 2007 20:04:55 -0000 Received: (qmail 39749 invoked by uid 500); 17 Jan 2007 20:05:00 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 39656 invoked by uid 500); 17 Jan 2007 20:05:00 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 39633 invoked by uid 99); 17 Jan 2007 20:05:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jan 2007 12:05:00 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jan 2007 12:04:48 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 7467B1A981A; Wed, 17 Jan 2007 12:03:44 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r497146 [2/5] - in /geronimo/server/trunk: ./ assemblies/geronimo-jetty6-jee5/ assemblies/geronimo-jetty6-jee5/src/main/var/config/ assemblies/geronimo-tomcat6-jee5/ assemblies/geronimo-tomcat6-jee5/src/main/var/config/ configs/ configs/jee... Date: Wed, 17 Jan 2007 20:03:29 -0000 To: scm@geronimo.apache.org From: dain@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070117200344.7467B1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/SecurityBuilder.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,255 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.openejb.deployment; + +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.util.Enumeration; +import java.util.List; +import java.util.Map; +import javax.security.jacc.EJBMethodPermission; +import javax.security.jacc.EJBRoleRefPermission; + +import org.apache.geronimo.common.DeploymentException; +import org.apache.geronimo.security.jacc.ComponentPermissions; +import org.apache.openejb.jee.AssemblyDescriptor; +import org.apache.openejb.jee.ExcludeList; +import org.apache.openejb.jee.Method; +import org.apache.openejb.jee.MethodPermission; +import org.apache.openejb.jee.SecurityRoleRef; + +public class SecurityBuilder { + /** + * Fill the container moduleBuilder with the security information that it needs + * to create the proper interceptors. A SecurityConfiguration + * is also filled with permissions that need to be used to fill the JACC + * policy configuration. + * + * @param notAssigned the set of all possible permissions. These will be + * culled so that all that are left are those that have + * not been assigned roles. + * @param assemblyDescriptor the assembly descriptor + * @param ejbName the name of the EJB + * @param securityRoleRefs the EJB's role references + * @throws DeploymentException if any constraints are violated + */ + public void addComponentPermissions(String defaultRole, + Permissions notAssigned, + AssemblyDescriptor assemblyDescriptor, + String ejbName, + List securityRoleRefs, + ComponentPermissions componentPermissions) throws DeploymentException { + + PermissionCollection uncheckedPermissions = componentPermissions.getUncheckedPermissions(); + PermissionCollection excludedPermissions = componentPermissions.getExcludedPermissions(); + Map rolePermissions = componentPermissions.getRolePermissions(); + + //this can occur in an ear when one ejb module has security and one doesn't. In this case we still need + //to make the non-secure one completely unchecked. + if (assemblyDescriptor != null) { + /** + * JACC v1.0 section 3.1.5.1 + */ + for (MethodPermission methodPermission : assemblyDescriptor.getMethodPermission()) { + List roleNames = methodPermission.getRoleName(); + boolean unchecked = methodPermission.getUnchecked() != null; + + for (Method method : methodPermission.getMethod()) { + if (!ejbName.equals(method.getEjbName())) { + continue; + } + + // method name + String methodName = method.getMethodName(); + if ("*".equals(methodName)) { + // jacc uses null instead of * + methodName = null; + } + + // method interface + String methodIntf = method.getMethodIntf().toString(); + + // method parameters + String[] methodParams; + if (method.getMethodParams() != null) { + List paramList = method.getMethodParams().getMethodParam(); + methodParams = paramList.toArray(new String[paramList.size()]); + } else { + methodParams = null; + } + + // create the permission object + EJBMethodPermission permission = new EJBMethodPermission(ejbName, methodName, methodIntf, methodParams); + notAssigned = cullPermissions(notAssigned, permission); + + // if this is unchecked, mark it as unchecked; otherwise assign the roles + if (unchecked) { + uncheckedPermissions.add(permission); + } else { + for (String roleName : roleNames) { + Permissions permissions = (Permissions) rolePermissions.get(roleName); + if (permissions == null) { + permissions = new Permissions(); + rolePermissions.put(roleName, permissions); + } + permissions.add(permission); + } + } + } + + } + + /** + * JACC v1.0 section 3.1.5.2 + */ + ExcludeList excludeList = assemblyDescriptor.getExcludeList(); + if (excludeList != null) { + for (Method method : excludeList.getMethod()) { + if (!ejbName.equals(method.getEjbName())) { + continue; + } + + // method name + String methodName = method.getMethodName(); + // method interface + String methodIntf = method.getMethodIntf().toString(); + + // method parameters + String[] methodParams; + if (method.getMethodParams() != null) { + List paramList = method.getMethodParams().getMethodParam(); + methodParams = paramList.toArray(new String[paramList.size()]); + } else { + methodParams = null; + } + + // create the permission object + EJBMethodPermission permission = new EJBMethodPermission(ejbName, methodName, methodIntf, methodParams); + + excludedPermissions.add(permission); + notAssigned = cullPermissions(notAssigned, permission); + } + } + + /** + * JACC v1.0 section 3.1.5.3 + */ + for (SecurityRoleRef securityRoleRef : securityRoleRefs) { + if (securityRoleRef.getRoleLink() == null) { + throw new DeploymentException("Missing role-link"); + } + + String roleLink = securityRoleRef.getRoleLink(); + + PermissionCollection roleLinks = (PermissionCollection) rolePermissions.get(roleLink); + if (roleLinks == null) { + roleLinks = new Permissions(); + rolePermissions.put(roleLink, roleLinks); + + } + roleLinks.add(new EJBRoleRefPermission(ejbName, securityRoleRef.getRoleName())); + } + } + + /** + * EJB v2.1 section 21.3.2 + *

+ * It is possible that some methods are not assigned to any security + * roles nor contained in the exclude-list element. In + * this case, it is the responsibility of the Deployer to assign method + * permissions for all of the unspecified methods, either by assigning + * them to security roles, or by marking them as unchecked. + */ + PermissionCollection permissions; + if (defaultRole == null) { + permissions = uncheckedPermissions; + } else { + permissions = (PermissionCollection) rolePermissions.get(defaultRole); + if (permissions == null) { + permissions = new Permissions(); + rolePermissions.put(defaultRole, permissions); + } + } + + Enumeration e = notAssigned.elements(); + while (e.hasMoreElements()) { + Permission p = (Permission) e.nextElement(); + permissions.add(p); + } + + } + + /** + * Generate all the possible permissions for a bean's interface. + *

+ * Method permissions are defined in the deployment descriptor as a binary + * relation from the set of security roles to the set of methods of the + * home, component, and/or web service endpoint interfaces of session and + * entity beans, including all their superinterfaces (including the methods + * of the EJBHome and EJBObject interfaces and/or + * EJBLocalHome and EJBLocalObject interfaces). + * + * @param permissions the permission set to be extended + * @param ejbName the name of the EJB + * @param methodInterface the EJB method interface + * @param interfaceClass the class name of the interface to be used to generate the permissions + * @param classLoader the class loader to be used in obtaining the interface class + */ + public void addToPermissions(Permissions permissions, + String ejbName, + String methodInterface, + String interfaceClass, + ClassLoader classLoader) throws DeploymentException { + + if (interfaceClass == null) { + return; + } + + try { + Class clazz = Class.forName(interfaceClass, false, classLoader); + for (java.lang.reflect.Method method : clazz.getMethods()) { + permissions.add(new EJBMethodPermission(ejbName, methodInterface, method)); + } + } catch (ClassNotFoundException e) { + throw new DeploymentException(e); + } + + } + + /** + * Removes permissions from toBeChecked that are implied by + * permission. + * + * @param toBeChecked the permissions that are to be checked and possibly culled + * @param permission the permission that is to be used for culling + * @return the culled set of permissions that are not implied by permission + */ + private Permissions cullPermissions(Permissions toBeChecked, Permission permission) { + Permissions result = new Permissions(); + + for (Enumeration e = toBeChecked.elements(); e.hasMoreElements();) { + Permission test = (Permission) e.nextElement(); + if (!permission.implies(test)) { + result.add(test); + } + } + + return result; + } +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,355 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.openejb.deployment; + +import java.net.URL; +import java.util.jar.JarFile; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.ByteArrayOutputStream; +import javax.xml.bind.ValidationEvent; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.namespace.QName; + +import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbEjbJarDocument; +import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType; +import org.apache.geronimo.deployment.util.DeploymentUtil; +import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil; +import org.apache.geronimo.deployment.xbeans.EnvironmentType; +import org.apache.geronimo.deployment.xbeans.ArtifactType; +import org.apache.geronimo.common.DeploymentException; +import org.apache.geronimo.schema.SchemaConversionUtils; +import org.apache.geronimo.xbeans.javaee.EjbJarDocument; +import org.apache.geronimo.xbeans.javaee.EjbJarType; +import org.apache.xmlbeans.XmlObject; +import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlDocumentProperties; +import org.apache.openejb.jee.EjbJar; + +public final class XmlUtil { + public static final QName OPENEJBJAR_QNAME = OpenejbEjbJarDocument.type.getDocumentElementName(); + private static final QName CMP_VERSION = new QName(SchemaConversionUtils.J2EE_NAMESPACE, "cmp-version"); + + private XmlUtil() { + } + + public static String loadEjbJarXml(URL ejbJarUrl, JarFile moduleFile) { + String ejbJarXml; + try { + if (ejbJarUrl == null) { + ejbJarUrl = DeploymentUtil.createJarURL(moduleFile, "META-INF/ejb-jar.xml"); + } + + // read in the entire specDD as a string, we need this for getDeploymentDescriptor + // on the J2ee management object + ejbJarXml = DeploymentUtil.readAll(ejbJarUrl); + return ejbJarXml; + } catch (Exception e) { + return null; + } + } + + @SuppressWarnings({"unchecked"}) + public static T unmarshal(Class type, String xml) throws DeploymentException { + try { + JAXBContext ctx = JAXBContext.newInstance(type); + Unmarshaller unmarshaller = ctx.createUnmarshaller(); + + Object object = unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes())); + unmarshaller.setEventHandler(new ValidationEventHandler()); + return (T) object; + } catch (JAXBException e) { + throw new DeploymentException(e); + } + } + + public static String marshal(T object) throws DeploymentException { + try { + JAXBContext ctx = JAXBContext.newInstance(object.getClass()); + Marshaller marshaller = ctx.createMarshaller(); + marshaller.setProperty("jaxb.formatted.output", true); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + marshaller.marshal(object, baos); + + String xml = new String(baos.toByteArray()); + return xml; + } catch (JAXBException e) { + throw new DeploymentException(e); + } + } + + public static String loadOpenejbJarXml(XmlObject xmlObject, JarFile moduleFile) throws DeploymentException { + // load the openejb-jar.xml from either the supplied plan or from the earFile + try { + String openejbJarXml; + if (xmlObject instanceof XmlObject) { + openejbJarXml = xmlObject.xmlText(); + } else { + if (xmlObject != null) { + xmlObject = XmlBeansUtil.parse(((File) xmlObject).toURL(), XmlUtil.class.getClassLoader()); + openejbJarXml = xmlObject.xmlText(); + } else { + URL path = DeploymentUtil.createJarURL(moduleFile, "META-INF/openejb-jar.xml"); + openejbJarXml = DeploymentUtil.readAll(path); + } + } + return openejbJarXml; + } catch (IOException e) { + return null; + } catch (XmlException e) { + throw new DeploymentException(e); + } + } + + public static EjbJarType convertToXmlbeans(EjbJar ejbJar) throws DeploymentException { + // + // it would be nice if Jaxb had a way to convert the object to a + // sax reader that could be fed directly into xmlbeans + // + + // marshal to xml + String xml = marshal(ejbJar); + try { + // parse the xml + EjbJarDocument ejbJarDoc = convertToEJBSchema(XmlBeansUtil.parse(xml)); + EjbJarType ejbJarType = ejbJarDoc.getEjbJar(); + return ejbJarType; + } catch (XmlException e) { + throw new DeploymentException("Error parsing ejb-jar.xml", e); + } + + } + public static OpenejbGeronimoEjbJarType loadGeronimOpenejbJar(Object plan, JarFile moduleFile, boolean standAlone, String targetPath, EjbJar ejbJar) throws DeploymentException { + OpenejbGeronimoEjbJarType openejbJar; + XmlObject rawPlan = null; + try { + // load the openejb-jar.xml from either the supplied plan or from the earFile + try { + if (plan instanceof XmlObject) { + rawPlan = (XmlObject) plan; + } else { + if (plan != null) { + OpenejbEjbJarDocument document = (OpenejbEjbJarDocument) XmlBeansUtil.parse(((File) plan).toURL(), XmlUtil.class.getClassLoader()); + rawPlan = document.getEjbJar(); + } else { + URL path = DeploymentUtil.createJarURL(moduleFile, "META-INF/geronimo-openejb.xml"); + rawPlan = XmlBeansUtil.parse(path, XmlUtil.class.getClassLoader()); + } + } + } catch (IOException e) { + //no plan, create a default + } + + // if we got one extract, adjust, and validate it otherwise create a default one + if (rawPlan != null) { + openejbJar = (OpenejbGeronimoEjbJarType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, OPENEJBJAR_QNAME, OpenejbGeronimoEjbJarType.type); + } else { + String path; + if (standAlone) { + // default configId is based on the moduleFile name + path = new File(moduleFile.getName()).getName(); + } else { + // default configId is based on the module uri from the application.xml + path = targetPath; + } + openejbJar = createDefaultPlan(path, ejbJar); + } + } catch (XmlException e) { + throw new DeploymentException(e); + } + return openejbJar; + } + + public static OpenejbGeronimoEjbJarType createDefaultPlan(String name, EjbJar ejbJar) { + String id = ejbJar.getId(); + if (id == null) { + id = name; + if (id.endsWith(".jar")) { + id = id.substring(0, id.length() - 4); + } + if (id.endsWith("/")) { + id = id.substring(0, id.length() - 1); + } + } + + OpenejbGeronimoEjbJarType openejbEjbJar = OpenejbGeronimoEjbJarType.Factory.newInstance(); + EnvironmentType environmentType = openejbEjbJar.addNewEnvironment(); + ArtifactType artifactType = environmentType.addNewModuleId(); + artifactType.setArtifactId(id); + return openejbEjbJar; + } + + public static String getJ2eeStringValue(org.apache.geronimo.xbeans.javaee.String string) { + if (string == null) { + return null; + } + return string.getStringValue(); + } + + public static class ValidationEventHandler implements javax.xml.bind.ValidationEventHandler { + public boolean handleEvent(ValidationEvent validationEvent) { + System.out.println(validationEvent.getMessage()); + return true; + } + } + + + // coerce to newest spec... this shouldn't be necessary as the jaxb tree always creates the newest spec + public static EjbJarDocument convertToEJBSchema(XmlObject xmlObject) throws XmlException { + if (EjbJarDocument.type.equals(xmlObject.schemaType())) { +// XmlBeansUtil.validateDD(xmlObject); + return (EjbJarDocument) xmlObject; + } + XmlCursor cursor = xmlObject.newCursor(); + XmlCursor moveable = xmlObject.newCursor(); + //cursor is intially located before the logical STARTDOC token + try { + cursor.toFirstChild(); + if (EjbJarDocument.type.getDocumentElementName().getNamespaceURI().equals(cursor.getName().getNamespaceURI())) { + XmlObject result = xmlObject.changeType(EjbJarDocument.type); + // XmlBeansUtil.validateDD(result); + return (EjbJarDocument) result; + } + // deployment descriptor is probably in EJB 1.1 or 2.0 format + XmlDocumentProperties xmlDocumentProperties = cursor.documentProperties(); + String publicId = xmlDocumentProperties.getDoctypePublicId(); + String cmpVersion; + if ("-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN".equals(publicId)) { + cmpVersion = "1.x"; + } else if ("-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN".equals(publicId)) { + cmpVersion = null;//2.x is the default "2.x"; + } else { + throw new XmlException("Unrecognized document type: " + publicId); + } + String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"; + String version = "2.1"; + SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.J2EE_NAMESPACE, schemaLocationURL, version); + //play with message-driven + cursor.toStartDoc(); + convertBeans(cursor, moveable, cmpVersion); + } finally { + cursor.dispose(); + moveable.dispose(); + } + XmlObject result = xmlObject.changeType(EjbJarDocument.type); + if (result != null) { + XmlBeansUtil.validateDD(result); + return (EjbJarDocument) result; + } + XmlBeansUtil.validateDD(xmlObject); + return (EjbJarDocument) xmlObject; + } + + private static void convertBeans(XmlCursor cursor, XmlCursor moveable, String cmpVersion) { + cursor.toChild(SchemaConversionUtils.J2EE_NAMESPACE, "ejb-jar"); + cursor.toChild(SchemaConversionUtils.J2EE_NAMESPACE, "enterprise-beans"); + if (cursor.toFirstChild()) { + //there's at least one ejb... + do { + cursor.push(); + String type = cursor.getName().getLocalPart(); + if ("session".equals(type)) { + cursor.toChild(SchemaConversionUtils.J2EE_NAMESPACE, "transaction-type"); + cursor.toNextSibling(); + SchemaConversionUtils.convertToJNDIEnvironmentRefsGroup(SchemaConversionUtils.J2EE_NAMESPACE, cursor, moveable); + } else if ("entity".equals(type)) { + cursor.toChild(SchemaConversionUtils.J2EE_NAMESPACE, "persistence-type"); + String persistenceType = cursor.getTextValue(); + //reentrant is the last required tag before jndiEnvironmentRefsGroup + cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "reentrant"); + //Convert 2.0 True/False to true/false for 2.1 + cursor.setTextValue(cursor.getTextValue().toLowerCase()); + if (cmpVersion != null && !cursor.toNextSibling(CMP_VERSION) && "Container".equals(persistenceType)) { + cursor.toNextSibling(); + cursor.insertElementWithText(CMP_VERSION, cmpVersion); + } + + cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "abstract-schema-name"); + while (cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "cmp-field")) { + } + cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "primkey-field"); + cursor.toNextSibling(); + SchemaConversionUtils.convertToJNDIEnvironmentRefsGroup(SchemaConversionUtils.J2EE_NAMESPACE, cursor, moveable); + } else if ("message-driven".equals(type)) { + cursor.toFirstChild(); + if (cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "messaging-type")) { + cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "transaction-type"); + } else { + cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "transaction-type"); + //insert messaging-type (introduced in EJB 2.1 spec) before transaction-type + cursor.insertElementWithText("messaging-type", SchemaConversionUtils.J2EE_NAMESPACE, "javax.jms.MessageListener"); + //cursor still on transaction-type + } + if (!cursor.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "activation-config")) { + //skip transaction-type + cursor.toNextSibling(); + //convert EJB 2.0 elements to activation-config-properties. + moveable.toCursor(cursor); + cursor.push(); + cursor.beginElement("activation-config", SchemaConversionUtils.J2EE_NAMESPACE); + boolean hasProperties = addActivationConfigProperty(moveable, cursor, "message-selector", "messageSelector"); + hasProperties |= addActivationConfigProperty(moveable, cursor, "acknowledge-mode", "acknowledgeMode"); + if (new QName(SchemaConversionUtils.J2EE_NAMESPACE, "message-driven-destination").equals(moveable.getName()) || + moveable.toNextSibling(SchemaConversionUtils.J2EE_NAMESPACE, "message-driven-destination")) { + moveable.push(); + moveable.toFirstChild(); + hasProperties |= addActivationConfigProperty(moveable, cursor, "destination-type", "destinationType"); + hasProperties |= addActivationConfigProperty(moveable, cursor, "subscription-durability", "subscriptionDurability"); + moveable.pop(); + moveable.removeXml(); + } + cursor.pop(); + if (!hasProperties) { + //the activation-config element that we created is empty so delete it + cursor.toPrevSibling(); + cursor.removeXml(); + //cursor should now be at first element in JNDIEnvironmentRefsGroup + } + } else { + //cursor pointing at activation-config + cursor.toNextSibling(); + //cursor should now be at first element in JNDIEnvironmentRefsGroup + } + SchemaConversionUtils.convertToJNDIEnvironmentRefsGroup(SchemaConversionUtils.J2EE_NAMESPACE, cursor, moveable); + } + cursor.pop(); + } while (cursor.toNextSibling()); + } + } + + private static boolean addActivationConfigProperty(XmlCursor moveable, XmlCursor cursor, String elementName, String propertyName) { + QName name = new QName(SchemaConversionUtils.J2EE_NAMESPACE, elementName); + if (name.equals(moveable.getName()) || moveable.toNextSibling(name)) { + cursor.push(); + cursor.beginElement("activation-config-property", SchemaConversionUtils.J2EE_NAMESPACE); + cursor.insertElementWithText("activation-config-property-name", SchemaConversionUtils.J2EE_NAMESPACE, propertyName); + cursor.insertElementWithText("activation-config-property-value", SchemaConversionUtils.J2EE_NAMESPACE, moveable.getTextValue()); + moveable.removeXml(); + cursor.pop(); + cursor.toNextSibling(); + return true; + } + return false; + } +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/AbstractEjbRefBuilder.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/AbstractEjbRefBuilder.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/AbstractEjbRefBuilder.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/AbstractEjbRefBuilder.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,233 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.openejb.deployment.ejbref; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import javax.naming.Reference; + +import org.apache.geronimo.common.DeploymentException; +import org.apache.geronimo.common.UnresolvedEJBRefException; +import org.apache.geronimo.gbean.AbstractName; +import org.apache.geronimo.gbean.AbstractNameQuery; +import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; +import org.apache.geronimo.kernel.GBeanNotFoundException; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.repository.Artifact; +import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.naming.deployment.AbstractNamingBuilder; +import org.apache.geronimo.openejb.EjbReference; +import org.apache.geronimo.openejb.deployment.EjbInterface; +import org.apache.openejb.RpcEjbDeployment; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public abstract class AbstractEjbRefBuilder extends AbstractNamingBuilder { + private final static Map STATELESS = Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.STATELESS_SESSION_BEAN); + private final static Map STATEFUL = Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.STATEFUL_SESSION_BEAN); + private final static Map ENTITY = Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.ENTITY_BEAN); + + protected AbstractEjbRefBuilder(Environment defaultEnvironment) { + super(defaultEnvironment); + } + + protected Reference createEjbRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, AbstractNameQuery query, boolean isSession, String homeInterface, String businessInterface, boolean remote) throws DeploymentException { + AbstractNameQuery match = getEjbRefQuery(refName, configuration, name, requiredModule, optionalModule, query, isSession, homeInterface, businessInterface, remote); + return new EjbReference(configuration.getId(), match, remote); + } + + protected AbstractNameQuery getEjbRefQuery(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, AbstractNameQuery query, boolean isSession, String homeInterface, String businessInterface, boolean remote) throws DeploymentException { + AbstractNameQuery match; + if (query != null) { + if (remote) { + checkRemoteProxyInfo(query, homeInterface, businessInterface, configuration); + } else { + checkLocalProxyInfo(query, homeInterface, businessInterface, configuration); + } + match = new AbstractNameQuery(query.getArtifact(), query.getName(), RpcEjbDeployment.class.getName()); + } else if (name != null) { + match = getMatch(refName, configuration, name, requiredModule, remote, isSession, homeInterface, businessInterface); + } else { + match = getImplicitMatch(refName, configuration, optionalModule, remote, isSession, homeInterface, businessInterface); + } + return match; + } + + private AbstractNameQuery getMatch(String refName, Configuration context, String name, String module, boolean isRemote, boolean isSession, String home, String remote) throws DeploymentException { + Map nameQuery = new HashMap(); + nameQuery.put(NameFactory.J2EE_NAME, name); + if (module != null) { + nameQuery.put(NameFactory.EJB_MODULE, module); + } + Artifact id = context.getId(); + Collection matches = getMatchesFromName(isSession, nameQuery, context, id, isRemote, home, remote); + if (matches.isEmpty()) { + matches = getMatchesFromName(isSession, nameQuery, context, null, isRemote, home, remote); + } + if (matches.isEmpty()) { + throw new UnresolvedEJBRefException(refName, !isRemote, isSession, home, remote, false); + } + AbstractName match; + if (matches.size() == 1) { + match = matches.iterator().next(); + } else { + throw new UnresolvedEJBRefException(refName, !isRemote, isSession, home, remote, matches.size() > 0); + } + return new AbstractNameQuery(stripVersion(match.getArtifact()), match.getName(), RpcEjbDeployment.class.getName()); + } + + private Collection getMatchesFromName(boolean isSession, Map nameQuery, Configuration context, Artifact id, boolean isRemote, String home, String remote) { + Set gbeanDatas = new HashSet(); + if (isSession) { + Map q = new HashMap(nameQuery); + q.putAll(STATELESS); + gbeanDatas.addAll(findGBeanDatas(context, id, q)); + + q = new HashMap(nameQuery); + q.putAll(STATEFUL); + gbeanDatas.addAll(findGBeanDatas(context, id, q)); + } else { + Map q = new HashMap(nameQuery); + q.putAll(ENTITY); + gbeanDatas.addAll(findGBeanDatas(context, id, q)); + } + + Collection matches = new ArrayList(); + for (GBeanData data : gbeanDatas) { + if (matchesProxyInfo(data, isRemote, home, remote)) { + matches.add(data.getAbstractName()); + } + } + return matches; + } + + @SuppressWarnings({"unchecked"}) + private Collection findGBeanDatas(Configuration context, Artifact id, Map q) { + return context.findGBeanDatas(Collections.singleton(new AbstractNameQuery(id, q, RpcEjbDeployment.class.getName()))); + } + + private AbstractNameQuery getImplicitMatch(String refName, Configuration context, String module, boolean isRemote, boolean isSession, String home, String remote) throws DeploymentException { + Collection matches = getMatchesFromName(isSession, Collections.emptyMap(), context, context.getId(), isRemote, home, remote); + if (matches.isEmpty()) { + matches = getMatchesFromName(isSession, Collections.emptyMap(), context, null, isRemote, home, remote); + } + if (matches.isEmpty()) { + throw new UnresolvedEJBRefException(refName, false, isSession, home, remote, false); + } + AbstractName match; + if (matches.size() == 1) { + match = matches.iterator().next(); + } else { + for (Iterator iterator = matches.iterator(); iterator.hasNext();) { + AbstractName objectName = iterator.next(); + if (module != null && !(objectName.getName().get(NameFactory.EJB_MODULE).equals(module))) { + iterator.remove(); + } + } + if (matches.size() == 1) { + match = matches.iterator().next(); + } else { + throw new UnresolvedEJBRefException(refName, false, isSession, home, remote, matches.size() > 0); + } + } + return new AbstractNameQuery(match); + } + + private boolean matchesProxyInfo(GBeanData data, boolean isRemote, String home, String remote) { + if (isRemote) { + return home.equals(getHomeInterface(data)) && remote.equals(getRemoteInterface(data)); + } else { + return home.equals(getLocalHomeInterface(data)) && remote.equals(getLocalInterface(data)); + } + } + + private void checkLocalProxyInfo(AbstractNameQuery query, String expectedLocalHome, String expectedLocal, Configuration configuration) throws DeploymentException { + try { + GBeanData data = configuration.findGBeanData(query); + + String actualLocalHome = getLocalHomeInterface(data); + String actualLocal = getLocalInterface(data); + if (actualLocalHome == null || actualLocal == null) { + // EJBs like the MEJB don't have interfaces declared in the gbean data + return; + } + + if (!expectedLocalHome.equals(actualLocalHome) || !expectedLocal.equals(actualLocal)) { + throw new DeploymentException("Reference interfaces do not match bean interfaces:\n" + + "reference localHome: " + expectedLocalHome + "\n" + + "ejb localHome: " + actualLocalHome + "\n" + + "reference local: " + expectedLocal + "\n" + + "ejb local: " + getLocalInterface(data)); + } + } catch (GBeanNotFoundException e) { + throw new DeploymentException("Could not locate ejb matching " + query + " in configuration " + configuration.getId()); + } + } + + private void checkRemoteProxyInfo(AbstractNameQuery query, String expectedHome, String expectedRemote, Configuration configuration) throws DeploymentException { + try { + GBeanData data = configuration.findGBeanData(query); + + String actualHome = getHomeInterface(data); + String actualRemote = getRemoteInterface(data); + if (actualHome == null || actualRemote == null) { + // EJBs like the MEJB don't have interfaces declared in the gbean data + return; + } + + if (!expectedHome.equals(actualHome) || !expectedRemote.equals(actualRemote)) { + throw new DeploymentException("Reference interfaces do not match bean interfaces:\n" + + "reference home: " + expectedHome + "\n" + + "ejb home: " + actualHome + "\n" + + "reference remote: " + expectedRemote + "\n" + + "ejb remote: " + actualRemote); + } + } catch (GBeanNotFoundException e) { + // we can't verify remote ejb refs if the GBean can't be found + // could be a reference to an ejb in another application that hasn't been loaded yet + } + } + + private static Artifact stripVersion(Artifact artifact) { + return new Artifact(artifact.getGroupId(), artifact.getArtifactId(), (String) null, artifact.getType()); + } + + private static String getHomeInterface(GBeanData data) { + return (String) data.getAttribute(EjbInterface.HOME.getAttributeName()); + } + + private static String getRemoteInterface(GBeanData data) { + return (String) data.getAttribute(EjbInterface.REMOTE.getAttributeName()); + } + + private static String getLocalHomeInterface(GBeanData data) { + return (String) data.getAttribute(EjbInterface.LOCAL_HOME.getAttributeName()); + } + + private static String getLocalInterface(GBeanData data) { + return (String) data.getAttribute(EjbInterface.LOCAL.getAttributeName()); + } +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/ClientEjbRefBuilder.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/ClientEjbRefBuilder.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/ClientEjbRefBuilder.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/ClientEjbRefBuilder.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,80 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.openejb.deployment.ejbref; + +import java.net.URI; +import java.net.URISyntaxException; +import javax.naming.Reference; + +import org.apache.geronimo.common.DeploymentException; +import org.apache.geronimo.gbean.AbstractNameQuery; +import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; +import org.apache.geronimo.kernel.GBeanNotFoundException; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.openejb.ClientEjbReference; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public class ClientEjbRefBuilder extends RemoteEjbRefBuilder { + private final URI uri; + + public ClientEjbRefBuilder(Environment defaultEnvironment, String[] eeNamespaces, String host, int port) throws URISyntaxException { + super(defaultEnvironment, eeNamespaces); + uri = new URI("ejb", null, host, port, null, null, null); + } + + protected Reference createEjbRef(String refName, Configuration configuration, String name, String requiredModule, String optionalModule, AbstractNameQuery query, boolean isSession, String homeInterface, String businessInterface, boolean remote) throws DeploymentException { + AbstractNameQuery match = getEjbRefQuery(refName, configuration, name, requiredModule, optionalModule, query, isSession, homeInterface, businessInterface, remote); + + GBeanData data = null; + try { + data = configuration.findGBeanData(match); + } catch (GBeanNotFoundException ignored) { + throw new DeploymentException("Ejb not found for ejb-ref " + refName); + } + + String deploymentId = (String) data.getAttribute("deploymentId"); + if (deploymentId == null) { + throw new DeploymentException(("EjbDeployment GBeanData does not contain a \"deploymentId\" attribute")); + } + return new ClientEjbReference(uri.toString(), deploymentId); + } + + public static final GBeanInfo GBEAN_INFO; + + static { + GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ClientEjbRefBuilder.class, RemoteEjbRefBuilder.GBEAN_INFO, NameFactory.MODULE_BUILDER); + + infoBuilder.addAttribute("host", String.class, true); + infoBuilder.addAttribute("port", int.class, true); + + infoBuilder.setConstructor(new String[]{"defaultEnvironment", "eeNamespaces", "host", "port"}); + + GBEAN_INFO = infoBuilder.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } + +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/LocalEjbRefBuilder.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/LocalEjbRefBuilder.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/LocalEjbRefBuilder.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/LocalEjbRefBuilder.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,169 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.openejb.deployment.ejbref; + +import java.net.URI; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.naming.Reference; +import javax.xml.namespace.QName; + +import org.apache.geronimo.common.DeploymentException; +import org.apache.geronimo.gbean.AbstractNameQuery; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.j2ee.deployment.Module; +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefDocument; +import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType; +import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType; +import org.apache.geronimo.xbeans.javaee.EjbLocalRefType; +import org.apache.xmlbeans.QNameSet; +import org.apache.xmlbeans.XmlObject; + +/** + * @version $Revision: 470469 $ $Date: 2006-11-02 10:43:34 -0800 (Thu, 02 Nov 2006) $ + */ +public class LocalEjbRefBuilder extends AbstractEjbRefBuilder { + private static final QName GER_EJB_LOCAL_REF_QNAME = GerEjbLocalRefDocument.type.getDocumentElementName(); + private static final QNameSet GER_EJB_LOCAL_REF_QNAME_SET = QNameSet.singleton(GER_EJB_LOCAL_REF_QNAME); + + private final QNameSet ejbLocalRefQNameSet; + + public LocalEjbRefBuilder(Environment defaultEnvironment, String[] eeNamespaces) { + super(defaultEnvironment); + ejbLocalRefQNameSet = buildQNameSet(eeNamespaces, "ejb-local-ref"); + } + + public QNameSet getSpecQNameSet() { + return ejbLocalRefQNameSet; + } + + public QNameSet getPlanQNameSet() { + return GER_EJB_LOCAL_REF_QNAME_SET; + } + + protected boolean willMergeEnvironment(XmlObject specDD, XmlObject plan) { + return specDD.selectChildren(ejbLocalRefQNameSet).length > 0; + } + + public void buildNaming(XmlObject specDD, XmlObject plan, Configuration localConfiguration, Configuration remoteConfiguration, Module module, Map componentContext) throws DeploymentException { + List ejbLocalRefs = convert(specDD.selectChildren(ejbLocalRefQNameSet), J2EE_CONVERTER, EjbLocalRefType.class, EjbLocalRefType.type); + XmlObject[] gerEjbLocalRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_EJB_LOCAL_REF_QNAME_SET); + Map ejbLocalRefMap = mapEjbLocalRefs(gerEjbLocalRefsUntyped); + ClassLoader cl = module.getEarContext().getClassLoader(); + + for (EjbLocalRefType ejbLocalRef : ejbLocalRefs) { + String ejbRefName = getStringValue(ejbLocalRef.getEjbRefName()); + GerEjbLocalRefType localRef = ejbLocalRefMap.get(ejbRefName); + + Reference ejbReference = createEjbLocalRef(remoteConfiguration, module.getModuleURI(), ejbLocalRef, localRef, cl); + if (ejbReference != null) { + //noinspection unchecked + getJndiContextMap(componentContext).put(ENV + ejbRefName, ejbReference); + } + } + } + + private Reference createEjbLocalRef(Configuration ejbContext, URI moduleURI, EjbLocalRefType ejbLocalRef, GerEjbLocalRefType localRef, ClassLoader cl) throws DeploymentException { + String refName = getStringValue(ejbLocalRef.getEjbRefName()); + + String local = getStringValue(ejbLocalRef.getLocal()); + try { + assureEJBLocalObjectInterface(local, cl); + } catch (DeploymentException e) { + throw new DeploymentException("Error processing 'local' element for EJB Local Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage()); + } + + String localHome = getStringValue(ejbLocalRef.getLocalHome()); + try { + assureEJBLocalHomeInterface(localHome, cl); + } catch (DeploymentException e) { + throw new DeploymentException("Error processing 'local-home' element for EJB Local Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage()); + } + + boolean isSession = "Session".equals(getStringValue(ejbLocalRef.getEjbRefType())); + + String ejbLink = null; + if (localRef != null && localRef.isSetEjbLink()) { + ejbLink = localRef.getEjbLink(); + } else if (ejbLocalRef.isSetEjbLink()) { + ejbLink = getStringValue(ejbLocalRef.getEjbLink()); + } + + String optionalModule; + if (moduleURI == null) { + optionalModule = null; + } else { + optionalModule = moduleURI.toString(); + } + + String requiredModule = null; + AbstractNameQuery containerQuery = null; + if (ejbLink != null) { + String[] bits = ejbLink.split("#"); + if (bits.length == 2) { + //look only in specified module. + requiredModule = bits[0]; + ejbLink = bits[1]; + } + } else if (localRef != null) { + GerPatternType patternType = localRef.getPattern(); + containerQuery = buildAbstractNameQuery(patternType, null, NameFactory.EJB_MODULE, null); + } + return createEjbRef(refName, ejbContext, ejbLink, requiredModule, optionalModule, containerQuery, isSession, localHome, local, false); + } + + private static Map mapEjbLocalRefs(XmlObject[] refs) { + Map refMap = new HashMap(); + if (refs != null) { + for (int i = 0; i < refs.length; i++) { + GerEjbLocalRefType ref = (GerEjbLocalRefType) refs[i].copy().changeType(GerEjbLocalRefType.type); + refMap.put(ref.getRefName().trim(), ref); + } + } + return refMap; + } + + public static Class assureEJBLocalObjectInterface(String local, ClassLoader cl) throws DeploymentException { + return assureInterface(local, "javax.ejb.EJBLocalObject", "Local", cl); + } + + public static Class assureEJBLocalHomeInterface(String localHome, ClassLoader cl) throws DeploymentException { + return assureInterface(localHome, "javax.ejb.EJBLocalHome", "LocalHome", cl); + } + + public static final GBeanInfo GBEAN_INFO; + + static { + GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(LocalEjbRefBuilder.class, NameFactory.MODULE_BUILDER); + infoBuilder.addAttribute("eeNamespaces", String[].class, true, true); + infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true); + + infoBuilder.setConstructor(new String[]{"defaultEnvironment", "eeNamespaces"}); + + GBEAN_INFO = infoBuilder.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/RemoteEjbRefBuilder.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/RemoteEjbRefBuilder.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/RemoteEjbRefBuilder.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/ejbref/RemoteEjbRefBuilder.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,185 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.openejb.deployment.ejbref; + +import java.net.URI; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.naming.Reference; +import javax.xml.namespace.QName; + +import org.apache.geronimo.common.DeploymentException; +import org.apache.geronimo.gbean.AbstractNameQuery; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.j2ee.deployment.Module; +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefDocument; +import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefType; +import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType; +import org.apache.geronimo.xbeans.javaee.EjbRefType; +import org.apache.xmlbeans.QNameSet; +import org.apache.xmlbeans.XmlObject; + +/** + * @version $Revision: 475950 $ $Date: 2006-11-16 14:18:14 -0800 (Thu, 16 Nov 2006) $ + */ +public class RemoteEjbRefBuilder extends AbstractEjbRefBuilder { + private static final QName GER_EJB_REF_QNAME = GerEjbRefDocument.type.getDocumentElementName(); + private static final QNameSet GER_EJB_REF_QNAME_SET = QNameSet.singleton(GER_EJB_REF_QNAME); + + private final QNameSet ejbRefQNameSet; + + public RemoteEjbRefBuilder(Environment defaultEnvironment, String[] eeNamespaces) { + super(defaultEnvironment); + ejbRefQNameSet = buildQNameSet(eeNamespaces, "ejb-ref"); + } + + public QNameSet getSpecQNameSet() { + return ejbRefQNameSet; + } + + public QNameSet getPlanQNameSet() { + return GER_EJB_REF_QNAME_SET; + } + + protected boolean willMergeEnvironment(XmlObject specDD, XmlObject plan) { + return specDD.selectChildren(ejbRefQNameSet).length > 0; + } + + public void buildNaming(XmlObject specDD, XmlObject plan, Configuration localConfiguration, Configuration remoteConfiguration, Module module, Map componentContext) throws DeploymentException { + List ejbRefs = convert(specDD.selectChildren(ejbRefQNameSet), J2EE_CONVERTER, EjbRefType.class, EjbRefType.type); + XmlObject[] gerEjbRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_EJB_REF_QNAME_SET); + Map ejbRefMap = mapEjbRefs(gerEjbRefsUntyped); + ClassLoader cl = module.getEarContext().getClassLoader(); + + for (EjbRefType ejbRef : ejbRefs) { + String ejbRefName = getStringValue(ejbRef.getEjbRefName()); + GerEjbRefType remoteRef = ejbRefMap.get(ejbRefName); + + Reference ejbReference = createEjbRef(remoteConfiguration, module.getModuleURI(), ejbRef, remoteRef, cl); + if (ejbReference != null) { + //noinspection unchecked + getJndiContextMap(componentContext).put(ENV + ejbRefName, ejbReference); + } + } + } + + private Reference createEjbRef(Configuration ejbContext, URI moduleURI, EjbRefType ejbRef, GerEjbRefType remoteRef, ClassLoader cl) throws DeploymentException { + String refName = getStringValue(ejbRef.getEjbRefName()); + + String remote = getStringValue(ejbRef.getRemote()); + try { + assureEJBObjectInterface(remote, cl); + } catch (DeploymentException e) { + throw new DeploymentException("Error processing 'remote' element for EJB Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage()); + } + + String home = getStringValue(ejbRef.getHome()); + try { + assureEJBHomeInterface(home, cl); + } catch (DeploymentException e) { + throw new DeploymentException("Error processing 'home' element for EJB Reference '" + refName + "' for module '" + moduleURI + "': " + e.getMessage()); + } + + boolean isSession = "Session".equals(getStringValue(ejbRef.getEjbRefType())); + + // MEJB + if (isSession && remote.equals("javax.management.j2ee.Management") && home.equals("javax.management.j2ee.ManagementHome")) { + AbstractNameQuery query = new AbstractNameQuery(null, Collections.singletonMap("name", "ejb/mgmt/MEJB")); + return createEjbRef(null, ejbContext, null, null, null, query, isSession, home, remote, true); + } + + // corba refs are handled by another builder + if (remoteRef != null && remoteRef.isSetNsCorbaloc()) { + return null; + } + + String ejbLink = null; + if (remoteRef != null && remoteRef.isSetEjbLink()) { + ejbLink = remoteRef.getEjbLink(); + } else if (ejbRef.isSetEjbLink()) { + ejbLink = getStringValue(ejbRef.getEjbLink()); + } + + String optionalModule; + if (moduleURI == null) { + optionalModule = null; + } else { + optionalModule = moduleURI.toString(); + } + + String requiredModule = null; + AbstractNameQuery containerQuery = null; + if (ejbLink != null) { + String[] bits = ejbLink.split("#"); + if (bits.length == 2) { + //look only in specified module. + requiredModule = bits[0]; + if (moduleURI != null) { + requiredModule = moduleURI.resolve(requiredModule).getPath(); + } + ejbLink = bits[1]; + } + } else if (remoteRef != null) { + GerPatternType patternType = remoteRef.getPattern(); + containerQuery = buildAbstractNameQuery(patternType, null, NameFactory.EJB_MODULE, null); + } + return createEjbRef(refName, ejbContext, ejbLink, requiredModule, optionalModule, containerQuery, isSession, home, remote, true); + } + + private static Map mapEjbRefs(XmlObject[] refs) { + Map refMap = new HashMap(); + if (refs != null) { + for (int i = 0; i < refs.length; i++) { + GerEjbRefType ref = (GerEjbRefType) refs[i].copy().changeType(GerEjbRefType.type); + refMap.put(ref.getRefName().trim(), ref); + } + } + return refMap; + } + + public static Class assureEJBObjectInterface(String remote, ClassLoader cl) throws DeploymentException { + return assureInterface(remote, "javax.ejb.EJBObject", "Remote", cl); + } + + public static Class assureEJBHomeInterface(String home, ClassLoader cl) throws DeploymentException { + return assureInterface(home, "javax.ejb.EJBHome", "Home", cl); + } + + public static final GBeanInfo GBEAN_INFO; + + static { + GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(RemoteEjbRefBuilder.class, NameFactory.MODULE_BUILDER); + infoBuilder.addAttribute("eeNamespaces", String[].class, true, true); + infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true); + + infoBuilder.setConstructor(new String[]{"defaultEnvironment", "eeNamespaces"}); + + GBEAN_INFO = infoBuilder.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } + +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/geronimo-openejb-2.0.xsd URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/geronimo-openejb-2.0.xsd?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/geronimo-openejb-2.0.xsd (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/geronimo-openejb-2.0.xsd Wed Jan 17 12:03:23 2007 @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/xmlconfig.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/xmlconfig.xml?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/xmlconfig.xml (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/schema/xmlconfig.xml Wed Jan 17 12:03:23 2007 @@ -0,0 +1,26 @@ + + + + + + org.apache.geronimo.openejb.xbeans.ejbjar + Openejb + + Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/SchemaConversionTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/SchemaConversionTest.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/SchemaConversionTest.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/SchemaConversionTest.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,173 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.geronimo.openejb.deployment; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil; +import org.apache.geronimo.schema.SchemaConversionUtils; +import org.apache.geronimo.testsupport.XmlBeansTestSupport; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlObject; + +/** + * ejb 1.1 dtd appears to be a subset of ejb 2.0 dtd so the same xsl should + * work for both. + * + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public class SchemaConversionTest extends XmlBeansTestSupport { + private ClassLoader classLoader = this.getClass().getClassLoader(); + + // Dain: I don't believe we need this test anymore since openejb is doing the converstions. + public void testNothing() { + } + + public void XtestEJB11ToEJB21Transform() throws Exception { + URL srcXml = classLoader.getResource("j2ee_1_2dtd/ejb-1-11.xml"); + URL expectedOutputXml = classLoader.getResource("j2ee_1_2dtd/ejb-1-21.xml"); + XmlObject xmlObject = XmlObject.Factory.parse(srcXml); + XmlObject expected = XmlObject.Factory.parse(expectedOutputXml); + XmlBeansUtil.validateDD(expected); + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); +// log.debug(xmlObject.toString()); +// log.debug(expected.toString()); + List problems = new ArrayList(); + boolean ok = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences: " + problems, ok); + //make sure trying to convert twice has no bad effects + XmlCursor cursor2 = xmlObject.newCursor(); + try { + String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"; + String version = "2.1"; + Assert.assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE, schemaLocationURL, version)); + } finally { + cursor2.dispose(); + } + boolean ok2 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to schema: " + problems, ok2); + //do the whole transform twice... + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); + boolean ok3 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to ejb schema: " + problems, ok3); + } + + public void XtestEJB20ToEJB21Transform() throws Exception { + URL srcXml = classLoader.getResource("j2ee_1_3dtd/ejb-jar.xml"); + URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/ejb-jar-21.xml"); + XmlObject xmlObject = XmlObject.Factory.parse(srcXml); + XmlObject expected = XmlObject.Factory.parse(expectedOutputXml); + XmlBeansUtil.validateDD(expected); + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); +// log.debug(xmlObject.toString()); +// log.debug(expected.toString()); + List problems = new ArrayList(); + boolean ok = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences: " + problems, ok); + //make sure trying to convert twice has no bad effects + XmlCursor cursor2 = xmlObject.newCursor(); + try { + String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"; + String version = "2.1"; + Assert.assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE, schemaLocationURL, version)); + } finally { + cursor2.dispose(); + } + boolean ok2 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to schema: " + problems, ok2); + //do the whole transform twice... + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); + boolean ok3 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to ejb schema: " + problems, ok3); + } + + public void xtestMDB20ToEJB21TransformBugGERONIMO_1649() throws Exception { + URL srcXml = classLoader.getResource("j2ee_1_3dtd/mdb-ejb-jar-20-GERONIMO-1649.xml"); + URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/mdb-ejb-jar-21-GERONIMO-1649.xml"); + XmlObject xmlObject = XmlObject.Factory.parse(srcXml); + XmlObject expected = XmlObject.Factory.parse(expectedOutputXml); + XmlBeansUtil.validateDD(expected); + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); +// log.debug(xmlObject.toString()); +// log.debug(expected.toString()); + List problems = new ArrayList(); + boolean ok = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences: " + problems, ok); + //make sure trying to convert twice has no bad effects + XmlCursor cursor2 = xmlObject.newCursor(); + try { + String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"; + String version = "2.1"; + Assert.assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE, schemaLocationURL, version)); + } finally { + cursor2.dispose(); + } + boolean ok2 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to schema: " + problems, ok2); + //do the whole transform twice... + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); + boolean ok3 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to ejb schema: " + problems, ok3); + } + + public void XtestMDB20To21Transform() throws Exception { + URL srcXml = classLoader.getResource("j2ee_1_3dtd/mdb-ejb-jar-20.xml"); + URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/mdb-ejb-jar-21.xml"); + XmlObject xmlObject = XmlObject.Factory.parse(srcXml); + XmlObject expected = XmlObject.Factory.parse(expectedOutputXml); + XmlBeansUtil.validateDD(expected); + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); +// log.debug(xmlObject.toString()); +// log.debug(expected.toString()); + List problems = new ArrayList(); + boolean ok = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences: " + problems, ok); + //make sure trying to convert twice has no bad effects + XmlCursor cursor2 = xmlObject.newCursor(); + try { + String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"; + String version = "2.1"; + Assert.assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE, schemaLocationURL, version)); + } finally { + cursor2.dispose(); + } + boolean ok2 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to schema: " + problems, ok2); + //do the whole transform twice... + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); + boolean ok3 = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences after reconverting to ejb schema: " + problems, ok3); + } + + + public void XtestEJB21To21DoesNothing() throws Exception { + URL srcXml = classLoader.getResource("j2ee_1_4schema/ejb-jar.xml"); + URL expectedOutputXml = classLoader.getResource("j2ee_1_4schema/ejb-jar.xml"); + XmlObject xmlObject = XmlObject.Factory.parse(srcXml); + xmlObject = XmlUtil.convertToEJBSchema(xmlObject); + XmlObject expected = XmlObject.Factory.parse(expectedOutputXml); + List problems = new ArrayList(); + boolean ok = compareXmlObjects(xmlObject, expected, problems); + Assert.assertTrue("Differences: " + problems, ok); + } + +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/XmlUtilTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/XmlUtilTest.java?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/XmlUtilTest.java (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/java/org/apache/geronimo/openejb/deployment/XmlUtilTest.java Wed Jan 17 12:03:23 2007 @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.openejb.deployment; + +import java.io.File; +import java.net.URL; + +import junit.framework.TestCase; +import org.apache.geronimo.openejb.xbeans.ejbjar.OpenejbGeronimoEjbJarType; +import org.apache.geronimo.xbeans.javaee.EjbJarType; +import org.apache.openejb.jee.EjbJar; + +/** + * @version $Rev$ $Date$ + */ +public class XmlUtilTest extends TestCase { + public void testLoadGeronimOpenejbJar() throws Exception { + URL resource = getClass().getClassLoader().getResource("plans/geronimo-openejb.xml"); + File plan = new File(resource.toURI()); + OpenejbGeronimoEjbJarType openejbGeronimoEjbJarType = XmlUtil.loadGeronimOpenejbJar(plan, null, true, null, null); + assertNotNull(openejbGeronimoEjbJarType); + } + + public void testConvertToXmlbeans() throws Exception { + URL specDDUrl = getClass().getClassLoader().getResource("jee_5schema/ejb-jar.xml"); + assertNotNull(specDDUrl); + + // load the ejb-jar.xml + String ejbJarXml = XmlUtil.loadEjbJarXml(specDDUrl, null); + assertNotNull(ejbJarXml); + + EjbJar ejbJar = XmlUtil.unmarshal(EjbJar.class, ejbJarXml); + EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar); + assertNotNull(ejbJarType); + } +} Added: geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_2dtd/ejb-1-11.xml URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_2dtd/ejb-1-11.xml?view=auto&rev=497146 ============================================================================== --- geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_2dtd/ejb-1-11.xml (added) +++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/test/resources/j2ee_1_2dtd/ejb-1-11.xml Wed Jan 17 12:03:23 2007 @@ -0,0 +1,126 @@ + + + + + + + description + My Favorite Ejb + + + description + Favorite Bean + FavoriteBean + org.apache.geronimo.FavoriteBeanHome + org.apache.geronimo.FavoriteBean + org.apache.geronimo.FavoriteBeanEJB + Container + java.lang.Integer + False + + id + + + preference + + + color + + id + + + + + + FavoriteBean + Home + remove + + java.lang.Object + + + Required + + + + FavoriteBean + Home + create + + int + float + java.lang.String + + + Required + + + + FavoriteBean + Remote + getPreference + + + Required + + + + FavoriteBean + Remote + remove + + + Required + + + + FavoriteBean + Home + remove + + javax.ejb.Handle + + + Required + + + + FavoriteBean + Home + findByPrimaryKey + + java.lang.Integer + + + Required + + + + FavoriteBean + Remote + updatePreference + + float + + + Required + + + +