summaryrefslogtreecommitdiff
path: root/TAO/examples/Content_Server/AMI_Observer/Push_Iterator_Handler.h
blob: d13b4b0872b841c096ff5961bccf2275735b7b0a (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// -*- C++ -*-
// $Id$

// Ossama Othman <ossama@uci.edu>

// ============================================================================
//
// = LIBRARY
//     ECE255
//
// = FILENAME
//     Push_Iterator_Handler.h
//
// = DESCRIPTION
//     Header file for the AMI_Iterator_FactoryHandler implementation.
//
// = AUTHOR
//     Ossama Othman <ossama@uci.edu>
//
// ============================================================================

#ifndef PUSH_ITERATOR_HANDLER_H
#define PUSH_ITERATOR_HANDLER_H

#include "ace/pre.h"

#include "Push_Web_ServerS.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

// Forward declaration
class Callback_i;

class Push_Iterator_Handler
  : public virtual POA_Web_Server::AMI_Iterator_FactoryHandler,
    public virtual PortableServer::RefCountServantBase
{
public:

  Push_Iterator_Handler (void);
  // Constructor that creates a content iterator corresponding to the
  // name of the file being retrieved from the web server.

  void run (int * request_count,
            const char *pathname,
            Web_Server::Iterator_Factory_ptr factory,
            CORBA::Environment &ACE_TRY_ENV)
    ACE_THROW_SPEC ((CORBA::SystemException,
                     Web_Server::Error_Result));
  // Activate and run this Reply Handler.  The contents (not the
  // pointer itself) of the <request_count> parameter will be
  // incremented when file retrieval begins, and decremented when file
  // retrieval completes.

private:

  ~Push_Iterator_Handler (void);
  // Destructor  (private to ensure that Iterator_Handler is allocated
  // on the heap).

  virtual void register_callback (
      const Web_Server::Metadata_Type & metadata, 
      CORBA::Environment &ACE_TRY_ENV)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // AMI callback that is invoked when a response from the
  // corresponding server method is received.

  virtual void register_callback_excep (
      Web_Server::AMI_Iterator_FactoryExceptionHolder *,
      CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException)) {}

private:
  Callback_i * callback_servant_;
  // The servant that accepts data pushed from the content server.

  Web_Server::Callback_var callback_;
  // Reference to the callback object the server sends data to.

  Web_Server::AMI_Iterator_FactoryHandler_var ami_handler_;
  // Reference to this Reply Handler's self.
};

#include "ace/post.h"

#endif  /* PUSH_ITERATOR_HANDLER_H */