You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by da...@apache.org on 2007/03/20 21:31:55 UTC
svn commit: r520558 - in
/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb:
assembler/classic/JndiEncBuilder.java
core/ivm/naming/SystemComponentReference.java
Author: dain
Date: Tue Mar 20 13:31:54 2007
New Revision: 520558
URL: http://svn.apache.org/viewvc?view=rev&rev=520558
Log:
Add jndi bindings for ORB and HandleDelegate
Added:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/SystemComponentReference.java
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java?view=diff&rev=520558&r1=520557&r2=520558
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java Tue Mar 20 13:31:54 2007
@@ -31,9 +31,12 @@
import org.apache.openejb.core.ivm.naming.IvmContext;
import org.apache.openejb.core.ivm.naming.NameNode;
import org.apache.openejb.core.ivm.naming.ParsedName;
+import org.apache.openejb.core.ivm.naming.SystemComponentReference;
import org.apache.xbean.naming.context.WritableContext;
+import org.omg.CORBA.ORB;
import javax.ejb.EJBContext;
+import javax.ejb.spi.HandleDelegate;
import javax.naming.Context;
import javax.naming.LinkRef;
import javax.naming.NamingException;
@@ -153,10 +156,9 @@
TransactionSynchronizationRegistry synchronizationRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class);
bindings.put("java:comp/TransactionSynchronizationRegistry", synchronizationRegistry);
- if (System.getProperty("duct tape") != null){
- bindings.put("java:comp/ORB", new JndiUrlReference("java:comp/geronimo/ORB"));
- bindings.put("java:comp/HandleDelegate", new JndiUrlReference("java:comp/geronimo/HandleDelegate"));
- }
+ // bind CORBA stuff
+ bindings.put("java:comp/ORB", new SystemComponentReference(ORB.class));
+ bindings.put("java:comp/HandleDelegate", new SystemComponentReference(HandleDelegate.class));
// get JtaEntityManagerRegistry
JtaEntityManagerRegistry jtaEntityManagerRegistry = SystemInstance.get().getComponent(JtaEntityManagerRegistry.class);
Added: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/SystemComponentReference.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/SystemComponentReference.java?view=auto&rev=520558
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/SystemComponentReference.java (added)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/SystemComponentReference.java Tue Mar 20 13:31:54 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.openejb.core.ivm.naming;
+
+import org.apache.openejb.loader.SystemInstance;
+
+import javax.naming.NamingException;
+
+/**
+ * @version $Rev: 497833 $ $Date: 2007-01-19 06:41:45 -0800 (Fri, 19 Jan 2007) $
+ */
+public class SystemComponentReference extends Reference {
+ private final Class<? extends Object> type;
+
+ public SystemComponentReference(Class<? extends Object> type) {
+ if (type == null) throw new NullPointerException("type is null");
+ this.type = type;
+ }
+
+ public Object getObject() throws NamingException {
+ Object component = SystemInstance.get().getComponent(type);
+ if (component == null) {
+ throw new NamingException("No " + type.getSimpleName() + " registered with the OpenEJB system");
+ }
+ return component;
+ }
+}