Java Code Examples for org.omg.CORBA.portable.ValueFactory

The following are top voted examples for showing how to use org.omg.CORBA.portable.ValueFactory. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 2
Project: openjdk-jdk10   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 3
Project: openjdk9   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 4
Project: lookaside_java-1.8.0-openjdk   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 5
Project: jdk8u_corba   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 6
Project: infobip-open-jdk-8   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 7
Project: openjdk-source-code-learn   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 8
Project: OLD-OpenJDK8   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 9
Project: openjdk-orb   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 10
Project: openjdk-icedtea7   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 11
Project: OpenJSharp   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 12
Project: OpenJSharp   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 13
Project: openjdk-jdk10   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 14
Project: openjdk-jdk10   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 15
Project: openjdk9   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 16
Project: openjdk9   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 17
Project: lookaside_java-1.8.0-openjdk   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 18
Project: lookaside_java-1.8.0-openjdk   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 19
Project: jdk8u_corba   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 20
Project: jdk8u_corba   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 21
Project: javify   File: OrbRestricted.java   View source code 5 votes vote down vote up
/**
 * Register the value factory under the given repository id.
 */
public ValueFactory register_value_factory(String repository_id,
  ValueFactory factory
)
{
  factories.put(repository_id, factory);
  return factory;
}
 
Example 22
Project: jvm-stm   File: OrbRestricted.java   View source code 5 votes vote down vote up
/**
 * Register the value factory under the given repository id.
 */
public ValueFactory register_value_factory(String repository_id,
  ValueFactory factory
)
{
  factories.put(repository_id, factory);
  return factory;
}
 
Example 23
Project: infobip-open-jdk-8   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 24
Project: infobip-open-jdk-8   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 25
Project: openjdk-source-code-learn   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 26
Project: openjdk-source-code-learn   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 27
Project: OLD-OpenJDK8   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 28
Project: OLD-OpenJDK8   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 29
Project: JamVM-PH   File: OrbRestricted.java   View source code 5 votes vote down vote up
/**
 * Register the value factory under the given repository id.
 */
public ValueFactory register_value_factory(String repository_id,
  ValueFactory factory
)
{
  factories.put(repository_id, factory);
  return factory;
}
 
Example 30
Project: openjdk-orb   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 31
Project: openjdk-orb   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 32
Project: classpath   File: OrbRestricted.java   View source code 5 votes vote down vote up
/**
 * Register the value factory under the given repository id.
 */
public ValueFactory register_value_factory(String repository_id,
  ValueFactory factory
)
{
  factories.put(repository_id, factory);
  return factory;
}
 
Example 33
Project: openjdk-icedtea7   File: CDRInputStream_1_0.java   View source code 5 votes vote down vote up
private java.lang.Object readIDLValue(int indirection, String repId,
                                      Class clazz, String codebase)
{
    ValueFactory factory ;

    // Always try to find a ValueFactory first, as required by the spec.
    // There are some complications here in the IDL 3.0 mapping (see 1.13.8),
    // but basically we must always be able to override the DefaultFactory
    // or Helper mappings that are also used.  This appears to be the case
    // even in the boxed value cases.  The original code only did the lookup
    // in the case of class implementing either StreamableValue or CustomValue,
    // but abstract valuetypes only implement ValueBase, and really require
    // the use of the repId to find a factory (including the DefaultFactory).
    try {
        // use new-style OBV support (factory object)
        factory = Utility.getFactory(clazz, codebase, orb, repId);
    } catch (MARSHAL marshal) {
        // XXX log marshal at one of the INFO levels

        // Could not get a factory, so try alternatives
        if (!StreamableValue.class.isAssignableFrom(clazz) &&
            !CustomValue.class.isAssignableFrom(clazz) &&
            ValueBase.class.isAssignableFrom(clazz)) {
            // use old-style OBV support (helper object)
            BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
            if (helper instanceof ValueHelper)
                return readIDLValueWithHelper((ValueHelper)helper, indirection);
            else
                return helper.read_value(parent);
        } else {
            // must be a boxed IDLEntity, so make a reflective call to the
            // helper's static read method...
            return readBoxedIDLEntity(clazz, codebase);
        }
    }

    // If there was no error in getting the factory, use it.
    valueIndirection = indirection;  // for callback
    return factory.read_value(parent);
}
 
Example 34
Project: openjdk-icedtea7   File: ORBImpl.java   View source code 5 votes vote down vote up
/**
 * Registers a value factory for a particular repository ID.
 *
 * @param repositoryID the repository ID.
 * @param factory the factory.
 * @return the previously registered factory for the given repository ID,
 * or null if no such factory was previously registered.
 * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
 **/
public synchronized ValueFactory register_value_factory(String repositoryID,
    ValueFactory factory)
{
    checkShutdownState();

    if ((repositoryID == null) || (factory == null))
        throw omgWrapper.unableRegisterValueFactory() ;

    return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
}
 
Example 35
Project: OpenJSharp   File: Utility.java   View source code 4 votes vote down vote up
/**
 * Get the factory for an IDLValue
 *
 * Throws MARSHAL exception if no factory found.
 */
public static ValueFactory getFactory(Class clazz, String codebase,
                           ORB orb, String repId)
{
    ValueFactory factory = null;
    if ((orb != null) && (repId != null)) {
        try {
            factory = ((org.omg.CORBA_2_3.ORB)orb).lookup_value_factory(
                repId);
        } catch (org.omg.CORBA.BAD_PARAM ex) {
            // Try other way
        }
    }

    String className = null;
    if (clazz != null) {
        className = clazz.getName();
        if (codebase == null)
            codebase = Util.getCodebase(clazz);
    } else {
        if (repId != null)
            className = RepositoryId.cache.getId(repId).getClassName();
        if (className == null) // no repId or unrecognized repId
            throw omgWrapper.unableLocateValueFactory(
                CompletionStatus.COMPLETED_MAYBE);
    }

    // if earlier search found a non-default factory, or the same default
    // factory that loadClassForClass would return, bale out now...
    if (factory != null &&
        (!factory.getClass().getName().equals(className+"DefaultFactory") ||
         (clazz == null && codebase == null)))
        return factory;

    try {
        ClassLoader clazzLoader =
            (clazz == null ? null : clazz.getClassLoader());
        Class factoryClass =
            loadClassForClass(className+"DefaultFactory", codebase,
            clazzLoader, clazz, clazzLoader);
        return (ValueFactory)factoryClass.newInstance();

    } catch (ClassNotFoundException cnfe) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cnfe);
    } catch (IllegalAccessException iae) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, iae);
    } catch (InstantiationException ie) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, ie);
    } catch (ClassCastException cce) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cce);
    }
}
 
Example 36
Project: openjdk-jdk10   File: Utility.java   View source code 4 votes vote down vote up
/**
 * Get the factory for an IDLValue
 *
 * Throws MARSHAL exception if no factory found.
 */
public static ValueFactory getFactory(Class clazz, String codebase,
                           ORB orb, String repId)
{
    ValueFactory factory = null;
    if ((orb != null) && (repId != null)) {
        try {
            factory = ((org.omg.CORBA_2_3.ORB)orb).lookup_value_factory(
                repId);
        } catch (org.omg.CORBA.BAD_PARAM ex) {
            // Try other way
        }
    }

    String className = null;
    if (clazz != null) {
        className = clazz.getName();
        if (codebase == null)
            codebase = Util.getCodebase(clazz);
    } else {
        if (repId != null)
            className = RepositoryId.cache.getId(repId).getClassName();
        if (className == null) // no repId or unrecognized repId
            throw omgWrapper.unableLocateValueFactory(
                CompletionStatus.COMPLETED_MAYBE);
    }

    // if earlier search found a non-default factory, or the same default
    // factory that loadClassForClass would return, bale out now...
    if (factory != null &&
        (!factory.getClass().getName().equals(className+"DefaultFactory") ||
         (clazz == null && codebase == null)))
        return factory;

    try {
        ClassLoader clazzLoader =
            (clazz == null ? null : clazz.getClassLoader());
        Class factoryClass =
            loadClassForClass(className+"DefaultFactory", codebase,
            clazzLoader, clazz, clazzLoader);
        return (ValueFactory)factoryClass.newInstance();

    } catch (ClassNotFoundException cnfe) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cnfe);
    } catch (IllegalAccessException iae) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, iae);
    } catch (InstantiationException ie) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, ie);
    } catch (ClassCastException cce) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cce);
    }
}
 
Example 37
Project: openjdk9   File: Utility.java   View source code 4 votes vote down vote up
/**
 * Get the factory for an IDLValue
 *
 * Throws MARSHAL exception if no factory found.
 */
public static ValueFactory getFactory(Class clazz, String codebase,
                           ORB orb, String repId)
{
    ValueFactory factory = null;
    if ((orb != null) && (repId != null)) {
        try {
            factory = ((org.omg.CORBA_2_3.ORB)orb).lookup_value_factory(
                repId);
        } catch (org.omg.CORBA.BAD_PARAM ex) {
            // Try other way
        }
    }

    String className = null;
    if (clazz != null) {
        className = clazz.getName();
        if (codebase == null)
            codebase = Util.getCodebase(clazz);
    } else {
        if (repId != null)
            className = RepositoryId.cache.getId(repId).getClassName();
        if (className == null) // no repId or unrecognized repId
            throw omgWrapper.unableLocateValueFactory(
                CompletionStatus.COMPLETED_MAYBE);
    }

    // if earlier search found a non-default factory, or the same default
    // factory that loadClassForClass would return, bale out now...
    if (factory != null &&
        (!factory.getClass().getName().equals(className+"DefaultFactory") ||
         (clazz == null && codebase == null)))
        return factory;

    try {
        ClassLoader clazzLoader =
            (clazz == null ? null : clazz.getClassLoader());
        Class factoryClass =
            loadClassForClass(className+"DefaultFactory", codebase,
            clazzLoader, clazz, clazzLoader);
        return (ValueFactory)factoryClass.newInstance();

    } catch (ClassNotFoundException cnfe) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cnfe);
    } catch (IllegalAccessException iae) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, iae);
    } catch (InstantiationException ie) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, ie);
    } catch (ClassCastException cce) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cce);
    }
}
 
Example 38
Project: lookaside_java-1.8.0-openjdk   File: Utility.java   View source code 4 votes vote down vote up
/**
 * Get the factory for an IDLValue
 *
 * Throws MARSHAL exception if no factory found.
 */
public static ValueFactory getFactory(Class clazz, String codebase,
                           ORB orb, String repId)
{
    ValueFactory factory = null;
    if ((orb != null) && (repId != null)) {
        try {
            factory = ((org.omg.CORBA_2_3.ORB)orb).lookup_value_factory(
                repId);
        } catch (org.omg.CORBA.BAD_PARAM ex) {
            // Try other way
        }
    }

    String className = null;
    if (clazz != null) {
        className = clazz.getName();
        if (codebase == null)
            codebase = Util.getCodebase(clazz);
    } else {
        if (repId != null)
            className = RepositoryId.cache.getId(repId).getClassName();
        if (className == null) // no repId or unrecognized repId
            throw omgWrapper.unableLocateValueFactory(
                CompletionStatus.COMPLETED_MAYBE);
    }

    // if earlier search found a non-default factory, or the same default
    // factory that loadClassForClass would return, bale out now...
    if (factory != null &&
        (!factory.getClass().getName().equals(className+"DefaultFactory") ||
         (clazz == null && codebase == null)))
        return factory;

    try {
        ClassLoader clazzLoader =
            (clazz == null ? null : clazz.getClassLoader());
        Class factoryClass =
            loadClassForClass(className+"DefaultFactory", codebase,
            clazzLoader, clazz, clazzLoader);
        return (ValueFactory)factoryClass.newInstance();

    } catch (ClassNotFoundException cnfe) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cnfe);
    } catch (IllegalAccessException iae) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, iae);
    } catch (InstantiationException ie) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, ie);
    } catch (ClassCastException cce) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cce);
    }
}
 
Example 39
Project: jdk8u_corba   File: Utility.java   View source code 4 votes vote down vote up
/**
 * Get the factory for an IDLValue
 *
 * Throws MARSHAL exception if no factory found.
 */
public static ValueFactory getFactory(Class clazz, String codebase,
                           ORB orb, String repId)
{
    ValueFactory factory = null;
    if ((orb != null) && (repId != null)) {
        try {
            factory = ((org.omg.CORBA_2_3.ORB)orb).lookup_value_factory(
                repId);
        } catch (org.omg.CORBA.BAD_PARAM ex) {
            // Try other way
        }
    }

    String className = null;
    if (clazz != null) {
        className = clazz.getName();
        if (codebase == null)
            codebase = Util.getCodebase(clazz);
    } else {
        if (repId != null)
            className = RepositoryId.cache.getId(repId).getClassName();
        if (className == null) // no repId or unrecognized repId
            throw omgWrapper.unableLocateValueFactory(
                CompletionStatus.COMPLETED_MAYBE);
    }

    // if earlier search found a non-default factory, or the same default
    // factory that loadClassForClass would return, bale out now...
    if (factory != null &&
        (!factory.getClass().getName().equals(className+"DefaultFactory") ||
         (clazz == null && codebase == null)))
        return factory;

    try {
        ClassLoader clazzLoader =
            (clazz == null ? null : clazz.getClassLoader());
        Class factoryClass =
            loadClassForClass(className+"DefaultFactory", codebase,
            clazzLoader, clazz, clazzLoader);
        return (ValueFactory)factoryClass.newInstance();

    } catch (ClassNotFoundException cnfe) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cnfe);
    } catch (IllegalAccessException iae) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, iae);
    } catch (InstantiationException ie) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, ie);
    } catch (ClassCastException cce) {
        throw omgWrapper.unableLocateValueFactory(
            CompletionStatus.COMPLETED_MAYBE, cce);
    }
}
 
Example 40
Project: javify   File: gnuDynValue.java   View source code 4 votes vote down vote up
/**
 * Convert into Any.
 */
public Any to_any()
{
  if (isNull)
    {
      Any a0 = createAny();
      a0.type(orb.get_primitive_tc(TCKind.tk_null));
      return a0;
    }
  else
    {
      try
        {
          ValueFactory factory =
            ((org.omg.CORBA_2_3.ORB) orb).lookup_value_factory(official_type.id());
          if (factory == null)
            {
              MARSHAL m = new MARSHAL("Factory for " + official_type.id() +
              " not registered.");
              m.minor = Minor.Factory;
              throw m;
            }

          OutputStream out = orb.create_output_stream();

          for (int i = 0; i < array.length; i++)
            array [ i ].to_any().write_value(out);

          org.omg.CORBA_2_3.portable.InputStream in =
            (org.omg.CORBA_2_3.portable.InputStream) out.create_input_stream();
          Serializable v = factory.read_value(in);

          Any g = createAny();
          g.type(official_type);
          g.insert_Value(v, official_type);

          return g;
        }
      catch (Exception e)
        {
          throw new Unexpected(e);
        }
    }
}