本文整理汇总了Java中javax.rmi.CORBA.Util.getCodebase方法的典型用法代码示例。如果您正苦于以下问题:Java Util.getCodebase方法的具体用法?Java Util.getCodebase怎么用?Java Util.getCodebase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.rmi.CORBA.Util
的用法示例。
在下文中一共展示了Util.getCodebase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: implementation
import javax.rmi.CORBA.Util; //导入方法依赖的package包/类
public String implementation (String x){
try{
// default to using the current ORB version in case the
// vhandler is not set
if (vhandler == null) {
vhandler = ValueHandlerImpl.getInstance(false);
}
// Util.getCodebase may return null which would
// cause a BAD_PARAM exception.
String result = Util.getCodebase(vhandler.getClassFromType(x));
if (result == null)
return "";
else
return result;
} catch(ClassNotFoundException cnfe){
throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE,
cnfe ) ;
}
}
示例2: implementation
import javax.rmi.CORBA.Util; //导入方法依赖的package包/类
public String implementation (String x){
try{
// default to using the current ORB version in case the
// vhandler is not set
if (vhandler == null) {
vhandler = new ValueHandlerImpl(false);
}
// Util.getCodebase may return null which would
// cause a BAD_PARAM exception.
String result = Util.getCodebase(vhandler.getClassFromType(x));
if (result == null)
return "";
else
return result;
} catch(ClassNotFoundException cnfe){
throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE,
cnfe ) ;
}
}
示例3: getHelper
import javax.rmi.CORBA.Util; //导入方法依赖的package包/类
/**
* Get the helper for an IDLValue
*
* Throws MARSHAL exception if no helper found.
*/
public static BoxedValueHelper getHelper(Class clazz, String codebase,
String repId)
{
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 wrapper.unableLocateValueHelper(
CompletionStatus.COMPLETED_MAYBE);
}
try {
ClassLoader clazzLoader =
(clazz == null ? null : clazz.getClassLoader());
Class helperClass =
loadClassForClass(className+"Helper", codebase, clazzLoader,
clazz, clazzLoader);
return (BoxedValueHelper)helperClass.newInstance();
} catch (ClassNotFoundException cnfe) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
cnfe );
} catch (IllegalAccessException iae) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
iae );
} catch (InstantiationException ie) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
ie );
} catch (ClassCastException cce) {
throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
cce );
}
}
示例4: getFactory
import javax.rmi.CORBA.Util; //导入方法依赖的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);
}
}
示例5: writeIDLEntity
import javax.rmi.CORBA.Util; //导入方法依赖的package包/类
private void writeIDLEntity(IDLEntity object) {
// _REVISIT_ could check to see whether chunking really needed
mustChunk = true;
String repository_id = repIdStrs.createForJavaType(object);
Class clazz = object.getClass();
String codebase = Util.getCodebase(clazz);
// Write value_tag
int indirection = writeValueTag(true, true, codebase);
updateIndirectionTable(indirection, object, object);
// Write rep. id
write_repositoryId(repository_id);
// Write Value chunk
end_flag--;
chunkedValueNestingLevel--;
start_block();
// Write the IDLEntity using reflection
try {
ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader());
final Class helperClass = Utility.loadClassForClass(clazz.getName()+"Helper", codebase,
clazzLoader, clazz, clazzLoader);
final Class argTypes[] = {org.omg.CORBA.portable.OutputStream.class, clazz};
// getDeclaredMethod requires RuntimePermission accessDeclaredMembers
// if a different class loader is used (even though the javadoc says otherwise)
Method writeMethod = null;
try {
writeMethod = (Method)AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public java.lang.Object run() throws NoSuchMethodException {
return helperClass.getDeclaredMethod(kWriteMethod, argTypes);
}
}
);
} catch (PrivilegedActionException pae) {
// this gets caught below
throw (NoSuchMethodException)pae.getException();
}
java.lang.Object args[] = {parent, object};
writeMethod.invoke(null, args);
} catch (ClassNotFoundException cnfe) {
throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, cnfe ) ;
} catch(NoSuchMethodException nsme) {
throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, nsme ) ;
} catch(IllegalAccessException iae) {
throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, iae ) ;
} catch(InvocationTargetException ite) {
throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, ite ) ;
}
end_block();
// Write end tag
writeEndTag(true);
}