public BuildSession(String buildId, AgentIdentifier agentIdentifier, BuildStateReporter buildStateReporter, TaggedStreamConsumer console, StrLookup buildVariables, ArtifactsRepository artifactsRepository, HttpService httpService, Clock clock, File workingDir, String consoleLogCharset) { this.buildId = buildId; this.agentIdentifier = agentIdentifier; this.buildStateReporter = buildStateReporter; this.console = console; this.buildVariables = buildVariables; this.artifactsRepository = artifactsRepository; this.httpService = httpService; this.clock = clock; this.workingDir = workingDir; this.consoleLogCharset = consoleLogCharset; this.envs = new HashMap<>(); this.secretSubstitutions = new HashMap<>(); this.buildResult = JobResult.Passed; this.doneLatch = new CountDownLatch(1); this.cancelLatch = new CountDownLatch(1); this.downloadAction = new DownloadAction(httpService, getPublisher(), clock); this.executorService = Executors.newCachedThreadPool(); }
private String handleInterpolation(String value) { StrSubstitutor substitutor = new StrSubstitutor(new StrLookup() { @Override public String lookup(String key) { String property = getSystemOrAppProperty(key); return property != null ? property : System.getProperty(key); } }); return substitutor.replace(value); }
public BuildVariables(AgentRuntimeInfo agentRuntimeInfo, Clock clock) { this.clock = clock; this.staticLookup = StrLookup.mapLookup(map( "agent.location", agentRuntimeInfo.getLocation(), "agent.hostname", agentRuntimeInfo.getHostName() )); }
protected BuildSession newBuildSession() { return new BuildSession("build1", agentIdentifier, statusReporter, console, StrLookup.mapLookup(buildVariables), artifactsRepository, httpService, new TestingClock(), sandbox, "utf-8"); }
private Email getEmail(final MailTemplate mailTemplate, final Class<? extends Email> mailType, final Map<String, String> params) throws EmailException, MessagingException, IOException { final Email email = mailTemplate.getEmail(StrLookup.mapLookup(params), mailType); if (params.containsKey(EmailServiceConstants.SENDER_EMAIL_ADDRESS) && params.containsKey(EmailServiceConstants.SENDER_NAME)) { email.setFrom( params.get(EmailServiceConstants.SENDER_EMAIL_ADDRESS), params.get(EmailServiceConstants.SENDER_NAME)); } else if (params.containsKey(EmailServiceConstants.SENDER_EMAIL_ADDRESS)) { email.setFrom(params.get(EmailServiceConstants.SENDER_EMAIL_ADDRESS)); } if (connectTimeout > 0) { email.setSocketConnectionTimeout(connectTimeout); } if (soTimeout > 0) { email.setSocketTimeout(soTimeout); } // #1008 setting the subject via the setSubject(..) parameter. if (params.containsKey(EmailServiceConstants.SUBJECT)) { email.setSubject(params.get(EmailServiceConstants.SUBJECT)); } return email; }
@Activate @SuppressWarnings("squid:S1149") protected final void activate(ComponentContext ctx) { Dictionary<?, ?> config = ctx.getProperties(); color = PropertiesUtil.toString(config.get(PROP_COLOR), ""); cssOverride = PropertiesUtil.toString(config.get(PROP_CSS_OVERRIDE), ""); innerHTML = PropertiesUtil.toString(config.get(PROP_INNER_HTML), ""); innerHTML = new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(innerHTML); // Only write CSS variable if cssOverride or color is provided if (StringUtils.isNotBlank(cssOverride)) { css = cssOverride; } else if (StringUtils.isNotBlank(color)) { css = createCss(color); } titlePrefix = xss.encodeForJSString( PropertiesUtil.toString(config.get(PROP_TITLE_PREFIX), "").toString()); if (StringUtils.isNotBlank(css) || StringUtils.isNotBlank(titlePrefix)) { Dictionary<String, String> filterProps = new Hashtable<String, String>(); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/"); filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)"); filterRegistration = ctx.getBundleContext().registerService(Filter.class.getName(), this, filterProps); } excludedWCMModes = PropertiesUtil.toStringArray(config.get(PROP_EXCLUDED_WCMMODES),DEFAULT_EXCLUDED_WCMMODES); }
@Override protected StrLookup fetchLookupForPrefix(String prefix) { return errorLookup; }
@Override protected StrLookup fetchNoPrefixLookup() { return errorLookup; }