Skip to content

Commit 4b628fc

Browse files
committed
Remove uber-jar dependency
This allows better control over compile classpath Get rid of Commons Codec dependency Use JcrConstants from Jackrabbit only
1 parent 80e9de9 commit 4b628fc

File tree

9 files changed

+180
-49
lines changed

9 files changed

+180
-49
lines changed

accesscontroltool-bundle/pom.xml

+114-31
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<properties>
2727
<tomcat.el.version>10.0.27</tomcat.el.version>
28-
<oak.version>1.48.0</oak.version>
28+
<oak.testing.version>1.48.0</oak.testing.version>
2929
</properties>
3030

3131
<dependencies>
@@ -97,6 +97,116 @@
9797
<artifactId>javax.servlet-api</artifactId>
9898
<scope>provided</scope>
9999
</dependency>
100+
<dependency>
101+
<groupId>org.slf4j</groupId>
102+
<artifactId>slf4j-api</artifactId>
103+
<scope>provided</scope>
104+
</dependency>
105+
<dependency>
106+
<groupId>org.apache.commons</groupId>
107+
<artifactId>commons-lang3</artifactId>
108+
<scope>provided</scope>
109+
</dependency>
110+
<dependency>
111+
<groupId>org.apache.commons</groupId>
112+
<artifactId>commons-collections4</artifactId>
113+
<scope>provided</scope>
114+
</dependency>
115+
<dependency>
116+
<groupId>org.apache.jackrabbit</groupId>
117+
<artifactId>jackrabbit-api</artifactId>
118+
<scope>provided</scope>
119+
</dependency>
120+
<dependency>
121+
<groupId>org.apache.jackrabbit.vault</groupId>
122+
<artifactId>org.apache.jackrabbit.vault</artifactId>
123+
<scope>provided</scope>
124+
</dependency>
125+
<dependency>
126+
<groupId>org.apache.jackrabbit</groupId>
127+
<artifactId>jackrabbit-jcr-commons</artifactId>
128+
<scope>provided</scope>
129+
</dependency>
130+
<dependency>
131+
<groupId>org.apache.sling</groupId>
132+
<artifactId>org.apache.sling.api</artifactId>
133+
<scope>provided</scope>
134+
</dependency>
135+
<dependency>
136+
<groupId>org.apache.sling</groupId>
137+
<artifactId>org.apache.sling.serviceusermapper</artifactId>
138+
<scope>provided</scope>
139+
</dependency>
140+
<dependency>
141+
<groupId>org.apache.sling</groupId>
142+
<artifactId>org.apache.sling.commons.scheduler</artifactId>
143+
<scope>provided</scope>
144+
</dependency>
145+
<dependency>
146+
<groupId>org.apache.sling</groupId>
147+
<artifactId>org.apache.sling.jcr.resource</artifactId>
148+
<scope>provided</scope>
149+
</dependency>
150+
<dependency>
151+
<groupId>org.apache.sling</groupId>
152+
<artifactId>org.apache.sling.jcr.api</artifactId>
153+
<scope>provided</scope>
154+
</dependency>
155+
<dependency>
156+
<groupId>org.apache.sling</groupId>
157+
<artifactId>org.apache.sling.settings</artifactId>
158+
<scope>provided</scope>
159+
</dependency>
160+
<dependency>
161+
<groupId>org.apache.sling</groupId>
162+
<artifactId>org.apache.sling.commons.osgi</artifactId>
163+
<scope>provided</scope>
164+
</dependency>
165+
<dependency>
166+
<groupId>org.apache.sling</groupId>
167+
<artifactId>org.apache.sling.hc.api</artifactId>
168+
</dependency>
169+
<dependency>
170+
<groupId>org.apache.jackrabbit</groupId>
171+
<artifactId>oak-security-spi</artifactId>
172+
<scope>provided</scope>
173+
</dependency>
174+
<dependency>
175+
<groupId>org.apache.jackrabbit</groupId>
176+
<artifactId>oak-auth-external</artifactId>
177+
<scope>provided</scope>
178+
</dependency>
179+
<dependency>
180+
<groupId>com.fasterxml.jackson.core</groupId>
181+
<artifactId>jackson-annotations</artifactId>
182+
<scope>provided</scope>
183+
</dependency>
184+
<dependency>
185+
<groupId>com.fasterxml.jackson.core</groupId>
186+
<artifactId>jackson-databind</artifactId>
187+
<scope>provided</scope>
188+
</dependency>
189+
<dependency>
190+
<groupId>com.fasterxml.jackson.core</groupId>
191+
<artifactId>jackson-core</artifactId>
192+
<scope>provided</scope>
193+
</dependency>
194+
<dependency>
195+
<groupId>org.apache.httpcomponents</groupId>
196+
<artifactId>httpclient-osgi</artifactId>
197+
</dependency>
198+
<!-- JMX annotations -->
199+
<dependency>
200+
<groupId>com.adobe.granite</groupId>
201+
<artifactId>com.adobe.granite.jmx</artifactId>
202+
<scope>provided</scope>
203+
</dependency>
204+
<!-- Crypto Support -->
205+
<dependency>
206+
<groupId>com.adobe.granite</groupId>
207+
<artifactId>com.adobe.granite.crypto</artifactId>
208+
<scope>provided</scope>
209+
</dependency>
100210
<!-- embedded third party libraries -->
101211
<dependency>
102212
<groupId>org.yaml</groupId>
@@ -167,19 +277,19 @@
167277
<dependency>
168278
<groupId>org.apache.jackrabbit</groupId>
169279
<artifactId>oak-core</artifactId>
170-
<version>${oak.version}</version>
280+
<version>${oak.testing.version}</version>
171281
<scope>test</scope>
172282
</dependency>
173283
<dependency>
174284
<groupId>org.apache.jackrabbit</groupId>
175285
<artifactId>oak-jcr</artifactId>
176-
<version>${oak.version}</version>
286+
<version>${oak.testing.version}</version>
177287
<scope>test</scope>
178288
</dependency>
179289
<dependency>
180290
<groupId>org.apache.jackrabbit</groupId>
181291
<artifactId>oak-segment-tar</artifactId>
182-
<version>${oak.version}</version>
292+
<version>${oak.testing.version}</version>
183293
<scope>test</scope>
184294
</dependency>
185295
<!-- transitive dependency of oak-segment-tar, necessary for filedatastore (https://issues.apache.org/jira/browse/OAK-6542) -->
@@ -189,34 +299,7 @@
189299
<version>3.2.3</version>
190300
<scope>test</scope>
191301
</dependency>
192-
<dependency>
193-
<groupId>org.apache.jackrabbit.vault</groupId>
194-
<artifactId>org.apache.jackrabbit.vault</artifactId>
195-
<!-- compile against old version but test with newest release -->
196-
<version>3.6.8</version>
197-
<scope>test</scope>
198-
</dependency>
199-
<dependency>
200-
<groupId>org.apache.httpcomponents</groupId>
201-
<artifactId>httpclient-osgi</artifactId>
202-
<version>4.5.13</version>
203-
<scope>test</scope>
204-
</dependency>
205-
<dependency>
206-
<groupId>com.fasterxml.jackson.core</groupId>
207-
<artifactId>jackson-databind</artifactId>
208-
<scope>test</scope>
209-
</dependency>
210302
<!-- END: Test Dependencies -->
211-
212-
<!-- use the uber-jar always as last dependency because a lot of classes are provided also by other artifacts
213-
It is only used here as replacement for com.adobe.granite:com.adobe.granite.crypto:3.0.0 whose pom.xml is not publicly available -->
214-
<dependency>
215-
<groupId>com.adobe.aem</groupId>
216-
<artifactId>uber-jar</artifactId>
217-
<classifier>apis</classifier>
218-
<scope>provided</scope>
219-
</dependency>
220303
</dependencies>
221304

222305
<!-- ====================================================================== -->

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aem/AcToolCqActions.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* #L%
1414
*/
1515

16-
import java.security.AccessControlException;
1716
import java.security.Principal;
1817
import java.util.Arrays;
1918
import java.util.Collection;
@@ -29,6 +28,7 @@
2928
import javax.jcr.Value;
3029
import javax.jcr.nodetype.NodeDefinition;
3130
import javax.jcr.nodetype.NodeType;
31+
import javax.jcr.security.AccessControlException;
3232
import javax.jcr.security.AccessControlManager;
3333
import javax.jcr.security.Privilege;
3434

@@ -38,7 +38,6 @@
3838
import org.slf4j.Logger;
3939
import org.slf4j.LoggerFactory;
4040

41-
import com.day.cq.replication.Replicator;
4241

4342
import biz.netcentric.cq.tools.actool.configmodel.AceBean;
4443
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
@@ -62,6 +61,7 @@ public enum CqActions {
6261
}
6362

6463
private static final String CONTENT_RESTRICTION = "*/jcr:content*";
64+
private static final String REPLICATE_PRIVILEGE = "rep:replicate";
6565

6666
private final Session session;
6767
private final Map<String, Set<Privilege>> map = new HashMap<>();
@@ -84,7 +84,7 @@ public AcToolCqActions(Session session) throws RepositoryException {
8484
map.put(CqActions.acl_edit.name(), getPrivilegeSet(Privilege.JCR_MODIFY_ACCESS_CONTROL, acMgr));
8585

8686
try {
87-
map.put(CqActions.replicate.name(), getPrivilegeSet(Replicator.REPLICATE_PRIVILEGE, acMgr));
87+
map.put(CqActions.replicate.name(), getPrivilegeSet(REPLICATE_PRIVILEGE, acMgr));
8888
} catch (AccessControlException e) {
8989
LOG.warn("Replicate privilege not registered");
9090
}

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configmodel/pkcs/DerType.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package biz.netcentric.cq.tools.actool.configmodel.pkcs;
22

3+
import java.util.Base64;
4+
35
/*-
46
* #%L
57
* Access Control Tool Bundle
@@ -16,7 +18,6 @@
1618
import java.util.regex.Matcher;
1719
import java.util.regex.Pattern;
1820

19-
import org.apache.commons.codec.binary.Base64;
2021

2122
public enum DerType {
2223

@@ -42,6 +43,7 @@ byte[] fromPem(String pem) {
4243
if (!matcher.find()) {
4344
return null;
4445
}
45-
return Base64.decodeBase64(matcher.group(1));
46+
String base64 = matcher.group(1).replaceAll("\\s","");
47+
return Base64.getDecoder().decode(base64);
4648
}
4749
}

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configreader/YamlMacroChildNodeObjectsProviderImpl.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@
2929
import javax.jcr.Value;
3030
import javax.jcr.ValueFormatException;
3131

32+
import org.apache.jackrabbit.JcrConstants;
3233
import org.apache.sling.jcr.api.SlingRepository;
3334
import org.osgi.service.component.annotations.Component;
3435
import org.osgi.service.component.annotations.Reference;
3536
import org.osgi.service.component.annotations.ReferencePolicyOption;
3637
import org.slf4j.Logger;
3738
import org.slf4j.LoggerFactory;
3839

39-
import com.day.cq.commons.jcr.JcrConstants;
40-
4140
import biz.netcentric.cq.tools.actool.history.InstallationLogger;
4241

4342
@Component
@@ -78,8 +77,8 @@ public List<Object> getValuesForPath(String pathOfChildrenOfClause, Installation
7877
if (childNode.hasNode(JcrConstants.JCR_CONTENT)) {
7978
Node jcrContentNode = childNode.getNode(JcrConstants.JCR_CONTENT);
8079

81-
if (jcrContentNode.hasProperty(JcrConstants.JCR_TITLE)) {
82-
childNodeObjectForEl.put("title", jcrContentNode.getProperty(JcrConstants.JCR_TITLE).getString());
80+
if (jcrContentNode.hasProperty(Property.JCR_TITLE)) {
81+
childNodeObjectForEl.put("title", jcrContentNode.getProperty(Property.JCR_TITLE).getString());
8382
}
8483

8584
Map<String, Object> jcrContentSubNode = getValuesForNode(jcrContentNode, includeContent);

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/history/impl/AcHistoryServiceImpl.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import javax.jcr.Session;
2525

2626
import org.apache.commons.lang3.StringUtils;
27-
import org.apache.commons.lang3.text.WordUtils;
27+
import org.apache.jackrabbit.JcrConstants;
2828
import org.apache.jackrabbit.commons.JcrUtils;
2929
import org.apache.sling.jcr.api.SlingRepository;
3030
import org.osgi.service.component.annotations.Activate;
@@ -37,8 +37,6 @@
3737
import org.slf4j.Logger;
3838
import org.slf4j.LoggerFactory;
3939

40-
import com.day.cq.commons.jcr.JcrConstants;
41-
4240
import biz.netcentric.cq.tools.actool.history.AcHistoryService;
4341
import biz.netcentric.cq.tools.actool.history.AcToolExecution;
4442
import biz.netcentric.cq.tools.actool.history.impl.AcHistoryServiceImpl.Configuration;

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/history/impl/HistoryUtils.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@
4040
import org.apache.commons.lang3.StringUtils;
4141
import org.apache.commons.lang3.text.WordUtils;
4242
import org.apache.jackrabbit.commons.JcrUtils;
43+
import org.apache.jackrabbit.util.Text;
4344
import org.slf4j.Logger;
4445
import org.slf4j.LoggerFactory;
4546

46-
import com.day.text.Text;
47-
4847
import biz.netcentric.cq.tools.actool.api.InstallationResult;
4948
import biz.netcentric.cq.tools.actool.comparators.TimestampPropertyComparator;
5049
import biz.netcentric.cq.tools.actool.configuploadlistener.impl.UploadListenerServiceImpl.AcToolConfigUpdateListener;

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/ui/AcToolUiService.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import javax.servlet.http.HttpServletResponse;
4141

4242
import org.apache.commons.lang3.StringUtils;
43-
import org.apache.felix.webconsole.WebConsoleConstants;
4443
import org.apache.jackrabbit.api.JackrabbitSession;
4544
import org.apache.jackrabbit.api.security.user.User;
4645
import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
@@ -88,6 +87,8 @@ public class AcToolUiService {
8887

8988
private static final int MAX_LINE_WIDTH = 180; // max line width for log output in characters
9089

90+
private static final String WEBCONSOLE_ATTR_APP_ROOT = "felix.webconsole.appRoot"; // from https://github.com/apache/felix-dev/blob/e9dbc04d1ffbd1cdcc40759b63046e6808c5571d/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java#L149
91+
9192

9293
@Reference(policyOption = ReferencePolicyOption.GREEDY)
9394
private ConfigDumpService dumpService;
@@ -211,7 +212,7 @@ private boolean isOneOfPrincipalNamesBound(JackrabbitSession session, String[] p
211212
}
212213

213214
public String getWebConsoleRoot(HttpServletRequest req) {
214-
return (String) req.getAttribute(WebConsoleConstants.ATTR_APP_ROOT);
215+
return (String) req.getAttribute(WEBCONSOLE_ATTR_APP_ROOT);
215216
}
216217

217218
private void renderUi(HttpServletRequest req, HttpServletResponse resp, String path, boolean isTouchUi) throws ServletException, IOException {

accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerIncrementalTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,11 @@ public Value[] getRestrictions(String name) throws RepositoryException {
401401
}
402402
return values.toArray(new Value[values.size()]);
403403
}
404-
404+
/*
405405
@Override
406406
public PrivilegeCollection getPrivilegeCollection() throws RepositoryException {
407407
throw new UnsupportedOperationException();
408-
}
408+
}*/
409409

410410

411411
};

0 commit comments

Comments
 (0)