MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / init

Method init

samples/JGroups/src/S3_PING.java:56–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55
56 public void init() throws Exception {
57 super.init();
58 if(access_key == null || secret_access_key == null)
59 throw new IllegalArgumentException("access_key and secret_access_key must be non-null");
60
61 conn=new AWSAuthConnection(access_key, secret_access_key);
62
63 if(prefix != null && prefix.length() > 0) {
64 ListAllMyBucketsResponse bucket_list=conn.listAllMyBuckets(null);
65 List buckets=bucket_list.entries;
66 if(buckets != null) {
67 boolean found=false;
68 for(Object tmp: buckets) {
69 if(tmp instanceof Bucket) {
70 Bucket bucket=(Bucket)tmp;
71 if(bucket.name.startsWith(prefix)) {
72 location=bucket.name;
73 found=true;
74 }
75 }
76 }
77 if(!found) {
78 location=prefix + "-" + java.util.UUID.randomUUID().toString();
79 }
80 }
81 }
82
83
84 if(!conn.checkBucketExists(location)) {
85 conn.createBucket(location, AWSAuthConnection.LOCATION_DEFAULT, null).connection.getResponseMessage();
86 }
87
88 Runtime.getRuntime().addShutdownHook(new Thread() {
89 public void run() {
90 remove(group_addr, local_addr);
91 }
92 });
93 }
94
95 protected void createRootDir() {
96 ; // do *not* create root file system (don't remove !)

Callers 3

encodeMethod · 0.45
cFunction · 0.45
jstree.min.jsFile · 0.45

Calls 5

lengthMethod · 0.80
listAllMyBucketsMethod · 0.45
toStringMethod · 0.45
checkBucketExistsMethod · 0.45
createBucketMethod · 0.45

Tested by

no test coverage detected