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.runtime;
 
 import java.util.List;
 import java.util.Map;
 
 
 
 public class CorbaDSIServant extends DynamicImplementation {
 
     private static final Logger LOG = LogUtils.getL7dLogger(CorbaDSIServant.class);
     private ORB orb;
     private POA servantPOA;    
     private List<Stringinterfaces;
     private MessageObserver incomingObserver;
     private CorbaDestination destination;
     private Map<StringQNameoperationMap;
     private CorbaTypeMap typeMap;
     
     public CorbaDSIServant() {
         //Complete
     }
     
     public void init(ORB theOrb,
                      POA poa,
                      CorbaDestination dest,
                      MessageObserver observer) {
         init(theOrbpoadestobservernull);
     }
 
     public void init(ORB theOrb,
                      POA poa,
                      CorbaDestination dest,
                      MessageObserver observer,
                      CorbaTypeMap map) {
          = theOrb;
          = poa;
          = dest;
          = observer;
          = map;
        
         // Get the list of interfaces that this servant will support
         try {                
             BindingType bindType = .getBindingInfo().getExtensor(BindingType.class);            
             if (bindType == null) {
                 throw new CorbaBindingException("Unable to determine corba binding information");
             }
 
             List<Stringbases = bindType.getBases();
              = new ArrayList<String>();
             .add(bindType.getRepositoryID());
             for (Iterator<Stringiter = bases.iterator(); iter.hasNext();) {
                 .add(iter.next());
             }
         } catch (java.lang.Exception ex) {
             .log(."Couldn't initialize the corba DSI servant");
             throw new CorbaBindingException(ex);
         }
        // Build the list of CORBA operations and the WSDL operations they map to.  Note that
        // the WSDL operation name may not always match the CORBA operation name.
        BindingInfo bInfo = .getBindingInfo();
        Iterator<BindingOperationInfoi = bInfo.getOperations().iterator();
        
         = new HashMap<StringQName>(bInfo.getOperations().size());
        while (i.hasNext()) {
            BindingOperationInfo bopInfo = i.next();
            OperationType opType = bopInfo.getExtensor(OperationType.class);
            if (opType != null) {
                .put(opType.getName(), bopInfo.getName());
            }
        }
    }
    public MessageObserver getObserver() {
        return ;
    }
    
    public void setObserver(MessageObserver observer) {
         = observer;
    }
    
    public ORB getOrb() {
        return ;
    }
    public CorbaDestination getDestination() {
        return ;
    }
    public Map<StringQNamegetOperationMapping() {
        return ;
    }
    public void setOperationMapping(Map<StringQNamemap) {
         = map;
    }
    public void setCorbaTypeMap(CorbaTypeMap map) {
         = map;
    }
    
    public void invoke(ServerRequest requestthrows CorbaBindingException {
        String opName = request.operation();
        QName requestOperation = .get(opName);
        
        MessageImpl msgImpl = new MessageImpl();
        msgImpl.setDestination(getDestination());
        Exchange exg = new ExchangeImpl();
        exg.put(String.classrequestOperation.getLocalPart());
        exg.put(ORB.classgetOrb());
        exg.put(ServerRequest.classrequest);
        msgImpl.setExchange(exg);
        CorbaMessage msg = new CorbaMessage(msgImpl);
        msg.setCorbaTypeMap();
        
        // If there's no output message part in our operation then it's a oneway op
        BindingMessageInfo bindingMsgOutputInfo = null;
        BindingOperationInfo bindingOpInfo = null;
        try {
            bindingOpInfo = this..getEndPointInfo().getBinding().getOperation(requestOperation);
        } catch (Exception ex) {
            throw new CorbaBindingException("Invalid Request. Operation unknown: " + opName);
        }
        if (bindingOpInfo != null) {
            bindingMsgOutputInfo = bindingOpInfo.getOutput();
            if (bindingMsgOutputInfo == null) {
                exg.setOneWay(true);
            } 
        }
        
        // invokes the interceptors
        getObserver().onMessage(msg);
    }
       
    public String[] _all_interfaces(POA poabyte[] objectId) {
        return .toArray(new String[.size()]);
    }
    public POA _default_POA() {
        return ;
    }
New to GrepCode? Check out our FAQ X