2020-09-15 03:16:26 +02:00
|
|
|
/*
|
2021-01-13 02:33:51 +01:00
|
|
|
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
2020-09-15 03:16:26 +02:00
|
|
|
*
|
|
|
|
* This file is part of StatoolInfos, simple service statistics tool.
|
|
|
|
*
|
|
|
|
* StatoolInfos is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* StatoolInfos 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 Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package fr.devinsy.statoolinfos.core;
|
|
|
|
|
2020-09-17 18:54:29 +02:00
|
|
|
import java.io.File;
|
2020-09-19 02:37:52 +02:00
|
|
|
import java.net.URL;
|
2021-03-01 04:42:59 +01:00
|
|
|
import java.time.LocalDate;
|
2020-09-28 03:52:51 +02:00
|
|
|
import java.time.LocalDateTime;
|
2021-06-03 04:50:51 +02:00
|
|
|
import java.time.YearMonth;
|
2020-09-19 02:37:52 +02:00
|
|
|
|
2020-10-23 03:59:44 +02:00
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
2020-09-19 02:37:52 +02:00
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2020-10-15 02:10:21 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
2020-09-17 18:54:29 +02:00
|
|
|
|
2021-05-14 02:40:15 +02:00
|
|
|
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
2021-05-18 19:40:29 +02:00
|
|
|
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
2021-06-03 04:50:51 +02:00
|
|
|
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
|
2020-09-17 02:28:37 +02:00
|
|
|
import fr.devinsy.statoolinfos.properties.PathProperties;
|
2020-09-15 03:16:26 +02:00
|
|
|
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
2021-06-11 23:35:50 +02:00
|
|
|
import fr.devinsy.statoolinfos.uptime.URLSet;
|
2021-06-08 19:01:11 +02:00
|
|
|
import fr.devinsy.statoolinfos.util.URLUtils;
|
2020-09-15 03:16:26 +02:00
|
|
|
|
|
|
|
/**
|
2020-09-19 02:37:52 +02:00
|
|
|
* The Class Service.
|
2020-09-15 03:16:26 +02:00
|
|
|
*/
|
|
|
|
public class Service extends PathPropertyList
|
|
|
|
{
|
|
|
|
private static final long serialVersionUID = 3629841771102288863L;
|
2020-10-04 00:18:38 +02:00
|
|
|
|
2020-10-15 02:10:21 +02:00
|
|
|
private static Logger logger = LoggerFactory.getLogger(Service.class);
|
|
|
|
|
2020-11-17 05:44:31 +01:00
|
|
|
public enum HostProviderType
|
|
|
|
{
|
|
|
|
HOME,
|
|
|
|
HOSTEDBAY,
|
|
|
|
HOSTEDSERVER,
|
|
|
|
OUTSOURCED,
|
|
|
|
UNKNOWN
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum HostServerType
|
|
|
|
{
|
|
|
|
NANO,
|
|
|
|
PHYSICAL,
|
|
|
|
VIRTUAL,
|
|
|
|
SHARED,
|
|
|
|
CLOUD,
|
|
|
|
UNKNOWN
|
|
|
|
}
|
|
|
|
|
2020-11-19 02:11:52 +01:00
|
|
|
public enum RegistrationType
|
|
|
|
{
|
|
|
|
NONE,
|
|
|
|
FREE,
|
|
|
|
MEMBER,
|
|
|
|
CLIENT,
|
|
|
|
UNKNOWN
|
|
|
|
}
|
|
|
|
|
2021-01-13 02:33:51 +01:00
|
|
|
public enum ServiceInstallType
|
|
|
|
{
|
|
|
|
DISTRIBUTION,
|
|
|
|
PROVIDER,
|
2021-01-28 19:42:59 +01:00
|
|
|
TOOLING,
|
2021-01-13 02:33:51 +01:00
|
|
|
PACKAGE,
|
|
|
|
CLONEREPO,
|
|
|
|
ARCHIVE,
|
|
|
|
SOURCES,
|
|
|
|
CONTAINER,
|
|
|
|
UNKNOWN
|
|
|
|
}
|
|
|
|
|
2020-10-04 00:18:38 +02:00
|
|
|
public enum Status
|
|
|
|
{
|
|
|
|
OK,
|
|
|
|
WARNING,
|
|
|
|
ALERT,
|
|
|
|
ERROR,
|
|
|
|
OVER,
|
2020-10-04 02:50:08 +02:00
|
|
|
VOID
|
2020-10-04 00:18:38 +02:00
|
|
|
}
|
|
|
|
|
2020-09-21 06:15:07 +02:00
|
|
|
private Organization organization;
|
2020-09-23 21:56:40 +02:00
|
|
|
private File inputFile;
|
|
|
|
private URL inputURL;
|
2020-10-23 03:59:44 +02:00
|
|
|
private String logoFileName;
|
2021-05-20 16:03:29 +02:00
|
|
|
private MetricsList metricsList;
|
2021-05-14 02:40:15 +02:00
|
|
|
private PropertyChecks inputChecks;
|
2021-05-18 19:40:29 +02:00
|
|
|
private CrawlJournal crawlJournal;
|
2020-09-15 03:16:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new service.
|
|
|
|
*/
|
|
|
|
public Service()
|
|
|
|
{
|
2021-05-14 02:40:15 +02:00
|
|
|
this(null);
|
2020-09-15 03:16:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new service.
|
|
|
|
*
|
|
|
|
* @param properties
|
|
|
|
* the properties
|
|
|
|
*/
|
2020-09-17 02:28:37 +02:00
|
|
|
public Service(final PathProperties properties)
|
2020-09-15 03:16:26 +02:00
|
|
|
{
|
|
|
|
super(properties);
|
2021-05-14 02:40:15 +02:00
|
|
|
this.inputChecks = new PropertyChecks();
|
2021-05-18 19:40:29 +02:00
|
|
|
this.crawlJournal = new CrawlJournal();
|
2021-05-20 16:03:29 +02:00
|
|
|
this.metricsList = new MetricsList();
|
2020-09-15 03:16:26 +02:00
|
|
|
}
|
|
|
|
|
2021-03-01 04:42:59 +01:00
|
|
|
/**
|
|
|
|
* Gets the age.
|
|
|
|
*
|
|
|
|
* @return the age
|
|
|
|
*/
|
|
|
|
public String getAge()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
LocalDate startDate = StatoolInfosUtils.parseDate(getStartDate());
|
|
|
|
LocalDate endDate = StatoolInfosUtils.parseDate(getEndDate());
|
|
|
|
|
|
|
|
result = StatoolInfosUtils.toHumanDuration(startDate, endDate);
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-03 06:30:47 +02:00
|
|
|
/**
|
|
|
|
* Gets the contact email.
|
|
|
|
*
|
|
|
|
* @return the contact email
|
|
|
|
*/
|
|
|
|
public String getContactEmail()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("service.contact.email");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the contact website.
|
|
|
|
*
|
|
|
|
* @return the contact website
|
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getContactURL()
|
2020-10-03 06:30:47 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
2020-10-03 06:30:47 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
result = getURL("service.contact.url");
|
2020-10-03 06:30:47 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-01-15 05:49:47 +01:00
|
|
|
/**
|
|
|
|
* Gets the country code.
|
|
|
|
*
|
|
|
|
* @return the country code
|
|
|
|
*/
|
|
|
|
public String getCountryCode()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
2021-01-16 04:43:40 +01:00
|
|
|
result = StringUtils.toRootUpperCase(get("host.country.code"));
|
2021-01-15 05:49:47 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-05-16 11:46:11 +02:00
|
|
|
/**
|
|
|
|
* Gets the crawl date.
|
|
|
|
*
|
|
|
|
* @return the crawl date
|
|
|
|
*/
|
|
|
|
public LocalDateTime getCrawlDate()
|
|
|
|
{
|
|
|
|
LocalDateTime result;
|
|
|
|
|
|
|
|
result = LocalDateTime.parse(get("crawl.datetime"));
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-01-16 04:43:40 +01:00
|
|
|
/**
|
|
|
|
* Gets the crawled date.
|
|
|
|
*
|
|
|
|
* @return the crawled date
|
|
|
|
*/
|
2020-09-28 03:52:51 +02:00
|
|
|
public LocalDateTime getCrawledDate()
|
|
|
|
{
|
|
|
|
LocalDateTime result;
|
|
|
|
|
|
|
|
result = LocalDateTime.parse(get("crawl.file.datetime"));
|
|
|
|
|
2021-05-16 11:46:11 +02:00
|
|
|
if (result.getYear() == 1970)
|
|
|
|
{
|
|
|
|
result = getCrawlDate();
|
|
|
|
}
|
|
|
|
|
2020-09-28 03:52:51 +02:00
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-05-18 19:40:29 +02:00
|
|
|
public CrawlJournal getCrawlJournal()
|
|
|
|
{
|
|
|
|
return this.crawlJournal;
|
|
|
|
}
|
|
|
|
|
2020-09-15 03:16:26 +02:00
|
|
|
/**
|
|
|
|
* Gets the description.
|
|
|
|
*
|
|
|
|
* @return the description
|
|
|
|
*/
|
|
|
|
public String getDescription()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("service.description");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-03 06:30:47 +02:00
|
|
|
/**
|
|
|
|
* Gets the end date.
|
|
|
|
*
|
|
|
|
* @return the end date
|
|
|
|
*/
|
|
|
|
public String getEndDate()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
2020-10-15 01:49:55 +02:00
|
|
|
result = get("service.enddate");
|
2020-10-03 06:30:47 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-02-21 00:51:58 +01:00
|
|
|
/**
|
|
|
|
* Gets the host name.
|
|
|
|
*
|
|
|
|
* @return the host name
|
|
|
|
*/
|
|
|
|
public String getHostName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("host.name");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-11-17 05:44:31 +01:00
|
|
|
/**
|
|
|
|
* Gets the host provider type.
|
|
|
|
*
|
|
|
|
* @return the host provider type
|
|
|
|
*/
|
|
|
|
public HostProviderType getHostProviderType()
|
|
|
|
{
|
|
|
|
HostProviderType result;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
String value = StringUtils.toRootUpperCase(get("host.provider.type"));
|
|
|
|
|
|
|
|
result = HostProviderType.valueOf(value);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException | NullPointerException exception)
|
|
|
|
{
|
|
|
|
result = HostProviderType.UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the host server type.
|
|
|
|
*
|
|
|
|
* @return the host server type
|
|
|
|
*/
|
|
|
|
public HostServerType getHostServerType()
|
|
|
|
{
|
|
|
|
HostServerType result;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
String value = StringUtils.toRootUpperCase(get("host.server.type"));
|
|
|
|
|
|
|
|
result = HostServerType.valueOf(value);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException | NullPointerException exception)
|
|
|
|
{
|
|
|
|
result = HostServerType.UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-05-14 02:40:15 +02:00
|
|
|
public PropertyChecks getInputChecks()
|
|
|
|
{
|
|
|
|
return this.inputChecks;
|
|
|
|
}
|
|
|
|
|
2021-05-20 16:03:29 +02:00
|
|
|
/**
|
|
|
|
* Gets the input checks all.
|
|
|
|
*
|
|
|
|
* @return the input checks all
|
|
|
|
*/
|
|
|
|
public PropertyChecks getInputChecksAll()
|
|
|
|
{
|
|
|
|
PropertyChecks result;
|
|
|
|
|
|
|
|
result = new PropertyChecks();
|
|
|
|
|
|
|
|
result.addAll(this.inputChecks);
|
|
|
|
|
|
|
|
for (Metrics metrics : getMetrics())
|
|
|
|
{
|
|
|
|
result.addAll(metrics.getInputChecks());
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-23 21:56:40 +02:00
|
|
|
public File getInputFile()
|
2020-09-17 18:54:29 +02:00
|
|
|
{
|
2020-09-23 21:56:40 +02:00
|
|
|
return this.inputFile;
|
|
|
|
}
|
|
|
|
|
|
|
|
public URL getInputURL()
|
|
|
|
{
|
|
|
|
return this.inputURL;
|
2020-09-17 18:54:29 +02:00
|
|
|
}
|
|
|
|
|
2020-10-03 06:30:47 +02:00
|
|
|
/**
|
|
|
|
* Gets the legal website.
|
|
|
|
*
|
|
|
|
* @return the legal website
|
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getLegalURL()
|
2020-10-03 06:30:47 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
|
|
|
|
|
|
|
String value = get("service.legal.url", "service.legal");
|
2020-10-03 06:30:47 +02:00
|
|
|
|
2021-06-19 15:56:49 +02:00
|
|
|
result = URLUtils.of(value);
|
2020-10-03 06:30:47 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-04 00:18:38 +02:00
|
|
|
/**
|
|
|
|
* Gets the license name.
|
|
|
|
*
|
|
|
|
* @return the license name
|
|
|
|
*/
|
|
|
|
public String getLicenseName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("software.license.name");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-05-20 16:03:29 +02:00
|
|
|
/**
|
|
|
|
* Gets the local name.
|
|
|
|
*
|
|
|
|
* @return the local name
|
|
|
|
*/
|
|
|
|
public String getLocalFileBaseName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = this.organization.getTechnicalName() + "-" + getTechnicalName();
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-01-15 04:58:55 +01:00
|
|
|
/**
|
|
|
|
* Gets the local name.
|
|
|
|
*
|
|
|
|
* @return the local name
|
|
|
|
*/
|
|
|
|
public String getLocalFileName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
2021-05-20 16:03:29 +02:00
|
|
|
result = getLocalFileBaseName() + ".properties";
|
2021-01-15 04:58:55 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-23 03:59:44 +02:00
|
|
|
public String getLogoFileName()
|
|
|
|
{
|
|
|
|
return this.logoFileName;
|
|
|
|
}
|
|
|
|
|
2020-09-19 02:37:52 +02:00
|
|
|
/**
|
|
|
|
* Gets the logo URL.
|
|
|
|
*
|
|
|
|
* @return the logo URL
|
|
|
|
*/
|
2021-06-10 03:54:39 +02:00
|
|
|
public URL getLogoURL()
|
2020-09-19 02:37:52 +02:00
|
|
|
{
|
|
|
|
URL result;
|
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
result = getURL("service.logo");
|
2020-09-19 02:37:52 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-05-20 16:03:29 +02:00
|
|
|
public MetricsList getMetrics()
|
|
|
|
{
|
|
|
|
return this.metricsList;
|
|
|
|
}
|
|
|
|
|
2020-09-15 03:16:26 +02:00
|
|
|
/**
|
|
|
|
* Gets the name.
|
|
|
|
*
|
|
|
|
* @return the name
|
|
|
|
*/
|
|
|
|
public String getName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("service.name");
|
|
|
|
|
2020-10-23 03:59:44 +02:00
|
|
|
if (StringUtils.isBlank(result))
|
|
|
|
{
|
|
|
|
String seed = get("crawl.url");
|
|
|
|
result = DigestUtils.md5Hex(seed).substring(0, 8);
|
|
|
|
}
|
|
|
|
|
2020-09-15 03:16:26 +02:00
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-06-03 04:50:51 +02:00
|
|
|
/**
|
|
|
|
* Gets the organization.
|
|
|
|
*
|
|
|
|
* @return the organization
|
|
|
|
*/
|
2020-09-21 06:15:07 +02:00
|
|
|
public Organization getOrganization()
|
|
|
|
{
|
|
|
|
return this.organization;
|
|
|
|
}
|
2020-10-17 17:57:10 +02:00
|
|
|
|
2021-06-03 04:50:51 +02:00
|
|
|
/**
|
|
|
|
* Gets the previous month user count.
|
|
|
|
*
|
|
|
|
* @return the previous month user count
|
|
|
|
*/
|
|
|
|
public long getPreviousMonthUserCount()
|
|
|
|
{
|
|
|
|
long result;
|
|
|
|
|
2021-12-24 17:38:30 +01:00
|
|
|
MonthValues values = getMetricMonthValues("metrics.service.users");
|
2021-06-03 04:50:51 +02:00
|
|
|
|
2022-01-11 16:01:51 +01:00
|
|
|
YearMonth previousMonth = YearMonth.now().minusMonths(1);
|
|
|
|
values = values.extract(previousMonth, previousMonth);
|
2021-06-03 04:50:51 +02:00
|
|
|
|
|
|
|
result = (long) values.sum();
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the previous month visit count.
|
|
|
|
*
|
|
|
|
* @return the previous month visit count
|
|
|
|
*/
|
|
|
|
public long getPreviousMonthVisitCount()
|
|
|
|
{
|
|
|
|
long result;
|
|
|
|
|
2021-12-24 17:38:30 +01:00
|
|
|
MonthValues values = getMetricMonthValues("metrics.http.visits.humans");
|
2021-06-03 04:50:51 +02:00
|
|
|
|
|
|
|
values = values.extract(YearMonth.now().minusMonths(1), YearMonth.now().minusMonths(1));
|
|
|
|
|
|
|
|
result = (long) values.sum();
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-04-15 04:39:38 +02:00
|
|
|
/**
|
|
|
|
* Gets the registration load.
|
|
|
|
*
|
|
|
|
* @return the registration load
|
|
|
|
*/
|
|
|
|
public String getRegistrationLoad()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("service.registration.load");
|
|
|
|
|
|
|
|
if (result == null)
|
|
|
|
{
|
|
|
|
result = "open";
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-01-13 02:33:51 +01:00
|
|
|
/**
|
|
|
|
* Gets the service install type.
|
|
|
|
*
|
|
|
|
* @return the service install type
|
|
|
|
*/
|
|
|
|
public ServiceInstallType getServiceInstallType()
|
|
|
|
{
|
|
|
|
ServiceInstallType result;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
String value = StringUtils.toRootUpperCase(get("service.install.type"));
|
|
|
|
|
|
|
|
result = ServiceInstallType.valueOf(value);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException | NullPointerException exception)
|
|
|
|
{
|
|
|
|
result = ServiceInstallType.UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-19 02:17:57 +02:00
|
|
|
/**
|
|
|
|
* Gets the software description.
|
|
|
|
*
|
|
|
|
* @return the software description
|
|
|
|
*/
|
|
|
|
public String getSoftwareDescription()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("software.description");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-04 00:18:38 +02:00
|
|
|
/**
|
|
|
|
* Gets the software license name.
|
|
|
|
*
|
|
|
|
* @return the software license name
|
|
|
|
*/
|
|
|
|
public String getSoftwareLicenseName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("software.license.name");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the software license webpage.
|
|
|
|
*
|
|
|
|
* @return the software license webpage
|
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getSoftwareLicenseURL()
|
2020-10-04 00:18:38 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
2020-10-04 00:18:38 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
result = getURL("software.license.url");
|
2020-10-04 00:18:38 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-25 04:36:38 +02:00
|
|
|
/**
|
|
|
|
* Gets the software name.
|
|
|
|
*
|
|
|
|
* @return the software name
|
|
|
|
*/
|
|
|
|
public String getSoftwareName()
|
2020-09-15 03:16:26 +02:00
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("software.name");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-04 00:18:38 +02:00
|
|
|
/**
|
2021-06-08 19:01:11 +02:00
|
|
|
* Gets the software source URL.
|
2020-10-04 00:18:38 +02:00
|
|
|
*
|
2021-06-08 19:01:11 +02:00
|
|
|
* @return the software source URL
|
2020-10-04 00:18:38 +02:00
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getSoftwareSourceURL()
|
2020-10-04 00:18:38 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
2020-10-04 00:18:38 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
result = getURL("software.source.url");
|
2020-10-04 00:18:38 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-15 01:47:48 +02:00
|
|
|
/**
|
|
|
|
* Gets the software technical name.
|
|
|
|
*
|
|
|
|
* @return the software technical name
|
|
|
|
*/
|
|
|
|
public String getSoftwareTechnicalName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = StatoolInfosUtils.toTechnicalName(getSoftwareName());
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-04 00:18:38 +02:00
|
|
|
/**
|
|
|
|
* Gets the software version.
|
|
|
|
*
|
|
|
|
* @return the software version
|
|
|
|
*/
|
|
|
|
public String getSoftwareVersion()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("software.version");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the software website.
|
|
|
|
*
|
|
|
|
* @return the software website
|
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getSoftwareWebsite()
|
2020-10-04 00:18:38 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
2020-10-04 00:18:38 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
result = getURL("software.website");
|
2020-10-04 00:18:38 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-03 06:30:47 +02:00
|
|
|
/**
|
|
|
|
* Gets the start date.
|
|
|
|
*
|
|
|
|
* @return the start date
|
|
|
|
*/
|
|
|
|
public String getStartDate()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
2020-10-15 01:49:55 +02:00
|
|
|
result = get("service.startdate");
|
2020-10-03 06:30:47 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-04 00:18:38 +02:00
|
|
|
/**
|
|
|
|
* Gets the status.
|
|
|
|
*
|
|
|
|
* @return the status
|
|
|
|
*/
|
|
|
|
public Status getStatus()
|
|
|
|
{
|
|
|
|
Status result;
|
|
|
|
|
|
|
|
String value = get("service.status", "service.status.level");
|
|
|
|
|
2020-10-04 02:50:08 +02:00
|
|
|
if ((StringUtils.isBlank(value)) || (StringUtils.equalsAnyIgnoreCase(value, "unknown", "void")))
|
2020-10-04 00:18:38 +02:00
|
|
|
{
|
2020-10-04 02:50:08 +02:00
|
|
|
result = Status.VOID;
|
2020-10-04 00:18:38 +02:00
|
|
|
}
|
|
|
|
else if (StringUtils.equalsAnyIgnoreCase(value, "ON", "OK"))
|
|
|
|
{
|
|
|
|
result = Status.OK;
|
|
|
|
}
|
|
|
|
else if (StringUtils.equalsAnyIgnoreCase(value, "alert"))
|
|
|
|
{
|
|
|
|
result = Status.ALERT;
|
|
|
|
}
|
2020-10-04 02:50:08 +02:00
|
|
|
else if (StringUtils.equalsAnyIgnoreCase(value, "error", "ko", "broken", "off"))
|
2020-10-04 00:18:38 +02:00
|
|
|
{
|
|
|
|
result = Status.ERROR;
|
|
|
|
}
|
2020-10-04 02:50:08 +02:00
|
|
|
else if (StringUtils.equalsAnyIgnoreCase(value, "over", "terminated", "closed", "ended"))
|
2020-10-04 00:18:38 +02:00
|
|
|
{
|
|
|
|
result = Status.OVER;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-04 02:50:08 +02:00
|
|
|
result = Status.VOID;
|
2020-10-04 00:18:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the status description.
|
|
|
|
*
|
|
|
|
* @return the status description
|
|
|
|
*/
|
|
|
|
public String getStatusDescription()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("service.status.description");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-04 02:50:08 +02:00
|
|
|
/**
|
|
|
|
* @return
|
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getTechnicalGuideURL()
|
2020-10-03 06:30:47 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
2020-10-03 06:30:47 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
String value = get("service.guide.technical", "service.guide.technical.url");
|
|
|
|
|
|
|
|
result = URLUtils.of(value);
|
2020-10-03 06:30:47 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-15 03:16:26 +02:00
|
|
|
/**
|
2020-09-17 02:03:56 +02:00
|
|
|
* Gets the technical name.
|
2020-09-15 03:16:26 +02:00
|
|
|
*
|
2020-09-17 02:03:56 +02:00
|
|
|
* @return the technical name
|
2020-09-15 03:16:26 +02:00
|
|
|
*/
|
2020-09-17 02:03:56 +02:00
|
|
|
public String getTechnicalName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
2020-09-25 04:36:38 +02:00
|
|
|
result = StatoolInfosUtils.toTechnicalName(getName());
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-06-19 15:56:49 +02:00
|
|
|
/**
|
|
|
|
* Gets the URL all.
|
|
|
|
*
|
|
|
|
* @return the URL all
|
|
|
|
*/
|
2021-06-11 23:35:50 +02:00
|
|
|
public URLSet getURLAll()
|
|
|
|
{
|
|
|
|
URLSet result;
|
|
|
|
|
|
|
|
result = new URLSet();
|
|
|
|
|
|
|
|
result.add(getContactURL());
|
|
|
|
result.add(getLegalURL());
|
|
|
|
result.add(getLogoURL());
|
|
|
|
result.add(getSoftwareWebsite());
|
|
|
|
result.add(getSoftwareLicenseURL());
|
|
|
|
result.add(getSoftwareSourceURL());
|
|
|
|
result.add(getTechnicalGuideURL());
|
|
|
|
result.add(getUserGuideURL());
|
|
|
|
result.add(getWebsiteURL());
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-25 04:36:38 +02:00
|
|
|
/**
|
|
|
|
* User count.
|
|
|
|
*
|
|
|
|
* @return the int
|
|
|
|
*/
|
|
|
|
public int getUserCount()
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
|
|
|
result = 0;
|
2020-09-17 02:03:56 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-03 06:30:47 +02:00
|
|
|
/**
|
|
|
|
* Gets the user doc.
|
|
|
|
*
|
|
|
|
* @return the user doc
|
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getUserGuideURL()
|
2020-10-03 06:30:47 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
2020-10-03 06:30:47 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
String value = get("service.documentation",
|
|
|
|
"service.documentation.url",
|
|
|
|
"service.documentation.user",
|
|
|
|
"service.documentation.user.url",
|
|
|
|
"service.documentation.tutorial",
|
2020-10-04 02:50:08 +02:00
|
|
|
"service.documentation.tutorial.url",
|
|
|
|
"service.guide.user",
|
|
|
|
"service.guide.user.url");
|
2020-10-03 06:30:47 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
result = URLUtils.of(value);
|
|
|
|
|
2020-10-03 06:30:47 +02:00
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-17 02:03:56 +02:00
|
|
|
/**
|
|
|
|
* Gets the website.
|
|
|
|
*
|
|
|
|
* @return the website
|
|
|
|
*/
|
2021-06-08 19:01:11 +02:00
|
|
|
public URL getWebsiteURL()
|
2020-09-15 03:16:26 +02:00
|
|
|
{
|
2021-06-08 19:01:11 +02:00
|
|
|
URL result;
|
2020-09-15 03:16:26 +02:00
|
|
|
|
2021-06-08 19:01:11 +02:00
|
|
|
result = getURL("service.website");
|
2020-09-15 03:16:26 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
2020-09-17 18:54:29 +02:00
|
|
|
|
2020-10-02 18:18:17 +02:00
|
|
|
/**
|
|
|
|
* Checks if is registration client.
|
|
|
|
*
|
|
|
|
* @return true, if is registration client
|
|
|
|
*/
|
|
|
|
public boolean isRegistrationClient()
|
|
|
|
{
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
result = StringUtils.containsIgnoreCase(get("service.registration"), "Client");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if is registration free.
|
|
|
|
*
|
|
|
|
* @return true, if is registration free
|
|
|
|
*/
|
|
|
|
public boolean isRegistrationFree()
|
|
|
|
{
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
result = StringUtils.containsIgnoreCase(get("service.registration"), "Free");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-04-15 04:39:38 +02:00
|
|
|
/**
|
|
|
|
* Checks if is registration load full.
|
|
|
|
*
|
|
|
|
* @return true, if is registration load full
|
|
|
|
*/
|
|
|
|
public boolean isRegistrationLoadFull()
|
|
|
|
{
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
result = StringUtils.containsIgnoreCase(get("service.registration.load"), "full");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if is registration load open.
|
|
|
|
*
|
|
|
|
* @return true, if is registration load open
|
|
|
|
*/
|
|
|
|
public boolean isRegistrationLoadOpen()
|
|
|
|
{
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
result = StringUtils.containsIgnoreCase(get("service.registration.load"), "open");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-10-02 18:18:17 +02:00
|
|
|
/**
|
|
|
|
* Checks if is registration member.
|
|
|
|
*
|
|
|
|
* @return true, if is registration member
|
|
|
|
*/
|
|
|
|
public boolean isRegistrationMember()
|
|
|
|
{
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
result = StringUtils.containsIgnoreCase(get("service.registration"), "Member");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if is registration none.
|
|
|
|
*
|
|
|
|
* @return true, if is registration none
|
|
|
|
*/
|
|
|
|
public boolean isRegistrationNone()
|
|
|
|
{
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
result = StringUtils.containsIgnoreCase(get("service.registration"), "None");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-05-26 02:05:45 +02:00
|
|
|
/**
|
|
|
|
* Checks if is registration unknown.
|
|
|
|
*
|
|
|
|
* @return true, if is registration unknown
|
|
|
|
*/
|
|
|
|
public boolean isRegistrationUnknown()
|
|
|
|
{
|
|
|
|
boolean result;
|
|
|
|
|
|
|
|
if (isRegistrationNone() || isRegistrationFree() || isRegistrationMember() || isRegistrationClient())
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-23 21:56:40 +02:00
|
|
|
public void setInputFile(final File inputFile)
|
|
|
|
{
|
|
|
|
this.inputFile = inputFile;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setInputURL(final URL inputURL)
|
2020-09-17 18:54:29 +02:00
|
|
|
{
|
2020-09-23 21:56:40 +02:00
|
|
|
this.inputURL = inputURL;
|
2020-09-17 18:54:29 +02:00
|
|
|
}
|
2020-09-21 06:15:07 +02:00
|
|
|
|
2020-10-23 03:59:44 +02:00
|
|
|
public void setLogoFileName(final String logoFileName)
|
|
|
|
{
|
|
|
|
this.logoFileName = logoFileName;
|
|
|
|
}
|
|
|
|
|
2020-09-21 06:15:07 +02:00
|
|
|
public void setOrganization(final Organization organization)
|
|
|
|
{
|
|
|
|
this.organization = organization;
|
|
|
|
}
|
2020-09-15 03:16:26 +02:00
|
|
|
}
|