Search in sources :

Example 61 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class AffectedStoreRecordTest method recordUploadsSorted.

@Test
public void recordUploadsSorted() throws Exception {
    final StoreType type = StoreType.group;
    final String name = "test-group";
    final AffectedStoreRecord record = new AffectedStoreRecord(new StoreKey(type, name));
    record.add("/path/two", StoreEffect.UPLOAD);
    record.add("/path/one", StoreEffect.UPLOAD);
    assertThat(record.getUploadedPaths().iterator().next(), equalTo("/path/one"));
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 62 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class AffectedStoreRecordTest method dontRecordNullDownload.

@Test
public void dontRecordNullDownload() throws Exception {
    final StoreType type = StoreType.group;
    final String name = "test-group";
    final AffectedStoreRecord record = new AffectedStoreRecord(new StoreKey(type, name));
    record.add(null, StoreEffect.DOWNLOAD);
    assertThat(record.getDownloadedPaths(), nullValue());
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 63 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class TrackedContentEntryV1 method readExternal.

@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    trackingKey = (TrackingKey) in.readObject();
    final String storeKeyName = (String) in.readObject();
    final StoreType storeType = StoreType.get((String) in.readObject());
    storeKey = new StoreKey(storeType, storeKeyName);
    final String accessChannelStr = (String) in.readObject();
    accessChannel = "".equals(accessChannelStr) ? null : AccessChannel.valueOf(accessChannelStr);
    final String pathStr = (String) in.readObject();
    path = "".equals(pathStr) ? null : pathStr;
    final String originUrlStr = (String) in.readObject();
    originUrl = "".equals(originUrlStr) ? null : originUrlStr;
    final String effectStr = (String) in.readObject();
    effect = "".equals(effectStr) ? null : StoreEffect.valueOf(effectStr);
    final String md5Str = (String) in.readObject();
    md5 = "".equals(md5Str) ? null : md5Str;
    final String sha1Str = (String) in.readObject();
    sha1 = "".equals(sha1Str) ? null : sha1Str;
    final String sha256Str = (String) in.readObject();
    sha256 = "".equals(sha256Str) ? null : sha256Str;
    size = (Long) in.readObject();
    index = in.readLong();
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) StoreKey(org.commonjava.indy.model.core.StoreKey)

Example 64 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class ScheduleKey method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    final String storeKeyName = (String) in.readObject();
    final StoreType storeType = StoreType.get((String) in.readObject());
    final String packageType = (String) in.readObject();
    storeKey = new StoreKey(packageType, storeType, storeKeyName);
    final String typeStr = (String) in.readObject();
    type = "".equals(typeStr) ? null : typeStr;
    final String nameStr = (String) in.readObject();
    name = "".equals(nameStr) ? null : nameStr;
    groupName = ScheduleManagerUtils.groupName(storeKey, type);
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) StoreKey(org.commonjava.indy.model.core.StoreKey)

Example 65 with StoreType

use of org.commonjava.indy.model.core.StoreType in project indy by Commonjava.

the class ScheduleDBManager method storeKeyFrom.

public static StoreKey storeKeyFrom(final String group) {
    final String[] parts = group.split("#");
    if (parts.length > 1) {
        final Logger logger = LoggerFactory.getLogger(ScheduleDBManager.class);
        StoreKey storeKey = null;
        try {
            storeKey = StoreKey.fromString(parts[0]);
        } catch (IllegalArgumentException e) {
            logger.warn("Not a store key for string: {}", parts[0]);
        }
        // TODO this part of code may be obsolete, will need further check then remove
        if (storeKey == null) {
            logger.info("Not a store key for string: {}, will parse as store type", parts[0]);
            final StoreType type = StoreType.get(parts[0]);
            if (type != null) {
                storeKey = new StoreKey(MavenPackageTypeDescriptor.MAVEN_PKG_KEY, type, parts[1]);
            }
        }
        return storeKey;
    }
    return null;
}
Also used : StoreType(org.commonjava.indy.model.core.StoreType) Logger(org.slf4j.Logger) StoreKey(org.commonjava.indy.model.core.StoreKey)

Aggregations

StoreType (org.commonjava.indy.model.core.StoreType)78 StoreKey (org.commonjava.indy.model.core.StoreKey)64 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)36 Response (javax.ws.rs.core.Response)34 ApiOperation (io.swagger.annotations.ApiOperation)27 ApiResponse (io.swagger.annotations.ApiResponse)27 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)27 Path (javax.ws.rs.Path)25 ApiResponses (io.swagger.annotations.ApiResponses)24 IOException (java.io.IOException)20 GET (javax.ws.rs.GET)15 Produces (javax.ws.rs.Produces)15 Logger (org.slf4j.Logger)14 Transfer (org.commonjava.maven.galley.model.Transfer)13 List (java.util.List)12 Inject (javax.inject.Inject)12 DELETE (javax.ws.rs.DELETE)12 IndyDataException (org.commonjava.indy.data.IndyDataException)12 JoinString (org.commonjava.atlas.maven.ident.util.JoinString)11 LoggerFactory (org.slf4j.LoggerFactory)11