=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / examples / Content_Server / AMI_Iterator / Iterator_Handler.h
blob0818d41e4a7b24a3d139aa3a9e189d1b7038e492
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Iterator_Handler.h
7 * Header file for the Web_Server::AMI_Content_IteratorHandler
8 * implementation.
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)
23 # pragma once
24 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 class Iterator_Handler
27 : public virtual POA_Web_Server::AMI_Content_IteratorHandler
29 // = TITLE
30 // The AMI reply handler for replies from the Content_Iterator.
32 // = DESCRIPTION
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;
43 public:
44 /// Constructor that creates a content iterator corresponding to the
45 /// name of the file being retrieved from the web server.
46 Iterator_Handler ();
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 *)
61 /**
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,
68 const char *pathname,
69 Web_Server::Iterator_Factory_ptr factory);
71 private:
72 /// Destructor (private to ensure that Iterator_Handler is allocated
73 /// on the heap).
74 ~Iterator_Handler ();
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.
81 void deactivate ();
83 /// Get the name of the viewer associated with the file being
84 /// retrieved.
85 int get_viewer (char *viewer, size_t length);
87 /// Spawn an external view to display the retrieved file.
88 int spawn_viewer ();
90 private:
91 /// The Addr corresponding to the retrieved file.
92 ACE_FILE_Addr file_;
94 /// The object that provides all file related IO operations
95 /// (e.g. read, write, etc).
96 ACE_FILE_IO file_io_;
98 /// The iterator used to obtain individual chunks of data from the
99 /// web server.
100 Web_Server::Content_Iterator_var contents_;
102 /// The metadata associated with the file being retrieved from the
103 /// web server.
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.
118 int *request_count_;
121 #endif /* ITERATOR_HAHNDLER_H */