exo-jcr SVN: r3340 - in jcr/trunk/exo.jcr.component.webdav/src: main/java/org/exoplatform/services/jcr/webdav/command/propfind and 3 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2010-10-22 11:03:50 -0400 (Fri, 22 Oct 2010)
New Revision: 3340
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropFindCommand.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindRequestEntity.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/util/PropertyConstants.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropstatGroupedRepresentation.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
Log:
EXOJCR-1013: fixed PROPFIND with allprop and include elements, now response contains properties from include element
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropFindCommand.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropFindCommand.java 2010-10-22 14:48:36 UTC (rev 3339)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PropFindCommand.java 2010-10-22 15:03:50 UTC (rev 3340)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.webdav.resource.ResourceUtil;
import org.exoplatform.services.jcr.webdav.resource.VersionedCollectionResource;
import org.exoplatform.services.jcr.webdav.resource.VersionedFileResource;
+import org.exoplatform.services.jcr.webdav.util.PropertyConstants;
import org.exoplatform.services.jcr.webdav.util.TextUtil;
import org.exoplatform.services.jcr.webdav.xml.WebDavNamespaceContext;
import org.exoplatform.services.log.ExoLogger;
@@ -144,6 +145,10 @@
{
response = new PropFindResponseEntity(depth, resource, null, false);
}
+ else if (request.getType().equalsIgnoreCase("include"))
+ {
+ response = new PropFindResponseEntity(depth, resource, propertyNames(body), false);
+ }
else if (request.getType().equalsIgnoreCase("propname"))
{
response = new PropFindResponseEntity(depth, resource, null, true);
@@ -171,8 +176,17 @@
{
HashSet<QName> names = new HashSet<QName>();
- HierarchicalProperty propBody = body.getChild(0);
+ HierarchicalProperty propBody = body.getChild(PropertyConstants.DAV_ALLPROP_INCLUDE);
+ if (propBody != null)
+ {
+ names.add(PropertyConstants.DAV_ALLPROP_INCLUDE);
+ }
+ else
+ {
+ propBody = body.getChild(0);
+ }
+
List<HierarchicalProperty> properties = propBody.getChildren();
Iterator<HierarchicalProperty> propIter = properties.iterator();
while (propIter.hasNext())
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindRequestEntity.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindRequestEntity.java 2010-10-22 14:48:36 UTC (rev 3339)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindRequestEntity.java 2010-10-22 15:03:50 UTC (rev 3340)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.webdav.command.propfind;
import org.exoplatform.common.util.HierarchicalProperty;
+import org.exoplatform.services.jcr.webdav.util.PropertyConstants;
import javax.xml.namespace.QName;
@@ -60,6 +61,11 @@
return "allprop";
}
+ if (input.getChild(PropertyConstants.DAV_ALLPROP_INCLUDE) != null)
+ {
+ return "include";
+ }
+
QName name = input.getChild(0).getName();
if (name.getNamespaceURI().equals("DAV:"))
return name.getLocalPart();
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/util/PropertyConstants.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/util/PropertyConstants.java 2010-10-22 14:48:36 UTC (rev 3339)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/util/PropertyConstants.java 2010-10-22 15:03:50 UTC (rev 3340)
@@ -207,6 +207,20 @@
QName IS_READ_ONLY = new QName("DAV:", "isreadonly");
/**
+ * dav:include element for dav:allprop of PROPFIND method
+ * See <a href='http://www.webdav.org/specs/rfc4918.html#METHOD_PROPFIND'>HTTP Extensions for Web Distributed Authoring
+ * and Versioning (WebDAV)</a> for more information..
+ */
+ QName DAV_ALLPROP_INCLUDE = new QName("DAV:", "include");
+
+ /**
+ * dav:allprop element for dav:allprop of PROPFIND method
+ * See <a href='http://www.webdav.org/specs/rfc4918.html#METHOD_PROPFIND'>HTTP Extensions for Web Distributed Authoring
+ * and Versioning (WebDAV)</a> for more information..
+ */
+ QName DAV_ALLPROP = new QName("DAV:", "allprop");
+
+ /**
* Creation date pattern.
*/
String CREATION_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java 2010-10-22 14:48:36 UTC (rev 3339)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java 2010-10-22 15:03:50 UTC (rev 3340)
@@ -41,6 +41,7 @@
public class PropertyWriteUtil
{
+ private final static Pattern ESCAPE_PATTERN = Pattern.compile("%[0-9a-fA-F]{2}");
/**
* Writes the statuses of properties into XML.
@@ -180,8 +181,7 @@
* @return <code>true</code> if string contains encoded characters, otherwise returns <code>false</code>
*/
private static boolean containsEncodedChar(String str){
- Pattern p = Pattern.compile("%[0-9a-fA-F]{2}");
- Matcher matcher = p.matcher(str);
+ Matcher matcher = ESCAPE_PATTERN.matcher(str);
return matcher.find();
}
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropstatGroupedRepresentation.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropstatGroupedRepresentation.java 2010-10-22 14:48:36 UTC (rev 3339)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropstatGroupedRepresentation.java 2010-10-22 15:03:50 UTC (rev 3340)
@@ -131,7 +131,11 @@
}
else
{
-
+ if (propNames.contains(PropertyConstants.DAV_ALLPROP_INCLUDE))
+ {
+ propStats.put(statname, resource.getProperties(namesOnly));
+ propNames.remove(PropertyConstants.DAV_ALLPROP_INCLUDE);
+ }
for (QName propName : propNames)
{
HierarchicalProperty prop = new HierarchicalProperty(propName);
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2010-10-22 14:48:36 UTC (rev 3339)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2010-10-22 15:03:50 UTC (rev 3340)
@@ -62,6 +62,9 @@
private String allPropsXML =
"<?xml version=\"1.0\" encoding=\"utf-8\" ?><D:propfind xmlns:D=\"DAV:\"><D:allprop/></D:propfind>";
+ private String allPropsWithInclusionXML = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><D:propfind xmlns:D=\"DAV:\">"
+ + "<D:allprop/><D:include><D:lockdiscovery/><D:supported-method-set/></D:include></D:propfind>";
+
public void setUp() throws Exception
{
super.setUp();
@@ -155,6 +158,34 @@
assertTrue(find.contains(author));
}
+ public void testAllPropsWithInclusion() throws Exception
+ {
+
+ String content = TestUtils.getFileContent();
+ String file = TestUtils.getFileName();
+ Node node =
+ TestUtils.addContent(session, file, new ByteArrayInputStream(content.getBytes()), nt_webdave_file, "");
+
+ node.addMixin("mix:lockable");
+ node.save();
+ node.lock(true, false);
+ node.getPath();
+ node.getName();
+
+ MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
+ headers.add(HttpHeaders.CONTENT_TYPE, "text/xml");
+ ContainerResponse responseFind =
+ service(WebDAVMethods.PROPFIND, getPathWS() + file, "", null, allPropsWithInclusionXML.getBytes());
+ assertEquals(HTTPStatus.MULTISTATUS, responseFind.getStatus());
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PropFindResponseEntity entity = (PropFindResponseEntity)responseFind.getEntity();
+ entity.write(outputStream);
+ String find = outputStream.toString();
+ System.out.println("\n" + find);
+ assertTrue(find.contains("D:lockdiscovery"));
+ assertTrue(find.contains("D:supported-method-set"));
+
+ }
public void testPropfindWrongDataFormat() throws Exception
{
13 years, 6 months
exo-jcr SVN: r3339 - in jcr/trunk/exo.jcr.component.webdav/src: test/java/org/exoplatform/services/jcr/webdav/command and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2010-10-22 10:48:36 -0400 (Fri, 22 Oct 2010)
New Revision: 3339
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
Log:
EXOJCR-1012: fixed PROPFIND method with 'allprop', now wrong data output avoided
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java 2010-10-22 14:47:57 UTC (rev 3338)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java 2010-10-22 14:48:36 UTC (rev 3339)
@@ -64,6 +64,8 @@
// FILE_SKIP.add("jcr:primaryType");
FILE_SKIP.add("jcr:mixinTypes");
FILE_SKIP.add("jcr:created");
+ FILE_SKIP.add("jcr:lockOwner");
+ FILE_SKIP.add("jcr:lockIsDeep");
};
/**
@@ -76,6 +78,8 @@
CONTENT_SKIP.add("jcr:lastModified");
CONTENT_SKIP.add("jcr:mimeType");
CONTENT_SKIP.add("jcr:uuid");
+ CONTENT_SKIP.add("jcr:lockOwner");
+ CONTENT_SKIP.add("jcr:lockIsDeep");
CONTENT_SKIP.add("dc:date");
CONTENT_SKIP.add("exo:internalUse");
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2010-10-22 14:47:57 UTC (rev 3338)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2010-10-22 14:48:36 UTC (rev 3339)
@@ -30,8 +30,6 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
import javax.jcr.Node;
import javax.ws.rs.core.HttpHeaders;
@@ -158,7 +156,36 @@
}
+ public void testPropfindWrongDataFormat() throws Exception
+ {
+
+ String path = testPropFind.getPath() + "/testPropfindComplexContent";
+ // prepare data
+ Node node =
+ TestUtils.addContent(session, path, new ByteArrayInputStream("file content".getBytes()), "nt:file",
+ "exo:testResource", "text/plain");
+
+ node.addMixin("mix:lockable");
+ node.save();
+ node.lock(false, false);
+ node.getNode("jcr:content").addMixin("mix:lockable");
+ node.save();
+ node.getNode("jcr:content").lock(true, false);
+ node.getNode("jcr:content").addNode("node", "nt:unstructured").setProperty("node-prop", "prop");
+ node.getNode("jcr:content").setProperty("exo:prop", "prop");
+ node.save();
+
+ // test
+ HierarchicalProperty body = new HierarchicalProperty("D:propfind", null, "DAV:");
+ body.addChild(new HierarchicalProperty("D:allprop", null, "DAV:"));
+ Response resp = new PropFindCommand().propfind(session, path, body, Depth.INFINITY_VALUE, "http://localhost");
+ ByteArrayOutputStream bas = new ByteArrayOutputStream();
+ ((PropFindResponseEntity)resp.getEntity()).write(bas);
+ String find = new String(bas.toByteArray());
+ assertTrue(!find.contains("jcr:lockOnwer"));
+ assertTrue(!find.contains("D:lockdiscovery"));
+ }
public void testPropWithPercent() throws Exception
13 years, 6 months
exo-jcr SVN: r3338 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-10-22 10:47:57 -0400 (Fri, 22 Oct 2010)
New Revision: 3338
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java
Log:
EXOJCR-999: TreeFileCleaner removed from TreeFileValueStorage as redundant
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java 2010-10-22 11:24:11 UTC (rev 3337)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileValueStorage.java 2010-10-22 14:47:57 UTC (rev 3338)
@@ -19,10 +19,8 @@
package org.exoplatform.services.jcr.impl.storage.value.fs;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
-import java.io.File;
import java.io.IOException;
/**
@@ -34,19 +32,9 @@
public class TreeFileValueStorage extends FileValueStorage
{
- protected class TreeFileCleaner extends FileCleaner
- {
- @Override
- public synchronized void addFile(File file)
- {
- super.addFile(new TreeFile(PrivilegedFileHelper.getAbsolutePath(file), cleaner, rootDir));
- }
- }
-
public TreeFileValueStorage(FileCleaner cleaner)
{
super(cleaner);
- this.cleaner = new TreeFileCleaner(); // TODO use container cleaner
}
@Override
13 years, 6 months
exo-jcr SVN: r3337 - in jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr: impl/storage/value/fs and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-10-22 07:24:11 -0400 (Fri, 22 Oct 2010)
New Revision: 3337
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java
Log:
EXOJCR-999: tests updated - now unused FileCleaners will be stopped
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2010-10-22 10:32:02 UTC (rev 3336)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/BaseStandaloneTest.java 2010-10-22 11:24:11 UTC (rev 3337)
@@ -153,8 +153,7 @@
wconf.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
WorkspaceDataContainer.DEF_MAXBUFFERSIZE);
- FileCleanerHolder wfcleaner =
- (FileCleanerHolder)wsc.getComponent(FileCleanerHolder.class);
+ FileCleanerHolder wfcleaner = (FileCleanerHolder)wsc.getComponent(FileCleanerHolder.class);
fileCleaner = wfcleaner.getFileCleaner();
holder = new ReaderSpoolFileHolder();
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java 2010-10-22 10:32:02 UTC (rev 3336)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java 2010-10-22 11:24:11 UTC (rev 3337)
@@ -24,7 +24,6 @@
import org.exoplatform.services.jcr.impl.storage.value.cas.RecordAlreadyExistsException;
import org.exoplatform.services.jcr.impl.storage.value.cas.RecordNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.cas.ValueContentAddressStorage;
-import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -48,8 +47,6 @@
protected ValueContentAddressStorage vcas;
- protected FileCleaner fileCleaner;
-
protected File rootDir;
protected String storageId;
@@ -61,9 +58,6 @@
{
super.setUp();
- if (fileCleaner == null)
- fileCleaner = new FileCleaner();
-
if (vcas == null)
initVCAS();
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java 2010-10-22 10:32:02 UTC (rev 3336)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/TestFileIOChannel.java 2010-10-22 11:24:11 UTC (rev 3337)
@@ -43,7 +43,7 @@
private File rootDir;
- private FileCleaner cleaner = new FileCleaner(2000);
+ private FileCleaner cleaner;
private ValueDataResourceHolder resources = new ValueDataResourceHolder();
@@ -57,6 +57,8 @@
{
super.setUp();
+ cleaner = new FileCleaner(2000);
+
rootDir = new File(new File("target"), "vs1");
rootDir.mkdirs();
@@ -67,6 +69,15 @@
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void tearDown() throws Exception
+ {
+ cleaner.halt();
+ }
+
public void testRead() throws Exception
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java 2010-10-22 10:32:02 UTC (rev 3336)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestPersistedValueData.java 2010-10-22 11:24:11 UTC (rev 3337)
@@ -81,27 +81,34 @@
public void testIfFinalizeRemovesTempFileStreamValueData() throws Exception
{
+ FileCleaner testFileCleaner = new FileCleaner(1000, true);
+ try
+ {
+ byte[] buf = "0123456789".getBytes();
+ SwapFile file = SwapFile.get(new File("target"), "testIfFinalizeRemovesTempFileStreamValueData");
+ //File file = new File("target/testIfFinalizeRemovesTempFileStreamValueData");
+ //if (file.exists())
+ // file.delete();
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(buf);
+ out.close();
- byte[] buf = "0123456789".getBytes();
- SwapFile file = SwapFile.get(new File("target"), "testIfFinalizeRemovesTempFileStreamValueData");
- //File file = new File("target/testIfFinalizeRemovesTempFileStreamValueData");
- //if (file.exists())
- // file.delete();
- FileOutputStream out = new FileOutputStream(file);
- out.write(buf);
- out.close();
+ CleanableFilePersistedValueData vd = new CleanableFilePersistedValueData(0, file, testFileCleaner);
+ assertTrue(file.exists());
- CleanableFilePersistedValueData vd = new CleanableFilePersistedValueData(0, file, new FileCleaner(1000, true));
- assertTrue(file.exists());
+ vd = null;
+ System.gc();
- vd = null;
- System.gc();
+ // allows GC to call finalize on vd
+ Thread.sleep(2500);
+ System.gc();
- // allows GC to call finalize on vd
- Thread.sleep(2500);
- System.gc();
-
- assertFalse(file.exists());
+ assertFalse(file.exists());
+ }
+ finally
+ {
+ testFileCleaner.halt();
+ }
}
public void testConcurrentFileStreamValueDataReading() throws Exception
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java 2010-10-22 10:32:02 UTC (rev 3336)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestTransientValueData.java 2010-10-22 11:24:11 UTC (rev 3337)
@@ -66,37 +66,46 @@
public void testCreateFileStreamTransientValueData() throws Exception
{
+ FileCleaner testFileCleaner = new FileCleaner();
+ try
+ {
+ byte[] buf = "0123456789".getBytes();
+ File file = new File("target/testCreateFileStreamTransientValueData");
+ if (file.exists())
+ file.delete();
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(buf);
+ out.close();
- byte[] buf = "0123456789".getBytes();
- File file = new File("target/testCreateFileStreamTransientValueData");
- if (file.exists())
- file.delete();
- FileOutputStream out = new FileOutputStream(file);
- out.write(buf);
- out.close();
+ FileInputStream fs1 = new FileInputStream(file);
+ TransientValueData vd =
+ new TransientValueData(0, null, fs1, null, testFileCleaner, 5, new File("target"), true);
- FileInputStream fs1 = new FileInputStream(file);
- TransientValueData vd = new TransientValueData(0, null, fs1, null, new FileCleaner(), 5, new File("target"), true);
+ // spool to file
+ InputStream fs2 = vd.getAsStream();
+ assertEquals(10, vd.getLength());
+ assertTrue(fs2 instanceof FileInputStream);
- // spool to file
- InputStream fs2 = vd.getAsStream();
- assertEquals(10, vd.getLength());
- assertTrue(fs2 instanceof FileInputStream);
+ // not the same object as new is is from spool file
+ assertNotSame(fs1, fs2);
+ // spooled to file so not a byte array
+ assertFalse(vd.isByteArray());
- // not the same object as new is is from spool file
- assertNotSame(fs1, fs2);
- // spooled to file so not a byte array
- assertFalse(vd.isByteArray());
+ // next call return not the same object as well
+ // (new stream every time)
+ assertNotSame(vd.getAsStream(), fs2);
+ assertEquals(10, vd.getLength());
- // next call return not the same object as well
- // (new stream every time)
- assertNotSame(vd.getAsStream(), fs2);
- assertEquals(10, vd.getLength());
+ // gets as byte array
+ assertEquals(10, vd.getAsByteArray().length);
+ // but still spooled to file
+ assertFalse(vd.isByteArray());
- // gets as byte array
- assertEquals(10, vd.getAsByteArray().length);
- // but still spooled to file
- assertFalse(vd.isByteArray());
+ }
+ finally
+ {
+ testFileCleaner.halt();
+ }
}
@@ -118,7 +127,7 @@
// TODO not influenced here as will be spooled to byte array anyway
//vd.setMaxBufferSize(5);
//vd.setFileCleaner(new FileCleaner());
-
+
//
InputStream fs2 = vd.getAsStream();
assertEquals(10, vd.getLength());
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java 2010-10-22 10:32:02 UTC (rev 3336)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/value/TestValueImpl.java 2010-10-22 11:24:11 UTC (rev 3337)
@@ -50,43 +50,51 @@
public void testNewBinaryValue() throws Exception
{
+ FileCleaner testFileCleaner = new FileCleaner();
- byte[] buf = "012345678901234567890123456789".getBytes();
- File file = new File("target/testNewBinaryValue");
- if (file.exists())
- file.delete();
- FileOutputStream out = new FileOutputStream(file);
- out.write(buf);
- out.close();
+ try
+ {
+ byte[] buf = "012345678901234567890123456789".getBytes();
+ File file = new File("target/testNewBinaryValue");
+ if (file.exists())
+ file.delete();
+ FileOutputStream out = new FileOutputStream(file);
+ out.write(buf);
+ out.close();
- FileInputStream fs1 = new FileInputStream(file);
- BinaryValue val = new BinaryValue(fs1, new FileCleaner(), tempDirectory, maxFufferSize);
- InputStream str1 = val.getStream();
- assertNotNull(str1);
+ FileInputStream fs1 = new FileInputStream(file);
+ BinaryValue val = new BinaryValue(fs1, testFileCleaner, tempDirectory, maxFufferSize);
+ InputStream str1 = val.getStream();
+ assertNotNull(str1);
- // obj returned by getStream() is not the same as incoming stream
- assertNotSame(str1, fs1);
+ // obj returned by getStream() is not the same as incoming stream
+ assertNotSame(str1, fs1);
- // streams returned by subsequent call of val.getStream() are equals
- assertEquals(str1, val.getStream());
+ // streams returned by subsequent call of val.getStream() are equals
+ assertEquals(str1, val.getStream());
- // another one value using the same string
- BinaryValue val2 = new BinaryValue(fs1, new FileCleaner(), tempDirectory, maxFufferSize);
- InputStream str2 = val2.getStream();
+ // another one value using the same string
+ BinaryValue val2 = new BinaryValue(fs1, testFileCleaner, tempDirectory, maxFufferSize);
+ InputStream str2 = val2.getStream();
- // are not the same although created from same Stream
- assertNotSame(str1, str2);
+ // are not the same although created from same Stream
+ assertNotSame(str1, str2);
- // stream already consumed
- try
- {
- val.getString();
- fail("IllegalStateException should have been thrown");
+ // stream already consumed
+ try
+ {
+ val.getString();
+ fail("IllegalStateException should have been thrown");
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ // System.out.println(" >>>>>>>>STRING >>> "+);
}
- catch (IllegalStateException e)
+ finally
{
+ testFileCleaner.halt();
}
- // System.out.println(" >>>>>>>>STRING >>> "+);
}
public void testNewBinaryValueFromString() throws Exception
13 years, 6 months
exo-jcr SVN: r3336 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-10-22 06:32:02 -0400 (Fri, 22 Oct 2010)
New Revision: 3336
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java
Log:
EXOJCR-999: FileCleanerHolder now used in JDBCWorkspaceDataContainer
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-10-22 10:13:46 UTC (rev 3335)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-10-22 10:32:02 UTC (rev 3336)
@@ -34,6 +34,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.statistics.StatisticsJDBCStorageConnection;
import org.exoplatform.services.jcr.impl.storage.jdbc.update.StorageUpdateManager;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
@@ -205,8 +206,9 @@
* if JNDI exception (on DataSource lookup)
*/
public JDBCWorkspaceDataContainer(WorkspaceEntry wsConfig, RepositoryEntry repConfig,
- InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
- throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
+ InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider,
+ FileCleanerHolder fileCleanerHolder) throws RepositoryConfigurationException, NamingException,
+ RepositoryException, IOException
{
// This recall is workaround for tenants creation. There is a trouble in visibility datasource
@@ -397,7 +399,7 @@
PrivilegedFileHelper.mkdirs(swapDirectory);
}
- this.swapCleaner = new FileCleaner(false);
+ this.swapCleaner = fileCleanerHolder.getFileCleaner();
initDatabase();
@@ -866,7 +868,6 @@
*/
public void start()
{
- this.swapCleaner.start();
}
/**
@@ -874,8 +875,6 @@
*/
public void stop()
{
- this.swapCleaner.halt();
- this.swapCleaner.interrupt();
// TODO HSQLDB Stop (debug)
// if (dbDialect.equals(DB_DIALECT_GENERIC) ||
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2010-10-22 10:13:46 UTC (rev 3335)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2010-10-22 10:32:02 UTC (rev 3336)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.HSQLDBConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.MySQLConnectionFactory;
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.OracleConnectionFactory;
+import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
import org.exoplatform.services.naming.InitialContextInitializer;
@@ -67,10 +68,11 @@
* if JNDI exception (on DataSource lookup)
*/
public CQJDBCWorkspaceDataContainer(WorkspaceEntry wsConfig, RepositoryEntry repConfig,
- InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider)
- throws RepositoryConfigurationException, NamingException, RepositoryException, IOException
+ InitialContextInitializer contextInit, ValueStoragePluginProvider valueStorageProvider,
+ FileCleanerHolder fileCleanerHolder) throws RepositoryConfigurationException, NamingException,
+ RepositoryException, IOException
{
- super(wsConfig, repConfig, contextInit, valueStorageProvider);
+ super(wsConfig, repConfig, contextInit, valueStorageProvider, fileCleanerHolder);
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java 2010-10-22 10:13:46 UTC (rev 3335)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java 2010-10-22 10:32:02 UTC (rev 3336)
@@ -18,17 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage;
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import javax.jcr.PropertyType;
-import javax.naming.InitialContext;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-import javax.sql.DataSource;
-
import junit.framework.TestCase;
import org.exoplatform.services.jcr.access.AccessControlList;
@@ -52,6 +41,17 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.log.LogConfigurationInitializer;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.jcr.PropertyType;
+import javax.naming.InitialContext;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import javax.sql.DataSource;
+
/**
* Created by The eXo Platform SAS.
*
@@ -104,9 +104,11 @@
// ref.add(new StringRefAddr("database", "jdbc:hsqldb:file:data/test"));
// SimpleJNDIContextInitializer.initialize(sourceName, ref);
+ FileCleanerHolder holder = new FileCleanerHolder();
container =
- new JDBCWorkspaceDataContainer(config, repositoryEntry, null, new StandaloneStoragePluginProvider(config, new FileCleanerHolder()));
+ new JDBCWorkspaceDataContainer(config, repositoryEntry, null, new StandaloneStoragePluginProvider(config,
+ holder), holder);
Properties logProps = new Properties();
logProps.put("org.apache.commons.logging.simplelog.defaultlog", "debug");
13 years, 6 months
exo-jcr SVN: r3335 - ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/method/filter.
by do-not-reply@jboss.org
Author: aparfonov
Date: 2010-10-22 06:13:46 -0400 (Fri, 22 Oct 2010)
New Revision: 3335
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/method/filter/MethodAccessFilter.java
Log:
EXOJCR-1002
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/method/filter/MethodAccessFilter.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/method/filter/MethodAccessFilter.java 2010-10-22 09:08:28 UTC (rev 3334)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/method/filter/MethodAccessFilter.java 2010-10-22 10:13:46 UTC (rev 3335)
@@ -28,13 +28,15 @@
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
/**
* Contract of this class thats constrains access to the resource method that
- * use JSR-250 security common annotations. See also https://jsr250.dev.java.net .
- *
+ * use JSR-250 security common annotations. See also https://jsr250.dev.java.net
+ * .
+ *
* @author <a href="mailto:andrew00x@gmail.com">Andrey Parfonov</a>
* @version $Id: $
*/
@@ -44,7 +46,7 @@
/**
* Check does <tt>method</tt> contains one on of security annotations
* PermitAll, DenyAll, RolesAllowed.
- *
+ *
* @see PermitAll
* @see DenyAll
* @see RolesAllowed {@inheritDoc}
@@ -66,7 +68,9 @@
{
// nobody allowed to call method
- throw new WebApplicationException(Response.status(Response.Status.FORBIDDEN).build());
+ throw new WebApplicationException(Response.status(Response.Status.FORBIDDEN).entity(
+ "You do not have access rights to this resource, please contact your administrator. ").type(
+ MediaType.TEXT_PLAIN).build());
}
if (ac == RolesAllowed.class)
@@ -78,14 +82,16 @@
return;
// user is not in allowed roles
- throw new WebApplicationException(Response.status(Response.Status.FORBIDDEN).build());
+ throw new WebApplicationException(Response.status(Response.Status.FORBIDDEN).entity(
+ "You do not have access rights to this resource, please contact your administrator. ").type(
+ MediaType.TEXT_PLAIN).build());
}
}
}
/**
* Extract roles from {@link RolesAllowed} annotation.
- *
+ *
* @param roles See {@link RolesAllowed}
* @return roles
*/
13 years, 6 months
exo-jcr SVN: r3334 - in jcr/trunk/exo.jcr.component.core/src/main: java/org/exoplatform/services/jcr/impl and 5 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-10-22 05:08:28 -0400 (Fri, 22 Oct 2010)
New Revision: 3334
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml
Log:
EXOJCR-999: WorkerService added, LockRemover made as single per-repository thread
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java 2010-10-22 08:11:26 UTC (rev 3333)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryInfo.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -46,6 +46,8 @@
protected long sessionTimeOut;
+ protected int lockRemoverMaxThreadCount;
+
public RepositoryInfo()
{
@@ -190,17 +192,43 @@
}
/**
+ * Returns LockRemovers per-repository max threads count.
+ * @return LockRemovers per-repository max threads count
+ */
+ public int getLockRemoverThreadsCount()
+ {
+ return lockRemoverMaxThreadCount;
+ }
+
+ /**
+ * Sets LockRemovers per-repository max threads count.
+ * @param lockRemoverMaxThreadCount
+ */
+ public void setLockRemoverThreadsCount(int lockRemoverMaxThreadCount)
+ {
+ this.lockRemoverMaxThreadCount = lockRemoverMaxThreadCount;
+ }
+
+ /**
* Merges the current {@link RepositoryInfo} with the given one. The current {@link RepositoryInfo}
* has the highest priority thus only absent data will be overrode
* @param entry the entry to merge with the current {@link RepositoryInfo}
*/
void merge(RepositoryInfo entry)
{
- if (systemWorkspaceName == null) setSystemWorkspaceName(entry.systemWorkspaceName);
- if (defaultWorkspaceName == null) setDefaultWorkspaceName(entry.defaultWorkspaceName);
- if (accessControl == null) setAccessControl(entry.accessControl);
- if (securityDomain == null) setSecurityDomain(entry.securityDomain);
- if (authenticationPolicy == null) setAuthenticationPolicy(entry.authenticationPolicy);
- if (sessionTimeOut == 0) setSessionTimeOut(entry.sessionTimeOut);
- }
+ if (systemWorkspaceName == null)
+ setSystemWorkspaceName(entry.systemWorkspaceName);
+ if (defaultWorkspaceName == null)
+ setDefaultWorkspaceName(entry.defaultWorkspaceName);
+ if (accessControl == null)
+ setAccessControl(entry.accessControl);
+ if (securityDomain == null)
+ setSecurityDomain(entry.securityDomain);
+ if (authenticationPolicy == null)
+ setAuthenticationPolicy(entry.authenticationPolicy);
+ if (sessionTimeOut == 0)
+ setSessionTimeOut(entry.sessionTimeOut);
+ if (lockRemoverMaxThreadCount == 0)
+ setLockRemoverThreadsCount(entry.lockRemoverMaxThreadCount);
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2010-10-22 08:11:26 UTC (rev 3333)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -43,6 +43,7 @@
import org.exoplatform.services.jcr.impl.core.WorkspaceInitializer;
import org.exoplatform.services.jcr.impl.core.access.DefaultAccessManagerImpl;
import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
+import org.exoplatform.services.jcr.impl.core.lock.LockRemoverHolder;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeDataManagerImpl;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.impl.core.nodetype.registration.JCRNodeTypeDataPersister;
@@ -516,6 +517,7 @@
// WorkspaceFileCleanerHolder - is a common holder for all workspaces.
// It is used to initialize FileValueStorage
registerComponentImplementation(FileCleanerHolder.class);
+ registerComponentImplementation(LockRemoverHolder.class);
registerWorkspacesComponents();
registerRepositoryComponents();
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-10-22 08:11:26 UTC (rev 3333)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -22,7 +22,6 @@
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.ExtendedSession;
import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
@@ -52,6 +51,7 @@
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.IdentityConstants;
import org.picocontainer.Startable;
import java.io.IOException;
@@ -146,12 +146,14 @@
* @param dataManager
* @param config
*/
- public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config)
+ public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
+ LockRemoverHolder lockRemoverHolder)
{
- this(dataManager, config, null);
+ this(dataManager, config, null, lockRemoverHolder);
}
- public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config, LockPersister persister)
+ public LockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config, LockPersister persister,
+ LockRemoverHolder lockRemoverHolder)
{
this.dataManager = dataManager;
@@ -169,6 +171,7 @@
tokensMap = new HashMap<String, LockData>();
dataManager.addItemPersistenceListener(this);
+ lockRemover = lockRemoverHolder.getLockRemover(this);
}
public synchronized void addLockToken(String sessionId, String lt)
@@ -468,7 +471,7 @@
*/
public void start()
{
- lockRemover = new LockRemover(this);
+ lockRemover.start();
}
// Quick method. We need to reconstruct
@@ -503,8 +506,8 @@
*/
public void stop()
{
- lockRemover.halt();
- lockRemover.interrupt();
+ lockRemover.stop();
+
locks.clear();
pendingLocks.clear();
tokensMap.clear();
@@ -701,7 +704,7 @@
{
NodeData nData = (NodeData)dataManager.getItemData(nodeIdentifier);
PlainChangesLog changesLog =
- new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
+ new PlainChangesLogImpl(new ArrayList<ItemState>(), IdentityConstants.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java 2010-10-22 08:11:26 UTC (rev 3333)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemover.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -18,47 +18,68 @@
*/
package org.exoplatform.services.jcr.impl.core.lock;
-import org.exoplatform.services.jcr.impl.proccess.WorkerThread;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
+import org.exoplatform.services.jcr.impl.proccess.WorkerService;
+import java.util.concurrent.ScheduledFuture;
+
/**
* Created by The eXo Platform SAS.
*
* @author <a href="mailto:Sergey.Kabashnyuk@gmail.com">Sergey Kabashnyuk</a>
* @version $Id: LockRemover.java 11987 2008-03-17 09:06:06Z ksm $
*/
-public class LockRemover extends WorkerThread
+public class LockRemover
{
+ public static final long DEFAULT_THREAD_TIMEOUT = 30000; // 30 sec
- private final Log log = ExoLogger.getLogger("exo.jcr.component.core.LockRemover");
+ private final WorkerService workerService;
- public static final long DEFAULT_THREAD_TIMEOUT = 30000; // 30
+ private final WorkspaceLockManager lockManager;
- // sec
+ private final long timeout;
- private final WorkspaceLockManager lockManagerImpl;
+ private ScheduledFuture lockRemoverTask = null;
- public LockRemover(WorkspaceLockManager lockManagerImpl)
+ class LockRemoverTask implements Runnable
{
- this(lockManagerImpl, DEFAULT_THREAD_TIMEOUT);
+ private final WorkspaceLockManager lockManager;
+
+ LockRemoverTask(WorkspaceLockManager lockManager)
+ {
+ this.lockManager = lockManager;
+ }
+
+ public void run()
+ {
+ lockManager.removeExpired();
+ }
}
- private LockRemover(WorkspaceLockManager lockManagerImpl, long timeout)
+ protected LockRemover(WorkerService workerService, WorkspaceLockManager lockManager)
{
- super(timeout);
- this.lockManagerImpl = lockManagerImpl;
- setName("LockRemover " + getId());
- setPriority(Thread.MIN_PRIORITY);
- setDaemon(true);
- start();
- if (log.isDebugEnabled())
- log.debug("LockRemover instantiated name= " + getName() + " timeout= " + timeout);
+ this(workerService, lockManager, DEFAULT_THREAD_TIMEOUT);
}
- @Override
- protected void callPeriodically() throws Exception
+ protected LockRemover(WorkerService workerService, WorkspaceLockManager lockManager, long timeout)
{
- lockManagerImpl.removeExpired();
+ this.workerService = workerService;
+ this.lockManager = lockManager;
+ this.timeout = timeout;
}
+
+ public void start()
+ {
+ if (lockRemoverTask != null)
+ {
+ stop();
+ }
+ lockRemoverTask = workerService.executePeriodically(new LockRemoverTask(lockManager), timeout);
+ }
+
+ public void stop()
+ {
+ lockRemoverTask.cancel(false);
+ lockRemoverTask = null;
+ }
+
}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -0,0 +1,65 @@
+package org.exoplatform.services.jcr.impl.core.lock;
+
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.impl.proccess.WorkerService;
+
+/**
+ * LockRemoverHolder holds is a single per-repository LockRemover container.
+ * @author <a href="mailto:foo@bar.org">Foo Bar</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
+ *
+ */
+public class LockRemoverHolder
+{
+
+ /**
+ * Default amount of thread that may be used by WorkerService to serve LockRemovers.
+ */
+ public final int DEFAULT_THREAD_COUNT = 1;
+
+ /**
+ * WorkerService that executed LockRemover.
+ */
+ private final WorkerService workerService;
+
+ /**
+ * Constructor.
+ * @param entry - RepositoryEntry that may contain lock-remover-max-threads parameter.
+ */
+ public LockRemoverHolder(RepositoryEntry entry)
+ {
+ int threadCount = DEFAULT_THREAD_COUNT;
+ if (entry != null)
+ {
+ if (entry.getLockRemoverThreadsCount() > 0)
+ {
+ threadCount = entry.getLockRemoverThreadsCount();
+ }
+ }
+ workerService = new WorkerService(threadCount, "lock-remover");
+ }
+
+ /**
+ * Returns LockRemover object that removes expired locks from LockManager. Default timeout used.
+ *
+ * @param lockManager - LockManager that going to be cleaned with returned LockRemover.
+ * @return LockRemover
+ */
+ public LockRemover getLockRemover(WorkspaceLockManager lockManager)
+ {
+ return new LockRemover(workerService, lockManager);
+ }
+
+ /**
+ * Returns LockRemover object that removes expired locks from LockManager.
+ *
+ * @param lockManager - LockManager that going to be cleaned with returned LockRemover.
+ * @param timeout - LockRemover will check LockManager with delay setted in timeout parameter
+ * @return LockRemover
+ */
+ public LockRemover getLockRemover(WorkspaceLockManager lockManager, long timeout)
+ {
+ return new LockRemover(workerService, lockManager, timeout);
+ }
+
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-10-22 08:11:26 UTC (rev 3333)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -21,7 +21,6 @@
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
@@ -43,6 +42,7 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
+import org.exoplatform.services.jcr.impl.core.lock.LockRemoverHolder;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -57,6 +57,7 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.transaction.TransactionService;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheSPI;
@@ -173,7 +174,7 @@
private Cache<Serializable, Object> cache;
private final Fqn<String> lockRoot;
-
+
private final boolean shareable;
/**
@@ -192,10 +193,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, transactionService.getTransactionManager(), cfm);
+ this(dataManager, config, context, transactionService.getTransactionManager(), cfm, lockRemoverHolder);
}
/**
@@ -207,10 +208,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, ConfigurationManager cfm) throws RepositoryConfigurationException,
- RepositoryException
+ InitialContextInitializer context, ConfigurationManager cfm, LockRemoverHolder lockRemoverHolder)
+ throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, (TransactionManager)null, cfm);
+ this(dataManager, config, context, (TransactionManager)null, cfm, lockRemoverHolder);
}
@@ -225,8 +226,8 @@
* @throws RepositoryConfigurationException
*/
public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
lockRoot = Fqn.fromElements(config.getUniqueName(), LOCKS);
@@ -270,7 +271,7 @@
cache = factory.createCache(config.getLockManager());
Fqn<String> rootFqn = Fqn.fromElements(config.getUniqueName());
-
+
shareable =
config.getLockManager().getParameterBoolean(JBOSSCACHE_SHAREABLE, JBOSSCACHE_SHAREABLE_DEFAULT)
.booleanValue();
@@ -292,6 +293,8 @@
{
throw new RepositoryConfigurationException("Cache configuration not found");
}
+
+ lockRemover = lockRemoverHolder.getLockRemover(this);
}
/**
@@ -819,7 +822,7 @@
*/
public void start()
{
- lockRemover = new LockRemover(this);
+ lockRemover.start();
}
/*
@@ -828,17 +831,17 @@
*/
public void stop()
{
- lockRemover.halt();
- lockRemover.interrupt();
+ lockRemover.stop();
+
sessionLockManagers.clear();
if (shareable)
{
// The cache cannot be stopped since it can be shared so we evict the root node instead
- cache.evict(lockRoot);
+ cache.evict(lockRoot);
}
else
{
- PrivilegedCacheHelper.stop(cache);
+ PrivilegedCacheHelper.stop(cache);
}
}
@@ -1112,7 +1115,7 @@
}
PlainChangesLog changesLog =
- new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
+ new PlainChangesLogImpl(new ArrayList<ItemState>(), IdentityConstants.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-10-22 08:11:26 UTC (rev 3333)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -21,7 +21,6 @@
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -42,6 +41,7 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.lock.LockRemover;
+import org.exoplatform.services.jcr.impl.core.lock.LockRemoverHolder;
import org.exoplatform.services.jcr.impl.core.lock.SessionLockManager;
import org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManager;
import org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableSessionLockManager;
@@ -55,6 +55,7 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.transaction.TransactionService;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
@@ -161,10 +162,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableJDBCLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, transactionService.getTransactionManager(), cfm);
+ this(dataManager, config, context, transactionService.getTransactionManager(), cfm, lockRemoverHolder);
}
/**
@@ -176,10 +177,10 @@
* @throws RepositoryConfigurationException
*/
public CacheableJDBCLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, ConfigurationManager cfm) throws RepositoryConfigurationException,
- RepositoryException
+ InitialContextInitializer context, ConfigurationManager cfm, LockRemoverHolder lockRemoverHolder)
+ throws RepositoryConfigurationException, RepositoryException
{
- this(dataManager, config, context, (TransactionManager)null, cfm);
+ this(dataManager, config, context, (TransactionManager)null, cfm, lockRemoverHolder);
}
/**
@@ -194,8 +195,8 @@
* @throws RepositoryException
*/
public CacheableJDBCLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
- InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm)
- throws RepositoryConfigurationException, RepositoryException
+ InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm,
+ LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
{
lockRoot = Fqn.fromElements(LOCKS);
@@ -250,6 +251,8 @@
{
throw new RepositoryConfigurationException("Cache configuration not found");
}
+
+ lockRemover = lockRemoverHolder.getLockRemover(this);
}
@Managed
@@ -598,7 +601,7 @@
*/
public void start()
{
- lockRemover = new LockRemover(this);
+ lockRemover.start();
}
/**
@@ -606,8 +609,8 @@
*/
public void stop()
{
- lockRemover.halt();
- lockRemover.interrupt();
+ lockRemover.stop();
+
sessionLockManagers.clear();
cache.stop();
}
@@ -947,7 +950,7 @@
}
PlainChangesLog changesLog =
- new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
+ new PlainChangesLogImpl(new ArrayList<ItemState>(), IdentityConstants.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/proccess/WorkerService.java 2010-10-22 09:08:28 UTC (rev 3334)
@@ -0,0 +1,84 @@
+package org.exoplatform.services.jcr.impl.proccess;
+
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class WorkerService
+{
+ /**
+ * Executor that process assigned command periodically.
+ */
+ private final ScheduledThreadPoolExecutor executor;
+
+ class WorkerThreadFactory implements ThreadFactory
+ {
+ final AtomicInteger poolNumber = new AtomicInteger(1);
+
+ final ThreadGroup group;
+
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+
+ final String namePrefix;
+
+ WorkerThreadFactory(String namePrefix)
+ {
+ SecurityManager s = System.getSecurityManager();
+ group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
+ this.namePrefix = namePrefix + poolNumber.getAndIncrement() + "-thread-";
+ }
+
+ public Thread newThread(Runnable r)
+ {
+ Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
+ if (t.isDaemon())
+ t.setDaemon(false);
+ if (t.getPriority() != Thread.NORM_PRIORITY)
+ t.setPriority(Thread.NORM_PRIORITY);
+ return t;
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param threadCount - max thread count that executor may use
+ */
+ public WorkerService(int threadCount)
+ {
+ executor = new ScheduledThreadPoolExecutor(threadCount);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param threadCount - max thread count that executor may use
+ * @param threadNamePrefix - thread name prefix
+ */
+ public WorkerService(int threadCount, String threadNamePrefix)
+ {
+ executor = new ScheduledThreadPoolExecutor(threadCount, new WorkerThreadFactory(threadNamePrefix));
+ }
+
+ /**
+ * Execute specified <code>command</code> periodically with <code>delay</code>.
+ *
+ * @param command - command that must be executed
+ * @param delay - delay between each command execution
+ * @return
+ */
+ public ScheduledFuture executePeriodically(Runnable command, long delay)
+ {
+ return executor.scheduleWithFixedDelay(command, 0, delay, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
+ */
+ public void stop()
+ {
+ executor.shutdown();
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml 2010-10-22 08:11:26 UTC (rev 3333)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml 2010-10-22 09:08:28 UTC (rev 3334)
@@ -17,6 +17,8 @@
<value name="access-control" field="accessControl" usage="optional" />
<value name="session-max-age" field="sessionTimeOut"
deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseTime" usage="optional" />
+ <value name="lock-remover-max-threads" field="lockRemoverMaxThreadCount"
+ deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseInt" usage="optional" />
<value name="authentication-policy" field="authenticationPolicy" />
<collection name="workspaces" field="workspaces" item-type="org.exoplatform.services.jcr.config.WorkspaceEntry" />
</mapping>
13 years, 6 months
exo-jcr SVN: r3333 - jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command.
by do-not-reply@jboss.org
Author: aparfonov
Date: 2010-10-22 04:11:26 -0400 (Fri, 22 Oct 2010)
New Revision: 3333
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/DeleteCommand.java
Log:
EXOJCR-1003
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/DeleteCommand.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/DeleteCommand.java 2010-10-22 07:17:46 UTC (rev 3332)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/DeleteCommand.java 2010-10-22 08:11:26 UTC (rev 3333)
@@ -25,12 +25,13 @@
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
* Created by The eXo Platform SAS Author : <a
* href="gavrikvetal(a)gmail.com">Vitaly Guly</a>.
- *
+ *
* @version $Id: $
*/
@@ -39,7 +40,7 @@
/**
* Webdav Delete method implementation.
- *
+ *
* @param session current session
* @param path file path
* @param lockTokenHeader lock tokens
@@ -65,7 +66,8 @@
if ((nodeLockToken == null) || (!nodeLockToken.equals(lockTokenHeader)))
{
- return Response.status(HTTPStatus.LOCKED).build();
+ return Response.status(HTTPStatus.LOCKED).entity("The " + path + " item is locked. ").type(
+ MediaType.TEXT_PLAIN).build();
}
}
}
13 years, 6 months
exo-jcr SVN: r3332 - jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-10-22 03:17:46 -0400 (Fri, 22 Oct 2010)
New Revision: 3332
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
Log:
JCR-1481 : Update documentation.
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2010-10-21 15:40:16 UTC (rev 3331)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2010-10-22 07:17:46 UTC (rev 3332)
@@ -17,14 +17,12 @@
</warning>
<highlights>
- <para>For GateIn should use context "/portal/rest". So to all url will be
- changed from "http://host:port/rest/..." to
- "http://host:port/portal/rest/..."</para>
+ <para>GateIn uses context /portal/rest, therefore you need to use
+ http://host:port/portal/rest/ instread of http://host:port/rest/</para>
- <para>GetIn is use form authentication, so you first need login over "form
- authentication" ( url to form authentication is
- http://host:port/portal/login). And secont make request to
- HTTPBackupAgent.</para>
+ <para>GateIn uses form authentication, so first you need to login (url to
+ form authentication is http://host:port/portal/login) and then perform
+ requests.</para>
</highlights>
<section>
@@ -974,15 +972,14 @@
<title>Backup Client</title>
<highlights>
- <para>For GateIn should use context "/portal/rest". GetIn is use form
- authentication, so you first need login over "form authentication" ( url
- to form authentication is http://host:port/portal/login). And secont
- make request to HTTPBackupAgent.</para>
+ <para>For GateIn should use context "/portal/rest". GateIn uses form
+ authentication, so first you need to login (url to form authentication
+ is http://host:port/portal/login) and then perform requests.</para>
<para></para>
- <para>Backup client is support form authenication. For example call
- command "info" wirh form authentication to GateIn :</para>
+ <para>Backup client is support form authentication. For example call
+ command "info" with form authentication to GateIn :</para>
<para>./jcrbackup.sh http://127.0.0.1:8080/portal/rest form POST
"/portal/login?username=root&password=gtn" info</para>
13 years, 6 months
exo-jcr SVN: r3331 - jcr/branches/1.12.5-GA_REL.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-10-21 11:40:16 -0400 (Thu, 21 Oct 2010)
New Revision: 3331
Modified:
jcr/branches/1.12.5-GA_REL/pom.xml
Log:
[SWF-580] Upgrade dependencies to next snapshots
Modified: jcr/branches/1.12.5-GA_REL/pom.xml
===================================================================
--- jcr/branches/1.12.5-GA_REL/pom.xml 2010-10-21 15:23:14 UTC (rev 3330)
+++ jcr/branches/1.12.5-GA_REL/pom.xml 2010-10-21 15:40:16 UTC (rev 3331)
@@ -42,9 +42,9 @@
<properties>
<exo.product.name>exo-jcr</exo.product.name>
<exo.product.specification>1.12</exo.product.specification>
- <org.exoplatform.kernel.version>2.2.5-GA</org.exoplatform.kernel.version>
- <org.exoplatform.core.version>2.3.5-GA</org.exoplatform.core.version>
- <org.exoplatform.ws.version>2.1.5-GA</org.exoplatform.ws.version>
+ <org.exoplatform.kernel.version>2.2.6-GA-SNAPSHOT</org.exoplatform.kernel.version>
+ <org.exoplatform.core.version>2.3.6-GA-SNAPSHOT</org.exoplatform.core.version>
+ <org.exoplatform.ws.version>2.1.6-GA-SNAPSHOT</org.exoplatform.ws.version>
<org.exoplatform.doc-style.version>1</org.exoplatform.doc-style.version>
</properties>
13 years, 6 months