/home/tetron/hack/vos/apps/tutorials/vostut7client.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "vostut7hello.hh"
00012
00013 using namespace VUtil;
00014 using namespace VOS;
00015
00016 int main(int argc, char** argv)
00017 {
00018 Site site;
00019 site.addSiteExtension(new LocalVipSiteExtension());
00020 site.setDefaultPolicy("core:accept-all");
00021
00022 try {
00023
00024 std::string siteurl;
00025 if(argc > 1) siteurl = argv[1];
00026 else siteurl = "vip://localhost:4231";
00027
00028 LOG("helloclient", 1, "Acquiring remote object at " << siteurl);
00029
00030 vRef<Vobject> v = Vobject::findObjectFromRoot(siteurl + "/hello");
00031
00032 vRef<Hello> h = meta_cast<Hello>(v);
00033
00034 LOG("helloclient", 1, "Saying 'Good day to you sir.'");
00035
00036
00037
00038
00039
00040 std::string s = h->hello("Good day to you sir.");
00041
00042 LOG("helloclient", 1, "Got back: '" << s << "'");
00043
00044 } catch(NoSuchObjectError x){
00045 LOG("helloclient", 1, "NoSuchObjectError " << x.what());
00046 } catch(NoSuchSiteError x){
00047 LOG("helloclient", 1, "NoSuchSiteError " << x.what());
00048 } catch(AccessControlError x){
00049 LOG("helloclient", 1, "AccessControlError " << x.what());
00050 } catch(RemoteError x){
00051 LOG("helloclient", 1, "RemoteError " << x.what());
00052 } catch(BadURLError x){
00053 LOG("helloclient", 1, "BadURLError " << x.what());
00054 }
00055 return 0;
00056 }
00057