00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "BESFileContainer.h"
00034 #include "TheBESKeys.h"
00035 #include "BESUncompressManager.h"
00036 #include "BESCache.h"
00037 #include "BESForbiddenError.h"
00038
00045 BESFileContainer::BESFileContainer( const string &sym_name,
00046 const string &real_name,
00047 const string &type )
00048 : BESContainer( sym_name, real_name, type )
00049 {
00050 string::size_type dotdot = real_name.find( ".." ) ;
00051 if( dotdot != string::npos )
00052 {
00053 string s = (string)"'../' not allowed in container real name "
00054 + real_name ;
00055 throw BESForbiddenError( s, __FILE__, __LINE__ ) ;
00056 }
00057 }
00058
00063 BESFileContainer::BESFileContainer( const BESFileContainer ©_from )
00064 : BESContainer( copy_from )
00065 {
00066 }
00067
00068 void
00069 BESFileContainer::_duplicate( BESContainer ©_to )
00070 {
00071 BESContainer::_duplicate( copy_to ) ;
00072 }
00073
00078 BESContainer *
00079 BESFileContainer::ptr_duplicate( )
00080 {
00081 BESContainer *container = new BESFileContainer ;
00082 BESContainer::_duplicate( *container ) ;
00083 return container ;
00084 }
00085
00091 string
00092 BESFileContainer::access()
00093 {
00094
00095 BESKeys *keys = TheBESKeys::TheKeys() ;
00096 BESCache cache( *keys, "BES.CacheDir", "BES.CachePrefix", "BES.CacheSize" );
00097
00098 _cached = BESUncompressManager::TheManager()->uncompress( get_real_name(),
00099 _target, cache ) ;
00100 if( _cached )
00101 return _target ;
00102 return get_real_name() ;
00103 }
00104
00112 bool
00113 BESFileContainer::release()
00114 {
00115
00116
00117 return true ;
00118 }
00119
00127 void
00128 BESFileContainer::dump( ostream &strm ) const
00129 {
00130 strm << BESIndent::LMarg << "BESFileContainer::dump - ("
00131 << (void *)this << ")" << endl ;
00132 BESIndent::Indent() ;
00133 BESContainer::dump( strm ) ;
00134 BESIndent::UnIndent() ;
00135 }
00136