001 package railo.runtime.db; 002 003 import railo.runtime.type.Struct; 004 005 /** 006 * interface for a datasource 007 */ 008 public interface DataSource extends Cloneable { 009 010 /** 011 * Field <code>ALLOW_SELECT</code> 012 */ 013 public static final int ALLOW_SELECT = 1; 014 015 /** 016 * Field <code>ALLOW_DELETE</code> 017 */ 018 public static final int ALLOW_DELETE = 2; 019 020 /** 021 * Field <code>ALLOW_UPDATE</code> 022 */ 023 public static final int ALLOW_UPDATE = 4; 024 025 /** 026 * Field <code>ALLOW_INSERT</code> 027 */ 028 public static final int ALLOW_INSERT = 8; 029 030 /** 031 * Field <code>ALLOW_CREATE</code> 032 */ 033 public static final int ALLOW_CREATE = 16; 034 035 /** 036 * Field <code>ALLOW_GRANT</code> 037 */ 038 public static final int ALLOW_GRANT = 32; 039 040 /** 041 * Field <code>ALLOW_REVOKE</code> 042 */ 043 public static final int ALLOW_REVOKE = 64; 044 045 /** 046 * Field <code>ALLOW_DROP</code> 047 */ 048 public static final int ALLOW_DROP = 128; 049 050 /** 051 * Field <code>ALLOW_ALTER</code> 052 */ 053 public static final int ALLOW_ALTER = 256; 054 055 /** 056 * Field <code>ALLOW_ALL</code> 057 */ 058 public static final int ALLOW_ALL = ALLOW_SELECT + ALLOW_DELETE 059 + ALLOW_UPDATE + ALLOW_INSERT + ALLOW_CREATE + ALLOW_GRANT 060 + ALLOW_REVOKE + ALLOW_DROP + ALLOW_ALTER; 061 062 /** 063 * @return Returns the dsn. 064 */ 065 public abstract String getDsnOriginal(); 066 067 /** 068 * @return Returns the dsn. 069 */ 070 public abstract String getDsnTranslated(); 071 072 /** 073 * @return Returns the password. 074 */ 075 public abstract String getPassword(); 076 077 /** 078 * @return Returns the username. 079 */ 080 public abstract String getUsername(); 081 082 /** 083 * @return Returns the readOnly. 084 */ 085 public abstract boolean isReadOnly(); 086 087 /** 088 * @param allow 089 * @return returns if given allow exists 090 */ 091 public abstract boolean hasAllow(int allow); 092 093 /** 094 * @return Returns the clazz. 095 */ 096 public abstract Class getClazz(); 097 098 /** 099 * @return Returns the database. 100 */ 101 public abstract String getDatabase(); 102 103 /** 104 * @return Returns the port. 105 */ 106 public abstract int getPort(); 107 108 /** 109 * @return Returns the host. 110 */ 111 public abstract String getHost(); 112 113 /** 114 * @return cloned Object 115 */ 116 public abstract Object clone(); 117 118 /** 119 * @return clone the DataSource as ReadOnly 120 */ 121 public abstract DataSource cloneReadOnly(); 122 123 /** 124 * @return Returns the blob. 125 */ 126 public abstract boolean isBlob(); 127 128 /** 129 * @return Returns the clob. 130 */ 131 public abstract boolean isClob(); 132 133 /** 134 * @return Returns the connectionLimit. 135 */ 136 public abstract int getConnectionLimit(); 137 138 /** 139 * @return Returns the connectionTimeout. 140 */ 141 public abstract int getConnectionTimeout(); 142 143 /** 144 * @param key 145 * @return Returns matching custom value or null if not exists. 146 */ 147 public abstract String getCustomValue(String key); 148 149 /** 150 * @return returns all custom names 151 */ 152 public abstract String[] getCustomNames(); 153 154 /** 155 * @return returns custom 156 */ 157 public abstract Struct getCustoms(); 158 159 /** 160 * @return returns if database has a SQL restriction 161 */ 162 public abstract boolean hasSQLRestriction(); 163 164 /** 165 * @return Returns the name. 166 */ 167 public abstract String getName(); 168 169 /** 170 * @param clazz The clazz to set. 171 */ 172 public abstract void setClazz(Class clazz); 173 174 // FUTURE public abstract boolean isStorage(); 175 176 // FUTURE public abstract boolean validate(); 177 178 //public abstract int getMaxConnection(); 179 180 }