001 package railo.runtime.extension; 002 003 import java.net.MalformedURLException; 004 import java.net.URL; 005 006 public class ExtensionProviderImpl implements ExtensionProvider { 007 008 009 //private String name; 010 private URL url; 011 private String strUrl; 012 private boolean readOnly; 013 014 public ExtensionProviderImpl(URL url, boolean readOnly) { 015 //this.name = name; 016 this.url = url; 017 this.readOnly=readOnly; 018 } 019 020 public ExtensionProviderImpl(String strUrl, boolean readOnly) { 021 //this.name = name; 022 this.strUrl=strUrl; 023 this.readOnly=readOnly; 024 } 025 026 /** 027 * @return the url 028 * @throws MalformedURLException 029 */ 030 public URL getUrl() throws MalformedURLException { 031 if(url==null)url=new URL(strUrl); 032 return url; 033 } 034 035 public String getUrlAsString() { 036 if(strUrl!=null) return strUrl; 037 return url.toExternalForm(); 038 } 039 040 public boolean isReadOnly() { 041 return readOnly; 042 } 043 044 /** 045 * @see java.lang.Object#toString() 046 */ 047 public String toString() { 048 return "url:"+getUrlAsString()+";"; 049 } 050 051 public int hashCode() { 052 return toString().hashCode(); 053 } 054 055 public boolean equals(Object obj) { 056 //if(!(obj instanceof ExtensionProvider))return false; 057 058 return toString().equals(obj.toString()); 059 } 060 061 }