diff --git a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java index 54100dd..87d6f9b 100644 --- a/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java +++ b/src/fr/devinsy/statoolinfos/checker/PropertyChecker.java @@ -34,96 +34,96 @@ import fr.devinsy.strings.StringsUtils; */ public class PropertyChecker { + public static final String STRING = "^.+$"; + public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?"; + public static final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})"; + public static final String URL = "^(http(s)?://)?\\w+(\\.\\w+)+(/.*)?$"; + public static final String EMAIL = "^.*@.*$"; + + private PropertyRules serviceRules; private PropertyRules federationRules; private PropertyRules organizationRules; - private PropertyRules serviceRules; /** * Instantiates a new property checker. */ public PropertyChecker() { - final String STRING = "^.+$"; - final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?"; - final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})"; - final String URL = "^(http(s)?://)?\\w+(\\.\\w+)+(/.*)?$"; - final String EMAIL = "^.*@.*$"; - // this.federationRules = new PropertyRules(); this.federationRules.add("file.class", "^[Ff]ederation$", PropertyMode.MANDATORY); - this.federationRules.add("file.generator", STRING, PropertyMode.WISHED); - this.federationRules.add("file.datetime", DATETIME, PropertyMode.WISHED); - this.federationRules.add("file.protocol", STRING, PropertyMode.WISHED); + this.federationRules.add("file.generator", this.STRING, PropertyMode.WISHED); + this.federationRules.add("file.datetime", this.DATETIME, PropertyMode.WISHED); + this.federationRules.add("file.protocol", this.STRING, PropertyMode.WISHED); - this.federationRules.add("federation.name", STRING, PropertyMode.MANDATORY); - this.federationRules.add("federation.description", STRING, PropertyMode.WISHED); - this.federationRules.add("federation.website", URL, PropertyMode.WISHED); - this.federationRules.add("federation.logo", URL, PropertyMode.WISHED); - this.federationRules.add("federation.favicon", URL, PropertyMode.WISHED); - this.federationRules.add("federation.contact.url", URL, PropertyMode.WISHED); - this.federationRules.add("federation.contact.email", EMAIL, PropertyMode.WISHED); - this.federationRules.add("federation.legal.url", URL, PropertyMode.WISHED); - this.federationRules.add("federation.legal", URL, PropertyMode.WISHED); - this.federationRules.add("federation.guide.user", URL, PropertyMode.WISHED); - this.federationRules.add("federation.guide.technical", URL, PropertyMode.WISHED); - this.federationRules.add("federation.startdate", DATE, PropertyMode.WISHED); - this.federationRules.add("federation.enddate", DATE, PropertyMode.OPTIONAL); + this.federationRules.add("federation.name", this.STRING, PropertyMode.MANDATORY); + this.federationRules.add("federation.description", this.STRING, PropertyMode.WISHED); + this.federationRules.add("federation.website", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.logo", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.favicon", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.contact.url", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.contact.email", this.EMAIL, PropertyMode.WISHED); + this.federationRules.add("federation.legal.url", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.legal", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.guide.user", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.guide.technical", this.URL, PropertyMode.WISHED); + this.federationRules.add("federation.startdate", this.DATE, PropertyMode.WISHED); + this.federationRules.add("federation.enddate", this.DATE, PropertyMode.OPTIONAL); // this.organizationRules = new PropertyRules(); this.organizationRules.add("file.class", "^[Oo]rganization$", PropertyMode.MANDATORY); - this.organizationRules.add("file.generator", STRING, PropertyMode.WISHED); - this.organizationRules.add("file.datetime", DATETIME, PropertyMode.WISHED); - this.organizationRules.add("file.protocol", STRING, PropertyMode.WISHED); + this.organizationRules.add("file.generator", this.STRING, PropertyMode.WISHED); + this.organizationRules.add("file.datetime", this.DATETIME, PropertyMode.WISHED); + this.organizationRules.add("file.protocol", this.STRING, PropertyMode.WISHED); - this.organizationRules.add("organization.name", STRING, PropertyMode.MANDATORY); - this.organizationRules.add("organization.description", STRING, PropertyMode.WISHED); - this.organizationRules.add("organization.website", URL, PropertyMode.WISHED); - this.organizationRules.add("organization.logo", URL, PropertyMode.WISHED); - this.organizationRules.add("organization.owner.name", STRING, PropertyMode.OPTIONAL); - this.organizationRules.add("organization.owner.website", URL, PropertyMode.OPTIONAL); - this.organizationRules.add("organization.owner.logo", URL, PropertyMode.OPTIONAL); - this.organizationRules.add("organization.contact.url", URL, PropertyMode.WISHED); - this.organizationRules.add("organization.contact.email", EMAIL, PropertyMode.WISHED); - this.organizationRules.add("organization.legal", URL, PropertyMode.WISHED); - this.organizationRules.add("organization.legal.url", URL, PropertyMode.WISHED); - this.organizationRules.add("organization.technical", URL, PropertyMode.WISHED); - this.organizationRules.add("organization.technical.url", URL, PropertyMode.WISHED); - this.organizationRules.add("organization.startdate", DATE, PropertyMode.WISHED); - this.organizationRules.add("organization.enddate", DATE, PropertyMode.OPTIONAL); + this.organizationRules.add("organization.name", this.STRING, PropertyMode.MANDATORY); + this.organizationRules.add("organization.description", this.STRING, PropertyMode.WISHED); + this.organizationRules.add("organization.website", this.URL, PropertyMode.WISHED); + this.organizationRules.add("organization.logo", this.URL, PropertyMode.WISHED); + this.organizationRules.add("organization.owner.name", this.STRING, PropertyMode.OPTIONAL); + this.organizationRules.add("organization.owner.website", this.URL, PropertyMode.OPTIONAL); + this.organizationRules.add("organization.owner.logo", this.URL, PropertyMode.OPTIONAL); + this.organizationRules.add("organization.contact.url", this.URL, PropertyMode.WISHED); + this.organizationRules.add("organization.contact.email", this.EMAIL, PropertyMode.WISHED); + this.organizationRules.add("organization.legal", this.URL, PropertyMode.WISHED); + this.organizationRules.add("organization.legal.url", this.URL, PropertyMode.WISHED); + this.organizationRules.add("organization.technical", this.URL, PropertyMode.WISHED); + this.organizationRules.add("organization.technical.url", this.URL, PropertyMode.WISHED); + this.organizationRules.add("organization.startdate", this.DATE, PropertyMode.WISHED); + this.organizationRules.add("organization.enddate", this.DATE, PropertyMode.OPTIONAL); // this.serviceRules = new PropertyRules(); this.serviceRules.add("file.class", "^[Ss]ervice$", PropertyMode.MANDATORY); - this.serviceRules.add("file.generator", STRING, PropertyMode.WISHED); - this.serviceRules.add("file.datetime", DATETIME, PropertyMode.WISHED); - this.serviceRules.add("file.protocol", STRING, PropertyMode.WISHED); + this.serviceRules.add("file.generator", this.STRING, PropertyMode.WISHED); + this.serviceRules.add("file.datetime", this.DATETIME, PropertyMode.WISHED); + this.serviceRules.add("file.protocol", this.STRING, PropertyMode.WISHED); - this.serviceRules.add("service.name", STRING, PropertyMode.MANDATORY); - this.serviceRules.add("service.description", STRING, PropertyMode.WISHED); - this.serviceRules.add("service.website", URL, PropertyMode.WISHED); - this.serviceRules.add("service.logo", URL, PropertyMode.WISHED); - this.serviceRules.add("service.contact.url", URL, PropertyMode.WISHED); - this.serviceRules.add("service.contact.email", EMAIL, PropertyMode.WISHED); - this.serviceRules.add("service.legal.url", URL, PropertyMode.WISHED); - this.serviceRules.add("service.guide.user", URL, PropertyMode.WISHED); - this.serviceRules.add("service.guide.technical", URL, PropertyMode.WISHED); - this.serviceRules.add("service.startdate", DATE, PropertyMode.WISHED); - this.serviceRules.add("service.enddate", DATE, PropertyMode.OPTIONAL); + this.serviceRules.add("service.name", this.STRING, PropertyMode.MANDATORY); + this.serviceRules.add("service.description", this.STRING, PropertyMode.WISHED); + this.serviceRules.add("service.website", this.URL, PropertyMode.WISHED); + this.serviceRules.add("service.logo", this.URL, PropertyMode.WISHED); + this.serviceRules.add("service.contact.url", this.URL, PropertyMode.WISHED); + this.serviceRules.add("service.contact.email", this.EMAIL, PropertyMode.WISHED); + this.serviceRules.add("service.legal.url", this.URL, PropertyMode.WISHED); + this.serviceRules.add("service.guide.user", this.URL, PropertyMode.WISHED); + this.serviceRules.add("service.guide.technical", this.URL, PropertyMode.WISHED); + this.serviceRules.add("service.startdate", this.DATE, PropertyMode.WISHED); + this.serviceRules.add("service.enddate", this.DATE, PropertyMode.OPTIONAL); this.serviceRules.add("service.status.level", "^(OK|WARNING|ALERT|ERROR|OVER|VOID)$", PropertyMode.MANDATORY); - this.serviceRules.add("service.status.description", DATE, PropertyMode.OPTIONAL); + this.serviceRules.add("service.status.description", this.STRING, PropertyMode.OPTIONAL); this.serviceRules.add("service.registration", "^(None|Free|Member|Client)([,;+](None|Free|Member|Client))?$", PropertyMode.MANDATORY); - this.serviceRules.add("software.name", STRING, PropertyMode.MANDATORY); - this.serviceRules.add("software.website", URL, PropertyMode.WISHED); - this.serviceRules.add("software.license.url", URL, PropertyMode.MANDATORY); - this.serviceRules.add("software.license.name", STRING, PropertyMode.MANDATORY); - this.serviceRules.add("software.version", STRING, PropertyMode.WISHED); - this.serviceRules.add("software.source.url", URL, PropertyMode.WISHED); + this.serviceRules.add("software.name", this.STRING, PropertyMode.MANDATORY); + this.serviceRules.add("software.website", this.URL, PropertyMode.WISHED); + this.serviceRules.add("software.license.url", this.URL, PropertyMode.MANDATORY); + this.serviceRules.add("software.license.name", this.STRING, PropertyMode.MANDATORY); + this.serviceRules.add("software.version", this.STRING, PropertyMode.WISHED); + this.serviceRules.add("software.source.url", this.URL, PropertyMode.WISHED); } /** @@ -185,6 +185,7 @@ public class PropertyChecker } else { + check.setStatus(Status.ALERT); check.setComment("Propriété inconnue"); } diff --git a/src/fr/devinsy/statoolinfos/checker/PropertyRules.java b/src/fr/devinsy/statoolinfos/checker/PropertyRules.java index 3fe00b6..134e66f 100644 --- a/src/fr/devinsy/statoolinfos/checker/PropertyRules.java +++ b/src/fr/devinsy/statoolinfos/checker/PropertyRules.java @@ -66,6 +66,14 @@ public class PropertyRules extends HashMap result = super.get(StringUtils.toRootLowerCase(path)); + if (result == null) + { + if (path.matches("^[^\\.]+\\.socialnetworks\\..+$")) + { + result = new PropertyRule("*.socialnetworks.*", PropertyChecker.URL, PropertyMode.WISHED); + } + } + // return result; } diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml index cad8422..3c1018a 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml @@ -11,7 +11,7 @@ -
+

Fichiers properties

Nombre de fichiers : n/a