def unpack(self): utils.putWait("Unpacking " + self.pretty_name) directory = self.cget("directory") + "/" + self.cget("name") utils.sh_mkdir_p(directory) detar_command = "tar -C " + directory + " --strip-components=1 -xaf " + self.cget("repo") if utils.sh_exec(detar_command): utils.putDoneOK() self.postUnpack() else: utils.putDoneFail()
def postUnpack(self): if self.cisTrue("multi_dseta_architecture"): webxml_path = CONFIG.get("tomcat", "catalina_home") + "webapps/" + self.cget("name") + "/WEB-INF/web.xml" cmd = """sed -i ' /<\/web-app>/i\\ <listener>\\ <listener-class>fr.unicaen.iota.dseta.service.PublisherContextListener</listener-class>\\ </listener>' %s""" % webxml_path if not utils.sh_exec(cmd): utils.putWarning("The Publisher listener could not be added to web.xml")
def postUnpack(self): if self.cget("use_gamma"): lambda_path = CONFIG.get("tomcat", "catalina_home") + "webapps/" + self.cget("name") gamma_path = self.cget("gamma_path") utils.sh_mkdir_p(gamma_path) detar_command = "tar -C " + gamma_path + " -xaf " + self.cget("gamma_repo") if utils.sh_exec(detar_command): gamma_path = gamma_path + "/GaMMa" utils.sh_cp(gamma_path+"/src/scripts/gamma.js", lambda_path+"/scripts") utils.sh_cp(gamma_path+"/src/styles/gamma-style.css", lambda_path+"/styles") openlayers_repo = gamma_path + "/src/OpenLayers-2.12.tar.gz" detar_command_openlayers = "tar -C " + lambda_path + " -xaf " + openlayers_repo if utils.sh_exec(detar_command_openlayers): jsp_queryepcis = lambda_path + "/jsp/pages/queryepcis.jsp" jsp_trace = lambda_path + "/jsp/pages/trace.jsp" cmd = """sed -i ' /<\/head>/i\\ <link rel="stylesheet" type="text/css" href="OpenLayers-2.12/theme/default/style.css">\\ <link rel="stylesheet" type="text/css" href="styles/gamma-style.css">\\ <script type="text/javascript" src="./OpenLayers-2.12/OpenLayers.js"></script>\\ <script type="text/javascript" src="scripts/gamma.js"></script>' %(file)s sed -i ' /<\/body>/i\\ <div id="map" class="smallmap"></div>\\ <script type="text/javascript">\\ gamma_init(); /* OpenLayers and div map init */\\ initShowOnMap("eventItems");\\ </script>' %(file)s """ utils.sh_exec(cmd % dict(file=jsp_queryepcis)) utils.sh_exec(cmd % dict(file=jsp_trace))
def postConfigure(self): # set default urls (for DSeTa) url = self.setSecuredURL() CONFIG.set("ds_policies", "xacml_url", url + "xi") # set policies directories (for DSeTa) policies_dir = CONFIG.get("ds_policies", "dir") admin_dir = (policies_dir + "/admin/").replace("//", "/") capture_dir = (policies_dir + "/capture/").replace("//", "/") query_dir = (policies_dir + "/query/").replace("//", "/") CONFIG.set("ds_policies", "admin_dir", admin_dir) CONFIG.set("ds_policies", "capture_dir", capture_dir) CONFIG.set("ds_policies", "query_dir",query_dir) if (self.cisTrue("deploy_policies")): utils.putWait("Initializing policies in " + policies_dir) utils.sh_mkdir_p(policies_dir) if utils.sh_exec("tar -C " + policies_dir + " --strip-components=1 -xaf resources/ds_policies.tar"): utils.putDoneOK() else: utils.putDoneFail()