public boolean hasSlackUserId(){ return StringUtil.isNotEmpty(slackUserId); } }
public PathPatternFilter(@NotNull String patterns) { if (StringUtil.isEmptyOrSpaces(patterns)) { patterns = "+:" + DEFAULT_INCLUDE_RULE; } final IncludeExcludeRules rules = new IncludeExcludeRules(patterns); for (IncludeExcludeRules.Rule r : rules.getRules()) { if (r.isInclude()) { myIncludePatterns.add(r.getRule()); } else { myExcludePatterns.add(r.getRule()); } } }
private void handleDeploy(final SRunningBuild build, final BuildTriggerDescriptor trigger) { executorService.submit(ExceptionUtil.catchAll("Tomcat7 Deploy", new Runnable() { @Override public void run() { try { deployHandler.handle(build, trigger); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error getting pull request infos", e); } } })); } }
public AnsibleReportArtifatcsProvider( @NotNull ArtifactsWatcher artifactsWatcher, @NotNull EventDispatcher<AgentLifeCycleListener> agentDispatcher) { agentDispatcher.addListener(this); this.artifactsWatcher = artifactsWatcher; }
public static String normalizeArtifactPath(final String path, final File file) { if (StringUtil.isEmpty(path)) { return file.getName(); } else { return FileUtil.normalizeRelativePath(String.format("%s/%s", path, file.getName())); } }
public static String getContentType(File file) { String contentType = URLConnection.guessContentTypeFromName(file.getName()); if (StringUtil.isNotEmpty(contentType)) { return contentType; } if (PROBE_CONTENT_TYPE_METHOD != null && FILE_TO_PATH_METHOD != null) { try { Object result = PROBE_CONTENT_TYPE_METHOD.invoke(null, FILE_TO_PATH_METHOD.invoke(file)); if (result instanceof String) { contentType = (String)result; } } catch (Exception ignored) { } } return StringUtil.notEmpty(contentType, DEFAULT_CONTENT_TYPE); }
@NotNull public List<String> filterPaths(@NotNull List<String> paths) { if (isIncludeAll()) return paths; final Collection<PathNode> files = AntPatternTreeMatcher.scan(createPathTree(paths), myIncludePatterns, myExcludePatterns, AntPatternTreeMatcher.ScanOption.LEAFS_ONLY); return CollectionsUtil.convertCollection(files, PathNode::getPath); }
public void run() FileUtil.processXmlFile(SlackNotificationMainConfig.this.myConfigFile, new FileUtil.Processor() { public void process(Element rootElement) { rootElement.setAttribute("enabled", Boolean.toString(SlackNotificationMainConfig.this.enabled));
public String getParameterAsStringOrNull(HttpServletRequest request, String paramName, String errorMessage) throws MissingPathException { String returnValue = StringUtil.nullIfEmpty(request.getParameter(paramName)); if (returnValue == null || "".equals(returnValue.trim())) { throw new MissingPathException(errorMessage); } return returnValue; }
@NotNull private List<String> getPathsToDelete(@NotNull ArtifactListData artifactsInfo, @NotNull String patterns, @NotNull String pathPrefix) throws IOException { final List<String> keys = CollectionsUtil.convertCollection(artifactsInfo.getArtifactList(), ArtifactData::getPath); return new ArrayList<>(new PathPatternFilter(patterns).filterPaths(keys)); }
@Nullable private PathPatternFilter.PathNode getChild(@NotNull String path, @NotNull List<PathPatternFilter.PathNode> children) { return CollectionsUtil.findFirst(children, data -> path.equals(data.getPath())); }
public S3ArtifactsPublisher(@NotNull final AgentArtifactHelper helper, @NotNull final EventDispatcher<AgentLifeCycleListener> dispatcher, @NotNull final CurrentBuildTracker tracker, @NotNull final BuildAgentConfiguration buildAgentConfiguration) { myHelper = helper; myTracker = tracker; myBuildAgentConfiguration = buildAgentConfiguration; dispatcher.addListener(new AgentLifeCycleAdapter() { @Override public void buildStarted(@NotNull AgentRunningBuild runningBuild) { myFileUploader = null; myArtifacts.clear(); } }); }
private boolean userHasSlackIdConfigured(SUser sUser) { String userName = sUser.getPropertyValue(USERID_KEY); return StringUtil.isNotEmpty(userName); }
private void handleBuildStatus(final SRunningBuild build, final BuildStatus buildStatus, final BuildTriggerDescriptor trigger) { executorService.submit(ExceptionUtil.catchAll("PullRequest Handler", new Runnable() { @Override public void run() { try { statusHandler.handle(build, trigger, buildStatus); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error updating pull request status.", e); } } })); }
public StagingBuildListener(EventDispatcher<BuildServerListener> listener, ExecutorServices executorServices, TomcatDeployHandler deployHandler) { this.deployHandler = deployHandler; executorService = executorServices.getLowPriorityExecutorService(); listener.addListener(new BuildServerAdapter() { @Override public void buildFinished(@NotNull SRunningBuild build) { onBuildFinished(build); } }); }
private void handleBuildStatus( final SRunningBuild build, final BuildStatus buildStatus, final SBuildFeatureDescriptor feature) { executorService.submit(ExceptionUtil.catchAll("BuildCommitStatus Handler", new Runnable() { @Override public void run() { try { statusHandler.handle(build, feature, buildStatus); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error updating commit status.", e); } } })); }
public HubServerListener(@NotNull final EventDispatcher<BuildServerListener> dispatcher, @NotNull final SBuildServer server, @NotNull final ServerPaths serverPaths) { this.server = server; dispatcher.addListener(this); configPersistenceManager = new ServerHubConfigPersistenceManager(serverPaths); }
public ArtifactoryServerListener(@NotNull final EventDispatcher<BuildServerListener> dispatcher, @NotNull final SBuildServer server, @NotNull ServerPaths serverPaths) { this.server = server; dispatcher.addListener(this); configPersistenceManager = new ServerConfigPersistenceManager(serverPaths); }
public PullRequestsBuildListener(EventDispatcher<BuildServerListener> listener, ExecutorServices executorServices, PullRequestStatusHandler statusHandler) { this.statusHandler = statusHandler; executorService = executorServices.getLowPriorityExecutorService(); listener.addListener(new BuildServerAdapter() { @Override public void buildStarted(@NotNull SRunningBuild build) { onBuildStatusChanged(build, BuildStatus.STARTING); } @Override public void buildInterrupted(@NotNull SRunningBuild build) { onBuildStatusChanged(build, BuildStatus.INTERRUPTED); } @Override public void buildFinished(@NotNull SRunningBuild build) { onBuildStatusChanged(build, BuildStatus.FINISHED); } }); }
public BuildCommitBuildListener( EventDispatcher<BuildServerListener> listener, ExecutorServices executorServices, BuildCommitStatusHandler statusHandler) { this.statusHandler = statusHandler; executorService = executorServices.getLowPriorityExecutorService(); listener.addListener(new BuildServerAdapter() { @Override public void changesLoaded(@NotNull SRunningBuild build) { onBuildStatusChanged(build, BuildStatus.STARTING); } @Override public void buildInterrupted(@NotNull SRunningBuild build) { onBuildStatusChanged(build, BuildStatus.INTERRUPTED); } @Override public void buildFinished(@NotNull SRunningBuild build) { onBuildStatusChanged(build, BuildStatus.FINISHED); } }); }