Upgraded catgenerator lib. Add bird default logo for services.

This commit is contained in:
Christian P. MOMON 2020-10-01 15:30:06 +02:00
parent b568101584
commit e0184400c5
7 changed files with 48 additions and 9 deletions

View file

@ -23,6 +23,6 @@
<classpathentry kind="lib" path="lib/xidyn-1.11.1.jar" sourcepath="lib/xidyn-1.11.1-sources.zip"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.11.jar" sourcepath="lib/commons-lang3-3.11-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-text-1.9.jar" sourcepath="lib/commons-text-1.9-sources.jar"/>
<classpathentry kind="lib" path="lib/catgenerator-0.1.0.jar" sourcepath="lib/catgenerator-0.1.0-sources.zip"/>
<classpathentry kind="lib" path="lib/catgenerator-0.1.1.jar" sourcepath="lib/catgenerator-0.1.1-sources.zip"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,4 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
org.eclipse.jdt.core.codeComplete.localPrefixes=
org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11

View file

@ -76,6 +76,10 @@ formatter_settings_version=19
jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false
org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true

View file

@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.catgenerator.core.BirdGenerator;
import fr.devinsy.catgenerator.core.CatGenerator;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
@ -42,6 +43,12 @@ public class CrawlCache
{
private static Logger logger = LoggerFactory.getLogger(CrawlCache.class);
public static enum DefaultLogoGenerator
{
CAT,
BIRD
}
private File directory;
/**
@ -192,10 +199,12 @@ public class CrawlCache
* the target
* @param seed
* the seed
* @param generator
* the generator
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public void restoreLogoTo(final URL url, final File target, final String seed) throws IOException
public void restoreLogoTo(final URL url, final File target, final String seed, final DefaultLogoGenerator generator) throws IOException
{
if ((target == null) || (seed == null))
{
@ -208,8 +217,15 @@ public class CrawlCache
try
{
logger.info("CatGeneratoring cat avatar (1): {}", target.getAbsoluteFile());
if ((generator == null) || (generator == DefaultLogoGenerator.CAT))
{
CatGenerator.buildAvatarTo(seed, target);
}
else
{
BirdGenerator.buildAvatarTo(seed, target);
}
}
catch (IOException exception)
{
logger.warn("CatGeneratoring failed for {}: {}", seed, exception.getMessage());
@ -224,8 +240,15 @@ public class CrawlCache
try
{
logger.info("CatGeneratoring cat avatar (2): {}", target.getAbsoluteFile());
if ((generator == null) || (generator == DefaultLogoGenerator.CAT))
{
CatGenerator.buildAvatarTo(seed, target);
}
else
{
BirdGenerator.buildAvatarTo(seed, target);
}
}
catch (IOException exception)
{
logger.warn("CatGeneratoring failed for {}: {}", seed, exception.getMessage());

View file

@ -40,6 +40,7 @@ import fr.devinsy.statoolinfos.core.Softwares;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
import fr.devinsy.statoolinfos.crawl.CrawlCache;
import fr.devinsy.statoolinfos.crawl.CrawlCache.DefaultLogoGenerator;
import fr.devinsy.statoolinfos.stats.StatAgent;
import fr.devinsy.statoolinfos.stats.categories.CategoryStats;
import fr.devinsy.statoolinfos.stats.properties.PropertyStats;
@ -220,7 +221,7 @@ public class Htmlizer
// Manage the logo file.
logger.info("Htmlize federation logo.");
cache.restoreLogoTo(federation.getLogoURL(), new File(htmlizeDirectory, federation.getTechnicalName() + "-logo.png"), federation.getTechnicalName());
cache.restoreLogoTo(federation.getLogoURL(), new File(htmlizeDirectory, federation.getTechnicalName() + "-logo.png"), federation.getTechnicalName(), DefaultLogoGenerator.CAT);
logger.info("Htmlize federation properties files.");
FileUtils.copyFile(federation.getInputFile(), new File(htmlizeDirectory, federation.getTechnicalName() + ".properties"));
@ -238,7 +239,7 @@ public class Htmlizer
{
// Manage the logo file.
logger.info("Htmlize organization logo: {}.", organization.getName());
cache.restoreLogoTo(organization.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-logo.png"), organization.getTechnicalName());
cache.restoreLogoTo(organization.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-logo.png"), organization.getTechnicalName(), DefaultLogoGenerator.CAT);
logger.info("Htmlize organization properties file: {}.", organization.getName());
FileUtils.copyFile(organization.getInputFile(), new File(htmlizeDirectory, organization.getTechnicalName() + ".properties"));
@ -251,7 +252,8 @@ public class Htmlizer
{
// Manage the logo file.
logger.info("Htmlize service logo: {}.", service.getName());
cache.restoreLogoTo(service.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-" + service.getTechnicalName() + "-logo.png"), service.getTechnicalName());
cache.restoreLogoTo(service.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-" + service.getTechnicalName() + "-logo.png"), service.getTechnicalName(),
DefaultLogoGenerator.BIRD);
logger.info("Htmlize service properties file: {}.", service.getName());
FileUtils.copyFile(service.getInputFile(),
new File(htmlizeDirectory, organization.getTechnicalName() + "-" + service.getTechnicalName() + ".properties"));
@ -347,7 +349,7 @@ public class Htmlizer
copyStuff(htmlizeDirectory);
// Manage the logo file.
cache.restoreLogoTo(organization.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-logo.jpg"), organization.getTechnicalName());
cache.restoreLogoTo(organization.getLogoURL(), new File(htmlizeDirectory, organization.getTechnicalName() + "-logo.jpg"), organization.getTechnicalName(), DefaultLogoGenerator.CAT);
//
logger.info("Htmlize about page.");
@ -361,7 +363,7 @@ public class Htmlizer
for (Service service : organization.getServices())
{
// Manage the logo file.
cache.restoreLogoTo(service.getLogoURL(), new File(htmlizeDirectory, service.getTechnicalName() + "-logo.jpg"), service.getTechnicalName());
cache.restoreLogoTo(service.getLogoURL(), new File(htmlizeDirectory, service.getTechnicalName() + "-logo.jpg"), service.getTechnicalName(), DefaultLogoGenerator.BIRD);
//
page = ServicePage.build(organization, service);