This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.distribution.sample-0.1.2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-sample.git
commit e59b8d707d132db1447501355cf2593ed1d12ba8 Author: Marius Petria <[email protected]> AuthorDate: Mon Apr 20 13:27:20 2015 +0000 SLING-4629: allow configuration of passive queues, for which processing is not enabled git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/distribution/sample@1674843 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 28 ++++++- .../org/apache/sling/distribution/test/Init.java | 90 ++++++++++++++++++++++ ...dDistributionAgentFactory-publish-multiple.json | 4 + ...ionPackageExporterFactory-publish-multiple.json | 8 ++ ...ServiceUserMapperImpl.amended-distribution.json | 2 +- 5 files changed, 130 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4658953..84d443a 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,33 @@ <artifactId>org.osgi.compendium</artifactId> <scope>provided</scope> </dependency> - + <dependency> + <groupId>javax.jcr</groupId> + <artifactId>jcr</artifactId> + <version>2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.jackrabbit</groupId> + <artifactId>jackrabbit-api</artifactId> + <version>2.9.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.jcr.api</artifactId> + <version>2.2.0</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.6.2</version> + </dependency> + <dependency> + <groupId>org.apache.jackrabbit</groupId> + <artifactId>jackrabbit-jcr-commons</artifactId> + <version>2.9.0</version> + </dependency> </dependencies> <reporting> <plugins> diff --git a/src/main/java/org/apache/sling/distribution/test/Init.java b/src/main/java/org/apache/sling/distribution/test/Init.java new file mode 100644 index 0000000..409b3b2 --- /dev/null +++ b/src/main/java/org/apache/sling/distribution/test/Init.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package org.apache.sling.distribution.test; + +import org.apache.felix.scr.annotations.Activate; +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Reference; +import org.apache.jackrabbit.api.JackrabbitSession; +import org.apache.jackrabbit.api.security.user.Authorizable; +import org.apache.jackrabbit.api.security.user.UserManager; +import javax.jcr.security.Privilege; +import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils; +import org.apache.sling.jcr.api.SlingRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +import javax.jcr.Session; + + +@Component(immediate = true) +public class Init { + + Logger log = LoggerFactory.getLogger(getClass()); + + @Reference + SlingRepository slingRepository; + + @Activate + public void activate() throws Exception { + + try { + final String userName = "testDistributionUser"; + Session session = slingRepository.loginAdministrative(null); + + JackrabbitSession jackrabittSession = (JackrabbitSession) session; + UserManager userManager = jackrabittSession.getUserManager(); + Authorizable user = userManager.getAuthorizable(userName); + + if (user == null) { + try { + user = userManager.createSystemUser(userName, null); + log.error("created system user", user); + + } catch (Throwable t) { + user = userManager.createUser(userName, "123"); + log.error("created regular user", user); + + } + } + + if (user != null) { + AccessControlUtils.addAccessControlEntry(session, "/", user.getPrincipal(), new String[]{ Privilege.JCR_ALL }, true); + + AccessControlUtils.addAccessControlEntry(session, null, user.getPrincipal(), new String[]{ Privilege.JCR_ALL }, true); + + session.save(); + + session.logout(); + } + + } catch (Throwable t) { + log.error("cannot create user", t); + } + + + + } + + + +} diff --git a/src/main/resources/SLING-CONTENT/libs/sling/distribution/install.author/publish-multiple/org.apache.sling.distribution.agent.impl.ForwardDistributionAgentFactory-publish-multiple.json b/src/main/resources/SLING-CONTENT/libs/sling/distribution/install.author/publish-multiple/org.apache.sling.distribution.agent.impl.ForwardDistributionAgentFactory-publish-multiple.json index 5dcfcb6..11f9533 100644 --- a/src/main/resources/SLING-CONTENT/libs/sling/distribution/install.author/publish-multiple/org.apache.sling.distribution.agent.impl.ForwardDistributionAgentFactory-publish-multiple.json +++ b/src/main/resources/SLING-CONTENT/libs/sling/distribution/install.author/publish-multiple/org.apache.sling.distribution.agent.impl.ForwardDistributionAgentFactory-publish-multiple.json @@ -16,5 +16,9 @@ "packageImporter.endpoints" : [ "endpoint1=http://localhost:4503/libs/sling/distribution/services/importers/default", "endpoint2=http://localhost:4503/libs/sling/distribution/services/importers/defaultbadaddress" + ], + + "passiveQueues" : [ + "passivequeue1" ] } \ No newline at end of file diff --git a/src/main/resources/SLING-CONTENT/libs/sling/distribution/install.author/publish-multiple/org.apache.sling.distribution.packaging.impl.exporter.AgentDistributionPackageExporterFactory-publish-multiple.json b/src/main/resources/SLING-CONTENT/libs/sling/distribution/install.author/publish-multiple/org.apache.sling.distribution.packaging.impl.exporter.AgentDistributionPackageExporterFactory-publish-multiple.json new file mode 100644 index 0000000..0d1045b --- /dev/null +++ b/src/main/resources/SLING-CONTENT/libs/sling/distribution/install.author/publish-multiple/org.apache.sling.distribution.packaging.impl.exporter.AgentDistributionPackageExporterFactory-publish-multiple.json @@ -0,0 +1,8 @@ +{ + "jcr:primaryType": "sling:OsgiConfig", + "name": "publish-multiple-passivequeue1", + + "agent.target": "(name=publish-multiple)", + + "queue": "passivequeue1" +} \ No newline at end of file diff --git a/src/main/resources/SLING-CONTENT/libs/sling/distribution/install/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-distribution.json b/src/main/resources/SLING-CONTENT/libs/sling/distribution/install/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-distribution.json index 10337b7..85cde3d 100644 --- a/src/main/resources/SLING-CONTENT/libs/sling/distribution/install/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-distribution.json +++ b/src/main/resources/SLING-CONTENT/libs/sling/distribution/install/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-distribution.json @@ -1,5 +1,5 @@ { "jcr:primaryType": "sling:OsgiConfig", "user.default": "", - "user.mapping": "org.apache.sling.distribution.core:distributionService=admin" + "user.mapping": "org.apache.sling.distribution.core:distributionService=testDistributionUser" } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
