summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.h
blob: 26b2322dd80816e1fb41e38d9a9e23de8970d183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// -*- C++ -*-

// $Id$

// ============================================================================
//
// = LIBRARY
//    orbsvcs
//
// = FILENAME
//    DSI_ForwardingProxy.h
//
// = AUTHOR
//    Ossama Othman <ossama@uci.edu>
//
// ============================================================================

#ifndef DSI_FORWARDING_PROXY_H
#define DSI_FORWARDING_PROXY_H

#include "orbsvcs/LoadBalancingS.h"

// Forward declaration.
class LoadBalancer_Impl;

// @@ Ossama: we have to change the implementation to use a
// ServantLocator, that can actually raise the ForwardingRequest
// exception.
// @@ Also: please remember to use the '#pragma once' madness, prefix
// the names of your classes and don't forget the TAO_XXXX_Export
// macros.

class DSI_ForwardingProxy : public PortableServer::DynamicImplementation
{
  // = TITLE
  //    Class that provides request forwarding.

  // = DESCRIPTION
  //    Using the Dynamic Skeleton Interface, this class intercepts
  //    requests from a client, and throws a location forwarding
  //    exception that contains the location of the server to which the
  //    client should redirect its requests.

public:
  DSI_ForwardingProxy (LoadBalancer_Impl *load_balancer,
                       const char *interface_id);
  // Constructor that sets the interface repository ID this DSI object
  // is associated with.

  // = The DynamicImplementation methods

  virtual void invoke (CORBA::ServerRequest_ptr request,
                       CORBA::Environment &ACE_TRY_ENV)
    ACE_THROW_SPEC ((CORBA::SystemException,
                     PortableServer::ForwardRequest));

  virtual CORBA::RepositoryId _primary_interface (
                                   const PortableServer::ObjectId &oid,
                                   PortableServer::POA_ptr poa,
                                   CORBA::Environment &ACE_TRY_ENV)
    ACE_THROW_SPEC (());

private:
  LoadBalancer_Impl *load_balancer_;
  // The load balancer implementation.

  CORBA::String_var interface_id_;
  // The interface repository ID of the target object.

};

#endif  /* DSI_FORWARDING_PROXY_H */