Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/PortableStubCompilerTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/PortableStubCompilerTest.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/PortableStubCompilerTest.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/PortableStubCompilerTest.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,99 @@ +/** + * 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.compiler; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import junit.framework.TestCase; +import org.apache.geronimo.corba.util.Util; + +/** + * @version $Rev: 451647 $ $Date: 2006-09-30 12:33:02 -0700 (Sat, 30 Sep 2006) $ + */ +public class PortableStubCompilerTest extends TestCase { + + public void testBeanPropertiesNameMangler() throws Exception { + assertMangling("beanPropertiesNameMangler.properties", BeanProperties.class); + } + + public void testBasicNameMangler() throws Exception { + assertMangling("nameMangler.properties", Foo.class); + } + + public void testSpecialNameMangler() throws Exception { + assertMangling("specialNameMangler.properties", Special.class); + } + + private void assertMangling(String propertiesFile, Class intf) throws IOException { + Properties nameManglerProperties = new Properties(); + InputStream in = this.getClass().getClassLoader().getResourceAsStream(propertiesFile); + if (in == null) { + fail("couldn't find resource: " + propertiesFile); + } + nameManglerProperties.load(in); + + boolean failed = false; + Set methodSignatures = new HashSet(); + Map methodToOperation = Util.mapMethodToOperation(intf); + for (Iterator iterator = methodToOperation.entrySet().iterator(); iterator.hasNext();) { + Map.Entry entry = (Map.Entry) iterator.next(); + Method method = (Method) entry.getKey(); + String operation = (String) entry.getValue(); + String methodSignature = method.getName() + "("; + + Class[] parameterTypes = method.getParameterTypes(); + for (int j = 0; j < parameterTypes.length; j++) { + Class parameterType = parameterTypes[j]; + String arrayBrackets = ""; + while (parameterType.isArray()) { + arrayBrackets += "[]"; + parameterType = parameterType.getComponentType(); + } + methodSignature += parameterType.getName() + arrayBrackets; + } + methodSignature += ")"; + methodSignatures.add(methodSignature); + + String expected = nameManglerProperties.getProperty(methodSignature); + if (expected == null || !expected.equals(operation)) { + System.out.println("Expected: " + expected); + System.out.println(" Actual: " + operation); + System.out.println(); + failed = true; + } + } + + if (!nameManglerProperties.keySet().equals(methodSignatures)) { + Set extraProperties = new HashSet(nameManglerProperties.keySet()); + extraProperties.removeAll(methodSignatures); + Set missingProperties = new HashSet(methodSignatures); + missingProperties.removeAll(nameManglerProperties.keySet()); + fail("extraProperties=" + extraProperties + ", missingProperties=" + missingProperties); + } + + if (failed) { + fail(); + } + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Simple.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Simple.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Simple.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Simple.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,55 @@ +/** + * 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.compiler; + +import java.math.BigDecimal; +import java.rmi.Remote; +import java.rmi.RemoteException; + +import org.apache.geronimo.corba.compiler.other.BlahEx; +import org.apache.geronimo.corba.compiler.other.CheeseIDLEntity; +import org.apache.geronimo.corba.compiler.other.Donkey; +import org.apache.geronimo.corba.compiler.other.DonkeyEx; +import org.apache.geronimo.corba.compiler.other.Generic$Interface; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public interface Simple extends Remote, Special { + public void invoke(boolean x0, + char x1, + byte x2, + int x3, + long x4, + float x5, + double x6, + BigDecimal x7, + Class x8, + org.omg.CORBA.Object x9, + org.omg.CORBA.Any x10, + org.omg.CORBA.TypeCode x11, + CheeseIDLEntity x12, + Generic$Interface x13, + BlahEx x14, + BooException x15) throws RemoteException, RemoteException, BlahEx, BooException, DonkeyEx, Donkey; + + public int invokeInt() throws RemoteException; + public String invokeString() throws RemoteException; + public Generic$Interface invokeGeneric$Interface() throws RemoteException; + public Foo invokeFoo() throws RemoteException; + +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Special.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Special.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Special.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/Special.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,110 @@ +/** + * 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.compiler; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +import org.apache.geronimo.corba.compiler.other.Generic$Interface; +import org.apache.geronimo.corba.compiler.other._Something; +import org.apache.geronimo.corba.compiler.other.inout; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public interface Special extends Remote { + // J_underscore + public void _underscore() throws RemoteException; + + public void _underscoreOverload() throws RemoteException; + public void _underscoreOverload(_Something x) throws RemoteException; + public void _underscoreOverload(_Something[] x) throws RemoteException; + + // special characters + public void dollar$() throws RemoteException; + public void $dollar() throws RemoteException; + + // this doesn't work in rmic either although the spec says it's legal +// public void unicode_¿Ï´¹Œ§Ä½µ() throws RemoteException; + + // innerclass + public void innerClass(Generic$Interface.Generic$InnerClass x, int y) throws RemoteException; + public void innerClass(Generic$Interface.Generic$InnerClass x[], int y) throws RemoteException; + + // class collision + public void special() throws RemoteException; + + // difer by case only + public void differByCase() throws RemoteException; + public void differByCASE() throws RemoteException; + public void differByCaseOverload() throws RemoteException; + public void differByCASEOverload() throws RemoteException; + public void differByCASEOverload(int x) throws RemoteException; + + // keywords + public void keyword() throws RemoteException; + public void keyword(inout x) throws RemoteException; + public void ABSTRACT() throws RemoteException; + public void ABSTRACT(int x) throws RemoteException; + + public void any() throws RemoteException; + public void attribute() throws RemoteException; + public void BOOLEAN() throws RemoteException; + public void CASE() throws RemoteException; + public void CHAR() throws RemoteException; + public void CONST() throws RemoteException; + public void context() throws RemoteException; + public void custom() throws RemoteException; + public void DEFAULT() throws RemoteException; + public void DOUBLE() throws RemoteException; +// public void enum() throws RemoteException; + public void exception() throws RemoteException; + public void factory() throws RemoteException; + public void FALSE() throws RemoteException; + public void fixed() throws RemoteException; + public void FLOAT() throws RemoteException; + public void in() throws RemoteException; + public void inout() throws RemoteException; + public void INTERFACE() throws RemoteException; + public void LONG() throws RemoteException; + public void module() throws RemoteException; + public void NATIVE() throws RemoteException; + public void OBJECT() throws RemoteException; + public void octet() throws RemoteException; + public void oneway() throws RemoteException; + public void out() throws RemoteException; + public void PRIVATE() throws RemoteException; + public void PUBLIC() throws RemoteException; + public void raises() throws RemoteException; + public void readonly() throws RemoteException; + public void sequence() throws RemoteException; + public void SHORT() throws RemoteException; + public void string() throws RemoteException; + public void struct() throws RemoteException; + public void supports() throws RemoteException; + public void SWITCH() throws RemoteException; + public void TRUE() throws RemoteException; + public void truncatable() throws RemoteException; + public void typedef() throws RemoteException; + public void union() throws RemoteException; + public void unsigned() throws RemoteException; + public void ValueBase() throws RemoteException; + public void valuetype() throws RemoteException; + public void VOID() throws RemoteException; + public void wchar() throws RemoteException; + public void wstring() throws RemoteException; +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/BlahEx.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/BlahEx.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/BlahEx.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/BlahEx.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,37 @@ +/** + * 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.compiler.other; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public class BlahEx extends Exception { + public BlahEx() { + } + + public BlahEx(String message) { + super(message); + } + + public BlahEx(String message, Throwable cause) { + super(message, cause); + } + + public BlahEx(Throwable cause) { + super(cause); + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/CheeseIDLEntity.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/CheeseIDLEntity.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/CheeseIDLEntity.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/CheeseIDLEntity.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,33 @@ +/** + * 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.compiler.other; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public class CheeseIDLEntity implements IDLEntity { + public short cheese = (short) 0; + + public CheeseIDLEntity() { + } + + public CheeseIDLEntity(short cheese) { + this.cheese = cheese; + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Donkey.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Donkey.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Donkey.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Donkey.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,37 @@ +/** + * 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.compiler.other; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public class Donkey extends Exception { + public Donkey() { + } + + public Donkey(String message) { + super(message); + } + + public Donkey(String message, Throwable cause) { + super(message, cause); + } + + public Donkey(Throwable cause) { + super(cause); + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/DonkeyEx.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/DonkeyEx.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/DonkeyEx.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/DonkeyEx.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,37 @@ +/** + * 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.compiler.other; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public class DonkeyEx extends Exception { + public DonkeyEx() { + } + + public DonkeyEx(String message) { + super(message); + } + + public DonkeyEx(String message, Throwable cause) { + super(message, cause); + } + + public DonkeyEx(Throwable cause) { + super(cause); + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Generic$Interface.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Generic%24Interface.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Generic$Interface.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/Generic$Interface.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,28 @@ +/** + * 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.compiler.other; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public interface Generic$Interface { + public void stuff(); + + public interface Generic$InnerClass { + public void stuff(); + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/_Something.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/_Something.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/_Something.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/_Something.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,23 @@ +/** + * 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.compiler.other; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public interface _Something { +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/inout.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/inout.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/inout.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/compiler/other/inout.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,23 @@ +/** + * 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.compiler.other; + +/** + * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public interface inout { +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/security/config/tss/ToStringTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/security/config/tss/ToStringTest.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/security/config/tss/ToStringTest.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/security/config/tss/ToStringTest.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,45 @@ +/* + * 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; + +/** + * @version $Rev: 503274 $ $Date: 2007-02-03 10:19:18 -0800 (Sat, 03 Feb 2007) $ + */ +public class ToStringTest extends TestCase { + + public void testToString() throws Exception { + TSSConfig t = new TSSConfig(); + String s = t.toString(); + t.setTransport_mech(new TSSSECIOPTransportConfig()); + t.toString(); + t.setTransport_mech(new TSSSSLTransportConfig()); + t.toString(); + TSSCompoundSecMechConfig tssCompoundSecMechConfig = new TSSCompoundSecMechConfig(); + t.getMechListConfig().add(tssCompoundSecMechConfig); + t.toString(); + tssCompoundSecMechConfig.setAs_mech(new TSSGSSUPMechConfig()); + tssCompoundSecMechConfig.setSas_mech(new TSSSASMechConfig()); + tssCompoundSecMechConfig.setTransport_mech(new TSSSSLTransportConfig()); + t.toString(); + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/DynamicStubClassLoaderTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/DynamicStubClassLoaderTest.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/DynamicStubClassLoaderTest.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/DynamicStubClassLoaderTest.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,64 @@ +/** + * 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.util; + +import java.util.Arrays; +import java.util.List; +import javax.rmi.CORBA.Stub; + +import junit.framework.TestCase; + +/** + * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $ + */ +public class DynamicStubClassLoaderTest extends TestCase { + public void testGeneration() throws Exception { + DynamicStubClassLoader dynamicStubClassLoader = new DynamicStubClassLoader(); + dynamicStubClassLoader.doStart(); + Class c = dynamicStubClassLoader.loadClass("org.omg.stub.org.apache.geronimo.corba.compiler._Simple_Stub"); + verifyStub(c); + verifyStub(c); + verifyStub(c); + verifyStub(c); + + } + + private void verifyStub(final Class c) throws Exception { + final Exception[] exception = new Exception[1]; + Runnable verify = new Runnable() { + public void run() { + try { + Stub stub = (Stub) c.newInstance(); + String[] strings = stub._ids(); + assertNotNull(strings); + assertEquals(2, strings.length); + List ids = Arrays.asList(strings); + assertTrue(ids.contains("RMI:org.apache.geronimo.corba.compiler.Simple:0000000000000000")); + assertTrue(ids.contains("RMI:org.apache.geronimo.corba.compiler.Special:0000000000000000")); + } catch (Exception e) { + exception[0] = e; + } + } + }; + Thread thread = new Thread(verify); + thread.start(); + thread.join(); + if (exception[0] != null) { + throw exception[0]; + } + } +} Added: geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/NameDescopingTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/NameDescopingTest.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/NameDescopingTest.java (added) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/java/org/apache/geronimo/corba/util/NameDescopingTest.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,73 @@ +/* + * 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.util; + +import java.io.UnsupportedEncodingException; + +import org.apache.geronimo.corba.util.Util; +import junit.framework.TestCase; + +/** + * @version $Rev: 503493 $ $Date: 2007-02-04 13:47:55 -0800 (Sun, 04 Feb 2007) $ + */ +public class NameDescopingTest extends TestCase { + + public void testDomainRemoval() throws Exception { + String scopedName = "username@domain"; + String expected = "username"; + test(scopedName, expected); + } + public void testAt() throws Exception { + String scopedName = "user\\\\name@domain"; + String expected = "user\\name"; + test(scopedName, expected); + } + public void testBackslash() throws Exception { + String scopedName = "user\\@name@domain"; + String expected = "user@name"; + test(scopedName, expected); + } + public void testNoDomainRemoval() throws Exception { + String scopedName = "username"; + String expected = "username"; + test(scopedName, expected); + } + public void testNoUsername() throws Exception { + String scopedName = "@domain"; + String expected = ""; + test(scopedName, expected); + } + + private void test(String scopedName, String expected) throws UnsupportedEncodingException { + String user = Util.extractUserNameFromScopedName(scopedName.getBytes()); + assertEquals(expected, user); + } + + public void testBuildScoped() throws Exception { + assertEquals("username@domain", Util.buildScopedUserName("username", "domain")); + assertEquals("user\\@name@domain", Util.buildScopedUserName("user@name", "domain")); + assertEquals("username@do\\@main", Util.buildScopedUserName("username", "do@main")); + assertEquals("user\\\\name@domain", Util.buildScopedUserName("user\\name", "domain")); + assertEquals("username@do\\\\main", Util.buildScopedUserName("username", "do\\main")); + assertEquals("username", Util.buildScopedUserName("username", null)); + assertEquals("@domain", Util.buildScopedUserName(null, "domain")); + } +} Modified: geronimo/server/trunk/modules/geronimo-corba/src/test/resources/beanPropertiesNameMangler.properties URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/resources/beanPropertiesNameMangler.properties?view=diff&rev=505432&r1=505429&r2=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/resources/beanPropertiesNameMangler.properties (original) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/resources/beanPropertiesNameMangler.properties Fri Feb 9 11:24:30 2007 @@ -30,10 +30,10 @@ setCORBA_Objectabcdef(org.omg.CORBA.Object) = _set_CORBA_Objectabcdef setCORBA_Anyabcdef(org.omg.CORBA.Any) = _set_CORBA_Anyabcdef setCORBA_TypeCodeabcdef(org.omg.CORBA.TypeCode) = _set_CORBA_TypeCodeabcdef -setCheeseIDLEntityabcdef(org.apache.openejb.corba.compiler.other.CheeseIDLEntity) = _set_cheeseIDLEntityabcdef -setGenericInterfaceabcdef(org.apache.openejb.corba.compiler.other.Generic$Interface) = _set_genericInterfaceabcdef -setBlahExceptionabcdef(org.apache.openejb.corba.compiler.other.BlahEx) = _set_blahExceptionabcdef -setBooExceptionabcdef(org.apache.openejb.corba.compiler.BooException) = _set_booExceptionabcdef +setCheeseIDLEntityabcdef(org.apache.geronimo.corba.compiler.other.CheeseIDLEntity) = _set_cheeseIDLEntityabcdef +setGenericInterfaceabcdef(org.apache.geronimo.corba.compiler.other.Generic$Interface) = _set_genericInterfaceabcdef +setBlahExceptionabcdef(org.apache.geronimo.corba.compiler.other.BlahEx) = _set_blahExceptionabcdef +setBooExceptionabcdef(org.apache.geronimo.corba.compiler.BooException) = _set_booExceptionabcdef isBooleanabcdef() = _get_booleanabcdef getCharabcdef() = _get_charabcdef getByteabcdef() = _get_byteabcdef Modified: geronimo/server/trunk/modules/geronimo-corba/src/test/resources/nameMangler.properties URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/resources/nameMangler.properties?view=diff&rev=505432&r1=505429&r2=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/resources/nameMangler.properties (original) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/resources/nameMangler.properties Fri Feb 9 11:24:30 2007 @@ -31,10 +31,10 @@ abcdefg_pass_CORBA_Object(org.omg.CORBA.Object) = abcdefg_pass_CORBA_Object abcdefg_pass_CORBA_Any(org.omg.CORBA.Any) = abcdefg_pass_CORBA_Any abcdefg_pass_CORBA_TypeCode(org.omg.CORBA.TypeCode) = abcdefg_pass_CORBA_TypeCode -abcdefg_pass_CheeseIDLEntity(org.apache.openejb.corba.compiler.other.CheeseIDLEntity) = abcdefg_pass_CheeseIDLEntity -abcdefg_pass_GenericInterface(org.apache.openejb.corba.compiler.other.Generic$Interface) = abcdefg_pass_GenericInterface -abcdefg_pass_BlahException(org.apache.openejb.corba.compiler.other.BlahEx) = abcdefg_pass_BlahException -abcdefg_pass_BooException(org.apache.openejb.corba.compiler.BooException) = abcdefg_pass_BooException +abcdefg_pass_CheeseIDLEntity(org.apache.geronimo.corba.compiler.other.CheeseIDLEntity) = abcdefg_pass_CheeseIDLEntity +abcdefg_pass_GenericInterface(org.apache.geronimo.corba.compiler.other.Generic$Interface) = abcdefg_pass_GenericInterface +abcdefg_pass_BlahException(org.apache.geronimo.corba.compiler.other.BlahEx) = abcdefg_pass_BlahException +abcdefg_pass_BooException(org.apache.geronimo.corba.compiler.BooException) = abcdefg_pass_BooException abcdefg_return_boolean() = abcdefg_return_boolean abcdefg_return_char() = abcdefg_return_char abcdefg_return_byte() = abcdefg_return_byte @@ -63,7 +63,7 @@ abcdefg_pass_return_CORBA_Object(org.omg.CORBA.Object) = abcdefg_pass_return_CORBA_Object abcdefg_pass_return_CORBA_Any(org.omg.CORBA.Any) = abcdefg_pass_return_CORBA_Any abcdefg_pass_return_CORBA_TypeCode(org.omg.CORBA.TypeCode) = abcdefg_pass_return_CORBA_TypeCode -abcdefg_pass_return_CheeseIDLEntity(org.apache.openejb.corba.compiler.other.CheeseIDLEntity) = abcdefg_pass_return_CheeseIDLEntity +abcdefg_pass_return_CheeseIDLEntity(org.apache.geronimo.corba.compiler.other.CheeseIDLEntity) = abcdefg_pass_return_CheeseIDLEntity abcdefg_pass_boolean_arr(boolean[]) = abcdefg_pass_boolean_arr abcdefg_pass_char_arr(char[]) = abcdefg_pass_char_arr abcdefg_pass_byte_arr(byte[]) = abcdefg_pass_byte_arr @@ -76,10 +76,10 @@ abcdefg_pass_CORBA_Object_arr(org.omg.CORBA.Object[]) = abcdefg_pass_CORBA_Object_arr abcdefg_pass_CORBA_Any_arr(org.omg.CORBA.Any[]) = abcdefg_pass_CORBA_Any_arr abcdefg_pass_CORBA_TypeCode_arr(org.omg.CORBA.TypeCode[]) = abcdefg_pass_CORBA_TypeCode_arr -abcdefg_pass_CheeseIDLEntity_arr(org.apache.openejb.corba.compiler.other.CheeseIDLEntity[]) = abcdefg_pass_CheeseIDLEntity_arr -abcdefg_pass_GenericInterface_arr(org.apache.openejb.corba.compiler.other.Generic$Interface[]) = abcdefg_pass_GenericInterface_arr -abcdefg_pass_BlahException_arr(org.apache.openejb.corba.compiler.other.BlahEx[]) = abcdefg_pass_BlahException_arr -abcdefg_pass_BooException_arr(org.apache.openejb.corba.compiler.BooException[]) = abcdefg_pass_BooException_arr +abcdefg_pass_CheeseIDLEntity_arr(org.apache.geronimo.corba.compiler.other.CheeseIDLEntity[]) = abcdefg_pass_CheeseIDLEntity_arr +abcdefg_pass_GenericInterface_arr(org.apache.geronimo.corba.compiler.other.Generic$Interface[]) = abcdefg_pass_GenericInterface_arr +abcdefg_pass_BlahException_arr(org.apache.geronimo.corba.compiler.other.BlahEx[]) = abcdefg_pass_BlahException_arr +abcdefg_pass_BooException_arr(org.apache.geronimo.corba.compiler.BooException[]) = abcdefg_pass_BooException_arr abcdefg_return_boolean_arr() = abcdefg_return_boolean_arr abcdefg_return_char_arr() = abcdefg_return_char_arr abcdefg_return_byte_arr() = abcdefg_return_byte_arr @@ -111,10 +111,10 @@ abcdefg_overload(org.omg.CORBA.Object) = abcdefg_overload__Object abcdefg_overload(org.omg.CORBA.Any) = abcdefg_overload__org_omg_boxedIDL_org_omg_CORBA_Any abcdefg_overload(org.omg.CORBA.TypeCode) = abcdefg_overload__org_omg_boxedIDL_org_omg_CORBA_TypeCode -abcdefg_overload(org.apache.openejb.corba.compiler.other.CheeseIDLEntity) = abcdefg_overload__org_omg_boxedIDL_org_apache_openejb_corba_compiler_other_CheeseIDLEntity -abcdefg_overload(org.apache.openejb.corba.compiler.other.Generic$Interface) = abcdefg_overload__org_apache_openejb_corba_compiler_other_GenericU0024Interface -abcdefg_overload(org.apache.openejb.corba.compiler.other.BlahEx) = abcdefg_overload__org_apache_openejb_corba_compiler_other_BlahEx -abcdefg_overload(org.apache.openejb.corba.compiler.BooException) = abcdefg_overload__org_apache_openejb_corba_compiler_BooException +abcdefg_overload(org.apache.geronimo.corba.compiler.other.CheeseIDLEntity) = abcdefg_overload__org_omg_boxedIDL_org_apache_geronimo_corba_compiler_other_CheeseIDLEntity +abcdefg_overload(org.apache.geronimo.corba.compiler.other.Generic$Interface) = abcdefg_overload__org_apache_geronimo_corba_compiler_other_GenericU0024Interface +abcdefg_overload(org.apache.geronimo.corba.compiler.other.BlahEx) = abcdefg_overload__org_apache_geronimo_corba_compiler_other_BlahEx +abcdefg_overload(org.apache.geronimo.corba.compiler.BooException) = abcdefg_overload__org_apache_geronimo_corba_compiler_BooException abcdefg_overload(boolean[]) = abcdefg_overload__org_omg_boxedRMI_seq1_boolean abcdefg_overload(char[]) = abcdefg_overload__org_omg_boxedRMI_seq1_wchar abcdefg_overload(byte[]) = abcdefg_overload__org_omg_boxedRMI_seq1_octet @@ -129,10 +129,10 @@ abcdefg_overload(org.omg.CORBA.Object[]) = abcdefg_overload__org_omg_boxedRMI_seq1_Object abcdefg_overload(org.omg.CORBA.Any[]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_omg_CORBA_seq1_Any abcdefg_overload(org.omg.CORBA.TypeCode[]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_omg_CORBA_seq1_TypeCode -abcdefg_overload(org.apache.openejb.corba.compiler.other.CheeseIDLEntity[]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_apache_openejb_corba_compiler_other_seq1_CheeseIDLEntity -abcdefg_overload(org.apache.openejb.corba.compiler.other.Generic$Interface[]) = abcdefg_overload__org_omg_boxedRMI_org_apache_openejb_corba_compiler_other_seq1_GenericU0024Interface -abcdefg_overload(org.apache.openejb.corba.compiler.other.BlahEx[]) = abcdefg_overload__org_omg_boxedRMI_org_apache_openejb_corba_compiler_other_seq1_BlahEx -abcdefg_overload(org.apache.openejb.corba.compiler.BooException[]) = abcdefg_overload__org_omg_boxedRMI_org_apache_openejb_corba_compiler_seq1_BooException +abcdefg_overload(org.apache.geronimo.corba.compiler.other.CheeseIDLEntity[]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_apache_geronimo_corba_compiler_other_seq1_CheeseIDLEntity +abcdefg_overload(org.apache.geronimo.corba.compiler.other.Generic$Interface[]) = abcdefg_overload__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_other_seq1_GenericU0024Interface +abcdefg_overload(org.apache.geronimo.corba.compiler.other.BlahEx[]) = abcdefg_overload__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_other_seq1_BlahEx +abcdefg_overload(org.apache.geronimo.corba.compiler.BooException[]) = abcdefg_overload__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_seq1_BooException abcdefg_overload(boolean[][]) = abcdefg_overload__org_omg_boxedRMI_seq2_boolean abcdefg_overload(char[][]) = abcdefg_overload__org_omg_boxedRMI_seq2_wchar abcdefg_overload(byte[][]) = abcdefg_overload__org_omg_boxedRMI_seq2_octet @@ -147,10 +147,10 @@ abcdefg_overload(org.omg.CORBA.Object[][]) = abcdefg_overload__org_omg_boxedRMI_seq2_Object abcdefg_overload(org.omg.CORBA.Any[][]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_omg_CORBA_seq2_Any abcdefg_overload(org.omg.CORBA.TypeCode[][]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_omg_CORBA_seq2_TypeCode -abcdefg_overload(org.apache.openejb.corba.compiler.other.CheeseIDLEntity[][]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_apache_openejb_corba_compiler_other_seq2_CheeseIDLEntity -abcdefg_overload(org.apache.openejb.corba.compiler.other.Generic$Interface[][]) = abcdefg_overload__org_omg_boxedRMI_org_apache_openejb_corba_compiler_other_seq2_GenericU0024Interface -abcdefg_overload(org.apache.openejb.corba.compiler.other.BlahEx[][]) = abcdefg_overload__org_omg_boxedRMI_org_apache_openejb_corba_compiler_other_seq2_BlahEx -abcdefg_overload(org.apache.openejb.corba.compiler.BooException[][]) = abcdefg_overload__org_omg_boxedRMI_org_apache_openejb_corba_compiler_seq2_BooException +abcdefg_overload(org.apache.geronimo.corba.compiler.other.CheeseIDLEntity[][]) = abcdefg_overload__org_omg_boxedRMI_org_omg_boxedIDL_org_apache_geronimo_corba_compiler_other_seq2_CheeseIDLEntity +abcdefg_overload(org.apache.geronimo.corba.compiler.other.Generic$Interface[][]) = abcdefg_overload__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_other_seq2_GenericU0024Interface +abcdefg_overload(org.apache.geronimo.corba.compiler.other.BlahEx[][]) = abcdefg_overload__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_other_seq2_BlahEx +abcdefg_overload(org.apache.geronimo.corba.compiler.BooException[][]) = abcdefg_overload__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_seq2_BooException abcdefg_throw_exception() = abcdefg_throw_exception abcdefg_pass_throw_exception(java.lang.String) = abcdefg_pass_throw_exception abcdefg_return_throw_exception() = abcdefg_return_throw_exception Modified: geronimo/server/trunk/modules/geronimo-corba/src/test/resources/specialNameMangler.properties URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/test/resources/specialNameMangler.properties?view=diff&rev=505432&r1=505429&r2=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-corba/src/test/resources/specialNameMangler.properties (original) +++ geronimo/server/trunk/modules/geronimo-corba/src/test/resources/specialNameMangler.properties Fri Feb 9 11:24:30 2007 @@ -20,13 +20,13 @@ _underscore() = J_underscore _underscoreOverload() = J_underscoreOverload__ -_underscoreOverload(org.apache.openejb.corba.compiler.other._Something) = J_underscoreOverload__org_apache_openejb_corba_compiler_other_J_Something -_underscoreOverload(org.apache.openejb.corba.compiler.other._Something[]) = J_underscoreOverload__org_omg_boxedRMI_org_apache_openejb_corba_compiler_other_seq1_J_Something +_underscoreOverload(org.apache.geronimo.corba.compiler.other._Something) = J_underscoreOverload__org_apache_geronimo_corba_compiler_other_J_Something +_underscoreOverload(org.apache.geronimo.corba.compiler.other._Something[]) = J_underscoreOverload__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_other_seq1_J_Something dollar$() = dollarU0024 $dollar() = U0024dollar #unicode_¿Ï´¹Œ§Ä½µ() = unicode_??U0153U00A5U03C0??U0192U03A9?U00B5 -innerClass(org.apache.openejb.corba.compiler.other.Generic$Interface$Generic$InnerClassint) = innerClass__org_apache_openejb_corba_compiler_other_GenericU0024Interface__GenericU0024InnerClass__long -innerClass(org.apache.openejb.corba.compiler.other.Generic$Interface$Generic$InnerClass[]int) = innerClass__org_omg_boxedRMI_org_apache_openejb_corba_compiler_other_seq1_GenericU0024Interface__GenericU0024InnerClass__long +innerClass(org.apache.geronimo.corba.compiler.other.Generic$Interface$Generic$InnerClassint) = innerClass__org_apache_geronimo_corba_compiler_other_GenericU0024Interface__GenericU0024InnerClass__long +innerClass(org.apache.geronimo.corba.compiler.other.Generic$Interface$Generic$InnerClass[]int) = innerClass__org_omg_boxedRMI_org_apache_geronimo_corba_compiler_other_seq1_GenericU0024Interface__GenericU0024InnerClass__long special() = special_ differByCase() = differByCase_6_8 differByCASE() = differByCASE_6_8_9_10_11 @@ -34,7 +34,7 @@ differByCASEOverload() = differByCASEOverload_6_8_9_10_11_12__ differByCASEOverload(int) = differByCASEOverload_6_8_9_10_11_12__long keyword() = keyword__ -keyword(org.apache.openejb.corba.compiler.other.inout) = keyword__org_apache_openejb_corba_compiler_other_inout +keyword(org.apache.geronimo.corba.compiler.other.inout) = keyword__org_apache_geronimo_corba_compiler_other_inout ABSTRACT() = ABSTRACT__ ABSTRACT(int) = ABSTRACT__long any() = _any @@ -47,7 +47,7 @@ custom() = _custom DEFAULT() = _DEFAULT DOUBLE() = _DOUBLE -enum() = _enum +#enum() = _enum exception() = _exception factory() = _factory FALSE() = _FALSE Copied: geronimo/server/trunk/modules/geronimo-yoko/pom.xml (from r505429, incubator/openejb/trunk/openejb2/modules/openejb-yoko/pom.xml) URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/pom.xml?view=diff&rev=505432&p1=incubator/openejb/trunk/openejb2/modules/openejb-yoko/pom.xml&r1=505429&p2=geronimo/server/trunk/modules/geronimo-yoko/pom.xml&r2=505432 ============================================================================== --- incubator/openejb/trunk/openejb2/modules/openejb-yoko/pom.xml (original) +++ geronimo/server/trunk/modules/geronimo-yoko/pom.xml Fri Feb 9 11:24:30 2007 @@ -22,34 +22,33 @@ 4.0.0 - org.apache.openejb + org.apache.geronimo.modules modules - 2.3-incubating-SNAPSHOT + 2.0-SNAPSHOT ../pom.xml - OpenEJB :: CORBA :: Yoko - openejb-yoko - OpenEJB Yoko ORB adapter - http://incubator.apache.org/openejb + Geronimo :: CORBA :: Yoko + geronimo-yoko - org.apache.openejb - openejb-corba - ${pom.version} + org.apache.geronimo.modules + geronimo-corba + ${version} - org.apache.openejb - openejb-corba-builder - ${pom.version} + org.apache.geronimo.modules + geronimo-corba-builder + ${version} test org.apache.geronimo.modules geronimo-naming-builder + ${version} test @@ -57,52 +56,61 @@ org.apache.geronimo.modules geronimo-security-builder + ${version} test org.apache.geronimo.modules geronimo-util + ${version} org.apache.geronimo.modules geronimo-core + ${version} org.apache.geronimo.modules geronimo-j2ee + ${version} org.apache.geronimo.modules geronimo-management + ${version} org.apache.geronimo.modules geronimo-kernel + ${version} org.apache.geronimo.modules geronimo-security + ${version} org.apache.geronimo.modules geronimo-system + ${version} org.apache.geronimo.modules geronimo-common + ${version} commons-logging - commons-logging-api + commons-logging Added: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java (added) +++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,428 @@ +/** + * 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.yoko; + +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.gbean.GBeanLifecycle; +import org.apache.geronimo.security.deploy.DefaultDomainPrincipal; +import org.apache.geronimo.security.deploy.DefaultPrincipal; +import org.apache.geronimo.security.deploy.DefaultRealmPrincipal; +import org.apache.geronimo.corba.CORBABean; +import org.apache.geronimo.corba.CSSBean; +import org.apache.geronimo.corba.NameService; +import org.apache.geronimo.corba.ORBConfiguration; +import org.apache.geronimo.corba.security.config.ConfigAdapter; +import org.apache.geronimo.corba.security.config.ConfigException; +import org.apache.geronimo.corba.security.config.tss.TSSConfig; +import org.apache.geronimo.corba.security.config.tss.TSSSSLTransportConfig; +import org.apache.geronimo.corba.security.config.tss.TSSTransportMechConfig; +import org.apache.yoko.orb.CosNaming.tnaming.TransientNameService; +import org.apache.yoko.orb.CosNaming.tnaming.TransientServiceException; +import org.apache.yoko.orb.OB.ZERO_PORT_POLICY_ID; +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Policy; + + +/** + * A ConfigAdapter instance for the Apache Yoko + * CORBA support. + * @version $Revision: 497125 $ $Date: 2007-01-17 10:51:30 -0800 (Wed, 17 Jan 2007) $ + */ +public class ORBConfigAdapter implements GBeanLifecycle, ConfigAdapter { + + private final Log log = LogFactory.getLog(ORBConfigAdapter.class); + + // static registry used to hook up bean instances with + private static final HashMap registry = new HashMap(); + + public ORBConfigAdapter() { + } + + /** + * Start the config adapter GBean. This is basically + * an opportunity to set any system properties + * required to make the ORB hook ups. In particular, + * this makes the ORB hookups for the RMI over IIOP + * support. + * + * @exception Exception + */ + public void doStart() throws Exception { + // define the default ORB for ORB.init(); + System.setProperty("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); + System.setProperty("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); + + // redirect the RMI implementation to use the Yoko ORB. + System.setProperty("javax.rmi.CORBA.PortableRemoteObjectClass", "org.apache.yoko.rmi.impl.PortableRemoteObjectImpl"); + System.setProperty("javax.rmi.CORBA.StubClass", "org.apache.yoko.rmi.impl.StubImpl"); + // this hooks the util class and allows us to override certain functions + System.setProperty("javax.rmi.CORBA.UtilClass", "org.apache.geronimo.corba.util.UtilDelegateImpl"); + // this tells the openejb UtilDelegateImpl which implementation to delegate non-overridden + // operations to. + System.setProperty("org.apache.geronimo.corba.UtilDelegateClass", "org.apache.yoko.rmi.impl.UtilImpl"); + // this allows us to hook RMI stub invocation/serialization events. + System.setProperty("org.apache.yoko.rmi.RMIStubInitializerClass", "org.apache.geronimo.yoko.RMIStubHandlerFactory"); + + // ok, now we have a potential classloading problem because of where our util delegates are located. + // by forcing these classes to load now using our class loader, we can ensure things are properly initialized + this.getClass().getClassLoader().loadClass("javax.rmi.PortableRemoteObject"); + + log.debug("Started Yoko ORBConfigAdapter"); + } + + public void doStop() throws Exception { + // nothing really required here. + log.debug("Stopped Yoko ORBConfigAdapter"); + } + + public void doFail() { + // nothing much to do. + log.warn("Failed Yoko ORBConfigAdapter"); + } + + /** + * Create an ORB for a CORBABean server context. + * + * @param server The CORBABean that owns this ORB's configuration. + * + * @return An ORB instance configured for the CORBABean. + * @exception ConfigException + */ + public ORB createServerORB(CORBABean server) throws ConfigException { + ORB orb = createORB(server.getURI(), (ORBConfiguration)server, translateToArgs(server), translateToProps(server)); + + // check the tss config for a transport mech definition. If we have one, then + // the port information will be passed in that config, and the port in the IIOP profile + // needs to be zero. + TSSConfig config = server.getTssConfig(); + TSSTransportMechConfig transportMech = config.getTransport_mech(); + if (transportMech != null) { + if (transportMech instanceof TSSSSLTransportConfig) { + Any any = orb.create_any(); + any.insert_boolean(true); + + try { + Policy portPolicy = orb.create_policy(ZERO_PORT_POLICY_ID.value, any); + Policy[] overrides = new Policy [] { portPolicy }; + server.setPolicyOverrides(overrides); + } catch (org.omg.CORBA.PolicyError e) { + // shouldn't happen, but we'll let things continue with no policy set. + } + + } + } + + return orb; + } + + /** + * Create an ORB for a CSSBean client context. + * + * @param client The configured CSSBean used for access. + * + * @return An ORB instance configured for this client access. + * @exception ConfigException + */ + public ORB createClientORB(CSSBean client) throws ConfigException { + return createORB(client.getURI(), (ORBConfiguration)client, translateToArgs(client), translateToProps(client)); + } + + /** + * Create an ORB for a CSSBean name service client context. + * + * @param client The configured CSSBean used for access. + * + * @return An ORB instance configured for this client access. + * @exception ConfigException + */ + public ORB createNameServiceClientORB(CSSBean client) throws ConfigException { + return createORB(client.getURI(), (ORBConfiguration)client, translateToArgs(client), translateToNameServiceProps(client)); + } + + /** + * Create a transient name service instance using the + * specified host name and port. + * + * @param host The String host name. + * @param port The port number of the listener. + * + * @return An opaque object that represents the name service. + * @exception ConfigException + */ + public Object createNameService(String host, int port) throws ConfigException { + try { + // create a name service using the supplied host and publish under the name "NameService" + TransientNameService service = new TransientNameService(host, port, "NameService"); + service.run(); + // the service instance is returned as an opaque object. + return service; + } catch (TransientServiceException e) { + throw new ConfigException("Error starting transient name service", e); + } + } + + /** + * Destroy a name service instance created by a + * prior call to createNameService(). + * + * @param ns The opaque name service object returned from a + * prior call to createNameService(). + */ + public void destroyNameService(Object ns) { + // The name service instance handles its own shutdown. + ((TransientNameService)ns).destroy(); + } + + /** + * Static method used by SocketFactory instances to + * retrieve the CORBABean or CSSBean that holds its + * configuration information. The String name has + * been passed to the SocketFactory as part of its + * initialization parameters. + * + * @param name The name of the bean holding the configuration + * information. + * + * @return The bean mapping for this SocketFactory instance. + */ + public static ORBConfiguration getConfiguration(String name) { + return (ORBConfiguration)registry.get(name); + } + + /** + * Create an ORB instance using the configured argument + * and property bundles. + * + * @param name The String name of the configuration GBean used to + * create this ORB. + * @param config The GBean configuration object required by the + * SocketFactory instance. + * @param args The String arguments passed to ORB.init(). + * @param props The property bundle passed to ORB.init(). + * + * @return An ORB constructed from the provided args and properties. + */ + private ORB createORB(String name, ORBConfiguration config, String[] args, Properties props) { + try { + // we need to stuff this reference in the registry so that the SocketFactory can find it + // when it initializes. + registry.put(name, config); + return ORB.init(args, props); + + } finally { + // remove the configuration object from the registry now that the ORB has initialized. We + // don't want to create a memory leak on the GBean. + registry.remove(name); + } + } + + /** + * Translate a CORBABean configuration into an + * array of arguments used to configure the ORB + * instance. + * + * @param server The CORBABean we're creating an ORB instance for. + * + * @return A String{} array containing the initialization + * arguments. + * @exception ConfigException + */ + private String[] translateToArgs(CORBABean server) throws ConfigException { + ArrayList list = new ArrayList(); + + TSSConfig config = server.getTssConfig(); + + // if the TSSConfig includes principal information, we need to add argument values + // for this information. + DefaultPrincipal principal = config.getDefaultPrincipal(); + if (principal != null) { + if (principal instanceof DefaultRealmPrincipal) { + DefaultRealmPrincipal realmPrincipal = (DefaultRealmPrincipal) principal; + list.add("default-realm-principal::" + realmPrincipal.getRealm() + ":" + realmPrincipal.getDomain() + ":" + + realmPrincipal.getPrincipal().getClassName() + ":" + realmPrincipal.getPrincipal().getPrincipalName()); + } else if (principal instanceof DefaultDomainPrincipal) { + DefaultDomainPrincipal domainPrincipal = (DefaultDomainPrincipal) principal; + list.add("default-domain-principal::" + domainPrincipal.getDomain() + ":" + + domainPrincipal.getPrincipal().getClassName() + ":" + domainPrincipal.getPrincipal().getPrincipalName()); + } else { + list.add("default-principal::" + principal.getPrincipal().getClassName() + ":" + principal.getPrincipal().getPrincipalName()); + } + } + + // enable the connection plugin + enableSocketFactory(server.getURI(), list); + + NameService nameService = server.getNameService(); + // if we have a name service to enable as an initial ref, add it to the init processing. + if (nameService != null) { + list.add("-ORBInitRef"); + list.add("NameService=" + nameService.getURI()); + } + + if (log.isDebugEnabled()) { + for (Iterator iter = list.iterator(); iter.hasNext();) { + log.debug(iter.next()); + } + } + + return (String[]) list.toArray(new String[list.size()]); + } + + private Properties translateToProps(CORBABean server) throws ConfigException { + Properties result = new Properties(); + + result.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); + result.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); + result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.corba.transaction.TransactionInitializer", ""); + result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.corba.security.SecurityInitializer", ""); + result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.yoko.ORBInitializer", ""); + // don't specify the port if we're allowing this to default. + if (server.getPort() > 0) { + result.put("yoko.orb.oa.endpoint", "iiop --host " + server.getHost() + " --port " + server.getPort()); + } + else { + result.put("yoko.orb.oa.endpoint", "iiop --host " + server.getHost()); + } + + // check the tss config for a transport mech definition. If we have one, then + // the port information will be passed in that config, and the port in the IIOP profile + // needs to be zero. + TSSConfig config = server.getTssConfig(); + TSSTransportMechConfig transportMech = config.getTransport_mech(); + if (transportMech != null) { + if (transportMech instanceof TSSSSLTransportConfig) { + result.put("yoko.orb.policy.zero_port", "true"); + } + } + + if (log.isDebugEnabled()) { + log.debug("translateToProps(TSSConfig)"); + for (Enumeration iter = result.keys(); iter.hasMoreElements();) { + String key = (String) iter.nextElement(); + log.debug(key + " = " + result.getProperty(key)); + } + } + return result; + } + + /** + * Translate a CSSBean configuration into the + * argument bundle needed to instantiate the + * ORB instance. + * + * @param client The CSSBean holding the configuration. + * + * @return A String array to be passed to ORB.init(). + * @exception ConfigException + */ + private String[] translateToArgs(CSSBean client) throws ConfigException { + ArrayList list = new ArrayList(); + + // enable the connection plugin + enableSocketFactory(client.getURI(), list); + + if (log.isDebugEnabled()) { + for (Iterator iter = list.iterator(); iter.hasNext();) { + log.debug(iter.next()); + } + } + + return (String[]) list.toArray(new String[list.size()]); + } + + /** + * Add arguments to the ORB.init() argument list + * required to enable the SocketFactory used for + * SSL support. + * + * @param uri The URI name of the configuration GBean (either a + * CSSBean or a CORBABean). + * @param args + */ + private void enableSocketFactory(String uri, List args) { + args.add("-IIOPconnectionHelper"); + args.add("org.apache.geronimo.yoko.SocketFactory"); + args.add("-IIOPconnectionHelperArgs"); + args.add(uri); + } + + + /** + * Translate a CSSBean configuration into the + * property bundle necessary to configure the + * ORB instance. + * + * @param client The CSSBean holding the configuration. + * + * @return A property bundle that can be passed to ORB.init(); + * @exception ConfigException + */ + private Properties translateToProps(CSSBean client) throws ConfigException { + Properties result = new Properties(); + + result.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); + result.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); + result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.corba.transaction.TransactionInitializer", ""); + result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.corba.security.SecurityInitializer", ""); + result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.yoko.ORBInitializer", ""); + + if (log.isDebugEnabled()) { + log.debug("translateToProps(CSSConfig)"); + for (Enumeration iter = result.keys(); iter.hasMoreElements();) { + String key = (String) iter.nextElement(); + log.debug(key + " = " + result.getProperty(key)); + } + } + return result; + } + + + /** + * Translate a CSSBean configuration into the + * property bundle necessary to configure the + * ORB instance. + * + * @param client The CSSBean holding the configuration. + * + * @return A property bundle that can be passed to ORB.init(); + * @exception ConfigException + */ + private Properties translateToNameServiceProps(CSSBean client) throws ConfigException { + Properties result = new Properties(); + + result.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB"); + result.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton"); + + if (log.isDebugEnabled()) { + log.debug("translateToNameServiceProps(CSSConfig)"); + for (Enumeration iter = result.keys(); iter.hasMoreElements();) { + String key = (String) iter.nextElement(); + log.debug(key + " = " + result.getProperty(key)); + } + } + return result; + } +} Added: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapterGBean.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapterGBean.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapterGBean.java (added) +++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapterGBean.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,45 @@ +/** + * 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.yoko; + +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; + +/** + * @version $Revision: 452600 $ $Date: 2006-10-03 12:29:42 -0700 (Tue, 03 Oct 2006) $ + */ +public final class ORBConfigAdapterGBean extends org.apache.geronimo.corba.security.config.ConfigAdapterGBean { + + public static final GBeanInfo GBEAN_INFO; + + public ORBConfigAdapterGBean() { + } + + static { + GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ORBConfigAdapterGBean.class, "ORB Configuration Adapater", ORBConfigAdapter.class, NameFactory.ORB_CONFIG); + infoFactory.setConstructor(new String[]{}); + infoFactory.addInterface(org.apache.geronimo.corba.security.config.ConfigAdapter.class); + + GBEAN_INFO = infoFactory.getBeanInfo(); + } + + public static GBeanInfo getGBeanInfo() { + return GBEAN_INFO; + } +} + Added: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBInitializer.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBInitializer.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBInitializer.java (added) +++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBInitializer.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,82 @@ +/** + * 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.yoko; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.omg.CORBA.LocalObject; +import org.omg.PortableInterceptor.ORBInitInfo; +import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; + +/** + * @version $Revision: 452600 $ $Date: 2006-10-03 12:29:42 -0700 (Tue, 03 Oct 2006) $ + */ +public class ORBInitializer extends LocalObject implements org.omg.PortableInterceptor.ORBInitializer { + + private final Log log = LogFactory.getLog(ORBInitializer.class); + + public ORBInitializer() { + if (log.isDebugEnabled()) log.debug("ORBInitializer."); + } + + /** + * Called during ORB initialization. If it is expected that initial + * services registered by an interceptor will be used by other + * interceptors, then those initial services shall be registered at + * this point via calls to + * ORBInitInfo.register_initial_reference. + * + * @param info provides initialization attributes and operations by + * which Interceptors can be registered. + */ + public void pre_init(ORBInitInfo info) { + } + + /** + * Called during ORB initialization. If a service must resolve initial + * references as part of its initialization, it can assume that all + * initial references will be available at this point. + *

+ * Calling the post_init operations is not the final + * task of ORB initialization. The final task, following the + * post_init calls, is attaching the lists of registered + * interceptors to the ORB. Therefore, the ORB does not contain the + * interceptors during calls to post_init. If an + * ORB-mediated call is made from within post_init, no + * request interceptors will be invoked on that call. + * Likewise, if an operation is performed which causes an IOR to be + * created, no IOR interceptors will be invoked. + * + * @param info provides initialization attributes and + * operations by which Interceptors can be registered. + */ + public void post_init(ORBInitInfo info) { + + try { + if (log.isDebugEnabled()) log.debug("Registering IOR interceptor"); + + try { + info.add_server_request_interceptor(new ServiceContextInterceptor()); + } catch (DuplicateName dn) { + log.error("Error registering interceptor", dn); + } + } catch (RuntimeException re) { + log.error("Error registering interceptor", re); + throw re; + } + } +} Added: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandler.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandler.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandler.java (added) +++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandler.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,53 @@ +/** +* +* 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.yoko; + +import org.apache.geronimo.corba.CorbaApplicationServer; +import org.apache.openejb.core.ServerFederation; +import org.apache.openejb.spi.ApplicationServer; +import org.apache.yoko.rmi.impl.MethodDescriptor; +import org.apache.yoko.rmi.impl.RMIStub; + +/** + * This class is the InvocationHandler for instances of POAStub. When a client + * calls a remote method, this is translated to a call to the invoke() method in + * this class. + */ +public class RMIStubHandler extends org.apache.yoko.rmi.impl.RMIStubHandler { + // the application server singleton + private static CorbaApplicationServer corbaApplicationServer = new CorbaApplicationServer(); + + public Object invoke(RMIStub stub, MethodDescriptor method, Object[] args) throws Throwable { + // object types must bbe written in the context of the corba application server + // which properly write replaces our objects for corba + ApplicationServer oldApplicationServer = ServerFederation.getApplicationServer(); + + ServerFederation.setApplicationServer(corbaApplicationServer); + + try { + // let the super class handle everything. We just need to wrap the context + return super.invoke(stub, method, args); + + } finally { + ServerFederation.setApplicationServer(oldApplicationServer); + } + } + +} + Added: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandlerFactory.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandlerFactory.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandlerFactory.java (added) +++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/RMIStubHandlerFactory.java Fri Feb 9 11:24:30 2007 @@ -0,0 +1,41 @@ +/** +* +* 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.yoko; + +/** + * Implementation of the yoko StubInitializer class to provide instances + * of RMIStubHandlers to Stub instances. + */ +public class RMIStubHandlerFactory implements org.apache.yoko.rmi.util.stub.StubInitializer { + public RMIStubHandlerFactory() { + } + + /** + * Provide an RMIStub instance with an RMIStubHandler instance. This version + * instantiates a new handler for each stub instance because the handler + * needs to be initialized with the appropriate execution context. + * + * @return An instance of StubHandler that hooks the RMI stub invocation into the openejb + * context. + */ + public Object getStubHandler() { + return new RMIStubHandler(); + } +} + Added: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ServiceContextInterceptor.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ServiceContextInterceptor.java?view=auto&rev=505432 ============================================================================== --- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ServiceContextInterceptor.java (added) +++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ServiceContextInterceptor.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.yoko; + +import java.net.Socket; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; + +import org.apache.yoko.orb.PortableInterceptor.ServerRequestInfoExt; +import org.apache.yoko.orb.OCI.IIOP.TransportInfo_impl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.omg.CORBA.LocalObject; +import org.omg.PortableInterceptor.ServerRequestInfo; +import org.omg.PortableInterceptor.ServerRequestInterceptor; + +import org.apache.geronimo.corba.security.SSLSessionManager; + +/** + * A service context interceptor to help manage + * SSL security information for incoming connections. + * @version $Revision: 452600 $ $Date: 2006-10-03 12:29:42 -0700 (Tue, 03 Oct 2006) $ + */ +final class ServiceContextInterceptor extends LocalObject implements ServerRequestInterceptor { + + private final Log log = LogFactory.getLog(ServiceContextInterceptor.class); + + public ServiceContextInterceptor() { + if (log.isDebugEnabled()) log.debug(""); + } + + public void receive_request(ServerRequestInfo ri) { + } + + public void receive_request_service_contexts(ServerRequestInfo ri) { + + if (log.isDebugEnabled()) log.debug("Looking for SSL Session"); + + // for an incoming request, we need to see if the request is coming in on + // an SSLSocket. If this is using a secure connection, then we register the + // request and SSLSession with the session manager. + ServerRequestInfoExt riExt = (ServerRequestInfoExt) ri; + TransportInfo_impl connection = (TransportInfo_impl)riExt.getTransportInfo(); + if (connection != null) { + Socket socket = connection.socket(); + if (socket != null && socket instanceof SSLSocket) { + if (log.isDebugEnabled()) log.debug("Found SSL Session"); + SSLSocket sslSocket = (SSLSocket) socket; + + SSLSessionManager.setSSLSession(ri.request_id(), sslSocket.getSession()); + } + } + } + + public void send_exception(ServerRequestInfo ri) { + // clean any SSL session information if we registered. + SSLSession old = SSLSessionManager.clearSSLSession(ri.request_id()); + if (log.isDebugEnabled() && old != null) log.debug("Removing SSL Session for send_exception"); + } + + public void send_other(ServerRequestInfo ri) { + // clean any SSL session information if we registered. + SSLSession old = SSLSessionManager.clearSSLSession(ri.request_id()); + if (log.isDebugEnabled() && old != null) log.debug("Removing SSL Session for send_reply"); + } + + public void send_reply(ServerRequestInfo ri) { + // clean any SSL session information if we registered. + SSLSession old = SSLSessionManager.clearSSLSession(ri.request_id()); + if (log.isDebugEnabled() && old != null) log.debug("Removing SSL Session for send_reply"); + } + + public void destroy() { + if (log.isDebugEnabled()) log.debug("Destroy"); + } + + public String name() { + return "org.apache.geronimo.yoko.ServiceContextInterceptor"; + } +}