本文整理汇总了Java中org.omg.CORBA.SystemException类的典型用法代码示例。如果您正苦于以下问题:Java SystemException类的具体用法?Java SystemException怎么用?Java SystemException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SystemException类属于org.omg.CORBA包,在下文中一共展示了SystemException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadLibrary
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* @deprecated
*/
private static void loadLibrary() {
//--agregar dlls faltantes para utilizar jtwain
String arch = System.getenv("PROCESSOR_ARCHITECTURE");
String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432");
String realArch = arch.endsWith(ARCHITECTURE_X32) || wow64Arch != null && wow64Arch.endsWith(ARCHITECTURE_X32) ? ARCHITECTURE_X32 : "64";
if (System.getProperty("os.name").startsWith("Windows")) {
try {
if (realArch.equals(ARCHITECTURE_X32)) {
System.load(LIB_X32 + NAME);
System.out.println("cargada lib twain x32 ");
} else {
System.load(LIB_X64 + NAME);
System.out.println("cargada lib twain x64 ");
}
} catch (SystemException e) {
System.out.println(e.getMessage());
}
}
}
示例2: addExceptionDetailMessage
import org.omg.CORBA.SystemException; //导入依赖的package包/类
private void addExceptionDetailMessage(CorbaMessageMediator mediator,
SystemException ex,
ServiceContexts serviceContexts)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(baos);
ex.printStackTrace(pw);
pw.flush(); // NOTE: you must flush or baos will be empty.
EncapsOutputStream encapsOutputStream =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
encapsOutputStream.putEndian();
encapsOutputStream.write_wstring(baos.toString());
UnknownServiceContext serviceContext =
new UnknownServiceContext(ExceptionDetailMessage.value,
encapsOutputStream.toByteArray());
serviceContexts.put(serviceContext);
}
示例3: Bind
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* Binds the object to the name component as the specified binding type.
* It creates a InternalBindingKey object and a InternalBindingValue
* object and inserts them in the hash table.
* @param n A single org.omg.CosNaming::NameComponent under which the
* object will be bound.
* @param obj An object reference to be bound under the supplied name.
* @param bt The type of the binding (i.e., as object or as context).
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
* system exceptions.
*/
public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
BindingType bt)
throws org.omg.CORBA.SystemException
{
// Create a key and a value
InternalBindingKey key = new InternalBindingKey(n);
NameComponent[] name = new NameComponent[1];
name[0] = n;
Binding b = new Binding(name,bt);
InternalBindingValue value = new InternalBindingValue(b,null);
value.theObjectRef = obj;
// insert it
InternalBindingValue oldValue =
(InternalBindingValue)this.theHashtable.put(key,value);
if (oldValue != null) {
updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
getName( n ) + " Was Already Bound" );
throw wrapper.transNcBindAlreadyBound() ;
}
if( updateLogger.isLoggable( Level.FINE ) ) {
updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
"Name Component: " + n.id + "." + n.kind );
}
}
示例4: Destroy
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* Destroys the NamingContext.
*/
public void Destroy() throws SystemException
{
// XXX note that orb.disconnect is illegal here, since the
// POA is used. However, there may be some associated state
// that needs to be cleaned up in ServerManagerImpl which we will
// look into further at another time.
/*
// XXX This needs to be replaced by cleaning up the
// file that backs up the naming context. No explicit
// action is necessary at the POA level, since this is
// created with the non-retain policy.
/*
try { orb.disconnect(
theNameServiceHandle.getObjectReferenceFromKey( this.objKey ) );
} catch( org.omg.CORBA.SystemException e ) {
throw e;
} catch( Exception e ) {
throw updateWrapper.transNcDestroyGotEx( e ) ;
}
*/
}
示例5: isLocal
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* The <tt>isLocal</tt> method has the same semantics as the
* ObjectImpl._is_local method, except that it can throw a RemoteException.
* (no it doesn't but the spec says it should.)
*
* The <tt>_is_local()</tt> method is provided so that stubs may determine
* if a particular object is implemented by a local servant and hence local
* invocation APIs may be used.
*
* @param stub the stub to test.
*
* @return The <tt>_is_local()</tt> method returns true if
* the servant incarnating the object is located in the same process as
* the stub and they both share the same ORB instance. The <tt>_is_local()</tt>
* method returns false otherwise. The default behavior of <tt>_is_local()</tt> is
* to return false.
*
* @throws RemoteException The Java to IDL specification does to
* specify the conditions that cause a RemoteException to be thrown.
*/
public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException
{
boolean result = false ;
try {
org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
if (delegate instanceof CorbaClientDelegate) {
// For the Sun ORB
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher() ;
result = lcs.useLocalInvocation( null ) ;
}
} else {
// For a non-Sun ORB
result = delegate.is_local( stub ) ;
}
} catch (SystemException e) {
throw javax.rmi.CORBA.Util.mapSystemException(e);
}
return result ;
}
示例6: wrapException
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* Wraps an exception thrown by an implementation
* method. It returns the corresponding client-side exception.
* @param orig the exception to wrap.
* @return the wrapped exception.
*/
public RemoteException wrapException(Throwable orig)
{
if (orig instanceof SystemException) {
return mapSystemException((SystemException)orig);
}
if (orig instanceof Error) {
return new ServerError("Error occurred in server thread",(Error)orig);
} else if (orig instanceof RemoteException) {
return new ServerException("RemoteException occurred in server thread",
(Exception)orig);
} else if (orig instanceof RuntimeException) {
throw (RuntimeException) orig;
}
if (orig instanceof Exception)
return new UnexpectedException( orig.toString(), (Exception)orig );
else
return new UnexpectedException( orig.toString());
}
示例7: reportException
import org.omg.CORBA.SystemException; //导入依赖的package包/类
public boolean reportException(ContactInfo contactInfo,
RuntimeException ex)
{
this.failureContactInfo = (CorbaContactInfo)contactInfo;
this.failureException = ex;
if (ex instanceof COMM_FAILURE) {
SystemException se = (SystemException) ex;
if (se.completed == CompletionStatus.COMPLETED_NO) {
if (hasNext()) {
return true;
}
if (contactInfoList.getEffectiveTargetIOR() !=
contactInfoList.getTargetIOR())
{
// retry from root ior
updateEffectiveTargetIOR(contactInfoList.getTargetIOR());
return true;
}
}
}
return false;
}
示例8: serverPIHandleExceptions
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* Handles exceptions for the starting and intermediate points for
* server request interceptors. This is common code that has been
* factored out into this utility method.
* <p>
* This method will NOT work for ending points.
*/
private void serverPIHandleExceptions( ServerRequestInfoImpl info )
{
int endingPointCall = info.getEndingPointCall();
if(endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) {
// If a system exception was thrown, throw it to caller:
throw (SystemException)info.getException();
}
else if( (endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) &&
(info.getForwardRequestException() != null) )
{
// If an interceptor throws a forward request, convert it
// into a ForwardException for easier handling:
IOR ior = info.getForwardRequestIOR();
throw new ForwardException( orb, ior );
}
}
示例9: Unbind
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* Deletes the binding with the supplied name. It creates a
* InternalBindingKey and uses it to remove the value associated
* with the key. If nothing is found an exception is thrown, otherwise
* the element is removed from the hash table.
* @param n a NameComponent which is the name to unbind
* @return the object reference bound to the name, or null if not found.
* @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
* system exceptions.
*/
public final org.omg.CORBA.Object Unbind(NameComponent n)
throws org.omg.CORBA.SystemException
{
// Create a key and remove it from the hashtable
InternalBindingKey key = new InternalBindingKey(n);
InternalBindingValue value =
(InternalBindingValue)this.theHashtable.remove(key);
// Return what was found
if (value == null) {
if( updateLogger.isLoggable( Level.FINE ) ) {
updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
" There was no binding with the name " + getName( n ) +
" to Unbind " );
}
return null;
} else {
if( updateLogger.isLoggable( Level.FINE ) ) {
updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
" NameComponent: " + getName( n ) );
}
return value.theObjectRef;
}
}
示例10: isLocal
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* The {@code isLocal} method has the same semantics as the
* ObjectImpl._is_local method, except that it can throw a RemoteException.
* (no it doesn't but the spec says it should.)
*
* The {@code _is_local()} method is provided so that stubs may determine
* if a particular object is implemented by a local servant and hence local
* invocation APIs may be used.
*
* @param stub the stub to test.
*
* @return The {@code _is_local()} method returns true if
* the servant incarnating the object is located in the same process as
* the stub and they both share the same ORB instance. The {@code _is_local()}
* method returns false otherwise. The default behavior of {@code _is_local()} is
* to return false.
*
* @throws RemoteException The Java to IDL specification does to
* specify the conditions that cause a RemoteException to be thrown.
*/
public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException
{
boolean result = false ;
try {
org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
if (delegate instanceof CorbaClientDelegate) {
// For the Sun ORB
CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
ContactInfoList cil = cdel.getContactInfoList() ;
if (cil instanceof CorbaContactInfoList) {
CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher() ;
result = lcs.useLocalInvocation( null ) ;
}
} else {
// For a non-Sun ORB
result = delegate.is_local( stub ) ;
}
} catch (SystemException e) {
throw javax.rmi.CORBA.Util.mapSystemException(e);
}
return result ;
}
示例11: convertCorbaAccessException
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* Convert the given CORBA SystemException that happened during remote access
* to Spring's RemoteAccessException if the method signature does not declare
* RemoteException. Else, return the SystemException wrapped in a RemoteException.
* @param method the invoked method
* @param ex the RemoteException that happened
* @return the exception to be thrown to the caller
*/
private Exception convertCorbaAccessException(SystemException ex, Method method) {
if (ReflectionUtils.declaresException(method, RemoteException.class)) {
// A traditional RMI service: wrap CORBA exceptions in standard RemoteExceptions.
return new RemoteException("Failed to access CORBA service [" + getJndiName() + "]", ex);
}
else {
if (isConnectFailure(ex)) {
return new RemoteConnectFailureException("Could not connect to CORBA service [" + getJndiName() + "]", ex);
}
else {
return new RemoteAccessException("Could not access CORBA service [" + getJndiName() + "]", ex);
}
}
}
示例12: write
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/** Write the service context to an output stream. This method
* must be used for writing the service context to a request or reply
* header.
*/
public void write(OutputStream s, GIOPVersion gv) throws SystemException
{
EncapsOutputStream os =
sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
os.putEndian() ;
writeData( os ) ;
byte[] data = os.toByteArray() ;
s.write_long(getId());
s.write_long(data.length);
s.write_octet_array(data, 0, data.length);
}
示例13: write
import org.omg.CORBA.SystemException; //导入依赖的package包/类
public void write( OutputStream os , GIOPVersion gv)
throws SystemException
{
os.write_long( id ) ;
os.write_long( data.length ) ;
os.write_octet_array( data, 0, data.length ) ;
}
示例14: received_exception_id
import org.omg.CORBA.SystemException; //导入依赖的package包/类
/**
* The CORBA::RepositoryId of the exception to be returned to the client.
*/
public String received_exception_id (){
checkAccess( MID_RECEIVED_EXCEPTION_ID );
if( cachedReceivedExceptionId == null ) {
String result = null;
if( exception == null ) {
// Note: exception should never be null here since we will
// throw a BAD_INV_ORDER if this is not called from
// receive_exception.
throw wrapper.exceptionWasNull() ;
} else if( exception instanceof SystemException ) {
String name = exception.getClass().getName();
result = ORBUtility.repositoryIdOf(name);
} else if( exception instanceof ApplicationException ) {
result = ((ApplicationException)exception).getId();
}
// _REVISIT_ We need to be able to handle a UserException in the
// DII case. How do we extract the ID from a UserException?
cachedReceivedExceptionId = result;
}
return cachedReceivedExceptionId;
}
示例15: reportException
import org.omg.CORBA.SystemException; //导入依赖的package包/类
public boolean reportException(ContactInfo contactInfo,
RuntimeException ex)
{
this.failureContactInfo = (CorbaContactInfo)contactInfo;
this.failureException = ex;
if (ex instanceof org.omg.CORBA.COMM_FAILURE) {
if (ex.getCause() instanceof GetEndPointInfoAgainException) {
socketInfoCookie =
((GetEndPointInfoAgainException) ex.getCause())
.getEndPointInfo();
return true;
}
SystemException se = (SystemException) ex;
if (se.completed == CompletionStatus.COMPLETED_NO) {
if (contactInfoList.getEffectiveTargetIOR() !=
contactInfoList.getTargetIOR())
{
// retry from root ior
contactInfoList.setEffectiveTargetIOR(
contactInfoList.getTargetIOR());
return true;
}
}
}
return false;
}