Search in sources :

Example 16 with com.amazonaws.services.s3.model

use of com.amazonaws.services.s3.model in project org.hl7.fhir.core by hapifhir.

the class TerminologyClientR2 method read.

@Override
public CanonicalResource read(String type, String id) {
    Class<Resource> t;
    try {
        // todo: do we have to deal with any resource renaming? Use cases are limited...
        t = (Class<Resource>) Class.forName("org.hl7.fhir.dstu2.model." + type);
    } catch (ClassNotFoundException e) {
        throw new FHIRException("Unable to fetch resources of type " + type + " in R2");
    }
    org.hl7.fhir.dstu2.model.Resource r2 = client.read(t, id);
    if (r2 == null) {
        throw new FHIRException("Unable to fetch resource " + Utilities.pathURL(getAddress(), type, id));
    }
    org.hl7.fhir.r5.model.Resource r5 = VersionConvertorFactory_10_50.convertResource(r2);
    if (r5 != null) {
        throw new FHIRException("Unable to convert resource " + Utilities.pathURL(getAddress(), type, id) + " to R5 (internal representation)");
    }
    if (!(r5 instanceof CanonicalResource)) {
        throw new FHIRException("Unable to convert resource " + Utilities.pathURL(getAddress(), type, id) + " to R5 canonical resource (internal representation)");
    }
    return (CanonicalResource) r5;
}
Also used : Resource(org.hl7.fhir.dstu2.model.Resource) Resource(org.hl7.fhir.dstu2.model.Resource) org.hl7.fhir.r5.model(org.hl7.fhir.r5.model) FHIRException(org.hl7.fhir.exceptions.FHIRException)

Example 17 with com.amazonaws.services.s3.model

use of com.amazonaws.services.s3.model in project MCCustomSkinLoader by xfl03.

the class CustomSkinAPI method toUserProfile.

@Override
public UserProfile toUserProfile(String root, String json, boolean local) {
    CustomSkinAPIProfile profile = CustomSkinLoader.GSON.fromJson(json, CustomSkinAPIProfile.class);
    UserProfile p = new UserProfile();
    if (StringUtils.isNotBlank(profile.skin)) {
        p.skinUrl = root + TEXTURES + profile.skin;
        if (local)
            p.skinUrl = HttpTextureUtil.getLocalFakeUrl(p.skinUrl);
    }
    if (StringUtils.isNotBlank(profile.cape)) {
        p.capeUrl = root + TEXTURES + profile.cape;
        if (local)
            p.capeUrl = HttpTextureUtil.getLocalFakeUrl(p.capeUrl);
    }
    if (StringUtils.isNotBlank(profile.elytra)) {
        p.elytraUrl = root + TEXTURES + profile.elytra;
        if (local)
            p.elytraUrl = HttpTextureUtil.getLocalFakeUrl(p.elytraUrl);
    }
    Map<String, String> textures = new LinkedHashMap<String, String>();
    if (profile.skins != null)
        textures.putAll(profile.skins);
    if (profile.textures != null)
        textures.putAll(profile.textures);
    if (textures.isEmpty())
        return p;
    boolean hasSkin = false;
    for (String model : textures.keySet()) {
        Model enumModel = ModelManager0.getEnumModel(model);
        if (enumModel == null || StringUtils.isEmpty(textures.get(model)))
            continue;
        if (ModelManager0.isSkin(enumModel))
            if (hasSkin)
                continue;
            else
                hasSkin = true;
        String url = root + TEXTURES + textures.get(model);
        if (local)
            url = HttpTextureUtil.getLocalFakeUrl(url);
        p.put(enumModel, url);
    }
    return p;
}
Also used : UserProfile(customskinloader.profile.UserProfile) Model(customskinloader.profile.ModelManager0.Model) LinkedHashMap(java.util.LinkedHashMap)

Example 18 with com.amazonaws.services.s3.model

use of com.amazonaws.services.s3.model in project geowebcache by GeoWebCache.

the class S3BlobStore method checkBucketPolicy.

/**
 * Checks a {@link com.amazonaws.services.s3.AmazonS3Client} by getting the policy out of the
 * bucket, as implemented by S3, Minio, but not, for example, by Cohesity.
 */
private void checkBucketPolicy(AmazonS3Client client, String bucketName) throws Exception {
    try {
        log.debug("Checking policy for bucket " + bucketName);
        BucketPolicy bucketPol = client.getBucketPolicy(bucketName);
        log.debug("Bucket " + bucketName + " policy: " + bucketPol.getPolicyText());
    } catch (AmazonServiceException se) {
        throw new StorageException("Server error getting bucket policy: " + se.getMessage(), se);
    }
}
Also used : BucketPolicy(com.amazonaws.services.s3.model.BucketPolicy) AmazonServiceException(com.amazonaws.AmazonServiceException) StorageException(org.geowebcache.storage.StorageException)

Example 19 with com.amazonaws.services.s3.model

use of com.amazonaws.services.s3.model in project theta by ftsrg.

the class Z3ModelTest method test.

@Test
public void test() {
    final Context context = new Context();
    final Solver solver = context.mkSimpleSolver();
    final BoolExpr a = context.mkBoolConst("a");
    final BoolExpr b = context.mkBoolConst("b");
    final BoolExpr expr = context.mkOr(a, b);
    solver.add(expr);
    solver.check();
    final Model model = solver.getModel();
    Assert.assertTrue(model.getConstInterp(a).isTrue());
    Assert.assertNull(model.getConstInterp(b));
    context.close();
}
Also used : Context(com.microsoft.z3.Context) BoolExpr(com.microsoft.z3.BoolExpr) Solver(com.microsoft.z3.Solver) Model(com.microsoft.z3.Model) Test(org.junit.Test)

Example 20 with com.amazonaws.services.s3.model

use of com.amazonaws.services.s3.model in project spring-cloud-aws by awspring.

the class AmazonS3ProxyFactory method createProxy.

/**
 * Factory-method to create a proxy using the {@link SimpleStorageRedirectInterceptor}
 * that supports redirects for buckets which are in a different region. This proxy
 * uses the amazonS3 parameter as a "prototype" and re-uses the credentials from the
 * passed in {@link AmazonS3} instance. Proxy implementations uses the
 * {@link AmazonS3ClientFactory} to create region specific clients, which are cached
 * by the implementation on a region basis to avoid unnecessary object creation.
 * @param amazonS3 Fully configured AmazonS3 client, the client can be an immutable
 * instance (created by the {@link com.amazonaws.services.s3.AmazonS3ClientBuilder})
 * as this proxy will not change the underlying implementation.
 * @return AOP-Proxy that intercepts all method calls using the
 * {@link SimpleStorageRedirectInterceptor}
 */
public static AmazonS3 createProxy(AmazonS3 amazonS3) {
    Assert.notNull(amazonS3, "AmazonS3 client must not be null");
    if (AopUtils.isAopProxy(amazonS3)) {
        Advised advised = (Advised) amazonS3;
        for (Advisor advisor : advised.getAdvisors()) {
            if (ClassUtils.isAssignableValue(SimpleStorageRedirectInterceptor.class, advisor.getAdvice())) {
                return amazonS3;
            }
        }
        try {
            advised.addAdvice(new SimpleStorageRedirectInterceptor((AmazonS3) advised.getTargetSource().getTarget()));
        } catch (Exception e) {
            throw new RuntimeException("Error adding advice for class amazonS3 instance", e);
        }
        return amazonS3;
    }
    ProxyFactory factory = new ProxyFactory(amazonS3);
    factory.setInterfaces(AmazonS3.class);
    factory.addAdvice(new SimpleStorageRedirectInterceptor(amazonS3));
    return (AmazonS3) factory.getProxy();
}
Also used : AmazonS3(com.amazonaws.services.s3.AmazonS3) Advised(org.springframework.aop.framework.Advised) ProxyFactory(org.springframework.aop.framework.ProxyFactory) Advisor(org.springframework.aop.Advisor) AmazonS3Exception(com.amazonaws.services.s3.model.AmazonS3Exception)

Aggregations

Test (org.junit.Test)49 Model (org.eclipse.xtext.valueconverter.bug250313.Model)30 Model (com.google.cloud.aiplatform.v1.Model)16 AutoMlClient (com.google.cloud.automl.v1.AutoMlClient)16 Model (com.google.cloud.automl.v1.Model)16 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)16 LocationName (com.google.cloud.aiplatform.v1.LocationName)14 PipelineServiceClient (com.google.cloud.aiplatform.v1.PipelineServiceClient)14 PipelineServiceSettings (com.google.cloud.aiplatform.v1.PipelineServiceSettings)14 TrainingPipeline (com.google.cloud.aiplatform.v1.TrainingPipeline)14 InputDataConfig (com.google.cloud.aiplatform.v1.InputDataConfig)13 ModelContainerSpec (com.google.cloud.aiplatform.v1.ModelContainerSpec)13 ByteArrayInputStream (java.io.ByteArrayInputStream)13 FilterSplit (com.google.cloud.aiplatform.v1.FilterSplit)11 FractionSplit (com.google.cloud.aiplatform.v1.FractionSplit)11 PredefinedSplit (com.google.cloud.aiplatform.v1.PredefinedSplit)11 TimestampSplit (com.google.cloud.aiplatform.v1.TimestampSplit)11 Status (com.google.rpc.Status)11 Model (com.microsoft.z3.Model)11 IOException (java.io.IOException)11