当前位置: 首页>>代码示例>>Java>>正文


Java CorbaUtils类代码示例

本文整理汇总了Java中com.sun.jndi.toolkit.corba.CorbaUtils的典型用法代码示例。如果您正苦于以下问题:Java CorbaUtils类的具体用法?Java CorbaUtils怎么用?Java CorbaUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CorbaUtils类属于com.sun.jndi.toolkit.corba包,在下文中一共展示了CorbaUtils类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStateToBind

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
/**
 * Returns the CORBA object for a Remote object.
 * If input is not a Remote object, or if Remote object uses JRMP, return null.
 * If the RMI-IIOP library is not available, throw ConfigurationException.
 *
 * @param orig The object to turn into a CORBA object. If not Remote,
 *             or if is a JRMP stub or impl, return null.
 * @param name Ignored
 * @param ctx The non-null CNCtx whose ORB to use.
 * @param env Ignored
 * @return The CORBA object for <tt>orig</tt> or null.
 * @exception ConfigurationException If the CORBA object cannot be obtained
 *    due to configuration problems, for instance, if RMI-IIOP not available.
 * @exception NamingException If some other problem prevented a CORBA
 *    object from being obtained from the Remote object.
 */
public Object getStateToBind(Object orig, Name name, Context ctx,
    Hashtable<?,?> env) throws NamingException {
    if (orig instanceof org.omg.CORBA.Object) {
        // Already a CORBA object, just use it
        return null;
    }

    if (orig instanceof Remote) {
        // Turn remote object into org.omg.CORBA.Object
        try {
            // Returns null if JRMP; let next factory try
            // CNCtx will eventually throw IllegalArgumentException if
            // no CORBA object gotten
            return
                CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb);
        } catch (ClassNotFoundException e) {
            // RMI-IIOP library not available
            throw new ConfigurationException(
                "javax.rmi packages not available");
        }
    }
    return null; // pass and let next state factory try
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:RemoteToCorba.java

示例2: getStateToBind

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
/**
 * Returns the CORBA object for a Remote object.
 * If input is not a Remote object, or if Remote object uses JRMP, return null.
 * If the RMI-IIOP library is not available, throw ConfigurationException.
 *
 * @param orig The object to turn into a CORBA object. If not Remote,
 *             or if is a JRMP stub or impl, return null.
 * @param name Ignored
 * @param ctx The non-null CNCtx whose ORB to use.
 * @param env Ignored
 * @return The CORBA object for {@code orig} or null.
 * @exception ConfigurationException If the CORBA object cannot be obtained
 *    due to configuration problems, for instance, if RMI-IIOP not available.
 * @exception NamingException If some other problem prevented a CORBA
 *    object from being obtained from the Remote object.
 */
public Object getStateToBind(Object orig, Name name, Context ctx,
    Hashtable<?,?> env) throws NamingException {
    if (orig instanceof org.omg.CORBA.Object) {
        // Already a CORBA object, just use it
        return null;
    }

    if (orig instanceof Remote) {
        // Turn remote object into org.omg.CORBA.Object
        // Returns null if JRMP; let next factory try
        // CNCtx will eventually throw IllegalArgumentException if
        // no CORBA object gotten
        return CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb);
    }
    return null; // pass and let next state factory try
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:RemoteToCorba.java

示例3: initUsingCorbanameUrl

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
/**
 * Initializes using "corbaname" URL (INS 99-12-03)
 */
private String initUsingCorbanameUrl(ORB orb, String url, Hashtable env)
    throws NamingException {
    try {
        CorbanameUrl parsedUrl = new CorbanameUrl(url);

        String corbaloc = parsedUrl.getLocation();
        String cosName = parsedUrl.getStringName();

        if (orb == null) {

            // No ORB instance specified; create one using env and defaults
            orb = CorbaUtils.getOrb(null, -1, env);
            orbTracker = new OrbReuseTracker(orb);
        }
        setOrbAndRootContext(orb, corbaloc);

        return parsedUrl.getStringName();
    } catch (MalformedURLException e) {
        throw new ConfigurationException(e.getMessage());
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:25,代码来源:CNCtx.java

示例4: getDefaultOrb

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
private synchronized static ORB getDefaultOrb() {
    if (_defaultOrb == null) {
        _defaultOrb = CorbaUtils.getOrb(null, -1,
           new Hashtable<String, java.lang.Object>());
    }
    return _defaultOrb;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:CNCtx.java

示例5: Test6852078

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
public Test6852078(String [] args) {

        int capacity = 128;
        ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo( CorbaUtils.getOrb(null, -1, new Hashtable()), bb);
        byte[] tmpBuf;
        tmpBuf = new byte[bbwi.buflen];

        for (int i = 0; i < capacity; i++)
            tmpBuf[i] = bbwi.byteBuffer.get(i);
    }
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:12,代码来源:Test6852078.java

示例6: IiopUrl

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
public IiopUrl(String url) throws MalformedURLException {
    int addrStart;
    boolean oldFormat;

    if (url.startsWith("iiopname://")) {
        oldFormat = false;
        addrStart = 11;
    } else if (url.startsWith("iiop://")) {
        oldFormat = true;
        addrStart = 7;
    } else {
        throw new MalformedURLException("Invalid iiop/iiopname URL: " + url);
    }
    int addrEnd = url.indexOf('/', addrStart);
    if (addrEnd < 0) {
        addrEnd = url.length();
        stringName = "";
    } else {
        stringName = CorbaUtils.decode(url.substring(addrEnd+1));
    }
    addresses = new Vector<>(3);
    if (oldFormat) {
        // Only one host:port part, not multiple
        addresses.addElement(
            new Address(url.substring(addrStart, addrEnd), oldFormat));
    } else {
        StringTokenizer tokens =
            new StringTokenizer(url.substring(addrStart, addrEnd), ",");
        while (tokens.hasMoreTokens()) {
            addresses.addElement(new Address(tokens.nextToken(), oldFormat));
        }
        if (addresses.size() == 0) {
            addresses.addElement(new Address("", oldFormat));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:IiopUrl.java

示例7: CorbanameUrl

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
public CorbanameUrl(String url) throws MalformedURLException {

        if (!url.startsWith("corbaname:")) {
            throw new MalformedURLException("Invalid corbaname URL: " + url);
        }

        int addrStart = 10;  // "corbaname:"

        int addrEnd = url.indexOf('#', addrStart);
        if (addrEnd < 0) {
            addrEnd = url.length();
            stringName = "";
        } else {
            stringName = CorbaUtils.decode(url.substring(addrEnd+1));
        }
        location = url.substring(addrStart, addrEnd);

        int keyStart = location.indexOf('/');
        if (keyStart >= 0) {
            // Has key string
            if (keyStart == (location.length() -1)) {
                location += "NameService";
            }
        } else {
            location += "/NameService";
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:CorbanameUrl.java

示例8: getURLSuffix

import com.sun.jndi.toolkit.corba.CorbaUtils; //导入依赖的package包/类
/**
 * Returns the suffix of the url. The result should be identical to
 * that of calling getRootURLContext().getRemainingName(), but
 * without the overhead of doing anything with the prefix like
 * creating a context.
 *<p>
 * This method returns a Name instead of a String because to give
 * the provider an opportunity to return a Name (for example,
 * for weakly separated naming systems like COS naming).
 *<p>
 * The default implementation uses skips 'prefix', calls
 * CorbaUtils.decode() on it, and returns the result as a single component
 * CompositeName.
 * Subclass should override if this is not appropriate.
 * This method is used only by rename().
 * If rename() is supported for a particular URL scheme,
 * getRootURLContext(), getURLPrefix(), and getURLSuffix()
 * must be in sync wrt how URLs are parsed and returned.
 *<p>
 * For many URL schemes, this method is very similar to URL.getFile(),
 * except getFile() will return a leading slash in the
 * 2nd, 3rd, and 4th cases. For schemes like "ldap" and "iiop",
 * the leading slash must be skipped before the name is an acceptable
 * format for operation by the Context methods. For schemes that treat the
 * leading slash as significant (such as "file"),
 * the subclass must override getURLSuffix() to get the correct behavior.
 * Remember, the behavior must match getRootURLContext().
 *
 * <pre>{@code
 * URL                                     Suffix
 * foo://host:port                         <empty string>
 * foo://host:port/rest/of/name            rest/of/name
 * foo:///rest/of/name                     rest/of/name
 * foo:/rest/of/name                       rest/of/name
 * foo:rest/of/name                        rest/of/name
 * }</pre>
 */
protected Name getURLSuffix(String prefix, String url) throws NamingException {
    String suffix = url.substring(prefix.length());
    if (suffix.length() == 0) {
        return new CompositeName();
    }

    if (suffix.charAt(0) == '/') {
        suffix = suffix.substring(1); // skip leading slash
    }

    try {
        return new CompositeName().add(CorbaUtils.decode(suffix));
    } catch (MalformedURLException e) {
        throw new InvalidNameException(e.getMessage());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:GenericURLContext.java


注:本文中的com.sun.jndi.toolkit.corba.CorbaUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。