Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 6887 invoked from network); 26 Jan 2007 21:31:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jan 2007 21:31:16 -0000 Received: (qmail 54199 invoked by uid 500); 26 Jan 2007 21:31:22 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 54174 invoked by uid 500); 26 Jan 2007 21:31:22 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 54163 invoked by uid 99); 26 Jan 2007 21:31:22 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jan 2007 13:31:22 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jan 2007 13:31:15 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id BD59C1A981D; Fri, 26 Jan 2007 13:30:55 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: scm@geronimo.apache.org From: dims@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070126213055.BD59C1A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); + } + } +}