00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef Y2WFMComponent_h
00021 #define Y2WFMComponent_h
00022
00023 #include <y2/Y2Component.h>
00024
00025 #include <ycp/YCPInteger.h>
00026 #include <ycp/YCPList.h>
00027 #include <ycp/YCPString.h>
00028
00029 #include "WFMSubAgent.h"
00030
00031 #define MAX_CLIENT_NAME_LEN 160
00032
00033 class Y2SystemNamespace;
00034
00035 class Y2WFMComponent : public Y2Component
00036 {
00037
00038 public:
00042 Y2WFMComponent();
00043
00047 ~Y2WFMComponent();
00048
00052 virtual string name() const;
00053
00057 virtual YCPValue doActualWork(const YCPList& arglist, Y2Component *displayserver);
00058
00059 static Y2WFMComponent* instance();
00060
00061 YCPInteger SCROpen (const YCPString& name, const YCPBoolean &check_version);
00062 void SCRClose (const YCPInteger& handle);
00063 YCPString SCRGetName (const YCPInteger &handle);
00064 void SCRSetDefault (const YCPInteger &handle);
00065 YCPInteger SCRGetDefault () const;
00066 YCPValue Args (const YCPInteger& index = YCPNull ()) const;
00067 YCPString GetLanguage () const;
00068 YCPString GetEncoding () const;
00069 YCPString SetLanguage (const YCPString& language, const YCPString& encoding = YCPNull ());
00070 YCPValue Read (const YCPPath &path, const YCPValue& arg);
00071 YCPValue Write (const YCPPath &path, const YCPValue& arg1, const YCPValue& arg2 = YCPNull ());
00072 YCPValue Execute (const YCPPath &path, const YCPValue& arg1);
00073 YCPValue CallFunction (const YCPString& client, const YCPList& args = YCPList ());
00074 YCPString GetEnvironmentEncoding ();
00075
00076 virtual Y2Namespace* import (const char* name_space);
00077
00084 void setupComponent (string client_name, string fullname,
00085 const YCPValue& script);
00086
00087 private:
00088
00089 bool createDefaultSCR ();
00090
00094 typedef vector <WFMSubAgent*> WFMSubAgents;
00095 typedef vector <Y2SystemNamespace*> SystemNamespaces;
00096
00097 WFMSubAgents scrs;
00098 SystemNamespaces system_namespaces;
00099
00103 WFMSubAgents::iterator find_handle (int);
00104
00108 int handle_cnt;
00109
00113 int default_handle;
00114
00118 WFMSubAgent local;
00119
00123 const char* get_env_lang () const;
00124
00128 string modulename;
00129
00135 YCPList argumentlist;
00136
00137 string currentLanguage;
00138 string currentEncoding;
00139
00143 string systemEncoding;
00144
00148 string environmentEncoding;
00149
00150
00151 static Y2WFMComponent* current_wfm;
00152
00156 YCPValue script;
00157
00161 string client_name;
00162
00166 string fullname;
00167 };
00168
00169
00170 #endif // Y2WFMComponent_h