本文整理汇总了Java中org.omg.CORBA.portable.ValueFactory类的典型用法代码示例。如果您正苦于以下问题:Java ValueFactory类的具体用法?Java ValueFactory怎么用?Java ValueFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueFactory类属于org.omg.CORBA.portable包,在下文中一共展示了ValueFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lookup_value_factory
import org.omg.CORBA.portable.ValueFactory; //导入依赖的package包/类
/**
* 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 ;
}
示例2: readIDLValue
import org.omg.CORBA.portable.ValueFactory; //导入依赖的package包/类
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);
}
示例3: register_value_factory
import org.omg.CORBA.portable.ValueFactory; //导入依赖的package包/类
/**
* 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);
}
示例4: register_value_factory
import org.omg.CORBA.portable.ValueFactory; //导入依赖的package包/类
/**
* 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;
}
示例5: getFactory
import org.omg.CORBA.portable.ValueFactory; //导入依赖的package包/类
/**
* 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);
}
}
示例6: to_any
import org.omg.CORBA.portable.ValueFactory; //导入依赖的package包/类
/**
* 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);
}
}
}