Skip to content

Commit acaef2b

Browse files
authored
Enforce checkstyle format (#37)
1 parent 0c54839 commit acaef2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+656
-600
lines changed

build-tools/src/main/resources/weblogic-image-tool/checkstyle/customized_google_checks.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
<property name="eachLine" value="true"/>
2828
</module>
2929

30+
<module name="RegexpHeader">
31+
<property name="headerFile" value="build-tools/src/main/resources/weblogic-image-tool/checkstyle/java.header"/>
32+
<property name="fileExtensions" value="java"/>
33+
</module>
34+
3035
<module name="TreeWalker">
3136
<module name="OuterTypeFilename"/>
3237
<module name="IllegalTokenText">
@@ -193,7 +198,7 @@
193198
<module name="CustomImportOrder">
194199
<property name="sortImportsInGroupAlphabetically" value="true"/>
195200
<property name="separateLineBetweenGroups" value="true"/>
196-
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
201+
<property name="customImportOrderRules" value="STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###STATIC"/>
197202
</module>
198203
<module name="MethodParamPad"/>
199204
<module name="NoWhitespaceBefore">
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
^// Copyright (\d\d\d\d, )+Oracle Corporation and\/or its affiliates\. All rights reserved\.$
2+
^// Licensed under the Universal Permissive License v 1\.0 as shown at http://oss\.oracle\.com/licenses/upl\.$

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/FileResolver.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
53

64
package com.oracle.weblogic.imagetool.api;
75

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/meta/CacheStore.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
53

64
package com.oracle.weblogic.imagetool.api.meta;
75

@@ -52,15 +50,15 @@ public interface CacheStore {
5250
boolean addToCache(String key, String value);
5351

5452
/**
55-
* Delete an entry from the cache
53+
* Delete an entry from the cache.
5654
*
5755
* @param key key corresponding to an entry in the cache
5856
* @return value or null
5957
*/
6058
String deleteFromCache(String key);
6159

6260
/**
63-
* Returns a map of current items in the cache
61+
* Returns a map of current items in the cache.
6462
*
6563
* @return map of current items
6664
*/

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/model/AbstractFile.java

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
5-
package com.oracle.weblogic.imagetool.api.model;
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
63

7-
import com.oracle.weblogic.imagetool.api.FileResolver;
8-
import com.oracle.weblogic.imagetool.api.meta.CacheStore;
4+
package com.oracle.weblogic.imagetool.api.model;
95

106
import java.nio.file.Files;
117
import java.nio.file.Paths;
128
import java.util.logging.Logger;
139

10+
import com.oracle.weblogic.imagetool.api.FileResolver;
11+
import com.oracle.weblogic.imagetool.api.meta.CacheStore;
12+
1413
/**
15-
* Base class to represent either an installer or a patch file
14+
* Base class to represent either an installer or a patch file.
1615
*/
1716
public abstract class AbstractFile implements FileResolver {
1817

18+
private static final Logger logger = Logger.getLogger(AbstractFile.class.getName());
19+
1920
private String key;
2021
protected CachePolicy cachePolicy;
2122
protected String userId;
2223
protected String password;
23-
private final static Logger logger = Logger.getLogger(AbstractFile.class.getName());
2424

25+
26+
/**
27+
* Construct a new abstract file.
28+
*
29+
* @param id cache ID
30+
* @param version applicable product version.
31+
* @param cachePolicy applicable cache policy.
32+
* @param userId userid to use for ARU.
33+
* @param password password to use for ARU.
34+
*/
2535
public AbstractFile(String id, String version, CachePolicy cachePolicy, String userId, String password) {
2636
this.key = generateKey(id, version);
2737
this.cachePolicy = cachePolicy;
@@ -38,11 +48,11 @@ public String generateKey(String id, String version) {
3848
//
3949
String mykey = id;
4050
if (id == null) { // should never happens
41-
mykey = id + CacheStore.CACHE_KEY_SEPARATOR + version;
51+
mykey = id + CacheStore.CACHE_KEY_SEPARATOR + version;
4252
} else if (id.indexOf('_') < 0) {
43-
if (version != null) {
44-
mykey = mykey + CacheStore.CACHE_KEY_SEPARATOR + version;
45-
}
53+
if (version != null) {
54+
mykey = mykey + CacheStore.CACHE_KEY_SEPARATOR + version;
55+
}
4656
}
4757

4858
logger.finest("AbstractFile generating key returns " + mykey);

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/model/CachePolicy.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
53

64
package com.oracle.weblogic.imagetool.api.model;
75

86
/**
9-
* @Deprecated
10-
* This is subject to removal and there is no need to use it
11-
* The logic is changed to use the presence of userId and password to
12-
* determine whether to access online if the item is not in the cache.
13-
* It allows the cache is just a store and nothing more
14-
*
15-
* first - Use cache entries and download artifacts if required
7+
* Cache policy types.
8+
* <p/>
169
* always - Use only cache entries and never download artifacts
17-
* never - Ignore cache entries and always download artifacts
10+
*
11+
* @deprecated
12+
* This is subject to removal and there is no need to use it
13+
* The logic is changed to use the presence of userId and password to
14+
* determine whether to access online if the item is not in the cache.
15+
* It allows the cache is just a store and nothing more
1816
*/
17+
@Deprecated
1918
public enum CachePolicy {
2019
ALWAYS("always");
2120

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
53

64
package com.oracle.weblogic.imagetool.api.model;
75

@@ -10,46 +8,62 @@ public class CommandResponse {
108
private int status;
119
private String message;
1210
private Object result;
13-
private boolean success = true;
1411

12+
/**
13+
* For use with PicoCLI to return the response to the command line.
14+
* @param status CLI status, 0 if normal.
15+
* @param message message to the user.
16+
*/
1517
public CommandResponse(int status, String message) {
1618
this.status = status;
1719
this.message = message;
18-
19-
if (status != 0) {
20-
this.success = false;
21-
}
2220
}
2321

22+
/**
23+
* For use with PicoCLI to return the response to the command line.
24+
* @param status CLI status, 0 if normal.
25+
* @param message message to the user.
26+
* @param result more details that help the user understand the message.
27+
*/
2428
public CommandResponse(int status, String message, Object result) {
2529
this.status = status;
2630
this.message = message;
2731
this.result = result;
28-
29-
if (status != 0) {
30-
this.success = false;
31-
}
3232
}
3333

34+
/**
35+
* Get the status code in this response.
36+
* @return the status
37+
*/
3438
public int getStatus() {
3539
return status;
3640
}
3741

42+
/**
43+
* Get the message in this response.
44+
* @return message to the user
45+
*/
3846
public String getMessage() {
3947
return message;
4048
}
4149

50+
51+
/**
52+
* Get the result in this response.
53+
* @param <T> result type.
54+
* @return the result object.
55+
*/
4256
@SuppressWarnings("unchecked")
4357
public <T> T getResult() {
4458
return (T) result;
4559
}
4660

61+
/**
62+
* True if the status was 0.
63+
* @return true if the status was 0.
64+
*/
4765
public boolean isSuccess() {
48-
return success;
49-
}
50-
51-
public void setSuccess(boolean success) {
52-
this.success = success;
66+
return status == 0;
5367
}
5468

5569
}

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/model/DomainType.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
53

64
package com.oracle.weblogic.imagetool.api.model;
75

@@ -19,6 +17,11 @@ public enum DomainType {
1917
this.value = value;
2018
}
2119

20+
/**
21+
* Create the Domain type Enum from the String value.
22+
* @param value the domain type string, ignoring case.
23+
* @return the enum domain type.
24+
*/
2225
public static DomainType fromValue(String value) {
2326
for (DomainType eachType : DomainType.values()) {
2427
if (eachType.value.equalsIgnoreCase(value)) {

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/model/InstallerType.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
53

64
package com.oracle.weblogic.imagetool.api.model;
75

8-
import com.oracle.weblogic.imagetool.util.Constants;
9-
106
import java.util.ArrayList;
117
import java.util.List;
128

9+
import com.oracle.weblogic.imagetool.util.Constants;
10+
1311
/**
14-
* An enum to represent type of installer
12+
* An enum to represent installer type.
1513
*/
1614
public enum InstallerType {
1715

@@ -31,6 +29,11 @@ public String toString() {
3129
return value;
3230
}
3331

32+
/**
33+
* Get the Dockerfile build argument for this installer type.
34+
* @param location the location of the installer.
35+
* @return --build-arg and this installer type argument and location.
36+
*/
3437
public List<String> getBuildArg(String location) {
3538
List<String> retVal = new ArrayList<>(2);
3639
retVal.add(Constants.BUILD_ARG);
@@ -44,6 +47,11 @@ public List<String> getBuildArg(String location) {
4447
return retVal;
4548
}
4649

50+
/**
51+
* Create the installer type Enum from the String value.
52+
* @param value the installer type string, ignoring case.
53+
* @return the enum installer type.
54+
*/
4755
public static InstallerType fromValue(String value) {
4856
for (InstallerType eachType : InstallerType.values()) {
4957
if (eachType.value.equalsIgnoreCase(value)) {

imagetool/src/main/java/com/oracle/weblogic/imagetool/api/model/WLSInstallerType.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
3-
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4-
*/
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
53

64
package com.oracle.weblogic.imagetool.api.model;
75

@@ -23,6 +21,11 @@ public String toString() {
2321
return value;
2422
}
2523

24+
/**
25+
* Create the WLS installer type Enum from the String value.
26+
* @param value the installer type string, ignoring case.
27+
* @return the enum installer type.
28+
*/
2629
public static WLSInstallerType fromValue(String value) {
2730
for (WLSInstallerType eachType : WLSInstallerType.values()) {
2831
if (eachType.value.equalsIgnoreCase(value)) {

0 commit comments

Comments
 (0)