001: package org.jacorb.orb.iiop;
002:
003: /*
004: * JacORB - a free Java ORB
005: *
006: * Copyright (C) 1999-2004 Gerald Brose
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Library General Public License for more details.
017: *
018: * You should have received a copy of the GNU Library General Public
019: * License along with this library; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: *
022: */
023:
024: import org.apache.avalon.framework.configuration.*;
025:
026: import org.omg.ETF.*;
027:
028: /**
029: * @author Andre Spiegel
030: * @version $Id: IIOPFactories.java,v 1.12 2006/07/27 13:50:35 nick.cross Exp $
031: */
032: public class IIOPFactories extends org.jacorb.orb.etf.FactoriesBase {
033: static {
034: connectionClz = ClientIIOPConnection.class;
035: listenerClz = IIOPListener.class;
036: profileClz = IIOPProfile.class;
037: addressClz = IIOPAddress.class;
038: }
039:
040: /* public Profile demarshal_profile(TaggedProfileHolder tagged_profile,
041: TaggedComponentSeqHolder components)
042: {
043: if (tagged_profile.value.tag != TAG_INTERNET_IOP.value)
044: {
045: throw new org.omg.CORBA.BAD_PARAM
046: ("wrong profile for IIOP transport, tag: "
047: + tagged_profile.value.tag);
048: }
049: else
050: {
051: IIOPProfile result =
052: new IIOPProfile(tagged_profile.value.profile_data);
053: try
054: {
055: result.configure(configuration);
056: }
057: catch(ConfigurationException e)
058: {
059: throw new org.omg.CORBA.INTERNAL("ConfigurationException: " + e.getMessage());
060: }
061:
062: components.value = result.getComponents().asArray();
063: return result;
064: }
065: }*/
066:
067: public int profile_tag() {
068: return org.omg.IOP.TAG_INTERNET_IOP.value;
069: }
070:
071: public Profile decode_corbaloc(String corbaloc) {
072: int colon = corbaloc.indexOf(':');
073: String token = corbaloc.substring(0, colon).toLowerCase();
074: if (token.length() == 0 || "iiop".equals(token)
075: || "ssliop".equals(token)) {
076: IIOPProfile result = new IIOPProfile(corbaloc);
077: try {
078: result.configure(configuration);
079: } catch (ConfigurationException e) {
080: throw new org.omg.CORBA.INTERNAL(
081: "ConfigurationException: " + e);
082: }
083:
084: return result;
085: }
086: return null;
087: }
088:
089: public int match_tag(String address) {
090: if (address == null) {
091: return -1;
092: }
093: int colon = address.indexOf(':');
094: String token = address.substring(0, colon).toLowerCase();
095: if ("iiop".equals(token) || "ssliop".equals(token)) {
096: return colon + 1;
097: }
098: return -1;
099: }
100: }
|