KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > util > xml > confix > test > Url


1 package org.sapia.util.xml.confix.test;
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><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
14  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
15  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
16  * </dl>
17  */

18 public class Url implements ObjectCreationCallback{
19     
20     private String JavaDoc _link;
21     
22     public void setLink(String JavaDoc link){
23         _link = link;
24     }
25     
26     public Object JavaDoc onCreate() throws ConfigurationException {
27         if(_link == null){
28             throw new ConfigurationException("'link' not specified for Url");
29         }
30         try{
31         return new URL JavaDoc(_link);
32         }catch(MalformedURLException JavaDoc e){
33             throw new ConfigurationException("Invalid link: " + _link, e);
34         }
35   }
36     
37 }
38
Popular Tags