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();
+ }
}
}