#include <SflexModuleApparat.hpp>
Abgeleitet von SflexModule.
Klassendiagramm für SflexModuleApparat:


Öffentliche Datenelemente | |
| SflexModuleApparat () | |
| virtual | ~SflexModuleApparat () | 
| virtual void | work () | 
| Läßt das Modul arbeiten. Mehr... | |
| virtual const std::string | getResult () const | 
| Liefert das Ergebnis des jeweiligen Arbeiters. Mehr... | |
| virtual const std::string | getContentType () const | 
| Liefert den Content-Type des produzierten Ergebnisses. Mehr... | |
| virtual bool | isSuccess () const | 
| Liefert den Status des Arbeiters. Mehr... | |
Private Attribute | |
| bool | isSuccess_ | 
| der Status. Mehr... | |
| std::string | contentType_ | 
| std::ostringstream | resultStream_ | 
| das Ergebnis. Mehr... | |
| SflexXslOutput * | sflexXslOutput_ | 
| der Zeiger auf das Ausgabe-Objekt. Mehr... | |
Dieses Modul ist auf den Lesartenapparat der DHA spezialisiert. Die Schnittstelle zum Modul (über PATH_INFO) ist folgendermaßen:
 /apparat/pool/xmlName/scopeID/lesartNr_stepPos/xslName.ContentType
 Bsp.: /apparat/heine/Lass_ab/scope1/1_1/index.html
 
 Im Stylesheet werden folgende Variablen gesetzt: 
      
  | 
  
| 
 
 
 00028 : isSuccess_( false ), 00029 contentType_( "" ), 00030 sflexXslOutput_( 0 ) 00031 { 00032 00033 }  | 
  
      
  | 
  
| 
 
 
 00038 {
00039     delete sflexXslOutput_;
00040 }
 | 
  
      
  | 
  
| 
 Liefert den Content-Type des produzierten Ergebnisses. 
 
 Implementiert SflexModule. 
 00129 {
00130     return contentType_;
00131 }
 | 
  
      
  | 
  
| 
 Liefert das Ergebnis des jeweiligen Arbeiters. Im Falle eines Fehlers liefert diese Methode auch die Fehlermeldung. 
 
 Implementiert SflexWorker. 
 00121 {
00122     return resultStream_.str();
00123 }
 | 
  
      
  | 
  
| 
 Liefert den Status des Arbeiters. 
 
 Implementiert SflexWorker. 
 00137 {
00138     return isSuccess_;
00139 }
 | 
  
      
  | 
  
| 
 Läßt das Modul arbeiten. 
 Implementiert SflexModule. 
 00046 {
00047     using std::string;
00048     using sflexhelper::getXmlFilename;
00049     using sflexhelper::getXslFilename;
00050     
00051     SflexConfig *config = SflexConfig::getConfig();
00052     const std::vector< string > ¶List = config->getModuleParameterList();
00053 
00054     if ( paraList.size() != 6 ) {
00055         resultStream_ << "Modul Apparat: Falsche Anzahl Parameter!\n";
00056         return;
00057     }
00058     config->addValue( "sflex", "pool", paraList[0] );
00059 
00060     const string xmlFile = getXmlFilename( paraList[1] );
00061     const string xslFile = getXslFilename( paraList[4],
00062                                            paraList[5] );
00063     
00064     bool isEmpty = ( xmlFile.empty() || xslFile.empty() );
00065     if ( isEmpty ) {
00066         const string pool    = config->getValue( "sflex", "pool" );
00067         const string dir     = config->getValue( pool, "root" );
00068         const string praefix = config->getValue( pool, "praefix" );
00069         const string suffix  = config->getValue( pool, "suffix" );
00070 
00071         resultStream_ << "Modul Apparat: die Dateinamen nicht erhalten!\n"
00072                       << "XmlFile  = " << xmlFile << "\n"
00073                       << "XslFile  = " << xslFile << "\n"
00074                       << "Pool     = " << pool << "\n"
00075                       << "Root-Dir = " << dir << "\n"
00076                       << "Praefix  = " << praefix << "\n"
00077                       << "Suffix   = " << suffix << "\n";
00078         return;
00079     }
00080 
00081     SflexWorkerFactory *wF = SflexWorkerFactory::getFactory();
00082     sflexXslOutput_ = wF->makeXslOutput( paraList[ 5 ] );
00083     if ( !sflexXslOutput_ ) {
00084         resultStream_ << wF->getError();
00085         return;
00086     }
00087 
00088     const string linkBase  = config->getValue( "sflex", "scriptName" );
00089     const string styleBase = paraList[ 4 ] + "." + paraList[ 5 ];
00090     const string fileName  = paraList[ 1 ];
00091     const string scopeId   = paraList[ 2 ];
00092     string pos      = paraList[ 3 ];
00093     unsigned int p  = pos.find('_');
00094     const string lesartNr = pos.substr(0, p);
00095     const string stepPos  = pos.substr(p + 1);
00096     
00097     sflexXslOutput_->setStyleParam( "linkBase", linkBase );
00098     sflexXslOutput_->setStyleParam( "styleBase", styleBase );
00099     sflexXslOutput_->setStyleParam( "fileName", fileName );
00100     sflexXslOutput_->setStyleParam( "scopeId", scopeId );
00101     sflexXslOutput_->setStyleParam( "lesartNr", lesartNr );
00102     sflexXslOutput_->setStyleParam( "stepPos", stepPos );
00103             
00104     sflexXslOutput_->work( xmlFile, xslFile );
00105     if ( !sflexXslOutput_->isSuccess() ) {
00106         resultStream_ << sflexXslOutput_->getResult();
00107         return;
00108     }
00109 
00110     resultStream_ << sflexXslOutput_->getResult();
00111     contentType_ = sflexXslOutput_->getContentType();
00112     isSuccess_ = true;
00113 
00114     return;
00115 }
 | 
  
      
  | 
  
| 
 
  | 
  
      
  | 
  
| 
 der Status. 
  | 
  
      
  | 
  
| 
 das Ergebnis. 
  | 
  
      
  | 
  
| 
 der Zeiger auf das Ausgabe-Objekt. 
  | 
  
1.2.14 geschrieben von Dimitri van Heesch,
 © 1997-2002