3 //=============================================================================
5 * @file Iterator_Handler.h
7 * Header file for the Web_Server::AMI_Content_IteratorHandler
10 * @author Ossama Othman <ossama@uci.edu>
12 //=============================================================================
15 #ifndef ITERATOR_HANDLER_H
16 #define ITERATOR_HANDLER_H
18 #include "ace/FILE_Addr.h"
19 #include "ace/FILE_IO.h"
20 #include "Web_ServerS.h"
22 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 class Iterator_Handler
27 : public virtual POA_Web_Server::AMI_Content_IteratorHandler
30 // The AMI reply handler for replies from the Content_Iterator.
33 // This class handles all asynchronously received replies from
34 // the Content_Iterator on the server side. Once a reply is
35 // handled, another asynchronous request is made to the
36 // Content_Iterator. This ensures that chunks of data are
37 // received in the proper order, and also takes advantage of
38 // asyncronous method invocations.
40 /// Dummy friend class declaration to quiet down a warning.
41 friend class Iterator_Handler_Friend
;
44 /// Constructor that creates a content iterator corresponding to the
45 /// name of the file being retrieved from the web server.
48 virtual void next_chunk (CORBA::Boolean pending_data
,
49 const Web_Server::Chunk_Type
& chunk
);
51 virtual void next_chunk_excep (
52 ::Messaging::ExceptionHolder
*)
55 virtual void destroy ();
57 virtual void destroy_excep (
58 ::Messaging::ExceptionHolder
*)
62 * Activate and run this Reply Handler. The contents (not the
63 * pointer itself) of the <request_count> parameter will be
64 * incremented when file retrieval begins, and decremented when file
65 * retrieval completes.
67 void run (int *request_count
,
69 Web_Server::Iterator_Factory_ptr factory
);
72 /// Destructor (private to ensure that Iterator_Handler is allocated
76 /// Initialize the Content Iterator used to retrieve the file.
77 void initialize_content_iterator (const char *pathname
,
78 Web_Server::Iterator_Factory_ptr factory
);
80 /// Deactivate this reply handler.
83 /// Get the name of the viewer associated with the file being
85 int get_viewer (char *viewer
, size_t length
);
87 /// Spawn an external view to display the retrieved file.
91 /// The Addr corresponding to the retrieved file.
94 /// The object that provides all file related IO operations
95 /// (e.g. read, write, etc).
98 /// The iterator used to obtain individual chunks of data from the
100 Web_Server::Content_Iterator_var contents_
;
102 /// The metadata associated with the file being retrieved from the
104 Web_Server::Metadata_Type_var metadata_
;
106 /// The offset from the beginning of the file, the next chunk of data
107 /// should be read from.
108 CORBA::ULong offset_
;
110 /// Reference to this Reply Handler's self.
111 Web_Server::AMI_Content_IteratorHandler_var ami_handler_
;
114 * Pointer to external status monitoring variable. The contents (not
115 * the pointer itself) of the<pending_data> parameter will be
116 * decremented when file retrieval has completed.
121 #endif /* ITERATOR_HAHNDLER_H */