1 /*
   2  * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.corba.se.impl.legacy.connection;
  27 
  28 import com.sun.corba.se.pept.transport.Connection;
  29 
  30 import com.sun.corba.se.spi.orb.ORB;
  31 import com.sun.corba.se.spi.ior.IOR;
  32 import com.sun.corba.se.spi.logging.CORBALogDomains;
  33 import com.sun.corba.se.spi.transport.CorbaContactInfoList;
  34 import com.sun.corba.se.spi.transport.SocketInfo;
  35 
  36 import com.sun.corba.se.impl.logging.ORBUtilSystemException;
  37 import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
  38 
  39 
  40 /**
  41  * @author Harold Carr
  42  */
  43 public class SocketFactoryContactInfoImpl
  44     extends
  45         SocketOrChannelContactInfoImpl
  46 {
  47     protected ORBUtilSystemException wrapper;
  48     protected SocketInfo socketInfo;
  49 
  50     // XREVISIT
  51     // See SocketOrChannelAcceptorImpl.createMessageMediator
  52     // See SocketFactoryContactInfoImpl.constructor()
  53     // See SocketOrChannelContactInfoImpl.constructor()
  54     public SocketFactoryContactInfoImpl()
  55     {
  56     }
  57 
  58     public SocketFactoryContactInfoImpl(
  59         ORB orb,
  60         CorbaContactInfoList contactInfoList,
  61         IOR effectiveTargetIOR,
  62         short addressingDisposition,
  63         SocketInfo cookie)
  64     {
  65         super(orb, contactInfoList);
  66         this.effectiveTargetIOR = effectiveTargetIOR;
  67         this.addressingDisposition = addressingDisposition;
  68 
  69         wrapper = ORBUtilSystemException.get( orb,
  70             CORBALogDomains.RPC_TRANSPORT ) ;
  71 
  72         socketInfo =
  73             orb.getORBData().getLegacySocketFactory()
  74                 .getEndPointInfo(orb, effectiveTargetIOR, cookie);
  75 
  76         socketType = socketInfo.getType();
  77         hostname = socketInfo.getHost();
  78         port = socketInfo.getPort();
  79     }
  80 
  81     ////////////////////////////////////////////////////
  82     //
  83     // pept.transport.ContactInfo
  84     //
  85 
  86     public Connection createConnection()
  87     {
  88         Connection connection =
  89             new SocketFactoryConnectionImpl(
  90                 orb, this,
  91                 orb.getORBData().connectionSocketUseSelectThreadToWait(),
  92                 orb.getORBData().connectionSocketUseWorkerThreadForEvent());
  93         return connection;
  94     }
  95 
  96     ////////////////////////////////////////////////////
  97     //
  98     // java.lang.Object
  99     //
 100 
 101     public String toString()
 102     {
 103         return
 104             "SocketFactoryContactInfoImpl["
 105             + socketType + " "
 106             + hostname + " "
 107             + port
 108             + "]";
 109     }
 110 }
 111 
 112 // End of file.