1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.aws.s3;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.common.aws.s3.monitor.BaseCase;
20
21 public class KualiMavenBucketBaseCase implements BaseCase {
22
23 String delimiter;
24 String token;
25
26 public boolean isBaseCase(String prefix) {
27 boolean baseCase1 = endsWithVersionNumber(prefix, delimiter);
28 boolean baseCase2 = endsWithToken(prefix, delimiter, token);
29 return baseCase1 || baseCase2;
30 }
31
32 public boolean endsWithVersionNumber(String prefix, String delimiter) {
33 String[] tokens = prefix.split(delimiter);
34 String lastToken = tokens[tokens.length - 1];
35 String firstChar = lastToken.substring(0, 1);
36 return StringUtils.isNumeric(firstChar);
37 }
38
39 public boolean endsWithToken(String prefix, String delimiter, String token) {
40 return prefix.endsWith(delimiter + token + delimiter);
41 }
42
43 public String getDelimiter() {
44 return delimiter;
45 }
46
47 public void setDelimiter(String delimiter) {
48 this.delimiter = delimiter;
49 }
50
51 public String getToken() {
52 return token;
53 }
54
55 public void setToken(String token) {
56 this.token = token;
57 }
58
59 }