001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.type.scope; 020 021import java.util.Iterator; 022 023import lucee.runtime.PageContext; 024import lucee.runtime.config.ConfigServer; 025import lucee.runtime.dump.DumpData; 026import lucee.runtime.dump.DumpProperties; 027import lucee.runtime.exp.ExpressionException; 028import lucee.runtime.exp.PageException; 029import lucee.runtime.exp.PageRuntimeException; 030import lucee.runtime.type.Collection; 031import lucee.runtime.type.dt.DateTime; 032import lucee.runtime.type.util.StructSupport; 033 034/**d 035 * 036 */ 037public final class ClusterNotSupported extends StructSupport implements Cluster { 038 039 private static final String NOT_SUPPORTED="to enable the cluster scope please install a cluster scope impementation with the help of the extenson manager"; 040 041 @Override 042 public int size() { 043 return 0; 044 } 045 046 @Override 047 public Collection.Key[] keys() { 048 return null; 049 } 050 051 @Override 052 public Object removeEL(Key key) { 053 return null; 054 } 055 056 @Override 057 public Object remove(Key key) throws PageException { 058 throw new ExpressionException(NOT_SUPPORTED); 059 } 060 061 @Override 062 public void clear() { 063 } 064 @Override 065 public Object get(Collection.Key key) throws ExpressionException { 066 throw new ExpressionException(NOT_SUPPORTED); 067 } 068 069 @Override 070 public Object get(Collection.Key key, Object defaultValue) { 071 return defaultValue; 072 } 073 074 @Override 075 public Object set(Key key, Object value) throws ExpressionException { 076 throw new ExpressionException(NOT_SUPPORTED); 077 } 078 079 @Override 080 public Object setEL(Collection.Key key, Object value) { 081 return null; 082 } 083 084 @Override 085 public void setEntry(ClusterEntry entry) { 086 } 087 088 @Override 089 public Iterator<Collection.Key> keyIterator() { 090 return null; 091 } 092 093 @Override 094 public Iterator<String> keysAsStringIterator() { 095 return null; 096 } 097 098 @Override 099 public Iterator<Entry<Key, Object>> entryIterator() { 100 return null; 101 } 102 103 @Override 104 public Iterator<Object> valueIterator() { 105 return null; 106 } 107 108 @Override 109 public boolean isInitalized() { 110 return false; 111 } 112 @Override 113 public void initialize(PageContext pc) { 114 } 115 116 @Override 117 public void release() { 118 } 119 120 @Override 121 public void release(PageContext pc) { 122 } 123 124 @Override 125 public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) { 126 throw new PageRuntimeException(new ExpressionException(NOT_SUPPORTED)); 127 //return new SimpleDumpData(NOT_SUPPORTED); 128 } 129 130 @Override 131 public Collection duplicate(boolean deepCopy) { 132 return new ClusterNotSupported(); 133 } 134 135 136 @Override 137 public boolean containsKey(Collection.Key key) { 138 return false; 139 } 140 141 @Override 142 public boolean containsValue(Object value) { 143 return false; 144 } 145 146 @Override 147 public java.util.Collection values() { 148 return null; 149 } 150 151 @Override 152 public String castToString() throws ExpressionException { 153 throw new ExpressionException(NOT_SUPPORTED); 154 } 155 156 @Override 157 public String castToString(String defaultValue) { 158 return defaultValue; 159 } 160 161 162 @Override 163 public boolean castToBooleanValue() throws ExpressionException { 164 throw new ExpressionException(NOT_SUPPORTED); 165 } 166 167 @Override 168 public Boolean castToBoolean(Boolean defaultValue) { 169 return defaultValue; 170 } 171 172 173 @Override 174 public double castToDoubleValue() throws ExpressionException { 175 throw new ExpressionException(NOT_SUPPORTED); 176 } 177 178 @Override 179 public double castToDoubleValue(double defaultValue) { 180 return defaultValue; 181 } 182 183 184 @Override 185 public DateTime castToDateTime() throws ExpressionException { 186 throw new ExpressionException(NOT_SUPPORTED); 187 } 188 189 @Override 190 public DateTime castToDateTime(DateTime defaultValue) { 191 return defaultValue; 192 } 193 194 public int getType() { 195 return SCOPE_CLUSTER; 196 } 197 public String getTypeAsString() { 198 return "Cluster"; 199 } 200 public int compareTo(String str) throws PageException { 201 throw new ExpressionException(NOT_SUPPORTED); 202 } 203 public int compareTo(boolean b) throws PageException { 204 throw new ExpressionException(NOT_SUPPORTED); 205 } 206 public int compareTo(double d) throws PageException { 207 throw new ExpressionException(NOT_SUPPORTED); 208 } 209 public int compareTo(DateTime dt) throws PageException { 210 throw new ExpressionException(NOT_SUPPORTED); 211 } 212 213 @Override 214 public void broadcast() { 215 //print.out("Cluster#broadcast()"); 216 } 217 218 @Override 219 public void init(ConfigServer configServer) { 220 } 221 222}