From a43673012d2827b0780c03f8a4fe862a6f7dfbf8 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sun, 25 Jan 2015 21:39:59 +0000 Subject: [PATCH] Adapt to CMS kernel git-svn-id: https://svn.argeo.org/commons/trunk@7698 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- demo/argeo_node_cms.properties | 23 ++++++++++----- demo/argeo_node_rap.properties | 9 +++--- org.argeo.security.core/bnd.bnd | 1 + org.argeo.security.core/pom.xml | 5 ++++ .../core/InternalAuthenticationProvider.java | 7 +++++ .../JackrabbitUserAdminService.java | 2 +- .../META-INF/spring/security-jcr-services.xml | 2 +- .../argeo/jackrabbit/JackrabbitContainer.java | 28 +++++++++++++++++-- .../argeo/jackrabbit/JackrabbitWrapper.java | 8 ++++-- 9 files changed, 67 insertions(+), 18 deletions(-) rename {org.argeo.security.jackrabbit/src/org/argeo/security => org.argeo.security.core/src/org/argeo/security/jcr}/jackrabbit/JackrabbitUserAdminService.java (99%) diff --git a/demo/argeo_node_cms.properties b/demo/argeo_node_cms.properties index aba171da5..45826958b 100644 --- a/demo/argeo_node_cms.properties +++ b/demo/argeo_node_cms.properties @@ -1,17 +1,26 @@ -argeo.osgi.start.1.node=\ -org.eclipse.gemini.blueprint.extender +#argeo.osgi.start.1.node=\ +#org.eclipse.gemini.blueprint.extender + +#argeo.osgi.start.3.node=\ +#org.argeo.security.dao.jackrabbit,\ -argeo.osgi.start.3.node=\ -org.argeo.node.repo.jackrabbit,\ -org.argeo.security.dao.jackrabbit,\ +#org.argeo.node.repo.jackrabbit,\ -argeo.osgi.start.4.node.rap=\ +argeo.osgi.start.2.node.rap=\ +org.eclipse.equinox.http.servlet,\ org.eclipse.equinox.http.jetty,\ org.eclipse.rap.rwt.osgi -argeo.osgi.start.5.cms=\ +argeo.osgi.start.3.cms=\ org.argeo.cms,\ +argeo.osgi.start.4.node=\ +org.eclipse.gemini.blueprint.extender + +argeo.osgi.start.5.cms=\ +org.argeo.cms.core,\ + + # Jetty org.osgi.service.http.port=7070 org.eclipse.equinox.http.jetty.log.stderr.threshold=info diff --git a/demo/argeo_node_rap.properties b/demo/argeo_node_rap.properties index 8596df804..88d9c9785 100644 --- a/demo/argeo_node_rap.properties +++ b/demo/argeo_node_rap.properties @@ -1,11 +1,11 @@ -argeo.osgi.start.1.node=\ +argeo.osgi.start.5.node=\ org.eclipse.gemini.blueprint.extender #org.argeo.server.ads.server,\ -argeo.osgi.start.3.node=\ -org.argeo.node.repo.jackrabbit,\ -org.argeo.security.dao.jackrabbit +#argeo.osgi.start.3.node=\ +#org.argeo.node.repo.jackrabbit,\ +#org.argeo.security.dao.jackrabbit #org.argeo.security.dao.ldap,\ @@ -14,6 +14,7 @@ org.eclipse.equinox.http.jetty,\ org.eclipse.rap.rwt.osgi,\ argeo.osgi.start.5.node.rap=\ +org.argeo.cms,\ org.eclipse.equinox.http.registry,\ #argeo.osgi.start.5.workbench=\ diff --git a/org.argeo.security.core/bnd.bnd b/org.argeo.security.core/bnd.bnd index 9124816cb..ef3d1aa2e 100644 --- a/org.argeo.security.core/bnd.bnd +++ b/org.argeo.security.core/bnd.bnd @@ -2,4 +2,5 @@ Bundle-ActivationPolicy: lazy Import-Package:org.bouncycastle.*;resolution:=optional,\ org.springframework.util,\ javax.jcr.security,\ +org.apache.jackrabbit.*;resolution:=optional,\ * diff --git a/org.argeo.security.core/pom.xml b/org.argeo.security.core/pom.xml index a7e3252eb..2305b7d7e 100644 --- a/org.argeo.security.core/pom.xml +++ b/org.argeo.security.core/pom.xml @@ -20,6 +20,11 @@ org.argeo.server.jcr 2.1.13-SNAPSHOT + + org.argeo.commons + org.argeo.server.jackrabbit + 2.1.13-SNAPSHOT + diff --git a/org.argeo.security.core/src/org/argeo/security/core/InternalAuthenticationProvider.java b/org.argeo.security.core/src/org/argeo/security/core/InternalAuthenticationProvider.java index 0efabcde0..4b7e047ba 100644 --- a/org.argeo.security.core/src/org/argeo/security/core/InternalAuthenticationProvider.java +++ b/org.argeo.security.core/src/org/argeo/security/core/InternalAuthenticationProvider.java @@ -7,6 +7,13 @@ import org.springframework.security.core.AuthenticationException; public class InternalAuthenticationProvider implements AuthenticationProvider { private String key; + public InternalAuthenticationProvider() { + } + + public InternalAuthenticationProvider(String key) { + this.key = key; + } + @Override public Authentication authenticate(Authentication arg0) throws AuthenticationException { diff --git a/org.argeo.security.jackrabbit/src/org/argeo/security/jackrabbit/JackrabbitUserAdminService.java b/org.argeo.security.core/src/org/argeo/security/jcr/jackrabbit/JackrabbitUserAdminService.java similarity index 99% rename from org.argeo.security.jackrabbit/src/org/argeo/security/jackrabbit/JackrabbitUserAdminService.java rename to org.argeo.security.core/src/org/argeo/security/jcr/jackrabbit/JackrabbitUserAdminService.java index 7835f1c8f..b648f32c3 100644 --- a/org.argeo.security.jackrabbit/src/org/argeo/security/jackrabbit/JackrabbitUserAdminService.java +++ b/org.argeo.security.core/src/org/argeo/security/jcr/jackrabbit/JackrabbitUserAdminService.java @@ -1,4 +1,4 @@ -package org.argeo.security.jackrabbit; +package org.argeo.security.jcr.jackrabbit; import java.util.ArrayList; import java.util.Iterator; diff --git a/org.argeo.security.dao.jackrabbit/META-INF/spring/security-jcr-services.xml b/org.argeo.security.dao.jackrabbit/META-INF/spring/security-jcr-services.xml index 1923d1023..6a7bdeca5 100644 --- a/org.argeo.security.dao.jackrabbit/META-INF/spring/security-jcr-services.xml +++ b/org.argeo.security.dao.jackrabbit/META-INF/spring/security-jcr-services.xml @@ -36,7 +36,7 @@ diff --git a/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitContainer.java b/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitContainer.java index 9060b585a..82d58fb31 100644 --- a/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitContainer.java +++ b/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitContainer.java @@ -56,7 +56,9 @@ public class JackrabbitContainer extends JackrabbitWrapper implements // local private Resource configuration; + private Resource variables; + private RepositoryConfig repositoryConfig; private File homeDirectory; private Boolean inMemory = false; @@ -64,6 +66,10 @@ public class JackrabbitContainer extends JackrabbitWrapper implements /** Migrations to execute (if not already done) */ private Set dataModelMigrations = new HashSet(); + /** Straight (non spring) values */ + private Properties configurationProperties; + private InputSource configurationXml; + /** * Empty constructor, {@link #init()} should be called after properties have * been set @@ -107,11 +113,16 @@ public class JackrabbitContainer extends JackrabbitWrapper implements // process configuration file Properties vars = getConfigurationProperties(); - configurationIn = readConfiguration(); vars.put(RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE, getHomeDirectory().getCanonicalPath()); - repositoryConfig = RepositoryConfig.create(new InputSource( - configurationIn), vars); + InputSource is; + if (configurationXml != null) + is = configurationXml; + else { + configurationIn = readConfiguration(); + is = new InputSource(configurationIn); + } + repositoryConfig = RepositoryConfig.create(is, vars); // // Actual repository creation @@ -288,6 +299,9 @@ public class JackrabbitContainer extends JackrabbitWrapper implements /** Generates the properties to use in the configuration. */ protected Properties getConfigurationProperties() { + if (configurationProperties != null) + return configurationProperties; + InputStream propsIn = null; Properties vars; try { @@ -349,4 +363,12 @@ public class JackrabbitContainer extends JackrabbitWrapper implements this.configuration = configuration; } + public void setConfigurationProperties(Properties configurationProperties) { + this.configurationProperties = configurationProperties; + } + + public void setConfigurationXml(InputSource configurationXml) { + this.configurationXml = configurationXml; + } + } diff --git a/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitWrapper.java b/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitWrapper.java index f9f04c4cb..53a9ff1e2 100644 --- a/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitWrapper.java +++ b/org.argeo.server.jackrabbit/src/org/argeo/jackrabbit/JackrabbitWrapper.java @@ -339,8 +339,8 @@ public class JackrabbitWrapper extends JcrRepositoryWrapper implements } else { // assume this is in the same bundle exportingBundle = bundleContext.getBundle(); -// throw new ArgeoException("No OSGi exporting package found for " -// + resUrl); + // throw new ArgeoException("No OSGi exporting package found for " + // + resUrl); } return exportingBundle; } @@ -360,6 +360,10 @@ public class JackrabbitWrapper extends JcrRepositoryWrapper implements this.bundleContext = bundleContext; } + protected BundleContext getBundleContext() { + return bundleContext; + } + public void setForceCndImport(Boolean forceCndUpdate) { this.forceCndImport = forceCndUpdate; } -- 2.30.2