001    package railo.runtime.type.scope;
002    
003    import java.util.Iterator;
004    
005    import railo.runtime.PageContext;
006    import railo.runtime.config.ConfigServer;
007    import railo.runtime.dump.DumpData;
008    import railo.runtime.dump.DumpProperties;
009    import railo.runtime.exp.ExpressionException;
010    import railo.runtime.exp.PageException;
011    import railo.runtime.exp.PageRuntimeException;
012    import railo.runtime.type.Collection;
013    import railo.runtime.type.dt.DateTime;
014    import railo.runtime.type.util.StructSupport;
015    
016    /**d
017     * 
018     */
019    public final class ClusterNotSupported extends StructSupport implements Cluster {
020            
021            private static final String NOT_SUPPORTED="to enable the cluster scope please install a cluster scope impementation with the help of the extenson manager";
022            
023            /**
024             * @see railo.runtime.type.Collection#size()
025             */
026            public int size() {
027                    return 0;
028            }
029            /**
030             * @see railo.runtime.type.Collection#keysAsString()
031             */
032            public String[] keysAsString() {
033                    return null;
034            }
035            
036            /**
037             * @see railo.runtime.type.Collection#keys()
038             */
039            public Collection.Key[] keys() {
040                    return null;
041            }
042            
043            /**
044             *
045             * @see railo.runtime.type.Collection#removeEL(railo.runtime.type.Collection.Key)
046             */
047            public Object removeEL(Key key) {
048                    return null;
049            }
050            
051            /**
052             * @see railo.runtime.type.Collection#remove(java.lang.String)
053             */
054            public Object remove(String key) throws ExpressionException {
055                throw new ExpressionException(NOT_SUPPORTED);
056            }
057            
058            /**
059             *
060             * @see railo.runtime.type.Collection#remove(railo.runtime.type.Collection.Key)
061             */
062            public Object remove(Key key) throws PageException {
063                    return remove(key.getString());
064            }
065            
066            /**
067             * @see railo.runtime.type.Collection#clear()
068             */
069            public void clear() {
070            }
071            /**
072             * @see railo.runtime.type.Collection#get(java.lang.String)
073             */
074            public Object get(Collection.Key key) throws ExpressionException {
075                    throw new ExpressionException(NOT_SUPPORTED);
076            }
077    
078            /**
079             *
080             * @see railo.runtime.type.Collection#get(railo.runtime.type.Collection.Key, java.lang.Object)
081             */
082            public Object get(Collection.Key key, Object defaultValue) {
083                    return defaultValue;
084            }
085    
086            /**
087             * @see railo.runtime.type.Collection#set(java.lang.String, java.lang.Object)
088             */
089            public Object set(Key key, Object value) throws ExpressionException {
090                    throw new ExpressionException(NOT_SUPPORTED);
091            }
092            
093        /**
094         * @see railo.runtime.type.Collection#setEL(railo.runtime.type.Collection.Key, java.lang.Object)
095         */
096        public Object setEL(Collection.Key key, Object value) {
097                    return null;
098            }
099            
100            /**
101             * @see railo.runtime.type.scope.Cluster#setEntry(railo.runtime.type.scope.ClusterEntry)
102             */
103            public void setEntry(ClusterEntry entry) {
104            }
105            
106            /**
107             * @see railo.runtime.type.Collection#keyIterator()
108             */
109            public Iterator keyIterator() {
110                    return null;
111            }
112    
113            /**
114             * @see railo.runtime.type.Scope#isInitalized()
115             */
116            public boolean isInitalized() {
117                    return false;
118            }
119            /**
120             * @see railo.runtime.type.Scope#initialize(railo.runtime.PageContext)
121             */
122            public void initialize(PageContext pc) {
123            }
124            /**
125             * @see railo.runtime.type.Scope#release()
126             */
127            public void release() {
128            }
129            
130            /**
131             * @see railo.runtime.dump.Dumpable#toDumpData(railo.runtime.PageContext, int)
132             */
133            public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
134            throw new PageRuntimeException(new ExpressionException(NOT_SUPPORTED));
135                    //return new SimpleDumpData(NOT_SUPPORTED);
136            }
137            
138            /**
139             * @see railo.runtime.type.Collection#duplicate(boolean)
140             */
141            public Collection duplicate(boolean deepCopy) {
142                return new ClusterNotSupported();
143            }
144            
145    
146            /**
147             * @see railo.runtime.type.Collection#containsKey(railo.runtime.type.Collection.Key)
148             */
149            public boolean containsKey(Collection.Key key) {
150                    return false;
151            }
152    
153            /**
154             * @see java.util.Map#containsValue(java.lang.Object)
155             */
156            public boolean containsValue(Object value) {
157                    return false;
158            }
159    
160            /**
161             * @see java.util.Map#values()
162             */
163            public java.util.Collection values() {
164                    return null;
165            }
166            
167        /**
168         * @see railo.runtime.op.Castable#castToString()
169         */
170        public String castToString() throws ExpressionException {
171            throw new ExpressionException(NOT_SUPPORTED);
172        }
173        
174            /**
175             * @see railo.runtime.type.util.StructSupport#castToString(java.lang.String)
176             */
177            public String castToString(String defaultValue) {
178                    return defaultValue;
179            }
180    
181    
182        /**
183         * @see railo.runtime.op.Castable#castToBooleanValue()
184         */
185        public boolean castToBooleanValue() throws ExpressionException {
186            throw new ExpressionException(NOT_SUPPORTED);
187        }
188        
189        /**
190         * @see railo.runtime.op.Castable#castToBoolean(java.lang.Boolean)
191         */
192        public Boolean castToBoolean(Boolean defaultValue) {
193            return defaultValue;
194        }
195    
196    
197        /**
198         * @see railo.runtime.op.Castable#castToDoubleValue()
199         */
200        public double castToDoubleValue() throws ExpressionException {
201            throw new ExpressionException(NOT_SUPPORTED);
202        }
203        
204        /**
205         * @see railo.runtime.op.Castable#castToDoubleValue(double)
206         */
207        public double castToDoubleValue(double defaultValue) {
208            return defaultValue;
209        }
210    
211    
212        /**
213         * @see railo.runtime.op.Castable#castToDateTime()
214         */
215        public DateTime castToDateTime() throws ExpressionException {
216            throw new ExpressionException(NOT_SUPPORTED);
217        }
218        
219        /**
220         * @see railo.runtime.op.Castable#castToDateTime(railo.runtime.type.dt.DateTime)
221         */
222        public DateTime castToDateTime(DateTime defaultValue) {
223            return defaultValue;
224        }
225        
226        public int getType() {
227            return SCOPE_CLUSTER;
228        }
229        public String getTypeAsString() {
230            return "Cluster";
231        }
232            public int compareTo(String str) throws PageException {
233            throw new ExpressionException(NOT_SUPPORTED);
234            }
235            public int compareTo(boolean b) throws PageException {
236            throw new ExpressionException(NOT_SUPPORTED);
237            }
238            public int compareTo(double d) throws PageException {
239            throw new ExpressionException(NOT_SUPPORTED);
240            }
241            public int compareTo(DateTime dt) throws PageException {
242            throw new ExpressionException(NOT_SUPPORTED);
243            }
244    
245            /**
246             * @see railo.runtime.type.scope.Cluster#broadcast()
247             */
248            public void broadcast() {
249                    //print.out("Cluster#broadcast()");
250            }
251    
252            /**
253             * @see railo.runtime.type.scope.Cluster#init(railo.runtime.config.ConfigServer)
254             */
255            public void init(ConfigServer configServer) {
256            }
257    
258    }