KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > gumby > tags > URLTag


1 package org.sapia.gumby.tags;
2
3 import java.net.MalformedURLException JavaDoc;
4 import java.net.URL JavaDoc;
5
6 import org.sapia.util.xml.confix.ConfigurationException;
7 import org.sapia.util.xml.confix.ObjectCreationCallback;
8
9 /**
10  * @author Yanick Duchesne
11  *
12  * <dl>
13  * <dt><b>Copyright: </b>
14  * <dd>Copyright &#169; 2002-2005 <a HREF="http://www.sapia-oss.org">Sapia Open
15  * Source Software </a>. All Rights Reserved.</dd>
16  * </dt>
17  * <dt><b>License: </b>
18  * <dd>Read the license.txt file of the jar or visit the <a
19  * HREF="http://www.sapia-oss.org/license.html">license page </a> at the Sapia
20  * OSS web site</dd>
21  * </dt>
22  * </dl>
23  */

24 public class URLTag implements ObjectCreationCallback {
25
26   private String JavaDoc _src;
27
28   public void setText(String JavaDoc src) {
29     setSrc(src);
30   }
31
32   public void setSrc(String JavaDoc src) {
33     _src = src;
34   }
35
36   /**
37    * @see org.sapia.util.xml.confix.ObjectCreationCallback#onCreate()
38    */

39   public Object JavaDoc onCreate() throws ConfigurationException {
40     if(_src == null) {
41       throw new ConfigurationException("URL source not specified");
42     }
43     try {
44       return new URL JavaDoc(_src);
45     } catch(MalformedURLException JavaDoc e) {
46       throw new ConfigurationException("Could not create URL object", e);
47     }
48   }
49
50 }
51
Popular Tags