svn commit: r938228 - /sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java

2010-04-26 Thread fmeschbe
Author: fmeschbe
Date: Mon Apr 26 20:42:25 2010
New Revision: 938228

URL: http://svn.apache.org/viewvc?rev=938228&view=rev
Log:
FELIX-1502 Synchronize access to consumers set

Modified:

sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java

Modified: 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java?rev=938228&r1=938227&r2=938228&view=diff
==
--- 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java
 (original)
+++ 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/AccessManagerFactoryTracker.java
 Mon Apr 26 20:42:25 2010
@@ -57,14 +57,17 @@ public class AccessManagerFactoryTracker
 public void removedService(ServiceReference serviceReference, Object o) {
 log.warn("AccessManager service removed.");
 this.factory = null;
-// Make a copy of consumers list to avoid concurrent modification
 closeSessions();
 super.removedService(serviceReference, o);
 }
 
 private void closeSessions() {
 log.warn("Closing all sessions");
-Set closing = new 
HashSet(consumers);
+// Make a copy of consumers list to avoid concurrent modification
+Set closing;
+synchronized (consumers) {
+closing = new HashSet(consumers);
+}
 for (PluggableDefaultAccessManager consumer : closing) {
 try {
 consumer.endSession();
@@ -83,12 +86,16 @@ public class AccessManagerFactoryTracker
 
 public AccessManagerPluginFactory getFactory(PluggableDefaultAccessManager 
consumer) {
 log.debug("Registering PluggableDefaultAccessManager instance");
-this.consumers.add(consumer);
+synchronized (consumers) {
+this.consumers.add(consumer);
+}
 return factory;
 }
 
 public void unregister(PluggableDefaultAccessManager consumer) {
 log.debug("Unregistering PluggableDefaultAccessManager instance");
-this.consumers.remove(consumer);
+synchronized (consumers) {
+this.consumers.remove(consumer);
+}
 }
 }




svn commit: r938081 - /sling/site/obr/sling.xml

2010-04-26 Thread justin
Author: justin
Date: Mon Apr 26 15:04:06 2010
New Revision: 938081

URL: http://svn.apache.org/viewvc?rev=938081&view=rev
Log:
Add bundle Commons OSGI 2.0.6

Modified:
sling/site/obr/sling.xml

Modified: sling/site/obr/sling.xml
URL: 
http://svn.apache.org/viewvc/sling/site/obr/sling.xml?rev=938081&r1=938080&r2=938081&view=diff
==
--- sling/site/obr/sling.xml (original)
+++ sling/site/obr/sling.xml Mon Apr 26 15:04:06 2010
@@ -1,7 +1,7 @@
 
 
 
-
+
 http://people.apache.org/repo/m2-incubating-repository/org/apache/sling/org.apache.sling.api/2.0.2-incubator/org.apache.sling.api-2.0.2-incubator.jar";
 version="2.0.2.incubator">
 The Sling API defines an extension to the Servlet API 2.4 to  
  provide access to content and unified access to requestparameters 
hiding the differences between the different methodsof transferring 
parameters from client to server. Note that theSling API bundle does 
not include the Servlet API but insteadrequires the API to be provided 
by the Servlet container inwhich the Sling framework is running or by 
another bundle.
 46754
@@ -2675,4 +2675,27 @@
 Import package 
org.osgi.service.component ;version=1.0.0
 Import package org.slf4j 
;version=1.5.2
 
+http://repo1.maven.org/maven2/org/apache/sling/org.apache.sling.commons.osgi/2.0.6/org.apache.sling.commons.osgi-2.0.6.jar";
 version="2.0.6">
+Commons OSGi
+22567
+http://sling.apache.org
+org/apache/sling/org.apache.sling.commons.osgi/2.0.6/org.apache.sling.commons.osgi-2.0.6-sources.jar
+http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+
+
+
+
+
+
+
+
+
+
+Import package 
org.apache.sling.commons.osgi ;version=2.0.6
+Import package 
org.osgi.framework ;version=1.4.0
+Import package 
org.osgi.service.event ;version=1.1.0
+
 




svn commit: r938017 - in /sling/trunk/contrib/extensions/rewriter: ./ src/main/java/org/apache/sling/rewriter/impl/ src/main/java/org/apache/sling/rewriter/impl/components/

2010-04-26 Thread cziegeler
Author: cziegeler
Date: Mon Apr 26 12:20:03 2010
New Revision: 938017

URL: http://svn.apache.org/viewvc?rev=938017&view=rev
Log:
Use resource api - remove dependency to jcr api.

Modified:
sling/trunk/contrib/extensions/rewriter/pom.xml

sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java

sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/RewriterFilter.java

sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlGeneratorFactory.java

sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/HtmlSerializerFactory.java

sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxHtmlSerializerFactory.java

sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/TraxXHtmlSerializerFactory.java

sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/components/XHtmlSerializerFactory.java

Modified: sling/trunk/contrib/extensions/rewriter/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/pom.xml?rev=938017&r1=938016&r2=938017&view=diff
==
--- sling/trunk/contrib/extensions/rewriter/pom.xml (original)
+++ sling/trunk/contrib/extensions/rewriter/pom.xml Mon Apr 26 12:20:03 2010
@@ -23,7 +23,7 @@
 
 org.apache.sling
 sling
-8
+9-SNAPSHOT
 
 
 org.apache.sling.rewriter
@@ -81,6 +81,12 @@
 
 
 
+org.apache.felix
+org.apache.felix.scr.annotations
+1.2.0
+compile
+
+
 commons-lang
 commons-lang
 2.4
@@ -89,7 +95,7 @@
 
 org.apache.sling
 org.apache.sling.api
-2.0.8
+2.0.9-SNAPSHOT
 provided
 
 
@@ -111,12 +117,6 @@
 provided
 
 
-org.apache.sling
-org.apache.sling.jcr.resource
-2.0.6
-provided
-
-
 org.apache.felix
 org.apache.felix.webconsole
 2.0.6

Modified: 
sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java?rev=938017&r1=938016&r2=938017&view=diff
==
--- 
sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
 (original)
+++ 
sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
 Mon Apr 26 12:20:03 2010
@@ -21,24 +21,21 @@ import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Dictionary;
 import java.util.HashMap;
-import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-import javax.jcr.observation.EventListener;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.SlingConstants;
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.jcr.resource.JcrResourceResolverFactory;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.rewriter.PipelineConfiguration;
 import org.apache.sling.rewriter.ProcessingContext;
 import org.apache.sling.rewriter.Processor;
@@ -46,17 +43,20 @@ import org.apache.sling.rewriter.Process
 import org.apache.sling.rewriter.ProcessorManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
+import org.osgi.service.event.EventHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * This manager keeps track of configured processors.
  *
- * @scr.component metatype="no"
- * @scr.service interface="ProcessorManager"
  */
-public class ProcessorManagerImpl implements ProcessorManager {
+...@component
+...@service(value

svn commit: r937970 - in /sling/trunk: bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/ bundles/servlets/post/src/test/java/org/apache/sling/servlets/post/impl/helper/ l

2010-04-26 Thread vramdal
Author: vramdal
Date: Mon Apr 26 09:04:34 2010
New Revision: 937970

URL: http://svn.apache.org/viewvc?rev=937970&view=rev
Log:
SLING-1501 Let JSONResponse set the correct HTTP response code (applying path 
from Simon Gaeremynck - thanks!)

Modified:

sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/JSONResponse.java

sling/trunk/bundles/servlets/post/src/test/java/org/apache/sling/servlets/post/impl/helper/JsonResponseTest.java

sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java

Modified: 
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/JSONResponse.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/JSONResponse.java?rev=937970&r1=937969&r2=937970&view=diff
==
--- 
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/JSONResponse.java
 (original)
+++ 
sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/JSONResponse.java
 Mon Apr 26 09:04:34 2010
@@ -144,6 +144,20 @@ public class JSONResponse extends HtmlRe
 setReferer(referer);
 response.setContentType(RESPONSE_CONTENT_TYPE);
 response.setCharacterEncoding(RESPONSE_CHARSET);
+
+// Status code
+if (setStatus) {
+  Object status = getProperty(PN_STATUS_CODE);
+  if (status instanceof Number) {
+  int statusCode = ((Number) status).intValue();
+  response.setStatus(statusCode);
+
+  // special treatment of 201/CREATED: Requires Location
+  if (statusCode == HttpServletResponse.SC_CREATED) {
+  response.setHeader("Location", getLocation());
+  }
+  }
+  }
 
 try {
 json.write(response.getWriter());

Modified: 
sling/trunk/bundles/servlets/post/src/test/java/org/apache/sling/servlets/post/impl/helper/JsonResponseTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/test/java/org/apache/sling/servlets/post/impl/helper/JsonResponseTest.java?rev=937970&r1=937969&r2=937970&view=diff
==
--- 
sling/trunk/bundles/servlets/post/src/test/java/org/apache/sling/servlets/post/impl/helper/JsonResponseTest.java
 (original)
+++ 
sling/trunk/bundles/servlets/post/src/test/java/org/apache/sling/servlets/post/impl/helper/JsonResponseTest.java
 Mon Apr 26 09:04:34 2010
@@ -171,11 +171,9 @@ public class JsonResponseTest extends Te
 }
 
 public void setStatus(int i) {
-throw new UnsupportedOperationException("Not implemented: " + 
getClass().getName() + ".setStatus");
 }
 
 public void setStatus(int i, String s) {
-throw new UnsupportedOperationException("Not implemented: " + 
getClass().getName() + ".setStatus");
 }
 
 public String getCharacterEncoding() {

Modified: 
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java?rev=937970&r1=937969&r2=937970&view=diff
==
--- 
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java
 (original)
+++ 
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java
 Mon Apr 26 09:04:34 2010
@@ -17,8 +17,15 @@
 package org.apache.sling.launchpad.webapp.integrationtest.servlets.post;
 
 import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.NameValuePair;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.apache.sling.servlets.post.SlingPostConstants;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletResponse;
 
 /** Test switching the output content-type of the POST servlet using
  *  either an Accept header or :http-equiv-accept parameter */
@@ -75,4 +82,24 @@ public class PostServletOutputContentTyp
 public void testJsonContentTypeWithQ() throws Exception {
 runTest("text/plain; q=0.5, text/html; q=0.8, application/json; 
q=0.9", CONTENT_TYPE_JSON); 
 }
+
+public void testJsonContentTypeException() throws Exception {
+  final String testPath = MY_TEST_PATH + "/abs/" + 
System.c