Changeset 11064

Show
Ignore:
Timestamp:
03/12/12 16:09:32 (15 months ago)
Author:
Snyder.Jason
Message:

committing patches from opencpi

Location:
ossiedev/branches/jsnyder/trunk
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/trunk/Makefile.am

    r11060 r11064  
    6161 
    6262install-data-hook: 
    63         -cp -rf $(prefix)/lib/* $(libdir) 
    64         -rm -rf $(prefix)/lib 
     63        -if [ $(prefix)/lib != $(libdir) ]; then \ 
     64            cp -rf $(prefix)/lib/* $(libdir); \ 
     65            rm -rf $(prefix)/lib; \ 
     66         fi 
    6567        -cp -rf $(prefix)/dom/xml/dtd/ $(prefix)/dev/xml/ 
    66         -mv $(prefix)/bin/nodeBooter $(nbdir) 
    67         -mv $(prefix)/bin/c_wavLoader $(nbdir) 
     68        -if [ $(prefix)/bin != $(nbdir) ]; then \ 
     69            mv $(prefix)/bin/nodeBooter $(nbdir); \ 
     70            mv $(prefix)/bin/c_wavLoader $(nbdir); \ 
     71         fi 
    6872        -chown -R $(SUDO_USER).$(SUDO_USER) $(prefix) 
    6973 
  • ossiedev/branches/jsnyder/trunk/system/ossie/framework/FileManager_impl.cpp

    r11048 r11064  
    2323#include <iostream> 
    2424#include <string> 
    25 #include <sstream> 
    26  
    27 #include <boost/filesystem/operations.hpp> 
    28 #include <boost/filesystem/path.hpp> 
    29 #include <boost/filesystem/exception.hpp> 
    30  
    31 #ifndef BOOST_VERSION 
    32 #include <boost/version.hpp> 
    33 #endif 
    34  
    35 #if BOOST_VERSION < 103500 
    36 #  include <boost/filesystem/cerrno.hpp> 
    37 #else 
    38 #  include <boost/cerrno.hpp> 
    39 #endif 
    40  
    41 namespace fs = boost::filesystem; 
     25 
    4226 
    4327#include "ossie/cf.h" 
    4428#include "ossie/FileManager_impl.h" 
    4529#include "ossie/debug.h" 
     30#include "ossie/ossieSupport.h" 
    4631 
    4732FileManager_impl::FileManager_impl ():FileSystem_impl () 
     
    251236    int result_length = 0; 
    252237    int tmp_length = 0; 
    253     try { 
    254238        for ( unsigned int i = 0; i < numMounts; i++ ) { 
    255239            DEBUG(4, FileManager, "Calling FileSystem->list"); 
     
    282266        DEBUG(4, FileManager, "About to return from list"); 
    283267        return result._retn(); 
    284     } catch (const fs::filesystem_error &ex) { 
    285 #if BOOST_VERSION < 103400 
    286         DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.error()); 
    287         if (ex.error() == fs::other_error) 
    288 #elif BOOST_VERSION < 103500 
    289         DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.system_error()); 
    290         if (ex.system_error() == EINVAL) 
    291 #else 
    292         DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.code().value()); ; 
    293         if (ex.code().value() == EINVAL) 
    294 #endif 
    295             throw CF::InvalidFileName(CF::CFEINVAL, ex.what()); 
    296         throw CF::FileException(CF::CFNOTSET, ex.what()); 
    297     } 
    298268} 
    299269 
     
    491461    DEBUG(5, FileManager, "Entering getFSandFSPath with path " << path); 
    492462 
    493     fs::path fullPath(path); 
    494     fs::path::iterator fullItr(fullPath.begin()); 
    495463    std::string tmpFSPath; 
    496464 
     
    514482    DEBUG(5, FileManager, "Entering pathMatches with path " << path << " mount point " << mPoint); 
    515483 
    516     fs::path fullPath(path); 
    517     fs::path::iterator fullItr(fullPath.begin()); 
    518  
    519     fs::path mPath(mPoint); 
    520     fs::path::iterator mItr(mPath.begin()); 
    521  
    522     unsigned int commonElements(0); 
    523  
    524     while (fullItr != fullPath.end()) { 
    525         if (*fullItr != *mItr) 
    526             break; 
    527         ++fullItr; 
    528         ++mItr; 
    529         ++commonElements; 
    530     } 
    531  
    532  
    533     fs::path localPath("/"); 
    534  
    535     while (fullItr != fullPath.end()) { 
    536         localPath /= *fullItr; 
    537         ++fullItr; 
    538     } 
    539     FSPath = localPath.string(); 
     484    unsigned n = 0, commonElements = 0; 
     485    for (n = 0; *path && *mPoint && *path == *mPoint; n++, path++, mPoint++) 
     486      if (n && *path == '/') 
     487        commonElements++; 
     488    FSPath = path; 
    540489 
    541490    DEBUG(5, FileManager, "Path matches with " << commonElements << " path elements in common and remaining path " << FSPath); 
  • ossiedev/branches/jsnyder/trunk/system/ossie/framework/FileSystem_impl.cpp

    r11048 r11064  
    2121****************************************************************************/ 
    2222 
     23#include <string> 
     24#include "ossie/FileSystem_impl.h" 
     25 
     26#ifdef USE_OPENCPI_FS 
     27#include "OcpiUtilFileFs.h" 
     28#include "OcpiCFUtilVfsFileSystem.h" 
     29 
     30 
     31FileSystem_impl::FileSystem_impl() 
     32: OCPI::CFUtil::VfsFileSystem(ossieSupport::ORB::poa, 
     33                              new OCPI::Util::FileFs::FileFs()) 
     34{ 
     35} 
     36FileSystem_impl::FileSystem_impl(const char *root) 
     37: OCPI::CFUtil::VfsFileSystem(ossieSupport::ORB::poa, 
     38                              new OCPI::Util::FileFs::FileFs(root)) 
     39{ 
     40} 
     41 
     42FileSystem_impl::~FileSystem_impl(){} 
     43 
     44// static 
     45bool FileSystem_impl::isValidPath(const char *path) { 
     46  try { 
     47    std::string s(path); 
     48    testFileName(s); 
     49  } catch (...) { 
     50    return false; 
     51  } 
     52  return true; 
     53} 
     54 
     55// static 
     56void FileSystem_impl::joinPath(const char *base, const char *rel, std::string &result) { 
     57  result = OCPI::Util::Vfs::joinNames(OCPI::Util::Vfs::directoryName(base), rel); 
     58} 
     59 
     60#else 
    2361/* SCA */ 
    2462 
    2563#include <iostream> 
    26 #include <string> 
    27  
    2864#include <fnmatch.h> 
    2965 
     
    4379namespace fs = boost::filesystem; 
    4480 
    45 #include "ossie/FileSystem_impl.h" 
    4681#include "ossie/debug.h" 
    4782 
     
    76111    DEBUG(6, FileSystem, "In destructor."); 
    77112} 
     113 
     114// Filename utility functions as static member functions of FileSystem_impl,  
     115// implemented using boost here, to limit boost dependency to here 
     116// static 
     117bool FileSystem_impl::isValidPath(const char *fileName) { 
     118    try { 
     119        fs::path testPath(fileName); 
     120    } catch (...) { 
     121        return false; 
     122    } 
     123 
     124    return true; 
     125} 
     126// static 
     127void FileSystem_impl::joinPath(const char *spdFile, const char *name, std::string &fileName) { 
     128    fs::path spdPath(spdFile); 
     129 
     130    fs::path filePath = spdPath.branch_path() / name; 
     131 
     132    fileName = filePath.string(); 
     133} 
     134 
    78135 
    79136void FileSystem_impl::remove (const char *fileName) throw (CORBA::SystemException, CF::FileException, CF::InvalidFileName) 
     
    157214            DEBUG(9, FileSystem, "In list checking file " << itr->path().filename()); 
    158215            if (fnmatch(searchPattern.c_str(), itr->path().filename().c_str(), 0) == 0) { 
    159                 DEBUG(9, FileSystem, "Match in list with " << itr->path().filename()); 
     216                DEBUG(9, FileSystem, "Match in list with " << itr->path().string()); 
    160217                fis->length(idx + 1); 
    161218 
     
    214271    result->length(0); 
    215272 
    216     recursiveList(rootDirPath, pattern, result); 
    217  
     273    try { 
     274      recursiveList(rootDirPath, pattern, result); 
     275    } catch (const fs::filesystem_error &ex) { 
     276      // Convert boost fs errors into SCA FileSystem errors 
     277#if BOOST_VERSION < 103400 
     278      DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.error()); 
     279      if (ex.error() == fs::other_error) 
     280#elif BOOST_VERSION < 103500 
     281      DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.system_error()); 
     282      if (ex.system_error() == EINVAL) 
     283#else 
     284      DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.code().value()); ; 
     285      if (ex.code().value() == EINVAL) 
     286#endif 
     287        throw CF::InvalidFileName(CF::CFEINVAL, ex.what()); 
     288      throw CF::FileException(CF::CFNOTSET, ex.what()); 
     289    } 
    218290    return result._retn(); 
    219291} 
     
    369441 
    370442///\todo Implement File object reference clean up. 
     443#endif /* end of else of ifdef USE_OPENCPI_FS */ 
  • ossiedev/branches/jsnyder/trunk/system/ossie/framework/File_impl.cpp

    r9807 r11064  
    2121****************************************************************************/ 
    2222 
     23#ifndef USE_OPENCPI_FS // This entire file isn't needed of we are using OpenCPI FS 
    2324#include <iostream> 
    2425#include <fstream> 
     
    136137    f.seekp(_filePointer); 
    137138} 
     139#endif /* of ifndef USE_OPENCPI_FS */ 
  • ossiedev/branches/jsnyder/trunk/system/ossie/framework/helperFunctions.cpp

    r11048 r11064  
    2424#include <iostream> 
    2525 
    26 #include <boost/filesystem/path.hpp> 
    27  
    28 namespace fs = boost::filesystem; 
     26#include "ossie/FileSystem_impl.h" 
    2927 
    3028#include <ossie/ossieSupport.h> 
     
    4038bool ossieSupport::isValidFileName(const char *fileName) 
    4139{ 
    42     try { 
    43         fs::path testPath(fileName); 
    44     } catch (...) { 
    45         return false; 
    46     } 
    47  
    48     return true; 
     40  return FileSystem_impl::isValidPath(fileName); 
    4941} 
    5042 
     
    5244{ 
    5345    DEBUG(9, spd_rel_file, "Called with spdFile: " << spdFile << ", name: " << name); 
    54     fs::path spdPath(spdFile); 
    5546 
    56     fs::path filePath = spdPath.branch_path() / name; 
    57  
    58     fileName = filePath.string(); 
     47    FileSystem_impl::joinPath(spdFile, name, fileName); 
    5948 
    6049    DEBUG(9, spd_rel_file, "Result: " << fileName); 
  • ossiedev/branches/jsnyder/trunk/system/ossie/include/ossie/FileSystem_impl.h

    r9807 r11064  
    2525#define __FILESYSTEM_IMPL__ 
    2626 
     27#include "ossie/cf.h" 
     28#include "ossie/ossieSupport.h" 
     29#ifdef USE_OPENCPI_FS 
     30 
     31#include "OcpiCFUtilVfsFileSystem.h" 
     32 
     33class FileSystem_impl : OCPI::CFUtil::VfsFileSystem, virtual public POA_CF::FileSystem { 
     34 public: 
     35  // The standalone constructor to create a file system based on a URL 
     36  FileSystem_impl(const char *url); 
     37  FileSystem_impl(); 
     38  ~FileSystem_impl(); 
     39  static bool isValidPath(const char *path); 
     40  static void joinPath(const char *base, const char *rel, std::string &result); 
     41}; 
     42#else 
     43 
    2744#include <vector> 
    2845#include <string> 
     
    4158    FileSystem_impl (const char *_root); 
    4259    ~ FileSystem_impl (); 
     60 
     61    static bool isValidPath(const char *path); 
     62 
     63    static void joinPath(const char *base, const char *rel, std::string &result); 
    4364 
    4465    void remove (const char *fileName) 
     
    89110 
    90111};                                                /* END CLASS DEFINITION FileSystem */ 
     112#endif                                            /* end of else of ifdef USE_OPENCPI_FS */ 
    91113#endif                                            /* __FILESYSTEM__ */ 
  • ossiedev/branches/jsnyder/trunk/system/ossie/parser/DASParser.cpp

    r9807 r11064  
    3838    das_file->read(fileData, fileSize); 
    3939 
    40     das_file->close(); 
     40    // das_file->close(); removed this since the only caller does this, like others 
    4141 
    4242    unsigned char *fileBuffer = fileData->get_buffer();