Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.apache.cxf.binding.corba.types;
 
 
 
 public class CorbaAnyListener extends AbstractCorbaTypeListener {
 
     private final CorbaTypeMap typeMap;
     private final ORB orb;
     private ServiceInfo serviceInfo;
     private QName containedType;
 
                             CorbaTypeMap map,
                             ORB orbRef,
                             ServiceInfo info) {
         super(h);
          = orbRef;
          = map;
          = info;
     }
 
     public void processStartElement(QName name) {
         if ( == null) {
              = name;
             QName idlType = convertSchemaToIdlType();
              = CorbaHandlerUtils.getTypeListener(name,
                                                                     idlType,
                                                                     ,
                                                                     ,
                                                                     );
 
             .setNamespaceContext();
             CorbaAnyHandler anyHandler = (CorbaAnyHandler);
             // We need an any during the write.  Since we don't have the orb in the writer, create
             // the any here and use it later.
             anyHandler.setValue(.create_any());
             anyHandler.setAnyContainedType(.getCorbaObject());
 
             .processStartElement(name);
         } else {
             .processStartElement(name);
         }
     }
 
     public void processEndElement(QName name) {
         if ( != null) {
             .processEndElement(name);
             CorbaAnyHandler anyHandler = (CorbaAnyHandler);
             anyHandler.setAnyContainedType(.getCorbaObject());
         }
     }
 
     public void processCharacters(String text) {
         if ( == null) {
             // This is the case with a primitive type.  Since there aren't any requests to
             // startElement and endElement, we need to do everything in here.
             QName idlType = convertSchemaToIdlType();
             CorbaTypeListener primitiveListener = CorbaHandlerUtils.getTypeListener(idlType,
                                                                                     idlType,
                                                                                     ,
                                                                                     ,
                                                                                     );
             primitiveListener.setNamespaceContext();
             primitiveListener.processCharacters(text);
 
             CorbaObjectHandler obj = primitiveListener.getCorbaObject();
 
             Any a = .create_any();
             
             CorbaAnyHandler anyHandler = (CorbaAnyHandler);
             anyHandler.setValue(a);
             anyHandler.setAnyContainedType(obj);
        } else {
            .processCharacters(text);
        }
    }
    public void processWriteAttribute(String prefixString namespaceURIString localNameString value) {
        if ("type".equals(localName) && ..equals(namespaceURI)) {
            int index = value.lastIndexOf(':');
            if (index != -1) {
                String pfx = value.substring(0, index);
                String ns = .getNamespaceURI(pfx);
                 = new QName(nsvalue.substring(index + 1), pfx);
            } else {
                 = new QName(value);
            }
        }
    }
    private QName convertSchemaToIdlType(QName schemaType) {
        QName idlType = null;
        if (CorbaAnyHelper.isPrimitiveSchemaType(schemaType)) {
            idlType = CorbaAnyHelper.convertPrimitiveSchemaToIdlType(schemaType);
        } else {
            // The localpart of the schema QName should match the localpart of the type in the CORBA
            // typemap.
            idlType = new QName(.getTargetNamespace(), schemaType.getLocalPart());
        }
        
        return idlType;
    }
New to GrepCode? Check out our FAQ X