Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / examples / Content_Server / AMI_Observer / Push_Iterator_Handler.h
blobec5f4048be8e5eaf1dea81a742a96ca01c821d9d
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Push_Iterator_Handler.h
7 * Header file for the AMI_Iterator_FactoryHandler implementation.
9 * @author Ossama Othman <ossama@uci.edu>
11 //=============================================================================
14 #ifndef PUSH_ITERATOR_HANDLER_H
15 #define PUSH_ITERATOR_HANDLER_H
17 #include "Push_Web_ServerS.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 // Forward declaration
24 class Callback_i;
26 class Push_Iterator_Handler
27 : public virtual POA_Web_Server::AMI_Iterator_FactoryHandler
29 // = TITLE
30 // Implement the Web_Server::Iterator_Factory AMI Reply Handler.
32 // = DESCRIPTION
33 // This classes asynchronously registers a reference to the
34 // client-side <Callback> object in the Content Server. Once
35 // registered, the <Callback> will begin receiving chunks of data
36 // pushed from the Content Server.
38 // Since registration occurs asynchronously, it is possible that
39 // the metadata returned from the <Iterator_Factory> will be
40 // received after the content of the file has been received. The
41 // <Callback> object is equipped to handle this possibility.
43 // The register_callback() reply handler method in this class
44 // receives the metadata, and then passes it to the <Callback>
45 // object. Once the metadata is received, there is no longer any
46 // use for this <Push_Iterator_Handler> object, and it is
47 // deactivated.
49 /// Dummy friend class declaration to quiet down a warning.
50 friend class Push_Iterator_Handler_Friend;
52 public:
53 /// Constructor that creates a content iterator corresponding to the
54 /// name of the file being retrieved from the web server.
55 Push_Iterator_Handler (void);
57 /**
58 * Activate and run this Reply Handler. The contents (not the
59 * pointer itself) of the <request_count> parameter will be
60 * incremented when file retrieval begins, and decremented when file
61 * retrieval completes.
63 void run (int *request_count,
64 const char *pathname,
65 Web_Server::Iterator_Factory_ptr factory);
67 private:
69 /// Destructor (private to ensure that Iterator_Handler is allocated
70 /// on the heap).
71 ~Push_Iterator_Handler (void);
73 /// AMI callback that is invoked when a response from the
74 /// corresponding server method is received.
75 virtual void register_callback
76 (const Web_Server::Metadata_Type &metadata);
78 virtual void register_callback_excep
79 (::Messaging::ExceptionHolder *)
82 /// Deactivate this handler.
83 void deactivate (void);
85 private:
86 /// The servant that accepts data pushed from the content server.
87 Callback_i *callback_servant_;
89 /// Reference to the callback object the server sends data to.
90 Web_Server::Callback_var callback_;
92 /// Reference to this Reply Handler's self.
93 Web_Server::AMI_Iterator_FactoryHandler_var ami_handler_;
96 #endif /* PUSH_ITERATOR_HANDLER_H */