A CORBA Bean Framework
by David Houlding

Listing One
module StoreServer {
    struct ItemDescription {
        long year;
        string manufacturer;
        string model;
        string description;
    };

    struct ItemRecord {
        ItemDescription description;
        double cost;
    };

    typedef sequence<ItemRecord> ItemSequence;

    interface InventoryServer {
        ItemSequence getItems( in long year, 
                               in boolean includeBefore, 
                               in boolean includeAfter );
        long inventory( in ItemDescription itemDescription );
    };
};

Listing Two
// Load the DynamicRequest bean.
DynamicRequest request = (DynamicRequest) 
    Beans.instantiate( null, "corbabeans.myRequest" );

// Set the input values of the request.
request.setArgumentParameterValue("year",new Integer(1997));
request.setArgumentParameterValue("includeBefore",new Boolean(false));
request.setArgumentParameterValue("includeAfter",new Boolean(false));

// Invoke the request and check the completion status.
request.invoke();
if( request.getStatus() != DynamicRequest.STATUS_OK ) {
    handleError( request );
}

// Process the results of the request.
int numItems=((SequenceParameter)request.getReturnParameter("return" ))
    .getLength();
for( int i = 0; i < numItems; ++i ) {
    System.out.println( request.getReturnParameterValue(
        "return[" + i + "].description.manufacturer" ) );
}

1


