private File getCacheFile(String oozieUrl) { AuthOozieClient authOozieClient = new AuthOozieClient(oozieUrl); String filename = authOozieClient.getAuthCacheFileName(oozieUrl); return new File(System.getProperty("user.home"), filename); }
wc = new AuthOozieClient(oozieUrl.toString()); Properties conf = wc.createConfiguration(); while (wc.getJobInfo(jobId).getStatus() == Status.RUNNING) if(wc.getJobInfo(jobId).getStatus() == Status.SUCCEEDED) logger.info(wc.getJobInfo(jobId)); logger.info(wc.getJobInfo(jobId));
@Override public List<CoordinatorJob> getCoordJobs() throws Exception { AuthOozieClient client = createOozieConnection(); List<CoordinatorJob> jobs = client.getCoordJobsInfo(config.getFilter(), 0, Integer.MAX_VALUE); if (jobs == null || jobs.isEmpty()) { return Collections.emptyList(); } return jobs; } }
private AuthOozieClient createOozieConnection() throws Exception { AuthOozieClient client = new AuthOozieClient(config.getOozieUrl(), config.getAuthType()); return client; }
readToken = readAuthToken(); long expires = getExpirationTime(currentToken); if (expires < System.currentTimeMillis() + 300000) { if (useAuthFile) { Authenticator authenticator = getAuthenticator(); try { authenticator.authenticate(url, currentToken); writeAuthToken(currentToken);
/** * Create an instance of the AuthOozieClient. * * @param oozieUrl the Oozie URL * @param authOption the auth option */ @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "FilenameUtils is used to filter user input. JDK8+ is used.") public AuthOozieClient(String oozieUrl, String authOption) { super(oozieUrl); this.authOption = authOption; String filename = getAuthCacheFileName(oozieUrl); // just to filter user input authTokenCacheFile = new File(System.getProperty("user.home"), FilenameUtils.getName(filename)); if (filename.length() >= AUTH_TOKEN_CACHE_FILENAME_MAXLENGTH && authTokenCacheFile.exists()) { System.out.println("Warn: the same Oozie auth cache filename exists, filename=" + filename); } }
if (authOption != null) { try { Class<? extends Authenticator> authClass = getAuthenticators().get(authOption.toUpperCase()); if (authClass == null) { throw new OozieClientException(OozieClientException.AUTHENTICATION,
private AuthOozieClient createOozieConnection() throws Exception { AuthOozieClient client = new AuthOozieClient(config.getOozieUrl(), config.getAuthType()); return client; }
readToken = readAuthToken(); long expires = getExpirationTime(currentToken); if (expires < System.currentTimeMillis() + 300000) { if (useAuthFile) { Authenticator authenticator = getAuthenticator(); try { authenticator.authenticate(url, currentToken); writeAuthToken(currentToken);
if (authOption != null) { try { Class<? extends Authenticator> authClass = getAuthenticators().get(authOption.toUpperCase()); if (authClass == null) { throw new OozieClientException(OozieClientException.AUTHENTICATION,
/** * Create a XOozieClient. * <p> * It injects any '-Dheader:' as header to the the {@link org.apache.oozie.client.OozieClient}. * * @param commandLine the parsed command line options. * @return a pre configured eXtended workflow client. * @throws OozieCLIException thrown if the XOozieClient could not be configured. */ protected XOozieClient createXOozieClient(CommandLine commandLine) throws OozieCLIException { XOozieClient wc = new AuthOozieClient(getOozieUrl(commandLine), getAuthOption(commandLine)); addHeader(wc); setDebugMode(wc,commandLine.hasOption(DEBUG_OPTION)); setRetryCount(wc); return wc; }
@Override public List<CoordinatorJob> getCoordJobs() throws Exception { AuthOozieClient client = createOozieConnection(); List<CoordinatorJob> jobs = client.getCoordJobsInfo(config.getFilter(), 0, Integer.MAX_VALUE); if (jobs == null || jobs.isEmpty()) { return Collections.emptyList(); } return jobs; } }
/** * Create a XOozieClient. * <p> * It injects any '-Dheader:' as header to the the {@link org.apache.oozie.client.OozieClient}. * * @param commandLine the parsed command line options. * @return a pre configured eXtended workflow client. * @throws OozieCLIException thrown if the XOozieClient could not be configured. */ protected XOozieClient createXOozieClient(CommandLine commandLine) throws OozieCLIException { XOozieClient wc = new AuthOozieClient(getOozieUrl(commandLine), getAuthOption(commandLine)); addHeader(wc); setDebugMode(wc,commandLine.hasOption(DEBUG_OPTION)); setRetryCount(wc); return wc; }