本文整理汇总了Java中jetbrains.buildServer.serverSide.TeamCityProperties类的典型用法代码示例。如果您正苦于以下问题:Java TeamCityProperties类的具体用法?Java TeamCityProperties怎么用?Java TeamCityProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TeamCityProperties类属于jetbrains.buildServer.serverSide包,在下文中一共展示了TeamCityProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreSignedUrl
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
@NotNull
@Override
public String getPreSignedUrl(@NotNull HttpMethod httpMethod, @NotNull String bucketName, @NotNull String objectKey, @NotNull Map<String, String> params) throws IOException {
try {
final Callable<String> resolver = () -> S3Util.withS3Client(params, client -> {
final GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, objectKey, httpMethod)
.withExpiration(new Date(System.currentTimeMillis() + getUrlLifetimeSec() * 1000));
return client.generatePresignedUrl(request).toString();
});
if (httpMethod == HttpMethod.GET) {
return TeamCityProperties.getBoolean(TEAMCITY_S3_PRESIGNURL_GET_CACHE_ENABLED)
? myGetLinksCache.get(getCacheIdentity(params, objectKey, bucketName), resolver)
: resolver.call();
} else {
return resolver.call();
}
} catch (Exception e) {
final AWSException awsException = new AWSException(e.getCause());
if (StringUtil.isNotEmpty(awsException.getDetails())) {
LOG.warn(awsException.getDetails());
}
final String err = "Failed to create " + httpMethod.name() + " pre-signed URL for [" + objectKey + "] in bucket [" + bucketName + "]";
LOG.infoAndDebugDetails(err, awsException);
throw new IOException(err + ": " + awsException.getMessage(), awsException);
}
}
开发者ID:JetBrains,项目名称:teamcity-s3-artifact-storage-plugin,代码行数:27,代码来源:S3PreSignedUrlProviderImpl.java
示例2: setUp
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
@BeforeMethod
@Override
protected void setUp() throws Exception {
super.setUp();
// setPartialMessagesChecker();
new TeamCityProperties() {{
setModel(new BasePropertiesModel() {
@NotNull
@Override
public Map<String, String> getUserDefinedProperties() {
return CollectionsUtil.asMap("teamcity.agent.build.messages.translators.enabled", "true");
}
});
}};
myEventDispatcher = EventDispatcher.create(AgentLifeCycleListener.class);
myCurrentBuildTracker = new CurrentBuildTrackerImpl(myEventDispatcher);
myTranslatorsRegistry = new TranslatorsRegistryImpl();
myParserLoader = new ParserLoaderImpl(myCurrentBuildTracker);
myParsersRegistry = new ParsersRegistryImpl(myTranslatorsRegistry, myParserLoader);
}
示例3: cleanupOldInstances
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
private void cleanupOldInstances() {
final long stoppedOrphanedTimeout = TeamCityProperties.getLong("teamcity.vmware.stopped.orphaned.timeout", STOPPED_ORPHANED_TIMEOUT);
final Date considerTime = new Date(System.currentTimeMillis() - stoppedOrphanedTimeout);
processStoppedInstances(new Function<VmwareInstance, Boolean>() {
public Boolean fun(final VmwareInstance vmInstance) {
final String vmName = vmInstance.getName();
final VmwareCloudInstance instance = findInstanceById(vmName);
if (instance != null && instance.getStatusUpdateTime().before(considerTime)){
LOG.info(String.format("VM %s was orphaned and will be deleted", vmName));
deleteInstance(instance);
return true;
}
return false;
}
});
}
示例4: getInstanceStartedTime
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
@NotNull
@Override
public Date getInstanceStartedTime(@NotNull String instanceId, @NotNull Callable<Date> resolver) throws Exception {
long now = System.currentTimeMillis();
synchronized (myInstanceStartedTimeCache) {
CacheEntry<Date> cacheEntry = myInstanceStartedTimeCache.get(instanceId);
if (cacheEntry == null || (now - cacheEntry.getTimestamp()) > TeamCityProperties.getInteger(CACHE_EXPIRATION_TIMEOUT_PROPERTY, 10 * 1000)) {
myInstanceStartedTimeCache.put(instanceId, new CacheEntry<>(now, resolver.call()));
}
}
return myInstanceStartedTimeCache.get(instanceId).getData();
}
示例5: getInstanceStatus
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
@NotNull
@Override
public InstanceStatus getInstanceStatus(@NotNull String instanceId, @NotNull Callable<InstanceStatus> resolver) throws Exception {
long now = System.currentTimeMillis();
synchronized (myInstanceStatusCache) {
CacheEntry<InstanceStatus> cacheEntry = myInstanceStatusCache.get(instanceId);
if (cacheEntry == null || (now - cacheEntry.getTimestamp()) > TeamCityProperties.getInteger(CACHE_EXPIRATION_TIMEOUT_PROPERTY, 10 * 1000)) {
myInstanceStatusCache.put(instanceId, new CacheEntry<>(now, resolver.call()));
}
}
return myInstanceStatusCache.get(instanceId).getData();
}
示例6: getToolPath
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
@Nullable
private static String getToolPath(@NotNull final BuildAgentConfiguration configuration) {
final String rpctoolPath = TeamCityProperties.getProperty(RPC_TOOL_PARAMETER);
if (StringUtil.isNotEmpty(rpctoolPath)){
return rpctoolPath;
}
if (SystemInfo.isUnix) { // Linux, MacOSX, FreeBSD
final Map<String, String> envs = configuration.getBuildParameters().getEnvironmentVariables();
final String path = envs.get("PATH");
if (path != null) for (String p : StringUtil.splitHonorQuotes(path, File.pathSeparatorChar)) {
final File file = new File(p, VMWARE_RPCTOOL_NAME);
if (file.exists()) {
return file.getAbsolutePath();
}
}
}
if (SystemInfo.isLinux) {
return getExistingCommandPath(LINUX_COMMANDS);
} else if (SystemInfo.isWindows) {
return getExistingCommandPath(WINDOWS_COMMANDS);
} else if (SystemInfo.isMac) {
return getExistingCommandPath(MAC_COMMANDS);
} else {
return getExistingCommandPath(LINUX_COMMANDS); //todo: update for other OS'es
}
}
示例7: canStartNewInstance
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
public synchronized boolean canStartNewInstance() {
if (getErrorInfo() != null){
LOG.debug("Can't start new instance, if image is erroneous");
return false;
}
if (myImageDetails.getBehaviour().isUseOriginal()) {
final VmwareCloudInstance myInstance = findInstanceById(myImageDetails.getSourceId());
if (myInstance == null) {
return false;
}
return myInstance.getStatus() == InstanceStatus.STOPPED;
}
final boolean countStoppedVmsInLimit = TeamCityProperties.getBoolean(VmwareConstants.CONSIDER_STOPPED_VMS_LIMIT)
&& myImageDetails.getBehaviour().isDeleteAfterStop();
final List<String> consideredInstances = new ArrayList<String>();
for (VmwareCloudInstance instance : getInstances()) {
if (instance.getStatus() != InstanceStatus.STOPPED || countStoppedVmsInLimit)
consideredInstances.add(instance.getInstanceId());
}
final boolean canStartMore = consideredInstances.size() < myImageDetails.getMaxInstances();
LOG.debug(String.format("[%s] Instances count: %d %s, can start more: %s", myImageDetails.getSourceId(),
consideredInstances.size(), Arrays.toString(consideredInstances.toArray()), String.valueOf(canStartMore)));
return canStartMore;
}
示例8: AgentTorrentsSeeder
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
public AgentTorrentsSeeder(@NotNull final BuildAgentConfiguration agentConfiguration,
@NotNull final TorrentConfiguration torrentConfiguration) {
myExecutorService = Executors.newScheduledThreadPool(1);
myTorrentsSeeder = new TorrentsSeeder(agentConfiguration.getCacheDirectory(Constants.TORRENTS_DIRNAME), TeamCityProperties.getInteger("teamcity.torrents.agent.maxSeededTorrents", 5000), new ParentDirConverter() {
@NotNull
@Override
public File getParentDir() {
return agentConfiguration.getSystemDirectory();
}
}, myExecutorService, torrentConfiguration);
}
示例9: updateSettings
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
private boolean updateSettings() {
try {
final int defaultSize = SystemInfo.isWindows ? TorrentConfiguration.DEFAULT_BUFFER_SIZE_WINDOWS : -1;
final TeamcityTorrentClient client = myTorrentsSeeder.getClient();
client.setSendBufferSize(TeamCityProperties.getInteger(TorrentConfiguration.SEND_BUFFER_SIZE, defaultSize));
client.setReceiveBufferSize(TeamCityProperties.getInteger(TorrentConfiguration.RECEIVE_BUFFER_SIZE, defaultSize));
String announceUrl = myTrackerManager.getAnnounceUrl();
if (announceUrl == null) return false;
myTrackerAnnounceUrl = new URI(announceUrl);
myTorrentsSeeder.setSocketTimeout(myTrackerManager.getSocketTimeout());
myTorrentsSeeder.setCleanupTimeout(myTrackerManager.getCleanupTimeout());
myTorrentsSeeder.setAnnounceInterval(myAnnounceIntervalSec);
final int maxConnectionsCount = myTrackerManager.getMaxConnectionsCount();
myTorrentsSeeder.setMaxIncomingConnectionsCount(maxConnectionsCount);
myTorrentsSeeder.setMaxOutgoingConnectionsCount(maxConnectionsCount);
myTransportEnabled = myLeechSettings.isDownloadEnabled();
boolean needEnableTorrent = (mySeedingSettings.isSeedingEnabled() || myTransportEnabled);
if (needEnableTorrent) {
startSeeder();
} else {
stopSeeder();
}
} catch (Exception e) {
LOG.warn("Error updating torrent settings", e);
return false;
}
return true;
}
示例10: TorrentConfigurator
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
public TorrentConfigurator(@NotNull final ServerPaths serverPaths,
@NotNull final RootUrlHolder rootUrlHolder,
@NotNull final XmlRpcHandlerManager xmlRpcHandlerManager) {
myServerPaths = serverPaths;
myRootUrlHolder = rootUrlHolder;
File configFile = getConfigFile();
if (!configFile.isFile()) {
initConfigFile(configFile);
}
loadConfiguration(configFile);
xmlRpcHandlerManager.addHandler(XmlRpcConstants.TORRENT_CONFIGURATION, this);
myConfigurationWatcher = new TorrentConfigurationWatcher();
myConfigurationWatcher.registerListener(new ChangeListener() {
public void changeOccured(String requestor) {
setTrackerEnabled(TeamCityProperties.getBooleanOrTrue(TRACKER_ENABLED));
setTrackerUsesDedicatedPort(TeamCityProperties.getBoolean(TRACKER_DEDICATED_PORT));
setMaxNumberOfSeededTorrents(TeamCityProperties.getInteger(MAX_NUMBER_OF_SEEDED_TORRENTS, DEFAULT_MAX_NUMBER_OF_SEEDED_TORRENTS));
long newFileSize = getFileSizeThreshold();
setFileSizeThresholdMb(newFileSize);
setMaxConnectionsCount(TeamCityProperties.getInteger(MAX_INCOMING_CONNECTIONS, DEFAULT_MAX_CONNECTIONS));
setTrackerTorrentExpireTimeoutSec(TeamCityProperties.getInteger(TRACKER_TORRENT_EXPIRE_TIMEOUT, DEFAULT_TRACKER_TORRENT_EXPIRE_TIMEOUT));
setAnnounceIntervalSec(TeamCityProperties.getInteger(ANNOUNCE_INTERVAL, DEFAULT_ANNOUNCE_INTERVAL));
setAnnounceUrl(TeamCityProperties.getProperty(ANNOUNCE_URL));
final int defaultBufferSize = SystemInfo.isWindows ? DEFAULT_BUFFER_SIZE_WINDOWS : -1;
setReceiveBufferSize(TeamCityProperties.getInteger(RECEIVE_BUFFER_SIZE, defaultBufferSize));
setSendBufferSize(TeamCityProperties.getInteger(SEND_BUFFER_SIZE, defaultBufferSize));
}
});
myConfigurationWatcher.registerChangeProvider(myConfigurationWatcher);
myConfigurationWatcher.start();
}
示例11: getFileSizeThreshold
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
private long getFileSizeThreshold() {
String strValue = TeamCityProperties.getProperty(FILE_SIZE_THRESHOLD, DEFAULT_FILE_SIZE_THRESHOLD);
try {
return StringUtil.parseFileSize(strValue);
} catch (NumberFormatException e) {
Loggers.SERVER.warnAndDebugDetails("incorrect value " + strValue + " for file size threshold property", e);
try {
return StringUtil.parseFileSize(DEFAULT_FILE_SIZE_THRESHOLD);
} catch (NumberFormatException nfe) {
Loggers.SERVER.warnAndDebugDetails("incorrect default value " + DEFAULT_FILE_SIZE_THRESHOLD + " for file size threshold property", nfe);
}
}
return 10*1024*1024;//10mb
}
示例12: getMaxNumberOfSeededTorrents
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
@Override
public int getMaxNumberOfSeededTorrents() {
String oldPropertyName = "torrent.max.seeded.number";
if (!"".equals(TeamCityProperties.getProperty(oldPropertyName))) {
return TeamCityProperties.getInteger(oldPropertyName, DEFAULT_MAX_NUMBER_OF_SEEDED_TORRENTS);
}
return TeamCityProperties.getInteger(MAX_NUMBER_OF_SEEDED_TORRENTS, DEFAULT_MAX_NUMBER_OF_SEEDED_TORRENTS);
}
示例13: getFileSizeThresholdBytes
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
@Override
public long getFileSizeThresholdBytes() {
boolean newValueNotExist = "".equals(TeamCityProperties.getProperty(FILE_SIZE_THRESHOLD));
if (newValueNotExist) {
String oldPropertyName = "torrent.file.size.threshold.mb";
return TeamCityProperties.getInteger(oldPropertyName, 10);
}
return getFileSizeThreshold();
}
示例14: changesDetected
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
public boolean changesDetected() {
for (String s : myStoredProperties.keySet()) {
if (!StringUtil.areEqual(myStoredProperties.get(s), TeamCityProperties.getProperty(s)))
return true;
}
return false;
}
示例15: resetChanged
import jetbrains.buildServer.serverSide.TeamCityProperties; //导入依赖的package包/类
public void resetChanged() {
myStoredProperties.put(TRACKER_ENABLED, TeamCityProperties.getProperty(TRACKER_ENABLED));
myStoredProperties.put(OWN_ADDRESS, TeamCityProperties.getProperty(OWN_ADDRESS));
myStoredProperties.put(FILE_SIZE_THRESHOLD, TeamCityProperties.getProperty(FILE_SIZE_THRESHOLD));
myStoredProperties.put(ANNOUNCE_INTERVAL, TeamCityProperties.getProperty(ANNOUNCE_INTERVAL));
myStoredProperties.put(TRACKER_TORRENT_EXPIRE_TIMEOUT, TeamCityProperties.getProperty(TRACKER_TORRENT_EXPIRE_TIMEOUT));
myStoredProperties.put(MAX_NUMBER_OF_SEEDED_TORRENTS, TeamCityProperties.getProperty(MAX_NUMBER_OF_SEEDED_TORRENTS));
myStoredProperties.put(TRACKER_DEDICATED_PORT, TeamCityProperties.getProperty(TRACKER_DEDICATED_PORT));
myStoredProperties.put(RECEIVE_BUFFER_SIZE, TeamCityProperties.getProperty(RECEIVE_BUFFER_SIZE));
myStoredProperties.put(SEND_BUFFER_SIZE, TeamCityProperties.getProperty(SEND_BUFFER_SIZE));
}