List of usage examples for java.util TimeZone getDefault
public static TimeZone getDefault()
From source file:com.cloud.hypervisor.vmware.resource.VmwareResource.java
@Override public Answer executeRequest(Command cmd) { if (s_logger.isTraceEnabled()) s_logger.trace("Begin executeRequest(), cmd: " + cmd.getClass().getSimpleName()); Answer answer = null;/*from w ww .ja va2s . com*/ NDC.push(getCommandLogTitle(cmd)); try { long cmdSequence = _cmdSequence++; Date startTime = DateUtil.currentGMTTime(); PropertyMapDynamicBean mbean = new PropertyMapDynamicBean(); mbean.addProp("StartTime", DateUtil.getDateDisplayString(TimeZone.getDefault(), startTime)); mbean.addProp("Command", _gson.toJson(cmd)); mbean.addProp("Sequence", String.valueOf(cmdSequence)); mbean.addProp("Name", cmd.getClass().getSimpleName()); Class<? extends Command> clz = cmd.getClass(); if (cmd instanceof NetworkElementCommand) { return _vrResource.executeRequest((NetworkElementCommand) cmd); } else if (clz == ReadyCommand.class) { answer = execute((ReadyCommand) cmd); } else if (clz == GetHostStatsCommand.class) { answer = execute((GetHostStatsCommand) cmd); } else if (clz == GetVmStatsCommand.class) { answer = execute((GetVmStatsCommand) cmd); } else if (clz == GetVmDiskStatsCommand.class) { answer = execute((GetVmDiskStatsCommand) cmd); } else if (clz == CheckHealthCommand.class) { answer = execute((CheckHealthCommand) cmd); } else if (clz == StopCommand.class) { answer = execute((StopCommand) cmd); } else if (clz == RebootRouterCommand.class) { answer = execute((RebootRouterCommand) cmd); } else if (clz == RebootCommand.class) { answer = execute((RebootCommand) cmd); } else if (clz == CheckVirtualMachineCommand.class) { answer = execute((CheckVirtualMachineCommand) cmd); } else if (clz == PrepareForMigrationCommand.class) { answer = execute((PrepareForMigrationCommand) cmd); } else if (clz == MigrateCommand.class) { answer = execute((MigrateCommand) cmd); } else if (clz == MigrateWithStorageCommand.class) { answer = execute((MigrateWithStorageCommand) cmd); } else if (clz == MigrateVolumeCommand.class) { answer = execute((MigrateVolumeCommand) cmd); } else if (clz == DestroyCommand.class) { answer = execute((DestroyCommand) cmd); } else if (clz == CreateStoragePoolCommand.class) { return execute((CreateStoragePoolCommand) cmd); } else if (clz == ModifyTargetsCommand.class) { answer = execute((ModifyTargetsCommand) cmd); } else if (clz == ModifyStoragePoolCommand.class) { answer = execute((ModifyStoragePoolCommand) cmd); } else if (clz == DeleteStoragePoolCommand.class) { answer = execute((DeleteStoragePoolCommand) cmd); } else if (clz == CopyVolumeCommand.class) { answer = execute((CopyVolumeCommand) cmd); } else if (clz == AttachIsoCommand.class) { answer = execute((AttachIsoCommand) cmd); } else if (clz == ValidateSnapshotCommand.class) { answer = execute((ValidateSnapshotCommand) cmd); } else if (clz == ManageSnapshotCommand.class) { answer = execute((ManageSnapshotCommand) cmd); } else if (clz == BackupSnapshotCommand.class) { answer = execute((BackupSnapshotCommand) cmd); } else if (clz == CreateVolumeFromSnapshotCommand.class) { answer = execute((CreateVolumeFromSnapshotCommand) cmd); } else if (clz == CreatePrivateTemplateFromVolumeCommand.class) { answer = execute((CreatePrivateTemplateFromVolumeCommand) cmd); } else if (clz == CreatePrivateTemplateFromSnapshotCommand.class) { answer = execute((CreatePrivateTemplateFromSnapshotCommand) cmd); } else if (clz == UpgradeSnapshotCommand.class) { answer = execute((UpgradeSnapshotCommand) cmd); } else if (clz == GetStorageStatsCommand.class) { answer = execute((GetStorageStatsCommand) cmd); } else if (clz == PrimaryStorageDownloadCommand.class) { answer = execute((PrimaryStorageDownloadCommand) cmd); } else if (clz == GetVncPortCommand.class) { answer = execute((GetVncPortCommand) cmd); } else if (clz == SetupCommand.class) { answer = execute((SetupCommand) cmd); } else if (clz == MaintainCommand.class) { answer = execute((MaintainCommand) cmd); } else if (clz == PingTestCommand.class) { answer = execute((PingTestCommand) cmd); } else if (clz == CheckOnHostCommand.class) { answer = execute((CheckOnHostCommand) cmd); } else if (clz == ModifySshKeysCommand.class) { answer = execute((ModifySshKeysCommand) cmd); } else if (clz == NetworkUsageCommand.class) { answer = execute((NetworkUsageCommand) cmd); } else if (clz == StartCommand.class) { answer = execute((StartCommand) cmd); } else if (clz == CheckSshCommand.class) { answer = execute((CheckSshCommand) cmd); } else if (clz == CheckNetworkCommand.class) { answer = execute((CheckNetworkCommand) cmd); } else if (clz == PlugNicCommand.class) { answer = execute((PlugNicCommand) cmd); } else if (clz == UnPlugNicCommand.class) { answer = execute((UnPlugNicCommand) cmd); } else if (cmd instanceof CreateVMSnapshotCommand) { return execute((CreateVMSnapshotCommand) cmd); } else if (cmd instanceof DeleteVMSnapshotCommand) { return execute((DeleteVMSnapshotCommand) cmd); } else if (cmd instanceof RevertToVMSnapshotCommand) { return execute((RevertToVMSnapshotCommand) cmd); } else if (clz == ResizeVolumeCommand.class) { return execute((ResizeVolumeCommand) cmd); } else if (clz == UnregisterVMCommand.class) { return execute((UnregisterVMCommand) cmd); } else if (cmd instanceof StorageSubSystemCommand) { checkStorageProcessorAndHandlerNfsVersionAttribute((StorageSubSystemCommand) cmd); return storageHandler.handleStorageCommands((StorageSubSystemCommand) cmd); } else if (clz == ScaleVmCommand.class) { return execute((ScaleVmCommand) cmd); } else if (clz == PvlanSetupCommand.class) { return execute((PvlanSetupCommand) cmd); } else if (clz == UnregisterNicCommand.class) { answer = execute((UnregisterNicCommand) cmd); } else { answer = Answer.createUnsupportedCommandAnswer(cmd); } if (cmd.getContextParam("checkpoint") != null) { answer.setContextParam("checkpoint", cmd.getContextParam("checkpoint")); } Date doneTime = DateUtil.currentGMTTime(); mbean.addProp("DoneTime", DateUtil.getDateDisplayString(TimeZone.getDefault(), doneTime)); mbean.addProp("Answer", _gson.toJson(answer)); synchronized (this) { try { JmxUtil.registerMBean("VMware " + _morHyperHost.getValue(), "Command " + cmdSequence + "-" + cmd.getClass().getSimpleName(), mbean); _cmdMBeans.add(mbean); if (_cmdMBeans.size() >= MazCmdMBean) { PropertyMapDynamicBean mbeanToRemove = _cmdMBeans.get(0); _cmdMBeans.remove(0); JmxUtil.unregisterMBean("VMware " + _morHyperHost.getValue(), "Command " + mbeanToRemove.getProp("Sequence") + "-" + mbeanToRemove.getProp("Name")); } } catch (Exception e) { if (s_logger.isTraceEnabled()) s_logger.trace( "Unable to register JMX monitoring due to exception " + ExceptionUtil.toString(e)); } } } finally { recycleServiceContext(); NDC.pop(); } if (s_logger.isTraceEnabled()) s_logger.trace("End executeRequest(), cmd: " + cmd.getClass().getSimpleName()); return answer; }
From source file:ch.cyberduck.core.Preferences.java
/** * setting the default prefs values// w w w . ja va2 s . co m */ protected void setDefaults() { defaults.put("tmp.dir", System.getProperty("java.io.tmpdir")); /** * The logging level (debug, info, warn, error) */ defaults.put("logging.config", "log4j-cocoa.xml"); defaults.put("logging", "error"); java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger(""); Handler[] handlers = rootLogger.getHandlers(); for (Handler handler : handlers) { rootLogger.removeHandler(handler); } // call only once during initialization time of your application SLF4JBridgeHandler.install(); /** * How many times the application was launched */ defaults.put("uses", "0"); /** * True if donation dialog will be displayed before quit */ defaults.put("donate.reminder", String.valueOf(-1)); defaults.put("donate.reminder.interval", String.valueOf(20)); // in days defaults.put("donate.reminder.date", String.valueOf(new Date(0).getTime())); defaults.put("defaulthandler.reminder", String.valueOf(true)); defaults.put("mail.feedback", "mailto:feedback@cyberduck.ch"); defaults.put("website.donate", "http://cyberduck.ch/donate/"); defaults.put("website.home", "http://cyberduck.ch/"); defaults.put("website.forum", "http://forum.cyberduck.ch/"); defaults.put("website.help", "http://help.cyberduck.ch/" + this.locale()); defaults.put("website.bug", "http://trac.cyberduck.ch/newticket/"); defaults.put("website.crash", "http://crash.cyberduck.ch/report"); defaults.put("rendezvous.enable", String.valueOf(true)); defaults.put("rendezvous.loopback.supress", String.valueOf(true)); defaults.put("growl.enable", String.valueOf(true)); defaults.put("growl.limit", String.valueOf(10)); defaults.put("path.symboliclink.resolve", String.valueOf(false)); /** * Normalize path names */ defaults.put("path.normalize", String.valueOf(true)); defaults.put("path.normalize.unicode", String.valueOf(false)); defaults.put("local.symboliclink.resolve", String.valueOf(false)); defaults.put("local.normalize.unicode", String.valueOf(true)); defaults.put("local.list.native", String.valueOf(true)); /** * Maximum number of directory listings to cache using a most recently used implementation */ defaults.put("browser.cache.size", String.valueOf(1000)); defaults.put("transfer.cache.size", String.valueOf(50)); defaults.put("icon.cache.size", String.valueOf(50)); /** * Caching NS* proxy instances. */ defaults.put("browser.model.cache.size", String.valueOf(200)); defaults.put("bookmark.model.cache.size", String.valueOf(100)); defaults.put("queue.model.cache.size", String.valueOf(50)); defaults.put("info.toolbar.selected", String.valueOf(0)); defaults.put("preferences.toolbar.selected", String.valueOf(0)); /** * Current default browser view is outline view (0-List view, 1-Outline view, 2-Column view) */ defaults.put("browser.view", "1"); /** * Save browser sessions when quitting and restore upon relaunch */ defaults.put("browser.serialize", String.valueOf(true)); defaults.put("browser.font.size", String.valueOf(12f)); defaults.put("browser.view.autoexpand", String.valueOf(true)); defaults.put("browser.view.autoexpand.useDelay", String.valueOf(true)); defaults.put("browser.view.autoexpand.delay", "1.0"); // in seconds defaults.put("browser.hidden.regex", "\\..*"); defaults.put("browser.openUntitled", String.valueOf(true)); defaults.put("browser.defaultBookmark", Locale.localizedString("None")); defaults.put("browser.markInaccessibleFolders", String.valueOf(true)); /** * Confirm closing the browsing connection */ defaults.put("browser.confirmDisconnect", String.valueOf(false)); defaults.put("browser.disconnect.showBookmarks", String.valueOf(false)); /** * Display only one info panel and change information according to selection in browser */ defaults.put("browser.info.isInspector", String.valueOf(true)); defaults.put("browser.columnKind", String.valueOf(false)); defaults.put("browser.columnExtension", String.valueOf(false)); defaults.put("browser.columnSize", String.valueOf(true)); defaults.put("browser.columnModification", String.valueOf(true)); defaults.put("browser.columnOwner", String.valueOf(false)); defaults.put("browser.columnGroup", String.valueOf(false)); defaults.put("browser.columnPermissions", String.valueOf(false)); defaults.put("browser.sort.column", "FILENAME"); defaults.put("browser.sort.ascending", String.valueOf(true)); defaults.put("browser.alternatingRows", String.valueOf(false)); defaults.put("browser.verticalLines", String.valueOf(false)); defaults.put("browser.horizontalLines", String.valueOf(true)); /** * Show hidden files in browser by default */ defaults.put("browser.showHidden", String.valueOf(false)); defaults.put("browser.charset.encoding", "UTF-8"); /** * Edit double clicked files instead of downloading */ defaults.put("browser.doubleclick.edit", String.valueOf(false)); /** * Rename files when return or enter key is pressed */ defaults.put("browser.enterkey.rename", String.valueOf(true)); /** * Enable inline editing in browser */ defaults.put("browser.editable", String.valueOf(true)); /** * Warn before renaming files */ defaults.put("browser.confirmMove", String.valueOf(false)); defaults.put("browser.logDrawer.isOpen", String.valueOf(false)); defaults.put("browser.logDrawer.size.height", String.valueOf(200)); /** * Filename (Short Date Format)Extension */ defaults.put("browser.duplicate.format", "{0} ({1}){2}"); /** * Use octal or decimal file sizes */ defaults.put("browser.filesize.decimal", String.valueOf(false)); defaults.put("browser.date.natural", String.valueOf(true)); defaults.put("info.toggle.permission", String.valueOf(1)); defaults.put("info.toggle.distribution", String.valueOf(0)); defaults.put("info.toggle.s3", String.valueOf(0)); defaults.put("connection.toggle.options", String.valueOf(0)); defaults.put("bookmark.toggle.options", String.valueOf(0)); defaults.put("alert.toggle.transcript", String.valueOf(0)); defaults.put("transfer.toggle.details", String.valueOf(1)); /** * Default editor */ defaults.put("editor.bundleIdentifier", "com.apple.TextEdit"); defaults.put("editor.alwaysUseDefault", String.valueOf(false)); defaults.put("editor.odb.enable", String.valueOf(false)); defaults.put("editor.tmp.directory", System.getProperty("java.io.tmpdir")); defaults.put("filetype.text.regex", ".*\\.txt|.*\\.cgi|.*\\.htm|.*\\.html|.*\\.shtml|.*\\.xml|.*\\.xsl|.*\\.php|.*\\.php3|" + ".*\\.js|.*\\.css|.*\\.asp|.*\\.java|.*\\.c|.*\\.cp|.*\\.cpp|.*\\.m|.*\\.h|.*\\.pl|.*\\.py|" + ".*\\.rb|.*\\.sh"); defaults.put("filetype.binary.regex", ".*\\.pdf|.*\\.ps|.*\\.exe|.*\\.bin|.*\\.jpeg|.*\\.jpg|.*\\.jp2|.*\\.gif|.*\\.tif|.*\\.ico|" + ".*\\.icns|.*\\.tiff|.*\\.bmp|.*\\.pict|.*\\.sgi|.*\\.tga|.*\\.png|.*\\.psd|" + ".*\\.hqx|.*\\.rar|.*\\.sea|.*\\.dmg|.*\\.zip|.*\\.sit|.*\\.tar|.*\\.gz|.*\\.tgz|.*\\.bz2|" + ".*\\.avi|.*\\.qtl|.*\\.bom|.*\\.pax|.*\\.pgp|.*\\.mpg|.*\\.mpeg|.*\\.mp3|.*\\.m4p|" + ".*\\.m4a|.*\\.mov|.*\\.avi|.*\\.qt|.*\\.ram|.*\\.aiff|.*\\.aif|.*\\.wav|.*\\.wma|" + ".*\\.doc|.*\\.iso|.*\\.xls|.*\\.ppt"); /** * Save bookmarks in ~/Library */ defaults.put("favorites.save", String.valueOf(true)); defaults.put("queue.openByDefault", String.valueOf(false)); defaults.put("queue.save", String.valueOf(true)); defaults.put("queue.removeItemWhenComplete", String.valueOf(false)); /** * The maximum number of concurrent transfers */ defaults.put("queue.maxtransfers", String.valueOf(5)); /** * Warning when number of transfers in queue exceeds limit */ defaults.put("queue.size.warn", String.valueOf(50)); /** * Open completed downloads */ defaults.put("queue.postProcessItemWhenComplete", String.valueOf(false)); /** * Bring transfer window to front */ defaults.put("queue.orderFrontOnStart", String.valueOf(true)); defaults.put("queue.orderBackOnStop", String.valueOf(false)); /** * Action when duplicate file exists */ defaults.put("queue.download.fileExists", "ask"); defaults.put("queue.upload.fileExists", "ask"); /** * When triggered manually using 'Reload' in the Transfer window */ defaults.put("queue.download.reload.fileExists", "ask"); defaults.put("queue.upload.reload.fileExists", "ask"); defaults.put("queue.upload.changePermissions", String.valueOf(true)); defaults.put("queue.upload.permissions.useDefault", String.valueOf(false)); defaults.put("queue.upload.permissions.file.default", String.valueOf(644)); defaults.put("queue.upload.permissions.folder.default", String.valueOf(755)); defaults.put("queue.upload.preserveDate", String.valueOf(false)); defaults.put("queue.upload.skip.enable", String.valueOf(true)); defaults.put("queue.upload.skip.regex.default", ".*~\\..*|\\.DS_Store|\\.svn|CVS"); defaults.put("queue.upload.skip.regex", ".*~\\..*|\\.DS_Store|\\.svn|CVS"); /** * Create temporary filename with an UUID and rename when upload is complete */ defaults.put("queue.upload.file.temporary", String.valueOf(false)); /** * Format string for temporary filename. Default to filename-uuid */ defaults.put("queue.upload.file.temporary.format", "{0}-{1}"); defaults.put("queue.upload.file.rename.format", "{0} ({1}){2}"); defaults.put("queue.download.file.rename.format", "{0} ({1}){2}"); defaults.put("queue.download.changePermissions", String.valueOf(true)); defaults.put("queue.download.permissions.useDefault", String.valueOf(false)); defaults.put("queue.download.permissions.file.default", String.valueOf(644)); defaults.put("queue.download.permissions.folder.default", String.valueOf(755)); defaults.put("queue.download.preserveDate", String.valueOf(true)); defaults.put("queue.download.skip.enable", String.valueOf(true)); defaults.put("queue.download.skip.regex.default", ".*~\\..*|\\.DS_Store|\\.svn|CVS|RCS|SCCS|\\.git|\\.bzr|\\.bzrignore|\\.bzrtags|\\.hg|\\.hgignore|\\.hgtags|_darcs"); defaults.put("queue.download.skip.regex", ".*~\\..*|\\.DS_Store|\\.svn|CVS|RCS|SCCS|\\.git|\\.bzr|\\.bzrignore|\\.bzrtags|\\.hg|\\.hgignore|\\.hgtags|_darcs"); defaults.put("queue.download.quarantine", String.valueOf(true)); defaults.put("queue.download.wherefrom", String.valueOf(true)); defaults.put("queue.sync.compare.hash", String.valueOf(true)); defaults.put("queue.sync.compare.size", String.valueOf(false)); defaults.put("queue.dock.badge", String.valueOf(false)); defaults.put("queue.sleep.prevent", String.valueOf(true)); /** * Bandwidth throttle options */ StringBuilder options = new StringBuilder(); options.append(5 * TransferStatus.KILO).append(","); options.append(10 * TransferStatus.KILO).append(","); options.append(20 * TransferStatus.KILO).append(","); options.append(50 * TransferStatus.KILO).append(","); options.append(100 * TransferStatus.KILO).append(","); options.append(150 * TransferStatus.KILO).append(","); options.append(200 * TransferStatus.KILO).append(","); options.append(500 * TransferStatus.KILO).append(","); options.append(1 * TransferStatus.MEGA).append(","); options.append(2 * TransferStatus.MEGA).append(","); options.append(5 * TransferStatus.MEGA).append(","); options.append(10 * TransferStatus.MEGA).append(","); options.append(15 * TransferStatus.MEGA).append(","); options.append(20 * TransferStatus.MEGA).append(","); options.append(50 * TransferStatus.MEGA).append(","); options.append(100 * TransferStatus.MEGA).append(","); defaults.put("queue.bandwidth.options", options.toString()); /** * Bandwidth throttle upload stream */ defaults.put("queue.upload.bandwidth.bytes", String.valueOf(-1)); /** * Bandwidth throttle download stream */ defaults.put("queue.download.bandwidth.bytes", String.valueOf(-1)); /** * While downloading, update the icon of the downloaded file as a progress indicator */ defaults.put("queue.download.icon.update", String.valueOf(true)); defaults.put("queue.download.icon.threshold", String.valueOf(TransferStatus.MEGA * 5)); /** * Default synchronize action selected in the sync dialog */ defaults.put("queue.sync.action.default", "upload"); defaults.put("queue.prompt.action.default", "overwrite"); defaults.put("queue.logDrawer.isOpen", String.valueOf(false)); defaults.put("queue.logDrawer.size.height", String.valueOf(200)); defaults.put("http.compression.enable", String.valueOf(true)); /** * HTTP routes to maximum number of connections allowed for those routes */ defaults.put("http.connections.route", String.valueOf(5)); /** * Total number of connections in the pool */ defaults.put("http.connections.total", String.valueOf(5)); defaults.put("http.manager.timeout", String.valueOf(0)); // Inifinite defaults.put("http.socket.buffer", String.valueOf(131072)); defaults.put("http.credentials.charset", "ISO-8859-1"); /** * Enable or disable verification that the remote host taking part * of a data connection is the same as the host to which the control * connection is attached. */ defaults.put("ftp.datachannel.verify", String.valueOf(false)); defaults.put("ftp.command.feat", String.valueOf(true)); defaults.put("ftp.socket.buffer", String.valueOf(131072)); /** * Send LIST -a */ defaults.put("ftp.command.lista", String.valueOf(true)); defaults.put("ftp.command.stat", String.valueOf(true)); defaults.put("ftp.command.mlsd", String.valueOf(true)); defaults.put("ftp.command.utime", String.valueOf(true)); /** * Fallback to active or passive mode respectively */ defaults.put("ftp.connectmode.fallback", String.valueOf(true)); /** * Protect the data channel by default. For TLS, the data connection * can have one of two security levels. 1) Clear (requested by 'PROT C') 2) Private (requested by 'PROT P') */ defaults.put("ftp.tls.datachannel", "P"); //C defaults.put("ftp.tls.session.requirereuse", String.valueOf(true)); defaults.put("ftp.ssl.session.cache.size", String.valueOf(100)); /** * Try to determine the timezone automatically using timestamp comparison from MLST and LIST */ defaults.put("ftp.timezone.auto", String.valueOf(false)); defaults.put("ftp.timezone.default", TimeZone.getDefault().getID()); /** * Default bucket location */ defaults.put("s3.location", "US"); defaults.put("s3.bucket.acl.default", "public-read"); //defaults.put("s3.bucket.acl.default", "private"); defaults.put("s3.key.acl.default", "public-read"); //defaults.put("s3.key.acl.default", "private"); /** * Default redundancy level */ defaults.put("s3.storage.class", "STANDARD"); //defaults.put("s3.encryption.algorithm", "AES256"); defaults.put("s3.encryption.algorithm", StringUtils.EMPTY); /** * Validaty for public S3 URLs */ defaults.put("s3.url.expire.seconds", String.valueOf(24 * 60 * 60)); //expiry time for public URL defaults.put("s3.mfa.serialnumber", StringUtils.EMPTY); defaults.put("s3.listing.chunksize", String.valueOf(1000)); /** * Show revisions as hidden files in browser */ defaults.put("s3.revisions.enable", String.valueOf(true)); /** * If set calculate MD5 sum of uploaded file and set metadata header Content-MD5 */ defaults.put("s3.upload.metadata.md5", String.valueOf(false)); defaults.put("s3.upload.multipart", String.valueOf(true)); defaults.put("s3.upload.multipart.concurency", String.valueOf(5)); /** * Threshold in bytes. Only use multipart uploads for files more than 5GB */ defaults.put("s3.upload.multipart.threshold", String.valueOf(5L * 1024L * 1024L * 1024L)); defaults.put("s3.upload.multipart.size", String.valueOf(5L * 1024L * 1024L)); /** * A prefix to apply to log file names */ defaults.put("s3.logging.prefix", "logs/"); defaults.put("google.logging.prefix", "log"); defaults.put("cloudfront.logging.prefix", "logs/"); defaults.put("google.storage.oauth.clientid", "996125414232.apps.googleusercontent.com"); defaults.put("google.storage.oauth.secret", "YdaFjo2t74-Q0sThsXgeTv3l"); final int month = 60 * 60 * 24 * 30; //30 days in seconds defaults.put("s3.cache.seconds", String.valueOf(month)); /** * Default metadata for uploads. Format must be "key1=value1 key2=value2" */ defaults.put("s3.metadata.default", StringUtils.EMPTY); defaults.put("azure.metadata.default", StringUtils.EMPTY); defaults.put("cf.authentication.context", "/v1.0"); defaults.put("cf.upload.metadata.md5", String.valueOf(false)); defaults.put("cf.metadata.default", StringUtils.EMPTY); defaults.put("cf.list.limit", String.valueOf(10000)); defaults.put("cf.list.cdn.preload", String.valueOf(true)); //doc Microsoft Word //html HTML Format //odt Open Document Format //pdf Portable Document Format //png Portable Networks Graphic Image Format //rtf Rich Format //txt TXT File //zip ZIP archive. Contains the images (if any) used in the document and an exported .html file. defaults.put("google.docs.export.document", "doc"); defaults.put("google.docs.export.document.formats", "doc,html,odt,pdf,png,rtf,txt,zip"); //pdf Portable Document Format //png Portable Networks Graphic Image Format //ppt Powerpoint Format //swf Flash Format //txt TXT file defaults.put("google.docs.export.presentation", "ppt"); defaults.put("google.docs.export.presentation.formats", "ppt,pdf,png,swf,txt"); //xls XLS (Microsoft Excel) //csv CSV (Comma Seperated Value) //pdf PDF (Portable Document Format) //ods ODS (Open Document Spreadsheet) //tsv TSV (Tab Seperated Value) //html HTML Format defaults.put("google.docs.export.spreadsheet", "xls"); defaults.put("google.docs.export.spreadsheet.formats", "xls,csv,pdf,ods,tsv,html"); defaults.put("google.docs.upload.convert", String.valueOf(true)); defaults.put("google.docs.upload.ocr", String.valueOf(false)); /** * Show revisions as hidden files in browser */ defaults.put("google.docs.revisions.enable", String.valueOf(false)); /** * If set to true will only trash documents */ defaults.put("google.docs.delete.trash", String.valueOf(false)); /** * NTLM Windows Domain */ defaults.put("webdav.ntlm.domain", StringUtils.EMPTY); defaults.put("webdav.ntlm.workstation", StringUtils.EMPTY); /** * Enable Expect-Continue handshake */ defaults.put("webdav.expect-continue", String.valueOf(true)); defaults.put("analytics.provider.qloudstat.setup", "https://qloudstat.com/configuration/add"); defaults.put("analytics.provider.qloudstat.iam.policy", "{\n" + " \"Statement\": [\n" + " {\n" + " \"Action\": [\n" + " \"s3:GetObject\", \n" + " \"s3:ListBucket\"\n" + " ], \n" + " \"Condition\": {\n" + " \"Bool\": {\n" + " \"aws:SecureTransport\": \"true\"\n" + " }\n" + " }, \n" + " \"Effect\": \"Allow\", \n" + " \"Resource\": \"arn:aws:s3:::%s/*\"\n" + " }, \n" + " {\n" + " \"Action\": [\n" + " \"s3:ListAllMyBuckets\", \n" + " \"s3:GetBucketLogging\", \n" + " \"s3:GetBucketLocation\"\n" + " ], \n" + " \"Effect\": \"Allow\", \n" + " \"Resource\": \"arn:aws:s3:::*\"\n" + " }, \n" + " {\n" + " \"Action\": [\n" + " \"cloudfront:GetDistribution\", \n" + " \"cloudfront:GetDistributionConfig\", \n" + " \"cloudfront:ListDistributions\", \n" + " \"cloudfront:GetStreamingDistribution\", \n" + " \"cloudfront:GetStreamingDistributionConfig\", \n" + " \"cloudfront:ListStreamingDistributions\"\n" + " ], \n" + " \"Condition\": {\n" + " \"Bool\": {\n" + " \"aws:SecureTransport\": \"true\"\n" + " }\n" + " }, \n" + " \"Effect\": \"Allow\", \n" + " \"Resource\": \"*\"\n" + " }\n" + " ]\n" + "}\n"); /** * Maximum concurrent connections to the same host * Unlimited by default */ defaults.put("connection.host.max", String.valueOf(-1)); /** * Default login name */ defaults.put("connection.login.name", System.getProperty("user.name")); defaults.put("connection.login.anon.name", "anonymous"); defaults.put("connection.login.anon.pass", "cyberduck@example.net"); /** * Search for passphrases in Keychain */ defaults.put("connection.login.useKeychain", String.valueOf(true)); /** * Add to Keychain option is checked in login prompt */ defaults.put("connection.login.addKeychain", String.valueOf(true)); defaults.put("connection.port.default", String.valueOf(21)); defaults.put("connection.protocol.default", Protocol.FTP.getIdentifier()); /** * Socket timeout */ defaults.put("connection.timeout.seconds", String.valueOf(30)); /** * Retry to connect after a I/O failure automatically */ defaults.put("connection.retry", String.valueOf(0)); defaults.put("connection.retry.delay", String.valueOf(10)); defaults.put("connection.hostname.default", StringUtils.EMPTY); /** * Try to resolve the hostname when entered in connection dialog */ defaults.put("connection.hostname.check", String.valueOf(true)); //Check hostname reachability using NSNetworkDiagnostics defaults.put("connection.hostname.idn", String.valueOf(true)); //Convert hostnames to Punycode /** * java.net.preferIPv6Addresses */ defaults.put("connection.dns.ipv6", String.valueOf(false)); /** * Read proxy settings from system preferences */ defaults.put("connection.proxy.enable", String.valueOf(true)); defaults.put("connection.proxy.ntlm.domain", StringUtils.EMPTY); /** * Warning when opening connections sending credentials in plaintext */ defaults.put("connection.unsecure.warning", String.valueOf(true)); defaults.put("connection.unsecure.switch", String.valueOf(true)); defaults.put("connection.ssl.protocols", "SSLv3, TLSv1"); /** * Transfer read buffer size */ defaults.put("connection.chunksize", String.valueOf(32768)); defaults.put("disk.unmount.timeout", String.valueOf(2)); defaults.put("transcript.length", String.valueOf(1000)); /** * Read favicon from Web URL */ defaults.put("bookmark.favicon.download", String.valueOf(true)); /** * Default to large icon size */ defaults.put("bookmark.icon.size", String.valueOf(64)); /** * Use the SFTP subsystem or a SCP channel for file transfers over SSH */ defaults.put("ssh.transfer", Protocol.SFTP.getIdentifier()); // Session.SCP defaults.put("ssh.authentication.publickey.default.enable", String.valueOf(false)); defaults.put("ssh.authentication.publickey.default.rsa", "~/.ssh/id_rsa"); defaults.put("ssh.authentication.publickey.default.dsa", "~/.ssh/id_dsa"); defaults.put("archive.default", "tar.gz"); /** * Archiver */ defaults.put("archive.command.create.tar", "tar -cpPf {0}.tar {1}"); defaults.put("archive.command.create.tar.gz", "tar -czpPf {0}.tar.gz {1}"); defaults.put("archive.command.create.tar.bz2", "tar -cjpPf {0}.tar.bz2 {1}"); defaults.put("archive.command.create.zip", "zip -qr {0}.zip {1}"); defaults.put("archive.command.create.gz", "gzip -qr {1}"); defaults.put("archive.command.create.bz2", "bzip2 -zk {1}"); /** * Unarchiver */ defaults.put("archive.command.expand.tar", "tar -xpPf {0} -C {1}"); defaults.put("archive.command.expand.tar.gz", "tar -xzpPf {0} -C {1}"); defaults.put("archive.command.expand.tar.bz2", "tar -xjpPf {0} -C {1}"); defaults.put("archive.command.expand.zip", "unzip -qn {0} -d {1}"); defaults.put("archive.command.expand.gz", "gzip -d {0}"); defaults.put("archive.command.expand.bz2", "bzip2 -dk {0}"); defaults.put("update.check", String.valueOf(true)); final int day = 60 * 60 * 24; defaults.put("update.check.interval", String.valueOf(day)); // periodic update check in seconds defaults.put("terminal.bundle.identifier", "com.apple.Terminal"); defaults.put("terminal.command", "do script \"{0}\""); defaults.put("terminal.command.ssh", "ssh -t {0} {1}@{2} -p {3} \"cd {4} && exec \\$SHELL\""); }
From source file:com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportJobsQuartzScheduler.java
protected Date translateFromTriggerTimeZone(ReportJobTrigger jobTrigger, Date date) { if (date != null) { TimeZone tz = getTriggerTimeZone(jobTrigger); if (tz != null) { date = DateBuilder.translateTime(date, TimeZone.getDefault(), tz); //date = TriggerUtils.translateTime(date, TimeZone.getDefault(), tz); }/*from w ww.j a v a 2s. co m*/ } return date; }
From source file:de.micromata.genome.gwiki.page.GWikiContext.java
/** * Parses the user date string./*from w ww . ja v a 2 s .co m*/ * * @param ds the ds * @return the date */ public Date parseUserDateString(String ds) { if (StringUtils.isBlank(ds) == true) { return null; } String tz = getWikiWeb().getAuthorization().getUserProp(this, GWikiUserAuthorization.USER_TZ); tz = StringUtils.defaultIfEmpty(tz, TimeZone.getDefault().getID()); String df = getWikiWeb().getAuthorization().getUserProp(this, GWikiUserAuthorization.USER_DATEFORMAT); df = StringUtils.defaultIfEmpty(df, TimeUtils.ISO_DATETIME); return TimeUtils.parseDate(ds, df, tz); }
From source file:ca.oson.json.gson.functional.DefaultTypeAdaptersTest.java
public void testTimestampSerialization() throws Exception { TimeZone defaultTimeZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Locale defaultLocale = Locale.getDefault(); Locale.setDefault(Locale.US); try {//from w w w. j av a 2 s. com Timestamp timestamp = new Timestamp(0L); //Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create(); String json = oson.setDateFormat("yyyy-MM-dd").toJson(timestamp, Timestamp.class); assertEquals("1970-01-01", json); assertEquals(0, oson.fromJson("\"1970-01-01\"", Timestamp.class).getTime()); } finally { TimeZone.setDefault(defaultTimeZone); Locale.setDefault(defaultLocale); } }
From source file:com.edgenius.wiki.blogsync.WordpressProxy.java
/** * Return "date_create_gmt" time is gmt, but timezone is wrong - it is local timezone. * Here will correct timezone and return date in local timezone. * @param date/*from ww w. j a va2 s . c o m*/ * @return */ private Date fixInputTimezone(Date date) { if (date == null) return new Date();//??? Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(Calendar.YEAR, date.getYear() + 1900); cal.set(Calendar.MONTH, date.getMonth()); cal.set(Calendar.DATE, date.getDate()); cal.set(Calendar.HOUR_OF_DAY, date.getHours()); cal.set(Calendar.MINUTE, date.getMinutes()); cal.set(Calendar.SECOND, date.getSeconds()); Calendar local = Calendar.getInstance(TimeZone.getDefault()); local.setTimeInMillis(cal.getTimeInMillis()); return local.getTime(); }
From source file:ca.oson.json.gson.functional.DefaultTypeAdaptersTest.java
public void testSqlDateSerialization() throws Exception { TimeZone defaultTimeZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Locale defaultLocale = Locale.getDefault(); Locale.setDefault(Locale.US); try {/*from w w w . j a v a 2 s .c om*/ java.sql.Date sqlDate = new java.sql.Date(0L); //Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create(); String json = oson.setDateFormat("yyyy-MM-dd").toJson(sqlDate, Timestamp.class); assertEquals("1970-01-01", json); assertEquals(0, oson.fromJson("\"1970-01-01\"", java.sql.Date.class).getTime()); } finally { TimeZone.setDefault(defaultTimeZone); Locale.setDefault(defaultLocale); } }
From source file:org.openmrs.module.atomfeed.AtomFeedUtil.java
/** * Format dates as specified in rfc3339 (required for Atom dates) * // w ww .ja va2s .c o m * @param d the Date to be formatted * @return the formatted date * @should not fail given a null date * @should convert date to rfc */ public static String dateToRFC3339(Date d) { if (d == null) return null; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(RFC_3339_DATE_FORMAT); Calendar cal = new GregorianCalendar(); cal.setTime(d); cal.setTimeZone(TimeZone.getDefault()); simpleDateFormat.setCalendar(cal); StringBuilder result = new StringBuilder(simpleDateFormat.format(d)); int offset_millis = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); int offset_hours = Math.abs(offset_millis / (1000 * 60 * 60)); int offset_minutes = Math.abs((offset_millis / (1000 * 60)) % 60); if (offset_millis == 0) { result.append("Z"); } else { result.append((offset_millis > 0) ? "+" : "-").append(doubleDigit.format(offset_hours)).append(":") .append(doubleDigit.format(offset_minutes)); } return result.toString(); }
From source file:com.redhat.rhn.common.localization.LocalizationService.java
/** * Determine the Timezone from the Context. Uses TimeZone.getDefault() if * there isn't one./* ww w . ja v a2 s.c o m*/ * * @return TimeZone from the Context */ private TimeZone determineTimeZone() { TimeZone retval = null; Context ctx = Context.getCurrentContext(); if (ctx != null) { retval = ctx.getTimezone(); } if (retval == null) { log.debug("Context is null"); // Get the app server's default timezone retval = TimeZone.getDefault(); } if (log.isDebugEnabled()) { log.debug("Determined timeZone to be: " + retval); } return retval; }