You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2004/05/11 20:39:34 UTC
cvs commit: jakarta-jetspeed-2/components/rdbms/src/java/org/apache/jetspeed/components/jndi TyrexJNDIComponent.java
weaver 2004/05/11 11:39:34
Modified: components/rdbms/src/java/org/apache/jetspeed/components/jndi
Tag: NANOCONTAINER_DEPLOYER TyrexJNDIComponent.java
Log:
Revision Changes Path
No revision
No revision
1.2.2.1 +117 -111 jakarta-jetspeed-2/components/rdbms/src/java/org/apache/jetspeed/components/jndi/TyrexJNDIComponent.java
Index: TyrexJNDIComponent.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/components/rdbms/src/java/org/apache/jetspeed/components/jndi/TyrexJNDIComponent.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- TyrexJNDIComponent.java 26 Feb 2004 17:38:44 -0000 1.2
+++ TyrexJNDIComponent.java 11 May 2004 18:39:34 -0000 1.2.2.1
@@ -1,111 +1,117 @@
-/**
- * Created on Feb 4, 2004
- *
- *
- * @author
- */
-package org.apache.jetspeed.components.jndi;
-
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import tyrex.naming.MemoryContext;
-import tyrex.tm.RuntimeContext;
-
-/**
- * <p>
- * TyrexJNDIComponent
- * </p>
- * <p>
- *
- * </p>
- * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
- * @version $Id$
- *
- */
-public class TyrexJNDIComponent implements JNDIComponent
-{
-
- private static final Log log = LogFactory.getLog(TyrexJNDIComponent.class);
-
- private MemoryContext rootJNDIContext;
-
- /**
- * @see org.apache.fulcrum.Service#init()
- */
- public TyrexJNDIComponent() throws NamingException
- {
- Context ctx = null;
-
- // Construct a non-shared memory context
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "tyrex.naming.MemoryContextFactory");
- rootJNDIContext = new MemoryContext(null);
- ctx = rootJNDIContext.createSubcontext("comp");
- ctx = ctx.createSubcontext("env");
- ctx = ctx.createSubcontext("jdbc");
-
- // Associate the memory context with a new
- // runtime context and associate the runtime context
- // with the current thread
- bindToCurrentThread();
- log.info("JNDI successfully initiallized");
-
- }
-
-
- /**
- * @see org.apache.jetspeed.cps.jndi.JNDIService#getRootContext()
- */
- public Context getRootContext()
- {
- return rootJNDIContext;
- }
-
- /**
- * @see org.apache.jetspeed.cps.jndi.JNDIService#bindToCurrentThread()
- */
- public void bindToCurrentThread() throws NamingException
- {
- RuntimeContext runCtx = RuntimeContext.newRuntimeContext(rootJNDIContext, null);
- RuntimeContext.setRuntimeContext(runCtx);
- }
-
- /**
- *
- * <p>
- * bindObject
- * </p>
- *
- * @see org.apache.jetspeed.cps.jndi.JNDIComponent#bindObject(java.lang.String, java.lang.Object)
- * @param bindToName
- * @param obj
- * @throws NamingException
- */
- public void bindObject(String bindToName, Object obj) throws NamingException
- {
- log.debug("Binding "+obj+" to name "+bindToName);
- Context ctx = getRootContext();
- ctx.bind(bindToName, obj);
- }
-
- /**
- * <p>
- * unbindFromCurrentThread
- * </p>
- *
- * @see org.apache.jetspeed.components.jndi.JNDIComponent#unbindFromCurrentThread()
- * @throws NamingException
- */
- public void unbindFromCurrentThread() throws NamingException
- {
- RuntimeContext.unsetRuntimeContext();
- RuntimeContext.cleanup(Thread.currentThread());
- }
-
-}
+/**
+ * Created on Feb 4, 2004
+ *
+ *
+ * @author
+ */
+package org.apache.jetspeed.components.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import tyrex.naming.MemoryContext;
+import tyrex.tm.RuntimeContext;
+
+/**
+ * <p>
+ * TyrexJNDIComponent
+ * </p>
+ * <p>
+ *
+ * </p>
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id$
+ *
+ */
+public class TyrexJNDIComponent implements JNDIComponent
+{
+
+ private static final Log log = LogFactory.getLog(TyrexJNDIComponent.class);
+
+ private MemoryContext rootJNDIContext;
+
+ /**
+ * @see org.apache.fulcrum.Service#init()
+ */
+ public TyrexJNDIComponent() throws NamingException
+ {
+ Context ctx = null;
+
+ // Construct a non-shared memory context
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "tyrex.naming.MemoryContextFactory");
+ env.put("java.naming.factory.url.pkgs", "tyrex.naming");
+ rootJNDIContext = new MemoryContext(null);
+ // rootJNDIContext = new MemoryContext(env);
+ ctx = rootJNDIContext.createSubcontext("comp");
+ ctx = ctx.createSubcontext("env");
+ ctx = ctx.createSubcontext("jdbc");
+
+ new InitialContext(env);
+
+ // Associate the memory context with a new
+ // runtime context and associate the runtime context
+ // with the current thread
+ bindToCurrentThread();
+
+ log.info("JNDI successfully initiallized");
+
+ }
+
+
+ /**
+ * @see org.apache.jetspeed.cps.jndi.JNDIService#getRootContext()
+ */
+ public Context getRootContext()
+ {
+ return rootJNDIContext;
+ }
+
+ /**
+ * @see org.apache.jetspeed.cps.jndi.JNDIService#bindToCurrentThread()
+ */
+ public void bindToCurrentThread() throws NamingException
+ {
+ RuntimeContext runCtx = RuntimeContext.newRuntimeContext(rootJNDIContext, null);
+ RuntimeContext.setRuntimeContext(runCtx);
+ }
+
+ /**
+ *
+ * <p>
+ * bindObject
+ * </p>
+ *
+ * @see org.apache.jetspeed.cps.jndi.JNDIComponent#bindObject(java.lang.String, java.lang.Object)
+ * @param bindToName
+ * @param obj
+ * @throws NamingException
+ */
+ public void bindObject(String bindToName, Object obj) throws NamingException
+ {
+ log.debug("Binding "+obj+" to name "+bindToName);
+ Context ctx = getRootContext();
+ ctx.bind(bindToName, obj);
+ }
+
+ /**
+ * <p>
+ * unbindFromCurrentThread
+ * </p>
+ *
+ * @see org.apache.jetspeed.components.jndi.JNDIComponent#unbindFromCurrentThread()
+ * @throws NamingException
+ */
+ public void unbindFromCurrentThread() throws NamingException
+ {
+ RuntimeContext.unsetRuntimeContext();
+ RuntimeContext.cleanup(Thread.currentThread());
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org