From 70af784f3d0752e97b68f77b34ab9bd4dcd1fb23 Mon Sep 17 00:00:00 2001 From: gotty Date: Wed, 20 Nov 2019 03:01:43 +0000 Subject: [PATCH] =?utf8?q?[LIB-10]=20=D0=A1orrect=20some=20site=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.hedgecode.org/lib/snooker-score-api/trunk@187 fb0bcced-7025-49ed-a12f-f98bce993226 --- pom.xml | 31 ++++++++- .../org/hedgecode/snooker/SnookerDateUtils.java | 70 +++++++++++++++------ .../org/hedgecode/snooker/api/PlayerImage.java | 4 +- .../hedgecode/snooker/cache/CacheSnookerScore.java | 2 +- src/site/apt/index.apt.vm | 4 +- src/site/resources/images/snooker_org.png | Bin 0 -> 3513 bytes src/site/ru/apt/index.apt.vm | 4 +- src/site/ru/xdoc/download.xml.vm | 16 ++--- src/site/site.xml | 2 +- src/site/site_ru.xml | 2 +- src/site/xdoc/download.xml.vm | 16 ++--- 11 files changed, 105 insertions(+), 46 deletions(-) create mode 100644 src/site/resources/images/snooker_org.png diff --git a/pom.xml b/pom.xml index ba62697..0c671d4 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.hedgecode.maven lib-parent - 2 + 3 ../lib-parent/pom.xml @@ -41,7 +41,32 @@ 2017 - http://lib.hedgecode.org/${project.artifactId}/ + https://lib.hedgecode.org/${project.artifactId}/ + + + + Hedgehog + Hedgecode + https://hedgecode.org/ + + inspirer + + + https://hedgecode.org/img/hedgehog50x50.png + + + + Bundle + Hedgecode + https://hedgecode.org/ + + data storage + + + https://hedgecode.org/img/bundle50x50.png + + + scm:svn:http://svn.hedgecode.org/lib/${project.artifactId}/trunk/ @@ -51,7 +76,7 @@ JIRA - http://issues.hedgecode.org/browse/${issueKey}/component/${issueComponentId} + https://issues.hedgecode.org/browse/${issueKey}/component/${issueComponentId} diff --git a/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java b/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java index aceb36a..69da93b 100644 --- a/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java +++ b/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java @@ -28,28 +28,39 @@ import java.util.TimeZone; */ public final class SnookerDateUtils { + private static SnookerDateUtils _instance; + public static final String DATE_PATTERN = "dd.MM.yyyy"; public static final String TIME_PATTERN = "HH:mm"; - public static final String DATETIME_PATTERN = TIME_PATTERN + " " + DATE_PATTERN; - - private static final TimeZone CTZ = TimeZone.getTimeZone("CET"); - private static final TimeZone LTZ = TimeZone.getDefault(); - - private static final DateFormat DATE_FORMAT = new SimpleDateFormat(DATE_PATTERN); - private static final DateFormat CET_TIME_FORMAT = new SimpleDateFormat(TIME_PATTERN); - private static final DateFormat CET_DATETIME_FORMAT = new SimpleDateFormat(DATETIME_PATTERN); - private static final DateFormat LOCAL_TIME_FORMAT = new SimpleDateFormat(TIME_PATTERN); - private static final DateFormat LOCAL_DATETIME_FORMAT = new SimpleDateFormat(DATETIME_PATTERN); - - static { - CET_TIME_FORMAT.setTimeZone(CTZ); - CET_DATETIME_FORMAT.setTimeZone(CTZ); - LOCAL_TIME_FORMAT.setTimeZone(LTZ); - LOCAL_DATETIME_FORMAT.setTimeZone(LTZ); + public static final String DATETIME_PATTERN = String.format("%s %s", TIME_PATTERN , DATE_PATTERN); + + private static final TimeZone SNOOKER_TIMEZONE = TimeZone.getTimeZone("CET"); + private static final TimeZone LOCAL_TIMEZONE = TimeZone.getDefault(); + + private final DateFormat dateFormat; + private final DateFormat snookerTimeFormat; + private final DateFormat snookerDateTimeFormat; + private final DateFormat localTimeFormat; + private final DateFormat localDateTimeFormat; + + private SnookerDateUtils() { + dateFormat = new SimpleDateFormat(DATE_PATTERN); + + snookerTimeFormat = new SimpleDateFormat(TIME_PATTERN); + snookerTimeFormat.setTimeZone(SNOOKER_TIMEZONE); + + snookerDateTimeFormat = new SimpleDateFormat(DATETIME_PATTERN); + snookerDateTimeFormat.setTimeZone(SNOOKER_TIMEZONE); + + localTimeFormat = new SimpleDateFormat(TIME_PATTERN); + localTimeFormat.setTimeZone(LOCAL_TIMEZONE); + + localDateTimeFormat = new SimpleDateFormat(DATETIME_PATTERN); + localDateTimeFormat.setTimeZone(LOCAL_TIMEZONE); } public static String formatDate(Date date) { - return DATE_FORMAT.format(date); + return getInstance().format(date); } public static String formatTime(Date date) { @@ -57,7 +68,7 @@ public final class SnookerDateUtils { } public static String formatTime(Date date, boolean withDate) { - return withDate ? CET_DATETIME_FORMAT.format(date) : CET_TIME_FORMAT.format(date); + return getInstance().format(date, false, withDate); } public static String formatLocalTime(Date date) { @@ -65,7 +76,28 @@ public final class SnookerDateUtils { } public static String formatLocalTime(Date date, boolean withDate) { - return withDate ? LOCAL_DATETIME_FORMAT.format(date) : LOCAL_TIME_FORMAT.format(date); + return getInstance().format(date, true, withDate); + } + + private String format(Date date) { + return dateFormat.format(date); + } + + private String format(Date date, boolean isLocal, boolean withDate) { + return getDateFormat(isLocal, withDate).format(date); + } + + private DateFormat getDateFormat(boolean isLocal, boolean withDate) { + if (isLocal) { + return withDate ? localDateTimeFormat : localTimeFormat; + } + return withDate ? snookerDateTimeFormat : snookerTimeFormat; + } + + protected static SnookerDateUtils getInstance() { + if (_instance == null) + _instance = new SnookerDateUtils(); + return _instance; } } diff --git a/src/main/java/org/hedgecode/snooker/api/PlayerImage.java b/src/main/java/org/hedgecode/snooker/api/PlayerImage.java index 9a23a93..2b8e0ff 100644 --- a/src/main/java/org/hedgecode/snooker/api/PlayerImage.java +++ b/src/main/java/org/hedgecode/snooker/api/PlayerImage.java @@ -29,8 +29,10 @@ import org.hedgecode.snooker.SnookerURLUtils; */ public class PlayerImage implements Serializable { + private static final long serialVersionUID = -8500007961319779078L; + private URL url; - private BufferedImage image; + private transient BufferedImage image; public PlayerImage(URL imageUrl) { url = imageUrl; diff --git a/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java b/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java index ccce491..5aaedc7 100644 --- a/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java +++ b/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java @@ -65,7 +65,7 @@ public class CacheSnookerScore extends JsonSnookerScore implements SnookerScoreA public static CacheSnookerScore getInstance() { if (_instance == null) - _instance= new CacheSnookerScore(); + _instance = new CacheSnookerScore(); return _instance; } diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index 2104fed..171838b 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -31,7 +31,7 @@ ${project.name} so for the functioning of applications that use this library Internet access is required. The current version of the library: - {{{http://repo.hedgecode.org/content/repositories/releases/org/hedgecode/snooker/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar}${project.version}}} + {{{https://repo.hedgecode.org/content/repositories/releases/org/hedgecode/snooker/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar}${project.version}}} <>: @@ -59,4 +59,4 @@ ${project.name} Portal {{{http://snooker.org/}Snooker.org}} -[http://snooker.org/img/design/snookerorg_small.png] Snooker.org Logo +[${project.url}images/snooker_org.png] Snooker.org Logo diff --git a/src/site/resources/images/snooker_org.png b/src/site/resources/images/snooker_org.png new file mode 100644 index 0000000000000000000000000000000000000000..f8f259540af9253ee5cc493e67f4a98ed80db180 GIT binary patch literal 3513 zcmV;q4My^bP)n00009a7bBm000XU z000XU0RWnu7ytkO8FWQhbW?9;ba!ELWdK2BZ(?O2No`?gWm08fWO;GPWjp`?4Ms^s zK~#9!>|9-p8&?%R-aRDyUdj2*eAD!$bSHj*t+lkm5@4 z9OsP(q&N~Uyb$jT5L|~AER~qHgOafbMkWI5R4j&= zwwn^M2x5vU25U?)#T2{2F~zhysqy-2Ijhsn^;g%SZ>)i7(6J5HN~iXXTOZU$;jP69 zrqM{#v>YBTJD*XWS}c_>8bDu7C!c(xIQIBsMbHu{bA26pOHJtATZHc7GMJ0&U@o`7 zT6UC3P(Hu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}7P;TL4VDD#_Vnd$KGo?uxqp3Lr2fG&)%*hN*O zFc)GBk;>74Zgm-Y#W0-R8#eg5U}z7TZXbI?-x&x{>Z?;<1gb~ocjo8K zwT2Q{$u*-V6MU3NRE)`;)C>ljScOvbvaa}jL2{XA6;`mamvzPOOEA1uQBzpZ+!V4X z-9yO(h$4UAGD5l@8~xUmsFHm&zw{u6(6S1Pr(YOU32QwRN#zr1RGDcK_sl54A5Z3JZ-miTC}yF1ACx^K;N4@|)C zk7iQ8(AS$dW{Vq*zsiecUR>1O9zLg)=mG=RH(R+4`*wa{&BJivhCN0EmDe>FU0h(% z(up;$DF^62{LYW^Fgib1Dc-|0C!1;_sPVfuV7Q)mbHCeXKIUO(v);6Di;uR^J-rzw zJc(!wH5jf9nDmg%PFe+s>oR%pHi)IUCX1pe{fzvWZT z0(VLJ0Tc9reP_{DS6i4%8pzbOS2s_)YdaA9APDFJ|F;)wkf#cfvU}OV1yM z-%h05fa*o``^6;Rc$MAWJcDq`M=^r76zW2@PFGa6bWj3<0hZ;swCJ%~60fq4MHTtg zxo)@!!`mxi`RSmrN9HIwTh6=~C(4S^A0fulBfl)|GrjK^ ztTBBKz^dem@;j{dEX8l+k7>`5@JQ!^;w2+(;l!3TrkF;zuoN>ExOr{m?S-e8Vz9>a ng#)jX_-X8c=d451{{>: <Все версии библиотеки до версии 1.0 не могут считаться полностью стабильными.> @@ -61,4 +61,4 @@ ${project.name} Портал {{{http://snooker.org/}Snooker.org}} -[http://snooker.org/img/design/snookerorg_small.png] Snooker.org Logo +[${project.url}images/snooker_org.png] Snooker.org Logo diff --git a/src/site/ru/xdoc/download.xml.vm b/src/site/ru/xdoc/download.xml.vm index 62f7cf8..f7ec094 100644 --- a/src/site/ru/xdoc/download.xml.vm +++ b/src/site/ru/xdoc/download.xml.vm @@ -28,23 +28,23 @@

Текущая стабильная версия ${project.name}: - ${project.artifactId}-${project.version}.jar - и её MD5 сумма. + ${project.artifactId}-${project.version}.jar + и её MD5 сумма.

-

Старые release-версии ${project.artifactId} доступны на странице Hedgecode Release Repository.

-

Старые snapshot-версии ${project.artifactId} доступны на странице Hedgecode Snapshot Repository.

+

Старые release-версии ${project.artifactId} доступны на странице Hedgecode Release Repository.

+

Старые snapshot-версии ${project.artifactId} доступны на странице Hedgecode Snapshot Repository.

Архивы с javadoc и исходными кодами текущей версии библиотеки: - javadoc, - sources. + javadoc, + sources.

-

Исходный код ${project.artifactId} доступен в Hedgecode Subversion Repository.

-

Исходный код ${project.name} распространяется под лицензией Apache License, version 2.0.

+

Исходный код ${project.artifactId} доступен в Hedgecode Subversion Repository.

+

Исходный код ${project.name} распространяется под лицензией Apache License, version 2.0.

diff --git a/src/site/site.xml b/src/site/site.xml index ce7ebeb..c615134 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -31,7 +31,7 @@ - + diff --git a/src/site/site_ru.xml b/src/site/site_ru.xml index f7f47ba..c441b88 100644 --- a/src/site/site_ru.xml +++ b/src/site/site_ru.xml @@ -31,7 +31,7 @@ - + diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 446b0bf..ead216b 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -28,23 +28,23 @@

The current stable version of ${project.name}: - ${project.artifactId}-${project.version}.jar - and its MD5 sum. + ${project.artifactId}-${project.version}.jar + and its MD5 sum.

-

Older releases can be found on ${project.artifactId} page of Hedgecode Release Repository.

-

Older snapshots can be found on ${project.artifactId} page of Hedgecode Snapshot Repository.

+

Older releases can be found on ${project.artifactId} page of Hedgecode Release Repository.

+

Older snapshots can be found on ${project.artifactId} page of Hedgecode Snapshot Repository.

Javadoc and Sources archives of the current version of the library: - javadoc, - sources. + javadoc, + sources.

-

Source code of the ${project.artifactId} can be found on Hedgecode Subversion Repository.

-

${project.name} source code is distributed under the Apache License, version 2.0.

+

Source code of the ${project.artifactId} can be found on Hedgecode Subversion Repository.

+

${project.name} source code is distributed under the Apache License, version 2.0.

-- 2.10.0