summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/PortableGroup/PortableGroup_Request_Dispatcher.cpp
blob: 3fb03e3841d2a988d572c2a6f8ed170cf9d6dcb7 (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
// This may look like C, but it's really -*- C++ -*-
//
// $Id$

#include "UIPMC_Profile.h"
#include "PortableGroup_Request_Dispatcher.h"
#include "PortableGroup_Loader.h"

#include "tao/TAO_Server_Request.h"
#include "tao/ORB_Core.h"

ACE_RCSID (PortableGroup,
           PortableGroup_Request_Dispatcher,
           "$Id$")

PortableGroup_Request_Dispatcher::~PortableGroup_Request_Dispatcher (void)
{
}

void
PortableGroup_Request_Dispatcher::dispatch (TAO_ORB_Core *orb_core,
                                            TAO_ServerRequest &request,
                                            CORBA::Object_out forward_to
                                            ACE_ENV_ARG_DECL)
{
  // Check if the request contains a tagged profile
  if (request.profile ().discriminator () == GIOP::ProfileAddr)
    {
      // Get the IOP::Tagged profile.
      const IOP::TaggedProfile &tagged_profile =
        request.profile ().tagged_profile ();
      PortableGroup::TagGroupTaggedComponent group;

      // Extract a Group ID from the profile if it exists.
      int result = TAO_UIPMC_Profile::extract_group_component (tagged_profile,
                                                               group);
      if (result == 0)
        {
          // Got a group.  Dispatch based on the group ID
          this->group_map_.dispatch (&group,
                                     orb_core,
                                     request,
                                     forward_to
                                     ACE_ENV_ARG_PARAMETER);
          ACE_CHECK;

          return;
        }

      // Else, fall through and dispatch based on object key like normal.
    }

  // Dispatch based on object key.
  orb_core->adapter_registry ()->dispatch (request.object_key (),
                                           request,
                                           forward_to
                                           ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}