geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r500364 - in /geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf: JNDIResolver.java JNDIResourceResolver.java
Date Fri, 26 Jan 2007 21:30:55 GMT
Author: dims
Date: Fri Jan 26 13:30:54 2007
New Revision: 500364

URL: http://svn.apache.org/viewvc?view=rev&rev=500364
Log:
oops! wrong file

Added:
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/JNDIResolver.java
Removed:
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/JNDIResourceResolver.java

Added: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/JNDIResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/JNDIResolver.java?view=auto&rev=500364
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/JNDIResolver.java
(added)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/JNDIResolver.java
Fri Jan 26 13:30:54 2007
@@ -0,0 +1,168 @@
+/**
+ *  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.cxf;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.geronimo.naming.java.RootContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class JNDIResolver {
+
+    private static final Log LOG = 
+        LogFactory.getLog(JNDIResolver.class.getName());
+
+    private Context componentContext;
+
+    public JNDIResolver(Context context) {
+        this.componentContext = context;
+    }
+
+    public Object resolve(String name, Class clz) throws NamingException {
+        Context oldContext = RootContext.getComponentContext();
+        try {
+            RootContext.setComponentContext(componentContext);
+
+            Context ctx = new InitialContext();
+            ctx = (Context) ctx.lookup("java:comp/env");
+
+            LOG.debug("Looking up '" + name + "'");
+
+            Object o = ctx.lookup(name);
+
+            return clz.cast(o);
+        } finally {
+            RootContext.setComponentContext(oldContext);
+        }
+    }
+}
+/**
+ *  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.cxf;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.geronimo.naming.java.RootContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class JNDIResolver {
+
+    private static final Log LOG = 
+        LogFactory.getLog(JNDIResolver.class.getName());
+
+    private Context componentContext;
+
+    public JNDIResolver(Context context) {
+        this.componentContext = context;
+    }
+
+    public Object resolve(String name, Class clz) throws NamingException {
+        Context oldContext = RootContext.getComponentContext();
+        try {
+            RootContext.setComponentContext(componentContext);
+
+            Context ctx = new InitialContext();
+            ctx = (Context) ctx.lookup("java:comp/env");
+
+            LOG.debug("Looking up '" + name + "'");
+
+            Object o = ctx.lookup(name);
+
+            return clz.cast(o);
+        } finally {
+            RootContext.setComponentContext(oldContext);
+        }
+    }
+}
+/**
+ *  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.cxf;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.geronimo.naming.java.RootContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class JNDIResolver {
+
+    private static final Log LOG = 
+        LogFactory.getLog(JNDIResolver.class.getName());
+
+    private Context componentContext;
+
+    public JNDIResolver(Context context) {
+        this.componentContext = context;
+    }
+
+    public Object resolve(String name, Class clz) throws NamingException {
+        Context oldContext = RootContext.getComponentContext();
+        try {
+            RootContext.setComponentContext(componentContext);
+
+            Context ctx = new InitialContext();
+            ctx = (Context) ctx.lookup("java:comp/env");
+
+            LOG.debug("Looking up '" + name + "'");
+
+            Object o = ctx.lookup(name);
+
+            return clz.cast(o);
+        } finally {
+            RootContext.setComponentContext(oldContext);
+        }
+    }
+}



Mime
View raw message