public RestS3Service makeObject() throws S3ServiceException { Jets3tProperties jProps = Jets3tProperties .getInstance(Constants.JETS3T_PROPERTIES_FILENAME); jProps.setProperty("httpclient.max-connections", Integer.toString(this.poolSize)); RestS3Service s3Service = new RestS3Service(awsCredentials, null, null, jProps); return s3Service; }
Jets3tProperties jets3=new Jets3tProperties(); jets3.loadAndReplaceProperties(new FileInputStream("/root/Desktop/jets3t.properties"), "jets3t.properties");
/** * @return * true if the "filecomparer.skip-symlinks" configuration option is set. */ public boolean isSkipSymlinks() { return jets3tProperties.getBoolProperty("filecomparer.skip-symlinks", false); }
/** * Merges properties from another JetS3tProperties object into this instance. * If a new property already exists, the property value is replaced. * * @param properties * the object containing properties that will be merged into this set of properties. * @param propertiesSource * a name for the source of the properties, such as a properties file name or identifier. This * is only used to generate meaningful debug messages when properties are updated, so it is * possible to tell where the updated property value came from. */ public void loadAndReplaceProperties(Jets3tProperties properties, String propertiesSource) { Properties newProperties = properties.getProperties(); loadAndReplaceProperties(newProperties, propertiesSource); }
public ThreadGroupManager(AbstractRunnable[] runnables, ThreadWatcher threadWatcher, Jets3tProperties jets3tProperties, boolean isAdminTask) { this.runnables = runnables; this.threadWatcher = threadWatcher; if (isAdminTask) { this.maxThreadCount = jets3tProperties .getIntProperty("threaded-service.admin-max-thread-count", 20); } else { this.maxThreadCount = jets3tProperties .getIntProperty("threaded-service.max-thread-count", 2); } this.ignoreExceptions = jets3tProperties .getBoolProperty("threaded-service.ignore-exceptions-in-multi", false); this.threads = new Thread[runnables.length]; started = new boolean[runnables.length]; // All values initialized to false. alreadyFired = new boolean[runnables.length]; // All values initialized to false. }
Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME); String propertiesFileName = "synchronize.properties"; Jets3tProperties.getInstance(propertiesFileName); if (synchronizeProperties.isLoaded()) { myProperties.loadAndReplaceProperties(synchronizeProperties, propertiesFileName + " in classpath"); myProperties.loadAndReplaceProperties( new FileInputStream(propertiesFileName), propertiesFile.getName()); } else { myProperties.setProperty("accesskey", ""); myProperties.setProperty("secretkey", ""); } catch (ServiceException e) { System.out.println("Failed to read credentials from the file '" + credentialsFile + "'"); if (myProperties != null && myProperties.getBoolProperty("upload.ignoreMissingPaths", false)) { System.err.println("WARN: Ignoring missing upload path: " + file); continue; && !myProperties.getBoolProperty("upload.ignoreMissingPaths", false)) if (!myProperties.containsKey("accesskey") || !myProperties.containsKey("secretkey") || (isEncryptionEnabled && !myProperties.containsKey("password"))) if (!myProperties.containsKey("accesskey")) { System.out.print("Acccess Key: ");
protected Jets3tProperties configure() { final Jets3tProperties configuration = new Jets3tProperties(); if(log.isDebugEnabled()) { log.debug(String.format("Configure for endpoint %s", host)); configuration.setProperty("s3service.s3-endpoint", preferences.getProperty("s3.hostname.default")); configuration.setProperty("s3service.disable-dns-buckets", String.valueOf(preferences.getBoolean("s3.bucket.virtualhost.disable"))); configuration.setProperty("s3service.s3-endpoint", host.getHostname()); configuration.setProperty("s3service.disable-dns-buckets", String.valueOf(true)); configuration.setProperty("s3service.enable-storage-classes", String.valueOf(true)); if(StringUtils.isNotBlank(host.getProtocol().getContext())) { if(!Scheme.isURL(host.getProtocol().getContext())) { configuration.setProperty("s3service.s3-endpoint-virtual-path", PathNormalizer.normalize(host.getProtocol().getContext())); configuration.setProperty("s3service.https-only", String.valueOf(host.getProtocol().isSecure())); if(host.getProtocol().isSecure()) { configuration.setProperty("s3service.s3-endpoint-https-port", String.valueOf(host.getPort())); configuration.setProperty("s3service.s3-endpoint-http-port", String.valueOf(host.getPort())); configuration.setProperty("s3service.internal-error-retry-max", String.valueOf(0)); configuration.setProperty("s3service.max-thread-count", String.valueOf(1)); configuration.setProperty("httpclient.proxy-autodetect", String.valueOf(false)); configuration.setProperty("httpclient.retry-max", String.valueOf(0)); configuration.setProperty("storage-service.internal-error-retry-max", String.valueOf(0));
uploaderProperties = Jets3tProperties.getInstance(UPLOADER_PROPERTIES_FILENAME); String appletParamNames = uploaderProperties.getStringProperty("applet.params", ""); StringTokenizer st = new StringTokenizer(appletParamNames, ","); while (st.hasMoreTokens()) { uploaderProperties.setProperty(paramName, paramValue); uploaderProperties.setProperty(propName, propValue); fileMaxCount = uploaderProperties.getIntProperty("file.maxCount", 1); fileMaxSizeMB = uploaderProperties.getLongProperty("file.maxSizeMB", 200); fileMinSizeMB = uploaderProperties.getLongProperty("file.minSizeMB", 0); String validFileExtensionsStr = uploaderProperties.getStringProperty("file.extensions", ""); if (validFileExtensionsStr != null) { StringTokenizer st = new StringTokenizer(validFileExtensionsStr, ",");
cockpitLiteProperties = Jets3tProperties.getInstance(PROPERTIES_FILENAME); String appletParamNames = cockpitLiteProperties.getStringProperty("applet.params", ""); StringTokenizer st = new StringTokenizer(appletParamNames, ","); while (st.hasMoreTokens()) { cockpitLiteProperties.setProperty(paramName, paramValue); cockpitLiteProperties.setProperty(propName, propValue); String message = "Missing one or more required application properties"; log.error(message); ErrorDialog.showDialog(ownerFrame, this, cockpitLiteProperties.getProperties(), message, null); System.exit(1); String gatekeeperUrl = cockpitLiteProperties.getStringProperty("gatekeeperUrl", null); if (gatekeeperUrl == null) { String message = "Application properties file '" + PROPERTIES_FILENAME + "' is not available"; log.error(message); ErrorDialog.showDialog(ownerFrame, this, cockpitLiteProperties.getProperties(), message, null); System.exit(1);
protected RestS3Service getRestS3Service(ProviderCredentials credentials) throws S3ServiceException { if (!this.isTargetS3) { // Override endpoint property in JetS3t properties originalTargetEndpoint = cockpitProperties.getStringProperty( "s3service.s3-endpoint", Constants.S3_DEFAULT_HOSTNAME); cockpitProperties.setProperty( "s3service.s3-endpoint", Constants.GS_DEFAULT_HOSTNAME); } else if (originalTargetEndpoint != null) { cockpitProperties.setProperty( "s3service.s3-endpoint", originalTargetEndpoint); } return new RestS3Service(credentials, APPLICATION_DESCRIPTION, this, cockpitProperties); }
jets3tProperties.getStringProperty( ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, ConnManagerFactory.class.getName())); jets3tProperties.getIntProperty("httpclient.connection-timeout-ms", 60000)); HttpConnectionParams.setSoTimeout(params, jets3tProperties.getIntProperty("httpclient.socket-timeout-ms", 60000)); HttpConnectionParams.setStaleCheckingEnabled(params, jets3tProperties.getBoolProperty("httpclient.stale-checking-enabled", true)); if (jets3tProperties.containsKey("httpclient.socket-receive-buffer")) { HttpConnectionParams.setSocketBufferSize(params, jets3tProperties.getIntProperty("httpclient.socket-receive-buffer", 0)); String userAgent = jets3tProperties.getStringProperty("httpclient.useragent", null); if (userAgent == null) { userAgent = ServiceUtils.getUserAgentDescription(userAgentDescription); = jets3tProperties.getBoolProperty("http.protocol.expect-continue", true); HttpProtocolParams.setUseExpectContinue(params, expectContinue); = jets3tProperties.getLongProperty("httpclient.connection-manager-timeout", 0); ConnManagerParams.setTimeout(params, connectionManagerTimeout); httpClient.setHttpRequestRetryHandler( new JetS3tRetryHandler( jets3tProperties.getIntProperty("httpclient.retry-max", 5), requestAuthorizer)); if (jets3tProperties.getBoolProperty(
@Override public void configure(final boolean enable, final Path file) { final Jets3tProperties options = session.getClient().getJetS3tProperties(); if(enable) { // Set accelerated endpoint options.setProperty("s3service.s3-endpoint", hostname); options.setProperty("s3service.disable-dns-buckets", String.valueOf(false)); options.setProperty("s3service.disable-expect-continue", String.valueOf(true)); } else { // Revert default configuration options.loadAndReplaceProperties(session.configure(), this.toString()); } }
boolean storeEmptyDirectories = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME) .getBoolProperty("uploads.storeEmptyDirectories", true); objectKeyToFilepathMap = FileComparer.getInstance() .buildObjectKeyToFilepathMap(downloadDirectory.listFiles(), "", storeEmptyDirectories); String message = "Unable to review files in targetted download directory"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, this, cockpitLiteProperties.getProperties(), message, e);
@Override protected Jets3tProperties configure() { final Jets3tProperties configuration = super.configure(); configuration.setProperty("s3service.enable-storage-classes", String.valueOf(false)); configuration.setProperty("s3service.disable-dns-buckets", String.valueOf(true)); return configuration; }
String propertyName = (String) iter.next(); String propertyValue = loginProperties.getProperty(propertyName); cockpitLiteProperties.setProperty(propertyName, propertyValue); requestProperties.putAll(cockpitLiteProperties.getProperties()); if (filterObjectsCheckBox.isSelected() && filterObjectsPrefix.getText().length() > 0) { requestProperties.put("Prefix", filterObjectsPrefix.getText()); } else { ErrorDialog.showDialog(ownerFrame, this, cockpitLiteProperties.getProperties(), "Your log-in information was not correct, please try again", null); stopProgressPanel(this); log.error("Gatekeeper login failed for URL: " + gkClient.getGatekeeperUrl(), e); ErrorDialog.showDialog(ownerFrame, this, cockpitLiteProperties.getProperties(), "Log-in failed, please try again", e);
protected void initializeProxy() { // Retrieve Proxy settings. if(this.jets3tProperties.getBoolProperty("httpclient.proxy-autodetect", true)) { RestUtils.initHttpProxy(this.httpClient, this.jets3tProperties); } else { String proxyHostAddress = this.jets3tProperties.getStringProperty("httpclient.proxy-host", null); int proxyPort = this.jets3tProperties.getIntProperty("httpclient.proxy-port", -1); String proxyUser = this.jets3tProperties.getStringProperty("httpclient.proxy-user", null); String proxyPassword = this.jets3tProperties.getStringProperty("httpclient.proxy-password", null); String proxyDomain = this.jets3tProperties.getStringProperty("httpclient.proxy-domain", null); RestUtils.initHttpProxy(this.httpClient, this.jets3tProperties, proxyHostAddress, proxyPort, proxyUser, proxyPassword, proxyDomain); } }
if (jets3tPropertiesFile.exists()) { try { Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME) .loadAndReplaceProperties(new FileInputStream(jets3tPropertiesFile), "jets3t.properties in Cockpit's home folder " + cockpitHomeDirectory); } catch (IOException e) { cockpitProperties = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME); skinsFactory = SkinsFactory.getInstance(cockpitProperties.getProperties());
/** * Create utility class for a given OAuth implementation that will use the given * client ID and Secret. Values in the default system {@link Jets3tProperties} object * are used to configure HTTP/S connections that may be performed by this class. * * @param implementation OAuth implementation version * @param clientId Client ID for installed application * @param clientSecret Client secret for installed applications */ public OAuthUtils(OAuthImplementation implementation, String clientId, String clientSecret) { this(implementation, clientId, clientSecret, Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME)); }
boolean storeEmptyDirectories = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME) .getBoolProperty("uploads.storeEmptyDirectories", true); final Map<String, String> objectKeyToFilepathMap = FileComparer.getInstance() .buildObjectKeyToFilepathMap(downloadDirectory.listFiles(), "", storeEmptyDirectories);
boolean disableDnsBuckets = false; String s3Endpoint = Jets3tProperties.getInstance(Constants.JETS3T_PROPERTIES_FILENAME) .getStringProperty("s3service.s3-endpoint", Constants.S3_DEFAULT_HOSTNAME); hostAndBucket = ServiceUtils.generateS3HostnameForBucket( userBucketName, disableDnsBuckets, s3Endpoint); String message = "Hours must be a valid decimal value; eg 3, 0.1"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, this, cockpitLiteProperties.getProperties(), message, e); } catch (Exception e) { String message = "Unable to generate public GET URL"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, this, cockpitLiteProperties.getProperties(), message, e);