@@ -77,7 +77,7 @@ private static final String toReplacementString(String key) {
77
77
private final ServerConfiguration serverClone ;
78
78
private final JdbcDatabaseContainer <?> databaseCont ;
79
79
private final DatabaseContainerType databaseType ;
80
- private final boolean isModifiable ;
80
+
81
81
82
82
//Optional fields
83
83
private boolean useGeneric = true ;
@@ -89,6 +89,7 @@ private static final String toReplacementString(String key) {
89
89
//Optional updates
90
90
private Map <String , Fileset > libraries = Collections .emptyMap ();
91
91
private Set <JavaPermission > permissions = Collections .emptySet ();
92
+ private boolean isModifiable = false ;
92
93
93
94
///// Constructor /////
94
95
private DatabaseContainerUtil (LibertyServer serv , JdbcDatabaseContainer <?> cont ) throws Exception {
@@ -133,7 +134,7 @@ private DatabaseContainerUtil(LibertyServer serv, JdbcDatabaseContainer<?> cont)
133
134
//TODO what about authData elements inside a <databaseStore> element?
134
135
135
136
//If there is nothing to modify, this is not modifiable
136
- this .isModifiable = !this .datasources .isEmpty () || !this .authDatas .isEmpty ();
137
+ this .isModifiable | = !this .datasources .isEmpty () || !this .authDatas .isEmpty ();
137
138
}
138
139
139
140
///// Builder /////
@@ -145,9 +146,7 @@ private DatabaseContainerUtil(LibertyServer serv, JdbcDatabaseContainer<?> cont)
145
146
*/
146
147
public static DatabaseContainerUtil build (LibertyServer server , JdbcDatabaseContainer <?> cont ) {
147
148
try {
148
- DatabaseContainerUtil instance = new DatabaseContainerUtil (server , cont );
149
- Log .info (c , "build" , instance .toString ());
150
- return instance ;
149
+ return new DatabaseContainerUtil (server , cont );
151
150
} catch (Exception e ) {
152
151
throw new RuntimeException ("Failure while building database container util" , e );
153
152
}
@@ -184,6 +183,8 @@ public DatabaseContainerUtil withDriverReplacement() {
184
183
this .permissions = serverClone .getJavaPermissions ().stream ()
185
184
.filter (p -> p .getCodeBase ().contains (toReplacementString (DRIVER_KEY )))
186
185
.collect (Collectors .toSet ());
186
+
187
+ this .isModifiable |= !this .libraries .isEmpty () || !this .permissions .isEmpty ();
187
188
188
189
return this ;
189
190
}
@@ -497,8 +498,11 @@ private Set<AuthData> findAuthDataLocations(DataSource ds) {
497
498
public String toString () {
498
499
return "DatabaseContainerUtil"
499
500
+ System .lineSeparator () + "[server=" + server .getServerName () + ", databaseType=" + databaseType + ", isModifiable=" + isModifiable
500
- + System .lineSeparator () + "datasources=" + datasources .stream ().map (ds -> getElementId (ds )).collect (Collectors .toList ())
501
- + System .lineSeparator () + "authDatas=" + authDatas .stream ().map (ad -> getElementId (ad )).collect (Collectors .toList ()) + "]" ;
501
+ + System .lineSeparator () + "\t datasources=" + datasources .stream ().map (ds -> getElementId (ds )).collect (Collectors .toList ())
502
+ + System .lineSeparator () + "\t authDatas=" + authDatas .stream ().map (ad -> getElementId (ad )).collect (Collectors .toList ())
503
+ + System .lineSeparator () + "\t libraries=" + libraries .keySet ()
504
+ + System .lineSeparator () + "\t permissions=" + permissions .stream ().map (ps -> getElementId (ps )).collect (Collectors .toList ())
505
+ + System .lineSeparator () + "]" ;
502
506
}
503
507
504
508
0 commit comments