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;
}
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;
}
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);
}
}
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();
}
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();
}
Aggregations