Notas de Aula - MAC 5759 - Sistemas de Objetos Distribuídos
Aula 13 - 23/4/2001
Interceptadores Portáteis (continuação)
-
Interceptadores podem ser adicionados através da linha de comando
ou através de código explícito na inicialização
do ORB:
-
java -Dorg.omg.PortableInterceptor.ORBInitializerClass.com.x.Logging.LoggingService
MyApp
-
ORBInitializer
-
public class LoggingService implements ORBInitializer {
void pre_init( ORBInitInfo info ) {
// Instantiate
the Logging Service s Interceptor.
Interceptor interceptor
= new LoggingInterceptor();
// Register the
Logging Service s Interceptor.
info.add_client_request_interceptor(
interceptor )
// cria um serviço
qualquer e ...
info.register_initial_reference("AService",
aServiceImpl);
}
void post_init( ORBInitInfo info ) {
// aqui pode-se
chamar o resolve_initial_references ();
}
}
-
interface org.omg.PortableInterceptor.ClientRequestInterceptorOperations
-
receive_exception(ClientRequestInfo ri)
Indicates to
the interceptor that an exception occurred.
receive_other(ClientRequestInfo ri) (e.g. LOCATION_FORWARD,
for retrying; asynchronous calls)
Allows an Interceptor
to query the information available when a request results in something
other than a normal reply or an exception.
receive_reply(ClientRequestInfo ri)
Allows an Interceptor
to query the information on a reply after it is returned from the server
and before control is returned to the client.
send_poll(ClientRequestInfo ri) (usado com o messaging system
para ver se a resposta já chegou ou não)
Allows an Interceptor
to query information during a Time-Independent Invocation (TII) polling
get reply sequence.
send_request(ClientRequestInfo ri)
Allows an Interceptor
to query request information and modify the service context before the
request is sent to the server.
-
ClientRequestInfoOperations
-
void add_request_service_context(ServiceContext service_context,
boolean replace)
Allows Interceptors
to add service contexts to the request.
TaggedProfile effective_profile()
Returns the
profile that will be used to send the request.
Object effective_target()
Returns the
actual object on which the operation will be invoked.
TaggedComponent get_effective_component(int id)
Returns the
IOP.TaggedComponent with the given ID from the profile selected for this
request.
TaggedComponent[] get_effective_components(int id)
Returns an array
of all tagged components with the given ID from the profile selected for
this request.
Policy get_request_policy(int type) (políticas são
usadas por alguns serviços, p.ex. o de segurança).
Returns the
given policy in effect for this operation.
String received_exception_id()
Returns the
repository id of the exception to be returned to the client.
Any received_exception()
Returns an any
which contains the exception to be returned to the client.
Object target()
Returns the
object which the client called to perform the operation.
Bindings (Associações) e Repositório de Implementações
Próxima Aula
Aula Anterior
Página de MAC 5759
Página do Fabio
Página do DCC