summaryrefslogtreecommitdiff
path: root/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h
blob: b26a3a424bcdf899c858d2e58ee42e649066d23e (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Assembly_Impl.h
 *
 *  $Id$
 *
 *  This file contains implementations for
 *  Components::Deployment::AssemblyFactory and
 *  Components::Deployment::Assembly interface.
 *
 *  @author Nanbor Wang <nanbor@cs.wustl.edu>
 */
//=============================================================================


#ifndef CIAO_SERVERACTIVATOR_IMPL_H
#define CIAO_SERVERACTIVATOR_IMPL_H
#include "ace/pre.h"

#include "ace/config-all.h"

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

#include "ace/Active_Map_Manager_T.h"
#include "CCM_DeploymentS.h"

namespace CIAO
{
  /**
   * @class AssemblyFactory_Impl
   *
   * @brief Servant implementation for Components::Deployment::AssemblyFactory
   *
   * This class implements the Components::Deployment::AssemblyFactory
   * interface as defined by the CCM spcification.  As the interface
   * implies, this is actually part of the deployment interface and is
   * used to manage the lifecycle of containers running on the server.
   */
  class CIAO_SERVER_Export AssemblyFactory_Impl
    : public virtual POA_Components::Deployment::AssemblyFactory,
      public virtual PortableServer::RefCountServantBase
  {
  public:
    /// Constructor
    AssemblyFactory_Impl (CORBA::ORB_ptr o,
                          PortableServer::POA_ptr p);

    /// Destructor
    virtual ~AssemblyFactory_Impl (void);

    /// Get the containing POA.  This operation does *not*
    /// increase the reference count of the POA.
    virtual PortableServer::POA_ptr _default_POA (void);

    /// Initialize the AssemblyFactory.
    int init (ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    /// Components::Deployment::Assembly defined attributes/operations.
    virtual ::Components::Cookie * create_assembly (const char * assembly_loc
                                                    ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException,
                       Components::Deployment::InvalidLocation,
                       Components::CreateFailure));

    virtual ::Components::Deployment::Assembly_ptr lookup (Components::Cookie * c
                                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException,
                       Components::Deployment::InvalidAssembly));

    virtual void destroy (Components::Cookie * c
                          ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException,
                       Components::Deployment::InvalidAssembly,
                       Components::RemoveFailure));

  protected:
    /// Keep a pointer to the managing ORB serving this servant.
    CORBA::ORB_var orb_;

    /// Keep a pointer to the managing POA.
    PortableServer::POA_var poa_;

    /// Keep a list of managed Assembly objects.
    ACE_Active_Map_Manager<Components::Deployment::Assembly_var> assembly_map_;
  };

  /**
   * @class Assembly_Impl
   *
   * @brief Servant implementation for Components::Deployment::Assembly
   *
   * This class implements the Components::Deployment::Assembly
   * interface as defined by the CCM spcification.  As the interface
   * implies, this is actually part of the deployment interface and is
   * used to manage the lifecycle of containers running on the server.
   */
  class CIAO_SERVER_Export Assembly_Impl
    : public virtual POA_Components::Deployment::Assembly,
      public virtual PortableServer::RefCountServantBase
  {
  public:
    /// Constructor
    Assembly_Impl (CORBA::ORB_ptr o,
                   PortableServer::POA_ptr p);

    /// Destructor
    virtual ~Assembly_Impl (void);

    /// Get the containing POA.  This operation does *not*
    /// increase the reference count of the POA.
    virtual PortableServer::POA_ptr _default_POA (void);

    /// Initialize the Assembly.
    int init (ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    /// Components::Deployment::Assembly defined attributes/operations.

    virtual void build (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual void tear_down (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException,
                       Components::RemoveFailure));

    virtual ::Components::Deployment::AssemblyState
    get_state (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

  protected:
    /// Keep a pointer to the managing ORB serving this servant.
    CORBA::ORB_var orb_;

    /// Keep a pointer to the managing POA.
    PortableServer::POA_var poa_;

    /// Current State
    ::Components::Deployment::AssemblyState state_;

    /// <Debug> My instance number.
    CORBA::ULong serial_number_;

    /// <Debug> instance counter.
    static CORBA::ULong assembly_count_;
  };
}

#if defined (__ACE_INLINE__)
# include "Assembly_Impl.inl"
#endif /* __ACE_INLINE__ */

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