From 52d1616151680d46cceb62cba752465ffd75a298 Mon Sep 17 00:00:00 2001 From: highstreetherbert Date: Fri, 10 Jul 2020 17:18:59 +0200 Subject: Reformat sdnr data-provider to ONAP code style Reformat to ONAP code style Issue-ID: SDNC-1275 Signed-off-by: highstreetherbert Change-Id: I16230015ab8af278ec9f865690b9308d8fa2c78a Signed-off-by: highstreetherbert --- .../dataprovider/model/ArchiveCleanProvider.java | 6 +- .../sdnr/wt/dataprovider/model/DataProvider.java | 10 +- .../dataprovider/model/HtDatabaseMaintenance.java | 4 +- .../wt/dataprovider/model/IEntityDataProvider.java | 6 +- .../sdnr/wt/dataprovider/model/IEsConfig.java | 6 +- .../wt/dataprovider/model/NetconfTimeStamp.java | 104 +++++++++++---------- .../dataprovider/model/StatusChangedHandler.java | 17 ++-- .../model/types/NetconfTimeStampImpl.java | 67 ++++++------- 8 files changed, 111 insertions(+), 109 deletions(-) (limited to 'sdnr/wt/data-provider/model') diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/ArchiveCleanProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/ArchiveCleanProvider.java index 559ed3148..2af7324e5 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/ArchiveCleanProvider.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/ArchiveCleanProvider.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model; import java.util.Date; @@ -23,6 +23,7 @@ public interface ArchiveCleanProvider { /** * Remove all index data older, than specified from faultlog and eventlog + * * @param olderAreOutdated time to specify older elements * @return number of removed elements */ @@ -30,6 +31,7 @@ public interface ArchiveCleanProvider { /** * Get number of elements older then + * * @param olderAreOutdated date to compare with and specify older elements * @return number of elements */ diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java index 15cc89212..a9e334668 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java @@ -67,6 +67,7 @@ public interface DataProvider extends ArchiveCleanProvider { /** * write internal equipment to database + * * @param internalEquipment with mandatory fields. */ void writeInventory(Inventory internalEquipment); @@ -81,6 +82,7 @@ public interface DataProvider extends ArchiveCleanProvider { /** * Update after new mountpoint registration + * * @param networkElementConnectionEntitiy data * @param nodeId of device (mountpoint name) */ @@ -101,9 +103,9 @@ public interface DataProvider extends ArchiveCleanProvider { */ void doWritePerformanceData(List list); - /** - * @return - */ - HtDatabaseClient getRawClient(); + /** + * @return + */ + HtDatabaseClient getRawClient(); } diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java index 11681c05f..51fe25d89 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/HtDatabaseMaintenance.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model; import java.util.List; diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEntityDataProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEntityDataProvider.java index 95ea0752b..9ba10cd0b 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEntityDataProvider.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEntityDataProvider.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.StatusChangedHandler.StatusKey; @@ -31,7 +31,7 @@ public interface IEntityDataProvider { public void setReadyStatus(boolean status); /** Set some static status information after startup */ - public void setStatus(StatusKey key,String value); + public void setStatus(StatusKey key, String value); /** Database configuration information **/ public IEsConfig getEsConfig(); diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEsConfig.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEsConfig.java index f41095db9..0f8f5e37d 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEsConfig.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/IEsConfig.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model; import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener; @@ -44,5 +44,5 @@ public interface IEsConfig { void registerConfigChangedListener(IConfigChangedListener archiveCleanService); - + } diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/NetconfTimeStamp.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/NetconfTimeStamp.java index 5bed9f7a3..26962c2e6 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/NetconfTimeStamp.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/NetconfTimeStamp.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model; import java.time.LocalDateTime; @@ -27,61 +27,63 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types. */ public interface NetconfTimeStamp { - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format - * - * @return String with Date in NETCONF/YANG Format Version 1.0. - */ - String getTimeStampAsNetconfString(); + /** + * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format + * + * @return String with Date in NETCONF/YANG Format Version 1.0. + */ + String getTimeStampAsNetconfString(); - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format - - * @return String with Date in NETCONF/YANG Format Version 1.0. - */ - String getTimeStampAsNetconfString(Date date); + /** + * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format + * + * @return String with Date in NETCONF/YANG Format Version 1.0. + */ + String getTimeStampAsNetconfString(Date date); - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format in GMT - * - * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. - */ - DateAndTime getTimeStamp(); + /** + * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format in GMT + * + * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. + */ + DateAndTime getTimeStamp(); - /** - * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT - * @param date specifying the date and time - * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. - */ - DateAndTime getTimeStamp(Date date); + /** + * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT + * + * @param date specifying the date and time + * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. + */ + DateAndTime getTimeStamp(Date date); - /** - * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT - * @param date specifying the date and time - * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. - */ - DateAndTime getTimeStamp(String date); + /** + * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT + * + * @param date specifying the date and time + * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. + */ + DateAndTime getTimeStamp(String date); - /** - * Return the String with a NETCONF time converted to long - * - * @param netconfTime as String according the formats given above - * @return Epoch milliseconds - * @throws IllegalArgumentException In case of no compliant time format definition for the string - */ - long getTimeStampFromNetconfAsMilliseconds(String netconfTime) throws IllegalArgumentException; + /** + * Return the String with a NETCONF time converted to long + * + * @param netconfTime as String according the formats given above + * @return Epoch milliseconds + * @throws IllegalArgumentException In case of no compliant time format definition for the string + */ + long getTimeStampFromNetconfAsMilliseconds(String netconfTime) throws IllegalArgumentException; - /** - * Deliver String result. - * - * @param netconfTime as String according the formats given above - * @return If successful: String in ISO8601 Format for database and presentation. If "wrong formed - * input" the Input string with the prefix "Maleformed date" is delivered back. - */ - String getTimeStampFromNetconf(String netconfTime); + /** + * Deliver String result. + * + * @param netconfTime as String according the formats given above + * @return If successful: String in ISO8601 Format for database and presentation. If "wrong formed input" the Input + * string with the prefix "Maleformed date" is delivered back. + */ + String getTimeStampFromNetconf(String netconfTime); - Date getDateFromNetconf(String netconfTime); + Date getDateFromNetconf(String netconfTime); - String getTimeStampAsNetconfString(LocalDateTime dt); + String getTimeStampAsNetconfString(LocalDateTime dt); -} \ No newline at end of file +} diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/StatusChangedHandler.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/StatusChangedHandler.java index fa64d4d3e..d97ee8463 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/StatusChangedHandler.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/StatusChangedHandler.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,16 +14,17 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model; public interface StatusChangedHandler { - public enum StatusKey { - CLUSTER_SIZE, - - } - public void onStatusChanged(StatusKey key,String newValue); - + public enum StatusKey { + CLUSTER_SIZE, + + } + + public void onStatusChanged(StatusKey key, String newValue); + } diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java index f5dd65269..c7f921708 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/NetconfTimeStampImpl.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/* * ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= @@ -14,7 +14,7 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. * ============LICENSE_END========================================================================== - ******************************************************************************/ + */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types; import java.time.LocalDateTime; @@ -41,32 +41,25 @@ import org.slf4j.LoggerFactory; * Format2 NETCONF - pattern from ietf-yang-types "2013-07-15" Pattern: * "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-](\d{2}):(\d{2}))" * - * Format3 NETCONF DateAndTime CoreModel-CoreFoundationModule-TypeDefinitions vom - * 2016-07-01 Example1: 20170118114449.1Z Example2: 20170118114449.1-0500 Pattern: - * "\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}.\d+?(Z|[\+\-](\d{2})(\d{2}))" typedef DateAndTime { description - * "This primitive type defines the date and time according to the following structure: - * 'yyyyMMddhhmmss.s[Z|{+|-}HHMm]' where: yyyy '0000'..'9999' year MM '01'..'12' month dd '01'..'31' - * day hh '00'..'23' hour mm '00'..'59' minute ss '00'..'59' second s '.0'..'.9' tenth of second - * (set to '.0' if EMS or NE cannot support this granularity) Z 'Z' indicates UTC (rather than local - * time) {+|-} '+' or '-' delta from UTC HH '00'..'23' time zone difference in hours Mm '00'..'59' - * time zone difference in minutes."; type string; } Format4 E/// specific Example1: - * 2017-01-23T13:32:38-05:00 Example2: 2017-01-23T13:32-05:00 + * Format3 NETCONF DateAndTime CoreModel-CoreFoundationModule-TypeDefinitions vom 2016-07-01 Example1: 20170118114449.1Z + * Example2: 20170118114449.1-0500 Pattern: "\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}.\d+?(Z|[\+\-](\d{2})(\d{2}))" typedef + * DateAndTime { description "This primitive type defines the date and time according to the following structure: + * 'yyyyMMddhhmmss.s[Z|{+|-}HHMm]' where: yyyy '0000'..'9999' year MM '01'..'12' month dd '01'..'31' day hh '00'..'23' + * hour mm '00'..'59' minute ss '00'..'59' second s '.0'..'.9' tenth of second (set to '.0' if EMS or NE cannot support + * this granularity) Z 'Z' indicates UTC (rather than local time) {+|-} '+' or '-' delta from UTC HH '00'..'23' time + * zone difference in hours Mm '00'..'59' time zone difference in minutes."; type string; } Format4 E/// specific + * Example1: 2017-01-23T13:32:38-05:00 Example2: 2017-01-23T13:32-05:00 * * Input formats netconfTime as String according the formats given above * * Return format is String in ISO8601 Format for database and presentation. * - * Example formats: - * 1) ISO8601. Example 2017-01-18T11:44:49.482-05:00 - * 2) Microwave ONF. Examples 20170118114449.1Z, 20170118114449.1-0500 - * 3.1) Ericson. Example: 2017-01-23T13:32:38-05:00 - * 3.2) Ericson. Example: 2017-01-23T13:32-05:00 - * Always 10 Groups, - * 1:Year 2:Month 3:day 4:Hour 5:minute 6:optional sec 7:optional ms 8:optional Z or 9:offset - * signedhour 10:min + * Example formats: 1) ISO8601. Example 2017-01-18T11:44:49.482-05:00 2) Microwave ONF. Examples 20170118114449.1Z, + * 20170118114449.1-0500 3.1) Ericson. Example: 2017-01-23T13:32:38-05:00 3.2) Ericson. Example: 2017-01-23T13:32-05:00 + * Always 10 Groups, 1:Year 2:Month 3:day 4:Hour 5:minute 6:optional sec 7:optional ms 8:optional Z or 9:offset + * signedhour 10:min * - * Template: - * private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); + * Template: private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); */ public class NetconfTimeStampImpl implements NetconfTimeStamp { @@ -77,22 +70,20 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp { /** * Specify the input format expected from netconf, and from specific devices. */ - private static DateTimeFormatter formatterInput = DateTimeFormatter.ofPattern("" - + "[yyyy-MM-dd'T'HH:mm[:ss][.SSS][.SS][.S][xxx][xx][X][Z]]" - + "[yyyyMMddHHmmss[.SSS][.SS][.S][xxx][xx][X][Z]]" - ).withZone(ZoneOffset.UTC); + private static DateTimeFormatter formatterInput = + DateTimeFormatter.ofPattern("" + "[yyyy-MM-dd'T'HH:mm[:ss][.SSS][.SS][.S][xxx][xx][X][Z]]" + + "[yyyyMMddHHmmss[.SSS][.SS][.S][xxx][xx][X][Z]]").withZone(ZoneOffset.UTC); /** * Specify output format that is used internally */ - private static DateTimeFormatter formatterOutput = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.S'Z'") - .withZone(ZoneOffset.UTC); + private static DateTimeFormatter formatterOutput = + DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.S'Z'").withZone(ZoneOffset.UTC); /** * Use static access */ - private NetconfTimeStampImpl() { - } + private NetconfTimeStampImpl() {} /* * ------------------------------------ Public function @@ -100,6 +91,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp { /** * Use this function to get the converter + * * @return global converter */ public static NetconfTimeStamp getConverter() { @@ -118,12 +110,12 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp { /** * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format - + * * @return String with Date in NETCONF/YANG Format Version 1.0. */ @Override public String getTimeStampAsNetconfString(Date date) { - return ZonedDateTime.ofInstant(date.toInstant(),ZoneOffset.UTC).format(formatterOutput); + return ZonedDateTime.ofInstant(date.toInstant(), ZoneOffset.UTC).format(formatterOutput); } @@ -140,6 +132,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp { /** * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT + * * @param date specifying the date and time * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. */ @@ -147,8 +140,10 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp { public DateAndTime getTimeStamp(Date date) { return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString(date)); } + /** * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT + * * @param date specifying the date and time * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. */ @@ -173,14 +168,14 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp { throw new IllegalArgumentException( "No pattern for NETCONF data string: " + netconfTime + " Msg:" + e.getMessage()); } - } + } /** * Deliver String result. * * @param netconfTime as String according the formats given above - * @return If successful: String in ISO8601 Format for database and presentation. If "wrong formed - * input" the Input string with the prefix "Maleformed date" is delivered back. + * @return If successful: String in ISO8601 Format for database and presentation. If "wrong formed input" the Input + * string with the prefix "Maleformed date" is delivered back. */ @Override public String getTimeStampFromNetconf(String netconfTime) { @@ -189,7 +184,7 @@ public class NetconfTimeStampImpl implements NetconfTimeStamp { return inputUTC; } catch (Exception e) { LOG.info(e.getMessage()); - } + } LOG.debug("No pattern for NETCONF data string: {}", netconfTime); return "Malformed date: " + netconfTime; // Error handling } -- cgit 1.2.3-korg