/** * @param key * a compatibility hint key * @return true if the specified compatibility hint is enabled, otherwise false */ public static boolean isHintEnabled(final String key) { if (HINTS.get(key) != null) { return HINTS.get(key); } return "true".equals(Configurator.getProperty(key)); } }
private static TimeZoneCache cacheInit() { Optional<TimeZoneCache> property = Configurator.getObjectProperty(TZ_CACHE_IMPL); return property.orElseGet(() -> { try { return (TimeZoneCache) Class.forName(DEFAULT_TZ_CACHE_IMPL).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoClassDefFoundError e) { throw new RuntimeException(MESSAGE_MISSING_DEFAULT_TZ_CACHE_IMPL, e); } }); }
/** * @param vTimeZone * @return */ private VTimeZone updateDefinition(VTimeZone vTimeZone) throws IOException, ParserException { final TzUrl tzUrl = vTimeZone.getTimeZoneUrl(); if (tzUrl != null) { final int connectTimeout = Configurator.getIntProperty(UPDATE_CONNECT_TIMEOUT).orElse(0); final int readTimeout = Configurator.getIntProperty(UPDATE_READ_TIMEOUT).orElse(0); URLConnection connection; URL url = tzUrl.getUri().toURL(); if ("true".equals(Configurator.getProperty(UPDATE_PROXY_ENABLED).orElse("false")) && proxy != null) { connection = url.openConnection(proxy); } else { connection = url.openConnection(); } connection.setConnectTimeout(connectTimeout); connection.setReadTimeout(readTimeout); final CalendarBuilder builder = new CalendarBuilder(); final Calendar calendar = builder.build(connection.getInputStream()); final VTimeZone updatedVTimeZone = (VTimeZone) calendar.getComponent(Component.VTIMEZONE); if (updatedVTimeZone != null) { return updatedVTimeZone; } } return vTimeZone; }
/** * @param vTimeZone * @return */ private VTimeZone updateDefinition(VTimeZone vTimeZone) throws IOException, ParserException { final TzUrl tzUrl = vTimeZone.getTimeZoneUrl(); if (tzUrl != null) { final int connectTimeout = Configurator.getIntProperty(UPDATE_CONNECT_TIMEOUT).orElse(0); final int readTimeout = Configurator.getIntProperty(UPDATE_READ_TIMEOUT).orElse(0); URLConnection connection; URL url = tzUrl.getUri().toURL(); if ("true".equals(Configurator.getProperty(UPDATE_PROXY_ENABLED).orElse("false")) && proxy != null) { connection = url.openConnection(proxy); } else { connection = url.openConnection(); } connection.setConnectTimeout(connectTimeout); connection.setReadTimeout(readTimeout); final CalendarBuilder builder = new CalendarBuilder(); final Calendar calendar = builder.build(connection.getInputStream()); final VTimeZone updatedVTimeZone = (VTimeZone) calendar.getComponent(Component.VTIMEZONE); if (updatedVTimeZone != null) { return updatedVTimeZone; } } return vTimeZone; }
/** * @param key * a compatibility hint key * @return true if the specified compatibility hint is enabled, otherwise false */ public static boolean isHintEnabled(final String key) { if (HINTS.get(key) != null) { return HINTS.get(key); } return "true".equals(Configurator.getProperty(key)); } }
private static TimeZoneCache cacheInit() { Optional<TimeZoneCache> property = Configurator.getObjectProperty(TZ_CACHE_IMPL); return property.orElseGet(() -> { try { return (TimeZoneCache) Class.forName(DEFAULT_TZ_CACHE_IMPL).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | NoClassDefFoundError e) { throw new RuntimeException(MESSAGE_MISSING_DEFAULT_TZ_CACHE_IMPL, e); } }); }
/** * @param key * a compatibility hint key * @return true if the specified compatibility hint is enabled, otherwise false */ public static boolean isHintEnabled(final String key) { if (HINTS.get(key) != null) { return HINTS.get(key); } return "true".equals(Configurator.getProperty(key)); } }
/** * @param key * a compatibility hint key * @return true if the specified compatibility hint is enabled, otherwise false */ public static boolean isHintEnabled(final String key) { if (HINTS.get(key) != null) { return HINTS.get(key); } return "true".equals(Configurator.getProperty(key)); } }
/** * @param key * a compatibility hint key * @return true if the specified compatibility hint is enabled, otherwise false */ public static boolean isHintEnabled(final String key) { if (((Map) HINTS.get()).get(key) != null) { return ((Boolean) ((Map) HINTS.get()).get(key)).booleanValue(); } return "true".equals(Configurator.getProperty(key)); } }
public static <T extends Enum<T>> Optional<T> getEnumProperty(Class<T> clazz, String key) { Optional<String> property = getProperty(key); if (property.isPresent()) { try { return Optional.of(Enum.valueOf(clazz, property.get())); } catch (IllegalArgumentException iae) { LOG.info(String.format("Invalid configuration value: %s", key), iae); return Optional.empty(); } } else { return Optional.empty(); } }
public static <T extends Enum<T>> Optional<T> getEnumProperty(Class<T> clazz, String key) { Optional<String> property = getProperty(key); if (property.isPresent()) { try { return Optional.of(Enum.valueOf(clazz, property.get())); } catch (IllegalArgumentException iae) { LOG.info(String.format("Invalid configuration value: %s", key), iae); return Optional.empty(); } } else { return Optional.empty(); } }
public static Optional<Integer> getIntProperty(final String key) { Optional<String> property = getProperty(key); if (property.isPresent()) { try { int intValue = Integer.parseInt(property.get()); return Optional.of(intValue); } catch (NumberFormatException nfe) { LOG.info(String.format("Invalid configuration value: %s", key), nfe); return Optional.empty(); } } else { return Optional.empty(); } }
public static Optional<Integer> getIntProperty(final String key) { Optional<String> property = getProperty(key); if (property.isPresent()) { try { int intValue = Integer.parseInt(property.get()); return Optional.of(intValue); } catch (NumberFormatException nfe) { LOG.info(String.format("Invalid configuration value: %s", key), nfe); return Optional.empty(); } } else { return Optional.empty(); } }
public static <T> Optional<T> getObjectProperty(String key) { Optional<String> property = getProperty(key); if (property.isPresent()) { try { return Optional.of((T) Class.forName(property.get()).newInstance()); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { LOG.info(String.format("Invalid configuration value: %s", key), e); return Optional.empty(); } } else { return Optional.empty(); } } }
public static <T> Optional<T> getObjectProperty(String key) { Optional<String> property = getProperty(key); if (property.isPresent()) { try { return Optional.of((T) Class.forName(property.get()).newInstance()); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { LOG.info(String.format("Invalid configuration value: %s", key), e); return Optional.empty(); } } else { return Optional.empty(); } } }
/** * Although timezones are not really applicable to DATE instances in iCalendar, the implementation * in iCal4j requires the use of a timezone. Dates in iCal4j may be either "floating", in that they * use the default Java timezone, or alternatively will use UTC (this is the default). * * The use of floating dates may be configured by specifying the following as a system property or in * a file called "ical4j.properties" in the classpath: * * <pre>net.fortuna.ical4j.timezone.date.floating=true</pre> * * @return the timezone used for date instances */ public static TimeZone getDateTimeZone() { if ("true".equals(Configurator.getProperty("net.fortuna.ical4j.timezone.date.floating"))) { return TimeZone.getDefault(); } return TimeZone.getTimeZone(UTC_ID); } }
/** * Although timezones are not really applicable to DATE instances in iCalendar, the implementation * in iCal4j requires the use of a timezone. Dates in iCal4j may be either "floating", in that they * use the default Java timezone, or alternatively will use UTC (this is the default). * * The use of floating dates may be configured by specifying the following as a system property or in * a file called "ical4j.properties" in the classpath: * * <pre>net.fortuna.ical4j.timezone.date.floating=true</pre> * * @return the timezone used for date instances */ public static TimeZone getDateTimeZone() { if ("true".equals(Configurator.getProperty("net.fortuna.ical4j.timezone.date.floating").orElse("false"))) { return TimeZone.getDefault(); } return getUtcTimeZone(); }
/** * Although timezones are not really applicable to DATE instances in iCalendar, the implementation * in iCal4j requires the use of a timezone. Dates in iCal4j may be either "floating", in that they * use the default Java timezone, or alternatively will use UTC (this is the default). * * The use of floating dates may be configured by specifying the following as a system property or in * a file called "ical4j.properties" in the classpath: * * <pre>net.fortuna.ical4j.timezone.date.floating=true</pre> * * @return the timezone used for date instances */ public static TimeZone getDateTimeZone() { if ("true".equals(Configurator.getProperty("net.fortuna.ical4j.timezone.date.floating").orElse("false"))) { return TimeZone.getDefault(); } return getUtcTimeZone(); }
/** * Although timezones are not really applicable to DATE instances in iCalendar, the implementation * in iCal4j requires the use of a timezone. Dates in iCal4j may be either "floating", in that they * use the default Java timezone, or alternatively will use UTC (this is the default). * * The use of floating dates may be configured by specifying the following as a system property or in * a file called "ical4j.properties" in the classpath: * * <pre>net.fortuna.ical4j.timezone.date.floating=true</pre> * * @return the timezone used for date instances */ public static TimeZone getDateTimeZone() { if ("true".equals(Configurator.getProperty("net.fortuna.ical4j.timezone.date.floating"))) { return TimeZone.getDefault(); } return getUtcTimeZone(); }
/** * Although timezones are not really applicable to DATE instances in iCalendar, the implementation * in iCal4j requires the use of a timezone. Dates in iCal4j may be either "floating", in that they * use the default Java timezone, or alternatively will use UTC (this is the default). * * The use of floating dates may be configured by specifying the following as a system property or in * a file called "ical4j.properties" in the classpath: * * <pre>net.fortuna.ical4j.timezone.date.floating=true</pre> * * @return the timezone used for date instances */ public static TimeZone getDateTimeZone() { if ("true".equals(Configurator.getProperty("net.fortuna.ical4j.timezone.date.floating"))) { return TimeZone.getDefault(); } return getUtcTimeZone(); }