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;
 
 
 
 public class CorbaServerConduit implements Conduit {
 
     private EndpointInfo endpointInfo;
     private EndpointReferenceType target;
     private ORB orb;
     private CorbaTypeMap typeMap;
     private org.omg.CORBA.Object targetObject;
 
     public CorbaServerConduit(EndpointInfo ei,
                               EndpointReferenceType ref,
                               org.omg.CORBA.Object targetObj,
                               ORB o,
                               OrbConfig config,
                               CorbaTypeMap map) {
          = ei;
          = getTargetReference(ref);
         if (o == null) {
              = CorbaBindingHelper.getDefaultORB(config);
         } else {
              = o;
         }
          = map;
          = targetObj;
     }
 
     public void prepare(Message messagethrows IOException {
         message.put(.);
         message.setContent(OutputStream.classnew CorbaOutputStream(message));
         if (message instanceof CorbaMessage) {
             ((CorbaMessagemessage).setCorbaTypeMap();
         }
     }
 
     public void close(Message messagethrows IOException {        
         if (message instanceof CorbaMessage) {
             buildRequestResult((CorbaMessage)message);
         }
         message.getContent(OutputStream.class).close();
     }
 
     public EndpointReferenceType getTarget() {
         return ;
     }
 
     public void close() {
     }
 
     public void setMessageObserver(MessageObserver observer) {
     }
     public MessageObserver getMessageObserver() {
         return null;
     }
 
         EndpointReferenceType ref = null;
         if (null == t) {
             ref = new EndpointReferenceType();
            AttributedURIType address = new AttributedURIType();
            address.setValue(getAddress());
            ref.setAddress(address);
        } else {
            ref = t;
        }
        return ref;
    }
    public final String getAddress() {
        return .getAddress();
    }
    
    
    public void buildRequestResult(CorbaMessage msg) {        
        Exchange exg = msg.getExchange();        
        ServerRequest request = exg.get(ServerRequest.class);
        try {
            if (!exg.isOneWay()) {                
                CorbaMessage inMsg = (CorbaMessage)msg.getExchange().getInMessage();
                NVList list = inMsg.getList();
                if (msg.getStreamableException() != null) {                    
                    Any exAny = CorbaAnyHelper.createAny();
                    CorbaStreamable exception = msg.getStreamableException();
                    exAny.insert_Streamable(exception);
                    request.set_exception(exAny);
                    if (msg.getExchange() != null) {
                        msg.getExchange().setOutFaultMessage(msg);
                    }
                } else {
                    CorbaStreamable[] arguments = msg.getStreamableArguments();
                    if (arguments != null) {
                        for (int i = 0; i < arguments.length; ++i) {
                            if (list.item(i).flags() != ....) {
                                arguments[i].getObject().setIntoAny(list.item(i).value(),
                                                                    arguments[i], true);
                            }   
                        }
                    }
                    CorbaStreamable resultValue = msg.getStreamableReturn();
                    if (resultValue != null) {
                        Any resultAny = CorbaAnyHelper.createAny();
                        resultValue.getObject().setIntoAny(resultAnyresultValuetrue);
                        request.set_result(resultAny);
                    }
                }
            }
        } catch (java.lang.Exception ex) {
            throw new CorbaBindingException("Exception during buildRequestResult"ex);
        }
    }        
    
    private class CorbaOutputStream extends CachedOutputStream {
        
        CorbaOutputStream(Message m) {
        }

        
Perform any actions required on stream flush (freeze headers, reset output stream ... etc.)
        public void doFlush() throws IOException {
            // do nothing here
        }

        
Perform any actions required on stream closure (handle response etc.)
        public void doClose() throws IOException {
        }
        public void onWrite() throws IOException {
        }
    }
New to GrepCode? Check out our FAQ X