svn commit: r902738 - /sling/trunk/launchpad/builder/src/main/bundles/list.xml
Author: fmeschbe Date: Mon Jan 25 09:07:11 2010 New Revision: 902738 URL: http://svn.apache.org/viewvc?rev=902738&view=rev Log: SLING-1282 Need snapshot of JCR Base bundle for the new credentials stuff to work. Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=902738&r1=902737&r2=902738&view=diff == --- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original) +++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Mon Jan 25 09:07:11 2010 @@ -232,7 +232,7 @@ org.apache.sling org.apache.sling.jcr.base -2.0.4-incubator +2.0.5-SNAPSHOT org.apache.jackrabbit
svn commit: r902743 - /sling/trunk/bundles/jcr/api/pom.xml
Author: cziegeler Date: Mon Jan 25 09:22:46 2010 New Revision: 902743 URL: http://svn.apache.org/viewvc?rev=902743&view=rev Log: Fix exported version to be 2.0.2 Modified: sling/trunk/bundles/jcr/api/pom.xml Modified: sling/trunk/bundles/jcr/api/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/api/pom.xml?rev=902743&r1=902742&r2=902743&view=diff == --- sling/trunk/bundles/jcr/api/pom.xml (original) +++ sling/trunk/bundles/jcr/api/pom.xml Mon Jan 25 09:22:46 2010 @@ -57,7 +57,7 @@ -org.apache.sling.jcr.api;version=${pom.version} +org.apache.sling.jcr.api;version=2.0.2
svn commit: r902764 - in /sling/trunk/bundles/jcr/classloader: NOTICE pom.xml src/main/resources/META-INF/NOTICE
Author: cziegeler Date: Mon Jan 25 10:24:12 2010 New Revision: 902764 URL: http://svn.apache.org/viewvc?rev=902764&view=rev Log: Update notice to 2010 and use JCR in bundle name as this is a bundle in our JCR section. Modified: sling/trunk/bundles/jcr/classloader/NOTICE sling/trunk/bundles/jcr/classloader/pom.xml sling/trunk/bundles/jcr/classloader/src/main/resources/META-INF/NOTICE Modified: sling/trunk/bundles/jcr/classloader/NOTICE URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/NOTICE?rev=902764&r1=902763&r2=902764&view=diff == --- sling/trunk/bundles/jcr/classloader/NOTICE (original) +++ sling/trunk/bundles/jcr/classloader/NOTICE Mon Jan 25 10:24:12 2010 @@ -1,5 +1,5 @@ Apache Sling JCR Classloader -Copyright 2008-2009 The Apache Software Foundation +Copyright 2008-2010 The Apache Software Foundation Apache Sling is based on source code originally developed by Day Software (http://www.day.com/). Modified: sling/trunk/bundles/jcr/classloader/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/pom.xml?rev=902764&r1=902763&r2=902764&view=diff == --- sling/trunk/bundles/jcr/classloader/pom.xml (original) +++ sling/trunk/bundles/jcr/classloader/pom.xml Mon Jan 25 10:24:12 2010 @@ -29,7 +29,7 @@ 3.0.1-SNAPSHOT bundle -Apache Sling Repository ClassLoader +Apache Sling JCR ClassLoader Provides Support for delegate class loaders built dynamically. Delegate class loaders supported are generic ClassLoader, OSGi @@ -107,18 +107,6 @@ provided -org.apache.jackrabbit -jackrabbit-classloader -1.5.0 -compile - - -org.apache.jackrabbit -jackrabbit-jcr-commons -1.6.0 -compile - - org.slf4j slf4j-api Modified: sling/trunk/bundles/jcr/classloader/src/main/resources/META-INF/NOTICE URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/src/main/resources/META-INF/NOTICE?rev=902764&r1=902763&r2=902764&view=diff == --- sling/trunk/bundles/jcr/classloader/src/main/resources/META-INF/NOTICE (original) +++ sling/trunk/bundles/jcr/classloader/src/main/resources/META-INF/NOTICE Mon Jan 25 10:24:12 2010 @@ -1,5 +1,5 @@ Apache Sling JCR Classloader -Copyright 2008-2009 The Apache Software Foundation +Copyright 2008-2010 The Apache Software Foundation Apache Sling is based on source code originally developed by Day Software (http://www.day.com/).
svn commit: r902769 - /sling/trunk/launchpad/builder/src/main/bundles/list.xml
Author: ieb Date: Mon Jan 25 10:36:55 2010 New Revision: 902769 URL: http://svn.apache.org/viewvc?rev=902769&view=rev Log: Revert "SLING-1282 Need snapshot of JCR Base bundle for the new credentials stuff to work." This reverts commit dd541d1cb3b20895c4a5522aeb15cced3142fce0. Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=902769&r1=902768&r2=902769&view=diff == --- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original) +++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Mon Jan 25 10:36:55 2010 @@ -232,7 +232,7 @@ org.apache.sling org.apache.sling.jcr.base -2.0.5-SNAPSHOT +2.0.4-incubator org.apache.jackrabbit
svn commit: r902770 - /sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
Author: ieb Date: Mon Jan 25 10:37:18 2010 New Revision: 902770 URL: http://svn.apache.org/viewvc?rev=902770&view=rev Log: Revert "SLING-1282 Set dummy passwords for the default configuration" This reverts commit 7ff1bbd93c57caa0614ff13533e34a47cc012d39. Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java?rev=902770&r1=902769&r2=902770&view=diff == --- sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java (original) +++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java Mon Jan 25 10:37:18 2010 @@ -23,7 +23,6 @@ import java.sql.DriverManager; import java.util.Hashtable; -import org.apache.sling.jcr.base.AbstractSlingRepository; import org.apache.sling.jcr.base.util.RepositoryAccessor; import org.apache.sling.jcr.jackrabbit.server.security.LoginModulePlugin; import org.osgi.framework.BundleActivator; @@ -290,10 +289,6 @@ homeDir.getPath()); props.put(SlingServerRepository.REPOSITORY_REGISTRATION_NAME, this.getRepositoryName()); - -// password properties are not used any more, set to a n/a value -props.put(AbstractSlingRepository.PROPERTY_ADMIN_PASS, "not-used"); -props.put(AbstractSlingRepository.PROPERTY_ANONYMOUS_PASS, "not-used"); } private File getHomeDir(BundleContext bundleContext) throws IOException {
svn commit: r902771 - /sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/OSGI-INF/metatype/metatype.properties
Author: ieb Date: Mon Jan 25 10:37:46 2010 New Revision: 902771 URL: http://svn.apache.org/viewvc?rev=902771&view=rev Log: Revert "SLING-1282 Comment on the password properties not being used by the embedded repository." This reverts commit 44d453d15c08c09fa284a296e7aa0bcb3e9d17eb. Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/OSGI-INF/metatype/metatype.properties Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/OSGI-INF/metatype/metatype.properties URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=902771&r1=902770&r2=902771&view=diff == --- sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/OSGI-INF/metatype/metatype.properties (original) +++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/OSGI-INF/metatype/metatype.properties Mon Jan 25 10:37:46 2010 @@ -35,8 +35,7 @@ repository. admin.password.name = Administrator Password -admin.password.description = This property is not used by the Embedded \ - Jackrabbit Repository. +admin.password.description = Password for the administrative user. anonymous.name.name = Anonymous anonymous.name.description = The user name of the anonymous user. This user \ @@ -44,8 +43,7 @@ instance. anonymous.password.name = Anonymous Password -anonymous.password.description = This property is not used by the Embedded \ - Jackrabbit Repository. +anonymous.password.description = Password for the anonymous user. autostart.name = Autostart autostart.description = Check to have the embedded JCR repository started as \
svn commit: r902772 - /sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
Author: ieb Date: Mon Jan 25 10:38:10 2010 New Revision: 902772 URL: http://svn.apache.org/viewvc?rev=902772&view=rev Log: Revert "SLING-1282 added default behaviour back in to allow other SlingRepository implementations to continue to work as before." This reverts commit 688e3610492b1ebc4f55a2647b50fb33e21a49d6. Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java?rev=902772&r1=902771&r2=902772&view=diff == --- sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java (original) +++ sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java Mon Jan 25 10:38:10 2010 @@ -140,12 +140,8 @@ private String anonUser; -private char[] anonPass; - private String adminUser; -private char[] adminPass; - private SessionPoolManager poolManager; private Loader loader; @@ -273,20 +269,13 @@ * @param anonUser the user name of the anon user. * @return a Credentials implementation that represents the anon user. */ -protected Credentials getAnonCredentials(String anonUser) { -// NB: this method is overridden in the Jackrabbit Service bundle to avoid using the anon password. SLING-1282 -return new SimpleCredentials(anonUser, anonPass); -} +protected abstract Credentials getAnonCredentials(String anonUser); /** * @param adminUser the name of the administrative user. * @return a Credentials implementation that represents the administrative user. */ -protected Credentials getAdministrativeCredentials(String adminUser){ -// NB: this method is overridden in the Jackrabbit Service bundle to avoid using the admin password. SLING-1282 -return new SimpleCredentials(adminUser, adminPass); -} - +protected abstract Credentials getAdministrativeCredentials(String adminUser); /* @@ -629,13 +618,9 @@ PROPERTY_DEFAULT_WORKSPACE, null)); this.anonUser = this.getProperty(properties, PROPERTY_ANONYMOUS_USER, DEFAULT_ANONYMOUS_USER); -this.anonPass = this.getProperty(properties, PROPERTY_ANONYMOUS_PASS, -DEFAULT_ANONYMOUS_PASS).toCharArray(); this.adminUser = this.getProperty(properties, PROPERTY_ADMIN_USER, DEFAULT_ADMIN_USER); -this.adminPass = this.getProperty(properties, PROPERTY_ADMIN_PASS, -DEFAULT_ADMIN_PASS).toCharArray(); setPollTimeActive(getIntProperty(properties, PROPERTY_POLL_ACTIVE)); setPollTimeInActive(getIntProperty(properties, PROPERTY_POLL_INACTIVE)); @@ -756,6 +741,7 @@ // -- Background operation checking repository availability + private void setPollTimeActive(int seconds) { if (seconds < MIN_POLL) { seconds = DEFAULT_POLL_ACTIVE;
svn commit: r902773 - in /sling/trunk/bundles/jcr: base/src/main/java/org/apache/sling/jcr/base/ jackrabbit-server/ jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/ jackrab
Author: ieb Date: Mon Jan 25 10:38:46 2010 New Revision: 902773 URL: http://svn.apache.org/viewvc?rev=902773&view=rev Log: Revert "SLING-1282 First pass at using credentials classes, concerned about impersonation." This reverts commit 017f5fbf5396f7018f33ff9feacbebba17ce46b0. Removed: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/AdministrativeCredentials.java sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/AnonCredentials.java sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/CallbackHandlerWrapper.java sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/TrustedCredentials.java Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java sling/trunk/bundles/jcr/jackrabbit-server/pom.xml sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/PluggableDefaultLoginModule.java Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java?rev=902773&r1=902772&r2=902773&view=diff == --- sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java (original) +++ sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java Mon Jan 25 10:38:46 2010 @@ -140,8 +140,12 @@ private String anonUser; +private char[] anonPass; + private String adminUser; +private char[] adminPass; + private SessionPoolManager poolManager; private Loader loader; @@ -197,7 +201,8 @@ public Session loginAdministrative(String workspace) throws RepositoryException { -Credentials sc = getAdministrativeCredentials(this.adminUser); +SimpleCredentials sc = new SimpleCredentials(this.adminUser, +this.adminPass); return this.login(sc, workspace); } @@ -221,7 +226,7 @@ } if (credentials == null) { -credentials = getAnonCredentials(this.anonUser); +credentials = new SimpleCredentials(this.anonUser, this.anonPass); } // check the workspace @@ -264,19 +269,6 @@ throw new RepositoryException(re.getMessage(), re); } } - -/** - * @param anonUser the user name of the anon user. - * @return a Credentials implementation that represents the anon user. - */ -protected abstract Credentials getAnonCredentials(String anonUser); - -/** - * @param adminUser the name of the administrative user. - * @return a Credentials implementation that represents the administrative user. - */ -protected abstract Credentials getAdministrativeCredentials(String adminUser); - /* * (non-Javadoc) @@ -618,9 +610,13 @@ PROPERTY_DEFAULT_WORKSPACE, null)); this.anonUser = this.getProperty(properties, PROPERTY_ANONYMOUS_USER, DEFAULT_ANONYMOUS_USER); +this.anonPass = this.getProperty(properties, PROPERTY_ANONYMOUS_PASS, +DEFAULT_ANONYMOUS_PASS).toCharArray(); this.adminUser = this.getProperty(properties, PROPERTY_ADMIN_USER, DEFAULT_ADMIN_USER); +this.adminPass = this.getProperty(properties, PROPERTY_ADMIN_PASS, +DEFAULT_ADMIN_PASS).toCharArray(); setPollTimeActive(getIntProperty(properties, PROPERTY_POLL_ACTIVE)); setPollTimeInActive(getIntProperty(properties, PROPERTY_POLL_INACTIVE)); @@ -713,7 +709,8 @@ Session tmpSession = null; try { -Credentials sc = getAdministrativeCredentials(this.adminUser); +SimpleCredentials sc = new SimpleCredentials(this.adminUser, +this.adminPass); tmpSession = this.getRepository().login(sc); Workspace defaultWs = tmpSession.getWorkspace(); if (defaultWs instanceof JackrabbitWorkspace) { @@ -741,7 +738,6 @@ // -- Background operation checking repository availability - private void setPollTimeActive(int seconds) { if (seconds < MIN_POLL) { seconds = DEFAULT_POLL_ACTIVE; Modified: sling/trunk/bundles/jcr/jackrabbit-server/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/pom.xml?rev=902773&r1=902772&r2=902773&view=diff
svn commit: r902795 - /sling/trunk/bundles/jcr/classloader/pom.xml
Author: cziegeler Date: Mon Jan 25 12:44:05 2010 New Revision: 902795 URL: http://svn.apache.org/viewvc?rev=902795&view=rev Log: We don't have an api anymore (since 3.0) Modified: sling/trunk/bundles/jcr/classloader/pom.xml Modified: sling/trunk/bundles/jcr/classloader/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/pom.xml?rev=902795&r1=902794&r2=902795&view=diff == --- sling/trunk/bundles/jcr/classloader/pom.xml (original) +++ sling/trunk/bundles/jcr/classloader/pom.xml Mon Jan 25 12:44:05 2010 @@ -71,9 +71,7 @@ org.apache.maven.plugins maven-javadoc-plugin - -org.apache.sling.jcr.classloader.internal - +true
svn commit: r902796 - /sling/trunk/bundles/jcr/classloader/pom.xml
Author: cziegeler Date: Mon Jan 25 12:44:26 2010 New Revision: 902796 URL: http://svn.apache.org/viewvc?rev=902796&view=rev Log: Remove spurious comma Modified: sling/trunk/bundles/jcr/classloader/pom.xml Modified: sling/trunk/bundles/jcr/classloader/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/pom.xml?rev=902796&r1=902795&r2=902796&view=diff == --- sling/trunk/bundles/jcr/classloader/pom.xml (original) +++ sling/trunk/bundles/jcr/classloader/pom.xml Mon Jan 25 12:44:26 2010 @@ -58,7 +58,7 @@ sling,jcr,jackrabbit -org.apache.sling.jcr.classloader.internal.*, +org.apache.sling.jcr.classloader.internal.*
svn commit: r902799 - in /sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal: DynamicRepositoryClassLoader.java URLRepositoryClassLoader.java net/JCRURLConnect
Author: cziegeler Date: Mon Jan 25 12:52:10 2010 New Revision: 902799 URL: http://svn.apache.org/viewvc?rev=902799&view=rev Log: SLING-1316 - Include jackrabbit classloader code to adjust it for Sling needs - code import with first changes. Update to Java 5 code. Modified: sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/DynamicRepositoryClassLoader.java sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/URLRepositoryClassLoader.java sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/net/JCRURLConnection.java Modified: sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/DynamicRepositoryClassLoader.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/DynamicRepositoryClassLoader.java?rev=902799&r1=902798&r2=902799&view=diff == --- sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/DynamicRepositoryClassLoader.java (original) +++ sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/DynamicRepositoryClassLoader.java Mon Jan 25 12:52:10 2010 @@ -83,7 +83,7 @@ * @see #onEvent(EventIterator) * @see #findClassLoaderResource(String) */ -private Map modTimeCache; +private Map modTimeCache; /** * Flag indicating whether there are loaded classes which have later been @@ -122,7 +122,7 @@ // set fields dirty = false; -modTimeCache = new HashMap(); +modTimeCache = new HashMap(); // register with observation service and path pattern list registerModificationListener(); @@ -152,7 +152,7 @@ // set the configuration and fields dirty = false; -modTimeCache = new HashMap(); +modTimeCache = new HashMap(); // create a repository from the handles - might get a different one setRepository(resetClassPathEntries(old.getRepository())); @@ -277,8 +277,8 @@ } // Check whether any class has changed -for (Iterator iter = getCachedResources(); iter.hasNext();) { -if (expireResource((ClassLoaderResource) iter.next())) { +for (Iterator iter = getCachedResources(); iter.hasNext();) { +if (expireResource(iter.next())) { log.debug("shouldReload: Found expired resource, need reload"); return true; } @@ -475,7 +475,7 @@ log.debug( "onEvent: Item {} has been modified, checking with cache", path); -ClassLoaderResource resource = (ClassLoaderResource) modTimeCache.get(path); +ClassLoaderResource resource = modTimeCache.get(path); if (resource != null) { log.debug("pageModified: Expiring cache entry {}", resource); expireResource(resource); Modified: sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/URLRepositoryClassLoader.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/URLRepositoryClassLoader.java?rev=902799&r1=902798&r2=902799&view=diff == --- sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/URLRepositoryClassLoader.java (original) +++ sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/URLRepositoryClassLoader.java Mon Jan 25 12:52:10 2010 @@ -229,7 +229,7 @@ * @throws ClassNotFoundException If the named class could not be found or * if this class loader has already been destroyed. */ -protected Class findClass(final String name) throws ClassNotFoundException { +protected Class findClass(final String name) throws ClassNotFoundException { if (isDestroyed()) { throw new ClassNotFoundException(name + " (Classloader destroyed)"); @@ -238,10 +238,10 @@ log.debug("findClass: Try to find class {}", name); try { -return (Class) AccessController -.doPrivileged(new PrivilegedExceptionAction() { +return AccessController.doPrivileged( +new PrivilegedExceptionAction>() { -public Object run() throws ClassNotFoundException { +public Class run() throws ClassNotFoundException { return findClassPrivileged(name); } }); @@ -288,15 +288,15 @@ * empty enumeration if no resources are found by this class loader * or if this class loader has already be
svn commit: r902807 - in /sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl: Activator.java DynamicClassLoaderManagerFactory.java DynamicClassLoaderManage
Author: cziegeler Date: Mon Jan 25 13:30:59 2010 New Revision: 902807 URL: http://svn.apache.org/viewvc?rev=902807&view=rev Log: SLING-1302 : After a NoClassDefError classes are still not found even if they have been installed in the meantime Modified: sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerFactory.java sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerImpl.java sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/PackageAdminClassLoader.java Modified: sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java?rev=902807&r1=902806&r2=902807&view=diff == --- sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java (original) +++ sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java Mon Jan 25 13:30:59 2010 @@ -113,6 +113,12 @@ if ( needsUpdate ) { this.unregisterManagerFactory(); this.registerManagerFactory(); +} else { +// if a new bundle has been added (=resolved), we should +// clear the negative cache (see SLING-1302) +if ( event.getType() == BundleEvent.RESOLVED ) { +this.service.clearNegativeCaches(); +} } } } Modified: sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerFactory.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerFactory.java?rev=902807&r1=902806&r2=902807&view=diff == --- sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerFactory.java (original) +++ sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerFactory.java Mon Jan 25 13:30:59 2010 @@ -16,8 +16,10 @@ */ package org.apache.sling.commons.classloader.impl; +import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; import org.osgi.framework.Bundle; @@ -40,6 +42,9 @@ private final Set usedBundles = Collections.synchronizedSet(new HashSet()); +/** All created managers. */ +private final List managers = new ArrayList(); + /** * Create a new service instance * @param ctx The bundle context. @@ -56,7 +61,12 @@ */ public Object getService(final Bundle bundle, final ServiceRegistration registration) { -return new DynamicClassLoaderManagerImpl(this.context, this.pckAdmin, new BundleProxyClassLoader(bundle), this); +final DynamicClassLoaderManagerImpl manager = new DynamicClassLoaderManagerImpl(this.context, +this.pckAdmin, new BundleProxyClassLoader(bundle), this); +synchronized ( managers ) { +managers.add(manager); +} +return manager; } /** @@ -66,6 +76,9 @@ final ServiceRegistration registration, final Object service) { if ( service != null ) { +synchronized ( managers ) { +managers.remove(service); +} ((DynamicClassLoaderManagerImpl)service).deactivate(); } } @@ -87,4 +100,15 @@ final long id = bundle.getBundleId(); this.usedBundles.add(id); } + +/** + * Clear the negative caches of all registered managers. + */ +public void clearNegativeCaches() { +synchronized ( this.managers ) { +for(final DynamicClassLoaderManagerImpl manager : this.managers) { +manager.clearNegativeCache(); +} +} +} } Modified: sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerImpl.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/DynamicClassLoaderManagerImpl.java?rev=902807&r1=902806&r2=902807&view=diff == --- sling/trunk/bundles/commons/class
svn commit: r902812 - /sling/trunk/launchpad/builder/src/main/bundles/list.xml
Author: cziegeler Date: Mon Jan 25 14:05:06 2010 New Revision: 902812 URL: http://svn.apache.org/viewvc?rev=902812&view=rev Log: Use latest dynamic classloader and move it to start level 0 Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=902812&r1=902811&r2=902812&view=diff == --- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original) +++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Mon Jan 25 14:05:06 2010 @@ -26,6 +26,11 @@ org.apache.sling.commons.mime 2.1.0-incubator + +org.apache.sling +org.apache.sling.commons.classloader +1.1.3-SNAPSHOT + @@ -190,11 +195,6 @@ org.apache.sling -org.apache.sling.commons.classloader -1.1.2 - - -org.apache.sling org.apache.sling.jcr.webconsole 1.0.0-SNAPSHOT
svn commit: r902837 - in /sling/trunk: bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/ bundles/jcr/jackrabbit-server/ bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrab
Author: ieb Date: Mon Jan 25 15:21:16 2010 New Revision: 902837 URL: http://svn.apache.org/viewvc?rev=902837&view=rev Log: SLING-1282 Fixed, all the previous commits on this issue that were then reverted have been suashed into a single commit. The first commit listed is the final one fixing problems with impersonation for Admin users. Squashed commit of the following: commit 7b738417cb0276a20039c390571b4c90da69649a Author: Ian Boston Date: Mon Jan 25 13:05:19 2010 + SLING-1282 Fixed issues where the Principals for the TrustedCredentials were the offical Jackrabbit Principals, and fixed credential callback issues where TrustedCredentials were ignored. This commit passes all build tests. commit bf0caa466d1f7068d5e2b410bd31ff209610e958 Author: Ian Boston Date: Mon Jan 25 11:26:46 2010 + Revert "Revert "SLING-1282 Need snapshot of JCR Base bundle for the new credentials stuff to work."" This reverts commit e2511216663b25f1a2250562faae4dc5b4241a99. commit bcba6e47a72ca0892fc190e32c827edb3ccf99ea Author: Ian Boston Date: Mon Jan 25 11:26:45 2010 + Revert "Revert "SLING-1282 Set dummy passwords for the default configuration"" This reverts commit 62a512a04f3a7a2c72cac610c422ed49b6dbdc7e. commit 71c5696829a2edbad8ce5d4d3fcf2f85d0b43a81 Author: Ian Boston Date: Mon Jan 25 11:26:43 2010 + Revert "Revert "SLING-1282 Comment on the password properties not being used by the embedded repository."" This reverts commit 5874e377d1e6833efd7ff50ca21f04ddb552ec3b. commit 00f52e69a8ce6400f637647c83ea0cb1cf660077 Author: Ian Boston Date: Mon Jan 25 11:26:42 2010 + Revert "Revert "SLING-1282 added default behaviour back in to allow other SlingRepository implementations to continue to work as before."" This reverts commit d7428d650e654778dc7213393e310949eb7f1013. commit bd8a0e97b0f0c7160f7c7d1ba760e349bce971ef Author: Ian Boston Date: Mon Jan 25 11:26:29 2010 + Revert "Revert "SLING-1282 First pass at using credentials classes, concerned about impersonation."" This reverts commit 5a2ddc0a885709ef3753b15467b2e7f2329dc22a. Added: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/AdministrativeCredentials.java (with props) sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/AnonCredentials.java (with props) sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/CallbackHandlerWrapper.java (with props) sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/TrustedCredentials.java (with props) Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java sling/trunk/bundles/jcr/jackrabbit-server/pom.xml sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/PluggableDefaultLoginModule.java sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/OSGI-INF/metatype/metatype.properties sling/trunk/launchpad/builder/src/main/bundles/list.xml Modified: sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java?rev=902837&r1=902836&r2=902837&view=diff == --- sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java (original) +++ sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java Mon Jan 25 15:21:16 2010 @@ -201,8 +201,7 @@ public Session loginAdministrative(String workspace) throws RepositoryException { -SimpleCredentials sc = new SimpleCredentials(this.adminUser, -this.adminPass); +Credentials sc = getAdministrativeCredentials(this.adminUser); return this.login(sc, workspace); } @@ -226,7 +225,7 @@ } if (credentials == null) { -credentials = new SimpleCredentials(this.anonUser, this.anonPass); +credentials = getAnonCredentials(this.anonUser); } // check the workspace @@ -269,6 +268,26 @@ throw new RepositoryException(re.getMessage(), re); } } + +/** + * @param anonUser the user name of the anon user. + * @return a Credentials implementation that represents the anon user. + */ +protected Credent
svn commit: r902843 - in /sling/trunk: ./ launchpad/builder/ maven/maven-launchpad-plugin/src/main/resources/org/apache/sling/maven/projectsupport/ maven/maven-launchpad-plugin/src/test/java/org/apach
Author: justin Date: Mon Jan 25 15:40:05 2010 New Revision: 902843 URL: http://svn.apache.org/viewvc?rev=902843&view=rev Log: SLING-1310 - Changing artifactId of launchpad.builder to launchpad Modified: sling/trunk/launchpad/builder/pom.xml sling/trunk/maven/maven-launchpad-plugin/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java sling/trunk/pom.xml Modified: sling/trunk/launchpad/builder/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/pom.xml?rev=902843&r1=902842&r2=902843&view=diff == --- sling/trunk/launchpad/builder/pom.xml (original) +++ sling/trunk/launchpad/builder/pom.xml Mon Jan 25 15:40:05 2010 @@ -21,7 +21,7 @@ ../../parent/pom.xml -org.apache.sling.launchpad.builder +org.apache.sling.launchpad war 6-SNAPSHOT Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties?rev=902843&r1=902842&r2=902843&view=diff == --- sling/trunk/maven/maven-launchpad-plugin/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties (original) +++ sling/trunk/maven/maven-launchpad-plugin/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties Mon Jan 25 15:40:05 2010 @@ -15,6 +15,6 @@ # specific language governing permissions and limitations # under the License. base=org.apache.sling,org.apache.sling.launchpad.base,,jar,,0 -defaultBundles=org.apache.sling,org.apache.sling.launchpad.builder,RELEASE,jar,bundles,0 -defaultBundleList=org.apache.sling,org.apache.sling.launchpad.builder,RELEASE,xml,bundlelist,0 +defaultBundles=org.apache.sling,org.apache.sling.launchpad,RELEASE,jar,bundles,0 +defaultBundleList=org.apache.sling,org.apache.sling.launchpad,RELEASE,xml,bundlelist,0 jarWebSupport=org.ops4j.pax.web,pax-web-service,RELEASE,jar,,5 Modified: sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java?rev=902843&r1=902842&r2=902843&view=diff == --- sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java (original) +++ sling/trunk/maven/maven-launchpad-plugin/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java Mon Jan 25 15:40:05 2010 @@ -36,10 +36,10 @@ "org.apache.sling.launchpad.base", null, "jar", null, 0); makeArtifactAssertions(mojo, "defaultBundles", "org.apache.sling", - "org.apache.sling.launchpad.builder", "RELEASE", "jar", "bundles", 0); + "org.apache.sling.launchpad", "RELEASE", "jar", "bundles", 0); makeArtifactAssertions(mojo, "defaultBundleList", "org.apache.sling", -"org.apache.sling.launchpad.builder", "RELEASE", "xml", "bundlelist", 0); +"org.apache.sling.launchpad", "RELEASE", "xml", "bundlelist", 0); makeArtifactAssertions(mojo, "jarWebSupport", "org.ops4j.pax.web", "pax-web-service", "RELEASE", "jar", null, 5); Modified: sling/trunk/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/pom.xml?rev=902843&r1=902842&r2=902843&view=diff == --- sling/trunk/pom.xml (original) +++ sling/trunk/pom.xml Mon Jan 25 15:40:05 2010 @@ -128,8 +128,6 @@ launchpad/base launchpad/content launchpad/builder -launchpad/app -launchpad/webapp
svn commit: r902844 - /sling/trunk/pom.xml
Author: justin Date: Mon Jan 25 15:42:45 2010 New Revision: 902844 URL: http://svn.apache.org/viewvc?rev=902844&view=rev Log: SLING-1310 - correcting removal of launchpad/app and launchpad/webapp from root pom.xml Modified: sling/trunk/pom.xml Modified: sling/trunk/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/pom.xml?rev=902844&r1=902843&r2=902844&view=diff == --- sling/trunk/pom.xml (original) +++ sling/trunk/pom.xml Mon Jan 25 15:42:45 2010 @@ -128,6 +128,8 @@ launchpad/base launchpad/content launchpad/builder +launchpad/app +launchpad/webapp
svn commit: r902845 - in /sling/trunk: ./ launchpad/app/ launchpad/app/src/main/assembly/ launchpad/app/src/main/dist/bin/ launchpad/app/src/main/dist/dos/ launchpad/app/src/main/dist/unix/ launchpad/
Author: justin Date: Mon Jan 25 15:44:25 2010 New Revision: 902845 URL: http://svn.apache.org/viewvc?rev=902845&view=rev Log: SLING-1317 - removing launchpad/webapp and launchpad/app (new artifacts have artifactId org.apache.sling.launchpad and classifiers) Removed: sling/trunk/launchpad/app/LICENSE sling/trunk/launchpad/app/NOTICE sling/trunk/launchpad/app/README.txt sling/trunk/launchpad/app/assembly.xml sling/trunk/launchpad/app/pom.xml sling/trunk/launchpad/app/src/main/assembly/bin.xml sling/trunk/launchpad/app/src/main/dist/bin/sling.ico sling/trunk/launchpad/app/src/main/dist/bin/sling.jpg sling/trunk/launchpad/app/src/main/dist/bin/sling.png sling/trunk/launchpad/app/src/main/dist/dos/server.bat sling/trunk/launchpad/app/src/main/dist/unix/serverctl sling/trunk/launchpad/app/src/main/dist/unix/start sling/trunk/launchpad/app/src/main/dist/unix/stop sling/trunk/launchpad/webapp/LICENSE sling/trunk/launchpad/webapp/NOTICE sling/trunk/launchpad/webapp/README.txt sling/trunk/launchpad/webapp/pom.xml sling/trunk/launchpad/webapp/src/main/assembly/bin.xml Modified: sling/trunk/pom.xml Modified: sling/trunk/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/pom.xml?rev=902845&r1=902844&r2=902845&view=diff == --- sling/trunk/pom.xml (original) +++ sling/trunk/pom.xml Mon Jan 25 15:44:25 2010 @@ -128,8 +128,6 @@ launchpad/base launchpad/content launchpad/builder -launchpad/app -launchpad/webapp
svn commit: r902943 - /sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java
Author: justin Date: Mon Jan 25 19:32:05 2010 New Revision: 902943 URL: http://svn.apache.org/viewvc?rev=902943&view=rev Log: SLING-1303 - Fixing compilation problem with BSF Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java?rev=902943&r1=902942&r2=902943&view=diff == --- sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java (original) +++ sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java Mon Jan 25 19:32:05 2010 @@ -12,7 +12,7 @@ public class ProtectedBindings implements Bindings { private final Bindings wrapped; -private final Set protectedKeys; +private final Set protectedKeys; public ProtectedBindings(Bindings wrapped) { this.wrapped = wrapped; @@ -24,7 +24,7 @@ * * @throws an IllegalArgumentException if the key is protected */ -public Object put(String key, Object value) { +public Object put(Object key, Object value) { if (protectedKeys.contains(key)) { throw new IllegalArgumentException(String.format("Key %s is protected.", key)); } @@ -34,8 +34,8 @@ /** * {...@inheritdoc} */ -public void putAll(Map toMerge) { -for (String key : toMerge.keySet()) { +public void putAll(Map toMerge) { +for (Object key : toMerge.keySet()) { if (!protectedKeys.contains(key)) { wrapped.put(key, toMerge.get(key)); } @@ -74,7 +74,7 @@ * * @return an unmodifiable Set view of the map */ -public Set> entrySet() { +public Set> entrySet() { return Collections.unmodifiableSet(wrapped.entrySet()); } @@ -91,7 +91,7 @@ * * @return an unmodifiable Set view of the map's keys */ -public Set keySet() { +public Set keySet() { return Collections.unmodifiableSet(wrapped.keySet()); }
svn commit: r902942 - in /sling/trunk: bundles/scripting/api/src/main/java/org/apache/sling/scripting/api/ bundles/scripting/core/ bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/
Author: justin Date: Mon Jan 25 19:31:55 2010 New Revision: 902942 URL: http://svn.apache.org/viewvc?rev=902942&view=rev Log: initial impl of SLING-1303 Added: sling/trunk/bundles/scripting/api/src/main/java/org/apache/sling/scripting/api/BindingsValuesProvider.java sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/GroovyBindingsValuesProvider.java sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/StringBindingsValuesProvider.java sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.esp sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.groovy Modified: sling/trunk/bundles/scripting/core/pom.xml sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java sling/trunk/launchpad/test-services/pom.xml Added: sling/trunk/bundles/scripting/api/src/main/java/org/apache/sling/scripting/api/BindingsValuesProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/api/src/main/java/org/apache/sling/scripting/api/BindingsValuesProvider.java?rev=902942&view=auto == --- sling/trunk/bundles/scripting/api/src/main/java/org/apache/sling/scripting/api/BindingsValuesProvider.java (added) +++ sling/trunk/bundles/scripting/api/src/main/java/org/apache/sling/scripting/api/BindingsValuesProvider.java Mon Jan 25 19:31:55 2010 @@ -0,0 +1,40 @@ +/* + * 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.scripting.api; + +import javax.script.Bindings; + +/** + * Service interface which allows for the Bindings object + */ +public interface BindingsValuesProvider { + +/** + * Add objects to the Bindings object. The Bindings + * object passed to this method does not support replacing + * or removing entries provided by Sling core scripting supports + * (request, response, resource, etc.). Entries created by + * other implementations of SlingScriptBindingsValuesProvider + * is permitted. + * + * @param bindings the Bindings object + */ +void addBindings(Bindings bindings); + +} Modified: sling/trunk/bundles/scripting/core/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/pom.xml?rev=902942&r1=902941&r2=902942&view=diff == --- sling/trunk/bundles/scripting/core/pom.xml (original) +++ sling/trunk/bundles/scripting/core/pom.xml Mon Jan 25 19:31:55 2010 @@ -7,9 +7,9 @@ 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 @@ -138,7 +138,7 @@ org.apache.sling org.apache.sling.scripting.api -2.0.2-incubator +2.0.3-SNAPSHOT provided Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java?rev=902942&r1=902941&r2=902942&view=diff == --- sling/trunk/bundles/sc
svn commit: r902945 - in /sling/trunk: bundles/scripting/api/pom.xml bundles/scripting/core/pom.xml launchpad/builder/src/main/bundles/list.xml
Author: justin Date: Mon Jan 25 19:32:13 2010 New Revision: 902945 URL: http://svn.apache.org/viewvc?rev=902945&view=rev Log: SLING-1318 - switching out BSF for Livetribe Modified: sling/trunk/bundles/scripting/api/pom.xml sling/trunk/bundles/scripting/core/pom.xml sling/trunk/launchpad/builder/src/main/bundles/list.xml Modified: sling/trunk/bundles/scripting/api/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/api/pom.xml?rev=902945&r1=902944&r2=902945&view=diff == --- sling/trunk/bundles/scripting/api/pom.xml (original) +++ sling/trunk/bundles/scripting/api/pom.xml Mon Jan 25 19:32:13 2010 @@ -7,9 +7,9 @@ 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 @@ -74,10 +74,10 @@ -org.apache.bsf -bsf-api -3.0-beta2 -compile + org.livetribe + livetribe-jsr223 + 2.0.6 + compile @@ -98,6 +98,5 @@ junit junit - Modified: sling/trunk/bundles/scripting/core/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/pom.xml?rev=902945&r1=902944&r2=902945&view=diff == --- sling/trunk/bundles/scripting/core/pom.xml (original) +++ sling/trunk/bundles/scripting/core/pom.xml Mon Jan 25 19:32:13 2010 @@ -69,38 +69,6 @@ - - - -org.apache.maven.plugins -maven-dependency-plugin - - -get-bsf3-api - -copy - - - - -org.apache.bsf -bsf-api -3.0-beta2 - - -true - - - - - -org.apache.maven.plugins -maven-compiler-plugin - - - -Xbootclasspath/p:${project.build.directory}/dependency/bsf-api.jar - - Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=902945&r1=902944&r2=902945&view=diff == --- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original) +++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Mon Jan 25 19:32:13 2010 @@ -125,7 +125,7 @@ org.apache.sling org.apache.sling.scripting.api -2.0.2-incubator +2.0.3-SNAPSHOT org.apache.sling
svn commit: r902946 - in /sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl: SlingScriptAdapterFactory.java helper/ProtectedBindings.java
Author: justin Date: Mon Jan 25 19:32:22 2010 New Revision: 902946 URL: http://svn.apache.org/viewvc?rev=902946&view=rev Log: SLING-1303 SLING-1318 - upgrading SLING-1303 modifications to use generics Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java?rev=902946&r1=902945&r2=902946&view=diff == --- sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java (original) +++ sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java Mon Jan 25 19:32:22 2010 @@ -22,7 +22,6 @@ import java.io.InputStreamReader; import java.net.URL; import java.util.Collection; -import java.util.Collections; import java.util.Dictionary; import java.util.HashMap; import java.util.HashSet; Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java?rev=902946&r1=902945&r2=902946&view=diff == --- sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java (original) +++ sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/helper/ProtectedBindings.java Mon Jan 25 19:32:22 2010 @@ -2,17 +2,15 @@ import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.script.Bindings; -...@suppresswarnings("restriction") public class ProtectedBindings implements Bindings { private final Bindings wrapped; -private final Set protectedKeys; +private final Set protectedKeys; public ProtectedBindings(Bindings wrapped) { this.wrapped = wrapped; @@ -24,7 +22,7 @@ * * @throws an IllegalArgumentException if the key is protected */ -public Object put(Object key, Object value) { +public Object put(String key, Object value) { if (protectedKeys.contains(key)) { throw new IllegalArgumentException(String.format("Key %s is protected.", key)); } @@ -34,8 +32,8 @@ /** * {...@inheritdoc} */ -public void putAll(Map toMerge) { -for (Object key : toMerge.keySet()) { +public void putAll(Map toMerge) { +for (String key : toMerge.keySet()) { if (!protectedKeys.contains(key)) { wrapped.put(key, toMerge.get(key)); } @@ -74,7 +72,7 @@ * * @return an unmodifiable Set view of the map */ -public Set> entrySet() { +public Set> entrySet() { return Collections.unmodifiableSet(wrapped.entrySet()); } @@ -91,7 +89,7 @@ * * @return an unmodifiable Set view of the map's keys */ -public Set keySet() { +public Set keySet() { return Collections.unmodifiableSet(wrapped.keySet()); }
svn commit: r902947 - /sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java
Author: justin Date: Mon Jan 25 19:32:30 2010 New Revision: 902947 URL: http://svn.apache.org/viewvc?rev=902947&view=rev Log: SLING-1303 - switching to servicetracker from scr due to need to get access to the ServiceReference obj Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java?rev=902947&r1=902946&r2=902947&view=diff == --- sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java (original) +++ sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java Mon Jan 25 19:32:30 2010 @@ -52,6 +52,7 @@ import org.osgi.service.event.Event; import org.osgi.service.event.EventAdmin; import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,17 +73,12 @@ * @scr.reference name="ScriptEngineFactory" *interface="javax.script.ScriptEngineFactory" *cardinality="0..n" policy="dynamic" - * @scr.reference name="BindingsValuesProvider" - * interface="org.apache.sling.scripting.api.BindingsValuesProvider" - *cardinality="0..n" policy="dynamic" */ -public class SlingScriptAdapterFactory implements AdapterFactory, -MimeTypeProvider, BundleListener { +public class SlingScriptAdapterFactory implements AdapterFactory, MimeTypeProvider, BundleListener { private final Logger log = LoggerFactory.getLogger(SlingScriptAdapterFactory.class); -private static final String ENGINE_FACTORY_SERVICE = "META-INF/services/" -+ ScriptEngineFactory.class.getName(); +private static final String ENGINE_FACTORY_SERVICE = "META-INF/services/" + ScriptEngineFactory.class.getName(); private ScriptEngineManager scriptEngineManager; @@ -92,20 +88,30 @@ private BundleContext bundleContext; -/** The service tracker for the event admin +/** + * The service tracker for the event admin */ private ServiceTracker eventAdminTracker; +/** + * The service tracker for BindingsValuesProvider impls + */ +private ServiceTracker bindingsValuesProviderTracker; + +/** + * The BindingsValuesProvider impls which apply to all languages + */ private Collection genericBindingsValuesProviders; +/** + * The BindingsValuesProvider impls which apply to a specific language + */ private Map> langBindingsValuesProviders; - // -- AdapterFactory --- @SuppressWarnings("unchecked") -public AdapterType getAdapter(Object adaptable, -Class type) { +public AdapterType getAdapter(Object adaptable, Class type) { Resource resource = (Resource) adaptable; String path = resource.getPath(); @@ -113,17 +119,15 @@ ScriptEngine engine = getScriptEngineManager().getEngineByExtension(ext); if (engine != null) { -Collection bindingsValuesProviders = -getBindingsValuesProviders(engine); +Collection bindingsValuesProviders = getBindingsValuesProviders(engine.getFactory()); // unchecked cast -return (AdapterType) new DefaultSlingScript(this.bundleContext, -resource, engine, bindingsValuesProviders); +return (AdapterType) new DefaultSlingScript(this.bundleContext, resource, engine, bindingsValuesProviders); } return null; } -/* package */ ScriptEngineManager getScriptEngineManager() { +/* package */ScriptEngineManager getScriptEngineManager() { if (scriptEngineManager == null) { // create (empty) script engine manager @@ -150,15 +154,10 @@ final String ext = o.toString(); final ScriptEngine e = scriptEngineManager.getEngineByExtension(ext); if (e == null) { -log.warn( -"No ScriptEngine found for extension '{}' that was just registered", -ext); +log.warn("No ScriptEngine found for extension '{}' that was just registered", ext); } else { -log.info( -"Script extension '{}' is now handled by ScriptEngine '{}', version='{}', class='{}'", -new Object[] { ext, e.getFactory().getEngineName(), -
svn commit: r902949 - in /sling/trunk/launchpad/testing/src/test: java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java resources/integration-test/bindingsprovid
Author: justin Date: Mon Jan 25 19:32:39 2010 New Revision: 902949 URL: http://svn.apache.org/viewvc?rev=902949&view=rev Log: SLING-1303 - switching esp test to use typeof as we're testing for an undefined value Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.esp Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java?rev=902949&r1=902948&r2=902949&view=diff == --- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java (original) +++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java Mon Jan 25 19:32:39 2010 @@ -52,7 +52,7 @@ final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML); assertTrue("Content includes ESP marker (" + content + ")",content.contains("ESP template")); assertTrue("Content includes test text (" + content + ")", content.contains("Hello World!")); -assertFalse("Content doesn't include Groovy-specific test text (" + content + ")", content.contains("Hello World from Groovy!")); +assertTrue("Content doesn't include Groovy-specific test text (" + content + ")", content.contains("groovyHelloWorld:undefined")); } finally { testClient.delete(toDelete); } Modified: sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.esp URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.esp?rev=902949&r1=902948&r2=902949&view=diff == --- sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.esp (original) +++ sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.esp Mon Jan 25 19:32:39 2010 @@ -22,6 +22,6 @@ ESP template helloWorld:<%= helloWorld %> - groovyHelloWorld:<%= groovyHelloWorld %> + groovyHelloWorld:<%= typeof(groovyHelloWorld) %>
svn commit: r902950 - /sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
Author: justin Date: Mon Jan 25 19:32:47 2010 New Revision: 902950 URL: http://svn.apache.org/viewvc?rev=902950&view=rev Log: SLING-1319 - adding script names for JSP Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java?rev=902950&r1=902949&r2=902950&view=diff == --- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java (original) +++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java Mon Jan 25 19:32:47 2010 @@ -102,8 +102,11 @@ public static final String[] SCRIPT_TYPE = { "jsp", "jspf", "jspx" }; +public static final String[] NAMES = { "jsp", "JSP" }; + public JspScriptEngineFactory() { setExtensions(SCRIPT_TYPE); +setNames(NAMES); } public ScriptEngine getScriptEngine() {
svn commit: r902952 - /sling/trunk/launchpad/builder/src/main/bundles/list.xml
Author: justin Date: Mon Jan 25 19:33:08 2010 New Revision: 902952 URL: http://svn.apache.org/viewvc?rev=902952&view=rev Log: SLING-1303 - upgrading to latest JSP bundle (for SLING-1319 change) Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=902952&r1=902951&r2=902952&view=diff == --- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original) +++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Mon Jan 25 19:33:08 2010 @@ -140,7 +140,7 @@ org.apache.sling org.apache.sling.scripting.jsp -2.0.8 +2.0.9-SNAPSHOT org.apache.sling
svn commit: r902951 - in /sling/trunk/launchpad: test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/ testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/
Author: justin Date: Mon Jan 25 19:33:01 2010 New Revision: 902951 URL: http://svn.apache.org/viewvc?rev=902951&view=rev Log: SLING-1303 - adding JSP test case Added: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/JSPBindingsValuesProvider.java sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.jsp Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java Added: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/JSPBindingsValuesProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/JSPBindingsValuesProvider.java?rev=902951&view=auto == --- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/JSPBindingsValuesProvider.java (added) +++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/scripting/JSPBindingsValuesProvider.java Mon Jan 25 19:33:01 2010 @@ -0,0 +1,39 @@ +package org.apache.sling.launchpad.testservices.scripting; + +/* + * 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. + */ + +import javax.script.Bindings; + +import org.apache.sling.scripting.api.BindingsValuesProvider; +/** Example/test BindingsValuesProvider targeting JSP scripts. +* +* @scr.component immediate="true" metatype="no" +* @scr.service +* +* @scr.property name="service.description" value="JSP BindingsValuesProvider" +* @scr.property name="service.vendor" value="The Apache Software Foundation" +* +* @scr.property name="javax.script.name" value="JSP" +*/ +public class JSPBindingsValuesProvider implements BindingsValuesProvider { + +public void addBindings(Bindings bindings) { + bindings.put("jspHelloWorld", "Hello World from JSP!"); +} + +} Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java?rev=902951&r1=902950&r2=902951&view=diff == --- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java (original) +++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBindingsValuesProviderTest.java Mon Jan 25 19:33:01 2010 @@ -70,4 +70,17 @@ } } +public void testJSPProvider() throws IOException { +final String toDelete = uploadTestScript("bindingsprovided.jsp","html.jsp"); +try { +final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML); +assertTrue("Content includes JSP marker (" + content + ")",content.contains("bindingsprovided.jsp")); +assertTrue("Content includes test text (" + content + ")", content.contains("Hello World!")); +assertTrue("Content includes JSP-specific test text (" + content + ")", content.contains("Hello World from JSP!")); +assertFalse("Content doesn't includes Groovy-specific test text (" + content + ")", content.contains("Hello World from Groovy!")); +} finally { +testClient.delete(toDelete); +} +} + } Added: sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.jsp URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.jsp?rev=902951&view=auto == --- sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.jsp (added) +++ sling/trunk/launchpad/testing/src/test/resources/integration-test/bindingsprovided.jsp Mon Jan 25 19:33:01 2010 @@ -0,0 +1,31 @@ + + +<%...@page sess
svn commit: r902962 - in /sling/trunk: bundles/commons/json/ bundles/commons/json/src/main/java/org/apache/sling/commons/json/groovy/internal/ launchpad/testing/src/test/resources/integration-test/
Author: justin Date: Mon Jan 25 20:03:15 2010 New Revision: 902962 URL: http://svn.apache.org/viewvc?rev=902962&view=rev Log: SLING-1320 - adding script binding for JSONGroovyBuilder Added: sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/groovy/internal/ sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/groovy/internal/JSONGroovyBuilderBindingsValuesProvider.java Modified: sling/trunk/bundles/commons/json/pom.xml sling/trunk/launchpad/testing/src/test/resources/integration-test/builder.groovy Modified: sling/trunk/bundles/commons/json/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/json/pom.xml?rev=902962&r1=902961&r2=902962&view=diff == --- sling/trunk/bundles/commons/json/pom.xml (original) +++ sling/trunk/bundles/commons/json/pom.xml Mon Jan 25 20:03:15 2010 @@ -44,11 +44,15 @@ org.apache.felix +maven-scr-plugin + + +org.apache.felix maven-bundle-plugin true - groovy.*;resolution:=optional,* + groovy.*;resolution:=optional,org.apache.sling.scripting.api.*;resolution:=optional,* org.apache.sling.commons.json.*;version=${pom.version} @@ -82,6 +86,12 @@ provided +org.apache.sling +org.apache.sling.scripting.api +2.0.3-SNAPSHOT +provided + + org.slf4j slf4j-api Added: sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/groovy/internal/JSONGroovyBuilderBindingsValuesProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/groovy/internal/JSONGroovyBuilderBindingsValuesProvider.java?rev=902962&view=auto == --- sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/groovy/internal/JSONGroovyBuilderBindingsValuesProvider.java (added) +++ sling/trunk/bundles/commons/json/src/main/java/org/apache/sling/commons/json/groovy/internal/JSONGroovyBuilderBindingsValuesProvider.java Mon Jan 25 20:03:15 2010 @@ -0,0 +1,44 @@ +/* + * 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.commons.json.groovy.internal; + +import javax.script.Bindings; + +import org.apache.sling.commons.json.groovy.JSONGroovyBuilder; +import org.apache.sling.scripting.api.BindingsValuesProvider; + +/** + * BindingsValuesProvider which binds an instance of JSONGroovyBuilder. + * + * @scr.component immediate="true" metatype="no" + * @scr.service + * + * @scr.property name="service.description" value="JSONGroovyBuilder BindingsValuesProvider" + * @scr.property name="service.vendor" value="The Apache Software Foundation" + * + * @scr.property name="javax.script.name" value="groovy" + */ +public class JSONGroovyBuilderBindingsValuesProvider implements BindingsValuesProvider { + +/** + * {...@inheritdoc} + */ +public void addBindings(Bindings bindings) { +bindings.put("jsonBuilder", new JSONGroovyBuilder()); +} + +} Modified: sling/trunk/launchpad/testing/src/test/resources/integration-test/builder.groovy URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/resources/integration-test/builder.groovy?rev=902962&r1=902961&r2=902962&view=diff == --- sling/trunk/launchpad/testing/src/test/resources/integration-test/builder.groovy (original) +++ sling/trunk/launchpad/testing/src/test/resources/integration-test/builder.groovy Mon Jan 25 20:03:15 2010 @@ -17,8 +17,6 @@ * under the License. */ -builder = new org.apache.sling.commons.json.groovy.JSONGroovyBuilder() - -out.write builder.json { +out.write jsonBuilder.json { text currentNode.getProperty("text").stri
[CONF] Apache Sling > Adding New Scripting Variables
Adding New Scripting Variables Page added by Justin Edelson As of r902947, Sling Scripting allows bundles to contribute objects to the variables available to scripts. This is done by implementing the interface org.apache.sling.scripting.api.BindingsValuesProvider and exposing the implementation as an OSGi Service. Implementations are able to add one or more name/value pairs to the javax.script.Bindings object, but they cannot overwrite or remove any of the default scripting variables (defined here: Scripting variables). These custom bindings can be configured to apply to any scripting language or a specific scripting language. An example of the binding of a custom object can be found in the commons.json bundle (source): import javax.script.Bindings; import org.apache.sling.commons.json.groovy.JSONGroovyBuilder; import org.apache.sling.scripting.api.BindingsValuesProvider; /** * BindingsValuesProvider which binds an instance of JSONGroovyBuilder. * * @scr.component immediate="true" metatype="no" * @scr.service * * @scr.property name="service.description" value="JSONGroovyBuilder BindingsValuesProvider" * @scr.property name="service.vendor" value="The Apache Software Foundation" * * @scr.property name="javax.script.name" value="groovy" */ public class JSONGroovyBuilderBindingsValuesProvider implements BindingsValuesProvider { /** * {...@inheritdoc} */ public void addBindings(Bindings bindings) { bindings.put("jsonBuilder", new JSONGroovyBuilder()); } } In this example, the jsonBuilder key is bound to an instance of JSONGroovyBuilder only for Groovy scripts. Change Notification Preferences View Online | Add Comment
[CONF] Apache Sling > Scripting variables
Scripting variables Page edited by Justin Edelson Common scripting variables The basic objects, such as the request and response, are available for most scripting languages (Note the differences for eg. JSP below). Name Description request SlingHttpServletRequest object, providing access to the HTTP request header information - extends the standard HttpServletRequest - and provides access to Sling-specific things like resource, path info, selector, etc. response SlingHttpServletResponse object, providing access for the HTTP response that is created by the server. This is currently the same as the HttpServletResponse from which it extends. sling SlingScriptHelper, containing convenience methods for scripts, mainly sling.include('/some/other/resource') for including the responses of other resources inside this response (eg. embedding header html snippets) and sling.getService(foo.bar.Service.class) to retrieve OSGi services available in Sling (Class notation depending on scripting language). resource Current Resource to handle, depending on the URL of the request. Same as request.getResource(). reader Direct access to the Reader of the request - same as request.getReader(). Use it for reading the data of an HTTP request body. out Direct access to the PrintWriter of the response - same as response.getWriter(). Use it for writing to the HTTP response body. flush Indicates whether the output used by the script shall be flushed after the script evaluation ended. It is a Boolean, so use TRUE for flushing or FALSE for not flushing, which is the default value. The boolean value notation depends on the scripting language. log Provides an SLF4J Logger for logging to the Sling log system from within scripts, eg. log.info("Executing my script"). See also the api documentation of the org.apache.sling.api.scripting.SlingBindings.java which defines the common scripting variables. This list can be expanded by bundles. See Adding New Scripting Variables for information. In addition currently the currentNode binding is supported by most scripting languages. If the current resource points to a JCR node (which is typically the case in Sling), this gives you direct access to the Node object. Otherwise this object is not defined. However, we discourage using this variable as this directly binds you to the jcr api and makes your script unusable with other data sources supported by Sling. The better approach is to rely on the resource and the value map. Have a look at the ResourceUtil class for more information. JSP Since JSPs already have a few Java-objects pre-defined, things have to be named differently here. And you will have to explicitly require the variables to be defined with a custom tag . Your jsp should start with: <%@ page session="false" %> <%@ page import="javax.jcr.*, org.apache.sling.api.resource.Resource" %> <%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %> slingRequest SlingHttpServletRequest object, providing access to the HTTP request header information - extends the standard HttpServletRequest - and provides access to Sling-specific things like resource, path info, selector, etc. slingResponse SlingHttpServletResponse object, providing access for the HTTP response that is created by the server. This is currently the same as the HttpServletResponse from which it extends. request The standard JSP request object which is a pure HttpServletRequest. response The standard JSP response object which is a pure HttpServletResponse. resourceResolver Current ResourceResolver. Same as slingRequest.getResourceResolver(). sling SlingScriptHelper, containing convenience methods for scripts, mainly sling.include('/some/other/resource') for including the responses of other resources inside this response (eg. embedding header html snippets) and sling.getService(foo.bar.Service.class) to retrieve OSGi services available in Sling (Class notation depending on scripting language). resource Current Resource to handle, depending on the URL of the request. Same as slingRequest.getResource(). log Provides an SLF4J Logger for logging to the Sling log system from within scripts, eg. log.info("Executing my script"). In addition currently the currentNode binding is supported. If the current resource points to a JCR node (which is typically the case in Sling), this gives you direct access to the Node object. Otherwise this object is not defined. However, we discourage using this variable as this directly binds you to the jcr api and makes your script unusable with other data sources supported by Sling. The better approach is to rely on the resource and the value map. Have a look at the ResourceUtil class for more information. Resource Inclusion Instead of sling.include("/path/to/resource") you can use the sling taglib f
svn commit: r902967 - in /sling/trunk/bundles: jcr/resource/ jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/ scripting/core/ scripting/core/src/main/java/org/apache/sling/
Author: justin Date: Mon Jan 25 20:34:23 2010 New Revision: 902967 URL: http://svn.apache.org/viewvc?rev=902967&view=rev Log: SLING-1304 - moving currentNode script binding to jcr.resource bundle Added: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java Modified: sling/trunk/bundles/jcr/resource/pom.xml sling/trunk/bundles/scripting/core/pom.xml sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/DefaultSlingScript.java Modified: sling/trunk/bundles/jcr/resource/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/pom.xml?rev=902967&r1=902966&r2=902967&view=diff == --- sling/trunk/bundles/jcr/resource/pom.xml (original) +++ sling/trunk/bundles/jcr/resource/pom.xml Mon Jan 25 20:34:23 2010 @@ -7,9 +7,9 @@ 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 @@ -59,6 +59,9 @@ true + + org.apache.sling.scripting.api.*;resolution:=optional,* + org.apache.sling.jcr.resource;version=${pom.version} @@ -115,6 +118,12 @@ 2.0.8 provided + +org.apache.sling +org.apache.sling.scripting.api +2.0.3-SNAPSHOT +provided + javax.jcr jcr @@ -173,7 +182,7 @@ 1.6.0 provided - + org.apache.sling Added: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java?rev=902967&view=auto == --- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java (added) +++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java Mon Jan 25 20:34:23 2010 @@ -0,0 +1,48 @@ +/* + * 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.jcr.resource.internal.scripting; + +import javax.jcr.Node; +import javax.script.Bindings; + +import org.apache.sling.api.resource.Resource; +import org.apache.sling.scripting.api.BindingsValuesProvider; + +/** + * BindingsValuesProvider for currentNode object. + * + * @scr.component immediate="true" metatype="no" + * @scr.service + * + * @scr.property name="service.description" value="CurrentNode BindingsValuesProvider" + * @scr.property name="service.vendor" value="The Apache Software Foundation" + */ +public class CurrentNodeBindingsValuesProvider implements BindingsValuesProvider { + +/** + * {...@inheritdoc} + */ +public void addBindings(Bindings bindings) { +Resource resource = (Resource) bindings.get("resource"); +Node node = resource.adaptTo(Node.class); +if (node != null) { +bindings.put("currentNode", node); +} + +} + +} Modified: sling/trunk/bundles/scripting/core/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/pom.xml?rev=902967&r1=902966&r2=902967&view=diff == --- sling/trunk
svn commit: r902985 - /sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
Author: justin Date: Mon Jan 25 21:39:32 2010 New Revision: 902985 URL: http://svn.apache.org/viewvc?rev=902985&view=rev Log: SLING-1322 - adding check to avoid loading launchpad artifact if it's the same as the current project's Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java?rev=902985&r1=902984&r2=902985&view=diff == --- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java (original) +++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java Mon Jan 25 21:39:32 2010 @@ -53,28 +53,28 @@ /** * The name of the directory within the output directory into which the base * JAR should be installed. - * + * * @parameter default-value="resources" */ protected String baseDestination; /** * The directory which contains the start-level bundle directories. - * + * * @parameter default-value="bundles" */ protected String bundlesDirectory; /** * The definition of the defaultBundleList artifact. - * + * * @parameter */ private ArtifactDefinition defaultBundleList; /** * The definition of the defaultBundles package. - * + * * @parameter */ private ArtifactDefinition defaultBundles; @@ -86,7 +86,7 @@ /** * To look up Archiver/UnArchiver implementations - * + * * @component */ private ArchiverManager archiverManager; @@ -98,7 +98,7 @@ /** * The Maven project. - * + * * @parameter expression="${project}" * @required * @readonly @@ -107,14 +107,14 @@ /** * Used to look up Artifacts in the remote repository. - * + * * @component */ private ArtifactFactory factory; /** * Location of the local repository. - * + * * @parameter expression="${localRepository}" * @readonly * @required @@ -133,7 +133,7 @@ /** * List of Remote Repositories used by the resolver. - * + * * @parameter expression="${project.remoteArtifactRepositories}" * @readonly * @required @@ -142,7 +142,7 @@ /** * Used to look up Artifacts in the remote repository. - * + * * @component */ private ArtifactResolver resolver; @@ -252,7 +252,7 @@ return readBundleList(bundleListFile); } - + protected void outputBundleList(File outputDirectory) throws MojoExecutionException { try { @@ -273,30 +273,39 @@ bundleListFile), e); } -try { -Artifact artifact = getArtifact(defaultBundleList.getGroupId(), -defaultBundleList.getArtifactId(), defaultBundleList -.getVersion(), defaultBundleList.getType(), -defaultBundleList.getClassifier()); -getLog().info( -"Using bundle list file from " -+ artifact.getFile().getAbsolutePath()); -BundleList bundles = readBundleList(artifact.getFile()); -copyBundles(bundles, outputDirectory); -return; -} catch (Exception e) { -getLog() -.warn( -"Unable to load bundle list from artifact. Falling back to bundle jar", -e); +if (!isCurrentArtifact(defaultBundleList)) { +try { +Artifact artifact = getArtifact(defaultBundleList.getGroupId(), +defaultBundleList.getArtifactId(), defaultBundleList +.getVersion(), defaultBundleList.getType(), +defaultBundleList.getClassifier()); +getLog().info( +"Using bundle list file from " ++ artifact.getFile().getAbsolutePath()); +BundleList bundles = readBundleList(artifact.getFile()); +copyBundles(bundles, outputDirectory); +return; +} catch (Exception e) { +getLog() +.warn( +"Unable to load bundle list from artifact. Falling back to bundle jar", +e); +} } -Artifact defaultBundlesArtifact = getA
svn commit: r902989 - /sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
Author: justin Date: Mon Jan 25 21:53:05 2010 New Revision: 902989 URL: http://svn.apache.org/viewvc?rev=902989&view=rev Log: SLING-1322 - removing extraneous project variable Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java?rev=902989&r1=902988&r2=902989&view=diff == --- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java (original) +++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java Mon Jan 25 21:53:05 2010 @@ -29,7 +29,7 @@ /** * Initialize a Sling application project by extracting bundles into the correct * locations. - * + * * @goal prepare-package * @requiresDependencyResolution test * @phase process-sources @@ -39,14 +39,14 @@ /** * Any additional bundles to include in the project's bundles directory. -* +* * @parameter */ private ArtifactDefinition[] additionalBundles; /** * If true, install the default bundles. -* +* * @parameter default-value="true" */ private boolean installDefaultBundles; @@ -55,29 +55,21 @@ * The output directory for the default bundles in a WAR-packaged project, * the base JAR (in the subdirectory named in the baseDestination * parameter), and any additional bundles. -* +* * @parameter default-value="${project.build.directory}/launchpad-bundles" */ private File warOutputDirectory; /** -* The Maven project. -* -* @parameter expression="${project}" -* @readonly -*/ - private MavenProject project; - - /** * The project's packaging type. -* +* * @parameter expression="${project.packaging}" */ private String packaging; /** * The definition of the base JAR. -* +* * @parameter */ private ArtifactDefinition base; @@ -85,14 +77,14 @@ /** * The definition of the package to be included to provide web support for * JAR-packaged projects (i.e. pax-web). -* +* * @parameter */ private ArtifactDefinition jarWebSupport; /** * The project's build output directory (i.e. target/classes). -* +* * @parameter expression="${project.build.outputDirectory}" * @readonly */ @@ -179,7 +171,7 @@ return buildOutputDirectory; } } - + protected void initArtifactDefinitions(Properties dependencies) { @@ -193,7 +185,7 @@ } jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport")); } - + private void unpackBaseArtifact() throws MojoExecutionException { Artifact artifact = getBaseDependency(); if (artifact == null) {
svn commit: r903004 - /sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
Author: justin Date: Mon Jan 25 22:45:16 2010 New Revision: 903004 URL: http://svn.apache.org/viewvc?rev=903004&view=rev Log: SLING-1323 - adding "bundlesToRemove" option Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java?rev=903004&r1=903003&r2=903004&view=diff == --- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java (original) +++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java Mon Jan 25 22:45:16 2010 @@ -23,7 +23,7 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; /** @@ -45,6 +45,13 @@ private ArtifactDefinition[] additionalBundles; /** +* Bundles which should be removed from the project's bundles directory. +* +* @parameter +*/ + private ArtifactDefinition[] bundlesToRemove; + + /** * If true, install the default bundles. * * @parameter default-value="true" @@ -97,11 +104,30 @@ } copyAdditionalBundles(); copyWebSupportBundle(); + removeBundles(); if (JAR.equals(packaging)) { unpackBaseArtifact(); } } + private void removeBundles() throws MojoExecutionException { + if (bundlesToRemove != null) { + File bundleBaseDir = new File(getOutputDirectory(), String.format( + "%s/%s", baseDestination, bundlesDirectory)); + + for (ArtifactDefinition def : bundlesToRemove) { + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir(bundleBaseDir); + scanner.setIncludes(new String[] { "**/" + def.getArtifactId() + "-*.*"}); + scanner.scan(); + for (String toRemove : scanner.getIncludedFiles()) { + getLog().info("Deleting " + toRemove); + new File(toRemove).delete(); + } + } + } + } + private void copyAdditionalBundles() throws MojoExecutionException { if (additionalBundles != null) { for (int i = 0; i < additionalBundles.length; i++) {
svn commit: r903111 - /sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java
Author: fmeschbe Date: Tue Jan 26 07:39:10 2010 New Revision: 903111 URL: http://svn.apache.org/viewvc?rev=903111&view=rev Log: SLING-1326 use ConcurrentHashMap instead of HashMap to prevent concurrency issues accessing the configurations. Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java?rev=903111&r1=903110&r2=903111&view=diff == --- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java (original) +++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/internal/slf4j/LogConfigManager.java Tue Jan 26 07:39:10 2010 @@ -23,11 +23,11 @@ import java.lang.ref.SoftReference; import java.util.Collection; import java.util.Dictionary; -import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import org.apache.sling.commons.log.internal.LogManager; import org.osgi.service.cm.ConfigurationException; @@ -95,11 +95,11 @@ * and logger configuration */ private LogConfigManager() { -writerByPid = new HashMap(); -writerByFileName = new HashMap(); -configByPid = new HashMap(); -configByCategory = new HashMap(); -loggersByCategory = new HashMap>(); +writerByPid = new ConcurrentHashMap(); +writerByFileName = new ConcurrentHashMap(); +configByPid = new ConcurrentHashMap(); +configByCategory = new ConcurrentHashMap(); +loggersByCategory = new ConcurrentHashMap>(); // configure the default writer to write to stdout (for now) // and register for PID only
svn commit: r903115 - /sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java
Author: cziegeler Date: Tue Jan 26 07:52:22 2010 New Revision: 903115 URL: http://svn.apache.org/viewvc?rev=903115&view=rev Log: SLING-1325 : Bundle deploy fails utterly if any XML files contains an element named "type" - throw exception now instead of an NPE. Modified: sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java Modified: sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java?rev=903115&r1=903114&r2=903115&view=diff == --- sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java (original) +++ sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/readers/XmlReader.java Tue Jan 26 07:52:22 2010 @@ -156,10 +156,10 @@ /** - * @see org.apache.sling.jcr.contentloader.internal.ContentReader#parse(java.net.URL, org.apache.sling.jcr.contentloader.internal.ContentCreator) + * @see org.apache.sling.jcr.contentloader.internal.ContentReader#parse(URL, org.apache.sling.jcr.contentloader.internal.ContentCreator) */ -public synchronized void parse(java.net.URL url, ContentCreator creator) -throws IOException, RepositoryException { +public synchronized void parse(final URL url, final ContentCreator creator) +throws IOException, RepositoryException { BufferedInputStream bufferedInput = null; try { // We need to buffer input, so that we can reset the stream if we encounter an XSL stylesheet reference @@ -172,8 +172,11 @@ } } -private void parseInternal(InputStream bufferedInput, ContentCreator creator, java.net.URL xmlLocation) throws XmlPullParserException, IOException, RepositoryException { -final StringBuffer contentBuffer = new StringBuffer(); +private void parseInternal(final InputStream bufferedInput, + final ContentCreator creator, + final URL xmlLocation) +throws XmlPullParserException, IOException, RepositoryException { +final StringBuilder contentBuffer = new StringBuilder(); // Mark the beginning of the stream. We assume that if there's an XSL processing instruction, // it will occur in the first gulp - which makes sense, as processing instructions must be // specified before the root elemeent of an XML file. @@ -223,7 +226,7 @@ } else if (ELEM_FILE_NAME.equals(currentElement) && ELEM_FILE_NAMESPACE.equals(this.xmlParser.getNamespace())) { int attributeCount = this.xmlParser.getAttributeCount(); if (attributeCount < 2 || attributeCount > 3) { -throw new IOException("File element must have these attributes: url, mimeType and lastModified"); +throw new IOException("File element must have these attributes: url, mimeType and lastModified: " + xmlLocation); } try { AttributeMap attributes = AttributeMap.getInstance(); @@ -232,7 +235,7 @@ FileDescription.SHARED.setValues(attributes); attributes.clear(); } catch (ParseException e) { -IOException ioe = new IOException("Error parsing file description"); +IOException ioe = new IOException("Error parsing file description: " + xmlLocation); ioe.initCause(e); throw ioe; } @@ -257,12 +260,21 @@ } } else if (ELEM_VALUE.equals(qName)) { +if ( currentProperty == null ) { +throw new IOException("XML file does not seem to contain valid content xml. Unexpected " + ELEM_VALUE + " element in : " + xmlLocation); +} currentProperty.addValue(content); } else if (ELEM_VALUES.equals(qName)) { +if ( currentProperty == null ) { +throw new IOException("XML file does not seem to contain valid content xml. Unexpected " + ELEM_VALUE + " element in : " + xmlLocation); +} currentProperty.isMultiValue = true; } else if (ELEM_TYPE.equals(qName)) { +if ( currentProperty == null ) { +throw new IOException("XML file does not seem to contain valid content xml. Unexpected " + ELEM_VALUE + " element in : " + xmlLocation); +}