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


Öffentliche Datenelemente | |
| SflexModuleEinzel () | |
| virtual | ~SflexModuleEinzel () |
| 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 die Verknüpfung von einer XML-Datei mit einem XSLT-Stylesheet spezialisiert. Die Schnittstelle zum Modul (über PATH_INFO) ist folgendermaßen:
/einzel/pool/xmlName/xslName.ContentType
Bsp.: /einzel/heine/Lass_ab/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.
00120 {
00121 return contentType_;
00122 }
|
|
|
Liefert das Ergebnis des jeweiligen Arbeiters. Im Falle eines Fehlers liefert diese Methode auch die Fehlermeldung.
Implementiert SflexWorker.
00112 {
00113 return resultStream_.str();
00114 }
|
|
|
Liefert den Status des Arbeiters.
Implementiert SflexWorker.
00128 {
00129 return isSuccess_;
00130 }
|
|
|
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() != 4 ) {
00055 resultStream_ << "Modul Einzel: 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[2],
00062 paraList[3] );
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 Einzel: 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[ 3 ] );
00083 if ( !sflexXslOutput_ ) {
00084 resultStream_ << wF->getError();
00085 return;
00086 }
00087
00088 const string linkBase = config->getValue( "sflex", "scriptName" );
00089 const string styleBase = paraList[2] + "." + paraList[3];
00090 const string fileName = paraList[1];
00091 sflexXslOutput_->setStyleParam( "linkBase", linkBase );
00092 sflexXslOutput_->setStyleParam( "styleBase", styleBase );
00093 sflexXslOutput_->setStyleParam( "fileName", fileName );
00094
00095 sflexXslOutput_->work( xmlFile, xslFile );
00096 if ( !sflexXslOutput_->isSuccess() ) {
00097 resultStream_ << sflexXslOutput_->getResult();
00098 return;
00099 }
00100
00101 resultStream_ << sflexXslOutput_->getResult();
00102 contentType_ = sflexXslOutput_->getContentType();
00103 isSuccess_ = true;
00104
00105 return;
00106 }
|
|
|
|
|
|
der Status.
|
|
|
das Ergebnis.
|
|
|
der Zeiger auf das Ausgabe-Objekt.
|
1.2.14 geschrieben von Dimitri van Heesch,
© 1997-2002