summaryrefslogtreecommitdiff
path: root/TAO/examples/Content_Server/AMI_Observer/Push_Iterator_Factory_i.h
blob: 684d13f80116a5848af8d1dcdcead17f7610defe (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
// -*- C++ -*-
// $Id$


// ============================================================================
//
// = LIBRARY
//     AMI_Observer
//
// = FILENAME
//     Push_Iterator_Factory_i.h
//
// = DESCRIPTION
//     Header file for the push Web_Server::Iterator_Factory implementation.
//
// = AUTHOR
//     Ossama Othman <ossama@uci.edu>
//
// ============================================================================

#ifndef PUSH_ITERATOR_FACTORY_I_H
#define PUSH_ITERATOR_FACTORY_I_H

#include /**/ "ace/pre.h"

#include "ace/FILE_Addr.h"
#include "ace/FILE_IO.h"
#include "Push_Web_ServerS.h"
#include "ace/OS_NS_sys_stat.h"

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

class Push_Iterator_Factory_i :
  virtual public POA_Web_Server::Iterator_Factory
{
  // = TITLE
  //    Implement the Web_Server::Iterator_Factory interface.
  //
  // = DESCRIPTION
  //    This class is used to register a client-side <Callback> object
  //    with the Content Server, which is actually implemented by the
  //    <Callback_Handler> class for each requested file.
  //
  //    The client invokes the register_callback() method in this
  //    class.  That method then creates a <Callback_Handler> which
  //    will push chunks of data asynchronously to the client-side
  //    <Callback> object.  This allows the Content Server to
  //    concurrently service multiple file requests without the need
  //    to explicitly use threads at the application level.

public:
  Web_Server::Metadata_Type *register_callback
    (const char *pathname,
     Web_Server::Callback_ptr client_callback
     ACE_ENV_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException,
                     Web_Server::Error_Result));
  // This registration method passes a <Callback> that the Web server
  // uses to ``push'' data associated with <pathname> one ``chunk'' at
  // a time.  The <metadata> reports information about the <pathname>.

  int modification_date (ACE_stat *file_status,
                         Web_Server::Metadata_Type &metadata);
  // Set the file modification date in the metadata structure.

  int content_type (const char *filename,
                    Web_Server::Metadata_Type &metadata);
  // Set the type of file content in the metadata structure.

private:
  Web_Server::Callback_var client_callback_;
  // Reference to the object that is used by the server to push chunks
  // of data to the client.
};

#include /**/ "ace/post.h"

#endif  /* PUSH_ITERATOR_FACTORY_I_H */