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            @Override
024            public int size() {
025                    return 0;
026            }
027            
028            @Override
029            public Collection.Key[] keys() {
030                    return null;
031            }
032            
033            @Override
034            public Object removeEL(Key key) {
035                    return null;
036            }
037            
038            @Override
039            public Object remove(Key key) throws PageException {
040                throw new ExpressionException(NOT_SUPPORTED);
041            }
042            
043            @Override
044            public void clear() {
045            }
046            @Override
047            public Object get(Collection.Key key) throws ExpressionException {
048                    throw new ExpressionException(NOT_SUPPORTED);
049            }
050    
051            @Override
052            public Object get(Collection.Key key, Object defaultValue) {
053                    return defaultValue;
054            }
055    
056            @Override
057            public Object set(Key key, Object value) throws ExpressionException {
058                    throw new ExpressionException(NOT_SUPPORTED);
059            }
060            
061        @Override
062        public Object setEL(Collection.Key key, Object value) {
063                    return null;
064            }
065            
066            @Override
067            public void setEntry(ClusterEntry entry) {
068            }
069            
070            @Override
071            public Iterator<Collection.Key> keyIterator() {
072                    return null;
073            }
074        
075        @Override
076            public Iterator<String> keysAsStringIterator() {
077            return null;
078        }
079            
080            @Override
081            public Iterator<Entry<Key, Object>> entryIterator() {
082                    return null;
083            }
084            
085            @Override
086            public Iterator<Object> valueIterator() {
087                    return null;
088            }
089    
090            @Override
091            public boolean isInitalized() {
092                    return false;
093            }
094            @Override
095            public void initialize(PageContext pc) {
096            }
097            
098            @Override
099            public void release() {
100            }
101            
102            @Override
103            public void release(PageContext pc) {
104            }
105            
106            @Override
107            public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
108            throw new PageRuntimeException(new ExpressionException(NOT_SUPPORTED));
109                    //return new SimpleDumpData(NOT_SUPPORTED);
110            }
111            
112            @Override
113            public Collection duplicate(boolean deepCopy) {
114                return new ClusterNotSupported();
115            }
116            
117    
118            @Override
119            public boolean containsKey(Collection.Key key) {
120                    return false;
121            }
122    
123            @Override
124            public boolean containsValue(Object value) {
125                    return false;
126            }
127    
128            @Override
129            public java.util.Collection values() {
130                    return null;
131            }
132            
133        @Override
134        public String castToString() throws ExpressionException {
135            throw new ExpressionException(NOT_SUPPORTED);
136        }
137        
138            @Override
139            public String castToString(String defaultValue) {
140                    return defaultValue;
141            }
142    
143    
144        @Override
145        public boolean castToBooleanValue() throws ExpressionException {
146            throw new ExpressionException(NOT_SUPPORTED);
147        }
148        
149        @Override
150        public Boolean castToBoolean(Boolean defaultValue) {
151            return defaultValue;
152        }
153    
154    
155        @Override
156        public double castToDoubleValue() throws ExpressionException {
157            throw new ExpressionException(NOT_SUPPORTED);
158        }
159        
160        @Override
161        public double castToDoubleValue(double defaultValue) {
162            return defaultValue;
163        }
164    
165    
166        @Override
167        public DateTime castToDateTime() throws ExpressionException {
168            throw new ExpressionException(NOT_SUPPORTED);
169        }
170        
171        @Override
172        public DateTime castToDateTime(DateTime defaultValue) {
173            return defaultValue;
174        }
175        
176        public int getType() {
177            return SCOPE_CLUSTER;
178        }
179        public String getTypeAsString() {
180            return "Cluster";
181        }
182            public int compareTo(String str) throws PageException {
183            throw new ExpressionException(NOT_SUPPORTED);
184            }
185            public int compareTo(boolean b) throws PageException {
186            throw new ExpressionException(NOT_SUPPORTED);
187            }
188            public int compareTo(double d) throws PageException {
189            throw new ExpressionException(NOT_SUPPORTED);
190            }
191            public int compareTo(DateTime dt) throws PageException {
192            throw new ExpressionException(NOT_SUPPORTED);
193            }
194    
195            @Override
196            public void broadcast() {
197                    //print.out("Cluster#broadcast()");
198            }
199    
200            @Override
201            public void init(ConfigServer configServer) {
202            }
203    
204    }