Projet

Général

Profil

Télécharger (4,13 ko) Statistiques
| Branche: | Tag: | Révision:
2e0a7cb1 Sylvain L. Sauvage
# -*- coding: utf-8 -*-
#
# This program is a part of the IoTa project.
#
19b58bab Rémy Ménard
# Copyright © 2012-2013 Université de Caen Basse-Normandie, GREYC
#
2e0a7cb1 Sylvain L. Sauvage
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# <http://www.gnu.org/licenses/>
#
# See AUTHORS for a list of contributors.
#
from config import CONFIG
import utils
import installer


class EpcILoNInstaller(installer.DBWebAppInstaller):

def __init__(self):
installer.DBWebAppInstaller.__init__(self, "EpcILoN web application", "epcilon", [
("Enter the EpcILoN web application name", "epcilon", "name", {}),
("Enter the archive file pathname", "epcilon", "repo", {"type": "file"}),
("Enter the EpcILoN database name", "epcilon", "db_name", {}),
("Enter the EpcILoN database login", "epcilon", "db_login", {}),
("Enter the EpcILoN database password", "epcilon", "db_password", {}),
8fd1d584 Rémy Ménard
("Use IoTa IDed (ETa and DSeTa) or not (Epcis and DS)?", "epcilon", "iota_ided", {"type": "YN"}),
2e0a7cb1 Sylvain L. Sauvage
("Enter the URL to the Epcis (or ETa) Query service", "epcilon", "subscription_url", {}),
bf9c3717 Rémy Ménard
("Enter the URL to the DS (or DSeTa)", "epcilon", "ds_url", {}),
8fd1d584 Rémy Ménard
("Enter this application’s identity", "epcilon", "identity",
{"when": ("epcilon", "iota_ided")}),
("Enter the keystore file name (PEM format)", "cert", "pem_keystore",
{"when": ("epcilon", "iota_ided")}),
("Enter the keystore password", "cert", "password",
{"when": ("epcilon", "iota_ided")}),
("Enter the truststore file name (PEM format)", "cert", "pem_truststore",
{"when": ("epcilon", "iota_ided")}),
("Enter the publisher frequency (time between each launch)", "epcilon", "publisher_frequency", {}),
("Enter the time before another try to publish", "epcilon", "publisher_pending_republish", {})
2e0a7cb1 Sylvain L. Sauvage
], [
("application",
8fd1d584 Rémy Ménard
{ "publish": "true",
"query-callback-address": ("epcilon", "callback_url"),
"query-client-address": ("epcilon", "subscription_url"),
"discovery-service-address": ("epcilon", "ds_url"),
"publisher-frequency" : ("epcilon", "publisher_frequency"),
"publisher-pending-republish" : ("epcilon", "publisher_pending_republish"),
"iota-ided" : ("epcilon", "iota_ided"),
bf9c3717 Rémy Ménard
"identity": ("epcilon", "identity"),
"pks-filename": ("cert", "keystore"),
19b58bab Rémy Ménard
"pks-password": ("cert", "password"),
"trust-pks-filename": ("cert", "truststore"),
8fd1d584 Rémy Ménard
"trust-pks-password": ("cert", "trustpassword")})
2e0a7cb1 Sylvain L. Sauvage
])


def postConfigure(self):
8fd1d584 Rémy Ménard
if self.cisTrue("iota_ided"):
bf9c3717 Rémy Ménard
self.setSecuredURL()
else:
self.setURL()
96454bcd Sylvain L. Sauvage
self.cset("callback_url", self.cget("url") + "StandingQueryCallbackServlet")
self.cset("db_jndi", "EPCILONDB")
2e0a7cb1 Sylvain L. Sauvage

def postInstall(self):
installer.DBWebAppInstaller.postInstall(self)
utils.putWait("Subscribing to the Epcis")
96454bcd Sylvain L. Sauvage
url = self.cget("url") + "SubscribedServlet"
bf9c3717 Rémy Ménard
cmd = "curl"
8fd1d584 Rémy Ménard
if self.cisTrue("iota_ided"):
bf9c3717 Rémy Ménard
keystore = CONFIG.get("cert", "pem_keystore")
keystore_pwd = CONFIG.get("cert", "password")
truststore = CONFIG.get("cert", "pem_truststore")
cmd += " --cert \"" + keystore + "\":\"" + keystore_pwd + "\" --cacert \"" + truststore + "\""
cmd += " " + url
if utils.sh_exec(cmd):
2e0a7cb1 Sylvain L. Sauvage
utils.putDoneOK()
else:
utils.putDoneFail()