001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Rodrigo Westrupp
028: */
029:
030: package com.caucho.config.types;
031:
032: import com.caucho.bytecode.*;
033: import com.caucho.ejb.*;
034: import com.caucho.util.BeanUtil;
035: import com.caucho.util.L10N;
036: import com.caucho.vfs.Path;
037: import com.caucho.vfs.Vfs;
038:
039: import java.lang.reflect.*;
040: import java.util.logging.Logger;
041:
042: /**
043: * Base configuration for ejb-ref and resource-env-ref.
044: */
045: abstract public class BaseRef {
046: private static final L10N L = new L10N(BaseRef.class);
047: private static final Logger log = Logger.getLogger(BaseRef.class
048: .getName());
049:
050: protected final Path _modulePath;
051:
052: protected String _sourceEjbName;
053:
054: protected InjectionTarget _injectionTarget;
055:
056: public BaseRef() {
057: _modulePath = Vfs.getPwd();
058: }
059:
060: public BaseRef(Path modulePath) {
061: _modulePath = modulePath;
062: }
063:
064: public BaseRef(Path modulePath, String sourceEjbName) {
065: _modulePath = modulePath;
066: _sourceEjbName = sourceEjbName;
067: }
068:
069: public InjectionTarget getInjectionTarget() {
070: return _injectionTarget;
071: }
072:
073: public void setInjectionTarget(InjectionTarget injectionTarget) {
074: _injectionTarget = injectionTarget;
075: }
076:
077: public Class getJavaClass(String className) throws Exception {
078: ClassLoader loader = Thread.currentThread()
079: .getContextClassLoader();
080:
081: JClassLoader jClassLoader = JClassLoaderWrapper.create(loader);
082:
083: JClass jClass = jClassLoader.forName(className);
084:
085: return jClass.getJavaClass();
086: }
087:
088: public AccessibleObject getFieldOrMethod(Class cl, String fieldName)
089: throws Exception {
090: return null;
091: /*
092: EjbServerManager manager = EjbServerManager.getLocal();
093:
094: if (manager == null)
095: return null;
096:
097: Method method = BeanUtil.getSetMethod(cl, fieldName);
098:
099: if (method != null)
100: return method;
101:
102: return cl.getDeclaredField(fieldName);
103: */
104: }
105: }
|