// Path: aliyun-oss/src/main/java/org/jclouds/aliyun/oss/OSSApi.java
// public interface OSSApi extends Closeable {
// 
//    static final String DEFAULT_REGION = "oss-cn-hangzhou";
// 
//    OSS getOSSClient(String region);
// 
//    Set<String> getAvailableRegions();
// }
// 
// Path: aliyun-oss/src/main/java/org/jclouds/aliyun/oss/blobstore/functions/RegionToLocation.java
// public class RegionToLocation implements Function<String, Location> {
// 
//    @Override
//    public Location apply(String input) {
//       LocationBuilder builder = new LocationBuilder();
//       builder.scope(LocationScope.REGION);
//       builder.id(input);
//       builder.description(input);
//       return builder.build();
//    }
// }


import static com.google.common.collect.Iterables.transform;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.aliyun.oss.OSSApi;
import org.jclouds.aliyun.oss.blobstore.functions.RegionToLocation;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobAccess;
import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.ContainerAccess;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.blobstore.domain.internal.BlobMetadataImpl;
import org.jclouds.blobstore.domain.internal.PageSetImpl;
import org.jclouds.blobstore.domain.internal.StorageMetadataImpl;
import org.jclouds.blobstore.internal.BaseBlobStore;
import org.jclouds.blobstore.options.CreateContainerOptions;
import org.jclouds.blobstore.options.GetOptions;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.options.PutOptions;
import org.jclouds.blobstore.reference.BlobStoreConstants;
import org.jclouds.blobstore.util.BlobUtils;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope;
import org.jclouds.io.ContentMetadata;
import org.jclouds.io.ContentMetadataBuilder;
import org.jclouds.location.suppliers.LocationsSupplier;
import org.jclouds.logging.Logger;
import com.aliyun.oss.OSS;
import com.aliyun.oss.model.AccessControlList;
import com.aliyun.oss.model.Bucket;
import com.aliyun.oss.model.CannedAccessControlList;
import com.aliyun.oss.model.CreateBucketRequest;
import com.aliyun.oss.model.DeleteObjectsRequest;
import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.Grant;
import com.aliyun.oss.model.GroupGrantee;
import com.aliyun.oss.model.ListObjectsRequest;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.OSSObjectSummary;
import com.aliyun.oss.model.ObjectAcl;
import com.aliyun.oss.model.ObjectListing;
import com.aliyun.oss.model.ObjectPermission;
import com.aliyun.oss.model.PutObjectResult;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
package org.jclouds.aliyun.oss.blobstore;






@Singleton
public class OSSBlobStore extends BaseBlobStore {

   @Resource
   @Named(BlobStoreConstants.BLOBSTORE_LOGGER)
   private Logger logger = Logger.NULL;

   protected final OSSApi api;
   protected final Map<ContainerAccess, CannedAccessControlList> bucketAccesses;
   protected final Map<BlobAccess, CannedAccessControlList> blobAccesses;

   @Inject
   protected OSSBlobStore(
         OSSApi api,
         BlobStoreContext context,
         BlobUtils blobUtils,
         Supplier<Location> defaultLocation,
         LocationsSupplier locations,
         Supplier<Map<ContainerAccess, CannedAccessControlList>> bucketAccesses,
         Supplier<Map<BlobAccess, CannedAccessControlList>> blobAccesses) {
      super(context, blobUtils, defaultLocation, locations);
      this.api = api;
      this.bucketAccesses = bucketAccesses.get();
      this.blobAccesses = blobAccesses.get();
   }

   @Override
   public Set<? extends Location> listAssignableLocations() {
      return ImmutableSet.<Location> builder()
// Path: aliyun-oss/src/main/java/org/jclouds/aliyun/oss/OSSApi.java
// public interface OSSApi extends Closeable {
// 
//    static final String DEFAULT_REGION = "oss-cn-hangzhou";
// 
//    OSS getOSSClient(String region);
// 
//    Set<String> getAvailableRegions();
// }
// 
// Path: aliyun-oss/src/main/java/org/jclouds/aliyun/oss/blobstore/functions/RegionToLocation.java
// public class RegionToLocation implements Function<String, Location> {
// 
//    @Override
//    public Location apply(String input) {
//       LocationBuilder builder = new LocationBuilder();
//       builder.scope(LocationScope.REGION);
//       builder.id(input);
//       builder.description(input);
//       return builder.build();
//    }
// }


// Path: aliyun-oss/src/main/java/org/jclouds/aliyun/oss/blobstore/OSSBlobStore.java
import static com.google.common.collect.Iterables.transform;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.aliyun.oss.OSSApi;
import org.jclouds.aliyun.oss.blobstore.functions.RegionToLocation;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobAccess;
import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.domain.ContainerAccess;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.blobstore.domain.internal.BlobMetadataImpl;
import org.jclouds.blobstore.domain.internal.PageSetImpl;
import org.jclouds.blobstore.domain.internal.StorageMetadataImpl;
import org.jclouds.blobstore.internal.BaseBlobStore;
import org.jclouds.blobstore.options.CreateContainerOptions;
import org.jclouds.blobstore.options.GetOptions;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.options.PutOptions;
import org.jclouds.blobstore.reference.BlobStoreConstants;
import org.jclouds.blobstore.util.BlobUtils;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope;
import org.jclouds.io.ContentMetadata;
import org.jclouds.io.ContentMetadataBuilder;
import org.jclouds.location.suppliers.LocationsSupplier;
import org.jclouds.logging.Logger;
import com.aliyun.oss.OSS;
import com.aliyun.oss.model.AccessControlList;
import com.aliyun.oss.model.Bucket;
import com.aliyun.oss.model.CannedAccessControlList;
import com.aliyun.oss.model.CreateBucketRequest;
import com.aliyun.oss.model.DeleteObjectsRequest;
import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.Grant;
import com.aliyun.oss.model.GroupGrantee;
import com.aliyun.oss.model.ListObjectsRequest;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.OSSObjectSummary;
import com.aliyun.oss.model.ObjectAcl;
import com.aliyun.oss.model.ObjectListing;
import com.aliyun.oss.model.ObjectPermission;
import com.aliyun.oss.model.PutObjectResult;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;

package org.jclouds.aliyun.oss.blobstore;






@Singleton
public class OSSBlobStore extends BaseBlobStore {

   @Resource
   @Named(BlobStoreConstants.BLOBSTORE_LOGGER)
   private Logger logger = Logger.NULL;

   protected final OSSApi api;
   protected final Map<ContainerAccess, CannedAccessControlList> bucketAccesses;
   protected final Map<BlobAccess, CannedAccessControlList> blobAccesses;

   @Inject
   protected OSSBlobStore(
         OSSApi api,
         BlobStoreContext context,
         BlobUtils blobUtils,
         Supplier<Location> defaultLocation,
         LocationsSupplier locations,
         Supplier<Map<ContainerAccess, CannedAccessControlList>> bucketAccesses,
         Supplier<Map<BlobAccess, CannedAccessControlList>> blobAccesses) {
      super(context, blobUtils, defaultLocation, locations);
      this.api = api;
      this.bucketAccesses = bucketAccesses.get();
      this.blobAccesses = blobAccesses.get();
   }

   @Override
   public Set<? extends Location> listAssignableLocations() {
      return ImmutableSet.<Location> builder()
            .addAll(transform(api.getAvailableRegions(), new RegionToLocation()))