use of org.commonjava.indy.model.core.AbstractRepository in project indy by Commonjava.
the class CassandraStoreDataManager method toExtra.
private Map<String, String> toExtra(ArtifactStore store) {
Map<String, String> extras = new HashMap<>();
if (store instanceof AbstractRepository) {
AbstractRepository repository = (AbstractRepository) store;
putValueIntoExtra(CassandraStoreUtil.ALLOW_SNAPSHOTS, repository.isAllowSnapshots(), extras);
putValueIntoExtra(CassandraStoreUtil.ALLOW_RELEASES, repository.isAllowReleases(), extras);
}
if (store instanceof HostedRepository) {
HostedRepository hostedRepository = (HostedRepository) store;
putValueIntoExtra(CassandraStoreUtil.STORAGE, hostedRepository.getStorage(), extras);
putValueIntoExtra(CassandraStoreUtil.READONLY, hostedRepository.isReadonly(), extras);
putValueIntoExtra(CassandraStoreUtil.SNAPSHOT_TIMEOUT_SECONDS, hostedRepository.getSnapshotTimeoutSeconds(), extras);
}
if (store instanceof RemoteRepository) {
RemoteRepository remoteRepository = (RemoteRepository) store;
putValueIntoExtra(CassandraStoreUtil.URL, remoteRepository.getUrl(), extras);
putValueIntoExtra(CassandraStoreUtil.HOST, remoteRepository.getHost(), extras);
putValueIntoExtra(CassandraStoreUtil.PORT, remoteRepository.getPort(), extras);
putValueIntoExtra(CassandraStoreUtil.USER, remoteRepository.getUser(), extras);
putValueIntoExtra(CassandraStoreUtil.PASSWORD, remoteRepository.getPassword(), extras);
putValueIntoExtra(CassandraStoreUtil.PROXY_HOST, remoteRepository.getProxyHost(), extras);
putValueIntoExtra(CassandraStoreUtil.PROXY_PORT, remoteRepository.getProxyPort(), extras);
putValueIntoExtra(CassandraStoreUtil.PROXY_USER, remoteRepository.getProxyUser(), extras);
putValueIntoExtra(CassandraStoreUtil.PROXY_PASSWORD, remoteRepository.getProxyPassword(), extras);
putValueIntoExtra(CassandraStoreUtil.KEY_CERT_PEM, remoteRepository.getKeyCertPem(), extras);
putValueIntoExtra(CassandraStoreUtil.KEY_PASSWORD, remoteRepository.getKeyPassword(), extras);
putValueIntoExtra(CassandraStoreUtil.SERVER_CERT_PEM, remoteRepository.getServerCertPem(), extras);
putValueIntoExtra(CassandraStoreUtil.PREFETCH_RESCAN_TIMESTAMP, remoteRepository.getPrefetchRescanTimestamp(), extras);
putValueIntoExtra(CassandraStoreUtil.METADATA_TIMEOUT_SECONDS, remoteRepository.getMetadataTimeoutSeconds(), extras);
putValueIntoExtra(CassandraStoreUtil.CACHE_TIMEOUT_SECONDS, remoteRepository.getCacheTimeoutSeconds(), extras);
putValueIntoExtra(CassandraStoreUtil.TIMEOUT_SECONDS, remoteRepository.getTimeoutSeconds(), extras);
putValueIntoExtra(CassandraStoreUtil.MAX_CONNECTIONS, remoteRepository.getMaxConnections(), extras);
putValueIntoExtra(CassandraStoreUtil.NFC_TIMEOUT_SECONDS, remoteRepository.getNfcTimeoutSeconds(), extras);
putValueIntoExtra(CassandraStoreUtil.PASS_THROUGH, remoteRepository.isPassthrough(), extras);
putValueIntoExtra(CassandraStoreUtil.PREFETCH_RESCAN, remoteRepository.isPrefetchRescan(), extras);
putValueIntoExtra(CassandraStoreUtil.IGNORE_HOST_NAME_VERIFICATION, remoteRepository.isIgnoreHostnameVerification(), extras);
}
if (store instanceof Group) {
Group group = (Group) store;
putValueIntoExtra(CassandraStoreUtil.CONSTITUENTS, group.getConstituents(), extras);
putValueIntoExtra(CassandraStoreUtil.PREPEND_CONSTITUENT, group.isPrependConstituent(), extras);
}
return extras;
}
use of org.commonjava.indy.model.core.AbstractRepository in project indy by Commonjava.
the class DefaultContentManager method checkListingMask.
private boolean checkListingMask(final ArtifactStore store, final String path) {
if (!(store instanceof AbstractRepository)) {
return true;
}
AbstractRepository repo = (AbstractRepository) store;
Set<String> maskPatterns = repo.getPathMaskPatterns();
logger.debug("Checking mask in: {}, type: {}, patterns: {}", repo.getName(), repo.getKey().getType(), maskPatterns);
if (maskPatterns == null || maskPatterns.isEmpty()) {
logger.debug("Checking mask in: {}, - NO PATTERNS", repo.getName());
return true;
}
for (String pattern : maskPatterns) {
if (isRegexPattern(pattern)) {
// present
return true;
}
}
for (String pattern : maskPatterns) {
if (path.startsWith(pattern) || pattern.startsWith(path)) {
logger.debug("Checking mask in: {}, pattern: {} - MATCH", repo.getName(), pattern);
return true;
}
}
return false;
}
use of org.commonjava.indy.model.core.AbstractRepository in project indy by Commonjava.
the class DefaultContentManager method checkMask.
private boolean checkMask(final ArtifactStore store, final String path) {
if (!(store instanceof AbstractRepository)) {
return true;
}
AbstractRepository repo = (AbstractRepository) store;
Set<String> maskPatterns = repo.getPathMaskPatterns();
logger.debug("Checking mask in: {}, type: {}, patterns: {}", repo.getName(), repo.getKey().getType(), maskPatterns);
if (maskPatterns == null || maskPatterns.isEmpty()) {
logger.debug("Checking mask in: {}, - NO PATTERNS", repo.getName());
return true;
}
for (String pattern : maskPatterns) {
// adding allPlaintext to the condition to reduce the number of isRegexPattern() calls
if (isRegexPattern(pattern)) {
if (path.matches(pattern)) {
return true;
}
} else if (path.startsWith(pattern)) {
logger.debug("Checking mask in: {}, pattern: {} - MATCH", repo.getName(), pattern);
return true;
}
}
return false;
}
Aggregations