You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/09/08 18:09:45 UTC
svn commit: r812570 [24/24] - in /jackrabbit/sandbox/JCR-1456: ./
jackrabbit-api/ jackrabbit-api/src/main/appended-resources/
jackrabbit-api/src/main/appended-resources/META-INF/
jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabb...
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Tue Sep 8 16:09:28 2009
@@ -73,7 +73,6 @@
import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
import org.apache.jackrabbit.spi.commons.value.ValueFormat;
import org.apache.jackrabbit.util.Text;
-import org.apache.jackrabbit.uuid.UUID;
import org.apache.jackrabbit.webdav.DavConstants;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavMethods;
@@ -191,6 +190,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
/**
* <code>RepositoryServiceImpl</code>...
@@ -229,7 +229,7 @@
private final Map nodeTypeDefinitions = new HashMap();
- private Map descriptors;
+ private Map<String, QValue[]> descriptors;
public RepositoryServiceImpl(String uri, IdFactory idFactory,
NameFactory nameFactory,
@@ -354,7 +354,7 @@
NamePathResolver resolver = sessionInfo.getNamePathResolver();
if (resolver == null) {
resolver = new NamePathResolverImpl(sessionInfo);
- ((SessionInfoImpl) sessionInfo).setNamePathResolver(resolver);
+ sessionInfo.setNamePathResolver(resolver);
}
return resolver;
}
@@ -497,7 +497,7 @@
/**
* @see RepositoryService#getRepositoryDescriptors()
*/
- public Map getRepositoryDescriptors() throws RepositoryException {
+ public Map<String, QValue[]> getRepositoryDescriptors() throws RepositoryException {
if (descriptors == null) {
ReportInfo info = new ReportInfo(RepositoryDescriptorsReport.REPOSITORY_DESCRIPTORS_REPORT, DEPTH_0);
ReportMethod method = null;
@@ -514,12 +514,21 @@
while (nsElems.hasNext()) {
Element elem = nsElems.nextElement();
String key = DomUtil.getChildText(elem, ItemResourceConstants.XML_DESCRIPTORKEY, ItemResourceConstants.NAMESPACE);
- String descriptor = DomUtil.getChildText(elem, ItemResourceConstants.XML_DESCRIPTORVALUE, ItemResourceConstants.NAMESPACE);
- if (key != null && descriptor != null) {
- descriptors.put(key, descriptor);
- } else {
- log.error("Invalid descriptor key / value pair: " + key + " -> " + descriptor);
+ ElementIterator it = DomUtil.getChildren(elem, ItemResourceConstants.XML_DESCRIPTORVALUE, ItemResourceConstants.NAMESPACE);
+ List<QValue> vs = new ArrayList();
+ while (it.hasNext()) {
+ Element dv = it.nextElement();
+ String descriptor = DomUtil.getText(dv);
+ if (key != null && descriptor != null) {
+ String typeStr = (DomUtil.getAttribute(dv, ItemResourceConstants.ATTR_VALUE_TYPE, null));
+ int type = (typeStr == null) ? PropertyType.STRING : PropertyType.valueFromName(typeStr);
+ vs.add(getQValueFactory().create(descriptor, type));
+ } else {
+ log.error("Invalid descriptor key / value pair: " + key + " -> " + descriptor);
+ }
+
}
+ descriptors.put(key, vs.toArray(new QValue[vs.size()]));
}
}
} catch (IOException e) {
@@ -574,7 +583,6 @@
throw new LoginException("Login failed: Unknown workspace '" + workspaceName+ "'.");
}
- boolean success = false;
DavPropertySet props = responses[0].getProperties(DavServletResponse.SC_OK);
if (props.contains(ItemResourceConstants.JCR_WORKSPACE_NAME)) {
String wspName = props.get(ItemResourceConstants.JCR_WORKSPACE_NAME).getValue().toString();
@@ -1110,8 +1118,7 @@
throw new ItemNotFoundException("Unable to retrieve the property with id " + saveGetIdString(propertyId, resolver));
}
- PropertyInfo pInfo = new PropertyInfoImpl(propertyId, path, type, isMultiValued, values);
- return pInfo;
+ return new PropertyInfoImpl(propertyId, path, type, isMultiValued, values);
} catch (IOException e) {
throw new RepositoryException(e);
} catch (DavException e) {
@@ -1464,6 +1471,17 @@
execute(method, sessionInfo);
}
+ /**
+ * @see RepositoryService#checkout(SessionInfo, NodeId, NodeId)
+ */
+ public void checkout(SessionInfo sessionInfo, NodeId nodeId, NodeId activityOd) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ // TODO
+ throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+ }
+
+ /**
+ * @see RepositoryService#checkpoint(SessionInfo, NodeId)
+ */
public NodeId checkpoint(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
// TODO
throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
@@ -1639,9 +1657,9 @@
}
/**
- * @see RepositoryService#createConfiguration(SessionInfo, NodeId, NodeId)
+ * @see RepositoryService#createConfiguration(SessionInfo, NodeId)
*/
- public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId, NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+ public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
// TODO
throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java Tue Sep 8 16:09:28 2009
@@ -19,12 +19,9 @@
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.Path;
import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.QValueFactory;
import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.apache.jackrabbit.spi.commons.value.AbstractQValueFactory;
-import org.apache.jackrabbit.spi.commons.value.AbstractQValue;
import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
-import org.apache.jackrabbit.util.ISO8601;
+import org.apache.jackrabbit.spi.commons.value.AbstractQValue;
import org.apache.jackrabbit.util.TransientFileFactory;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.jcr.ItemResourceConstants;
@@ -39,13 +36,10 @@
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
-import javax.jcr.ValueFormatException;
-import javax.jcr.Binary;
import javax.jcr.ValueFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -56,20 +50,20 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
import java.util.Arrays;
-import java.util.Calendar;
-import java.util.TimeZone;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.net.URISyntaxException;
/**
* <code>ValueFactoryImpl</code>...
*/
-class QValueFactoryImpl extends AbstractQValueFactory {
+class QValueFactoryImpl extends org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl {
+
+ /**
+ * A dummy value for calling the constructor of AbstractQValue
+ */
+ private static final Object DUMMY_VALUE = new Serializable() {
+ private static final long serialVersionUID = -5667366239976271493L;
+ };
- private final NamePathResolver resolver;
private final ValueLoader loader;
private final ValueFactory vf;
@@ -78,7 +72,6 @@
}
QValueFactoryImpl(NamePathResolver resolver, ValueLoader loader) {
- this.resolver = resolver;
this.loader = loader;
vf = new ValueFactoryQImpl(this, resolver);
}
@@ -110,421 +103,18 @@
return loader.loadType(uri);
}
- //------------------------------------------------------< QValueFactory >---
- /**
- * @see QValueFactory#create(String, int)
- */
- public QValue create(String value, int type) throws RepositoryException {
- if (value == null) {
- throw new IllegalArgumentException("Cannot create QValue from null value.");
- }
- try {
- switch (type) {
- case PropertyType.BOOLEAN:
- return (Boolean.valueOf(value).booleanValue()) ?
- QValueImpl.TRUE :
- QValueImpl.FALSE;
- case PropertyType.DATE: {
- Calendar cal = ISO8601.parse(value);
- if (cal == null) {
- throw new ValueFormatException("not a valid date: " + value);
- }
- return new DateQValue(cal);
- }
- case PropertyType.DOUBLE:
- return new QValueImpl(Double.valueOf(value));
- case PropertyType.LONG:
- return new QValueImpl(Long.valueOf(value));
- case PropertyType.PATH:
- return new QValueImpl(PATH_FACTORY.create(value));
- case PropertyType.NAME:
- return new QValueImpl(NAME_FACTORY.create(value));
- case PropertyType.STRING:
- case PropertyType.REFERENCE:
- case PropertyType.WEAKREFERENCE:
- return new QValueImpl(value, type);
- case PropertyType.BINARY:
- return new BinaryQValue(value.getBytes(DEFAULT_ENCODING));
- case PropertyType.DECIMAL:
- return new QValueImpl(new BigDecimal(value));
- case PropertyType.URI:
- return new QValueImpl(URI.create(value));
- }
- } catch (IllegalArgumentException ex) {
- // given String value cannot be converted to Long/Double/Path/Name
- throw new ValueFormatException(ex);
- } catch (UnsupportedEncodingException ex) {
- throw new RepositoryException(ex);
- }
-
- // none of the legal types:
- throw new IllegalArgumentException("illegal type");
- }
-
- /**
- * @see QValueFactory#create(Calendar)
- */
- public QValue create(Calendar value) {
- if (value == null) {
- throw new IllegalArgumentException("Cannot create QValue from null value.");
- }
- // Calendar is not constant, must create a clone
- return new DateQValue((Calendar) value.clone());
- }
-
- /**
- * @see QValueFactory#create(double)
- */
- public QValue create(double value) {
- return new QValueImpl(Double.valueOf(value));
- }
-
- /**
- * @see QValueFactory#create(long)
- */
- public QValue create(long value) {
- return new QValueImpl(Long.valueOf(value));
- }
-
- /**
- * @see QValueFactory#create(boolean)
- */
- public QValue create(boolean value) throws RepositoryException {
- return (value) ? QValueImpl.TRUE : QValueImpl.FALSE;
- }
-
- /**
- * @see QValueFactory#create(URI)
- */
- public QValue create(URI value) {
- return new QValueImpl(value);
- }
-
- /**
- * @see QValueFactory#create(URI)
- */
- public QValue create(BigDecimal value) {
- return new QValueImpl(value);
- }
-
- /**
- * @see QValueFactory#create(Name)
- */
- public QValue create(Name value) {
- return new QValueImpl(value);
- }
-
- /**
- * @see QValueFactory#create(Path)
- */
- public QValue create(Path value) {
- return new QValueImpl(value);
- }
-
- /**
- * @see QValueFactory#create(byte[])
- */
- public QValue create(byte[] value) {
- if (value == null) {
- throw new IllegalArgumentException("Cannot create QValue from null value.");
- }
- return new BinaryQValue(value);
- }
-
- /**
- * @see QValueFactory#create(InputStream)
- */
- public QValue create(InputStream value) throws IOException {
- if (value == null) {
- throw new IllegalArgumentException("Cannot create QValue from null value.");
- }
- return new BinaryQValue(value);
- }
-
- /**
- * @see QValueFactory#create(File)
- */
- public QValue create(File value) throws IOException {
- if (value == null) {
- throw new IllegalArgumentException("Cannot create QValue from null value.");
- }
- return new BinaryQValue(value);
- }
-
//--------------------------------------------------------< Inner Class >---
- /**
- * <code>QValue</code> implementation for all valid <code>PropertyType</code>s
- * except for BINARY.
- * @see QValueFactoryImpl.BinaryQValue
- */
- private static class QValueImpl extends AbstractQValue implements Serializable {
-
- private static final QValue TRUE = new QValueImpl(Boolean.TRUE);
- private static final QValue FALSE = new QValueImpl(Boolean.FALSE);
-
- private QValueImpl(String value, int type) {
- super(value, type);
- }
-
- private QValueImpl(Long value) {
- super(value);
- }
-
- private QValueImpl(Double value) {
- super(value);
- }
- private QValueImpl(Boolean value) {
- super(value);
- }
-
- private QValueImpl(Calendar value) {
- super(value);
- }
-
- private QValueImpl(Name value) {
- super(value);
- }
-
- private QValueImpl(Path value) {
- super(value);
- }
-
- protected QValueImpl(BigDecimal value) {
- super(value);
- }
-
- protected QValueImpl(URI value) {
- super(value);
- }
-
- //---------------------------------------------------------< QValue >---
- /**
- * @see QValue#getString()
- */
- public String getString() {
- return val.toString();
- }
-
- /**
- * @see QValue#getStream()
- */
- public InputStream getStream() throws RepositoryException {
- try {
- // convert via string
- return new ByteArrayInputStream(getString().getBytes(DEFAULT_ENCODING));
- } catch (UnsupportedEncodingException e) {
- throw new RepositoryException(QValueFactoryImpl.DEFAULT_ENCODING + " is not supported encoding on this platform", e);
- }
- }
-
- /**
- * @see org.apache.jackrabbit.spi.QValue#getDecimal()
- */
- public BigDecimal getDecimal() throws RepositoryException {
- if (val instanceof BigDecimal) {
- return (BigDecimal) val;
- } else if (val instanceof Double) {
- return new BigDecimal((Double) val);
- } else if (val instanceof Long) {
- return new BigDecimal((Long) val);
- } else if (val instanceof Calendar) {
- return new BigDecimal(((Calendar) val).getTimeInMillis());
- } else {
- try {
- return new BigDecimal(getString());
- } catch (NumberFormatException e) {
- throw new ValueFormatException("not a valid decimal string: " + getString(), e);
- }
- }
- }
-
- /**
- * @see QValue#getCalendar()
- */
- public Calendar getCalendar() throws RepositoryException {
- if (val instanceof Calendar) {
- return (Calendar) ((Calendar) val).clone();
- } else if (val instanceof Double) {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00"));
- cal.setTimeInMillis(((Double) val).longValue());
- return cal;
- } else if (val instanceof Long) {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00"));
- cal.setTimeInMillis(((Long) val).longValue());
- return cal;
- } else if (val instanceof BigDecimal) {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00"));
- cal.setTimeInMillis(((BigDecimal) val).longValue());
- return cal;
- } else {
- String str = getString();
- Calendar cal = ISO8601.parse(str);
- if (cal == null) {
- int type = getType();
- if (type == PropertyType.LONG) {
- cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00"));
- cal.setTimeInMillis(new Long(str).longValue());
- } else if (type == PropertyType.DOUBLE) {
- cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:00"));
- cal.setTimeInMillis(new Double(str).longValue());
- } else {
- throw new ValueFormatException("not a date string: " + getString());
- }
- }
- return cal;
- }
- }
-
- /**
- * @see QValue#getDouble()
- */
- public double getDouble() throws RepositoryException {
- if (val instanceof Double) {
- return ((Double) val).doubleValue();
- } else if (val instanceof BigDecimal) {
- return ((BigDecimal) val).doubleValue();
- } else if (val instanceof Calendar) {
- return ((Calendar) val).getTimeInMillis();
- } else {
- try {
- return Double.parseDouble(getString());
- } catch (NumberFormatException ex) {
- int type = getType();
- if (type == PropertyType.DATE) {
- Calendar cal = ISO8601.parse(getString());
- if (cal != null) {
- return cal.getTimeInMillis();
- }
- }
- throw new ValueFormatException("not a double: " + getString(), ex);
- }
- }
- }
-
- /**
- * @see QValue#getLong()
- */
- public long getLong() throws RepositoryException {
- if (val instanceof Long) {
- return ((Long) val).longValue();
- } else if (val instanceof Double) {
- return ((Double) val).longValue();
- } else if (val instanceof BigDecimal) {
- return ((BigDecimal) val).longValue();
- } else if (val instanceof Calendar) {
- return ((Calendar) val).getTimeInMillis();
- } else {
- String str = getString();
- try {
- return Long.parseLong(str);
- } catch (NumberFormatException ex) {
- int type = getType();
- if (type == PropertyType.DOUBLE) {
- return new Double(str).longValue();
- } else if (type == PropertyType.DATE) {
- Calendar cal = ISO8601.parse(getString());
- if (cal != null) {
- return cal.getTimeInMillis();
- }
- }
- throw new ValueFormatException("not a long: " + getString(), ex);
- }
- }
- }
-
- /**
- * @see QValue#getBinary()
- */
- public Binary getBinary() throws RepositoryException {
- // TODO FIXME consolidate Binary implementations
- return new Binary() {
- public InputStream getStream() throws RepositoryException {
- return QValueImpl.this.getStream();
- }
-
- public int read(byte[] b, long position) throws IOException, RepositoryException {
- InputStream in = getStream();
- try {
- in.skip(position);
- return in.read(b);
- } finally {
- in.close();
- }
- }
-
- public long getSize() throws RepositoryException {
- return getLength();
- }
-
- public void dispose() {
- }
-
- };
- }
-
- }
-
- //--------------------------------------------------------< Inner Class >---
- /**
- * Extension for values of type {@link PropertyType#DATE}.
- */
- private class DateQValue extends QValueImpl {
-
- private final String formattedStr;
-
- private DateQValue(Calendar value) {
- super(value);
- formattedStr = ISO8601.format(value);
- }
-
- /**
- * @return The formatted String of the internal Calendar value.
- * @see QValue#getString()
- * @see ISO8601#format(Calendar)
- */
- public String getString() {
- return formattedStr;
- }
-
- //---------------------------------------------------------< Object >---
- /**
- * @param obj The object to be checked for equality.
- * @return true if the given Object is a <code>DateQValue</code> with an
- * equal String representation.
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DateQValue) {
- DateQValue other = (DateQValue) obj;
- return formattedStr.equals(other.formattedStr);
- } else if (obj instanceof QValueImpl) {
- QValueImpl other = (QValueImpl) obj;
- return other.getType() == PropertyType.DATE && formattedStr.equals(other.getString());
- }
- return false;
- }
-
- /**
- * @return the hashCode of the formatted String of the Calender value.
- * @see Object#hashCode()
- */
- public int hashCode() {
- return formattedStr.hashCode();
- }
- }
-
- //--------------------------------------------------------< Inner Class >---
/**
* <code>BinaryQValue</code> represents a binary <code>Value</code> which is
* backed by a resource or byte[]. Unlike <code>BinaryValue</code> it has no
* state, i.e. the <code>getStream()</code> method always returns a fresh
* <code>InputStream</code> instance.
*/
- private class BinaryQValue implements QValue, Serializable, ValueLoader.Target {
+ private class BinaryQValue extends AbstractQValue implements ValueLoader.Target {
+
+ private static final long serialVersionUID = 2736654000266713469L;
+
/**
* empty array
*/
@@ -553,11 +143,6 @@
private byte[] buffer;
/**
- * Converted text
- */
- private transient String text = null;
-
- /**
* URI to retrieve the value from
*/
private String uri;
@@ -566,6 +151,7 @@
private boolean initialized = true;
private BinaryQValue(long length, String uri, int index) {
+ super(DUMMY_VALUE, PropertyType.BINARY);
this.length = length;
this.uri = uri;
this.index = index;
@@ -578,58 +164,6 @@
* to a temporary file or to a byte buffer if its size is smaller than
* {@link #MAX_BUFFER_SIZE}.
* <p/>
- * The new instance represents a <i>temporary</i> value whose dynamically
- * allocated resources will be freed explicitly on {@link #discard()}.
- *
- * @param in stream to be represented as a <code>BinaryQValue</code> instance
- * @throws IOException if an error occurs while reading from the stream or
- * writing to the temporary file
- */
- private BinaryQValue(InputStream in) throws IOException {
- init(in, true);
- }
-
-
- /**
- * Creates a new <code>BinaryQValue</code> instance from a
- * <code>byte[]</code> array.
- *
- * @param bytes byte array to be represented as a <code>BinaryQValue</code>
- * instance
- */
- private BinaryQValue(byte[] bytes) {
- buffer = bytes;
- file = null;
- // this instance is not backed by a temporarily allocated buffer
- temp = false;
- }
-
- /**
- * Creates a new <code>BinaryQValue</code> instance from a <code>File</code>.
- *
- * @param file file to be represented as a <code>BinaryQValue</code> instance
- * @throws IOException if the file can not be read
- */
- private BinaryQValue(File file) throws IOException {
- String path = file.getCanonicalPath();
- if (!file.isFile()) {
- throw new IOException(path + ": the specified file does not exist");
- }
- if (!file.canRead()) {
- throw new IOException(path + ": the specified file can not be read");
- }
- // this instance is backed by a 'real' file
- this.file = file;
- // this instance is not backed by temporarily allocated resource/buffer
- temp = false;
- }
-
- /**
- * Creates a new <code>BinaryQValue</code> instance from an
- * <code>InputStream</code>. The contents of the stream is spooled
- * to a temporary file or to a byte buffer if its size is smaller than
- * {@link #MAX_BUFFER_SIZE}.
- * <p/>
* The <code>temp</code> parameter governs whether dynamically allocated
* resources will be freed explicitly on {@link #discard()}. Note that any
* dynamically allocated resources (temp file/buffer) will be freed
@@ -677,6 +211,7 @@
}
}
} finally {
+ in.close();
if (out != null) {
out.close();
}
@@ -695,12 +230,6 @@
}
//---------------------------------------------------------< QValue >---
- /**
- * @see QValue#getType()
- */
- public int getType() {
- return PropertyType.BINARY;
- }
/**
* Returns the length of this <code>BinaryQValue</code>.
@@ -727,32 +256,6 @@
}
/**
- * @see QValue#getString()
- */
- public String getString() throws RepositoryException {
- if (text == null) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- spool(out);
- byte[] data = out.toByteArray();
- text = new String(data, QValueFactoryImpl.DEFAULT_ENCODING);
- } catch (UnsupportedEncodingException e) {
- throw new RepositoryException(QValueFactoryImpl.DEFAULT_ENCODING
- + " not supported on this platform", e);
- } catch (IOException e) {
- throw new ValueFormatException("conversion from stream to string failed", e);
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- return text;
- }
-
- /**
* @see QValue#getStream()
*/
public InputStream getStream() throws RepositoryException {
@@ -788,44 +291,6 @@
}
/**
- * @see QValue#getCalendar()
- */
- public Calendar getCalendar() throws RepositoryException {
- Calendar cal = ISO8601.parse(getString());
- if (cal == null) {
- throw new ValueFormatException("not a date string: " + getString());
- } else {
- return cal;
- }
- }
-
- /**
- * @see QValue#getDouble()
- */
- public double getDouble() throws RepositoryException {
- try {
- return Double.parseDouble(getString());
- } catch (NumberFormatException ex) {
- throw new ValueFormatException(ex);
- }
- }
-
- /**
- * @see QValue#getLong()
- */
- public long getLong() throws RepositoryException {
- try {
- return Long.parseLong(getString());
- } catch (NumberFormatException ex) {
- throw new ValueFormatException(ex);
- }
- }
-
- public boolean getBoolean() throws RepositoryException {
- return new Boolean(getString()).booleanValue();
- }
-
- /**
* @see QValue#getPath()
*/
public Path getPath() throws RepositoryException {
@@ -833,59 +298,6 @@
}
/**
- * @see QValue#getDecimal()
- */
- public BigDecimal getDecimal() throws RepositoryException {
- try {
- return new BigDecimal(getString());
- } catch (NumberFormatException ex) {
- throw new ValueFormatException(ex);
- }
- }
-
- /**
- * @see QValue#getURI()
- */
- public URI getURI() throws RepositoryException {
- try {
- return new URI(getString());
- } catch (URISyntaxException ex) {
- throw new ValueFormatException(ex);
- }
- }
-
- /**
- * @see QValue#getBinary()
- */
- public Binary getBinary() throws RepositoryException {
- // TODO FIXME consolidate Binary implementations
- // TODO optimize
- return new Binary() {
- public InputStream getStream() throws RepositoryException {
- return BinaryQValue.this.getStream();
- }
-
- public int read(byte[] b, long position) throws IOException, RepositoryException {
- InputStream in = getStream();
- try {
- in.skip(position);
- return in.read(b);
- } finally {
- in.close();
- }
- }
-
- public long getSize() throws RepositoryException {
- return getLength();
- }
-
- public void dispose() {
- }
-
- };
- }
-
- /**
* Frees temporarily allocated resources such as temporary file, buffer, etc.
* If this <code>BinaryQValue</code> is backed by a persistent resource
* calling this method will have no effect.
@@ -972,50 +384,6 @@
}
//----------------------------------------------------------------------
- /**
- * Spools the contents of this <code>BinaryQValue</code> to the given
- * output stream.
- *
- * @param out output stream
- * @throws RepositoryException if the input stream for this
- * <code>BinaryQValue</code> could not be obtained
- * @throws IOException if an error occurs while while spooling
- */
- private void spool(OutputStream out) throws RepositoryException, IOException {
- InputStream in;
- if (file != null) {
- // this instance is backed by a 'real' file
- try {
- in = new FileInputStream(file);
- } catch (FileNotFoundException fnfe) {
- throw new RepositoryException("file backing binary value not found",
- fnfe);
- }
- } else if (buffer != null) {
- // this instance is backed by an in-memory buffer
- in = new ByteArrayInputStream(buffer);
- } else {
- // only uri present:
- loadBinary();
- if (buffer == null) {
- in = new FileInputStream(file);
- } else {
- in = new ByteArrayInputStream(buffer);
- }
- }
- try {
- byte[] buffer = new byte[0x2000];
- int read;
- while ((read = in.read(buffer)) > 0) {
- out.write(buffer, 0, read);
- }
- } finally {
- try {
- in.close();
- } catch (IOException ignore) {
- }
- }
- }
private synchronized void loadBinary() throws RepositoryException, IOException {
if (uri == null) {
@@ -1099,4 +467,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java Tue Sep 8 16:09:28 2009
@@ -86,6 +86,8 @@
private static final String ORDER_POSITION_LAST = "#last";
private static final String ORDER_POSITION_BEFORE = "#before";
+ private static final String DEFAULT_CHARSET = "UTF-8";
+
/**
* base uri to the extended jcr-server that can handle the GET and POST
* (or PATCH) requests sent by this service implementation.
@@ -588,7 +590,6 @@
public void setMixins(NodeId nodeId, Name[] mixinNodeTypeNames) throws RepositoryException {
assertMethod();
- NamePathResolver resolver = getNamePathResolver(sessionInfo);
QValue[] vs = new QValue[mixinNodeTypeNames.length];
for (int i = 0; i < mixinNodeTypeNames.length; i++) {
vs[i] = getQValueFactory(sessionInfo).create(mixinNodeTypeNames[i]);
@@ -602,7 +603,6 @@
public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException {
assertMethod();
- NamePathResolver resolver = getNamePathResolver(sessionInfo);
QValue v = getQValueFactory(sessionInfo).create(primaryNodeTypeName);
addProperty(nodeId, NameConstants.JCR_PRIMARYTYPE, v);
}
@@ -694,7 +694,7 @@
* @param value
*/
private void addPart(String paramName, String value) {
- parts.add(new StringPart(paramName, value));
+ parts.add(new StringPart(paramName, value, DEFAULT_CHARSET));
}
/**
@@ -711,13 +711,13 @@
part = new FilePart(paramName, new BinaryPartSource(value));
break;
case PropertyType.NAME:
- part = new StringPart(paramName, resolver.getJCRName(value.getName()));
+ part = new StringPart(paramName, resolver.getJCRName(value.getName()), DEFAULT_CHARSET);
break;
case PropertyType.PATH:
- part = new StringPart(paramName, resolver.getJCRPath(value.getPath()));
+ part = new StringPart(paramName, resolver.getJCRPath(value.getPath()), DEFAULT_CHARSET);
break;
default:
- part = new StringPart(paramName, value.getString());
+ part = new StringPart(paramName, value.getString(), DEFAULT_CHARSET);
}
String ctype = JcrValueType.contentTypeFromType(value.getType());
((PartBase) part).setContentType(ctype);
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java Tue Sep 8 16:09:28 2009
@@ -34,7 +34,6 @@
import org.apache.jackrabbit.spi.commons.name.NameConstants;
import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
import org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver;
-import org.apache.jackrabbit.uuid.UUID;
import javax.jcr.ItemNotFoundException;
import javax.jcr.NamespaceException;
@@ -47,6 +46,7 @@
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
/**
* <code>ConnectionTest</code>...
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/pom.xml?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/pom.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/pom.xml Tue Sep 8 16:09:28 2009
@@ -54,7 +54,7 @@
<include>**/TestAll.java</include>
</includes>
<forkMode>once</forkMode>
- <argLine>-Xmx128m -enableassertions</argLine>
+ <argLine>-Xmx256m -enableassertions</argLine>
<systemProperties>
<property>
<name>derby.system.durability</name>
@@ -71,7 +71,10 @@
org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest#testRegisteredNamespaceVisibility
org.apache.jackrabbit.test.api.ShareableNodeTest
org.apache.jackrabbit.test.api.version.simple
- org.apache.jackrabbit.test.api.version.ActivitiesTest
+ org.apache.jackrabbit.test.api.version.ActivitiesTest#testActivitiesPath
+ org.apache.jackrabbit.test.api.version.ActivitiesTest#testActivitiesRelation
+ org.apache.jackrabbit.test.api.version.ConfigurationsTest#testCreateConfigWithBaseline
+ org.apache.jackrabbit.test.api.LifecycleTest
</value>
</property>
</systemProperties>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/PropertyInfoImpl.java Tue Sep 8 16:09:28 2009
@@ -50,7 +50,7 @@
throws RepositoryException, NameException {
super(resolver.getQPath(property.getPath()),
idFactory.createPropertyId(property, resolver),
- property.getType(), property.getDefinition().isMultiple(),
+ property.getType(), property.isMultiple(),
getValues(property, resolver, qValueFactory));
}
@@ -67,7 +67,7 @@
NamePathResolver resolver,
QValueFactory factory)
throws RepositoryException {
- boolean isMultiValued = property.getDefinition().isMultiple();
+ boolean isMultiValued = property.isMultiple();
QValue[] values;
if (isMultiValued) {
Value[] jcrValues = property.getValues();
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java Tue Sep 8 16:09:28 2009
@@ -42,6 +42,7 @@
import org.apache.jackrabbit.spi.Event;
import org.apache.jackrabbit.spi.commons.EventFilterImpl;
import org.apache.jackrabbit.spi.commons.EventBundleImpl;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
import org.apache.jackrabbit.spi.commons.nodetype.NodeTypeDefinitionImpl;
import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
@@ -50,6 +51,7 @@
import org.apache.jackrabbit.spi.commons.conversion.NameException;
import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
+import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
import org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl;
import org.apache.jackrabbit.spi.commons.value.ValueFormat;
import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
@@ -206,14 +208,29 @@
/**
* {@inheritDoc}
*/
- public Map getRepositoryDescriptors() throws RepositoryException {
- Map descriptors = new HashMap();
- String[] keys = repository.getDescriptorKeys();
- for (int i = 0; i < keys.length; i++) {
- if (keys[i].equals(Repository.OPTION_TRANSACTIONS_SUPPORTED)) {
- descriptors.put(keys[i], "false");
+ public Map<String, QValue[]> getRepositoryDescriptors() throws RepositoryException {
+ Map<String, QValue[]> descriptors = new HashMap();
+ for (String key : repository.getDescriptorKeys()) {
+ if (key.equals(Repository.OPTION_TRANSACTIONS_SUPPORTED)) {
+ descriptors.put(key, new QValue[] {qValueFactory.create(false)});
} else {
- descriptors.put(keys[i], repository.getDescriptor(keys[i]));
+ Value[] vs = repository.getDescriptorValues(key);
+ QValue[] qvs = new QValue[vs.length];
+ for (int i = 0; i < vs.length; i++) {
+ // Name and path resolver that uses a dummy namespace resolver
+ // as Name/Path values are not expected to occur in the
+ // descriptors. TODO: check again.
+ NamePathResolver resolver = new DefaultNamePathResolver(new NamespaceResolver() {
+ public String getURI(String prefix) throws NamespaceException {
+ return prefix;
+ }
+ public String getPrefix(String uri) throws NamespaceException {
+ return uri;
+ }
+ });
+ qvs[i] = ValueFormat.getQValue(vs[i], resolver, qValueFactory);
+ }
+ descriptors.put(key, qvs);
}
}
return descriptors;
@@ -684,7 +701,22 @@
final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
executeWithLocalEvents(new Callable() {
public Object run() throws RepositoryException {
- getNode(nodeId, getSessionInfoImpl(sessionInfo)).checkout();
+ getNode(nodeId, sInfo).checkout();
+ return null;
+ }
+ }, sInfo);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void checkout(final SessionInfo sessionInfo, final NodeId nodeId, NodeId activityId) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
+ Node activity = (activityId == null) ? null : getNode(activityId, sInfo);
+ sInfo.getSession().getWorkspace().getVersionManager().setActivity(activity);
+ executeWithLocalEvents(new Callable() {
+ public Object run() throws RepositoryException {
+ getNode(nodeId, sInfo).checkout();
return null;
}
}, sInfo);
@@ -966,11 +998,10 @@
public void removeActivity(SessionInfo sessionInfo, final NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
final VersionManager vMgr = getVersionManager(sInfo);
- Node activity = (Node) executeWithLocalEvents(new Callable() {
+ executeWithLocalEvents(new Callable() {
public Object run() throws RepositoryException {
- // TODO: uncomment as soon as removeActivity method is fixed in jsr 283
- // return vMgr.removeActivity(getNode(activityId, sInfo));
- throw new UnsupportedOperationException("Impl missing... waiting for updated jsr 283 jar.");
+ vMgr.removeActivity(getNode(activityId, sInfo));
+ return null;
}
}, getSessionInfoImpl(sessionInfo));
}
@@ -997,12 +1028,13 @@
/**
* {@inheritDoc}
*/
- public NodeId createConfiguration(SessionInfo sessionInfo, final NodeId nodeId, final NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+ public NodeId createConfiguration(SessionInfo sessionInfo, final NodeId nodeId)
+ throws UnsupportedRepositoryOperationException, RepositoryException {
final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
final VersionManager vMgr = getVersionManager(sInfo);
Node configuration = (Node) executeWithLocalEvents(new Callable() {
public Object run() throws RepositoryException {
- return vMgr.createConfiguration(getNodePath(nodeId, sInfo), (Version) getNode(baselineId, sInfo));
+ return vMgr.createConfiguration(getNodePath(nodeId, sInfo));
}
}, getSessionInfoImpl(sessionInfo));
return idFactory.createNodeId(configuration, sInfo.getNamePathResolver());
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/pom.xml?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/pom.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/pom.xml Tue Sep 8 16:09:28 2009
@@ -1,116 +1,116 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
-<!-- ====================================================================== -->
-<!-- P R O J E C T D E S C R I P T I O N -->
-<!-- ====================================================================== -->
- <parent>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-parent</artifactId>
- <version>2.0-SNAPSHOT</version>
- <relativePath>../jackrabbit-parent/pom.xml</relativePath>
- </parent>
- <artifactId>jackrabbit-standalone</artifactId>
- <packaging>bundle</packaging>
- <name>Jackrabbit Standalone</name>
- <description>Runnable jar packaging of Apache Jackrabbit</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.jackrabbit.standalone
- </Export-Package>
- <Embed-Dependency>
- *;inline=
- *.txt|*.html|*.jsp|*.xml|*.jar|*.properties|
- remoting/**|bootstrap/**|javax/**|repackage/**|images/**|
- com/**|Resources/**|css/**|schema*/**|EDU/**|error/**|org/**|
- META-INF/*.tld|META-INF/maven/**|META-INF/services/**|
- WEB-INF/config.xml|WEB-INF/*.properties|WEB-INF/templates/**
- </Embed-Dependency>
- <Embed-Transitive>true</Embed-Transitive>
- <Main-Class>org.apache.jackrabbit.standalone.Main</Main-Class>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>javax.jcr</groupId>
- <artifactId>jcr</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-webapp</artifactId>
- <version>2.0-SNAPSHOT</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-webapp</artifactId>
- <version>2.0-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-2.1</artifactId>
- </dependency>
- <!--
- JCR-1882: Explicitly declare versions of transitive Jetty dependencies
- to avoid problems with the ${project.version} setting that Jetty uses.
- -->
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-api-2.1</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.1</version>
- </dependency>
- </dependencies>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+<!-- ====================================================================== -->
+<!-- P R O J E C T D E S C R I P T I O N -->
+<!-- ====================================================================== -->
+ <parent>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../jackrabbit-parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>jackrabbit-standalone</artifactId>
+ <packaging>bundle</packaging>
+ <name>Jackrabbit Standalone</name>
+ <description>Runnable jar packaging of Apache Jackrabbit</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.jackrabbit.standalone
+ </Export-Package>
+ <Embed-Dependency>
+ *;inline=
+ *.txt|*.html|*.jsp|*.xml|*.jar|*.properties|
+ remoting/**|bootstrap/**|javax/**|repackage/**|images/**|
+ com/**|Resources/**|css/**|schema*/**|EDU/**|error/**|org/**|
+ META-INF/*.tld|META-INF/maven/**|META-INF/services/**|
+ WEB-INF/config.xml|WEB-INF/*.properties|WEB-INF/templates/**
+ </Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Main-Class>org.apache.jackrabbit.standalone.Main</Main-Class>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-webapp</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-webapp</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1</artifactId>
+ </dependency>
+ <!--
+ JCR-1882: Explicitly declare versions of transitive Jetty dependencies
+ to avoid problems with the ${project.version} setting that Jetty uses.
+ -->
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-api-2.1</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java Tue Sep 8 16:09:28 2009
@@ -185,10 +185,7 @@
}
message("Creating a repository copy in " + targetDir);
-
- RepositoryCopier copier = new RepositoryCopier(source, target);
- copier.copy();
-
+ RepositoryCopier.copy(source, target);
message("The repository has been successfully copied.");
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/pom.xml?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/pom.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/pom.xml Tue Sep 8 16:09:28 2009
@@ -63,9 +63,8 @@
<dependencies>
<dependency>
<groupId>org.apache.tika</groupId>
- <artifactId>tika</artifactId>
- <version>0.3</version>
- <classifier>jdk14</classifier>
+ <artifactId>tika-parsers</artifactId>
+ <version>0.4</version>
<exclusions>
<exclusion>
<groupId>bouncycastle</groupId>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/DefaultTextExtractor.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/DefaultTextExtractor.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/DefaultTextExtractor.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-text-extractors/src/main/java/org/apache/jackrabbit/extractor/DefaultTextExtractor.java Tue Sep 8 16:09:28 2009
@@ -24,7 +24,6 @@
import org.apache.tika.config.TikaConfig;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.AutoDetectParser;
-import org.apache.tika.parser.Parser;
import org.apache.tika.parser.ParsingReader;
/**
@@ -35,7 +34,7 @@
/**
* Auto-detecting parser.
*/
- private static final Parser PARSER;
+ private static final AutoDetectParser PARSER;
/**
* Supported content types.
@@ -43,34 +42,21 @@
private static final String[] TYPES;
static {
- // The default Tika configuration refers to Apache POI libraries that
- // are compiled for Java 5, and can thus not be loaded in Java 1.4.
- // This makes it impossible to load the default Tika configuration
- // (see TIKA-217 for background), and so we need to use the following
- // workaround to instantiate the Tika AutoDetectParser without the
- // POI classes (and thus support for MS Office formats) when running
- // on Java 1.4.
- AutoDetectParser parser;
- if ("1.4".equals(System.getProperty("java.specification.version"))) {
- InputStream stream =
- DefaultTextExtractor.class.getResourceAsStream("tika-config-jdk14.xml");
+ InputStream stream =
+ DefaultTextExtractor.class.getResourceAsStream("tika-config.xml");
+ try {
try {
- try {
- parser = new AutoDetectParser(new TikaConfig(stream));
- } finally {
- stream.close();
- }
- } catch (Exception e) {
- throw new RuntimeException(
- "Unable to load Tika configuration", e);
+ PARSER = new AutoDetectParser(new TikaConfig(stream));
+
+ Set<String> types = PARSER.getParsers().keySet();
+ TYPES = types.toArray(new String[types.size()]);
+ } finally {
+ stream.close();
}
- } else {
- parser = new AutoDetectParser();
+ } catch (Exception e) {
+ throw new RuntimeException(
+ "Unable to load Tika configuration", e);
}
- PARSER = parser;
-
- Set types = parser.getParsers().keySet();
- TYPES = (String[]) types.toArray(new String[types.size()]);
}
public String[] getContentTypes() {
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-webapp/src/main/webapp/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-webapp/src/main/webapp/META-INF/LICENSE.txt?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-webapp/src/main/webapp/META-INF/LICENSE.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-webapp/src/main/webapp/META-INF/LICENSE.txt Tue Sep 8 16:09:28 2009
@@ -202,11 +202,11 @@
limitations under the License.
-APACHE JACKRABBIT SUBCOMPONENTS:
+APACHE JACKRABBIT SUBCOMPONENTS
-Apache Jackrabbit includes subcomponents with separate copyright notices
-and license terms. Your use of these subcomponents is subject to the terms
-and conditions of the following licenses:
+Apache Jackrabbit includes parts with separate copyright notices and license
+terms. Your use of these subcomponents is subject to the terms and conditions
+of the following licenses:
XPath parser (jackrabbit-spi-commons)
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/DefaultActiveLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/DefaultActiveLock.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/DefaultActiveLock.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/DefaultActiveLock.java Tue Sep 8 16:09:28 2009
@@ -16,7 +16,8 @@
*/
package org.apache.jackrabbit.webdav.lock;
-import org.apache.jackrabbit.uuid.UUID;
+import java.util.UUID;
+
import org.apache.jackrabbit.webdav.DavConstants;
/**
@@ -31,7 +32,7 @@
*/
public class DefaultActiveLock extends AbstractActiveLock {
- private final String token = DavConstants.OPAQUE_LOCK_TOKEN_PREFIX + UUID.randomUUID().toString();
+ private final String token = DavConstants.OPAQUE_LOCK_TOKEN_PREFIX + UUID.randomUUID();
private String owner;
private boolean isDeep = true; // deep by default
private long expirationTime = DavConstants.INFINITE_TIMEOUT; // never expires by default;