/** {@inheritDoc} */ @Override public String toString() { return S.toString(UriDeploymentScannerManager.class, this, "uri", U.hidePassword(uri.toString())); } }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(GridUriDeploymentUnitDescriptor.class, this, "uri", U.hidePassword(uri)); } }
/** * Fills in list of URIs with all available URIs and encodes them if * encoding is enabled. * * @throws org.apache.ignite.spi.IgniteSpiException Thrown if at least one URI has incorrect syntax. */ private void initializeUriList() throws IgniteSpiException { for (String uri : uriList) { assertParameter(uri != null, "uriList.get(X) != null"); String encUri = encodeUri(uri.replaceAll("\\\\", "/")); URI uriObj; try { uriObj = new URI(encUri); } catch (URISyntaxException e) { throw new IgniteSpiException("Failed to parse URI [uri=" + U.hidePassword(uri) + ", encodedUri=" + U.hidePassword(encUri) + ']', e); } if (uriObj.getScheme() == null || uriObj.getScheme().trim().isEmpty()) throw new IgniteSpiException("Failed to get 'scheme' from URI [uri=" + U.hidePassword(uri) + ", encodedUri=" + U.hidePassword(encUri) + ']'); uriEncodedList.add(uriObj); } }
/** {@inheritDoc} */ @Override public void onDeletedFiles(List<String> uris) { if (log.isInfoEnabled()) { List<String> uriList = null; if (uris != null) { uriList = new ArrayList<>(); for (String uri : uris) uriList.add(U.hidePassword(uri)); } if (log.isInfoEnabled()) log.info("Found deleted GAR units [uris=" + uriList + ']'); } processDeletedFiles(uris); }
/** * Create context for the given URI. * * @param uri URI. * @param scanCtx Scanner context. * @return URI context. */ private URIContext createUriContext(URI uri, final UriDeploymentScannerContext scanCtx) { String scanDirPath = uri.getPath(); File scanDir = null; if (scanDirPath != null) scanDir = new File(scanDirPath); if (scanDir == null || !scanDir.isDirectory()) throw new IgniteSpiException("URI is either not provided or is not a directory: " + U.hidePassword(uri.toString())); FileFilter garFilter = new FileFilter() { /** {@inheritDoc} */ @Override public boolean accept(File pathname) { return scanCtx.getFilter().accept(null, pathname.getName()); } }; FileFilter garDirFilesFilter = new FileFilter() { /** {@inheritDoc} */ @Override public boolean accept(File pathname) { // Allow all files in GAR-directory. return pathname.isFile(); } }; return new URIContext(scanDir, garFilter, garDirFilesFilter); }
U.warn(scanCtx.getLogger(), "No GAR-units found in: " + U.hidePassword(scanCtx.getUri().toString()));
/** * */ @Test public void testHidePassword() { Collection<String> uriList = new ArrayList<>(); uriList.add("ftp://anonymous:111111;freq=5000@unknown.host:21/pub/gg-test"); uriList.add("ftp://anonymous:111111;freq=5000@localhost:21/pub/gg-test"); uriList.add("http://freq=5000@localhost/tasks"); uriList.add("http://freq=5000@unknownhost.host/tasks"); for (String uri : uriList) X.println(uri + " -> " + U.hidePassword(uri)); }
throw new IOException("Failed to open connection: " + U.hidePassword(url.toString())); if (X.hasCause(e, ConnectException.class)) { LT.error(scanCtx.getLogger(), e, "Failed to connect to HTTP server (connection refused): " + U.hidePassword(url.toString())); U.hidePassword(url.toString())); U.error(scanCtx.getLogger(), "Failed to get HTML page: " + U.hidePassword(url.toString()), e);
U.hidePassword(uri) + ']');
else if (log.isDebugEnabled()) log.debug("No tasks loaded from file [file=" + file.getAbsolutePath() + ", uri=" + U.hidePassword(uri) + ']');
U.hidePassword(url)); if (X.hasCause(e, ConnectException.class)) { LT.error(scanCtx.getLogger(), e, "Failed to connect to HTTP server " + "(connection refused): " + U.hidePassword(url)); "(host is unknown): " + U.hidePassword(url));
@Override public void onNewOrUpdatedFile(File file, String uri, long tstamp) { if (log.isInfoEnabled()) log.info("Found new or updated GAR units [uri=" + U.hidePassword(uri) + ", file=" + file.getAbsolutePath() + ", tstamp=" + tstamp + ']'); if (delayOnNewOrUpdatedFile) { U.warn(log, "Delaying onNewOrUpdatedFile() by 10000 ms since 'delayOnNewOrUpdatedFile' " + "is set to true (is this intentional?)."); try { U.sleep(10000); } catch (IgniteInterruptedCheckedException ignored) { // No-op } U.warn(log, "Delay finished."); } try { GridUriDeploymentFileProcessorResult fileRes = GridUriDeploymentFileProcessor.processFile(file, uri, new File(deployTmpDirPath), log); if (fileRes != null) newUnitReceived(uri, fileRes.getFile(), tstamp, fileRes.getClassLoader(), fileRes.getTaskClasses(), fileRes.getMd5()); } catch (IgniteSpiException e) { U.error(log, "Error when processing file: " + file.getAbsolutePath(), e); } }
if (log.isInfoEnabled()) LT.info(log, "Skipping new deployment unit because of md5 match " + "[uri='" + U.hidePassword(newDesc.getUri()) + "', file=" + (newDesc.getFile() == null ? "N/A" : newDesc.getFile()) + ']'); LT.info(log, "Class loader (re)registered [clsLdr=" + newDesc.getClassLoader() + ", tstamp=" + newDesc.getTimestamp() + ", uri='" + U.hidePassword(newDesc.getUri()) + "', file=" + (newDesc.getFile() == null ? "N/A" : newDesc.getFile()) + ']');
else if (log.isDebugEnabled()) log.debug("No tasks loaded from file [file=" + file.getAbsolutePath() + ", uri=" + U.hidePassword(uri) + ']');