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;
 
 import java.util.List;
 
 
 
 
     static final String WSDLI_NAMESPACE_URI = "http://www.w3.org/2006/01/wsdl-instance";
     static final String XSI_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema-instance";
                                                "Address");
     static final List<AttributeIS_NIL_OBJ_REF_ATTRS;
     static {
         XMLEventFactory factory = XMLEventFactory.newInstance();
          = new ArrayList<Attribute>();
         .add(factory.createAttribute(new QName("nil""xsi"), "true"));
     }
     private static final String INFER_FROM_TYPE_ID = "InferFromTypeId";
     private static final Logger LOG = LogUtils.getL7dLogger(CorbaObjectReferenceEventProducer.class);
 
     List<AttributerefAttrs;    
        
     public CorbaObjectReferenceEventProducer(CorbaObjectHandler hServiceInfo serviceORB orbRef) {
         CorbaObjectReferenceHandler handler = (CorbaObjectReferenceHandlerh;
          = CorbaUtils.processQName(handler.getName(), service);
          = orbRef;
          = service;
          = null;
 
         if (handler.getReference() == null) {
              = ;
             return;
         }
 
         List<CorbaTypeEventProducerobjRefProducers = new ArrayList<CorbaTypeEventProducer>();
         
         String address = .object_to_string(handler.getReference());
         objRefProducers.add(new CorbaAddressEventProducer(address));
 
         
         // Get the TypeImpl of the object reference so that we can determine the binding
         // needed for this object reference
         org.apache.cxf.binding.corba.wsdl.Object objType =
             (org.apache.cxf.binding.corba.wsdl.Object)handler.getType();
         QName bindingName = objType.getBinding();
         if (bindingName != null) {
             EprMetaData eprInfo = null;
             if (.equalsIgnoreCase(bindingName.getLocalPart())) { 
                 String typeId = CorbaObjectReferenceHelper.extractTypeIdFromIOR(address);
                 if (!StringUtils.isEmpty(typeId)) {
                     eprInfo = getEprMetadataForTypeId(wsdlDeftypeId);
                 } else {
                     .log(."For binding with value \"" + 
                                     + "\" the type_id of the object reference IOR must be set to its most"
                                     + " derived type. It is currently null indicating CORBA:Object."
                                     + " Address Url=" + address); 
                 }
             } else {               
                 eprInfo = getEprMetadataForBindingName(wsdlDefbindingName);
            }
            
            if (eprInfo.isValid()) {
                .log(."Epr metadata " + eprInfo);
                // Create the meta data producer and add its child producers.
                String wsdlLoc = CorbaObjectReferenceHelper.getWSDLLocation(eprInfo.getCandidateWsdlDef());
                CorbaServiceNameEventProducer nameProducer =
                    new CorbaServiceNameEventProducer(eprInfo.getServiceQName(), eprInfo.getPortName());
                QName interfaceName = eprInfo.getBinding().getPortType().getQName();
                CorbaInterfaceNameEventProducer interfaceProducer =
                    new CorbaInterfaceNameEventProducer(interfaceName);
                CorbaMetaDataEventProducer metaProducer =
                    new CorbaMetaDataEventProducer(wsdlLocnameProducerinterfaceProducer);  
                objRefProducers.add(metaProducer);
            }
        }
         = objRefProducers.iterator();
    }
    
    private EprMetaData getEprMetadataForBindingName(Definition wsdlDefQName bindingName) {
        EprMetaData info = getObjectReferenceBinding(wsdlDefbindingName); 
        CorbaObjectReferenceHelper.populateEprInfo(info);
        return info;
    }
    private EprMetaData getEprMetadataForTypeId(Definition wsdlDefString typeId) {        
        EprMetaData info = CorbaObjectReferenceHelper.getBindingForTypeId(typeIdwsdlDef);
        CorbaObjectReferenceHelper.populateEprInfo(info);
        return info;
    }
    public List<AttributegetAttributes() {
        if ( != null) {
            return .getAttributes();
        }
        return ;
    }
    
    protected EprMetaData getObjectReferenceBinding(Definition wsdlDefQName bindingName) {
        EprMetaData info = new EprMetaData();
        Binding wsdlBinding = wsdlDef.getBinding(bindingName);
        
        // If the binding name does not have a namespace associated with it, then we'll need to 
        // get the list of all bindings and compare their local parts against our name.
        if (wsdlBinding == null && bindingName.getNamespaceURI().equals("")
            && !bindingName.getLocalPart().equals("")) {
            Collection<BindingbindingsCollection = CastUtils.cast(wsdlDef.getBindings().values());
            for (Binding b : bindingsCollection) {
                if (b.getQName().getLocalPart().equals(bindingName.getLocalPart())) {
                    wsdlBinding = b;
                    break;
                }
            }
        }
        
        if (wsdlBinding != null) {
            info.setBinding(wsdlBinding);
            info.setCandidateWsdlDef(wsdlDef);
        }
        
        return info;
    }
    // An event producer to handle the production of the Address XML data.
        int state;
        int[] states = {.
                        .
                        .};
        final String address;
        public CorbaAddressEventProducer(String value) {
             = value;
        }
        public String getLocalName() {
            return .getLocalPart();
        }
        public String getText() {
            return ;
        }
        public int next() {
            return [++];
        }
        public QName getName() {
            return ;
        }
        public boolean hasNext() {
            return  < .;
        }
        public List<AttributegetAttributes() {
            return null;
        }
        public List<NamespacegetNamespaces() {
            return null;
        }
    }
    // An event producer to handle the production of the Metadata XML data.  This producer will rely
    // on two additional producers to handle the production of sub-events.
        List<AttributemetaAttrs;
            this(nullsvcnull);
        }
        
        public CorbaMetaDataEventProducer(String location,
                                          CorbaServiceNameEventProducer svc,
                                          CorbaInterfaceNameEventProducer intf) {
             = new QName(."Metadata");
            List<CorbaTypeEventProducermetaDataProducers = new ArrayList<CorbaTypeEventProducer>();
            metaDataProducers.add(svc);
            if (intf != null) {
                metaDataProducers.add(intf);
            }
             = metaDataProducers.iterator();
            
            if (location != null) {
                XMLEventFactory factory = XMLEventFactory.newInstance();
                 = new ArrayList<Attribute>();
                .add(factory.createAttribute(
                        new QName("wsdlLocation""objrefns1"), location));
            }
        }
        public List<AttributegetAttributes() {
            if ( != null) {
                return .getAttributes();
            } else {
                return ;
            }
        }
   
    }
    // An event producer to handle the production of the ServiceName XML data.
        int state;
        int[] states = {.,
                        .,
                        .};
        QName serviceName;
        QName name;
        List<Attributeattributes;
        List<Namespacenamespaces;
        public CorbaServiceNameEventProducer(QName svcString ep) {
             = svc;
                             "ServiceName");
            
            XMLEventFactory factory = XMLEventFactory.newInstance();
             = new ArrayList<Attribute>();
            .add(factory.createAttribute("EndpointName"ep));
             = new ArrayList<Namespace>();
            .add(factory.createNamespace("objrefns2"svc.getNamespaceURI()));
        }
        public String getLocalName() {
            return .getLocalPart();
        }
        public String getText() {
            return .get(0).getPrefix() + ":" + .getLocalPart();
        }
        public int next() {
            return [++];
        }
        public boolean hasNext() {
            return  < .;
        }
        public QName getName() {
            return ;
        }
        public List<AttributegetAttributes() {
            return ;
        }
        public List<NamespacegetNamespaces() {
            return ;
        }
    }
    // An event producer to handle the production of the InterfaceName XML data.
        int state;
        int[] states = {.,
                        .,
                        .};
        QName interfaceName;
        QName name;
        List<Namespacenamespaces;
        public CorbaInterfaceNameEventProducer(QName intf) {
             = intf;
                             "InterfaceName");
            
            XMLEventFactory factory = XMLEventFactory.newInstance();
             = new ArrayList<Namespace>();
            .add(factory.createNamespace("objrefns2"intf.getNamespaceURI()));
        }
        public String getLocalName() {
            return .getLocalPart();
        }
        public String getText() {
            return .get(0).getPrefix() + ":" + .getLocalPart();
        }
        public int next() {
            return [++];
        }
        public boolean hasNext() {
            return  < .;
        }
        public QName getName() {
            return ;
        }
        public List<AttributegetAttributes() {
            return null;
        }
        public List<NamespacegetNamespaces() {
            return ;
        }
    }
New to GrepCode? Check out our FAQ X