List of usage examples for org.joda.time DateTimeZone setDefault
public static void setDefault(DateTimeZone zone) throws SecurityException
From source file:com.github.markserrano.jsonquery.jpa.util.DateTimeZoneRule.java
License:Apache License
@Override public Statement apply(final Statement statement, final FrameworkMethod frameworkMethod, Object target) { return new Statement() { @Override//from w w w .j av a 2s .co m public void evaluate() throws Throwable { before(); try { DateTimeZoneModifier annotation = frameworkMethod.getAnnotation(DateTimeZoneModifier.class); if (annotation == null) { statement.evaluate(); } else { DateTimeZone.setDefault(DateTimeZone.forID(annotation.value())); } } finally { after(); } } }; }
From source file:com.github.markserrano.jsonquery.jpa.util.DateTimeZoneRule.java
License:Apache License
private void before() { oldTimeZone = DateTimeZone.getDefault(); DateTimeZone.setDefault(zone); }
From source file:com.github.markserrano.jsonquery.jpa.util.DateTimeZoneRule.java
License:Apache License
private void after() { DateTimeZone.setDefault(oldTimeZone); }
From source file:com.godaddy.pubsub.ServiceApplication.java
License:Apache License
public static void main(String[] args) throws Exception { DateTimeZone.setDefault(DateTimeZone.UTC); ServiceApplication serviceApplication = new ServiceApplication(new GuiceBundleProvider()); try {/*from ww w.j av a 2 s. c o m*/ serviceApplication.run(args); } catch (Throwable ex) { ex.printStackTrace(); System.exit(1); } }
From source file:com.intuit.wasabi.Main.java
License:Apache License
/** * Application entry point./*from ww w. j a v a2 s . co m*/ * * @param args application arguments * @throws Exception unintended exception */ public static void main(String[] args) throws Exception { LOGGER.info("starting {}", Main.class.getSimpleName()); TimeZone.setDefault(getTimeZone("UTC")); DateTimeZone.setDefault(UTC); ServiceManager serviceManager = new ServiceManager().addModules(ApiModule.class, MetricsModule.class) .addServices(getEnabledWebServices()).addServices(getEnabledMetricsServices()) .addServices(EventLogService.class); serviceManager.start(); LOGGER.info("started {}", Main.class.getSimpleName()); }
From source file:com.metinkale.prayerapp.utils.TimeZoneChangedReceiver.java
License:Apache License
@Override public void onReceive(Context context, @NonNull Intent intent) { String tzId = intent.getStringExtra("time-zone"); try {/*w w w. java 2 s. c o m*/ DateTimeZone newDefault = DateTimeZone.forTimeZone(TimeZone.getDefault()); DateTimeZone.setDefault(newDefault); Log.d("prayer-times-android", "TIMEZONE_CHANGED received, changed default timezone to \"" + tzId + "\""); } catch (IllegalArgumentException e) { Log.d("prayer-times-android", "Could not recognize timezone id \"" + tzId + "\"", e); } }
From source file:com.mycollab.configuration.SiteConfiguration.java
License:Open Source License
public static void loadConfiguration() { TimeZone.setDefault(DateTimeZone.UTC.toTimeZone()); DateTimeZone.setDefault(DateTimeZone.UTC); int serverPort = Integer.parseInt(System.getProperty(ApplicationProperties.MYCOLLAB_PORT, "8080")); ApplicationProperties.loadProps();//from w w w . j a v a 2 s. com instance = new SiteConfiguration(); instance.sentErrorEmail = ApplicationProperties.getString(ERROR_SENDTO, "support@mycollab.com"); instance.siteName = ApplicationProperties.getString(SITE_NAME, "MyCollab"); instance.serverAddress = ApplicationProperties.getString(SERVER_ADDRESS, "localhost"); instance.serverPort = serverPort; String propLocale = ApplicationProperties.getString(DEFAULT_LOCALE, "en_US"); try { instance.defaultLocale = Locale.forLanguageTag(propLocale); } catch (Exception e) { instance.defaultLocale = Locale.US; } String pullMethodValue = ApplicationProperties.getString(ApplicationProperties.PULL_METHOD, "push"); instance.pullMethod = PullMethod.valueOf(pullMethodValue); instance.cdnUrl = String.format(ApplicationProperties.getString(CDN_URL), instance.serverAddress, instance.serverPort); instance.appUrl = String.format(ApplicationProperties.getString(APP_URL), instance.serverAddress, instance.serverPort); if (!instance.appUrl.endsWith("/")) { instance.appUrl += "/"; } instance.apiUrl = ApplicationProperties.getString(API_URL, "https://api.mycollab.com/api/"); instance.endecryptPassword = ApplicationProperties.getString(BI_ENDECRYPT_PASSWORD, "esofthead321"); // load email String host = ApplicationProperties.getString(MAIL_SMTPHOST); String user = ApplicationProperties.getString(MAIL_USERNAME); String password = ApplicationProperties.getString(MAIL_PASSWORD); Integer port = Integer.parseInt(ApplicationProperties.getString(MAIL_PORT, "25")); Boolean isTls = Boolean.parseBoolean(ApplicationProperties.getString(MAIL_IS_TLS, "false")); Boolean isSsl = Boolean.parseBoolean(ApplicationProperties.getString(MAIL_IS_SSL, "false")); String noreplyEmail = ApplicationProperties.getString(MAIL_NOTIFY, ""); instance.emailConfiguration = new EmailConfiguration(host, user, password, port, isTls, isSsl, noreplyEmail); // load database configuration String driverClass = ApplicationProperties.getString(DB_DRIVER_CLASS); String dbUrl = ApplicationProperties.getString(DB_URL); String dbUser = ApplicationProperties.getString(DB_USERNAME); String dbPassword = ApplicationProperties.getString(DB_PASSWORD); instance.databaseConfiguration = new DatabaseConfiguration(driverClass, dbUrl, dbUser, dbPassword); instance.resourceDownloadUrl = ApplicationProperties.getString(RESOURCE_DOWNLOAD_URL); if (!"".equals(instance.resourceDownloadUrl)) { instance.resourceDownloadUrl = String.format(instance.resourceDownloadUrl, instance.serverAddress, instance.serverPort); } else { instance.resourceDownloadUrl = instance.appUrl + "file/"; } instance.dropboxCallbackUrl = ApplicationProperties.getString(DROPBOX_AUTH_LINK); instance.ggDriveCallbackUrl = ApplicationProperties.getString(GOOGLE_DRIVE_LINK); instance.facebookUrl = ApplicationProperties.getString(FACEBOOK_URL, "https://www.facebook.com/mycollab2"); instance.twitterUrl = ApplicationProperties.getString(TWITTER_URL, "https://twitter.com/mycollabdotcom"); instance.googleUrl = ApplicationProperties.getString(GOOGLE_URL, "https://plus.google.com/u/0/b/112053350736358775306/+Mycollab/about/p/pub"); instance.linkedinUrl = ApplicationProperties.getString(LINKEDIN_URL, "http://www.linkedin.com/company/mycollab"); Configuration configuration = new Configuration(Configuration.VERSION_2_3_25); configuration.setDefaultEncoding("UTF-8"); try { List<TemplateLoader> loaders = new ArrayList<>(); File i18nFolder = new File(FileUtils.getUserFolder(), "i18n"); File confFolder1 = new File(FileUtils.getUserFolder(), "conf"); File confFolder2 = new File(FileUtils.getUserFolder(), "src/main/conf"); if (i18nFolder.exists()) { loaders.add(new FileTemplateLoader(i18nFolder)); } if (confFolder1.exists()) { loaders.add(new FileTemplateLoader(confFolder1)); } if (confFolder2.exists()) { loaders.add(new FileTemplateLoader(confFolder2)); } loaders.add(new ClassTemplateLoader(SiteConfiguration.class.getClassLoader(), "")); configuration.setTemplateLoader( new MultiTemplateLoader(loaders.toArray(new TemplateLoader[loaders.size()]))); instance.freemarkerConfiguration = configuration; } catch (IOException e) { e.printStackTrace(); System.exit(-1); } }
From source file:com.mycollab.test.rule.EssentialInitRule.java
License:Open Source License
@Override public Statement apply(Statement base, Description description) { SiteConfiguration.loadConfiguration(); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); DateTimeZone.setDefault(DateTimeZone.UTC); return base;//from www .j a va 2s . c o m }
From source file:com.prayer.App.java
License:Apache License
@Override public void onCreate() { super.onCreate(); sContext = this; JobManager.create(this).addJobCreator(new MyJobCreator()); mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler(mCaughtExceptionHandler); DateTimeZone.setDefault(DateTimeZone.forTimeZone(TimeZone.getDefault())); try {// w w w .j a v a 2 s . com Times.getTimes(); } catch (Exception e) { } Utils.init(this); startService(new Intent(this, WidgetService.class)); Times.setAlarms(); PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this); }
From source file:com.robwilliamson.healthyesther.App.java
License:Open Source License
@Override public void onCreate() { super.onCreate(); JodaTimeAndroid.init(this); DateTimeZone.setDefault(DateTimeZone.forOffsetMillis(TimeZone.getDefault().getRawOffset())); if (BuildConfig.DEBUG) { HealthDbHelper.sDebug = true;/*w ww . j a va 2 s .co m*/ } sUiThreadId = Thread.currentThread().getId(); sInstance = this; TimingManager.INSTANCE.applicationCreated(getApplicationContext()); }