001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.axis.server;
018    
019    import java.io.Externalizable;
020    import java.io.IOException;
021    import java.io.ObjectInput;
022    import java.io.ObjectOutput;
023    import java.util.ArrayList;
024    import java.util.Iterator;
025    import java.util.List;
026    
027    import javax.xml.namespace.QName;
028    
029    import org.apache.axis.constants.Style;
030    import org.apache.axis.constants.Use;
031    import org.apache.axis.description.JavaServiceDesc;
032    import org.apache.axis.description.OperationDesc;
033    import org.apache.axis.description.TypeDesc;
034    import org.apache.axis.encoding.TypeMapping;
035    import org.apache.axis.encoding.TypeMappingRegistry;
036    import org.apache.geronimo.axis.client.TypeInfo;
037    
038    /**
039     * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
040     */
041    public class ReadOnlyServiceDesc extends JavaServiceDesc implements Externalizable {
042        private JavaServiceDesc serviceDesc;
043        private List typeInfo;
044    
045        /**
046         * Only required as Externalizable.
047         */
048        public ReadOnlyServiceDesc() {
049        }
050    
051        public ReadOnlyServiceDesc(JavaServiceDesc serviceDesc, List typeInfo) {
052            this.serviceDesc = serviceDesc;
053            this.typeInfo = typeInfo;
054        }
055    
056        public Class getImplClass() {
057            return serviceDesc.getImplClass();
058        }
059    
060        public void setImplClass(Class implClass) {
061            serviceDesc.setImplClass(implClass);
062        }
063    
064        public ArrayList getStopClasses() {
065            return serviceDesc.getStopClasses();
066        }
067    
068        public void setStopClasses(ArrayList stopClasses) {
069        }
070    
071        public void loadServiceDescByIntrospection() {
072            serviceDesc.loadServiceDescByIntrospection();
073        }
074    
075        public void loadServiceDescByIntrospection(Class implClass) {
076            serviceDesc.loadServiceDescByIntrospection(implClass);
077        }
078    
079        public void loadServiceDescByIntrospection(Class cls, TypeMapping tm) {
080            serviceDesc.loadServiceDescByIntrospection(cls, tm);
081        }
082    
083        public Style getStyle() {
084            return serviceDesc.getStyle();
085        }
086    
087        public void setStyle(Style style) {
088        }
089    
090        public Use getUse() {
091            return serviceDesc.getUse();
092        }
093    
094        public void setUse(Use use) {
095        }
096    
097        public String getWSDLFile() {
098            return serviceDesc.getWSDLFile();
099        }
100    
101        public void setWSDLFile(String wsdlFileName) {
102        }
103    
104        public List getAllowedMethods() {
105            return serviceDesc.getAllowedMethods();
106        }
107    
108        public void setAllowedMethods(List allowedMethods) {
109        }
110    
111        public TypeMapping getTypeMapping() {
112            return serviceDesc.getTypeMapping();
113        }
114    
115        public void setTypeMapping(TypeMapping tm) {
116        }
117    
118        public String getName() {
119            return serviceDesc.getName();
120        }
121    
122        public void setName(String name) {
123        }
124    
125        public String getDocumentation() {
126            return serviceDesc.getDocumentation();
127        }
128    
129        public void setDocumentation(String documentation) {
130        }
131    
132        public void removeOperationDesc(OperationDesc operation) {
133        }
134    
135        public void addOperationDesc(OperationDesc operation) {
136        }
137    
138        public ArrayList getOperations() {
139            return serviceDesc.getOperations();
140        }
141    
142        public OperationDesc[] getOperationsByName(String methodName) {
143            return serviceDesc.getOperationsByName(methodName);
144        }
145    
146        public OperationDesc getOperationByName(String methodName) {
147            return serviceDesc.getOperationByName(methodName);
148        }
149    
150        public OperationDesc getOperationByElementQName(QName qname) {
151            return serviceDesc.getOperationByElementQName(qname);
152        }
153    
154        public OperationDesc[] getOperationsByQName(QName qname) {
155            return serviceDesc.getOperationsByQName(qname);
156        }
157    
158        public void setNamespaceMappings(List namespaces) {
159        }
160    
161        public String getDefaultNamespace() {
162            return serviceDesc.getDefaultNamespace();
163        }
164    
165        public void setDefaultNamespace(String namespace) {
166        }
167    
168        public void setProperty(String name, Object value) {
169            serviceDesc.setProperty(name, value);
170        }
171    
172        public Object getProperty(String name) {
173            return serviceDesc.getProperty(name);
174        }
175    
176        public String getEndpointURL() {
177            return serviceDesc.getEndpointURL();
178        }
179    
180        public void setEndpointURL(String endpointURL) {
181        }
182    
183        public TypeMappingRegistry getTypeMappingRegistry() {
184            return serviceDesc.getTypeMappingRegistry();
185        }
186    
187        public void setTypeMappingRegistry(TypeMappingRegistry tmr) {
188        }
189    
190        public boolean isInitialized() {
191            return serviceDesc.isInitialized();
192        }
193    
194        public boolean isWrapped() {
195            return serviceDesc.isWrapped();
196        }
197    
198        public List getDisallowedMethods() {
199            return serviceDesc.getDisallowedMethods();
200        }
201    
202        public void setDisallowedMethods(List disallowedMethods) {
203        }
204    
205        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
206            typeInfo = (List) in.readObject();
207            
208            // one must register the TypeDesc before to deserialize the JavaServiceDesc
209            // as it contains a bunch of BeanXXXFactory instances which need 
210            // them registered to properly recreate the state of the factories.
211            for (Iterator iter = typeInfo.iterator(); iter.hasNext();) {
212                TypeInfo info = (TypeInfo) iter.next();
213                TypeDesc.registerTypeDescForClass(info.getClazz(), info.buildTypeDesc());
214            }
215            
216            serviceDesc = (JavaServiceDesc) in.readObject();
217        }
218    
219        public void writeExternal(ObjectOutput out) throws IOException {
220            out.writeObject(typeInfo);
221            out.writeObject(serviceDesc);
222        }
223    }