类org.omg.CORBA.UserException源码实例Demo

下面列出了怎么用org.omg.CORBA.UserException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: cxf   文件: Server.java
static int run(ORB orb, String[] args) throws UserException {
    //
    // Resolve Root POA
    //
    POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

    //
    // Get a reference to the POA manager
    //
    POAManager manager = poa.the_POAManager();

    //
    // Create implementation object
    //
    BankImpl bankImpl = new BankImpl(poa);

    byte[] oid = "Bank".getBytes();
    poa.activate_object_with_id(oid, bankImpl);

    org.omg.CORBA.Object ref = poa.create_reference_with_id(oid, BankHelper.id());

    // Register in NameService
    org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
    NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
    NameComponent[] nc = rootContext.to_name("Bank");
    rootContext.rebind(nc, ref);

    //
    // Run implementation
    //
    manager.activate();
    System.out.println("Server ready...");
    orb.run();

    return 0;
}
 
源代码2 项目: cxf   文件: Client.java
static int run(ORB orb, String[] args) throws UserException {

        // Get "hello" object
        // Resolve the HelloWorldImpl by using INS's corbaname url.
        // The URL locates the NameService running on localhost
        // and listening on 1050 and resolve 'HelloWorld'
        // from that NameService
        org.omg.CORBA.Object obj = orb.string_to_object("corbaname::localhost:1050#HelloWorld");

        if (obj == null) {
            System.err.println("Client: Could not resolve target object");
            return 1;
        }

        HelloWorld hello = HelloWorldHelper.narrow(obj);

        // Test our narrowed "hello" object
        System.out.println("Invoking greetMe...");
        String result = null;
        if (args.length > 0) {
            result = hello.greetMe(args[args.length - 1]);
        } else {
            result = hello.greetMe("World");
        }
        System.out.println("greetMe.result = " + result);

        return 0;
    }
 
源代码3 项目: cxf   文件: Server.java
static int run(ORB orb, String[] args) throws UserException {
    // Resolve Root POA
    POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

    // Get a reference to the POA manager
    POAManager manager = poa.the_POAManager();

    // Create implementation object
    HelloWorldImpl hwImpl = new HelloWorldImpl(poa);

    byte[] oid = "HelloWorld".getBytes();
    poa.activate_object_with_id(oid, hwImpl);

    org.omg.CORBA.Object ref = poa.create_reference_with_id(oid, HelloWorldHelper.id());

    // Register in NameService
    org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
    NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
    NameComponent[] nc = rootContext.to_name("HelloWorld");
    rootContext.rebind(nc, ref);

    // Run implementation
    manager.activate();
    System.out.println("Server ready...");
    orb.run();

    return 0;
}
 
源代码4 项目: jdk1.8-source-analysis   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码5 项目: TencentKona-8   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码6 项目: jdk8u60   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码7 项目: JDKSourceCode1.8   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码8 项目: openjdk-jdk8u   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码10 项目: openjdk-jdk9   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码11 项目: hottub   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码12 项目: openjdk-8-source   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码13 项目: openjdk-8   文件: PIHandlerImpl.java
public void invokeClientPIStartingPoint()
    throws RemarshalException
{
    if( !hasClientInterceptors ) return;
    if( !isClientPIEnabledForThisThread() ) return;

    // Invoke the starting interception points and record exception
    // and reply status info in the info object:
    ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
    interceptorInvoker.invokeClientInterceptorStartingPoint( info );

    // Check reply status.  If we will not have another chance later
    // to invoke the client ending points, do it now.
    short replyStatus = info.getReplyStatus();
    if( (replyStatus == SYSTEM_EXCEPTION.value) ||
        (replyStatus == LOCATION_FORWARD.value) )
    {
        // Note: Transport retry cannot happen here since this happens
        // before the request hits the wire.

        Exception exception = invokeClientPIEndingPoint(
            convertPIReplyStatusToReplyMessage( replyStatus ),
            info.getException() );
        if( exception == null ) {
            // Do not throw anything.  Otherwise, it must be a
            // SystemException, UserException or RemarshalException.
        } if( exception instanceof SystemException ) {
            throw (SystemException)exception;
        } else if( exception instanceof RemarshalException ) {
            throw (RemarshalException)exception;
        } else if( (exception instanceof UserException) ||
                 (exception instanceof ApplicationException) ) {
            // It should not be possible for an interceptor to throw
            // a UserException.  By asserting instead of throwing the
            // UserException, we need not declare anything but
            // RemarshalException in the throws clause.
            throw wrapper.exceptionInvalid() ;
        }
    }
    else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) {
        throw wrapper.replyStatusNotInit() ;
    }
}
 
源代码14 项目: cxf   文件: Client.java
static int run(ORB orb, String[] args) throws UserException {

        // Get the Bank object
        org.omg.CORBA.Object obj =
            orb.string_to_object("corbaname::localhost:1050#Bank");
        if (obj == null) {
            System.err.println("bank.Client: cannot read IOR from corbaname::localhost:1050#Bank");
            return 1;
        }
        Bank bank = BankHelper.narrow(obj);


        // Test the method Bank.create_account()
        System.out.println("Creating account called \"Account1\"");
        Account account1 = bank.create_account("Account1");
        System.out.println("Depositing 100.00 into account \"Account1\"");
        account1.deposit(100.00f);
        System.out.println("Current balance of \"Account1\" is " + account1.get_balance());
        System.out.println();

        // Test the method Bank.create_epr_account()
        System.out.println("Creating account called \"Account2\"");
        org.omg.CORBA.Object account2Obj = bank.create_epr_account("Account2");
        Account account2 = AccountHelper.narrow(account2Obj);
        System.out.println("Depositing 5.00 into account \"Account2\"");
        account2.deposit(5.00f);
        System.out.println("Current balance of \"Account2\" is " + account2.get_balance());
        System.out.println();

        // Create two more accounts to use with the getAccount calls
        Account acc3 = bank.create_account("Account3");
        acc3.deposit(200.00f);
        Account acc4 = bank.create_account("Account4");
        acc4.deposit(400.00f);

        // Test the method Bank.get_account()
        System.out.println("Retrieving account called \"Account3\"");
        Account account3 = bank.get_account("Account3");
        System.out.println("Current balance for \"Account3\" is " + account3.get_balance());
        System.out.println("Depositing 10.00 into account \"Account3\"");
        account3.deposit(10.00f);
        System.out.println("New balance for account \"Account3\" is " + account3.get_balance());
        System.out.println();

        // Test the method Bank.get_epr_account()
        System.out.println("Retrieving account called \"Account4\"");
        Account account4 = bank.get_account("Account4");
        System.out.println("Current balance for \"Account4\" is " + account4.get_balance());
        System.out.println("Withdrawing 150.00 into account \"Account4\"");
        account4.deposit(-150.00f);
        System.out.println("New balance for account \"Account4\" is " + account4.get_balance());
        System.out.println();

        bank.remove_account("Account1");
        bank.remove_account("Account2");
        bank.remove_account("Account3");
        bank.remove_account("Account4");

        return 0;
    }
 
 类所在包
 类方法
 同包方法