summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.h
blob: f544aa6e63def07175962f98038ffd091630ec19 (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// $Id$

///====================================================================
//@filename: new_RepositoryManager_Impl.h
//@Author: Stoyan Paunov	spaunov@isis.vanderbilt.edu
//
//@Purpose: This class is the implementation class for the new
//			RepositoryManager



// -*- C++ -*-
//
// $Id$

// ****  Code generated by the The ACE ORB (TAO) IDL Compiler ****
// TAO and the TAO IDL Compiler have been developed by:
//       Center for Distributed Object Computing
//       Washington University
//       St. Louis, MO
//       USA
//       http://www.cs.wustl.edu/~schmidt/doc-center.html
// and
//       Distributed Object Computing Laboratory
//       University of California at Irvine
//       Irvine, CA
//       USA
//       http://doc.ece.uci.edu/
// and
//       Institute for Software Integrated Systems
//       Vanderbilt University
//       Nashville, TN
//       USA
//       http://www.isis.vanderbilt.edu/
//
// Information about TAO is available at:
//     http://www.cs.wustl.edu/~schmidt/TAO.html

// TAO_IDL - Generated from 
// .\be\be_codegen.cpp:873

#ifndef NEW_REPOSITORYMANAGERI_H_
#define NEW_REPOSITORYMANAGERI_H_

#include "new_RepositoryManagerS.h"
#include "DeploymentS.h"					//added for the deployment stuff

#include "ace/Hash_Map_Manager.h"			//for the ACE_Hash_Map_Manager
#include "ace/Null_Mutex.h"					//for ACE_Null_Mutex
#include "ace/OS_NS_string.h"				//for ACE_CString
#include "ace/SString.h"


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


///DIRECTORY WHERE THE PACKAGES WILL BE STORED LOCALLY
const static char* RM_STORAGE_PATH = "./RepositoryDir";


class  CIAO_new_RepositoryManagerDaemon_i : public virtual POA_CIAO::new_RepositoryManagerDaemon, public virtual PortableServer::RefCountServantBase
{
public:

  //Constructor 
  CIAO_new_RepositoryManagerDaemon_i (CORBA::ORB_ptr the_orb);
  
  //Destructor 
  virtual ~CIAO_new_RepositoryManagerDaemon_i (void);
  
  virtual
  void shutdown (
      
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException
    ));
  
  virtual
  void installPackage (
      const char * installationName,
      const ::Deployment::Package & the_package,
      ::CORBA::Boolean replace
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException,
      ::Deployment::NameExists,
      ::Deployment::PackageError
    ));
  
  virtual
  ::Deployment::DeploymentPlan * retrievePlan (
      const char * packageName
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException
    ));
  
  virtual
  ::Deployment::Package * findPackageByName (
      const char * name
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException,
      ::Deployment::NoSuchName
    ));
  
  virtual
  ::Deployment::Implementation * findImplementationByName (
      const char * implementation_name,
	  const char * package_name
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException,
      ::Deployment::NoSuchName
    ));
  
  virtual
  ::Deployment::Package * findPackageByUUID (
      const char * UUID
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException,
      ::Deployment::NoSuchName
    ));
  
  virtual
  ::Deployment::Implementation * findImplementationByUUID (
      const char * UUID
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException,
      ::Deployment::NoSuchName
    ));
  
  virtual
  ::CORBA::StringSeq * getAllPackageNames (
      
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException
    ));
  
  virtual
  void deletePackage (
      const char * installationName
    )
    ACE_THROW_SPEC ((
      CORBA::SystemException,
      ::Deployment::NoSuchName
    ));


  protected:

	  ///function that writes out a file to a specified location on the hand disk
	  ///returns 1 on success
	  ///		-1 on error

	  int write_to_disk (const char* full_path, 
						 const CORBA::Octet* buffer, 
						 size_t length
						 );


	  ///function that writes out a file to a specified location on the hand disk
	  ///returns 1 on success
	  ///		 0 on already exists and replace == false
	  ///		-1 on error

	  int write_to_disk (const char* full_path, 
						 ACE_Message_Block& mb,
						 bool replace = true
						 );


	  ///function to read the contents of a file from disk into a CORBA::OctetSeq
	  ///returns a pointer to a CORBA::Octet buffer and updated the lenght on success 
	  ///		 0 on failure

	  CORBA::Octet* read_from_disk (const char* full_path, size_t &lenght);

  private:
	/// Cached information about the installed packages
	/// and the Implementation Artifacts within them
    /// Key:	Package name of CString type or
    /// Value:	The location of the local copy of the package

    typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
                                    ACE_CString,
                                    ACE_Hash<ACE_CString>,
                                    ACE_Equal_To<ACE_CString>,
                                    ACE_Null_Mutex> RepositoryDatabase;


	typedef RepositoryDatabase::iterator RepositoryDatabase_Iterator;

    RepositoryDatabase packages_;
	CORBA::ORB_var the_orb_;

};


#endif /* NEW_REPOSITORYMANAGERI_H_  */