geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r505432 [2/11] - in /geronimo/server/trunk: applications/magicGball/magicGball-ear/src/main/plan/ configs/client-corba-yoko/src/plan/ configs/j2ee-corba-yoko/src/plan/ configs/openejb-corba-deployer/src/plan/ modules/ modules/geronimo-corba...
Date Fri, 09 Feb 2007 19:24:39 GMT
Added: geronimo/server/trunk/modules/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditor.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditor.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba-builder/src/main/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditor.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,278 @@
+/**
+ * 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.corba.security.config.tss;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.common.propertyeditor.PropertyEditorException;
+import org.apache.geronimo.deployment.service.XmlAttributeBuilder;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.security.deploy.DefaultPrincipal;
+import org.apache.geronimo.security.deployment.GeronimoSecurityBuilderImpl;
+import org.apache.geronimo.xbeans.geronimo.security.GerDefaultPrincipalType;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.kernel.ClassLoading;
+import org.omg.CSIIOP.CompositeDelegation;
+import org.omg.CSIIOP.Confidentiality;
+import org.omg.CSIIOP.DetectMisordering;
+import org.omg.CSIIOP.DetectReplay;
+import org.omg.CSIIOP.EstablishTrustInClient;
+import org.omg.CSIIOP.EstablishTrustInTarget;
+import org.omg.CSIIOP.Integrity;
+import org.omg.CSIIOP.NoDelegation;
+import org.omg.CSIIOP.NoProtection;
+import org.omg.CSIIOP.SimpleDelegation;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSAssociationOption;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSCompoundSecMechType;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSGSSUPType;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSGeneralNameType;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSGssExportedNameType;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSIdentityTokenTypeList;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSSSLType;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSSasMechType;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSTssDocument;
+import org.apache.geronimo.corba.xbeans.csiv2.tss.TSSTssType;
+
+
+/**
+ * A property editor for {@link org.apache.geronimo.corba.security.config.tss.TSSConfig}.
+ *
+ * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
+ */
+public class TSSConfigEditor implements XmlAttributeBuilder {
+
+    private static final String NAMESPACE = TSSTssDocument.type.getDocumentElementName().getNamespaceURI();
+
+    public String getNamespace() {
+        return NAMESPACE;
+    }
+
+    /**
+     * Returns a TSSConfig object initialized with the input object
+     * as an XML string.
+     *
+     * @return a TSSConfig object
+     * @throws org.apache.geronimo.common.propertyeditor.PropertyEditorException
+     *          An IOException occured.
+     */
+    public Object getValue(XmlObject xmlObject, String type, ClassLoader cl) throws DeploymentException {
+        TSSTssType tss;
+        if (xmlObject instanceof TSSTssType) {
+            tss = (TSSTssType) xmlObject;
+        } else {
+            tss = (TSSTssType) xmlObject.copy().changeType(TSSTssType.type);
+        }
+
+        try {
+            XmlBeansUtil.validateDD(tss);
+        } catch (XmlException e) {
+            throw new DeploymentException(e);
+        }
+
+        TSSConfig tssConfig = new TSSConfig();
+
+        tssConfig.setInherit(tss.getInherit());
+
+        if (tss.isSetDefaultPrincipal()) {
+            DefaultPrincipal defaultPrincipal = new DefaultPrincipal();
+            GerDefaultPrincipalType defaultPrincipalType = tss.getDefaultPrincipal();
+
+            defaultPrincipal.setPrincipal(new GeronimoSecurityBuilderImpl().buildPrincipal(defaultPrincipalType.getPrincipal()));
+
+            tssConfig.setDefaultPrincipal(defaultPrincipal);
+        }
+
+        if (tss.isSetSSL()) {
+            tssConfig.setTransport_mech(extractSSL(tss.getSSL()));
+        } else if (tss.isSetSECIOP()) {
+            throw new PropertyEditorException("SECIOP processing not implemented");
+        } else {
+            tssConfig.setTransport_mech(new TSSNULLTransportConfig());
+        }
+
+        if (tss.isSetCompoundSecMechTypeList()) {
+            TSSCompoundSecMechListConfig mechListConfig = tssConfig.getMechListConfig();
+            mechListConfig.setStateful(tss.getCompoundSecMechTypeList().getStateful());
+
+            TSSCompoundSecMechType[] mechList = tss.getCompoundSecMechTypeList().getCompoundSecMechArray();
+            for (int i = 0; i < mechList.length; i++) {
+                TSSCompoundSecMechConfig cMech = extractCompoundSecMech(mechList[i], cl);
+                cMech.setTransport_mech(tssConfig.getTransport_mech());
+                mechListConfig.add(cMech);
+            }
+        }
+
+        return tssConfig;
+    }
+
+    protected static TSSTransportMechConfig extractSSL(TSSSSLType sslMech) {
+        TSSSSLTransportConfig sslConfig = new TSSSSLTransportConfig();
+
+        sslConfig.setHostname(sslMech.getHostname());
+        sslConfig.setPort(sslMech.getPort());
+        sslConfig.setHandshakeTimeout(sslMech.getHandshakeTimeout());
+        sslConfig.setSupports(extractAssociationOptions(sslMech.getSupports()));
+        sslConfig.setRequires(extractAssociationOptions(sslMech.getRequires()));
+
+        return sslConfig;
+    }
+
+    protected static TSSCompoundSecMechConfig extractCompoundSecMech(TSSCompoundSecMechType mech, ClassLoader cl) throws DeploymentException {
+
+        TSSCompoundSecMechConfig result = new TSSCompoundSecMechConfig();
+
+        if (mech.isSetGSSUP()) {
+            result.setAs_mech(extractASMech(mech.getGSSUP()));
+        } else {
+            result.setAs_mech(new TSSNULLASMechConfig());
+        }
+
+        if (mech.isSetSasMech()) {
+            result.setSas_mech(extractSASMech(mech.getSasMech(), cl));
+        }
+
+        return result;
+    }
+
+    protected static TSSASMechConfig extractASMech(TSSGSSUPType gssupMech) {
+
+        TSSGSSUPMechConfig gssupConfig = new TSSGSSUPMechConfig();
+
+        gssupConfig.setTargetName(gssupMech.getTargetName());
+        gssupConfig.setRequired(gssupMech.getRequired());
+
+        return gssupConfig;
+    }
+
+    protected static TSSSASMechConfig extractSASMech(TSSSasMechType sasMech, ClassLoader cl) throws DeploymentException {
+
+        TSSSASMechConfig sasMechConfig = new TSSSASMechConfig();
+
+        if (sasMech.isSetServiceConfigurationList()) {
+            sasMechConfig.setRequired(sasMech.getServiceConfigurationList().getRequired());
+
+            TSSGeneralNameType[] generalNames = sasMech.getServiceConfigurationList().getGeneralNameArray();
+            for (int i = 0; i < generalNames.length; i++) {
+                sasMechConfig.addServiceConfigurationConfig(new TSSGeneralNameConfig(generalNames[i].getPrivilegeAuthority()));
+            }
+
+            TSSGssExportedNameType[] exportedNames = sasMech.getServiceConfigurationList().getGssExportedNameArray();
+            for (int i = 0; i < exportedNames.length; i++) {
+                sasMechConfig.addServiceConfigurationConfig(new TSSGSSExportedNameConfig(exportedNames[i].getPrivilegeAuthority(), exportedNames[i].getOID()));
+            }
+        }
+
+        TSSIdentityTokenTypeList identityTokenTypes = sasMech.getIdentityTokenTypes();
+
+        if (identityTokenTypes.isSetITTAbsent()) {
+            sasMechConfig.addIdentityToken(new TSSITTAbsent());
+        } else {
+            if (identityTokenTypes.isSetITTAnonymous()) {
+                sasMechConfig.addIdentityToken(new TSSITTAnonymous());
+            }
+            if (identityTokenTypes.isSetITTPrincipalNameGSSUP()) {
+                org.apache.geronimo.corba.xbeans.csiv2.tss.TSSITTPrincipalNameGSSUPType ittPrincipalNameGSSUP = identityTokenTypes.getITTPrincipalNameGSSUP();
+                String principalClassName = ittPrincipalNameGSSUP.getPrincipalClass();
+                Class principalClass;
+                try {
+                    principalClass = ClassLoading.loadClass(principalClassName, cl);
+                } catch (ClassNotFoundException e) {
+                    throw new DeploymentException("Could not load principal class", e);
+                }
+                String domainName = ittPrincipalNameGSSUP.isSetDomain() ? ittPrincipalNameGSSUP.getDomain().trim() : null;
+                String realmName = null;
+                if (domainName != null && ittPrincipalNameGSSUP.isSetRealm()) {
+                    realmName = ittPrincipalNameGSSUP.getRealm().trim();
+                }
+
+
+                try {
+                    sasMechConfig.addIdentityToken(new TSSITTPrincipalNameGSSUP(principalClass, realmName, domainName));
+                } catch (NoSuchMethodException e) {
+                    throw new DeploymentException("Could not find principal class constructor", e);
+                }
+            }
+            if (identityTokenTypes.isSetITTDistinguishedName()) {
+                String realmName = identityTokenTypes.getITTDistinguishedName().getRealm();
+                String domainName = identityTokenTypes.getITTDistinguishedName().getDomain();
+
+                realmName = (realmName == null ? null : realmName.trim());
+                domainName = (domainName == null ? null : domainName.trim());
+                sasMechConfig.addIdentityToken(new TSSITTDistinguishedName(realmName, domainName));
+            }
+            if (identityTokenTypes.isSetITTX509CertChain()) {
+                String realmName = identityTokenTypes.getITTX509CertChain().getRealm();
+                String domainName = identityTokenTypes.getITTX509CertChain().getDomain();
+
+                realmName = (realmName == null ? null : realmName.trim());
+                domainName = (domainName == null ? null : domainName.trim());
+                sasMechConfig.addIdentityToken(new TSSITTX509CertChain(realmName, domainName));
+            }
+        }
+
+        return sasMechConfig;
+    }
+
+    protected static short extractAssociationOptions(List list) {
+        short result = 0;
+
+        for (Iterator iter = list.iterator(); iter.hasNext();) {
+            TSSAssociationOption.Enum obj = TSSAssociationOption.Enum.forString((String) iter.next());
+
+            if (TSSAssociationOption.NO_PROTECTION.equals(obj)) {
+                result |= NoProtection.value;
+            } else if (TSSAssociationOption.INTEGRITY.equals(obj)) {
+                result |= Integrity.value;
+            } else if (TSSAssociationOption.CONFIDENTIALITY.equals(obj)) {
+                result |= Confidentiality.value;
+            } else if (TSSAssociationOption.DETECT_REPLAY.equals(obj)) {
+                result |= DetectReplay.value;
+            } else if (TSSAssociationOption.DETECT_MISORDERING.equals(obj)) {
+                result |= DetectMisordering.value;
+            } else if (TSSAssociationOption.ESTABLISH_TRUST_IN_TARGET.equals(obj)) {
+                result |= EstablishTrustInTarget.value;
+            } else if (TSSAssociationOption.ESTABLISH_TRUST_IN_CLIENT.equals(obj)) {
+                result |= EstablishTrustInClient.value;
+            } else if (TSSAssociationOption.NO_DELEGATION.equals(obj)) {
+                result |= NoDelegation.value;
+            } else if (TSSAssociationOption.SIMPLE_DELEGATION.equals(obj)) {
+                result |= SimpleDelegation.value;
+            } else if (TSSAssociationOption.COMPOSITE_DELEGATION.equals(obj)) {
+                result |= CompositeDelegation.value;
+            }
+        }
+        return result;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(TSSConfigEditor.class, "XmlAttributeBuilder");
+        infoBuilder.addInterface(XmlAttributeBuilder.class);
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-css-config-2.1.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-css-config-2.1.xsd?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-css-config-2.1.xsd (added)
+++ geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-css-config-2.1.xsd Fri Feb  9 11:24:30 2007
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+-->
+
+<xsd:schema
+    xmlns:css="http://openejb.apache.org/xml/ns/corba-css-config-2.1"
+    targetNamespace="http://openejb.apache.org/xml/ns/corba-css-config-2.1"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    version="1.0">
+
+    <xsd:element name="css" type="css:cssType"/>
+
+    <xsd:complexType name="cssType">
+        <xsd:sequence>
+            <xsd:element name="description" type="css:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="compoundSecMechTypeList" minOccurs="0">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="compoundSecMech" type="css:compoundSecMechType" maxOccurs="unbounded"/>
+                    </xsd:sequence>
+                    <xsd:attribute name="stateful" type="xsd:boolean" use="optional" default="false"/>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:complexType name="descriptionType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute ref="xml:lang"/>
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="compoundSecMechType">
+        <xsd:sequence>
+            <xsd:element name="description" type="css:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:group ref="css:transportMechGroup" minOccurs="0"/>
+            <xsd:group ref="css:asMechGroup" minOccurs="0"/>
+            <xsd:element name="sasMech" type="css:sasMechType" minOccurs="0"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:group name="transportMechGroup">
+        <xsd:choice>
+            <xsd:element name="SSL" type="css:SSLType"/>
+            <xsd:element name="SECIOP" type="css:SECIOPType"/>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="SSLType">
+        <xsd:sequence>
+            <xsd:element name="description" type="css:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="supports" type="css:associationOptionList"/>
+            <xsd:element name="requires" type="css:associationOptionList"/>
+            <xsd:group ref="css:trustGroup" minOccurs="0"/>
+        </xsd:sequence>
+        <xsd:attribute name="handshakeTimeout" type="xsd:short"/>
+    </xsd:complexType>
+
+    <xsd:complexType name="SECIOPType">
+        <xsd:sequence>
+            <xsd:element name="description" type="css:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="supports" type="css:associationOptionList"/>
+            <xsd:element name="requires" type="css:associationOptionList"/>
+            <xsd:group ref="css:trustGroup"/>
+        </xsd:sequence>
+        <xsd:attribute name="mechOID" type="xsd:string"/>
+        <xsd:attribute name="targetName" type="xsd:string"/>
+    </xsd:complexType>
+
+    <xsd:group name="trustGroup">
+        <xsd:choice>
+            <xsd:element name="trustEveryone" type="css:trustEveryoneType"/>
+            <xsd:element name="trustNoone" type="css:trustNooneType"/>
+            <xsd:element name="trustList">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="entity" type="css:entityType" maxOccurs="unbounded"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="trustEveryoneType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="trustNooneType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="entityType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="hostname" type="xsd:string" use="optional"/>
+                <xsd:attribute name="distinguishedName" type="xsd:string" use="optional"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:group name="asMechGroup">
+        <xsd:choice>
+            <xsd:element name="GSSUPStatic" type="css:GSSUPStaticType"/>
+            <xsd:element name="GSSUPDynamic" type="css:GSSUPDynamicType"/>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="GSSUPStaticType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="username" type="xsd:string"/>
+                <xsd:attribute name="password" type="xsd:string"/>
+                <xsd:attribute name="domain" type="xsd:string"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="GSSUPDynamicType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="domain" type="xsd:string" use="optional"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="sasMechType">
+        <xsd:sequence>
+            <xsd:element name="description" type="css:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:group ref="css:ittGroup"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:group name="ittGroup">
+        <xsd:choice>
+            <xsd:element name="ITTAbsent" type="css:ITTAbsentType"/>
+            <xsd:element name="ITTAnonymous" type="css:ITTAnonymousType"/>
+            <xsd:element name="ITTPrincipalNameStatic" type="css:ITTPrincipalNameStaticType"/>
+            <xsd:element name="ITTPrincipalNameDynamic" type="css:ITTPrincipalNameDynamicType"/>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="ITTAbsentType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="ITTAnonymousType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="ITTPrincipalNameStaticType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="name" type="xsd:string"/>
+                <xsd:attribute name="oid" type="xsd:string" use="optional"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="ITTPrincipalNameDynamicType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="principal-class" type="xsd:string"/>
+                <xsd:attribute name="domain" type="xsd:string" use="optional"/>
+                <xsd:attribute name="realm" type="xsd:string" use="optional"/>
+                <xsd:attribute name="oid" type="xsd:string" use="optional"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:simpleType name="associationOption">
+        <xsd:restriction base="xsd:token">
+            <xsd:enumeration value="NoProtection"/>
+            <xsd:enumeration value="Integrity"/>
+            <xsd:enumeration value="Confidentiality"/>
+            <xsd:enumeration value="DetectReplay"/>
+            <xsd:enumeration value="DetectMisordering"/>
+            <xsd:enumeration value="EstablishTrustInTarget"/>
+            <xsd:enumeration value="EstablishTrustInClient"/>
+            <xsd:enumeration value="NoDelegation"/>
+            <xsd:enumeration value="SimpleDelegation"/>
+            <xsd:enumeration value="CompositeDelegation"/>
+            <xsd:enumeration value="IdentityAssertion"/>
+            <xsd:enumeration value="DelegationByClient"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <xsd:simpleType name="associationOptionList">
+        <xsd:list itemType="css:associationOption"/>
+    </xsd:simpleType>
+
+</xsd:schema>

Added: geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-tss-config-2.1.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-tss-config-2.1.xsd?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-tss-config-2.1.xsd (added)
+++ geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/corba-tss-config-2.1.xsd Fri Feb  9 11:24:30 2007
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+-->
+
+<xsd:schema
+    xmlns:tss="http://openejb.apache.org/xml/ns/corba-tss-config-2.1"
+    targetNamespace="http://openejb.apache.org/xml/ns/corba-tss-config-2.1"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:security="http://geronimo.apache.org/xml/ns/security-1.2"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    version="1.0">
+
+    <xsd:element name="tss" type="tss:tssType"/>
+
+    <xsd:complexType name="tssType">
+        <xsd:sequence>
+            <xsd:element name="description" type="tss:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="default-principal" type="security:default-principalType" minOccurs="0"/>
+            <xsd:group ref="tss:transportMechGroup" minOccurs="0"/>
+            <xsd:element name="compoundSecMechTypeList" minOccurs="0">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="compoundSecMech" type="tss:compoundSecMechType" maxOccurs="unbounded"/>
+                    </xsd:sequence>
+                    <xsd:attribute name="stateful" type="xsd:boolean" use="optional" default="false"/>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:sequence>
+        <xsd:attribute name="inherit" type="xsd:boolean" use="optional" default="false"/>
+    </xsd:complexType>
+
+    <xsd:complexType name="descriptionType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute ref="xml:lang"/>
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:group name="transportMechGroup">
+        <xsd:choice>
+            <xsd:element name="SSL" type="tss:SSLType"/>
+            <xsd:element name="SECIOP" type="tss:SECIOPType"/>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="SSLType">
+        <xsd:sequence>
+            <xsd:element name="description" type="tss:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="supports" type="tss:associationOptionList"/>
+            <xsd:element name="requires" type="tss:associationOptionList"/>
+            <xsd:group ref="tss:trustGroup" minOccurs="0"/>
+        </xsd:sequence>
+        <xsd:attribute name="port" type="xsd:short" use="required"/>
+        <xsd:attribute name="hostname" type="xsd:string" use="required"/>
+        <xsd:attribute name="handshakeTimeout" type="xsd:short"/>
+    </xsd:complexType>
+
+    <xsd:complexType name="SECIOPType">
+        <xsd:sequence>
+            <xsd:element name="description" type="tss:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="supports" type="tss:associationOptionList"/>
+            <xsd:element name="requires" type="tss:associationOptionList"/>
+            <xsd:element name="transportAddress" type="tss:transportAddressType" maxOccurs="unbounded"/>
+            <xsd:group ref="tss:trustGroup"/>
+        </xsd:sequence>
+        <xsd:attribute name="mechOID" type="xsd:string"/>
+        <xsd:attribute name="targetName" type="xsd:string"/>
+    </xsd:complexType>
+
+    <xsd:group name="trustGroup">
+        <xsd:choice>
+            <xsd:element name="trustEveryone" type="tss:trustEveryoneType"/>
+            <xsd:element name="trustNoone" type="tss:trustNooneType"/>
+            <xsd:element name="trustList">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="entity" type="tss:entityType" maxOccurs="unbounded"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="trustEveryoneType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="trustNooneType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="entityType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="hostname" type="xsd:string" use="optional"/>
+                <xsd:attribute name="distinguishedName" type="xsd:string" use="optional"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="transportAddressType">
+        <xsd:simpleContent>
+            <xsd:extension base="xsd:string">
+                <xsd:attribute name="port" type="xsd:short"/>
+                <xsd:attribute name="hostname" type="xsd:string"/>
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="compoundSecMechType">
+        <xsd:sequence>
+            <xsd:element name="description" type="tss:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:group ref="tss:asMechGroup" minOccurs="0"/>
+            <xsd:element name="sasMech" type="tss:sasMechType" minOccurs="0"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:group name="asMechGroup">
+        <xsd:choice>
+            <xsd:element name="GSSUP" type="tss:GSSUPType"/>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="GSSUPType">
+        <xsd:sequence>
+            <xsd:element name="description" type="tss:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+        </xsd:sequence>
+        <xsd:attribute name="targetName" type="xsd:string"/>
+        <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
+    </xsd:complexType>
+
+    <xsd:complexType name="sasMechType">
+        <xsd:sequence>
+            <xsd:element name="description" type="tss:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="serviceConfigurationList" minOccurs="0">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:group ref="tss:serviceConfigurationGroup" maxOccurs="unbounded"/>
+                    </xsd:sequence>
+                    <xsd:attribute name="required" type="xsd:boolean" use="optional" default="false"/>
+                </xsd:complexType>
+            </xsd:element>
+            <xsd:element name="identityTokenTypes" type="tss:identityTokenTypeList"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:group name="serviceConfigurationGroup">
+        <xsd:choice>
+            <xsd:element name="generalName" type="tss:generalNameType"/>
+            <xsd:element name="gssExportedName" type="tss:gssExportedNameType"/>
+        </xsd:choice>
+    </xsd:group>
+
+    <xsd:complexType name="generalNameType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="privilegeAuthority" type="xsd:string"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="gssExportedNameType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType">
+                <xsd:attribute name="OID" type="xsd:string"/>
+                <xsd:attribute name="privilegeAuthority" type="xsd:string"/>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:simpleType name="associationOption">
+        <xsd:restriction base="xsd:token">
+            <xsd:enumeration value="NoProtection"/>
+            <xsd:enumeration value="Integrity"/>
+            <xsd:enumeration value="Confidentiality"/>
+            <xsd:enumeration value="DetectReplay"/>
+            <xsd:enumeration value="DetectMisordering"/>
+            <xsd:enumeration value="EstablishTrustInTarget"/>
+            <xsd:enumeration value="EstablishTrustInClient"/>
+            <xsd:enumeration value="NoDelegation"/>
+            <xsd:enumeration value="SimpleDelegation"/>
+            <xsd:enumeration value="CompositeDelegation"/>
+            <xsd:enumeration value="IdentityAssertion"/>
+            <xsd:enumeration value="DelegationByClient"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <xsd:simpleType name="associationOptionList">
+        <xsd:list itemType="tss:associationOption"/>
+    </xsd:simpleType>
+
+    <xsd:complexType name="identityTokenTypeList">
+        <xsd:sequence>
+            <xsd:choice>
+                <xsd:element name="ITTAbsent" type="tss:ITTAbsentType"/>
+                <xsd:group ref="tss:ittGroup"/>
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+
+    <xsd:group name="ittGroup">
+        <xsd:sequence>
+            <xsd:element name="ITTAnonymous" type="tss:ITTAnonymousType" minOccurs="0"/>
+            <xsd:element name="ITTPrincipalNameGSSUP" type="tss:ITTPrincipalNameGSSUPType" minOccurs="0"/>
+            <xsd:element name="ITTDistinguishedName" type="tss:ITTDistinguishedNameType" minOccurs="0"/>
+            <xsd:element name="ITTX509CertChain" type="tss:ITTX509CertChainType" minOccurs="0"/>
+        </xsd:sequence>
+    </xsd:group>
+
+    <xsd:complexType name="ITTAbsentType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="ITTAnonymousType">
+        <xsd:complexContent>
+            <xsd:restriction base="xsd:anyType"/>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+    <xsd:complexType name="ITTPrincipalNameGSSUPType">
+        <!--        <xsd:complexContent>-->
+        <!--            <xsd:restriction base="xsd:anyType"/>-->
+        <!--        </xsd:complexContent>-->
+        <xsd:sequence/>
+        <xsd:attribute name="principal-class" type="xsd:string"/>
+        <xsd:attribute name="domain" type="xsd:string" use="optional"/>
+        <xsd:attribute name="realm" type="xsd:string" use="optional"/>
+    </xsd:complexType>
+
+    <xsd:complexType name="ITTDistinguishedNameType">
+<!--        <xsd:complexContent>-->
+<!--            <xsd:restriction base="xsd:anyType"/>-->
+<!--        </xsd:complexContent>-->
+        <xsd:sequence/>
+        <xsd:attribute name="realm"  type="xsd:string" use="optional"/>
+        <xsd:attribute name="domain"  type="xsd:string" use="optional"/>
+    </xsd:complexType>
+
+    <xsd:complexType name="ITTX509CertChainType">
+<!--        <xsd:complexContent>-->
+<!--            <xsd:restriction base="xsd:anyType"/>-->
+<!--        </xsd:complexContent>-->
+        <xsd:sequence/>
+        <xsd:attribute name="realm"  type="xsd:string" use="optional"/>
+        <xsd:attribute name="domain"  type="xsd:string" use="optional"/>
+    </xsd:complexType>
+
+</xsd:schema>

Added: geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/xmlconfig.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/xmlconfig.xml?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/xmlconfig.xml (added)
+++ geronimo/server/trunk/modules/geronimo-corba-builder/src/main/schema/xmlconfig.xml Fri Feb  9 11:24:30 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+-->
+
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
+
+    <xb:namespace uri="http://openejb.apache.org/xml/ns/corba-tss-config-2.1">
+        <xb:package>org.apache.geronimo.corba.xbeans.csiv2.tss</xb:package>
+        <xb:prefix>TSS</xb:prefix>
+    </xb:namespace>
+
+    <xb:namespace uri="http://openejb.apache.org/xml/ns/corba-css-config-2.1">
+        <xb:package>org.apache.geronimo.corba.xbeans.csiv2.css</xb:package>
+        <xb:prefix>CSS</xb:prefix>
+    </xb:namespace>
+
+</xb:config>

Added: geronimo/server/trunk/modules/geronimo-corba-builder/src/test/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditorTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba-builder/src/test/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditorTest.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba-builder/src/test/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditorTest.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba-builder/src/test/java/org/apache/geronimo/corba/security/config/tss/TSSConfigEditorTest.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,94 @@
+/**
+ * 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.corba.security.config.tss;
+
+import junit.framework.TestCase;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+
+import org.apache.geronimo.common.DeploymentException;
+
+
+/**
+ * @version $Revision: 452600 $ $Date: 2006-10-03 12:29:42 -0700 (Tue, 03 Oct 2006) $
+ */
+public class TSSConfigEditorTest extends TestCase {
+    private static final String TEST_XML1 = "<foo:tss xmlns:foo=\"http://openejb.apache.org/xml/ns/corba-tss-config-2.1\">\n" +
+//                                            "                <foo:description>this is a foo</foo:description>" +
+                                            "                <foo:SSL port=\"443\" hostname=\"corba.apache.org\">\n" +
+                                            "                    <foo:supports>Integrity Confidentiality EstablishTrustInTarget EstablishTrustInClient</foo:supports>\n" +
+                                            "                    <foo:requires>Integrity</foo:requires>\n" +
+                                            "                </foo:SSL>\n" +
+                                            "                <foo:compoundSecMechTypeList>\n" +
+                                            "                    <foo:compoundSecMech>\n" +
+                                            "                    </foo:compoundSecMech>\n" +
+                                            "                </foo:compoundSecMechTypeList>\n" +
+                                            "            </foo:tss>";
+    private static final String TEST_XML2 = "<foo:tss inherit=\"true\" xmlns:foo=\"http://openejb.apache.org/xml/ns/corba-tss-config-2.1\"/>";
+    private static final String TEST_XML3 = "<tss xmlns=\"http://openejb.apache.org/xml/ns/corba-tss-config-2.1\">\n" +
+                                            "                <SSL port=\"443\">\n" +
+                                            "                    <supports>BAD_ENUM Integrity Confidentiality EstablishTrustInTarget EstablishTrustInClient</supports>\n" +
+                                            "                    <requires>Integrity</requires>\n" +
+                                            "                </SSL>\n" +
+                                            "                <compoundSecMechTypeList>\n" +
+                                            "                    <compoundSecMech>\n" +
+                                            "                    </compoundSecMech>\n" +
+                                            "                </compoundSecMechTypeList>\n" +
+                                            "            </tss>";
+
+
+    private XmlObject getXmlObject(String xmlString) throws XmlException {
+        XmlObject xmlObject = XmlObject.Factory.parse(xmlString);
+        XmlCursor xmlCursor = xmlObject.newCursor();
+        try {
+            xmlCursor.toFirstChild();
+            return xmlCursor.getObject();
+        } finally {
+            xmlCursor.dispose();
+        }
+    }
+
+    public void testSimple1() throws Exception {
+        XmlObject xmlObject = getXmlObject(TEST_XML1);
+        TSSConfigEditor editor = new TSSConfigEditor();
+        Object o = editor.getValue(xmlObject, null, null);
+        TSSConfig tss = (TSSConfig) o;
+        assertFalse(tss.isInherit());
+        assertNotNull(tss.getTransport_mech());
+    }
+
+    public void testSimple2() throws Exception {
+        XmlObject xmlObject = getXmlObject(TEST_XML2);
+        TSSConfigEditor editor = new TSSConfigEditor();
+        TSSConfig tss = (TSSConfig) editor.getValue(xmlObject, null, null);
+        assertTrue(tss.isInherit());
+        assertNotNull(tss.getTransport_mech());
+        assertTrue(tss.getTransport_mech() instanceof TSSNULLTransportConfig);
+    }
+
+    public void testSimple3() throws Exception {
+        try {
+            XmlObject xmlObject = getXmlObject(TEST_XML3);
+            TSSConfigEditor editor = new TSSConfigEditor();
+            TSSConfig tss = (TSSConfig) editor.getValue(xmlObject, null, null);
+            fail("Should fail");
+        } catch (DeploymentException e) {
+        }
+
+    }
+}

Copied: geronimo/server/trunk/modules/geronimo-corba/pom.xml (from r505429, incubator/openejb/trunk/openejb2/modules/openejb-corba/pom.xml)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/pom.xml?view=diff&rev=505432&p1=incubator/openejb/trunk/openejb2/modules/openejb-corba/pom.xml&r1=505429&p2=geronimo/server/trunk/modules/geronimo-corba/pom.xml&r2=505432
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-corba/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-corba/pom.xml Fri Feb  9 11:24:30 2007
@@ -21,61 +21,61 @@
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.apache.openejb</groupId>
+        <groupId>org.apache.geronimo.modules</groupId>
         <artifactId>modules</artifactId>
-        <version>2.3-incubating-SNAPSHOT</version>
+        <version>2.0-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <name>OpenEJB :: CORBA</name>
-    <artifactId>openejb-corba</artifactId>
-    <description>OpenEJB Base Corba integration</description>
-    <url>http://www.openejb.org</url>
+    <name>Geronimo :: CORBA</name>
+    <artifactId>geronimo-corba</artifactId>
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>openejb-core</artifactId>
-            <version>${pom.version}</version>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-openejb</artifactId>
+            <version>${version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-management</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-security</artifactId>
+            <version>${version}</version>
+        </dependency>
 
-      <dependency>
-          <groupId>org.apache.geronimo.modules</groupId>
-          <artifactId>geronimo-management</artifactId>
-      </dependency>
-
-      <dependency>
-          <groupId>org.apache.geronimo.modules</groupId>
-          <artifactId>geronimo-kernel</artifactId>
-      </dependency>
-
-      <dependency>
-          <groupId>org.apache.geronimo.modules</groupId>
-          <artifactId>geronimo-security</artifactId>
-      </dependency>
-
-      <dependency>
-          <groupId>org.apache.geronimo.modules</groupId>
-          <artifactId>geronimo-timer</artifactId>
-      </dependency>
-
-      <dependency>
-          <groupId>org.apache.geronimo.modules</groupId>
-          <artifactId>geronimo-transaction</artifactId>
-      </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-timer</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-transaction</artifactId>
+            <version>${version}</version>
+        </dependency>
+ 
+        <dependency>
+            <groupId>org.apache.yoko</groupId>
+            <artifactId>yoko-spec-corba</artifactId>
+        </dependency>
 
     </dependencies>
 
     <build>
         <plugins>
-            <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.4</source>
-                    <target>1.4</target>
-                </configuration>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>

Added: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/Adapter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/Adapter.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/Adapter.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/Adapter.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,145 @@
+/**
+ * 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.corba;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.CosNaming.NamingContextHelper;
+import org.omg.CosNaming.NamingContextPackage.NotEmpty;
+import org.omg.CosNaming.NamingContextPackage.NotFound;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.apache.geronimo.corba.transaction.ServerTransactionPolicyFactory;
+import org.apache.openejb.InterfaceType;
+import org.apache.geronimo.openejb.EjbDeployment;
+
+/**
+ * @version $Revision: 497125 $ $Date: 2007-01-17 10:51:30 -0800 (Wed, 17 Jan 2007) $
+ */
+public abstract class Adapter implements RefGenerator {
+    private final EjbDeployment deployment;
+    protected final POA homePOA;
+    protected final ORB orb;
+    private final NamingContextExt initialContext;
+    private final byte[] home_id;
+    private final org.omg.CORBA.Object homeReference;
+
+    protected Adapter(TSSLink tssLink, ORB orb, POA parentPOA, Policy securityPolicy) throws CORBAException {
+        this.deployment = tssLink.getDeployment();
+        this.home_id = tssLink.getContainerId().getBytes();
+        this.orb = orb;
+
+        Any any = orb.create_any();
+        any.insert_Value(tssLink.getHomeTxPolicyConfig());
+
+        try {
+            Policy[] policies = new Policy[]{
+                securityPolicy,
+                orb.create_policy(ServerTransactionPolicyFactory.POLICY_TYPE, any),
+//                parentPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT),
+                parentPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY),
+                parentPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN),
+                parentPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID),
+                parentPOA.create_implicit_activation_policy(ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION),
+            };
+            // make sure we create this with the appropriate ORB-specific policies. 
+            policies = tssLink.addPolicyOverrides(policies);
+            homePOA = parentPOA.create_POA(tssLink.getContainerId(), parentPOA.the_POAManager(), policies);
+
+            homePOA.the_POAManager().activate();
+
+            StandardServant servant = new StandardServant(orb, InterfaceType.EJB_HOME, deployment);
+
+            homePOA.activate_object_with_id(home_id, servant);
+            homeReference = homePOA.servant_to_reference(servant);
+
+            org.omg.CORBA.Object obj = orb.resolve_initial_references("NameService");
+            initialContext = NamingContextExtHelper.narrow(obj);
+            String[] names = tssLink.getJndiNames();
+            for (int i = 0; i < names.length; i++) {
+                NameComponent[] nameComponent = initialContext.to_name(names[i]);
+                NamingContext currentContext = initialContext;
+                NameComponent[] nc = new NameComponent[1];
+                int lastComponent = nameComponent.length - 1;
+                for (int j = 0; j < lastComponent; ++j) {
+                    nc[0] = nameComponent[j];
+                    try {
+                        currentContext = NamingContextHelper.narrow(currentContext.resolve(nc));
+                    } catch (NotFound nf) {
+                        currentContext = currentContext.bind_new_context(nc);
+                    }
+                }
+                nc[0] = nameComponent[lastComponent];
+                currentContext.rebind(nc, homeReference);
+            }
+        } catch (Exception e) {
+            throw new CORBAException(e);
+        }
+
+    }
+
+    public EjbDeployment getDeployment() {
+        return deployment;
+    }
+
+    public NamingContextExt getInitialContext() {
+        return initialContext;
+    }
+
+    public org.omg.CORBA.Object getHomeReference() {
+        return homeReference;
+    }
+
+    public ORB getOrb() {
+        return orb;
+    }
+
+    public void stop() throws CORBAException {
+        try {
+            NameComponent[] nameComponent = initialContext.to_name(deployment.getDeploymentId());
+            initialContext.unbind(nameComponent);
+
+            for (int j = nameComponent.length - 1; 0 < j; --j) {
+                NameComponent[] nc = new NameComponent[j];
+                System.arraycopy(nameComponent, 0, nc, 0, j);
+                NamingContext currentContext = NamingContextHelper.narrow(initialContext.resolve(nc));
+                try {
+                    currentContext.destroy();
+                } catch (NotEmpty ne) {
+                    break;
+                }
+            }
+
+            homePOA.deactivate_object(home_id);
+            homePOA.destroy(true, true);
+        } catch (Exception e) {
+            throw new CORBAException(e);
+        }
+    }
+
+    public org.omg.CORBA.Object genHomeReference() throws CORBAException {
+        return this.getHomeReference();
+    }
+}

Added: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterDelegate.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterDelegate.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterDelegate.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,42 @@
+/**
+ * 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.corba;
+
+import java.rmi.Remote;
+
+
+/**
+ * @version $Revision: 465108 $ $Date: 2006-10-17 17:23:40 -0700 (Tue, 17 Oct 2006) $
+ */
+public class AdapterDelegate {
+
+    private final Remote delegate;
+    private final ClassLoader classLoader;
+
+    public AdapterDelegate(Remote delegate, ClassLoader classLoader) {
+        this.delegate = delegate;
+        this.classLoader = classLoader;
+    }
+
+    final public Remote getDelegate() {
+        return delegate;
+    }
+
+    final public ClassLoader getClassLoader() {
+        return classLoader;
+    }
+}

Added: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterEntity.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterEntity.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterEntity.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterEntity.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,141 @@
+/**
+ * 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.corba;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.ServantLocator;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.apache.geronimo.corba.transaction.ServerTransactionPolicyFactory;
+import org.apache.openejb.InterfaceType;
+import org.apache.geronimo.openejb.EjbDeployment;
+
+
+/**
+ * @version $Revision: 497125 $ $Date: 2007-01-17 10:51:30 -0800 (Wed, 17 Jan 2007) $
+ */
+public final class AdapterEntity extends Adapter {
+    private final Log log = LogFactory.getLog(AdapterEntity.class);
+
+    private final POA poa;
+    private final String referenceInterface;
+    private String deploymentId;
+
+    public AdapterEntity(TSSLink tssLink, ORB orb, POA parentPOA, Policy securityPolicy) throws CORBAException {
+        super(tssLink, orb, parentPOA, securityPolicy);
+
+        deploymentId = tssLink.getContainerId();
+
+        Any any = orb.create_any();
+        any.insert_Value(tssLink.getRemoteTxPolicyConfig());
+
+        try {
+            Policy[] policies = new Policy[]{
+                securityPolicy,
+                orb.create_policy(ServerTransactionPolicyFactory.POLICY_TYPE, any),
+//                homePOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT),
+                homePOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_SERVANT_MANAGER),
+                homePOA.create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN),
+                homePOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID),
+                homePOA.create_implicit_activation_policy(ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION),
+            };
+
+            // make sure we create this with the appropriate ORB-specific policies. 
+            policies = tssLink.addPolicyOverrides(policies);
+
+            poa = homePOA.create_POA(tssLink.getContainerId(), homePOA.the_POAManager(), policies);
+            poa.set_servant_manager(new ObjectActivator());
+
+            poa.the_POAManager().activate();
+
+            StandardServant servant = new StandardServant(orb, InterfaceType.EJB_OBJECT, tssLink.getDeployment());
+            referenceInterface = servant._all_interfaces(null, null)[0];
+        } catch (Exception e) {
+            throw new CORBAException(e);
+        }
+    }
+
+    public POA getPOA() {
+        return poa;
+    }
+
+    public void stop() throws CORBAException {
+        poa.destroy(true, true);
+        super.stop();
+    }
+
+    public org.omg.CORBA.Object genObjectReference(Object primaryKey) throws CORBAException {
+
+        byte[] bytes;
+        try {
+            ByteArrayOutputStream b = new ByteArrayOutputStream();
+            ObjectOutputStream os = new ObjectOutputStream(b);
+
+            os.writeObject(primaryKey);
+            bytes = b.toByteArray();
+
+            os.close();
+        } catch (IOException e) {
+            log.error("Could not serialize deployment info for " + deploymentId, e);
+            throw new CORBAException(e);
+        }
+        return poa.create_reference_with_id(bytes, referenceInterface);
+    }
+
+    protected class ObjectActivator extends LocalObject implements ServantLocator {
+
+        public Servant preinvoke(byte[] oid, POA poa, String operation, CookieHolder cookie) {
+            // the byte array can be cached in a weak hash map for performance
+            Object pk = null;
+
+            try {
+                ObjectInputStream is = new ObjectInputStream(new ByteArrayInputStream(oid));
+                pk = is.readObject();
+                is.close();
+
+                EjbDeployment deployment = getDeployment();
+                return new StandardServant(getOrb(), InterfaceType.EJB_OBJECT, deployment, pk);
+            } catch (IOException e) {
+                // if we can't deserialize, then this object can't exist in this process
+                throw new OBJECT_NOT_EXIST(0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
+            } catch (Exception e) {
+                log.error("Exception during dispatch to method " + operation + " in bean " + pk, e);
+                return null;
+            }
+        }
+
+        public void postinvoke(byte[] oid, POA poa, String operation, Object cookie, Servant servant) {
+        }
+    }
+}

Added: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterProxyFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterProxyFactory.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterProxyFactory.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterProxyFactory.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,144 @@
+/**
+ * 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.corba;
+
+import java.lang.reflect.Method;
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+
+import net.sf.cglib.proxy.Callback;
+import net.sf.cglib.proxy.CallbackFilter;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+import net.sf.cglib.proxy.NoOp;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.UNKNOWN;
+
+
+/**
+ * @version $Revision: 465108 $ $Date: 2006-10-17 17:23:40 -0700 (Tue, 17 Oct 2006) $
+ */
+public class AdapterProxyFactory {
+
+    private final static Log log = LogFactory.getLog(AdapterProxyFactory.class);
+    private final static AdapterMethodInterceptor interceptor = new AdapterMethodInterceptor();
+    private final Enhancer enhancer;
+
+    public AdapterProxyFactory(Class clientInterface) {
+        this(clientInterface, clientInterface.getClassLoader());
+    }
+
+    public AdapterProxyFactory(Class clientInterface, ClassLoader classLoader) {
+        this(new Class[]{clientInterface}, classLoader);
+    }
+
+
+    public AdapterProxyFactory(Class[] clientInterfaces, ClassLoader classLoader) {
+        assert clientInterfaces != null;
+        assert areAllInterfaces(clientInterfaces);
+
+        enhancer = new Enhancer();
+        enhancer.setClassLoader(classLoader);
+        enhancer.setSuperclass(AdapterDelegate.class);
+        enhancer.setInterfaces(clientInterfaces);
+        enhancer.setCallbackTypes(new Class[]{NoOp.class, MethodInterceptor.class});
+        enhancer.setCallbackFilter(FILTER);
+        enhancer.setUseFactory(false);
+    }
+
+    private static boolean areAllInterfaces(Class[] clientInterfaces) {
+        for (int i = 0; i < clientInterfaces.length; i++) {
+            if (clientInterfaces[i] == null || !clientInterfaces[i].isInterface()) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public Object create(Remote delegate, ClassLoader classLoader) {
+        return create(new Class[]{Remote.class, ClassLoader.class}, new Object[]{delegate, classLoader});
+    }
+
+    public synchronized Object create(Class[] types, Object[] arguments) {
+        enhancer.setCallbacks(new Callback[]{NoOp.INSTANCE, interceptor});
+        return enhancer.create(types, arguments);
+    }
+
+    private final static class AdapterMethodInterceptor implements MethodInterceptor {
+
+        public final Object intercept(Object o, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
+            ClassLoader savedCL = Thread.currentThread().getContextClassLoader();
+            try {
+                AdapterDelegate delegate = (AdapterDelegate) o;
+                Thread.currentThread().setContextClassLoader(delegate.getClassLoader());
+
+                if (log.isDebugEnabled()) log.debug("Calling " + method.getName());
+
+                return methodProxy.invoke(delegate.getDelegate(), args);
+            } catch (TransactionRolledbackException e) {
+                log.debug("TransactionRolledbackException", e);
+                throw new TRANSACTION_ROLLEDBACK(e.toString());
+            } catch (TransactionRequiredException e) {
+                log.debug("TransactionRequiredException", e);
+                throw new TRANSACTION_REQUIRED(e.toString());
+            } catch (InvalidTransactionException e) {
+                log.debug("InvalidTransactionException", e);
+                throw new INVALID_TRANSACTION(e.toString());
+            } catch (NoSuchObjectException e) {
+                log.debug("NoSuchObjectException", e);
+                throw new OBJECT_NOT_EXIST(e.toString());
+            } catch (AccessException e) {
+                log.debug("AccessException", e);
+                throw new NO_PERMISSION(e.toString());
+            } catch (MarshalException e) {
+                log.debug("MarshalException", e);
+                throw new MARSHAL(e.toString());
+            } catch (RemoteException e) {
+                log.debug("RemoteException", e);
+                throw new UNKNOWN(e.toString());
+            } finally {
+                Thread.currentThread().setContextClassLoader(savedCL);
+            }
+        }
+    }
+
+    private static final CallbackFilter FILTER = new CallbackFilter() {
+        public int accept(Method method) {
+            if (method.getName().equals("finalize") &&
+                method.getParameterTypes().length == 0 &&
+                method.getReturnType() == Void.TYPE) {
+                return 0;
+            }
+            return 1;
+        }
+    };
+}
+

Added: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateful.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateful.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateful.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateful.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,139 @@
+/**
+ * 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.corba;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.omg.PortableServer.LifespanPolicyValue;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.ServantLocator;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.apache.openejb.InterfaceType;
+import org.apache.geronimo.corba.transaction.ServerTransactionPolicyFactory;
+import org.apache.geronimo.openejb.EjbDeployment;
+
+/**
+ * @version $Revision: 497125 $ $Date: 2007-01-17 10:51:30 -0800 (Wed, 17 Jan 2007) $
+ */
+public class AdapterStateful extends Adapter {
+    private final Log log = LogFactory.getLog(AdapterStateful.class);
+
+    private final POA poa;
+    private final String referenceInterface;
+    private String deploymentId;
+
+    public AdapterStateful(TSSLink tssLink, ORB orb, POA parentPOA, Policy securityPolicy) throws CORBAException {
+        super(tssLink, orb, parentPOA, securityPolicy);
+
+        deploymentId = tssLink.getContainerId();
+
+        Any any = orb.create_any();
+        any.insert_Value(tssLink.getRemoteTxPolicyConfig());
+
+        try {
+            Policy[] policies = new Policy[]{
+                securityPolicy,
+                orb.create_policy(ServerTransactionPolicyFactory.POLICY_TYPE, any),
+                homePOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT),
+                homePOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_SERVANT_MANAGER),
+                homePOA.create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN),
+                homePOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID),
+                homePOA.create_implicit_activation_policy(ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION),
+            };
+            // make sure we create this with the appropriate ORB-specific policies. 
+            policies = tssLink.addPolicyOverrides(policies);
+            poa = homePOA.create_POA(tssLink.getContainerId(), homePOA.the_POAManager(), policies);
+            poa.set_servant_manager(new ObjectActivator());
+
+            poa.the_POAManager().activate();
+
+            StandardServant servant = new StandardServant(orb, InterfaceType.EJB_OBJECT, tssLink.getDeployment());
+            referenceInterface = servant._all_interfaces(null, null)[0];
+        } catch (Exception e) {
+            throw new CORBAException(e);
+        }
+    }
+
+    public POA getPOA() {
+        return poa;
+    }
+
+    public void stop() throws CORBAException {
+        poa.destroy(true, true);
+        super.stop();
+    }
+
+    public org.omg.CORBA.Object genObjectReference(Object primaryKey) throws CORBAException {
+
+        byte[] bytes;
+        try {
+            ByteArrayOutputStream b = new ByteArrayOutputStream();
+            ObjectOutputStream os = new ObjectOutputStream(b);
+
+            os.writeObject(primaryKey);
+            bytes = b.toByteArray();
+
+            os.close();
+        } catch (IOException e) {
+            log.error("Could not serialize deployment info for " + deploymentId, e);
+            throw new CORBAException(e);
+        }
+        return poa.create_reference_with_id(bytes, referenceInterface);
+    }
+
+    protected class ObjectActivator extends LocalObject implements ServantLocator {
+
+        public Servant preinvoke(byte[] oid, POA poa, String operation, CookieHolder cookie) {
+            // the byte array can be cached in a weak hash map for performance
+            Object pk = null;
+
+            try {
+                ObjectInputStream is = new ObjectInputStream(new ByteArrayInputStream(oid));
+                pk = is.readObject();
+                is.close();
+
+                EjbDeployment deployment = getDeployment();
+                return new StandardServant(getOrb(), InterfaceType.EJB_OBJECT, deployment, pk);
+            } catch (IOException e) {
+                // if we can't deserialize, then this object can't exist in this process
+                throw new OBJECT_NOT_EXIST(0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
+            } catch (Exception e) {
+                log.error("Exception during dispatch to method " + operation + " in bean " + pk, e);
+                return null;
+            }
+        }
+
+        public void postinvoke(byte[] oid, POA poa, String operation, Object cookie, Servant servant) {
+        }
+    }
+}

Added: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateless.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateless.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateless.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterStateless.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,86 @@
+/**
+ * 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.corba;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAPackage.ObjectNotActive;
+import org.omg.PortableServer.POAPackage.WrongPolicy;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.apache.openejb.InterfaceType;
+import org.apache.geronimo.corba.transaction.ServerTransactionPolicyFactory;
+
+/**
+ * @version $Revision: 497125 $ $Date: 2007-01-17 10:51:30 -0800 (Wed, 17 Jan 2007) $
+ */
+public final class AdapterStateless extends Adapter {
+    private final POA poa;
+    private final byte[] object_id;
+    private final org.omg.CORBA.Object objectReference;
+
+    public AdapterStateless(TSSLink tssLink, ORB orb, POA parentPOA, Policy securityPolicy) throws CORBAException {
+        super(tssLink, orb, parentPOA, securityPolicy);
+        Any any = orb.create_any();
+        any.insert_Value(tssLink.getRemoteTxPolicyConfig());
+
+        try {
+            Policy[] policies = new Policy[]{
+                securityPolicy,
+                orb.create_policy(ServerTransactionPolicyFactory.POLICY_TYPE, any),
+//                homePOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT),
+                homePOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY),
+                homePOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN),
+                homePOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID),
+                homePOA.create_implicit_activation_policy(ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION),
+            };
+            // make sure we create this with the appropriate ORB-specific policies. 
+            policies = tssLink.addPolicyOverrides(policies); 
+            poa = homePOA.create_POA(tssLink.getContainerId(), homePOA.the_POAManager(), policies);
+
+            poa.the_POAManager().activate();
+
+            StandardServant servant = new StandardServant(orb, InterfaceType.EJB_OBJECT, tssLink.getDeployment());
+
+            poa.activate_object_with_id(object_id = tssLink.getContainerId().getBytes(), servant);
+            objectReference = poa.servant_to_reference(servant);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new CORBAException(e);
+        }
+    }
+
+    public void stop() throws CORBAException {
+        try {
+            poa.deactivate_object(object_id);
+            poa.destroy(true, true);
+            super.stop();
+        } catch (ObjectNotActive e) {
+            throw new CORBAException(e);
+        } catch (WrongPolicy e) {
+            throw new CORBAException(e);
+        }
+    }
+
+    public org.omg.CORBA.Object genObjectReference(Object primaryKey) {
+        return objectReference;
+    }
+}

Added: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterWrapper.java?view=auto&rev=505432
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterWrapper.java (added)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/AdapterWrapper.java Fri Feb  9 11:24:30 2007
@@ -0,0 +1,67 @@
+/**
+ * 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.corba;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
+import org.omg.PortableServer.POA;
+import org.apache.openejb.ContainerType;
+
+/**
+ * @version $Revision: 477657 $ $Date: 2006-11-21 04:54:49 -0800 (Tue, 21 Nov 2006) $
+ */
+public final class AdapterWrapper {
+    private final static Map adapters = new HashMap();
+    private final TSSLink tssLink;
+    private Adapter generator;
+
+    public AdapterWrapper(TSSLink tssLink) {
+        this.tssLink = tssLink;
+
+    }
+
+    public void start(ORB orb, POA poa, Policy securityPolicy) throws CORBAException {
+        ContainerType containerType = tssLink.getDeployment().getContainer().getContainerType();
+        switch (containerType) {
+            case STATELESS:
+                generator = new AdapterStateless(tssLink, orb, poa, securityPolicy);
+                break;
+            case STATEFUL:
+                generator = new AdapterStateful(tssLink, orb, poa, securityPolicy);
+                break;
+            case BMP_ENTITY:
+            case CMP_ENTITY:
+                generator = new AdapterEntity(tssLink, orb, poa, securityPolicy);
+                break;
+            default:
+                throw new CORBAException("CORBA Adapter does not handle MDB containers");
+        }
+        adapters.put(tssLink.getContainerId(), generator);
+    }
+
+    public void stop() throws CORBAException {
+        generator.stop();
+        adapters.remove(tssLink.getContainerId());
+    }
+
+    public static RefGenerator getRefGenerator(String containerId) {
+        return (RefGenerator) adapters.get(containerId);
+    }
+}



Mime
View raw message