2020-09-15 03:16:26 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
|
|
|
*
|
|
|
|
* 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.MalformedURLException;
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2020-09-17 18:54:29 +02:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
/**
|
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-09-17 18:54:29 +02:00
|
|
|
private File localFile;
|
2020-09-15 03:16:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates a new service.
|
|
|
|
*/
|
|
|
|
public Service()
|
|
|
|
{
|
|
|
|
super(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the description.
|
|
|
|
*
|
|
|
|
* @return the description
|
|
|
|
*/
|
|
|
|
public String getDescription()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("service.description");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-17 18:54:29 +02:00
|
|
|
public File getLocalFile()
|
|
|
|
{
|
|
|
|
return this.localFile;
|
|
|
|
}
|
|
|
|
|
2020-09-19 02:37:52 +02:00
|
|
|
/**
|
|
|
|
* Gets the logo URL.
|
|
|
|
*
|
|
|
|
* @return the logo URL
|
|
|
|
* @throws MalformedURLException
|
|
|
|
* the malformed URL exception
|
|
|
|
*/
|
|
|
|
public URL getLogoURL() throws MalformedURLException
|
|
|
|
{
|
|
|
|
URL result;
|
|
|
|
|
|
|
|
String path = get("service.logo");
|
|
|
|
if ((StringUtils.isBlank(path)) || (!StringUtils.startsWith(path, "http")))
|
|
|
|
{
|
|
|
|
result = null;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result = new URL(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-09-15 03:16:26 +02:00
|
|
|
/**
|
|
|
|
* Gets the name.
|
|
|
|
*
|
|
|
|
* @return the name
|
|
|
|
*/
|
|
|
|
public String getName()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("service.name");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getSoftware()
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
result = get("software.name");
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
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;
|
|
|
|
|
|
|
|
result = StatoolInfosUtils.buildTechnicalName(getName());
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the website.
|
|
|
|
*
|
|
|
|
* @return the website
|
|
|
|
*/
|
|
|
|
public String getWebsite()
|
2020-09-15 03:16:26 +02:00
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
2020-09-17 03:59:11 +02:00
|
|
|
result = get("service.website");
|
2020-09-15 03:16:26 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
2020-09-17 18:54:29 +02:00
|
|
|
|
|
|
|
public void setLocalFile(final File localFile)
|
|
|
|
{
|
|
|
|
this.localFile = localFile;
|
|
|
|
}
|
2020-09-15 03:16:26 +02:00
|
|
|
}
|