/** * Returns the file resolved from URL and directory * @param extension the extension * @param project the project * @return file the file resolved * @throws BuildException if the URL is invalid */ @Override public File resolve(final Extension extension, final Project project) throws BuildException { validate(); final File file = getDest(); final Get get = new Get(); get.setProject(project); get.setDest(file); get.setSrc(url); get.execute(); return file; }
private File get(final URL url, final String expectedChecksum) { final File tempPluginFile = new File(tempDir, "plugin.zip"); final Get get = new Get(); get.setProject(getProject()); get.setTaskName("get"); get.setSrc(url); get.setDest(tempPluginFile); get.setIgnoreErrors(false); get.setVerbose(false); get.execute(); if (expectedChecksum != null) { final String checksum = getFileHash(tempPluginFile); if (!checksum.equalsIgnoreCase(expectedChecksum)) { throw new BuildException(new IllegalArgumentException(String.format("Downloaded plugin file checksum %s does not match expected value %s", checksum, expectedChecksum))); } } return tempPluginFile; }
Get get = new Get(); get.setDest(new File(spiders, url.getHost() + url.getPath().replace("/","-"))); get.setSrc(url); get.setUseTimestamp(true); get.execute();
getTask.setUseTimestamp(true); getTask.setSrc(this.remoteLocation); String userInfo = this.remoteLocation.getUserInfo(); if (userInfo != null) getTask.setUsername(username); String password = userInfo.substring(separator + 1); getTask.setPassword(password); getTask.setUsername(userInfo); getTask.setDest(targetFile); getTask.execute();
SubscriptionPurchase subscripcion = get.execute();
private void onlineDownload(URL source, File dest) throws IOException { Get get = (Get) getProject().createTask("get"); DownloadProgress progress = null; if (verbose) { progress = new Get.VerboseProgress(System.out); } get.setUseTimestamp(true); get.setUsername(username); get.setPassword(password); get.setMaxTime(maxDownloadTime); get.doGet(source, dest, Project.MSG_INFO, progress); }
Get get = new Get(); get.setDest(new File(spiders, url.getHost() + url.getPath().replace("/", "-"))); get.setSrc(url); get.setUseTimestamp(true); get.execute();
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = new JacksonFactory(); List<String> scopes = new ArrayList<String>(); scopes.add(AndroidPublisherScopes.ANDROIDPUBLISHER); Credential credential = new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory) .setServiceAccountId(googleServiceAccountId) .setServiceAccountPrivateKeyFromP12File(new File(googleServicePrivateKeyPath)) .setServiceAccountScopes(scopes).build(); AndroidPublisher publisher = new AndroidPublisher.Builder(httpTransport, jsonFactory, credential).build(); AndroidPublisher.Purchases purchases = publisher.purchases(); final Get request = purchases.get(packageName, productId, token); final SubscriptionPurchase purchase = request.execute(); // Do whatever you want with the purchase bean
protected void downloadWithAnt(final URL url, final File outputFile) { Project p = new Project(); p.addBuildListener(new AntJettyLoggerBuildListener(LOGGER)); Get g = new Get(); g.setProject(p); g.setSrc(url); g.setDest(outputFile); g.execute(); }
private static GoogleCredential getGoogleCredential() throws IOException { List<String> scopes = new ArrayList<String>(); scopes.add(AndroidPublisherScopes.ANDROIDPUBLISHER); ClassLoader classLoader = MY_CLASS.class.getClassLoader(); GoogleCredential credential = GoogleCredential.fromStream(classLoader.getResourceAsStream(GOOGLE_KEY_FILE_PATH)) .createScoped(scopes); return credential; } private static ProductPurchase getPurchase(GoogleReceipt receipt, GoogleCredential credential) throws GeneralSecurityException, IOException { HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = new JacksonFactory(); AndroidPublisher publisher = new AndroidPublisher.Builder(httpTransport, jsonFactory, credential) .setApplicationName(YOUR_APPLICATION_NAME).build(); AndroidPublisher.Purchases purchases = publisher.purchases(); final Get request = purchases.products().get(receipt.getPackageName(), receipt.getProductId(), receipt.getPurchaseToken()); final ProductPurchase purchase = request.execute(); return purchase; }
protected void downloadWithAnt(final URL url, final File outputFile) { Project p = new Project(); p.addBuildListener(new AntJettyLoggerBuildListener(LOGGER)); Get g = new Get(); g.setProject(p); g.setSrc(url); g.setDest(outputFile); g.execute(); }
/** * Extracts jonas-starter from jonas-builder archive. * @param builderJar the jonas-builder location */ public void initStarter(final String builderJar) throws BuilderException { Get get = new Get(); Project project = new Project(); try { get.setSrc(new URL(builderJar)); get.setDest(this.workdirectory); get.setProject(project); get.execute(); setStarterDefaultLocation(new File(this.workdirectory.getAbsolutePath(), this.jonasStarterJarFileTmpName)); } catch (MalformedURLException ex) { Logger.getLogger(Builder.class.getName()).log(Level.SEVERE, null, ex); } Unzip unzip = new Unzip(this.output); unzip.setVerboseMode(this.verboseMode); unzip.setSrc(new File(builderJar)); setStarterDefaultLocation(new File(this.workdirectory.getAbsolutePath(), this.jonasStarterJarFileTmpName)); unzip.setDest(this.workdirectory); try { unzip.execute(); } catch (UnzipException e) { throw new BuilderException("Unable to initialize starter", e); } }
Get get = new Get(); Project project = new Project(); get.setSrc(starterUrl); get.setDest(this.workdirectory); get.setProject(project); get.execute(); this.jonasStarterJarFileTmpName = starterUrlString.substring(starterUrlString.lastIndexOf("/"), starterUrlString .length());
Get get = new Get(); Project project = new Project(); Copy cp = new Copy(); if (Utility.testConnexionURL(new URL(this.applicationLocation[i]))) { try { get.setSrc(new URL(this.applicationLocation[i])); get.setDest(new File(destFolder)); get.setProject(project); get.execute(); } catch (MalformedURLException ex) { this.output.write(ex.getMessage());
if (this.url.startsWith("http") || this.url.startsWith("https") || this.url.startsWith("ftp")) { Get get = new Get(); try { get.setSrc(new URL(this.url)); } catch (MalformedURLException ex) { this.output.write(ex.getMessage()); get.setDest(new File(this.workdirectory, file)); get.setProject(project); get.execute(); this.jonasLocation.add(0, this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + file); } else {