|
|
Request-Level Interceptor API
This chapter documents the following interfaces that you use to implement request-level interceptors, along with their C++ and Java language mappings:
Each of these interfaces is a locality-constrained object. Any attempt to pass a reference outside its locality (that is, its process), or any attempt to externalize an object supporting this interface using the CORBA ORB object_to_string operation, results in the CORBA MARSHAL system exception (CORBA::MARSHAL in C++, org.omg.CORBA.MARSHAL in Java) being raised.
Interceptor Hierarchy
Request-level interceptors are divided into two interfaces, providing separate client- and target-side functionality. The following figure illustrates the inheritance hierarchy of the request-level interceptors supported in WebLogic Enterprise 5.1.
The method signatures for operations on classes derived from the RequestLevelInterceptor interface include parameters for the following interfaces:
Java: com.beasys.RequestLevelInterceptors.ServiceContextList
Java: com.beasys.RequestLevelInterceptors.ServiceContextList
These interfaces are not used in the WebLogic Enterprise 5.1 product. However, they are defined in the WebLogic Enterprise 5.1 product so that you do not need to recompile your WebLogic Enterprise application if an implementation of these interfaces is ever provided in a future release of WebLogic Enterprise. The ORB always passes a nil for the actual argument. You should not attempt to use this argument; doing so will likely end the process with a serious error.
The method signatures for the Java mappings to these interfaces include the following classes, which you also do not use but that are reserved for future compatibility:
NotFound
Interceptors::Interceptor Interface
The Interceptors::Interceptor interface is defined as the base interface of all types of interceptors, including request-level interceptors. This interface contains the set of operations and attributes that are supported by all types of interceptors. The Interceptors::Interceptor interface is defined as an abstract interface; thus an instance of the interface can not be instantiated.
Listing 9-1 OMG IDL for the Interceptors::Interceptor Interface
//File: Interceptors.idl
#ifndef _INTERCEPTORS_IDL
#define _INTERCEPTORS_IDL
#pragma prefix "beasys.com"
module Interceptors
{
native ExceptionValue;
local Interceptor
{
readonly attribute string id; // identifier of interceptor
// called by ORB when interceptor is being shutdown
ShutdownReturnStatus shutdown(
in ShutdownReason reason,
out ExceptionValue excep_val
);
}; // locality constrained
};
#endif /* _INTERCEPTORS_IDL */
C++ Language Mapping
In C++, the implementation of the operations _duplicate, _narrow, and _nil are inherited from the implementation of the CORBA::LocalBase interface provided by the WebLogic Enterprise ORB.
Listing 9-2 C++ Declaration of the Interceptors::Interceptor Interface
#ifndef _INTERCEPTORS_H
#define _INTERCEPTORS_H
#include <string.h>
#include <CORBA.h>
class OBBEXPDLL Interceptors
{
public:
class Interceptor;
typedef Interceptor * Interceptor_ptr;
enum InvokeReturnStatus
{
INVOKE_NO_EXCEPTION,// proceed normally
REPLY_NO_EXCEPTION, // stop proceeding; start reply processing
REPLY_EXCEPTION // stop proceeding; reply with exception
};
enum ResponseReturnStatus
{
RESPONSE_NO_EXCEPTION, // proceed normally
RESPONSE_EXCEPTION
};
enum ShutdownReturnStatus
{
SHUTDOWN_NO_EXCEPTION,
SHUTDOWN_EXCEPTION
};
enum ShutdownReason
{
ORB_SHUTDOWN,
CONNECTION_ABORTED,
RESOURCES_EXCEEDED
};
struct Version
{
CORBA::Octet major_version;
CORBA::Octet minor_version;
};
typedef Version * Version_ptr;
//+
// Abstract base interface for all Interceptors
//-
class OBBEXPDLL Interceptor : public virtual CORBA::LocalBase
{
public:
static Interceptor_ptr _duplicate(Interceptor_ptr obj);
static Interceptor_ptr _narrow(Interceptor_ptr obj);
static Interceptor_ptr _nil();
virtual ShutdownReturnStatus
shutdown( ShutdownReason reason,
CORBA::Exception_ptr & excep_val) = 0;
virtual CORBA::String id() = 0;
protected:
Interceptor();
virtual ~Interceptor();
};
};#endif /* _INTERCEPTORS_H */
Java Language Mapping
This section shows the Java declaration of the Interceptors::Interceptor interface, and also shows the Java declarations for the following classes that are used as parameters in the methods on several request-level interceptor classes:
Listing 9-3 Java Declaration of the Interceptors::Interceptor Interface
package com.beasys.Interceptors;
public interface Interceptor {
String id();
ShutdownReturnStatus shutdown(ShutdownReason reason,
org.omg.CORBA.SystemExceptionHolder excep_val);
}
Listing 9-4 Java Declaration of the com.beasys.Interceptors.Version Class
package com.beasys.Interceptors;
public final class Version {
// instance variables
public byte major_version;
public byte minor_version;
// constructors
public Version();
public Version(byte __major_version, byte __minor_version);
}
Listing 9-5 Java Declaration of the com.beasys.Interceptors.InvokeReturnStatus Class
package com.beasys.Interceptors;
public final class InvokeReturnStatus {
public static final int _INVOKE_NO_EXCEPTION = 0,
_REPLY_NO_EXCEPTION = 1,
_REPLY_EXCEPTION = 2;
public static final InvokeReturnStatus INVOKE_NO_EXCEPTION =
new InvokeReturnStatus(_INVOKE_NO_EXCEPTION);
public static final InvokeReturnStatus REPLY_NO_EXCEPTION =
new InvokeReturnStatus(_REPLY_NO_EXCEPTION);
public static final InvokeReturnStatus REPLY_EXCEPTION =
new InvokeReturnStatus(_REPLY_EXCEPTION);
public int value();
public static final InvokeReturnStatus from_int(int i)
throws org.omg.CORBA.BAD_PARAM;
}
Listing 9-6 Java Declaration of the com.beasys.Interceptors.ResponseReturnStatus Class
package com.beasys.Interceptors;
public final class ResponseReturnStatus {
public static final int _RESPONSE_NO_EXCEPTION = 0,
_RESPONSE_EXCEPTION = 1;
public static final ResponseReturnStatus RESPONSE_NO_EXCEPTION =
new ResponseReturnStatus(_RESPONSE_NO_EXCEPTION);
public static final ResponseReturnStatus RESPONSE_EXCEPTION =
new ResponseReturnStatus(_RESPONSE_EXCEPTION);
public int value();
public static final ResponseReturnStatus from_int(int i)
throws org.omg.CORBA.BAD_PARAM;
}
Listing 9-7 Java Declaration of the com.beasys.Interceptors.ShutdownReason Class
package com.beasys.Interceptors;
public final class ShutdownReason {
public static final int _ORB_SHUTDOWN = 0,
_CONNECTION_ABORTED = 1,
_RESOURCES_EXCEEDED = 2;
public static final ShutdownReason ORB_SHUTDOWN =
new ShutdownReason(_ORB_SHUTDOWN);
public static final ShutdownReason CONNECTION_ABORTED =
new ShutdownReason(_CONNECTION_ABORTED);
public static final ShutdownReason RESOURCES_EXCEEDED =
new ShutdownReason(_RESOURCES_EXCEEDED);
public int value();
public static final ShutdownReason from_int(int i)
throws org.omg.CORBA.BAD_PARAM;
}
Obtains the vendor assigned identity of the interceptor as a string value.
C++ Mapping
virtual CORBA::String id() = 0;
Java Binding
String id();
Parameters
None.
Exceptions
None.
Description
The id accessor operation is used by the ORB to obtain the vendor assigned identity of the interceptor as a string value. This attribute is used primarily for debugging and tracing of operations on the interceptors called by the ORB.
Return Values
In C++, this operation returns a pointer to a null-terminated string containing the identity of the interceptor as assigned by the provider of the interceptor implementation. In Java, this operation returns a null-terminated string that represents the name of the interceptor. The ORB is responsible for freeing the memory associated with the return value.
Interceptor::shutdown
Synopsis
Notifies an implementation of an interceptor that the interceptor is being shut down.
C++ Binding
virtual ShutdownReturnStatus
shutdown( ShutdownReason reason,
CORBA::Exception_ptr & excep_val) = 0;
Java Binding
ShutdownReturnStatus shutdown( ShutdownReason reason,
SystemExceptionHolder excep_val);
Parameters
ORB_SHUTDOWN |
Indicates that the ORB is being shut down. |
RESOURCES_EXCEEDED |
Indicates that resources of the process have been exhausted. |
CONNECTION_ABORTED |
This exception is not reported in WebLogic Enterprise 5.1. |
Exceptions
None.
Description
The shutdown operation is used by the ORB to notify an implementation of an interceptor that the interceptor is being shut down. The ORB destroys the instance of the interceptor once control is returned from the operation back to the ORB.
Return Values
RequestLevelInterceptor::
RequestInterceptor Interface
The RequestLevelInterceptor::RequestInterceptor interface is the base interface of all request-level interceptors. It inherits directly from the Interceptors::Interceptor interface. The RequestLevelInterceptor::RequestInterceptor interface:
The local keyword in OMG IDL indicates that the RequestInterceptor interface is not a normal CORBA object, so it cannot be used as such.
Listing 9-8 OMG IDL for the RequestLevelInterceptor::RequestInterceptor Interface
#ifndef _REQUEST_LEVEL_INTERCEPTOR_IDL
#define _REQUEST_LEVEL_INTERCEPTOR_IDL
#include <orb.idl>
#include <Giop.idl>
#include <Interceptors.idl>
#pragma prefix "beasys.com"
module RequestLevelInterceptor
{
local RequestInterceptor : Interceptors::Interceptor
{
void exception_occurred(
in ReplyContext reply_context,
in ExceptionValue excep_val
);
};
};
#endif /* _REQUEST_LEVEL_INTERCEPTOR_IDL */
C++ Language Mapping
In C++, the implementation of the RequestInterceptor interface inherits from CORBA::LocalBase rather than from CORBA::Object. In C++, CORBA::LocalBase provides an implementation of the operations _duplicate, _narrow, and _nil, similar to those of CORBA::Object.
Listing 9-9 C++ Declaration for the RequestInterceptor Interface
#ifndef _RequestLevelInterceptor_h
#define _RequestLevelInterceptor_h
#include <CORBA.h>
#include <IOP.h>
#include <GIOP.h>
#include <Interceptors.h>
class OBBEXPDLL RequestLevelInterceptor
{
public:
class RequestInterceptor;
typedef RequestInterceptor * RequestInterceptor_ptr;
struct RequestContext
{
Interceptors::Version struct_version;
CORBA::ULong request_id;
CORBA::Octet response_flags;
GIOP::TargetAddress target;
CORBA::String_var interface_id;
CORBA::String_var operation;
RequestContext &operator=(const RequestContext &_obj);
};
typedef RequestContext * RequestContext_ptr;
typedef GIOP::ReplyStatusType_1_2 ReplyStatus;
struct ReplyContext
{
Interceptors::Version struct_version;
CORBA::ULong request_id;
ReplyStatus reply_status;
};
typedef ReplyContext * ReplyContext_ptr;
class OBBEXPDLL RequestInterceptor :
public virtual Interceptors::Interceptor
{
public:
static RequestInterceptor_ptr
_duplicate(RequestInterceptor_ptr obj);
static RequestInterceptor_ptr
_narrow(RequestInterceptor_ptr obj);
inline static RequestInterceptor_ptr _nil() { return 0; }
virtual void
exception_occurred( const ReplyContext & reply_context,
CORBA::Exception_ptr excep_val) = 0;
protected:
RequestInterceptor(CORBA::LocalBase_ptr obj = 0) { }
virtual ~RequestInterceptor(){ }
private:
RequestInterceptor( const RequestInterceptor&) { }
void operator=(const RequestInterceptor&) { }
}; // class RequestInterceptor
#endif /* _RequestLevelInterceptor_h */
Java Language Mapping
Listing 9-10 Java Declaration for the RequestInterceptor Interface
package com.beasys.RequestLevelInterceptor;
public interface RequestInterceptor
extends com.beasys.Interceptors.Interceptor {
void exception_occurred(
com.beasys.RequestLevel.Interceptor.ReplyContext reply_context,
org.omg.CORBA.SystemException excep_val);
}
RequestContext Structure
Synopsis
Contains the information that represents the context in which a request is to be processed.
C++ Binding
struct RequestContext
{
Interceptors::Version struct_version;
CORBA::ULong request_id;
CORBA::Octet response_flags;
GIOP::TargetAddress target;
CORBA::String_var interface_id;
CORBA::String_var operation;
RequestContext &operator=(const RequestContext &_obj);
};
Java Binding
public final class RequestContext {
public com.beasys.Interceptors.Version struct_version;
public int request_id;
public byte response_flags;
public org.omg.CORBA.GIOP.TargetAddress target;
public String interface_id;
public String operation;
public RequestContext();
public RequestContext(
com.beasys.Interceptors.Version __struct_version,
int __request_id,
byte __response_flags,
org.omg.CORBA.GIOP.TargetAddress __target,
String __interface_id,
String __operation);
}
Members
Version Member |
Description |
---|---|
major_version |
Indicates the major version value. The value of this member is incremented anytime a change is made to the contents or layout of a RequestContext that is not backward compatible with previous versions. |
minor_version |
Indicates the minor version value. The value of this member is incremented anytime a change is made to the contents or layout of a RequestContext that is backward compatible with previous versions. |
Discriminator |
Description |
---|---|
KeyAddr |
The object_key field from the transport-specific GIOP profile (for example, from the encapsulated IIOP profile of the IOR for the target object). This value is meaningful only to the server and is not interpreted or modified by the client. |
ProfileAddr |
The transport-specific GIOP profile selected for the target's IOR by the client ORB. Note: In the WebLogic Enterprise 5.1 product, this discriminator value is not supported, but is provided for future support of GIOP 1.2. |
ReferenceAddr |
The full IOR of the target object. The selected_profile_index indicates the transport-specific GIOP profile that was selected by the client ORB. Note: In the WebLogic Enterprise 5.1 product, this discriminator value is not supported, but is provided for future support of GIOP 1.2. |
Description
The RequestContext data object contains the information that represents the context in which a request is to be processed. The context information contained in the RequestContext provides information necessary to coordinate between the processing of a given request and its corresponding reply.
The context information in the RequestContext structure can not be modified by the interceptor implementation. The ORB maintains ownership of the RequestContext and is responsible for freeing any resources associated with the RequestContext when it has completed using it.
ReplyContext Structure
Synopsis
Contains the information that represents the context in which a reply is to be processed.
C++ Binding
struct ReplyContext
{
Interceptors::Version struct_version;
CORBA::ULong request_id;
ReplyStatus reply_status;
};
Java Binding
public final class ReplyContext {
public Interceptors.Version struct_version;
public int request_id;
public org.omg.CORBA.GIOP.ReplyStatusType_1_2 reply_status;
public ReplyContext();
public ReplyContext(
com.beasys.Interceptors.Version __struct_version,
int __request_id,
org.omg.CORBA.GIOP.ReplyStatusType_1_2 __reply_status);
}
Members
Version Member |
Description |
---|---|
major_version |
Indicates the major version value. The value of this member is incremented anytime a change is made to the contents or layout of a ReplyContext that is not backward compatible with previous versions. |
minor_version |
Indicates the minor version value. The value of this member is incremented anytime a change is made to the contents or layout of a ReplyContext that is backward compatible with previous versions. |
Status Value |
Description |
---|---|
NO_EXCEPTION |
Indicates that the requested operation completed successfully and that the value of the arg_stream parameter contains the return values of the operation. |
USER_EXCEPTION |
Indicates that the requested operation failed because of an exception reported by the target object. |
SYSTEM_EXCEPTION |
Indicates that the request operation failed because of an exception reported either by the target object or by the infrastructure. |
LOCATION_FORWARD |
Indicates that the body contains an object reference (IOR). The client ORB is responsible for resending the original request to that (different) object. This resending is transparent to the client program making the request, but the resending is not transparent to the interceptor. |
LOCATION_FORWARD_PERM |
Indicates that the body contains an object reference. The usage is similar to LOCATION_FORWARD, but when used by a server, this value also provides an indication to the client that the client may replace the old IOR with the new IOR. Both the old IOR and the new IOR are valid, but the new IOR is preferred for future use. This resending is transparent to the client program making the request, but the resending is not transparent to the interceptor. |
NEEDS_ADDRESSING_MODE |
Indicates that the body contains a GIOP::AddressingDisposition. The client ORB is responsible for resending the original request using the requested addressing mode. This resending is transparent to the client program making the request, but the resending is not transparent to the interceptor. |
Description
The ReplyContext data object contains the information that represents the context in which a reply is to be processed. The context information contained in the ReplyContext provides information necessary to coordinate between the processing of a given request and its corresponding reply.
The context information in the ReplyContext can not be modified by the interceptor implementation. The ORB maintains ownership of the ReplyContext and is responsible for freeing any resources associated with the ReplyContext when it has completed using it.
RequestInterceptor::exception_occurred
Synopsis
Is called by the ORB to allow the interceptor to clean up any state that the interceptor might have been managing that is specific to a request
C++ Binding
virtual void
exception_occurred( const ReplyContext & reply_context,
CORBA::Exception_ptr excep_val) = 0;
Java Binding
void exception_occurred(
ReplyContext reply_context,
CORBA.SystemException excep_val);
Parameters
Exceptions
None.
Description
The exception_occurred operation is called on a request-level interceptor implementation in one of three cases:
Return Values
None.
RequestLevelInterceptor::
ClientRequestInterceptor Interface
This is the base interface of all request-level interceptors. It inherits directly from the RequestLevelInterceptor::RequestInterceptor interface. The interface contains the set of operations and attributes that are supported by all client-side request-level interceptors.
Listing 9-11 OMG IDL Definition
//File: RequestLevelInterceptor.idl
#ifndef _REQUEST_LEVEL_INTERCEPTOR_IDL
#define _REQUEST_LEVEL_INTERCEPTOR_IDL
#include <orb.idl>
#include <Giop.idl>
#include <Interceptors.idl>
#pragma prefix "beasys.com"
module RequestLevelInterceptor
{
local ClientRequestInterceptor : RequestInterceptor
{
InvokeReturnStatus
client_invoke(
in RequestContext request_context,
in ServiceContextList service_context,
in CORBA::DataInputStream request_arg_stream,
in CORBA::DataOutputStream reply_arg_stream,
out ExceptionValue excep_val
);
ResponseReturnStatus
client_response(
in ReplyContext reply_context,
in ServiceContextList service_context,
in CORBA::DataInputStream arg_stream,
out ExceptionValue excep_val
);
};
};
#endif /* _REQUEST_LEVEL_INTERCEPTOR_IDL */
C++ Language Mapping
In C++, the implementation of the operations _duplicate, _narrow, and _nil are inherited indirectly from the implementation of the CORBA::LocalBase interface provided by the WebLogic Enterprise ORB.
Listing 9-12 C++ Declaration
#ifndef _RequestLevelInterceptor_h
#define _RequestLevelInterceptor_h
#include <CORBA.h>
#include <IOP.h>
#include <GIOP.h>
#include <Interceptors.h>
class OBBEXPDLL RequestLevelInterceptor
{
public:
class ClientRequestInterceptor;
typedef ClientRequestInterceptor *
ClientRequestInterceptor_ptr;
class OBBEXPDLL ClientRequestInterceptor :
public virtual RequestInterceptor
{
public:
static ClientRequestInterceptor_ptr
_duplicate(ClientRequestInterceptor_ptr obj);
static ClientRequestInterceptor_ptr
_narrow(ClientRequestInterceptor_ptr obj);
inline static ClientRequestInterceptor_ptr
_nil() { return 0; }
virtual Interceptors::InvokeReturnStatus
client_invoke(
const RequestContext & request_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr request_arg_stream,
CORBA::DataOutputStream_ptr reply_arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
virtual Interceptors::ResponseReturnStatus
client_response(
const ReplyContext & reply_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
protected:
ClientRequestInterceptor(CORBA::LocalBase_ptr obj = 0) { }
virtual ~ClientRequestInterceptor(){ }
private:
ClientRequestInterceptor( const ClientRequestInterceptor&)
{ }
void operator=(const ClientRequestInterceptor&) { }
}; // class ClientRequestInterceptor
};
#endif /* _RequestLevelInterceptor_h */
Java Language Mapping
Listing 9-13 Java Declaration
package com.beasys.RequestLevelInterceptor;
public interface ClientRequestInterceptor
extends com.beasys.RequestLevelInterceptor.RequestInterceptor {
com.beasys.Interceptors.InvokeReturnStatus client_invoke(
com.beasys.RequestLevel.Interceptor.RequestContext
request_context,
com.beasys.RequestLevel.Interceptor.ServiceContextList
service_context,
org.omg.CORBA.DataInputStream request_arg_stream,
org.omg.CORBA.DataOutputStream reply_arg_stream,
org.omg.CORBA.SystemExceptionHolder excep_val);
com.beasys.Interceptors.ResponseReturnStatus client_response(
com.beasys.RequestLevel.Interceptor.ReplyContext reply_context,
com.beasys.RequestLevel.Interceptor.ServiceContextList
service_context,
org.omg.CORBA.DataInputStream arg_stream,
org.omg.CORBA.SystemExceptionHolder excep_val);
}
ClientRequestInterceptor::client_invoke
Synopsis
Is called by the client-side ORB anytime the client application sends an invocation to a target object.
C++ Binding
virtual Interceptors::InvokeReturnStatus
client_invoke(
const RequestContext & request_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr request_arg_stream,
CORBA::DataOutputStream_ptr reply_arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
Java Binding
Interceptors.InvokeReturnStatus
client_invoke(
RequestContext request_context,
ServiceContextList service_context,
DataInputStream request_arg_stream,
DataOutputStream reply_arg_stream,
SystemExceptionHolder excep_val);
Parameters
Exceptions
None.
Description
The client_invoke operation is called on an interceptor implementation that supports the RequestLevelInterceptor::ClientRequestInterceptor interceptor interface. The operation is called by the ORB anytime that an invocation is being sent to a target object, regardless of whether the target object is in a different address space or the same address space as the target object.
Return Values
ClientRequestInterceptor::client_response
Synopsis
Is called on an interceptor implementation that supports the RequestLevelInterceptor::ClientRequestInterceptor interface.
C++ Binding
virtual Interceptors::ResponseReturnStatus
client_response(
const ReplyContext & reply_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
Java Binding
ResponseReturnStatus
client_response(
ReplyContext reply_context,
ServiceContextList service_context,
DataInputStream arg_stream,
SystemExceptionHolder excep_val);
Parameters
LOCATION_FORWARD, LOCATION_FORWARD_PERM, or NEEDS_ADDRESSING_MODE |
A nil DataInputStream is supplied |
NO_EXCEPTION |
The DataInputStream contains first any operation return value, then any inout and out parameters in the order in which they appear in the operation's IDL definition, from left to right. A nil DataInputStream indicates that no arguments exist. |
USER_EXCEPTION or SYSTEM_EXCEPTION |
The DataInputStream contains the exception that was raised by the operation. |
Exceptions
None.
Description
The client_response operation is called on an interceptor implementation that supports the RequestLevelInterceptor::ClientRequestInterceptor interface. The operation is called by the ORB anytime that a reply to an invocation is being received by the initiator of the request, regardless of whether the initiator is in a different address space or the same address space as the target object.
Return Values
RequestLevelInterceptor::
TargetRequestInterceptor Interface
This is the base interface of all request-level interceptors. It inherits directly from the RequestLevelInterceptor::RequestInterceptor interface. The interface contains the set of operations and attributes that are supported by all target-side request-level interceptors.
Listing 9-14 OMG IDL Definition
//File: RequestLevelInterceptor.idl
#ifndef _REQUEST_LEVEL_INTERCEPTOR_IDL
#define _REQUEST_LEVEL_INTERCEPTOR_IDL
#include <orb.idl>
#include <Giop.idl>
#include <Interceptors.idl>
#pragma prefix "beasys.com"
module RequestLevelInterceptor
{
local TargetRequestInterceptor : RequestInterceptor
{
InvokeReturnStatus
target_invoke(
in RequestContext request_context,
in ServiceContextList service_context,
in CORBA::DataInputStream request_arg_stream,
in CORBA::DataOutputStream reply_arg_stream,
out ExceptionValue excep_val
);
ResponseReturnStatus
target_response(
in ReplyContext reply_context,
in ServiceContextList service_context,
in CORBA::DataInputStream arg_stream,
out ExceptionValue excep_val
);
};
};
#endif /* _REQUEST_LEVEL_INTERCEPTOR_IDL */
C++ Language Mapping
In C++, the implementation of the operations _duplicate, _narrow, and _nil are inherited indirectly from the implementation of the CORBA::LocalBase interface provided by the WebLogic Enterprise ORB.
Listing 9-15 C++ Declaration
#ifndef _RequestLevelInterceptor_h
#define _RequestLevelInterceptor_h
#include <CORBA.h>
#include <IOP.h>
#include <GIOP.h>
#include <Interceptors.h>
class OBBEXPDLL RequestLevelInterceptor
{
public:
class TargetRequestInterceptor;
typedef TargetRequestInterceptor *
TargetRequestInterceptor_ptr;
class OBBEXPDLL TargetRequestInterceptor :
public virtual RequestInterceptor
{
public:
static TargetRequestInterceptor_ptr
_duplicate(TargetRequestInterceptor_ptr obj);
static TargetRequestInterceptor_ptr
_narrow(TargetRequestInterceptor_ptr obj);
inline static TargetRequestInterceptor_ptr
_nil() { return 0; }
virtual Interceptors::InvokeReturnStatus target_invoke(
const RequestContext & request_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr request_arg_stream,
CORBA::DataOutputStream_ptr reply_arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
virtual Interceptors::ResponseReturnStatus
target_response(
const ReplyContext & reply_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
protected:
TargetRequestInterceptor(CORBA::LocalBase_ptr obj = 0) { }
virtual ~TargetRequestInterceptor(){ }
private:
TargetRequestInterceptor( const TargetRequestInterceptor&)
{ }
void operator=(const TargetRequestInterceptor&) { }
}; // class TargetRequestInterceptor
};
#endif /* _RequestLevelInterceptor_h */
Java Language Mapping
Listing 9-16 Java Declaration
package com.beasys.RequestLevelInterceptor;
public interface TargetRequestInterceptor
extends com.beasys.RequestLevelInterceptor.RequestInterceptor {
com.beasys.Interceptors.InvokeReturnStatus target_invoke(
com.beasys.RequestLevel.Interceptor.RequestContext
request_context,
com.beasys.RequestLevel.Interceptor.ServiceContextList
service_context,
org.omg.CORBA.DataInputStream request_arg_stream,
org.omg.CORBA.DataOutputStream reply_arg_stream,
org.omg.CORBA.SystemExceptionHolder excep_val);
com.beasys.Interceptors.ResponseReturnStatus target_response(
com.beasys.RequestLevel.Interceptor.ReplyContext reply_context,
com.beasys.RequestLevel.Interceptor.ServiceContextList
service_context,
org.omg.CORBA.DataInputStream arg_stream,
org.omg.CORBA.SystemExceptionHolder excep_val);
}
TargetRequestInterceptor::target_invoke
Synopsis
Is called by the target-side ORB anytime an invocation is being received by a target object.
C++ Binding
virtual Interceptors::InvokeReturnStatus
target_invoke(
const RequestContext & request_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr request_arg_stream,
CORBA::DataOutputStream_ptr reply_arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
Java Binding
Interceptors.InvokeReturnStatus
target_invoke(
RequestContext request_context,
ServiceContextList service_context,
DataInputStream request_arg_stream,
DataOutputStream reply_arg_stream,
SystemExceptionHolder excep_val);
Parameters
Exceptions
None.
Description
The target_invoke operation is called on an interceptor implementation that supports the RequestLevelInterceptor::TargetRequestInterceptor interface. The operation is called by the ORB anytime that an invocation is being received by a target object, regardless of whether the target object is in a different address space or the same address space as the target object.
Return Values
TargetRequestInterceptor::target_response
Synopsis
Is called by the target-side ORB anytime that a reply to an invocation is being sent to the initiator of the request
C++ Binding
virtual Interceptors::ResponseReturnStatus
target_response(
const ReplyContext & reply_context,
ServiceContextList_ptr service_context,
CORBA::DataInputStream_ptr arg_stream,
CORBA::Exception_ptr & excep_val ) = 0;
Java Binding
Interceptors.ResponseReturnStatus
target_response(
ReplyContext reply_context,
ServiceContextList service_context,
DataInputStream arg_stream,
SystemExceptionHolder excep_val);
Parameters
LOCATION_FORWARD, LOCATION_FORWARD_PERM, or NEEDS_ADDRESSING_MODE |
A nil DataInputStream is supplied |
NO_EXCEPTION |
The DataInputStream contains first any operation return value, then any inout and out parameters in the order in which they appear in the operation's IDL definition, from left to right. A nil DataInputStream indicates that no arguments exist. |
USER_EXCEPTION or SYSTEM_EXCEPTION |
The DataInputStream contains the exception that was raised by the operation. |
Exceptions
None.
Description
The target_response operation is called on an interceptor implementation that supports the RequestLevelInterceptor::TargetRequestInterceptor interface. The operation is called by the target-side ORB anytime that a reply to an invocation is being sent to the initiator of the request, regardless of whether the initiator is in a different address space or the same address space as the target object.
Return Values
RESPONSE_NO_EXCEPTION
AppRequestInterceptorInit
Synopsis
Instantiates and initializes client-side and target-side interceptors. This method is C++-only.
C++ Binding
typedef void (*AppRequestInterceptorInit)(
CORBA::ORB_ptr TheORB,
RequestLevelInterceptor::ClientRequestInterceptor ** ClientPtr,
RequestLevelInterceptor::TargetRequestInterceptor ** TargetPtr,
CORBA::Boolean * RetStatus);
Parameters
Exceptions
None.
Description
The AppRequestInterceptorInit function is a user-provided function that is used by the ORB to instantiate and initialize client-side and target-side interceptors.
Return Values
None.
CORBA::DataInputStream Interface
The abstract valuetype keywords in IDL applied to DataInputStream indicates that it is not the same as an interface.
Listing 9-17 OMG IDL Definition
module CORBA {
//... all the rest
// Definitions used by DataInputStream
typedef sequence<any> AnySeq;
typedef sequence<boolean> BooleanSeq;
typedef sequence<char> CharSeq;
typedef sequence<octet> OctetSeq;
typedef sequence<short> ShortSeq;
typedef sequence<unsigned short> UShortSeq;
typedef sequence<long> LongSeq;
typedef sequence<unsigned long> ULongSeq;
typedef sequence<float> FloatSeq;
typedef sequence<double> DoubleSeq;
// DataInputStream - for reading data from the stream
abstract valuetype DataInputStream
{
any read_any(); // WLE 5.1 - raises NO_IMPLEMENT
boolean read_boolean();
char read_char();
octet read_octet();
short read_short();
unsigned short read_ushort();
long read_long();
unsigned long read_ulong();
float read_float();
double read_double();
string read_string ();
Object read_Object();
TypeCode read_TypeCode();
void read_any_array( inout AnySeq seq,
in unsigned long offset,
in unsigned long length);
// WLE 5.1 - raises NO_IMPLEMENT
void read_boolean_array(inout BooleanSeq seq,
in unsigned long offset,
in unsigned long length);
void read_char_array( inout CharSeq seq,
in unsigned long offset,
in unsigned long length);
void read_octet_array(inout OctetSeq seq,
in unsigned long offset,
in unsigned long length);
void read_short_array(inout ShortSeq seq,
in unsigned long offset,
in unsigned long length);
void read_ushort_array(inout UShortSeq seq,
in unsigned long offset,
in unsigned long length);
void read_long_array( inout LongSeq seq,
in unsigned long offset,
in unsigned long length);
void read_ulong_array(inout ULongSeq seq,
in unsigned long offset,
in unsigned long length);
void read_float_array(inout FloatSeq seq,
in unsigned long offset,
in unsigned long length);
void read_double_array(inout DoubleSeq seq,
in unsigned long offset,
in unsigned lon
C++ Language Mapping
In C++, the implementation of CORBA::DataInputStream inherits from CORBA::ValueBase rather than from CORBA::Object. You cannot use, for example, _duplicate, _narrow, and _nil operations since they apply only to CORBA::Object. At this time, there is nothing of interest for users in the CORBA::ValueBase interface.
Listing 9-18 C++ Declaration
class CORBA
{
public:
class AnySeq {/* Normal sequence definition */};
typedef AnySeq * AnySeq_ptr;
class BooleanSeq {/* Normal sequence definition */};
typedef BooleanSeq * BooleanSeq_ptr;
static const CORBA::TypeCode_ptr _tc_BooleanSeq;
class CharSeq {/* Normal sequence definition */};
typedef CharSeq * CharSeq_ptr;
static const CORBA::TypeCode_ptr _tc_CharSeq;
class OctetSeq {/* Normal sequence definition */};
typedef OctetSeq * OctetSeq_ptr;
static const CORBA::TypeCode_ptr _tc_OctetSeq;
class ShortSeq {/* Normal sequence definition */};
typedef ShortSeq * ShortSeq_ptr;
static const CORBA::TypeCode_ptr _tc_ShortSeq;
class UshortSeq {/* Normal sequence definition */};
typedef UShortSeq * UShortSeq_ptr;
static const CORBA::TypeCode_ptr _tc_UShortSeq;
class LongSeq {/* Normal sequence definition */};typedef LongSeq * LongSeq_ptr;
static const CORBA::TypeCode_ptr _tc_LongSeq;
class UlongSeq {/* Normal sequence definition */};
typedef ULongSeq * ULongSeq_ptr;
static const CORBA::TypeCode_ptr _tc_ULongSeq;
class FloatSeq {/* Normal sequence definition */};
typedef FloatSeq * FloatSeq_ptr;
static const CORBA::TypeCode_ptr _tc_FloatSeq;
class DoubleSeq {/* Normal sequence definition */};
typedef DoubleSeq * DoubleSeq_ptr;
static const CORBA::TypeCode_ptr _tc_DoubleSeq;class OBBEXPDLL DataInputStream : public virtual ValueBase
{
public:
static DataInputStream_ptr _downcast(ValueBase_ptr obj);
virtual Any * read_any (); // WLE 5.0 raises NO_IMPLEMENT
virtual Boolean read_boolean ();
virtual Char read_char ();
virtual Octet read_octet ();
virtual Short read_short ();
virtual UShort read_ushort ();
virtual Long read_long ();
virtual ULong read_ulong ();
virtual Float read_float ();
virtual Double read_double ();
virtual Char * read_string ();
virtual Object_ptr read_Object ();
virtual TypeCode_ptr read_TypeCode ();
virtual void read_any_array ( AnySeq & seq,
ULong offset, ULong length);
// WLE 5.1 - raises NO_IMPLEMENT
virtual void read_boolean_array(BooleanSeq & seq,
ULong offset, ULong length);
virtual void read_char_array ( CharSeq & seq,
ULong offset, ULong length);
virtual void read_octet_array ( OctetSeq & seq,
ULong offset, ULong length);
virtual void read_short_array ( ShortSeq & seq,
ULong offset, ULong length);
virtual void read_ushort_array (UShortSeq & seq,
ULong offset, ULong length);
virtual void read_long_array ( LongSeq & seq,
ULong offset, ULong length);
virtual void read_ulong_array ( ULongSeq & seq,
ULong offset, ULong length);
virtual void read_float_array ( FloatSeq & seq,
ULong offset, ULong length);
virtual void read_double_array (DoubleSeq & seq,
ULong offset, ULong length);
protected:
DataInputStream(){ };
virtual ~DataInputStream(){ }
private:
void operator=(const DataInputStream&) { }
};
typedef DataInputStream * DataInputStream_ptr;
};
Java Language Mapping
Listing 9-19 Java Declaration
package org.omg.CORBA;
public interface DataInputStream
extends org.omg.CORBA.portable.ValueBase {
org.omg.CORBA.Any read_any(); // WLE 5.1 - raises NO_IMPLEMENT
boolean read_boolean();
char read_char();
byte read_octet();
short read_short();
short read_ushort();
int read_long();
int read_ulong();
float read_float();
double read_double();
String read_string();
org.omg.CORBA.Object read_Object();
org.omg.CORBA.TypeCode read_TypeCode();
void read_any_array(org.omg.CORBA.AnySeqHolder seq,
// WLE 5.1 - raises NO_IMPLEMENT
int offset, int length);
void read_boolean_array(org.omg.CORBA.BooleanSeqHolder seq,
int offset, int length);
void read_char_array(org.omg.CORBA.CharSeqHolder seq,
int offset, int length);
void read_octet_array(org.omg.CORBA.OctetSeqHolder seq,
int offset, int length);
void read_short_array(org.omg.CORBA.ShortSeqHolder seq,
int offset, int length);
void read_ushort_array(org.omg.CORBA.UShortSeqHolder seq,
int offset, int length);
void read_long_array(org.omg.CORBA.LongSeqHolder seq,
int offset, int length);
void read_ulong_array(org.omg.CORBA.ULongSeqHolder seq,
int offset, int length);
void read_float_array(org.omg.CORBA.FloatSeqHolder seq,
int offset, int length);
void read_double_array(org.omg.CORBA.DoubleSeqHolder seq,
int offset, int length);
}
DataInputStream::read_<primitive>
Synopsis
Returns a value from the stream.
C++ Binding
<primitive> read_<primitive>();Java Binding
<primitive> read_<primitive>();Parameters
None.
Exceptions
None.
Description
The operations to read a primitive element (<primitive>) from a DataInputStream all have the same format. Each operation returns a value from the stream.
Note: In C++, String_var, TypeCode_var, or Object_var can be used for memory management. Otherwise, strings must be released using the string_free() operation on the CORBA object, and TypeCode or Object pointers must be released using the release() operation on the CORBA object.
In C++, the primitives are the following:
AnySeq (Not implemented in WLE 5.1)
BooleanSeq
CharSeq
OctetSeq
ShortSeq
UshortSeq
LongSeq
UlongSeq
FloatSeq
DoubleSeqIn Java, the primitives are the following:
org.omg.CORBA.AnySeqHolder (Not implemented in WLE 5.1)
org.omg.CORBA.BooleanSeqHolder
org.omg.CORBA.CharSeqHolder
org.omg.CORBA.OctetSeqHolder
org.omg.CORBA.ShortSeqHolder
org.omg.CORBA.UShortSeqHolder
org.omg.CORBA.LongSeqHolder
org.omg.CORBA.ULongSeqHolder
org.omg.CORBA.FloatSeqHolder
org.omg.CORBA.DoubleSeqHolderReturn Values
None.
DataInputStream::read_array_<primitive>
Synopsis
Returns an array of primitive values from the stream into a CORBA sequence.
C++ Binding
void read_array_<primitive>( <primitive>Seq & seq,
ULong offset,
ULong length);Java Binding
void read_array_<primitive>( <primitive>SeqHolder seq,
int offset,
int length);Parameters
- <primitive>Seq
- A sequence of the appropriate type that will receive the array elements read.
- C++
- If the sequence was not long enough to contain the additional elements, the length will be set to the sum offset+length. (The length will not be adjusted down.)
- Java
- The SeqHolder must be large enough; it will not be extended.
- Offset
- The offset into the array to read the elements. That is, the array will have new elements starting at array index offset up to array index offset+length-1.
- Length
- The number of elements of the array to be returned into the seq parameter.
Exceptions
None.
Description
The operations to read an array of primitive elements (<primitive>) from a DataInputStream all have the same format. Each operation returns an array of primitive values from the stream into a CORBA sequence of that same primitive type.
In C++, the primitives are the following:
AnySeq (Not implemented in WLE 5.1)
BooleanSeq
CharSeq
OctetSeq
ShortSeq
UshortSeq
LongSeq
UlongSeq
FloatSeq
DoubleSeqIn Java, the primitives are the following:
org.omg.CORBA.AnySeqHolder (Not implemented in WLE 5.1)
org.omg.CORBA.BooleanSeqHolder
org.omg.CORBA.CharSeqHolder
org.omg.CORBA.OctetSeqHolder
org.omg.CORBA.ShortSeqHolder
org.omg.CORBA.UShortSeqHolder
org.omg.CORBA.LongSeqHolder
org.omg.CORBA.ULongSeqHolder
org.omg.CORBA.FloatSeqHolder
org.omg.CORBA.DoubleSeqHolderReturn Values
None.
Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.