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 Scott Ferguson
028: */
029:
030: package com.caucho.jsp.cfg;
031:
032: import com.caucho.config.program.ConfigProgram;
033: import com.caucho.server.webapp.WebApp;
034: import com.caucho.vfs.Path;
035:
036: import java.util.ArrayList;
037:
038: /**
039: * Configuration for the taglib in the .tld
040: */
041: public class TldPreload {
042: private boolean _isInit;
043:
044: private String _uri;
045: private String _location;
046:
047: private ArrayList<TldListener> _listeners = new ArrayList<TldListener>();
048:
049: private Path _path;
050: private Throwable _configException;
051:
052: /**
053: * Sets the uri
054: */
055: public void setURI(String uri) {
056: _uri = uri;
057: }
058:
059: /**
060: * Gets the uri
061: */
062: public String getURI() {
063: return _uri;
064: }
065:
066: /**
067: * Sets the location
068: */
069: public void setLocation(String location) {
070: _location = location;
071: }
072:
073: /**
074: * Gets the location
075: */
076: public String getLocation() {
077: return _uri;
078: }
079:
080: /**
081: * Adds a listener
082: */
083: public void addListener(TldListener listener) {
084: _listeners.add(listener);
085: }
086:
087: /**
088: * Sets the path to the tld.
089: */
090: public void setPath(Path path) {
091: _path = path;
092: }
093:
094: /**
095: * Gets the path.
096: */
097: public Path getPath() {
098: return _path;
099: }
100:
101: /**
102: * Sets any configuration exception
103: */
104: public void setConfigException(Throwable e) {
105: _configException = e;
106: }
107:
108: /**
109: * Gets any configuration exception
110: */
111: public Throwable getConfigException() {
112: return _configException;
113: }
114:
115: /**
116: * Ignores unknown options.
117: */
118: public void addBuilderProgram(ConfigProgram program) {
119: }
120:
121: /**
122: * Applies the listeners.
123: */
124: public void initListeners(WebApp app)
125: throws InstantiationException, IllegalAccessException {
126: if (app == null)
127: return;
128:
129: for (int i = 0; i < _listeners.size(); i++) {
130: TldListener listener = _listeners.get(i);
131:
132: listener.register(app);
133: }
134: }
135:
136: public boolean isJsf() {
137: return false;
138: }
139:
140: public String toString() {
141: return "TldPreload[" + _path + "]";
142: }
143: }
|