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 @Override 045 public String toString() { 046 return "url:"+getUrlAsString()+";"; 047 } 048 049 public int hashCode() { 050 return toString().hashCode(); 051 } 052 053 public boolean equals(Object obj) { 054 //if(!(obj instanceof ExtensionProvider))return false; 055 056 return toString().equals(obj.toString()); 057 } 058 059 }