exo-jcr SVN: r5457 - kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-17 04:08:32 -0500 (Tue, 17 Jan 2012)
New Revision: 5457
Modified:
kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/Log4JConfigurator.java
Log:
EXOJCR-1687: Fixed new sonar violations in project
Modified: kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/Log4JConfigurator.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/Log4JConfigurator.java 2012-01-17 08:40:14 UTC (rev 5456)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/Log4JConfigurator.java 2012-01-17 09:08:32 UTC (rev 5457)
@@ -44,7 +44,8 @@
{
try
{
- Class<?> propertyConfiguratorClass = ClassLoading.forName("org.apache.log4j.PropertyConfigurator", Log4JConfigurator.class);
+ Class<?> propertyConfiguratorClass =
+ ClassLoading.forName("org.apache.log4j.PropertyConfigurator", Log4JConfigurator.class);
Method m = propertyConfiguratorClass.getMethod("configure", Properties.class);
m.invoke(null, properties);
}
14 years, 3 months
exo-jcr SVN: r5456 - in jcr/branches/1.15.x: exo.jcr.component.core and 7 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-17 03:40:14 -0500 (Tue, 17 Jan 2012)
New Revision: 5456
Modified:
jcr/branches/1.15.x/applications/exo.jcr.applications.browser/src/main/java/org/exoplatform/applications/jcr/browser/JCRBrowserFilter.java
jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/pom.xml
jcr/branches/1.15.x/exo.jcr.component.core/pom.xml
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/observation/TestSessionsObservation.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/ThreadLocalSessionProviderInitializedFilter.java
jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/fckeditor/JCRContentFCKeditor.java
Log:
EXOJCR-821: Added throw an exception if session is logged out
Modified: jcr/branches/1.15.x/applications/exo.jcr.applications.browser/src/main/java/org/exoplatform/applications/jcr/browser/JCRBrowserFilter.java
===================================================================
--- jcr/branches/1.15.x/applications/exo.jcr.applications.browser/src/main/java/org/exoplatform/applications/jcr/browser/JCRBrowserFilter.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/applications/exo.jcr.applications.browser/src/main/java/org/exoplatform/applications/jcr/browser/JCRBrowserFilter.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -175,12 +175,16 @@
if (jcrBrowser.getRepository() != null)
{
-
if (workspaceName != null && !jcrBrowser.getSession().getWorkspace().getName().equals(workspaceName))
{
jcrBrowser.setSession(sessionProviderService.getSessionProvider(null).getSession(workspaceName,
jcrBrowser.getRepository()));
}
+ else
+ {
+ jcrBrowser.setSession(sessionProviderService.getSessionProvider(null).getSession(
+ jcrBrowser.getSession().getWorkspace().getName(), jcrBrowser.getRepository()));
+ }
// Navigation
String path = (String)httpRequest.getParameter("goParent");
@@ -192,7 +196,9 @@
{
path = (String)httpRequest.getParameter("goNodePath");
if (path != null)
+ {
jcrBrowser.setNode((Node)jcrBrowser.getSession().getItem(path));
+ }
// else seems nothing changed in JCR navigation
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/pom.xml 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/pom.xml 2012-01-17 08:40:14 UTC (rev 5456)
@@ -571,6 +571,11 @@
<name>jgroups.stack</name>
<value>udp</value>
</property>
+ <!-- Need for TCK tests -->
+ <property>
+ <name>exo.jcr.allow.closed.session.usage</name>
+ <value>true</value>
+ </property>
</systemProperties>
<includes>
<include>org/apache/jackrabbit/test/api/*Test.java</include>
@@ -657,6 +662,11 @@
<name>jgroups.stack</name>
<value>udp</value>
</property>
+ <!-- Need for TCK tests -->
+ <property>
+ <name>exo.jcr.allow.closed.session.usage</name>
+ <value>true</value>
+ </property>
</systemProperties>
<includes>
<!-- From default tests -->
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -156,7 +156,6 @@
{
try
{
- // Currently it only warns, but newer jcr versions (1.15+) will throw an exception
session.checkLive();
}
catch (RepositoryException e)
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -190,7 +190,6 @@
public void addMixin(String mixinName) throws NoSuchNodeTypeException, ConstraintViolationException,
VersionException, LockException, RepositoryException
{
-
checkValid();
if (LOG.isDebugEnabled())
@@ -245,7 +244,6 @@
public Node addNode(String relPath) throws PathNotFoundException, ConstraintViolationException, RepositoryException,
VersionException, LockException
{
-
checkValid();
if (JCRPath.THIS_RELPATH.equals(relPath))
{
@@ -303,7 +301,6 @@
}
// try to make new node
return doAddNode(parent, name, primaryTypeName, nodeDef);
-
}
/**
@@ -312,7 +309,6 @@
public Node addNode(String relPath, String nodeTypeName) throws ItemExistsException, PathNotFoundException,
NoSuchNodeTypeException, ConstraintViolationException, RepositoryException, VersionException, LockException
{
-
checkValid();
if (JCRPath.THIS_RELPATH.equals(relPath))
@@ -356,7 +352,6 @@
*/
public boolean canAddMixin(String mixinName) throws RepositoryException
{
-
checkValid();
NodeTypeData type =
@@ -452,7 +447,6 @@
public Version checkin() throws VersionException, UnsupportedRepositoryOperationException,
InvalidItemStateException, RepositoryException
{
-
checkValid();
if (!session.getAccessManager().hasPermission(getACL(),
@@ -518,7 +512,6 @@
*/
public void checkout() throws RepositoryException, UnsupportedRepositoryOperationException
{
-
checkValid();
if (!session.getAccessManager().hasPermission(getACL(), new String[]{PermissionType.SET_PROPERTY},
@@ -565,7 +558,6 @@
*/
public void checkPermission(String actions) throws AccessControlException, RepositoryException
{
-
checkValid();
if (!session.getAccessManager().hasPermission(getACL(), actions, session.getUserState().getIdentity()))
@@ -616,7 +608,6 @@
private void doAddMixin(NodeTypeData type) throws NoSuchNodeTypeException, ConstraintViolationException,
VersionException, LockException, RepositoryException
{
-
// Add both to mixinNodeTypes and to jcr:mixinTypes property
// Prepare mixin values
@@ -697,7 +688,6 @@
public void doneMerge(Version version) throws VersionException, InvalidItemStateException,
UnsupportedRepositoryOperationException, RepositoryException
{
-
if (!session.getAccessManager().hasPermission(getACL(),
new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
{
@@ -751,7 +741,6 @@
*/
public AccessControlList getACL() throws RepositoryException
{
-
checkValid();
List<AccessControlEntry> listEntry = new ArrayList<AccessControlEntry>();
@@ -769,7 +758,6 @@
*/
public Version getBaseVersion() throws UnsupportedRepositoryOperationException, RepositoryException
{
-
checkValid();
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
@@ -807,7 +795,6 @@
protected NodeData getCorrespondingNodeData(SessionImpl corrSession) throws ItemNotFoundException,
AccessDeniedException, RepositoryException
{
-
final QPath myPath = nodeData().getQPath();
final SessionDataManager corrDataManager = corrSession.getTransientNodesManager();
@@ -861,7 +848,6 @@
public String getCorrespondingNodePath(String workspaceName) throws ItemNotFoundException, NoSuchWorkspaceException,
AccessDeniedException, RepositoryException
{
-
checkValid();
SessionImpl corrSession =
@@ -875,7 +861,6 @@
*/
public NodeDefinition getDefinition() throws RepositoryException
{
-
checkValid();
if (nodeDefinition == null)
@@ -934,7 +919,6 @@
*/
public int getIndex() throws RepositoryException
{
-
checkValid();
return getInternalPath().getIndex();
@@ -946,7 +930,6 @@
public Lock getLock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException,
RepositoryException
{
-
checkValid();
LockImpl lock = session.getLockManager().getLock(this);
@@ -964,7 +947,6 @@
*/
public NodeType[] getMixinNodeTypes() throws RepositoryException
{
-
checkValid();
// should not be null
@@ -1007,7 +989,6 @@
*/
public Node getNode(String relPath) throws PathNotFoundException, RepositoryException
{
-
checkValid();
JCRPath itemPath = locationFactory.parseRelPath(relPath);
@@ -1037,7 +1018,6 @@
*/
public NodeIterator getNodes() throws RepositoryException
{
-
if (SessionImpl.FORCE_USE_GET_NODES_LAZILY)
{
if (LOG.isDebugEnabled())
@@ -1117,7 +1097,6 @@
*/
public NodeIterator getNodes(String namePattern) throws RepositoryException
{
-
long start = 0;
if (LOG.isDebugEnabled())
{
@@ -1181,7 +1160,6 @@
*/
public Item getPrimaryItem() throws ItemNotFoundException, RepositoryException
{
-
checkValid();
NodeTypeDataManager nodeTypeDataManager = session.getWorkspace().getNodeTypesHolder();
@@ -1229,7 +1207,6 @@
*/
public PropertyIterator getProperties() throws RepositoryException
{
-
long start = 0;
if (LOG.isDebugEnabled())
{
@@ -1359,7 +1336,6 @@
*/
public Property getProperty(String relPath) throws PathNotFoundException, RepositoryException
{
-
checkValid();
JCRPath itemPath = locationFactory.parseRelPath(relPath);
@@ -1383,7 +1359,6 @@
*/
public PropertyIterator getReferences() throws RepositoryException
{
-
checkValid();
return new EntityCollection(dataManager.getReferences(getInternalIdentifier()));
@@ -1394,7 +1369,6 @@
*/
public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException
{
-
checkValid();
if (isNodeType(Constants.MIX_REFERENCEABLE))
@@ -1452,7 +1426,6 @@
*/
public VersionHistory getVersionHistory() throws UnsupportedRepositoryOperationException, RepositoryException
{
-
checkValid();
return versionHistory(true);
@@ -1463,7 +1436,6 @@
*/
public boolean hasNode(String relPath) throws RepositoryException
{
-
checkValid();
JCRPath itemPath = locationFactory.parseRelPath(relPath);
@@ -1477,7 +1449,6 @@
*/
public boolean hasNodes() throws RepositoryException
{
-
checkValid();
return dataManager.getChildNodesCount(nodeData()) > 0;
@@ -1488,7 +1459,6 @@
*/
public boolean hasProperties() throws RepositoryException
{
-
checkValid();
return dataManager.listChildPropertiesData(nodeData()).size() > 0;
@@ -1499,7 +1469,6 @@
*/
public boolean hasProperty(String relPath) throws RepositoryException
{
-
checkValid();
JCRPath itemPath = locationFactory.parseRelPath(relPath);
@@ -1513,7 +1482,6 @@
*/
public boolean holdsLock() throws RepositoryException
{
-
checkValid();
return session.getLockManager().holdsLock((NodeData)getData());
@@ -1535,7 +1503,6 @@
*/
public boolean isLocked() throws RepositoryException
{
-
checkValid();
return session.getLockManager().isLocked((NodeData)this.getData());
}
@@ -1592,7 +1559,6 @@
public void loadData(ItemData data, NodeData parent) throws RepositoryException, InvalidItemStateException,
ConstraintViolationException
{
-
if (data.isNode())
{
NodeData nodeData = (NodeData)data;
@@ -1677,7 +1643,6 @@
public Lock lock(boolean isDeep, boolean isSessionScoped) throws UnsupportedRepositoryOperationException,
LockException, AccessDeniedException, RepositoryException
{
-
checkValid();
if (!isNodeType(Constants.MIX_LOCKABLE))
@@ -1774,7 +1739,6 @@
public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws UnsupportedRepositoryOperationException,
NoSuchWorkspaceException, AccessDeniedException, MergeException, RepositoryException, InvalidItemStateException
{
-
checkValid();
if (!session.getAccessManager().hasPermission(getACL(),
@@ -1816,7 +1780,6 @@
public void orderBefore(String srcName, String destName) throws UnsupportedRepositoryOperationException,
ConstraintViolationException, ItemNotFoundException, RepositoryException
{
-
checkValid();
if (!getPrimaryNodeType().hasOrderableChildNodes())
@@ -1839,7 +1802,6 @@
public void removeMixin(String mixinName) throws NoSuchNodeTypeException, ConstraintViolationException,
RepositoryException
{
-
checkValid();
InternalQName[] mixinTypes = nodeData().getMixinTypeNames();
@@ -1966,7 +1928,6 @@
*/
public void removePermission(String identity) throws RepositoryException, AccessControlException
{
-
checkValid();
if (!isNodeType(Constants.EXO_PRIVILEGEABLE))
@@ -1987,7 +1948,6 @@
*/
public void removePermission(String identity, String permission) throws RepositoryException, AccessControlException
{
-
checkValid();
if (!isNodeType(Constants.EXO_PRIVILEGEABLE))
@@ -2009,7 +1969,6 @@
public void restore(String versionName, boolean removeExisting) throws VersionException, ItemExistsException,
UnsupportedRepositoryOperationException, LockException, RepositoryException, InvalidItemStateException
{
-
VersionImpl version = (VersionImpl)versionHistory(false).version(versionName, false);
restore(version, removeExisting);
}
@@ -2020,7 +1979,6 @@
public void restore(Version version, boolean removeExisting) throws VersionException, ItemExistsException,
UnsupportedRepositoryOperationException, LockException, RepositoryException, InvalidItemStateException
{
-
checkValid();
if (!session.getAccessManager().hasPermission(getACL(),
@@ -2067,7 +2025,6 @@
ItemExistsException, UnsupportedRepositoryOperationException, LockException, RepositoryException,
InvalidItemStateException
{
-
if (JCRPath.THIS_RELPATH.equals(relPath))
{
@@ -2162,7 +2119,6 @@
ItemExistsException, UnsupportedRepositoryOperationException, LockException, RepositoryException,
InvalidItemStateException
{
-
checkValid();
VersionImpl version = (VersionImpl)getVersionHistory().getVersionByLabel(versionLabel);
@@ -2175,7 +2131,6 @@
*/
public void setPermission(String identity, String[] permission) throws RepositoryException, AccessControlException
{
-
checkValid();
if (!isNodeType(Constants.EXO_PRIVILEGEABLE))
@@ -2212,7 +2167,6 @@
public void setPermissions(Map permissions) throws RepositoryException, AccessDeniedException,
AccessControlException
{
-
checkValid();
if (!isNodeType(Constants.EXO_PRIVILEGEABLE))
@@ -2260,7 +2214,6 @@
public Property setProperty(String name, boolean value) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
@@ -2274,7 +2227,6 @@
public Property setProperty(String name, Calendar value) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
@@ -2301,7 +2253,6 @@
public Property setProperty(String name, InputStream value) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
@@ -2314,7 +2265,6 @@
public Property setProperty(String name, long value) throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
@@ -2328,7 +2278,6 @@
public Property setProperty(String name, Node value) throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
@@ -2342,7 +2291,6 @@
public Property setProperty(String name, String value) throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory
@@ -2356,7 +2304,6 @@
public Property setProperty(String name, String value, int type) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), valueFactory.createValue(
@@ -2369,7 +2316,6 @@
public Property setProperty(String name, String[] values) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
Value[] val = null;
@@ -2391,7 +2337,6 @@
public Property setProperty(String name, String[] values, int type) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
Value[] val = null;
@@ -2413,7 +2358,6 @@
public Property setProperty(String name, Value value) throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), value, false,
@@ -2426,7 +2370,6 @@
public Property setProperty(String name, Value value, int type) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), value, false, type);
@@ -2439,7 +2382,6 @@
public Property setProperty(String name, Value[] values) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), values, true,
@@ -2452,7 +2394,6 @@
public Property setProperty(String name, Value[] values, int type) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException
{
-
checkValid();
return doUpdateProperty(this, locationFactory.parseJCRName(name).getInternalName(), values, true, type);
@@ -2464,7 +2405,6 @@
public void unlock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException,
RepositoryException
{
-
checkValid();
if (!session.getLockManager().holdsLock((NodeData)this.getData()))
@@ -2502,7 +2442,6 @@
public void update(String srcWorkspaceName) throws NoSuchWorkspaceException, AccessDeniedException,
InvalidItemStateException, LockException, RepositoryException
{
-
checkValid();
// Check pending changes
@@ -2552,7 +2491,6 @@
public void validateChildNode(InternalQName name, InternalQName primaryTypeName) throws ItemExistsException,
RepositoryException, ConstraintViolationException, VersionException, LockException
{
-
// Check if nodeType exists and not mixin
NodeTypeDataManager nodeTypeDataManager = session.getWorkspace().getNodeTypesHolder();
NodeTypeData nodeType = nodeTypeDataManager.getNodeType(primaryTypeName);
@@ -2623,7 +2561,6 @@
public VersionHistoryImpl versionHistory(boolean pool) throws UnsupportedRepositoryOperationException,
RepositoryException
{
-
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException("Node is not mix:versionable " + getPath());
@@ -2846,7 +2783,6 @@
*/
protected void doUnlock() throws RepositoryException
{
-
PlainChangesLog changesLog = new PlainChangesLogImpl(new ArrayList<ItemState>(), session, ExtendedEvent.UNLOCK);
ItemData lockOwner =
@@ -2899,7 +2835,6 @@
protected PropertyData updatePropertyData(InternalQName name, List<ValueData> values) throws RepositoryException
{
-
PropertyData existed =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);
@@ -2923,7 +2858,6 @@
protected PropertyData updatePropertyData(InternalQName name, ValueData value) throws RepositoryException
{
-
PropertyData existed =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);
@@ -2951,7 +2885,6 @@
*/
private List<PropertyData> childPropertiesData() throws RepositoryException, AccessDeniedException
{
-
List<PropertyData> storedProps = new ArrayList<PropertyData>(dataManager.getChildPropertiesData(nodeData()));
Collections.sort(storedProps, new PropertiesDataOrderComparator<PropertyData>());
@@ -2978,7 +2911,6 @@
private EntityCollection createMergeFailed(Map<String, String> failed, SessionChangesLog changes)
throws RepositoryException
{
-
EntityCollection res = new EntityCollection();
TransientPropertyData mergeFailed =
(TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0),
@@ -3162,7 +3094,6 @@
private void removeMergeFailed(Version version, PlainChangesLog changesLog) throws RepositoryException
{
-
PropertyData mergeFailed =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0),
ItemType.PROPERTY);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/PropertyImpl.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -144,7 +144,6 @@
*/
public Value getValue() throws ValueFormatException, RepositoryException
{
-
checkValid();
if (isMultiValued())
@@ -166,7 +165,6 @@
*/
public Value[] getValues() throws ValueFormatException, RepositoryException
{
-
checkValid();
// Check property definition and life-state flag both
@@ -294,7 +292,6 @@
*/
public long getLength() throws ValueFormatException, RepositoryException
{
-
return ((BaseValue)getValue()).getLength();
}
@@ -303,7 +300,6 @@
*/
public long[] getLengths() throws ValueFormatException, RepositoryException
{
-
Value[] thisValues = getValues();
long[] lengths = new long[thisValues.length];
@@ -319,7 +315,6 @@
*/
public PropertyDefinition getDefinition() throws RepositoryException
{
-
checkValid();
if (propertyDef == null)
@@ -356,7 +351,6 @@
private void initDefinitions(boolean multiple, NodeData parent) throws RepositoryException,
ConstraintViolationException
{
-
InternalQName pname = getData().getQPath().getName();
if (parent == null)
@@ -390,7 +384,6 @@
public void setValue(Value value) throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException
{
-
checkValid();
doUpdateProperty(parent(), getInternalName(), value, false, PropertyType.UNDEFINED);
@@ -402,7 +395,6 @@
public void setValue(Value[] values) throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException
{
-
checkValid();
doUpdateProperty(parent(), getInternalName(), values, true, PropertyType.UNDEFINED);
@@ -489,7 +481,6 @@
public void setValue(String[] values) throws ValueFormatException, VersionException, LockException,
ConstraintViolationException, RepositoryException
{
-
Value[] strValues = null;
if (values != null)
{
@@ -560,7 +551,6 @@
*/
public Value[] getValueArray() throws RepositoryException
{
-
Value[] values = new Value[propertyData.getValues().size()];
for (int i = 0; i < values.length; i++)
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -115,15 +115,15 @@
/**
* Indicates if it must fail in case we use a closed session.
*/
- private static final boolean PROHIBIT_CLOSED_SESSION_USAGE =
- Boolean.valueOf(PropertyManager.getProperty("exo.jcr.prohibit.closed.session.usage"));
+ private static final boolean ALLOW_CLOSED_SESSION_USAGE = Boolean.valueOf(PropertyManager
+ .getProperty("exo.jcr.allow.closed.session.usage"));
- protected static boolean FORCE_USE_GET_NODES_LAZILY =
- Boolean.valueOf(PropertyManager.getProperty("org.exoplatform.jcr.forceUserGetNodesLazily"));
+ protected static boolean FORCE_USE_GET_NODES_LAZILY = Boolean.valueOf(PropertyManager
+ .getProperty("org.exoplatform.jcr.forceUserGetNodesLazily"));
static
{
- if (PROHIBIT_CLOSED_SESSION_USAGE)
+ if (!ALLOW_CLOSED_SESSION_USAGE)
{
log.info("The JCR will throw an exception anytime we will try to use a dead session.");
}
@@ -301,7 +301,6 @@
public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)
throws InvalidSerializedDataException, PathNotFoundException, SAXException, RepositoryException
{
-
checkLive();
LocationFactory factory = new LocationFactory(((NamespaceRegistryImpl)repository.getNamespaceRegistry()));
@@ -342,7 +341,6 @@
public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
throws InvalidSerializedDataException, IOException, PathNotFoundException, RepositoryException
{
-
checkLive();
LocationFactory factory = new LocationFactory(((NamespaceRegistryImpl)repository.getNamespaceRegistry()));
@@ -386,7 +384,6 @@
public void exportWorkspaceSystemView(OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException,
PathNotFoundException, RepositoryException
{
-
checkLive();
LocationFactory factory = new LocationFactory(((NamespaceRegistryImpl)repository.getNamespaceRegistry()));
@@ -428,7 +425,6 @@
public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)
throws PathNotFoundException, SAXException, RepositoryException
{
-
checkLive();
LocationFactory factory = new LocationFactory(((NamespaceRegistryImpl)repository.getNamespaceRegistry()));
@@ -930,20 +926,10 @@
*/
public void checkLive() throws RepositoryException
{
- if (!live)
+ if (!live && !ALLOW_CLOSED_SESSION_USAGE)
{
- if (PROHIBIT_CLOSED_SESSION_USAGE)
- {
- throw new RepositoryException("This kind of operation is forbidden after a session.logout().",
- closedByCallStack);
- }
- // warn in debug mode only
- else if (PropertyManager.isDevelopping())
- {
- log.warn("This kind of operation is forbidden after a session.logout(), "
- + "please note that an exception will be raised in the next jcr version.", new Exception(
- closedByCallStack));
- }
+ throw new RepositoryException("This kind of operation is forbidden after a session.logout().",
+ closedByCallStack);
}
}
@@ -976,7 +962,7 @@
}
this.sessionRegistry.unregisterSession(getId());
this.live = false;
- if (PROHIBIT_CLOSED_SESSION_USAGE || PropertyManager.isDevelopping())
+ if (!ALLOW_CLOSED_SESSION_USAGE && PropertyManager.isDevelopping())
{
this.closedByCallStack = new Exception("The session has been closed by the following call stack");
}
@@ -1017,8 +1003,8 @@
+ destAbsPath);
}
- destParentNode.validateChildNode(destNodePath.getName().getInternalName(), ((NodeTypeImpl)srcNode
- .getPrimaryNodeType()).getQName());
+ destParentNode.validateChildNode(destNodePath.getName().getInternalName(),
+ ((NodeTypeImpl)srcNode.getPrimaryNodeType()).getQName());
// Check for node with destAbsPath name in session
NodeImpl destNode =
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -99,7 +99,6 @@
public WorkspaceImpl(String name, ExoContainer container, SessionImpl session, ObservationManager observationManager)
throws RepositoryException
{
-
this.session = session;
this.name = name;
this.observationManager = observationManager;
@@ -326,11 +325,9 @@
PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException,
RepositoryException
{
-
Map<String, Object> context = new HashMap<String, Object>();
context.put(ContentImporter.RESPECT_PROPERTY_DEFINITIONS_CONSTRAINTS, true);
importXML(parentAbsPath, in, uuidBehavior, context);
-
}
/*
@@ -486,7 +483,6 @@
public void restore(Version[] versions, boolean removeExisting) throws UnsupportedRepositoryOperationException,
VersionException, RepositoryException, InvalidItemStateException
{
-
restoreVersions(versions, removeExisting);
}
@@ -494,7 +490,6 @@
SessionChangesLog changes) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException,
AccessDeniedException, PathNotFoundException, ItemExistsException, RepositoryException
{
-
if (srcWorkspace.equals(getName()))
{
throw new RepositoryException("Source and destination workspace are equals " + name);
@@ -737,5 +732,4 @@
return String.format("Workspace {\n name: %s/%s;\n session-id: %s \n}", repository().getName(), name, session
.getId());
}
-
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -112,7 +112,6 @@
*/
public String getVersionableUUID() throws RepositoryException
{
-
checkValid();
PropertyData versionableUuid =
@@ -143,7 +142,6 @@
*/
public Version getRootVersion() throws RepositoryException
{
-
checkValid();
VersionImpl version =
@@ -193,7 +191,6 @@
*/
public Version version(String versionName, boolean pool) throws VersionException, RepositoryException
{
-
JCRName jcrVersionName = locationFactory.parseJCRName(versionName);
VersionImpl version =
(VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -442,7 +442,6 @@
*/
public VersionHistoryImpl getContainingHistory() throws RepositoryException
{
-
checkValid();
VersionHistoryImpl vhistory =
@@ -459,7 +458,6 @@
public SessionChangesLog restoreLog(NodeData destParent, InternalQName name, VersionHistoryDataHelper historyData,
SessionImpl restoreSession, boolean removeExisting, SessionChangesLog delegatedLog) throws RepositoryException
{
-
checkValid();
if (LOG.isDebugEnabled())
@@ -484,7 +482,6 @@
public void restore(SessionImpl restoreSession, NodeData destParent, InternalQName name, boolean removeExisting)
throws RepositoryException
{
-
checkValid();
DataManager dmanager = restoreSession.getTransientNodesManager().getTransactManager();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/observation/TestSessionsObservation.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/observation/TestSessionsObservation.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/observation/TestSessionsObservation.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -23,7 +23,6 @@
import javax.jcr.Node;
import javax.jcr.RepositoryException;
-import javax.jcr.Session;
import javax.jcr.observation.Event;
public class TestSessionsObservation extends JcrAPIBaseTest
@@ -71,7 +70,6 @@
public void testSessionOpen() throws RepositoryException
{
-
int counter = 0;
SimpleListener listener = new SimpleListener("testSessionOpen", log, counter);
@@ -95,7 +93,6 @@
public void testSessionClosed() throws Exception
{
-
int counter = 0;
SimpleListener listener = new SimpleListener("testSessionOpen", log, counter);
@@ -136,7 +133,6 @@
public void testMultipleSessionClosed() throws Exception
{
-
SimpleListener addListener = new SimpleListener("testMultipleSessionClosed__add_nt:file", log, 0);
SimpleListener removeListener = new SimpleListener("testMultipleSessionClosed__remove", log, 0);
@@ -210,7 +206,6 @@
public void testListenerRemoved() throws Exception
{
-
SimpleListener listener1 = new SimpleListener("testListenerRemoved1", log, 0);
SimpleListener listener2 = new SimpleListener("testListenerRemoved2", log, 0);
@@ -262,26 +257,4 @@
sessionWs1.getWorkspace().getObservationManager().removeEventListener(listener2);
}
}
-
- public void testMoveOnClosedSession() throws Exception
- {
-
- testRootWs1.addNode("newNode");
- sessionWs1.save();
-
- int counter = 0;
-
- SimpleListener listener = new SimpleListener("testSessionOpen", log, counter);
-
- Session sessionWs1ForListener = repository.login(credentials, "ws1");
-
- sessionWs1ForListener.getWorkspace().getObservationManager().addEventListener(listener,
- Event.NODE_ADDED | Event.NODE_REMOVED, testRootWs1.getPath() + "/", false, null, null, false);
-
- sessionWs1ForListener.logout();
-
- sessionWs1.logout();
- sessionWs1.getWorkspace().move(testRootWs1.getPath() + "/newNode", testRootWs1.getPath() + "/newNode2");
- assertEquals(2, listener.getCounter());
- }
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -202,6 +202,7 @@
SessionImpl session =
(SessionImpl)repository.login(credentials, repository.getConfiguration().getSystemWorkspaceName());
NodeImpl node = (NodeImpl)session.getRootNode().addNode("testNode");
+ String nodeIdentifier = node.getIdentifier();
session.save();
session.logout();
@@ -222,7 +223,7 @@
NodeData data =
new TransientNodeData(QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName("", "testNode")),
- node.getIdentifier(), -1, Constants.NT_UNSTRUCTURED, null, 0, null, new AccessControlList());
+ nodeIdentifier, -1, Constants.NT_UNSTRUCTURED, null, 0, null, new AccessControlList());
TransientPropertyData primaryType =
new TransientPropertyData(QPath.makeChildPath(data.getQPath(), Constants.JCR_PRIMARYTYPE),
@@ -261,6 +262,7 @@
SessionImpl session =
(SessionImpl)repository.login(credentials, repository.getConfiguration().getSystemWorkspaceName());
NodeImpl node = (NodeImpl)session.getRootNode().addNode("testNode");
+ String nodeIdentifier = node.getIdentifier();
session.save();
session.logout();
@@ -281,7 +283,7 @@
NodeData data =
new TransientNodeData(QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName("", "testNode")),
- node.getIdentifier(), -1, Constants.NT_UNSTRUCTURED, null, 0, null, new AccessControlList());
+ nodeIdentifier, -1, Constants.NT_UNSTRUCTURED, null, 0, null, new AccessControlList());
TransientPropertyData primaryType =
new TransientPropertyData(QPath.makeChildPath(data.getQPath(), Constants.JCR_PRIMARYTYPE),
Modified: jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/pom.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/pom.xml 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/pom.xml 2012-01-17 08:40:14 UTC (rev 5456)
@@ -388,6 +388,11 @@
<name>jgroups.bind_addr</name>
<value>127.0.0.1</value>
</property>
+ <!-- Need for TCK tests -->
+ <property>
+ <name>exo.jcr.allow.closed.session.usage</name>
+ <value>true</value>
+ </property>
</systemProperties>
<includes>
<include>org/apache/jackrabbit/test/api/*Test.java</include>
@@ -466,6 +471,11 @@
<name>jgroups.bind_addr</name>
<value>127.0.0.1</value>
</property>
+ <!-- Need for TCK tests -->
+ <property>
+ <name>exo.jcr.allow.closed.session.usage</name>
+ <value>true</value>
+ </property>
</systemProperties>
<includes>
<!-- From default tests -->
Modified: jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/ThreadLocalSessionProviderInitializedFilter.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/ThreadLocalSessionProviderInitializedFilter.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/ThreadLocalSessionProviderInitializedFilter.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -64,7 +64,6 @@
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException
{
-
ExoContainer container = getContainer();
providerService = (SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);
@@ -82,7 +81,9 @@
if (state == null)
{
if (log.isDebugEnabled())
+ {
log.debug("Current conversation state is not set");
+ }
if (httpSession != null)
{
@@ -90,9 +91,13 @@
// initialize thread local SessionProvider
state = stateRegistry.getState(stateKey);
if (state != null)
+ {
provider = new SessionProvider(state);
+ }
else if (log.isDebugEnabled())
+ {
log.debug("WARN: Conversation State is null, id " + httpSession.getId());
+ }
}
}
else
@@ -103,13 +108,17 @@
if (provider == null)
{
if (log.isDebugEnabled())
+ {
log.debug("Create SessionProvider for anonymous.");
+ }
provider = SessionProvider.createAnonimProvider();
}
try
{
if (ConversationState.getCurrent() != null)
+ {
ConversationState.getCurrent().setAttribute(SessionProvider.SESSION_PROVIDER, provider);
+ }
providerService.setSessionProvider(null, provider);
Modified: jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/fckeditor/JCRContentFCKeditor.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/fckeditor/JCRContentFCKeditor.java 2012-01-16 16:08:35 UTC (rev 5455)
+++ jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/fckeditor/JCRContentFCKeditor.java 2012-01-17 08:40:14 UTC (rev 5456)
@@ -46,13 +46,19 @@
private final static Log LOG = ExoLogger.getLogger("exo.jcr.framework.command.JCRContentFCKeditor");
- private Node file;
+ private final String filePath;
+ private final SessionProviderService sessionProviderService;
+
+ private final ManageableRepository repo;
+
public JCRContentFCKeditor(HttpServletRequest req, String parInstanceName, String workspaceName, String filePath,
String newNodeType) throws RepositoryException
{
super(req, parInstanceName);
+ this.filePath = filePath;
+
ExoContainer container =
(ExoContainer)req.getSession().getServletContext().getAttribute(WebConstants.EXO_CONTAINER);
if (container == null)
@@ -60,26 +66,32 @@
container = PortalContainer.getCurrentInstance(req.getSession().getServletContext());
}
- SessionProviderService sessionProviderService =
+ sessionProviderService =
(SessionProviderService)container.getComponentInstanceOfType(SessionProviderService.class);
RepositoryService repositoryService =
(RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
- ManageableRepository repo = repositoryService.getCurrentRepository();
+ repo = repositoryService.getCurrentRepository();
Session session =
sessionProviderService.getSessionProvider(null).getSession(repo.getConfiguration().getDefaultWorkspaceName(),
repo);
+
+ Node file;
try
{
- this.file = (Node)session.getItem(filePath);
+ file = (Node)session.getItem(filePath);
}
catch (PathNotFoundException e1)
{
- this.file = session.getRootNode().addNode(filePath.substring(1), newNodeType);
+ file = session.getRootNode().addNode(filePath.substring(1), newNodeType);
}
+
if (!file.isNodeType("nt:file"))
+ {
throw new RepositoryException("The Node should be nt:file type");
+ }
+
try
{
Property content = (Property)session.getItem(filePath + "/jcr:content/jcr:data");
@@ -95,8 +107,21 @@
{
// file.setProperty("jcr:content/jcr:data", value);
// [VO] "jcr:content/jcr:data" - impossible according to spec
- file.getNode("jcr:content").setProperty("jcr:data", value);
- setValue(value);
- file.getSession().save();
+ Session session =
+ sessionProviderService.getSessionProvider(null).getSession(repo.getConfiguration().getDefaultWorkspaceName(),
+ repo);
+
+ try
+ {
+ Node file = (Node)session.getItem(filePath);
+
+ file.getNode("jcr:content").setProperty("jcr:data", value);
+ setValue(value);
+ file.getSession().save();
+ }
+ finally
+ {
+ session.logout();
+ }
}
}
14 years, 3 months
exo-jcr SVN: r5455 - jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-01-16 11:08:35 -0500 (Mon, 16 Jan 2012)
New Revision: 5455
Modified:
jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch
Log:
JCR-1704: patch added with fixed doc
Modified: jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch 2012-01-16 15:54:13 UTC (rev 5454)
+++ jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch 2012-01-16 16:08:35 UTC (rev 5455)
@@ -1,6 +1,6 @@
Index: exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java
===================================================================
---- exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java (revision 5450)
+--- exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java (revision 5453)
+++ exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java (working copy)
@@ -144,6 +144,39 @@
assertEquals(headers.getFirst(HttpHeaders.CONTENT_TYPE), property.getString());
@@ -44,7 +44,7 @@
{
Index: exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
---- exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml (revision 5450)
+--- exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml (revision 5453)
+++ exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml (working copy)
@@ -173,7 +173,16 @@
<component>
@@ -66,7 +66,7 @@
<value>false</value>
Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
===================================================================
---- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java (revision 5450)
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java (revision 5453)
+++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java (working copy)
@@ -75,9 +75,12 @@
import java.net.URISyntaxException;
@@ -130,7 +130,7 @@
Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
===================================================================
---- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java (revision 5450)
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java (revision 5453)
+++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java (working copy)
@@ -24,7 +24,9 @@
@@ -202,7 +202,7 @@
content.setProperty("jcr:encoding", encoding);
Index: exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
===================================================================
---- exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml (revision 5450)
+--- exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml (revision 5453)
+++ exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml (working copy)
@@ -1,345 +1,471 @@
-<?xml version='1.0' encoding='UTF-8'?>
@@ -717,7 +717,7 @@
+ <value>application/vnd.openxmlformats-officedocument.wordprocessingml.document</value>
+ </value-param>
+
-+ </init-params
++ </init-params>
+</component></programlisting>
+ </section>
+
14 years, 3 months
exo-jcr SVN: r5454 - in jcr/branches/1.12.x/patch/1.12.12-GA: JCR-1704 and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-01-16 10:54:13 -0500 (Mon, 16 Jan 2012)
New Revision: 5454
Added:
jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/
jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch
Log:
JCR-1704: patch added
Added: jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1704/JCR-1704.patch 2012-01-16 15:54:13 UTC (rev 5454)
@@ -0,0 +1,1023 @@
+Index: exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java
+===================================================================
+--- exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java (revision 5450)
++++ exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java (working copy)
+@@ -144,6 +144,39 @@
+ assertEquals(headers.getFirst(HttpHeaders.CONTENT_TYPE), property.getString());
+ }
+
++ /**
++ * Testing if read-only mime-types properties, which can be set as initial parameters
++ * for WebDavService, are indeed read-only.
++ * More info can be found here: https://jira.exoplatform.org/browse/JCR-1704
++ * @throws Exception
++ */
++ public void testReadOnlyMimeTypeProperties() throws Exception
++ {
++ String testMimeTypeProperty = "test/mime-type";
++ String content = TestUtils.getFileContent();
++ String path = TestUtils.getFileName();
++ MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
++
++ // setting content-type header
++ // test/mime-type is defined in init params to be read only mime type
++ headers.add(HttpHeaders.CONTENT_TYPE, testMimeTypeProperty);
++ // putting a resource
++ service(WebDAVMethods.PUT, getPathWS() + path, "", headers, content.getBytes());
++
++ headers.clear();
++ // setting content-type header again
++ // this time we set MediaType.TEXT_HTML to replace previous mime type
++ headers.add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_HTML);
++ // putting one mopre time
++ service(WebDAVMethods.PUT, getPathWS() + path, "", headers, content.getBytes());
++
++ // gettin jcr:content node, which stores jcr:mimeType parameter
++ Node node = session.getRootNode().getNode(TextUtil.relativizePath(path)).getNode("jcr:content");
++
++ assertEquals("Mime-type property should not be changed.", testMimeTypeProperty,
++ node.getProperty("jcr:mimeType").getString());
++ }
++
+ @Override
+ protected String getRepositoryName()
+ {
+Index: exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
+===================================================================
+--- exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml (revision 5450)
++++ exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml (working copy)
+@@ -173,7 +173,16 @@
+ <component>
+ <type>org.exoplatform.services.jcr.webdav.WebDavServiceImpl</type>
+ <init-params>
+-
++
++ <!--
++ To test read-only mime-type properties to be correctly fetched and processed during put requests.
++ See more details here: https://jira.exoplatform.org/browse/JCR-1704
++ -->
++ <value-param>
++ <name>read-only-mime-types</name>
++ <value>test/mime-type</value>
++ </value-param>
++
+ <value-param>
+ <name>auto-mix-lockable</name>
+ <value>false</value>
+Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
+===================================================================
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java (revision 5450)
++++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java (working copy)
+@@ -75,9 +75,12 @@
+ import java.net.URISyntaxException;
+ import java.net.URLEncoder;
+ import java.util.ArrayList;
++import java.util.Arrays;
+ import java.util.HashMap;
++import java.util.HashSet;
+ import java.util.List;
+ import java.util.Map;
++import java.util.Set;
+
+ import javax.jcr.NoSuchWorkspaceException;
+ import javax.jcr.PathNotFoundException;
+@@ -141,6 +144,8 @@
+
+ public static final String FOLDER_ICON_PATH = "folder-icon-path";
+
++ public static final String READ_ONLY_MIME_TYPES = "read-only-mime-types";
++
+ /**
+ * Logger.
+ */
+@@ -192,6 +197,12 @@
+ private Map<String, String> xsltParams = new HashMap<String, String>();
+
+ /**
++ * Set to keep all 'read-only' mime types. Mime-types listed here
++ * are not allowed to be changed.
++ */
++ private Set<String> readOnlyMimeTypes = new HashSet<String>();
++
++ /**
+ * The list of allowed methods.
+ */
+ private static final String ALLOW;
+@@ -300,6 +311,14 @@
+
+ }
+
++ ValueParam pReadOnlyMimeTypes = params.getValueParam(READ_ONLY_MIME_TYPES);
++ if (pReadOnlyMimeTypes != null)
++ {
++ for (String mimeType : Arrays.asList(pReadOnlyMimeTypes.getValue().split(",")))
++ {
++ readOnlyMimeTypes.add(mimeType.trim());
++ }
++ }
+ }
+
+ /**
+@@ -1038,7 +1057,8 @@
+ NodeType nodeType = ntm.getNodeType(contentNodeType);
+ NodeTypeUtil.checkContentResourceType(nodeType);
+
+- return new PutCommand(nullResourceLocks).put(session, path(repoPath), inputStream, fileNodeType,
++ return new PutCommand(nullResourceLocks, readOnlyMimeTypes).put(session, path(repoPath), inputStream,
++ fileNodeType,
+ contentNodeType, NodeTypeUtil.getMixinTypes(mixinTypes), mimeType, encoding, updatePolicyType,
+ autoVersionType, tokens);
+
+Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
+===================================================================
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java (revision 5450)
++++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java (working copy)
+@@ -24,7 +24,9 @@
+
+ import java.io.InputStream;
+ import java.util.Calendar;
++import java.util.HashSet;
+ import java.util.List;
++import java.util.Set;
+
+ import javax.jcr.AccessDeniedException;
+ import javax.jcr.Node;
+@@ -50,6 +52,12 @@
+ private final NullResourceLocksHolder nullResourceLocks;
+
+ /**
++ * Set to keep all 'read-only' mime types. Mime-types listed here
++ * are not allowed to be changed.
++ */
++ private final Set<String> readOnlyMimeTypes;
++
++ /**
+ * Constructor.
+ *
+ * @param nullResourceLocks resource locks.
+@@ -57,9 +65,22 @@
+ public PutCommand(final NullResourceLocksHolder nullResourceLocks)
+ {
+ this.nullResourceLocks = nullResourceLocks;
++ this.readOnlyMimeTypes = new HashSet<String>();
+ }
+
+ /**
++ * Constructor.
++ *
++ * @param nullResourceLocks resource locks.
++ * @param readOnlyMimeTypes set of 'read-only' mime types
++ */
++ public PutCommand(final NullResourceLocksHolder nullResourceLocks, Set<String> readOnlyMimeTypes)
++ {
++ this.nullResourceLocks = nullResourceLocks;
++ this.readOnlyMimeTypes = readOnlyMimeTypes;
++ }
++
++ /**
+ * Webdav Put method implementation.
+ *
+ * @param session current session
+@@ -205,7 +226,20 @@
+ {
+
+ Node content = node.getNode("jcr:content");
+- content.setProperty("jcr:mimeType", mimeType);
++
++ /*
++ Workaround created to fix JCR-1704
++
++ 1. Check if jcr:mimeType property is not set, if it is not set we can set it without worries
++ 1. Check if jcr:mimeType property is in 'read-only' properties list,
++ if not we again can set it without worries
++ */
++ if (!content.hasProperty("jcr:mimeType")
++ || !readOnlyMimeTypes.contains(content.getProperty("jcr:mimeType").getString()))
++ {
++ content.setProperty("jcr:mimeType", mimeType);
++ }
++
+ if (encoding != null)
+ {
+ content.setProperty("jcr:encoding", encoding);
+Index: exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
+===================================================================
+--- exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml (revision 5450)
++++ exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml (working copy)
+@@ -1,345 +1,471 @@
+-<?xml version='1.0' encoding='UTF-8'?>
+-<!-- This document was created with Syntext Serna Free. --><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
+-<chapter id="JCR.WebDAV">
+-<?dbhtml filename="ch-webdav.html"?> <title>WebDAV</title>
+- <section>
+- <title>Related documents</title>
+- <itemizedlist>
+- <listitem>
+- <para><link linkend="JCR.LinkProducerService">Link Producer</link></para>
+- </listitem>
+- </itemizedlist>
+- </section>
+- <section>
+- <title>Introduction</title>
+- <para>The WebDAV protocol enables you to use the third party tools to
+- communicate with hierarchical content servers via HTTP. It is possible to
+- add and remove documents or a set of documents from a path on the server.
+- DeltaV is an extension of the WebDav protocol that allows managing
+- document versioning. Locking guarantees protection against multiple access
+- when writing resources. The ordering support allows changing the position
+- of the resource in the list and sort the directory to make the directory tree viewed conveniently. The full-text search makes it easy to find the
+- necessary documents. You can search by using two languages: SQL and
+- XPATH.</para>
+- <para>In eXo JCR, we plug in the WebDAV layer - based on the code taken
+- from the extension modules of the reference implementation - on the top of
+- our JCR implementation so that it is possible to browse a workspace using
+- the third party tools (it can be Windows folders or Mac ones as well as a
+- Java WebDAV client, such as DAVExplorer or IE using File->Open as a Web
+- Folder).</para>
+- <para>Now WebDav is an extension of the REST service. To get the WebDav
+- server ready, you must deploy the REST application. Then, you can access
+- any workspaces of your repository by using the following URL:</para>
+- <para>Standalone mode:</para>
+- <para><uri>http://host:port/rest/jcr/{RepositoryName}/{WorkspaceName}/{Path}</uri></para>
+- <para>Portal mode:</para>
+- <para><uri>http://host:port/portal/rest/private/jcr/{RepositoryName}/{WorkspaceName}...</uri></para>
+- <para>When accessing the WebDAV server with the URL<uri>http://localhost:8080/rest/jcr/repository/production</uri>, you might
+- also use "collaboration" (instead of "production") which is the default
+- workspace in eXo products. You will be asked to enter your login and
+- password. Those will then be checked by using the organization service
+- that can be implemented thanks to an InMemory (dummy) module or a DB module
+- or an LDAP one and the JCR user session will be created with the correct JCR
+- Credentials.</para>
+- <note>
+- <para>If you try the "in ECM"
+- option, add "@ecm" to the user's password. Alternatively, you may modify
+- jaas.conf by adding the <emphasis role="bold">domain=ecm</emphasis> option
+- as follows:</para>
+- <programlisting>exo-domain {
+- org.exoplatform.services.security.jaas.BasicLoginModule required domain=ecm;
+-};</programlisting>
+- </note>
+- </section>
+- <section>
+- <title>Configuration</title>
+- <programlisting><component>
+- <key>org.exoplatform.services.webdav.WebDavServiceImpl</key>
+- <type>org.exoplatform.services.webdav.WebDavServiceImpl</type>
+- <init-params>
+-
+- <!-- this parameter indicates the default login and password values
+- used as credentials for accessing the repository -->
+- <!-- value-param>
+- <name>default-identity</name>
+- <value>admin:admin</value>
+- </value-param -->
+-
+- <!-- this is the value of WWW-Authenticate header -->
+- <value-param>
+- <name>auth-header</name>
+- <value>Basic realm="eXo-Platform Webdav Server 1.6.1"</value>
+- </value-param>
+-
+- <!-- default node type which is used for the creation of collections -->
+- <value-param>
+- <name>def-folder-node-type</name>
+- <value>nt:folder</value>
+- </value-param>
+-
+- <!-- default node type which is used for the creation of files -->
+- <value-param>
+- <name>def-file-node-type</name>
+- <value>nt:file</value>
+- </value-param>
+-
+- <!-- if MimeTypeResolver can't find the required mime type,
+- which conforms with the file extension, and the mimeType header is absent
+- in the HTTP request header, this parameter is used
+- as the default mime type-->
+- <value-param>
+- <name>def-file-mimetype</name>
+- <value>application/octet-stream</value>
+- </value-param>
+-
+- <!-- This parameter indicates one of the three cases when you update the content of the resource by PUT command.
+- In case of "create-version", PUT command creates the new version of the resource if this resource exists.
+- In case of "replace" - if the resource exists, PUT command updates the content of the resource and its last modification date.
+- In case of "add", the PUT command tries to create the new resource with the same name (if the parent node allows same-name siblings).-->
+-
+- <value-param>
+- <name>update-policy</name>
+- <value>create-version</value>
+- <!--value>replace</value -->
+- <!-- value>add</value -->
+- </value-param>
+-
+- <!--
+- This parameter determines how service responds to a method that attempts to modify file content.
+- In case of "checkout-checkin" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout and followed by a checkin operation.
+- In case of "checkout" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout operation.
+- -->
+- <value-param>
+- <name>auto-version</name>
+- <value>checkout-checkin</value>
+- <!--value>checkout</value -->
+- </value-param>
+-
+- <!--
+- This parameter is responsible for managing Cache-Control header value which will be returned to the client.
+- You can use patterns like "text/*", "image/*" or wildcard to define the type of content.
+- -->
+- <value-param>
+- <name>cache-control</name>
+- <value>text/xml,text/html:max-age=3600;image/png,image/jpg:max-age=1800;*/*:no-cache;</value>
+- </value-param>
+-
+- <!--
+- This parameter determines the absolute path to the folder icon file, which is shown
+- during WebDAV view of the contents
+- -->
+- <value-param>
+- <name>folder-icon-path</name>
+- <value>/absolute/path/to/file</value>
+- </value-param>
+-
+- </init-params
+-</component></programlisting>
+- </section>
+- <section>
+- <title>Screenshots</title>
+- <para>At present, eXo JCR WebDav server is tested by using MS Internet
+- Explorer, <ulink url="http://www.ics.uci.edu/~webdav">Dav Explorer</ulink>, <ulink url="http://www.xythos.com/home/xythos/products/xythos_drive.html">Xythos Drive</ulink>, Microsoft Office 2003 (as client), and Ubuntu Linux.</para>
+- <section>
+- <title>MS Internet Explorer</title>
+- <para>(File -> Open as Web Folder)</para>
+- <mediaobject>
+- <imageobject>
+- <imagedata fileref="images/protocols/webdav_explorer.jpg"/>
+- </imageobject>
+- </mediaobject>
+- </section>
+- <section>
+- <title>Dav Explorer</title>
+- <mediaobject>
+- <imageobject>
+- <imagedata fileref="images/protocols/webdav_davexplorer.jpg"/>
+- </imageobject>
+- </mediaobject>
+- </section>
+- <section>
+- <title>Xythos Drive</title>
+- <mediaobject>
+- <imageobject>
+- <imagedata fileref="images/protocols/webdav_xythosdrive.jpg"/>
+- </imageobject>
+- </mediaobject>
+- </section>
+- <section>
+- <title>Microsoft Office 2003</title>
+- <para>(as client) (File->Open with typing http://... href in the file
+- name box)</para>
+- <mediaobject>
+- <imageobject>
+- <imagedata fileref="images/protocols/webdav_msoffice2003.jpg"/>
+- </imageobject>
+- </mediaobject>
+- </section>
+- <section>
+- <title>Ubuntu Linux</title>
+- <mediaobject>
+- <imageobject>
+- <imagedata fileref="images/protocols/webdav_ubuntulinux.jpg"/>
+- </imageobject>
+- </mediaobject>
+- </section>
+- </section>
+- <section>
+- <title>Comparison table of WebDav and JCR commands</title>
+- <table>
+- <title/>
+- <tgroup cols="2">
+- <thead>
+- <row>
+- <entry>WebDav</entry>
+- <entry>JCR</entry>
+- </row>
+- </thead>
+- <tbody>
+- <row>
+- <entry>COPY</entry>
+- <entry>Workspace.copy(...)</entry>
+- </row>
+- <row>
+- <entry>DELETE</entry>
+- <entry>Node.remove()</entry>
+- </row>
+- <row>
+- <entry>GET</entry>
+- <entry>Node.getProperty(...); Property.getValue()</entry>
+- </row>
+- <row>
+- <entry>HEAD</entry>
+- <entry>Node.getProperty(...); Property.getLength()</entry>
+- </row>
+- <row>
+- <entry>MKCOL</entry>
+- <entry>Node.addNode(...)</entry>
+- </row>
+- <row>
+- <entry>MOVE</entry>
+- <entry>Session.move(...) or Workspace.move(...)</entry>
+- </row>
+- <row>
+- <entry>PROPFIND</entry>
+- <entry>Session.getNode(...); Node.getNode(...); Node.getNodes(...); Node.getProperties()</entry>
+- </row>
+- <row>
+- <entry>PROPPATCH</entry>
+- <entry>Node.setProperty(...); Node.getProperty(...).remove()</entry>
+- </row>
+- <row>
+- <entry>PUT</entry>
+- <entry>Node.addNode("node","nt:file"); Node.setProperty("jcr:data", "data")</entry>
+- </row>
+- <row>
+- <entry>CHECKIN</entry>
+- <entry>Node.checkin()</entry>
+- </row>
+- <row>
+- <entry>CHECKOUT</entry>
+- <entry>Node.checkout()</entry>
+- </row>
+- <row>
+- <entry>REPORT</entry>
+- <entry>Node.getVersionHistory(); VersionHistory.getAllVersions(); Version.getProperties()</entry>
+- </row>
+- <row>
+- <entry>RESTORE</entry>
+- <entry>Node.restore(...)</entry>
+- </row>
+- <row>
+- <entry>UNCHECKOUT</entry>
+- <entry>Node.restore(...)</entry>
+- </row>
+- <row>
+- <entry>VERSION-CONTROL</entry>
+- <entry>Node.addMixin("mix:versionable")</entry>
+- </row>
+- <row>
+- <entry>LOCK</entry>
+- <entry>Node.lock(...)</entry>
+- </row>
+- <row>
+- <entry>UNLOCK</entry>
+- <entry>Node.unlock()</entry>
+- </row>
+- <row>
+- <entry>ORDERPATCH</entry>
+- <entry>Node.orderBefore(...)</entry>
+- </row>
+- <row>
+- <entry>SEARCH</entry>
+- <entry>Workspace.getQueryManager(); QueryManager.createQuery(); Query.execute()</entry>
+- </row>
+- </tbody>
+- </tgroup>
+- </table>
+- </section>
+- <section>
+- <title>Restrictions</title>
+- <para>There are some restrictions for WebDAV in different Operating
+- systems.</para>
+- <section>
+- <title>Windows 7</title>
+- <para>When you try to set up a web folder by “adding a network location”
+- or “map a network drive” through My Computer, you can get an error
+- message saying that either “The folder you entered does not appear to be valid.
+- Please choose another” or “Windows cannot access… Check the spelling of
+- the name. Otherwise, there might be…”. These errors may appear when you are
+- using SSL or non-SSL.</para>
+- <para>To fix this, do as follows:</para>
+- <orderedlist>
+- <listitem>
+- <para>Go to Windows Registry Editor.</para>
+- </listitem>
+- <listitem>
+- <para>Find a key:
+- \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlset\services\WebClient\Parameters\BasicAuthLevel
+- .</para>
+- </listitem>
+- <listitem>
+- <para>Change the value to 2.</para>
+- </listitem>
+- </orderedlist>
+- </section>
+- <section>
+- <title>Microsoft Office 2010</title>
+- <para>If you have Microsoft Office 2010 applications or Microsoft Office 2007 applications installed on a client computer. From that client computer, you try to access an Office file that is stored on a web server that is configured for Basic authentication. The connection between your computer and the web server does not use Secure Sockets Layer (SSL). When you try to open or to download the file, you experience the following symptoms:
+- <itemizedlist>
+- <listitem>
+- <para>The Office file does not open or download.</para>
+- </listitem>
+- <listitem>
+- <para>You do not receive a Basic authentication password prompt when you try to open or to download the file.</para>
+- </listitem>
+- <listitem>
+- <para>You do not receive an error message when you try to open the file. The associated Office application starts. However, the selected file does not open.</para>
+- </listitem>
+- </itemizedlist>
+- </para>
+- <para>To enable Basic authentication on the client computer, follow these steps:</para>
+- <orderedlist>
+- <listitem>
+- <para>Click Start, type regedit in the Start Search box, and then press Enter.</para>
+- </listitem>
+- <listitem>
+- <para>Locate and then click the following registry subkey: </para>
+- <para>HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Internet</para>
+- </listitem>
+- <listitem>
+- <para>On the Edit menu, point to New, and then click DWORD Value.</para>
+- </listitem>
+- <listitem>
+- <para>Type BasicAuthLevel, and then press Enter.</para>
+- </listitem>
+- <listitem>
+- <para>Right-click BasicAuthLevel, and then click Modify.</para>
+- </listitem>
+- <listitem>
+- <para>In the Value data box, type 2, and then click OK.</para>
+- </listitem>
+- </orderedlist>
+- </section>
+- </section>
+-</chapter>
++<?xml version="1.0" encoding="UTF-8"?>
++<!-- This document was created with Syntext Serna Free. -->
++<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
++"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
++<chapter id="JCR.WebDAV">
++ <?dbhtml filename="ch-webdav.html"?>
++
++ <title>WebDAV</title>
++
++ <section>
++ <title>Related documents</title>
++
++ <itemizedlist>
++ <listitem>
++ <para><link linkend="JCR.LinkProducerService">Link
++ Producer</link></para>
++ </listitem>
++ </itemizedlist>
++ </section>
++
++ <section>
++ <title>Introduction</title>
++
++ <para>The WebDAV protocol enables you to use the third party tools to
++ communicate with hierarchical content servers via HTTP. It is possible to
++ add and remove documents or a set of documents from a path on the server.
++ DeltaV is an extension of the WebDav protocol that allows managing
++ document versioning. Locking guarantees protection against multiple access
++ when writing resources. The ordering support allows changing the position
++ of the resource in the list and sort the directory to make the directory
++ tree viewed conveniently. The full-text search makes it easy to find the
++ necessary documents. You can search by using two languages: SQL and
++ XPATH.</para>
++
++ <para>In eXo JCR, we plug in the WebDAV layer - based on the code taken
++ from the extension modules of the reference implementation - on the top of
++ our JCR implementation so that it is possible to browse a workspace using
++ the third party tools (it can be Windows folders or Mac ones as well as a
++ Java WebDAV client, such as DAVExplorer or IE using File->Open as a Web
++ Folder).</para>
++
++ <para>Now WebDav is an extension of the REST service. To get the WebDav
++ server ready, you must deploy the REST application. Then, you can access
++ any workspaces of your repository by using the following URL:</para>
++
++ <para>Standalone mode:</para>
++
++ <para><uri>http://host:port/rest/jcr/{RepositoryName}/{WorkspaceName}/{Path}</uri></para>
++
++ <para>Portal mode:</para>
++
++ <para><uri>http://host:port/portal/rest/private/jcr/{RepositoryName}/{WorkspaceName}...</uri></para>
++
++ <para>When accessing the WebDAV server with the
++ URL<uri>http://localhost:8080/rest/jcr/repository/production</uri>, you
++ might also use "collaboration" (instead of "production") which is the
++ default workspace in eXo products. You will be asked to enter your login
++ and password. Those will then be checked by using the organization service
++ that can be implemented thanks to an InMemory (dummy) module or a DB
++ module or an LDAP one and the JCR user session will be created with the
++ correct JCR Credentials.</para>
++
++ <note>
++ <para>If you try the "in ECM" option, add "@ecm" to the user's password.
++ Alternatively, you may modify jaas.conf by adding the <emphasis
++ role="bold">domain=ecm</emphasis> option as follows:</para>
++
++ <programlisting>exo-domain {
++ org.exoplatform.services.security.jaas.BasicLoginModule required domain=ecm;
++};</programlisting>
++ </note>
++ </section>
++
++ <section>
++ <title>Configuration</title>
++
++ <programlisting><component>
++ <key>org.exoplatform.services.webdav.WebDavServiceImpl</key>
++ <type>org.exoplatform.services.webdav.WebDavServiceImpl</type>
++ <init-params>
++
++ <!-- this parameter indicates the default login and password values
++ used as credentials for accessing the repository -->
++ <!-- value-param>
++ <name>default-identity</name>
++ <value>admin:admin</value>
++ </value-param -->
++
++ <!-- this is the value of WWW-Authenticate header -->
++ <value-param>
++ <name>auth-header</name>
++ <value>Basic realm="eXo-Platform Webdav Server 1.6.1"</value>
++ </value-param>
++
++ <!-- default node type which is used for the creation of collections -->
++ <value-param>
++ <name>def-folder-node-type</name>
++ <value>nt:folder</value>
++ </value-param>
++
++ <!-- default node type which is used for the creation of files -->
++ <value-param>
++ <name>def-file-node-type</name>
++ <value>nt:file</value>
++ </value-param>
++
++ <!-- if MimeTypeResolver can't find the required mime type,
++ which conforms with the file extension, and the mimeType header is absent
++ in the HTTP request header, this parameter is used
++ as the default mime type-->
++ <value-param>
++ <name>def-file-mimetype</name>
++ <value>application/octet-stream</value>
++ </value-param>
++
++ <!-- This parameter indicates one of the three cases when you update the content of the resource by PUT command.
++ In case of "create-version", PUT command creates the new version of the resource if this resource exists.
++ In case of "replace" - if the resource exists, PUT command updates the content of the resource and its last modification date.
++ In case of "add", the PUT command tries to create the new resource with the same name (if the parent node allows same-name siblings).-->
++
++ <value-param>
++ <name>update-policy</name>
++ <value>create-version</value>
++ <!--value>replace</value -->
++ <!-- value>add</value -->
++ </value-param>
++
++ <!--
++ This parameter determines how service responds to a method that attempts to modify file content.
++ In case of "checkout-checkin" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout and followed by a checkin operation.
++ In case of "checkout" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout operation.
++ -->
++ <value-param>
++ <name>auto-version</name>
++ <value>checkout-checkin</value>
++ <!--value>checkout</value -->
++ </value-param>
++
++ <!--
++ This parameter is responsible for managing Cache-Control header value which will be returned to the client.
++ You can use patterns like "text/*", "image/*" or wildcard to define the type of content.
++ -->
++ <value-param>
++ <name>cache-control</name>
++ <value>text/xml,text/html:max-age=3600;image/png,image/jpg:max-age=1800;*/*:no-cache;</value>
++ </value-param>
++
++ <!--
++ This parameter determines the absolute path to the folder icon file, which is shown
++ during WebDAV view of the contents
++ -->
++ <value-param>
++ <name>folder-icon-path</name>
++ <value>/absolute/path/to/file</value>
++ </value-param>
++
++ <!--
++ This parameter is responsible for definition of read-only mime-type properties.
++ That basically means that all mime-types mentioned here will be set as read-only properties
++ (i. e. you cannot change resource's mime-type after it is set).
++ Use ',' as a delimeter to separate mime-types.
++ -->
++ <value-param>
++ <name>read-only-mime-types</name>
++ <value>application/vnd.openxmlformats-officedocument.wordprocessingml.document</value>
++ </value-param>
++
++ </init-params
++</component></programlisting>
++ </section>
++
++ <section>
++ <title>Screenshots</title>
++
++ <para>At present, eXo JCR WebDav server is tested by using MS Internet
++ Explorer, <ulink url="http://www.ics.uci.edu/~webdav">Dav
++ Explorer</ulink>, <ulink
++ url="http://www.xythos.com/home/xythos/products/xythos_drive.html">Xythos
++ Drive</ulink>, Microsoft Office 2003 (as client), and Ubuntu Linux.</para>
++
++ <section>
++ <title>MS Internet Explorer</title>
++
++ <para>(File -> Open as Web Folder)</para>
++
++ <mediaobject>
++ <imageobject>
++ <imagedata fileref="images/protocols/webdav_explorer.jpg" />
++ </imageobject>
++ </mediaobject>
++ </section>
++
++ <section>
++ <title>Dav Explorer</title>
++
++ <mediaobject>
++ <imageobject>
++ <imagedata fileref="images/protocols/webdav_davexplorer.jpg" />
++ </imageobject>
++ </mediaobject>
++ </section>
++
++ <section>
++ <title>Xythos Drive</title>
++
++ <mediaobject>
++ <imageobject>
++ <imagedata fileref="images/protocols/webdav_xythosdrive.jpg" />
++ </imageobject>
++ </mediaobject>
++ </section>
++
++ <section>
++ <title>Microsoft Office 2003</title>
++
++ <para>(as client) (File->Open with typing http://... href in the file
++ name box)</para>
++
++ <mediaobject>
++ <imageobject>
++ <imagedata fileref="images/protocols/webdav_msoffice2003.jpg" />
++ </imageobject>
++ </mediaobject>
++ </section>
++
++ <section>
++ <title>Ubuntu Linux</title>
++
++ <mediaobject>
++ <imageobject>
++ <imagedata fileref="images/protocols/webdav_ubuntulinux.jpg" />
++ </imageobject>
++ </mediaobject>
++ </section>
++ </section>
++
++ <section>
++ <title>Comparison table of WebDav and JCR commands</title>
++
++ <table>
++ <title></title>
++
++ <tgroup cols="2">
++ <thead>
++ <row>
++ <entry>WebDav</entry>
++
++ <entry>JCR</entry>
++ </row>
++ </thead>
++
++ <tbody>
++ <row>
++ <entry>COPY</entry>
++
++ <entry>Workspace.copy(...)</entry>
++ </row>
++
++ <row>
++ <entry>DELETE</entry>
++
++ <entry>Node.remove()</entry>
++ </row>
++
++ <row>
++ <entry>GET</entry>
++
++ <entry>Node.getProperty(...); Property.getValue()</entry>
++ </row>
++
++ <row>
++ <entry>HEAD</entry>
++
++ <entry>Node.getProperty(...); Property.getLength()</entry>
++ </row>
++
++ <row>
++ <entry>MKCOL</entry>
++
++ <entry>Node.addNode(...)</entry>
++ </row>
++
++ <row>
++ <entry>MOVE</entry>
++
++ <entry>Session.move(...) or Workspace.move(...)</entry>
++ </row>
++
++ <row>
++ <entry>PROPFIND</entry>
++
++ <entry>Session.getNode(...); Node.getNode(...);
++ Node.getNodes(...); Node.getProperties()</entry>
++ </row>
++
++ <row>
++ <entry>PROPPATCH</entry>
++
++ <entry>Node.setProperty(...);
++ Node.getProperty(...).remove()</entry>
++ </row>
++
++ <row>
++ <entry>PUT</entry>
++
++ <entry>Node.addNode("node","nt:file");
++ Node.setProperty("jcr:data", "data")</entry>
++ </row>
++
++ <row>
++ <entry>CHECKIN</entry>
++
++ <entry>Node.checkin()</entry>
++ </row>
++
++ <row>
++ <entry>CHECKOUT</entry>
++
++ <entry>Node.checkout()</entry>
++ </row>
++
++ <row>
++ <entry>REPORT</entry>
++
++ <entry>Node.getVersionHistory(); VersionHistory.getAllVersions();
++ Version.getProperties()</entry>
++ </row>
++
++ <row>
++ <entry>RESTORE</entry>
++
++ <entry>Node.restore(...)</entry>
++ </row>
++
++ <row>
++ <entry>UNCHECKOUT</entry>
++
++ <entry>Node.restore(...)</entry>
++ </row>
++
++ <row>
++ <entry>VERSION-CONTROL</entry>
++
++ <entry>Node.addMixin("mix:versionable")</entry>
++ </row>
++
++ <row>
++ <entry>LOCK</entry>
++
++ <entry>Node.lock(...)</entry>
++ </row>
++
++ <row>
++ <entry>UNLOCK</entry>
++
++ <entry>Node.unlock()</entry>
++ </row>
++
++ <row>
++ <entry>ORDERPATCH</entry>
++
++ <entry>Node.orderBefore(...)</entry>
++ </row>
++
++ <row>
++ <entry>SEARCH</entry>
++
++ <entry>Workspace.getQueryManager(); QueryManager.createQuery();
++ Query.execute()</entry>
++ </row>
++ </tbody>
++ </tgroup>
++ </table>
++ </section>
++
++ <section>
++ <title>Restrictions</title>
++
++ <para>There are some restrictions for WebDAV in different Operating
++ systems.</para>
++
++ <section>
++ <title>Windows 7</title>
++
++ <para>When you try to set up a web folder by “adding a network location”
++ or “map a network drive” through My Computer, you can get an error
++ message saying that either “The folder you entered does not appear to be
++ valid. Please choose another” or “Windows cannot access… Check the
++ spelling of the name. Otherwise, there might be…”. These errors may
++ appear when you are using SSL or non-SSL.</para>
++
++ <para>To fix this, do as follows:</para>
++
++ <orderedlist>
++ <listitem>
++ <para>Go to Windows Registry Editor.</para>
++ </listitem>
++
++ <listitem>
++ <para>Find a key:
++ \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlset\services\WebClient\Parameters\BasicAuthLevel
++ .</para>
++ </listitem>
++
++ <listitem>
++ <para>Change the value to 2.</para>
++ </listitem>
++ </orderedlist>
++ </section>
++
++ <section>
++ <title>Microsoft Office 2010</title>
++
++ <para>If you have Microsoft Office 2010 applications or Microsoft Office
++ 2007 applications installed on a client computer. From that client
++ computer, you try to access an Office file that is stored on a web
++ server that is configured for Basic authentication. The connection
++ between your computer and the web server does not use Secure Sockets
++ Layer (SSL). When you try to open or to download the file, you
++ experience the following symptoms: <itemizedlist>
++ <listitem>
++ <para>The Office file does not open or download.</para>
++ </listitem>
++
++ <listitem>
++ <para>You do not receive a Basic authentication password prompt
++ when you try to open or to download the file.</para>
++ </listitem>
++
++ <listitem>
++ <para>You do not receive an error message when you try to open the
++ file. The associated Office application starts. However, the
++ selected file does not open.</para>
++ </listitem>
++ </itemizedlist></para>
++
++ <para>To enable Basic authentication on the client computer, follow
++ these steps:</para>
++
++ <orderedlist>
++ <listitem>
++ <para>Click Start, type regedit in the Start Search box, and then
++ press Enter.</para>
++ </listitem>
++
++ <listitem>
++ <para>Locate and then click the following registry subkey:</para>
++
++ <para>HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Internet</para>
++ </listitem>
++
++ <listitem>
++ <para>On the Edit menu, point to New, and then click DWORD
++ Value.</para>
++ </listitem>
++
++ <listitem>
++ <para>Type BasicAuthLevel, and then press Enter.</para>
++ </listitem>
++
++ <listitem>
++ <para>Right-click BasicAuthLevel, and then click Modify.</para>
++ </listitem>
++
++ <listitem>
++ <para>In the Value data box, type 2, and then click OK.</para>
++ </listitem>
++ </orderedlist>
++ </section>
++ </section>
++</chapter>
14 years, 3 months
exo-jcr SVN: r5453 - jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2012-01-16 10:01:06 -0500 (Mon, 16 Jan 2012)
New Revision: 5453
Modified:
jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
Log:
EXOJCR-1709: Added index retrieval on startup. Small refactoring.
Modified: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java 2012-01-16 08:06:08 UTC (rev 5452)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java 2012-01-16 15:01:06 UTC (rev 5453)
@@ -94,20 +94,40 @@
}
- /**
- * {@inheritDoc}
- */
+ /**
+ * {@inheritDoc}
+ */
@Override
protected void refreshIndexes(Set<String> set)
{
+ triggerRSyncSynchronization();
+ // call super, after indexes are synchronized
+ super.refreshIndexes(set);
+ }
+
+ @Override
+ public void read() throws IOException
+ {
+ // synchronizing indexes on read access to index list for Read-Only mode
+ // allowing to synchronize indexes on startup
+ triggerRSyncSynchronization();
+ super.read();
+ }
+
+ /**
+ * Call to system RSync binary implementation,
+ */
+ private void triggerRSyncSynchronization()
+ {
// Call RSync to retrieve actual index from coordinator
if (modeHandler.getMode() == IndexerIoMode.READ_ONLY)
{
- if (cache.getLocalAddress() instanceof IpAddress)
+ if (((CacheSPI<Serializable, Object>)cache).getRPCManager().getCoordinator() instanceof IpAddress)
{
// Coordinator's address
String address =
- ((IpAddress)((CacheSPI)cache).getRPCManager().getCoordinator()).getIpAddress().getHostAddress();
+ ((IpAddress)((CacheSPI<Serializable, Object>)cache).getRPCManager().getCoordinator()).getIpAddress()
+ .getHostAddress();
RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, address), indexPath);
try
{
@@ -122,8 +142,6 @@
}
}
}
- // call super, after indexes are synchronized
- super.refreshIndexes(set);
}
private class RSyncJob
@@ -140,6 +158,7 @@
this.dst = dst;
}
+ // TODO : Use JNI and librsync library? or handle err stream
public void execute() throws IOException
{
Runtime run = Runtime.getRuntime();
14 years, 3 months
exo-jcr SVN: r5452 - jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-01-16 03:06:08 -0500 (Mon, 16 Jan 2012)
New Revision: 5452
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/master.xml
Log:
EXOJCR-1715: Update copyright year in JCR ref guide
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/master.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/master.xml 2012-01-13 15:23:33 UTC (rev 5451)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/master.xml 2012-01-16 08:06:08 UTC (rev 5452)
@@ -41,8 +41,8 @@
<subtitle>Java Content Repository and Extension services</subtitle>
<copyright>
- <year>2009, 2010</year>
- <holder>eXoPlatform</holder>
+ <year>2012</year>
+ <holder>eXoPlatform SAS</holder>
</copyright>
</bookinfo>
14 years, 3 months
exo-jcr SVN: r5451 - jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2012-01-13 10:23:33 -0500 (Fri, 13 Jan 2012)
New Revision: 5451
Added:
jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
Modified:
jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
Log:
EXOJCR-1709 : initial implementation based on PoC.
What is ready :
- initial code-architecture;
- index sync, when index list changes;
- configuration;
TODO:
- Sync index on start to get initial index;
- Failover capabilities;
- User/password for RSync server;
RSync approach is built upon JBossCache concept, overriding just few things that adds RSync invocation when processing an index list modification event
Modified: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2012-01-13 09:39:01 UTC (rev 5450)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2012-01-13 15:23:33 UTC (rev 5451)
@@ -29,6 +29,8 @@
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
+import org.exoplatform.services.jcr.impl.core.query.lucene.IndexInfos;
+import org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
import org.exoplatform.services.jcr.jbosscache.PrivilegedJBossCacheHelper;
@@ -75,10 +77,25 @@
public static final Boolean PARAM_JBOSSCACHE_SHAREABLE_DEFAULT = Boolean.FALSE;
+ // RSYNC SERVER CONFIGURATION
+ public static final String PARAM_RSYNC_ENTRY_NAME = "rsync-entry-name";
+
+ public static final String PARAM_RSYNC_ENTRY_PATH = "rsync-entry-path";
+
+ public static final String PARAM_RSYNC_PORT = "rsync-port";
+
+ public static final int PARAM_RSYNC_PORT_DEFAULT = 873;
+
+ // TODO
+ public static final String PARAM_RSYNC_USER = "rsync-user";
+
+ public static final String PARAM_RSYNC_PASSWORD = "rsync-password";
+
+ // Fields
private final Cache<Serializable, Object> cache;
private final Fqn<String> rootFqn;
-
+
private final JmxRegistrationManager jmxManager;
public static final String LISTWRAPPER = "$lists".intern();
@@ -140,8 +157,10 @@
PrivilegedJBossCacheHelper.create(cache);
PrivilegedJBossCacheHelper.start(cache);
-
- this.jmxManager = ExoJBossCacheFactory.getJmxRegistrationManager(searchManager.getExoContainerContext(), cache, CacheType.INDEX_CACHE);
+
+ this.jmxManager =
+ ExoJBossCacheFactory.getJmxRegistrationManager(searchManager.getExoContainerContext(), cache,
+ CacheType.INDEX_CACHE);
if (jmxManager != null)
{
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
@@ -171,18 +190,50 @@
if (!parentHandler.isInitialized())
{
- parentHandler.setIndexInfos(new JBossCacheIndexInfos(rootFqn, cache, true, modeHandler));
+ parentHandler.setIndexInfos(createIndexInfos(true, modeHandler, config, parentHandler));
parentHandler.setIndexUpdateMonitor(new JBossCacheIndexUpdateMonitor(rootFqn, cache, true, modeHandler));
parentHandler.init();
}
if (!handler.isInitialized())
{
- handler.setIndexInfos(new JBossCacheIndexInfos(rootFqn, cache, false, modeHandler));
+ handler.setIndexInfos(createIndexInfos(false, modeHandler, config, handler));
handler.setIndexUpdateMonitor(new JBossCacheIndexUpdateMonitor(rootFqn, cache, false, modeHandler));
handler.init();
}
}
+ /**
+ * Factory method for creating corresponding IndexInfos class. RSyncIndexInfos created if RSync configured
+ * and JBossCacheIndexInfos otherwise
+ *
+ * @param system
+ * @param modeHandler
+ * @param config
+ * @param handler
+ * @return
+ * @throws RepositoryConfigurationException
+ */
+ private IndexInfos createIndexInfos(Boolean system, IndexerIoModeHandler modeHandler, QueryHandlerEntry config,
+ QueryHandler handler) throws RepositoryConfigurationException
+ {
+ // read RSYNC configuration
+ String rsyncEntryName = config.getParameterValue(PARAM_RSYNC_ENTRY_NAME, null);
+ String rsyncEntryPath = config.getParameterValue(PARAM_RSYNC_ENTRY_PATH, null);
+ int rsyncPort = config.getParameterInteger(PARAM_RSYNC_PORT, PARAM_RSYNC_PORT_DEFAULT);
+
+ // rsync configured
+ if (rsyncEntryName != null)
+ {
+ return new RsyncIndexInfos(rootFqn, cache, system, modeHandler, ((SearchIndex)handler).getContext()
+ .getIndexDirectory(), rsyncPort, rsyncEntryName, rsyncEntryPath);
+ }
+ else
+ {
+ return new JBossCacheIndexInfos(rootFqn, cache, system, modeHandler);
+ }
+
+ }
+
protected Log getLogger()
{
return log;
@@ -202,9 +253,9 @@
return true;
}
- /**
- * {@inheritDoc}
- */
+ /**
+ * {@inheritDoc}
+ */
@Override
public void close()
{
@@ -222,8 +273,9 @@
});
}
}
- catch (Exception e) {
+ catch (Exception e)
+ {
log.warn("Not all JBoss Cache MBeans were unregistered.");
}
- }
+ }
}
Modified: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2012-01-13 09:39:01 UTC (rev 5450)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2012-01-13 15:23:33 UTC (rev 5451)
@@ -64,17 +64,17 @@
private static final String LIST_KEY = "$listOfIndexes".intern();
- private final Cache<Serializable, Object> cache;
+ protected final Cache<Serializable, Object> cache;
/**
* Flag notifies if this IndexInfos is from system search manager or not.
*/
- private boolean system;
+ protected boolean system;
/**
* Used to retrieve the current mode
*/
- private final IndexerIoModeHandler modeHandler;
+ protected final IndexerIoModeHandler modeHandler;
/**
* This FQN points to cache node, where list of indexes for this {@link IndexInfos} instance is stored.
@@ -192,23 +192,36 @@
// read from cache to update lists
set = (Set<String>)cache.get(namesFqn, LIST_KEY);
}
- if (set != null)
+ refreshIndexes(set);
+ }
+ }
+
+ /**
+ * Update index configuration, when it changes on persistent storage
+ *
+ * @param set
+ */
+ protected void refreshIndexes(Set<String> set)
+ {
+ // do nothing if null is passed
+ if (set == null)
+ {
+ return;
+ }
+ setNames(set);
+ // callback multiIndex to refresh lists
+ try
+ {
+ MultiIndex multiIndex = getMultiIndex();
+ if (multiIndex != null)
{
- setNames(set);
- // callback multiIndex to refresh lists
- try
- {
- MultiIndex multiIndex = getMultiIndex();
- if (multiIndex != null)
- {
- multiIndex.refreshIndexList();
- }
- }
- catch (IOException e)
- {
- log.error("Failed to update indexes! " + e.getMessage(), e);
- }
+ multiIndex.refreshIndexList();
}
}
+ catch (IOException e)
+ {
+ log.error("Failed to update indexes! " + e.getMessage(), e);
+ }
}
+
}
Added: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java (rev 0)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java 2012-01-13 15:23:33 UTC (rev 5451)
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2003-2012 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.core.query.jbosscache;
+
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jgroups.stack.IpAddress;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : eXoPlatform
+ * exo(a)exoplatform.com
+ * Jan 11, 2012
+ */
+@CacheListener
+public class RsyncIndexInfos extends JBossCacheIndexInfos
+{
+
+ private final Log log = ExoLogger.getLogger("exo.jcr.component.core.RsyncIndexInfos");
+
+ private final String indexPath;
+
+ private final String urlFormatString;
+
+ public RsyncIndexInfos(Fqn<String> rootFqn, Cache<Serializable, Object> cache, boolean system,
+ IndexerIoModeHandler modeHandler, String indexPath, int rsyncPort, String rsyncEntryName, String rsyncEntryPath)
+ throws RepositoryConfigurationException
+ {
+ super(rootFqn, cache, system, modeHandler);
+
+ String absoluteRsyncEntryPath;
+ try
+ {
+ this.indexPath = new File(indexPath).getCanonicalPath();
+ absoluteRsyncEntryPath = new File(rsyncEntryPath).getCanonicalPath();
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryConfigurationException("Index path or rsyncEntry path is invalid.", e);
+ }
+
+ if (this.indexPath.startsWith(absoluteRsyncEntryPath))
+ {
+ // in relation to RSync Server Entry
+ // i.e. absolute index path is /var/portal/data/index/repo1/ws2
+ // i.e. RSync Server Entry is "index" pointing to /var/portal/data/index
+ // then relative path is repo1/ws2
+ // and whole url is "rsync://<addr>:<port>/<entryName>/repo1/ws2"
+ String relativeIndexPath = this.indexPath.substring(absoluteRsyncEntryPath.length());
+
+ // if client is Windows OS, need to replace all '\' with '/' used in url
+ if (File.separatorChar == '\\')
+ {
+ relativeIndexPath = relativeIndexPath.replace(File.separatorChar, '/');
+ }
+ // generate ready-to-use formatter string with address variable
+ urlFormatString = "rsync://%s:" + rsyncPort + "/" + rsyncEntryName + relativeIndexPath + "/";
+ }
+ else
+ {
+ throw new RepositoryConfigurationException(
+ "Invalid RSync configuration. Index must be placed in folder that is a descendant of RSync Server Entry. Current RSync Server Entry Path is : "
+ + absoluteRsyncEntryPath
+ + " but it doesnt hold Index folder, that is : "
+ + this.indexPath
+ + ". Please fix configuration according to JCR Documentation and restart application.");
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void refreshIndexes(Set<String> set)
+ {
+ // Call RSync to retrieve actual index from coordinator
+ if (modeHandler.getMode() == IndexerIoMode.READ_ONLY)
+ {
+ if (cache.getLocalAddress() instanceof IpAddress)
+ {
+ // Coordinator's address
+ String address =
+ ((IpAddress)((CacheSPI)cache).getRPCManager().getCoordinator()).getIpAddress().getHostAddress();
+ RSyncJob rSyncJob = new RSyncJob(String.format(urlFormatString, address), indexPath);
+ try
+ {
+ synchronized (this)
+ {
+ rSyncJob.execute();
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("Failed to retrieve index using RSYNC", e);
+ }
+ }
+ }
+ // call super, after indexes are synchronized
+ super.refreshIndexes(set);
+ }
+
+ private class RSyncJob
+ {
+ private Process process;
+
+ private String src;
+
+ private String dst;
+
+ public RSyncJob(String src, String dst)
+ {
+ this.src = src.endsWith(File.separator) ? src : src + File.separator;
+ this.dst = dst;
+ }
+
+ public void execute() throws IOException
+ {
+ Runtime run = Runtime.getRuntime();
+ try
+ {
+ String command = "rsync -rv --delete " + src + " " + dst;
+ log.info("Rsync job started: " + command);
+ process = run.exec(command);
+
+ Integer returnCode = null;
+ // wait for thread
+ while (returnCode == null)
+ {
+ try
+ {
+ returnCode = process.waitFor();
+ }
+ catch (InterruptedException e)
+ {
+ // oops, this can happen sometimes
+ }
+ }
+ log.info("Rsync job finished: " + returnCode);
+ if (returnCode != 0)
+ {
+ throw new IOException("RSync job finished with exit code is " + returnCode);
+ }
+ }
+ finally
+ {
+ process = null;
+ }
+ }
+
+ public void forceCancel()
+ {
+ if (process != null)
+ {
+ process.destroy();
+ }
+ }
+ }
+
+}
Property changes on: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 3 months
exo-jcr SVN: r5450 - in jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: clean/rdbms and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-13 04:39:01 -0500 (Fri, 13 Jan 2012)
New Revision: 5450
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanHelper.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/RecursiveDBCleanHelper.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleaner.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleaner.java
Log:
EXOJCR-1707: DBCleanHelper removed
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2012-01-13 08:22:15 UTC (rev 5449)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2012-01-13 09:39:01 UTC (rev 5450)
@@ -195,15 +195,7 @@
{
try
{
- try
- {
- // don't care about any exception here
- dbCleaner.executeCommitScripts();
- }
- catch (Exception e)
- {
- LOG.error("Can't remove temporary objects after cleaning", e);
- }
+ dbCleaner.executeCommitScripts();
jdbcConn.commit();
}
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanHelper.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanHelper.java 2012-01-13 08:22:15 UTC (rev 5449)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanHelper.java 2012-01-13 09:39:01 UTC (rev 5450)
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2003-2011 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.clean.rdbms;
-
-import java.sql.SQLException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date: 2011
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: DBCleanHelper.java 111 2011-11-11 11:11:11Z rainf0x $
- */
-public interface DBCleanHelper
-{
- /**
- * Clean data from database. The method doesn't close connection or perform commit.
- *
- * @throws SQLException
- * if any errors occurred
- */
- public void executeCleanScripts() throws SQLException;
-}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2012-01-13 08:22:15 UTC (rev 5449)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2012-01-13 09:39:01 UTC (rev 5450)
@@ -34,9 +34,7 @@
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.sql.Connection;
-import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
@@ -869,32 +867,6 @@
if (!isMultiDB)
{
- boolean cleanWithHelper = false;
- if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_HSQLDB))
- {
- cleanWithHelper = true;
- }
- else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
- {
- cleanWithHelper = true;
-
- Statement st = jdbcConn.createStatement();
- st.execute("SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA='" + jdbcConn.getCatalog()
- + "' and (TABLE_NAME='JCR_SITEM' or TABLE_NAME='JCR_MITEM')");
- ResultSet result = st.getResultSet();
- if (result.next())
- {
- String engine = result.getString("ENGINE");
- if (engine.equalsIgnoreCase("MyISAM"))
- {
- cleanWithHelper = false;
- }
- }
- }
-
String containerName = wsEntry.getName();
String multiDb = isMultiDB ? "M" : "S";
@@ -923,21 +895,8 @@
+ containerName + "')");
cleanScripts.add("delete from JCR_SREF where PROPERTY_ID IN (select ID from JCR_SITEM where CONTAINER_NAME='"
+ containerName + "')");
-
- if (cleanWithHelper)
- {
- cleanScripts.add("delete from JCR_SITEM where I_CLASS=2 and CONTAINER_NAME='" + containerName + "'");
-
- String selectItems =
- "select ID from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME='" + containerName + "' and PARENT_ID=?";
- String deleteItems =
- "delete from JCR_SITEM where I_CLASS=1 and CONTAINER_NAME='" + containerName + "' and PARENT_ID=?";
-
- return new DBCleaner(jdbcConn, cleanScripts, rollbackScripts, commitScripts, new RecursiveDBCleanHelper(
- jdbcConn, selectItems, deleteItems), dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_SYBASE));
- }
-
cleanScripts.add("delete from JCR_SITEM where CONTAINER_NAME='" + containerName + "'");
+
return new DBCleaner(jdbcConn, cleanScripts, rollbackScripts, commitScripts,
dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_SYBASE));
}
@@ -980,16 +939,8 @@
try
{
dbCleaner.executeCleanScripts();
+ dbCleaner.executeCommitScripts();
- try
- {
- dbCleaner.executeCommitScripts();
- }
- catch (SQLException e)
- {
- LOG.error("Can't remove temporary objects", e);
- }
-
jdbcConn.commit();
}
catch (SQLException e)
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleaner.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleaner.java 2012-01-13 08:22:15 UTC (rev 5449)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleaner.java 2012-01-13 09:39:01 UTC (rev 5450)
@@ -30,7 +30,7 @@
import java.util.List;
/**
- * The goal of this class is removing workspace data from database.
+ * The goal of this class is removing data from database.
*
* @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
* @version $Id: DBCleaner.java 3769 2011-01-04 15:36:06Z areshetnyak $
@@ -63,11 +63,6 @@
protected final List<String> commitScripts = new ArrayList<String>();
/**
- * DB clean helper.
- */
- protected final DBCleanHelper dbCleanHelper;
-
- /**
* Idicates if executing scripts should be done in autoCommit mode.
*/
protected final boolean autoCommit;
@@ -89,37 +84,16 @@
* indicates if executing scripts should be done in autoCommit mode
*/
public DBCleaner(Connection connection, List<String> cleanScripts, List<String> rollbackScripts,
- List<String> commitScripts, DBCleanHelper dbCleanHelper, boolean autoCommit)
+ List<String> commitScripts, boolean autoCommit)
{
this.connection = connection;
this.cleanScripts.addAll(cleanScripts);
this.rollbackScripts.addAll(rollbackScripts);
this.commitScripts.addAll(commitScripts);
- this.dbCleanHelper = dbCleanHelper;
this.autoCommit = autoCommit;
}
/**
- * DBCleaner constructor.
- *
- * @param connection
- * connection to database where workspace tables is placed
- * @param cleanScripts
- * scripts for cleaning database
- * @param rollbackScripts
- * scripts for execution when something failed
- * @param commitScripts
- * scripts for removing temporary objects
- * @param autoCommit
- * indicates if executing scripts should be done in autoCommit mode
- */
- public DBCleaner(Connection connection, List<String> cleanScripts, List<String> rollbackScripts,
- List<String> commitScripts, boolean autoCommit)
- {
- this(connection, cleanScripts, rollbackScripts, commitScripts, null, autoCommit);
- }
-
- /**
* Clean data from database. The method doesn't close connection or perform commit.
*
* @throws SQLException
@@ -128,11 +102,6 @@
public void executeCleanScripts() throws SQLException
{
executeScripts(cleanScripts);
-
- if (dbCleanHelper != null)
- {
- dbCleanHelper.executeCleanScripts();
- }
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleaner.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleaner.java 2012-01-13 08:22:15 UTC (rev 5449)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleaner.java 2012-01-13 09:39:01 UTC (rev 5450)
@@ -35,7 +35,7 @@
*/
public DummyDBCleaner()
{
- super(null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), null, false);
+ super(null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), false);
}
/**
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/RecursiveDBCleanHelper.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/RecursiveDBCleanHelper.java 2012-01-13 08:22:15 UTC (rev 5449)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/RecursiveDBCleanHelper.java 2012-01-13 09:39:01 UTC (rev 5450)
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.clean.rdbms;
-
-import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.security.PrivilegedExceptionAction;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- *
- * Created by The eXo Platform SAS.
- *
- * Date: 21.01.2011
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: RecursiveDBCleanHelper.java.java 34360 2010-11-11 11:11:11Z tolusha $
- */
-public class RecursiveDBCleanHelper implements DBCleanHelper
-{
-
- /**
- * Logger.
- */
- protected final static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.RecursiveDBCleanHelper");
-
- /**
- * Select items query.
- */
- private final String selectItems;
-
- /**
- * Remove items query.
- */
- private final String removeItems;
-
- /**
- * Connection to database.
- */
- protected final Connection connection;
-
- /**
- * DBCleanerHelper constructor.
- */
- public RecursiveDBCleanHelper(Connection connection, String selectItemds, String removeItems)
- {
- this.connection = connection;
- this.selectItems = selectItemds;
- this.removeItems = removeItems;
- }
-
- /**
- * Removing rows from table. Some database do not support cascade delete,
- * or need special sittings. In such case will be used deleting like
- * visitor does. First traverse to the bottom of the tree and then go up to the root
- * and perform deleting children.
- *
- * @throws SQLException
- * SQL exception.
- */
- public void executeCleanScripts() throws SQLException
- {
- recursiveClean(Constants.ROOT_PARENT_UUID);
- }
-
- private void recursiveClean(String parentID) throws SQLException
- {
- PreparedStatement selectStatement = null;
- PreparedStatement removeStatement = null;
- ResultSet result = null;
-
- try
- {
- selectStatement = connection.prepareStatement(this.selectItems);
- selectStatement.setString(1, parentID);
-
- final PreparedStatement fSelectStatement = selectStatement;
- result = (ResultSet)SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- return fSelectStatement.executeQuery();
- }
- });
-
- // recursive traversing to the bottom of the tree
- if (result.next())
- {
- do
- {
- recursiveClean(result.getString(1));
- }
- while (result.next());
-
- // go up to the root and remove all nodes
- removeStatement = connection.prepareStatement(this.removeItems);
- removeStatement.setString(1, parentID);
-
- final PreparedStatement fRemoveStatement = removeStatement;
- SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- fRemoveStatement.executeUpdate();
- return null;
- }
- });
- }
- }
- finally
- {
- if (selectStatement != null)
- {
- selectStatement.close();
- }
-
- if (removeStatement != null)
- {
- removeStatement.close();
- }
-
- if (result != null)
- {
- result.close();
- }
- }
- }
-}
14 years, 3 months
exo-jcr SVN: r5449 - jcr/branches/1.15.x/applications/product-patches/as/tomcat/bin.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-13 03:22:15 -0500 (Fri, 13 Jan 2012)
New Revision: 5449
Added:
jcr/branches/1.15.x/applications/product-patches/as/tomcat/bin/eXo_debug.sh
Log:
EXOJCR-1706: added eXo_debug.sh
Added: jcr/branches/1.15.x/applications/product-patches/as/tomcat/bin/eXo_debug.sh
===================================================================
--- jcr/branches/1.15.x/applications/product-patches/as/tomcat/bin/eXo_debug.sh (rev 0)
+++ jcr/branches/1.15.x/applications/product-patches/as/tomcat/bin/eXo_debug.sh 2012-01-13 08:22:15 UTC (rev 5449)
@@ -0,0 +1,5 @@
+#!/bin/sh
+export JPDA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=18000,server=y,suspend=y"
+
+PRGDIR=`dirname "$PRG"`
+exec "$PRGDIR"/eXo.sh "$@"
Property changes on: jcr/branches/1.15.x/applications/product-patches/as/tomcat/bin/eXo_debug.sh
___________________________________________________________________
Added: svn:executable
+ *
14 years, 3 months
exo-jcr SVN: r5448 - core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-13 02:42:50 -0500 (Fri, 13 Jan 2012)
New Revision: 5448
Modified:
core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/XAPoolTxSupportDatabaseService.java
Log:
EXOJCR-1695: execute code in priv block
Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/XAPoolTxSupportDatabaseService.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/XAPoolTxSupportDatabaseService.java 2012-01-13 07:41:37 UTC (rev 5447)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/XAPoolTxSupportDatabaseService.java 2012-01-13 07:42:50 UTC (rev 5448)
@@ -20,12 +20,14 @@
import org.enhydra.jdbc.pool.StandardXAPoolDataSource;
import org.enhydra.jdbc.standard.StandardXADataSource;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.services.database.DatabaseService;
import org.exoplatform.services.database.ExoDatasource;
import org.exoplatform.services.transaction.TransactionService;
+import java.security.PrivilegedAction;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Iterator;
@@ -94,7 +96,14 @@
private DataSource createDatasource(Map<String, String> props) throws Exception
{
- StandardXADataSource ds = new StandardXADataSource();
+ StandardXADataSource ds = SecurityHelper.doPrivilegedAction(new PrivilegedAction<StandardXADataSource>()
+ {
+ public StandardXADataSource run()
+ {
+ return new StandardXADataSource();
+ }
+ });
+
ds.setDriverName(props.get("connection.driver"));
ds.setUrl(props.get("connection.url"));
ds.setUser(props.get("connection.login"));
14 years, 3 months