You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/09/08 18:09:45 UTC
svn commit: r812570 [18/24] - in /jackrabbit/sandbox/JCR-1456: ./
jackrabbit-api/ jackrabbit-api/src/main/appended-resources/
jackrabbit-api/src/main/appended-resources/META-INF/
jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabb...
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/EvaluationUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/EvaluationUtil.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/EvaluationUtil.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/EvaluationUtil.java Tue Sep 8 16:09:28 2009
@@ -25,11 +25,11 @@
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.Value;
import javax.jcr.security.AccessControlManager;
import javax.jcr.security.AccessControlPolicy;
import java.security.Principal;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -39,18 +39,17 @@
static boolean isExecutable(SessionImpl s, AccessControlManager acMgr) {
if (acMgr instanceof JackrabbitAccessControlManager) {
- for (Iterator it = s.getSubject().getPrincipals().iterator(); it.hasNext();) {
- Principal princ = (Principal) it.next();
+ for (Principal princ : s.getSubject().getPrincipals()) {
try {
AccessControlPolicy[] policies = ((JackrabbitAccessControlManager) acMgr).getApplicablePolicies(princ);
- for (int i = 0; i < policies.length; i++) {
- if (policies[i] instanceof ACLTemplate) {
+ for (AccessControlPolicy policy : policies) {
+ if (policy instanceof ACLTemplate) {
return true;
}
}
policies = ((JackrabbitAccessControlManager) acMgr).getPolicies(princ);
- for (int i = 0; i < policies.length; i++) {
- if (policies[i] instanceof ACLTemplate) {
+ for (AccessControlPolicy policy : policies) {
+ if (policy instanceof ACLTemplate) {
return true;
}
}
@@ -62,33 +61,33 @@
return false;
}
- static JackrabbitAccessControlList getPolicy(AccessControlManager acM, String path, Principal principal) throws RepositoryException,
- AccessDeniedException, NotExecutableException {
+ static JackrabbitAccessControlList getPolicy(AccessControlManager acM,
+ String path,
+ Principal principal)
+ throws RepositoryException, AccessDeniedException, NotExecutableException {
if (acM instanceof JackrabbitAccessControlManager) {
// first try applicable policies
AccessControlPolicy[] policies = ((JackrabbitAccessControlManager) acM).getApplicablePolicies(principal);
- for (int i = 0; i < policies.length; i++) {
- if (policies[i] instanceof ACLTemplate) {
- ACLTemplate acl = (ACLTemplate) policies[i];
- return acl;
+ for (AccessControlPolicy policy : policies) {
+ if (policy instanceof ACLTemplate) {
+ return (ACLTemplate) policy;
}
}
// second existing policies
policies = ((JackrabbitAccessControlManager) acM).getPolicies(principal);
- for (int i = 0; i < policies.length; i++) {
- if (policies[i] instanceof ACLTemplate) {
- ACLTemplate acl = (ACLTemplate) policies[i];
- return acl;
+ for (AccessControlPolicy policy : policies) {
+ if (policy instanceof ACLTemplate) {
+ return (ACLTemplate) policy;
}
}
}
throw new NotExecutableException();
}
- static Map getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
+ static Map<String, Value> getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
if (s instanceof SessionImpl) {
- Map restr = new HashMap();
+ Map<String, Value> restr = new HashMap<String, Value>();
restr.put(((SessionImpl) s).getJCRName(ACLTemplate.P_NODE_PATH), s.getValueFactory().createValue(path, PropertyType.PATH));
return restr;
} else {
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/LockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/LockTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/LockTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/LockTest.java Tue Sep 8 16:09:28 2009
@@ -23,6 +23,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.Value;
import javax.jcr.security.AccessControlManager;
import java.security.Principal;
import java.util.Map;
@@ -40,7 +41,7 @@
RepositoryException, NotExecutableException {
return EvaluationUtil.getPolicy(acMgr, path, princ);
}
- protected Map getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
+ protected Map<String, Value> getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
return EvaluationUtil.getRestrictions(s, path);
}
}
\ No newline at end of file
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/NodeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/NodeTypeTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/NodeTypeTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/NodeTypeTest.java Tue Sep 8 16:09:28 2009
@@ -23,6 +23,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.Value;
import javax.jcr.security.AccessControlManager;
import java.security.Principal;
import java.util.Map;
@@ -40,7 +41,7 @@
RepositoryException, NotExecutableException {
return EvaluationUtil.getPolicy(acMgr, path, princ);
}
- protected Map getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
+ protected Map<String, Value> getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
return EvaluationUtil.getRestrictions(s, path);
}
}
\ No newline at end of file
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/VersionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/VersionTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/VersionTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/VersionTest.java Tue Sep 8 16:09:28 2009
@@ -29,6 +29,7 @@
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.Value;
import javax.jcr.security.AccessControlManager;
import javax.jcr.security.Privilege;
import java.security.Principal;
@@ -51,7 +52,7 @@
RepositoryException, NotExecutableException {
return EvaluationUtil.getPolicy(acMgr, path, princ);
}
- protected Map getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
+ protected Map<String, Value> getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
return EvaluationUtil.getRestrictions(s, path);
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/WriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/WriteTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/WriteTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/principalbased/WriteTest.java Tue Sep 8 16:09:28 2009
@@ -19,22 +19,21 @@
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy;
+import org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal;
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.core.SessionImpl;
import org.apache.jackrabbit.core.security.authorization.AbstractWriteTest;
import org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry;
import org.apache.jackrabbit.core.security.TestPrincipal;
-import org.apache.jackrabbit.core.security.principal.ItemBasedPrincipal;
import org.apache.jackrabbit.test.NotExecutableException;
import org.apache.jackrabbit.util.Text;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.Value;
import javax.jcr.security.AccessControlManager;
import javax.jcr.security.Privilege;
import java.security.Principal;
@@ -45,8 +44,6 @@
*/
public class WriteTest extends AbstractWriteTest {
- private static Logger log = LoggerFactory.getLogger(WriteTest.class);
-
protected boolean isExecutable() {
return EvaluationUtil.isExecutable((SessionImpl) superuser, acMgr);
}
@@ -55,7 +52,7 @@
return EvaluationUtil.getPolicy(acM, path, principal);
}
- protected Map getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
+ protected Map<String, Value> getRestrictions(Session s, String path) throws RepositoryException, NotExecutableException {
return EvaluationUtil.getRestrictions(s, path);
}
@@ -63,8 +60,8 @@
public void testAutocreatedProperties() throws RepositoryException, NotExecutableException {
givePrivileges(path, testUser.getPrincipal(), privilegesFromName(PrivilegeRegistry.REP_WRITE), getRestrictions(superuser, path));
- // testuser is not allowed to READ the protected property jcr:created.
- Map restr = getRestrictions(superuser, path);
+ // test user is not allowed to READ the protected property jcr:created.
+ Map<String, Value> restr = getRestrictions(superuser, path);
restr.put(((SessionImpl) superuser).getJCRName(ACLTemplate.P_GLOB), superuser.getValueFactory().createValue("/afolder/jcr:created"));
withdrawPrivileges(path, testUser.getPrincipal(), privilegesFromName(Privilege.JCR_READ), restr);
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/GroupAdministratorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/GroupAdministratorTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/GroupAdministratorTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/GroupAdministratorTest.java Tue Sep 8 16:09:28 2009
@@ -42,8 +42,8 @@
private String uPath;
private Session uSession;
- private String parentUID;
- private String childUID;
+ private String otherUID;
+ private String otherUID2;
private String grID;
@@ -55,13 +55,13 @@
// create a first user
Principal p = getTestPrincipal();
UserImpl pUser = (UserImpl) userMgr.createUser(p.getName(), buildPassword(p));
- parentUID = pUser.getID();
+ otherUID = pUser.getID();
- // create a second user 'below' the first user and make it group-admin
+ // create a second user and make it group-admin
p = getTestPrincipal();
String pw = buildPassword(p);
Credentials creds = buildCredentials(p.getName(), pw);
- User user = userMgr.createUser(p.getName(), pw, p, pUser.getNode().getPath());
+ User user = userMgr.createUser(p.getName(), pw);
uID = user.getID();
uPath = ((UserImpl) user).getNode().getPath();
@@ -88,7 +88,7 @@
groupAdmin.removeMember(userMgr.getAuthorizable(uID));
// remove all users that have been created
- Authorizable a = userMgr.getAuthorizable(parentUID);
+ Authorizable a = userMgr.getAuthorizable(otherUID);
if (a != null) {
a.remove();
}
@@ -97,13 +97,13 @@
super.tearDown();
}
- private String getChildID() throws RepositoryException {
- if (childUID == null) {
- // create a third child user below
+ private String getYetAnotherID() throws RepositoryException {
+ if (otherUID2 == null) {
+ // create a third user
Principal p = getTestPrincipal();
- childUID = userMgr.createUser(p.getName(), buildPassword(p), p, uPath).getID();
+ otherUID2 = userMgr.createUser(p.getName(), buildPassword(p), p, uPath).getID();
}
- return childUID;
+ return otherUID2;
}
public void testIsGroupAdmin() throws RepositoryException, NotExecutableException {
@@ -157,7 +157,7 @@
Group testGroup = null;
try {
testGroup = umgr.createGroup(getTestPrincipal(), "/any/intermediate/path");
- assertTrue(Text.isDescendant(UserConstants.GROUPS_PATH + "/any/intermediate/path", ((GroupImpl)testGroup).getNode().getPath()));
+ assertEquals("Intermediate path must be ignored.",-1, ((GroupImpl)testGroup).getNode().getPath().indexOf("/any/intermediate/path"));
} finally {
if (testGroup != null) {
testGroup.remove();
@@ -165,15 +165,15 @@
}
}
- public void testAddChildToGroup() throws RepositoryException, NotExecutableException {
+ public void testAddToGroup() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(uSession);
- Authorizable cU = umgr.getAuthorizable(getChildID());
+ Authorizable cU = umgr.getAuthorizable(getYetAnotherID());
Group gr = (Group) umgr.getAuthorizable(grID);
- // adding and removing the child-user as member of a group not
+ // adding and removing the child-user as member of a group must not
// succeed as long editing session is not user-admin.
try {
- assertFalse(gr.addMember(cU));
+ assertFalse("Modifying group membership requires GroupAdmin and UserAdmin.",gr.addMember(cU));
} catch (AccessDeniedException e) {
// ok
} finally {
@@ -181,9 +181,9 @@
}
}
- public void testAddChildToGroup2() throws RepositoryException, NotExecutableException {
+ public void testAddToGroup2() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(uSession);
- Authorizable cU = umgr.getAuthorizable(getChildID());
+ Authorizable cU = umgr.getAuthorizable(getYetAnotherID());
Authorizable auth = umgr.getAuthorizable(UserConstants.USER_ADMIN_GROUP_NAME);
if (auth == null || !auth.isGroup()) {
@@ -223,7 +223,7 @@
assertTrue(userAdmin.isMember(self));
// add child-user to test group
- Authorizable testUser = umgr.getAuthorizable(getChildID());
+ Authorizable testUser = umgr.getAuthorizable(getYetAnotherID());
assertFalse(testGroup.isMember(testUser));
assertTrue(testGroup.addMember(testUser));
} finally {
@@ -241,7 +241,7 @@
try {
// let superuser create child user below the user with uID.
UserManager umgr = getUserManager(uSession);
- Authorizable cU = umgr.getAuthorizable(getChildID());
+ Authorizable cU = umgr.getAuthorizable(getYetAnotherID());
Group uadminGr = (Group) umgr.getAuthorizable(UserConstants.USER_ADMIN_GROUP_NAME);
if (uadminGr.isMember(cU)) {
throw new RepositoryException("Test user is already member -> cannot execute.");
@@ -257,14 +257,14 @@
}
}
- public void testAddParentToGroup() throws RepositoryException, NotExecutableException {
+ public void testAddOtherUserToGroup() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(uSession);
- Authorizable pU = umgr.getAuthorizable(parentUID);
+ Authorizable pU = umgr.getAuthorizable(otherUID);
Group gr = (Group) umgr.getAuthorizable(groupAdmin.getID());
- // adding and removing the parent-user as member of a group must
- // never succeed.
+ // adding and removing the parent-user as member of a group must not
+ // succeed: editing session isn't UserAdmin
try {
assertFalse(gr.addMember(pU));
} catch (AccessDeniedException e) {
@@ -273,7 +273,8 @@
gr.removeMember(pU);
}
- // ... even if the editing user becomes member of the user-admin group
+ // ... if the editing user becomes member of the user-admin group it
+ // must work.
Group uAdministrators = null;
try {
Authorizable userAdmin = userMgr.getAuthorizable(UserConstants.USER_ADMIN_GROUP_NAME);
@@ -283,12 +284,8 @@
uAdministrators = (Group) userAdmin;
uAdministrators.addMember(userMgr.getAuthorizable(uID));
- try {
- assertFalse(gr.addMember(pU));
- gr.removeMember(pU);
- } catch (AccessDeniedException e) {
- // fine as well.
- }
+ assertTrue(gr.addMember(pU));
+ gr.removeMember(pU);
} finally {
// let superuser do the clean up.
// remove testuser from u-admin group again.
@@ -410,7 +407,7 @@
UserManager umgr = getUserManager(uSession);
Principal selfPrinc = umgr.getAuthorizable(uID).getPrincipal();
- User child = (User) umgr.getAuthorizable(getChildID());
+ User child = (User) umgr.getAuthorizable(getYetAnotherID());
Impersonation impers = child.getImpersonation();
assertFalse(impers.allows(buildSubject(selfPrinc)));
try {
@@ -420,7 +417,7 @@
}
assertFalse(impers.allows(buildSubject(selfPrinc)));
- User parent = (User) umgr.getAuthorizable(parentUID);
+ User parent = (User) umgr.getAuthorizable(otherUID);
impers = parent.getImpersonation();
assertFalse(impers.allows(buildSubject(selfPrinc)));
try {
@@ -430,4 +427,21 @@
}
assertFalse(impers.allows(buildSubject(selfPrinc)));
}
+
+ public void testPersisted() throws NotExecutableException, RepositoryException {
+ UserManager umgr = getUserManager(uSession);
+ Group gr = null;
+ try {
+ Principal p = getTestPrincipal();
+ gr = umgr.createGroup(p);
+
+ Authorizable az = userMgr.getAuthorizable(gr.getID());
+ assertNotNull(az);
+ assertEquals(gr.getID(), az.getID());
+ } finally {
+ if (gr != null) {
+ gr.remove();
+ }
+ }
+ }
}
\ No newline at end of file
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/TestAll.java Tue Sep 8 16:09:28 2009
@@ -45,6 +45,8 @@
suite.addTestSuite(IndexNodeResolverTest.class);
suite.addTestSuite(TraversingNodeResolverTest.class);
+ suite.addTestSuite(IdResolverTest.class);
+
return suite;
}
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserAdministratorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserAdministratorTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserAdministratorTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserAdministratorTest.java Tue Sep 8 16:09:28 2009
@@ -24,7 +24,6 @@
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.jackrabbit.core.security.principal.EveryonePrincipal;
import org.apache.jackrabbit.test.NotExecutableException;
-import org.apache.jackrabbit.util.Text;
import javax.jcr.AccessDeniedException;
import javax.jcr.Credentials;
@@ -59,11 +58,11 @@
UserImpl u = (UserImpl) userMgr.createUser(p.getName(), buildPassword(p));
uID = u.getID();
- // create a second user 'below' the first user.
+ // create a second user
p = getTestPrincipal();
String pw = buildPassword(p);
Credentials otherCreds = buildCredentials(p.getName(), pw);
- User other = userMgr.createUser(p.getName(), pw, p, u.getNode().getPath());
+ User other = userMgr.createUser(p.getName(), pw);
otherUID = other.getID();
otherPath = ((UserImpl) other).getNode().getPath();
@@ -123,11 +122,10 @@
public void testCreateUser() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(otherSession);
UserImpl u = null;
- // create a new user -> must succeed and user must be create below 'other'
+ // create a new user -> must succeed.
try {
Principal p = getTestPrincipal();
u = (UserImpl) umgr.createUser(p.getName(), buildPassword(p));
- assertTrue(Text.isDescendant(otherPath, u.getNode().getPath()));
} finally {
if (u != null) {
u.remove();
@@ -139,12 +137,12 @@
UserManager umgr = getUserManager(otherSession);
UserImpl u = null;
// create a new user with intermediate-path
- // -> must succeed and user must be create below 'other'
+ // -> must succeed and user must be created
+ // -> intermediate path must be ignored.
try {
Principal p = getTestPrincipal();
u = (UserImpl) umgr.createUser(p.getName(), buildPassword(p), p, "/some/intermediate/path");
- assertTrue(Text.isDescendant(otherPath, u.getNode().getPath()));
- assertTrue(Text.isDescendant(otherPath + "/some/intermediate/path", u.getNode().getPath()));
+ assertEquals(-1, u.getNode().getPath().indexOf("/some/intermediate/path"));
} finally {
if (u != null) {
u.remove();
@@ -164,24 +162,25 @@
}
}
- public void testRemoveParentUser() throws RepositoryException, NotExecutableException {
+ /**
+ * A member of 'usermanagers' must be able to remove another user.
+ *
+ * @throws RepositoryException
+ * @throws NotExecutableException
+ */
+ public void testRemoveAnotherUser() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(otherSession);
- Authorizable parentuser = umgr.getAuthorizable(uID);
- try {
- parentuser.remove();
- fail("A UserAdministrator should not be allowed to remove a 'parent' user.");
- } catch (AccessDeniedException e) {
- // success
- }
+ Authorizable user = umgr.getAuthorizable(uID);
+ user.remove();
}
- public void testModifyImpersonationOfChildUser() throws RepositoryException, NotExecutableException {
+ public void testModifyImpersonationOfUser() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(otherSession);
Principal otherP = umgr.getAuthorizable(otherUID).getPrincipal();
+ // modify impersonation of new user
User u = null;
- // create a new user -> must succeed and user must be create below 'other'
try {
Principal p = getTestPrincipal();
u = umgr.createUser(p.getName(), buildPassword(p));
@@ -196,25 +195,15 @@
u.remove();
}
}
- }
- public void testModifyImpersonationOfParentUser() throws RepositoryException, NotExecutableException {
- UserManager umgr = getUserManager(otherSession);
- User u = (User) umgr.getAuthorizable(uID);
+ // modify impersonation of another user
+ u = (User) umgr.getAuthorizable(uID);
Impersonation uImpl = u.getImpersonation();
-
- Principal otherP = umgr.getAuthorizable(otherUID).getPrincipal();
-
if (!uImpl.allows(buildSubject(otherP))) {
- // ... trying to modify 'impersonators of 'uid' must not succeed.
- try {
- assertFalse(uImpl.grantImpersonation(otherP));
- } catch (AccessDeniedException e) {
- // success
- } finally {
- assertFalse(uImpl.allows(buildSubject(otherP)));
- uImpl.revokeImpersonation(otherP);
- }
+ // ... trying to modify 'impersonators of another user must succeed
+ assertTrue(uImpl.grantImpersonation(otherP));
+ assertTrue(uImpl.allows(buildSubject(otherP)));
+ uImpl.revokeImpersonation(otherP);
} else {
throw new NotExecutableException("Cannot execute test. OtherP can already impersonate UID-user.");
}
@@ -232,7 +221,7 @@
}
}
- public void testModifyGroupForParentUser() throws RepositoryException, NotExecutableException {
+ public void testModifyGroup() throws RepositoryException, NotExecutableException {
UserManager umgr = getUserManager(otherSession);
User parentUser = (User) umgr.getAuthorizable(uID);
@@ -241,22 +230,19 @@
} else {
Group gr = getGroupAdminGroup(umgr);
try {
- assertFalse(gr.addMember(parentUser));
+ assertFalse("A UserAdmin must not be allowed to modify group memberships", gr.addMember(parentUser));
} catch (RepositoryException e) {
// success
}
}
- }
- public void testModifyGroupForChildUser() throws RepositoryException, NotExecutableException {
- UserManager umgr = getUserManager(otherSession);
Principal cp = getTestPrincipal();
User childU = null;
try {
childU = umgr.createUser(cp.getName(), buildPassword(cp));
Group gr = getGroupAdminGroup(umgr);
try {
- assertFalse(gr.addMember(childU));
+ assertFalse("A UserAdmin must not be allowed to modify group memberships", gr.addMember(childU));
} catch (RepositoryException e) {
// success
}
@@ -289,6 +275,22 @@
}
}
+ public void testRemoveGroup() throws NotExecutableException, RepositoryException {
+ UserManager umgr = getUserManager(otherSession);
+ Group g = null;
+ try {
+ g = userMgr.createGroup(getTestPrincipal());
+ umgr.getAuthorizable(g.getID()).remove();
+ fail("UserAdmin should not be allowed to remove a Group.");
+ } catch (RepositoryException e) {
+ // success.
+ } finally {
+ if (g != null) {
+ g.remove();
+ }
+ }
+ }
+
public void testAddToGroup() throws NotExecutableException, RepositoryException {
UserManager umgr = getUserManager(otherSession);
Group gr = getGroupAdminGroup(umgr);
@@ -316,4 +318,22 @@
// success
}
}
+
+ public void testPersisted() throws NotExecutableException, RepositoryException {
+ UserManager umgr = getUserManager(otherSession);
+ UserImpl u = null;
+ // create a new user -> must succeed.
+ try {
+ Principal p = getTestPrincipal();
+ u = (UserImpl) umgr.createUser(p.getName(), buildPassword(p));
+
+ Authorizable az = userMgr.getAuthorizable(u.getID());
+ assertNotNull(az);
+ assertEquals(u.getID(), az.getID());
+ } finally {
+ if (u != null) {
+ u.remove();
+ }
+ }
+ }
}
\ No newline at end of file
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserManagerImplTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserManagerImplTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserManagerImplTest.java Tue Sep 8 16:09:28 2009
@@ -98,24 +98,6 @@
}
}
-
- public void testRemoveUserRemovesTree() throws RepositoryException {
- // create 2 new users. the second as child of the first.
- Principal p = getTestPrincipal();
- User u = userMgr.createUser(p.getName(), buildPassword(p));
- String uID = u.getID();
- p = getTestPrincipal();
- User u2 = userMgr.createUser(p.getName(), buildPassword(p), p, ((UserImpl)u).getNode().getPath());
- String u2ID = u2.getID();
-
- // removing the first user must also remove the child-users.
- u.remove();
-
- // make sure both users are gone
- assertNull(userMgr.getAuthorizable(uID));
- assertNull(userMgr.getAuthorizable(u2ID));
- }
-
public void testPrincipalNameEqualsUserID() throws RepositoryException {
Principal p = getTestPrincipal();
User u = null;
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueFactoryTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueFactoryTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueFactoryTest.java Tue Sep 8 16:09:28 2009
@@ -16,11 +16,11 @@
*/
package org.apache.jackrabbit.core.value;
+import org.apache.jackrabbit.core.id.NodeId;
import org.apache.jackrabbit.spi.QValueFactoryTest;
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
-import org.apache.jackrabbit.uuid.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,7 +38,7 @@
factory = InternalValueFactory.getInstance();
rootPath = PathFactoryImpl.getInstance().getRootPath();
testName = NameFactoryImpl.getInstance().create(Name.NS_JCR_URI, "data");
- reference = UUID.randomUUID().toString();
+ reference = new NodeId().toString();
}
protected void tearDown() throws Exception {
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/InternalValueTest.java Tue Sep 8 16:09:28 2009
@@ -16,11 +16,11 @@
*/
package org.apache.jackrabbit.core.value;
+import org.apache.jackrabbit.core.id.NodeId;
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.QValueTest;
import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
-import org.apache.jackrabbit.uuid.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,7 +38,7 @@
factory = InternalValueFactory.getInstance();
rootPath = PathFactoryImpl.getInstance().getRootPath();
testName = NameFactoryImpl.getInstance().create(Name.NS_JCR_URI, "data");
- reference = UUID.randomUUID().toString();
+ reference = new NodeId().toString();
}
protected void tearDown() throws Exception {
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/TestAll.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/TestAll.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/value/TestAll.java Tue Sep 8 16:09:28 2009
@@ -32,6 +32,7 @@
public static Test suite() {
TestSuite suite = new TestSuite("org.apache.jackrabbit.core.value tests");
+ suite.addTestSuite(BinaryValueTest.class);
suite.addTestSuite(InternalValueFactoryTest.class);
suite.addTestSuite(InternalValueTest.class);
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java Tue Sep 8 16:09:28 2009
@@ -22,7 +22,6 @@
import org.apache.jackrabbit.core.id.NodeId;
import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.uuid.UUID;
public class VersionIteratorImplTest extends TestCase {
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/DocumentViewTest.java Tue Sep 8 16:09:28 2009
@@ -114,7 +114,7 @@
ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
try {
Property property = root.getProperty("multi-value-test/test");
- assertTrue(message, property.getDefinition().isMultiple());
+ assertTrue(message, property.isMultiple());
assertEquals(message, property.getValues().length, 2);
assertTrue(message, property.getValues()[0].getBoolean());
assertFalse(message, property.getValues()[1].getBoolean());
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/TestAll.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/TestAll.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/TestAll.java Tue Sep 8 16:09:28 2009
@@ -34,6 +34,7 @@
public static Test suite() {
TestSuite suite = new TestSuite("XML format test cases");
suite.addTestSuite(DocumentViewTest.class);
+ suite.addTestSuite(AccessControlImporterTest.class);
return suite;
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/WorkspaceImporterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/WorkspaceImporterTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/WorkspaceImporterTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/WorkspaceImporterTest.java Tue Sep 8 16:09:28 2009
@@ -23,7 +23,7 @@
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
import org.apache.jackrabbit.test.AbstractJCRTest;
/**
@@ -53,7 +53,7 @@
*/
public void testReferenceImport() throws Exception {
try {
- UUID uuid = UUID.randomUUID();
+ NodeId id = new NodeId();
String xml =
"<sv:node sv:name=\"a\""
+ " xmlns:jcr=\"http://www.jcp.org/jcr/1.0\""
@@ -67,13 +67,13 @@
+ "<sv:property sv:name=\"jcr:mixinTypes\" sv:type=\"Name\">"
+ "<sv:value>mix:referenceable</sv:value></sv:property>"
+ "<sv:property sv:name=\"jcr:uuid\" sv:type=\"String\">"
- + "<sv:value>" + uuid + "</sv:value></sv:property>"
+ + "<sv:value>" + id + "</sv:value></sv:property>"
+ "</sv:node>"
+ "<sv:node sv:name=\"c\">"
+ "<sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\">"
+ "<sv:value>nt:unstructured</sv:value></sv:property>"
+ "<sv:property sv:name=\"ref\" sv:type=\"Reference\">"
- + "<sv:value>" + uuid + "</sv:value></sv:property>"
+ + "<sv:value>" + id + "</sv:value></sv:property>"
+ "</sv:node>"
+ "</sv:node>";
superuser.getWorkspace().importXML(
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository/workspaces/default/workspace.xml?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository/workspaces/default/workspace.xml (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/repository/workspaces/default/workspace.xml Tue Sep 8 16:09:28 2009
@@ -41,7 +41,6 @@
<param name="synonymProviderConfigPath" value="../synonyms.properties"/>
<param name="supportHighlighting" value="true"/>
<param name="excerptProviderClass" value="org.apache.jackrabbit.core.query.lucene.WeightedHTMLExcerpt"/>
- <param name="indexingConfiguration" value="${wsp.home}/indexing-configuration.xml"/>
</SearchIndex>
</Workspace>
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCASessionHandle.java Tue Sep 8 16:09:28 2009
@@ -356,7 +356,7 @@
return getSession().getRetentionManager();
}
- public boolean hasCapability(String arg0, Object arg1, Map arg2)
+ public boolean hasCapability(String arg0, Object arg1, Object[] arg2)
throws RepositoryException {
return getSession().hasCapability(arg0, arg1, arg2);
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/rar/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/rar/META-INF/LICENSE.txt?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/rar/META-INF/LICENSE.txt (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jca/src/main/rar/META-INF/LICENSE.txt Tue Sep 8 16:09:28 2009
@@ -202,11 +202,11 @@
limitations under the License.
-APACHE JACKRABBIT SUBCOMPONENTS:
+APACHE JACKRABBIT SUBCOMPONENTS
-Apache Jackrabbit includes subcomponents with separate copyright notices
-and license terms. Your use of these subcomponents is subject to the terms
-and conditions of the following licenses:
+Apache Jackrabbit includes parts with separate copyright notices and license
+terms. Your use of these subcomponents is subject to the terms and conditions
+of the following licenses:
XPath parser (jackrabbit-spi-commons)
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-client/src/test/java/org/apache/jackrabbit/client/RepositoryFactoryImplTest.java Tue Sep 8 16:09:28 2009
@@ -162,7 +162,7 @@
return null;
}
- public Map getRepositoryDescriptors() throws RepositoryException {
+ public Map<String, QValue[]> getRepositoryDescriptors() throws RepositoryException {
return null;
}
@@ -264,6 +264,9 @@
public void checkout(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
}
+ public void checkout(SessionInfo sessionInfo, NodeId nodeId, NodeId activityId) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+ }
+
public NodeId checkpoint(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
return null;
}
@@ -306,7 +309,7 @@
return null;
}
- public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId, NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+ public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
return null;
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java Tue Sep 8 16:09:28 2009
@@ -39,17 +39,11 @@
*/
private static final Set<String> STANDARD_KEYS = new HashSet<String>() {{
add(Repository.IDENTIFIER_STABILITY);
- add(Repository.IDENTIFIER_STABILITY_INDEFINITE_DURATION);
- add(Repository.IDENTIFIER_STABILITY_METHOD_DURATION);
- add(Repository.IDENTIFIER_STABILITY_SAVE_DURATION);
- add(Repository.IDENTIFIER_STABILITY_SESSION_DURATION);
add(Repository.LEVEL_1_SUPPORTED);
add(Repository.LEVEL_2_SUPPORTED);
+ add(Repository.OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED);
add(Repository.NODE_TYPE_MANAGEMENT_AUTOCREATED_DEFINITIONS_SUPPORTED);
add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE);
- add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE_MINIMAL);
- add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE_MULTIPLE);
- add(Repository.NODE_TYPE_MANAGEMENT_INHERITANCE_SINGLE);
add(Repository.NODE_TYPE_MANAGEMENT_MULTIPLE_BINARY_PROPERTIES_SUPPORTED);
add(Repository.NODE_TYPE_MANAGEMENT_MULTIVALUED_PROPERTIES_SUPPORTED);
add(Repository.NODE_TYPE_MANAGEMENT_ORDERABLE_CHILD_NODES_SUPPORTED);
@@ -59,12 +53,13 @@
add(Repository.NODE_TYPE_MANAGEMENT_RESIDUAL_DEFINITIONS_SUPPORTED);
add(Repository.NODE_TYPE_MANAGEMENT_SAME_NAME_SIBLINGS_SUPPORTED);
add(Repository.NODE_TYPE_MANAGEMENT_VALUE_CONSTRAINTS_SUPPORTED);
+ add(Repository.NODE_TYPE_MANAGEMENT_UPDATE_IN_USE_SUPORTED);
add(Repository.OPTION_ACCESS_CONTROL_SUPPORTED);
add(Repository.OPTION_JOURNALED_OBSERVATION_SUPPORTED);
add(Repository.OPTION_LIFECYCLE_SUPPORTED);
add(Repository.OPTION_LOCKING_SUPPORTED);
- add(Repository.OPTION_NODE_TYPE_MANAGEMENT_SUPPORTED);
add(Repository.OPTION_OBSERVATION_SUPPORTED);
+ add(Repository.OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED);
add(Repository.OPTION_QUERY_SQL_SUPPORTED);
add(Repository.OPTION_RETENTION_SUPPORTED);
add(Repository.OPTION_SHAREABLE_NODES_SUPPORTED);
@@ -78,13 +73,10 @@
add(Repository.OPTION_XML_EXPORT_SUPPORTED);
add(Repository.OPTION_XML_IMPORT_SUPPORTED);
add(Repository.OPTION_ACTIVITIES_SUPPORTED);
- // add(Repository.OPTION_BASELINES_SUPPORTED);
+ add(Repository.OPTION_BASELINES_SUPPORTED);
add(Repository.QUERY_FULL_TEXT_SEARCH_SUPPORTED);
add(Repository.QUERY_JOINS);
- add(Repository.QUERY_JOINS_INNER);
- add(Repository.QUERY_JOINS_INNER_OUTER);
- add(Repository.QUERY_JOINS_NONE);
add(Repository.QUERY_LANGUAGES);
add(Repository.QUERY_STORED_QUERIES_SUPPORTED);
add(Repository.QUERY_XPATH_DOC_ORDER);
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/Exporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/Exporter.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/Exporter.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/xml/Exporter.java Tue Sep 8 16:09:28 2009
@@ -357,7 +357,7 @@
int type = property.getType();
if (type != PropertyType.BINARY || binary) {
- if (property.getDefinition().isMultiple()) {
+ if (property.isMultiple()) {
exportProperty(uri, local, type, property.getValues());
} else {
exportProperty(uri, local, property.getValue());
@@ -365,7 +365,7 @@
} else {
ValueFactory factory = session.getValueFactory();
Value value = factory.createValue("", PropertyType.BINARY);
- if (property.getDefinition().isMultiple()) {
+ if (property.isMultiple()) {
exportProperty(uri, local, type, new Value[] { value });
} else {
exportProperty(uri, local, value);
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Base64.java Tue Sep 8 16:09:28 2009
@@ -23,6 +23,7 @@
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
+import java.io.BufferedWriter;
/**
* <code>Base64</code> provides Base64 encoding/decoding of strings and streams.
@@ -115,8 +116,15 @@
*/
public static void encode(InputStream in, OutputStream out)
throws IOException {
- Writer writer = new OutputStreamWriter(out, CHARSET);
- encode(in, writer);
+ Writer writer = new BufferedWriter(new OutputStreamWriter(out, CHARSET));
+ try {
+ encode(in, writer);
+ } finally {
+ try {
+ writer.flush();
+ } catch (IOException ignore) {
+ }
+ }
}
/**
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/ChildrenCollectorFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/ChildrenCollectorFilter.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/ChildrenCollectorFilter.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/ChildrenCollectorFilter.java Tue Sep 8 16:09:28 2009
@@ -16,10 +16,18 @@
*/
package org.apache.jackrabbit.util;
+import javax.jcr.Item;
import javax.jcr.Node;
+import javax.jcr.NodeIterator;
import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.util.TraversingItemVisitor;
+
+import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
+import org.apache.jackrabbit.commons.iterator.PropertyIteratorAdapter;
+
+import java.util.ArrayList;
import java.util.Collection;
import java.util.StringTokenizer;
@@ -33,7 +41,7 @@
static final char WILDCARD_CHAR = '*';
static final String OR = "|";
- private final Collection children;
+ private final Collection<Item> children;
private final boolean collectNodes;
private final boolean collectProperties;
// namePattern and nameGlobs fields are used mutually exclusive
@@ -52,7 +60,7 @@
* (e.g. 1 for direct children only, 2 for children and their children, and so on)
*/
public ChildrenCollectorFilter(
- String namePattern, Collection children,
+ String namePattern, Collection<Item> children,
boolean collectNodes, boolean collectProperties, int maxLevel) {
super(false, maxLevel);
this.namePattern = namePattern;
@@ -74,7 +82,7 @@
* (e.g. 1 for direct children only, 2 for children and their children, and so on)
*/
public ChildrenCollectorFilter(
- String[] nameGlobs, Collection children,
+ String[] nameGlobs, Collection<Item> children,
boolean collectNodes, boolean collectProperties, int maxLevel) {
super(false, maxLevel);
this.nameGlobs = nameGlobs;
@@ -84,6 +92,38 @@
this.collectProperties = collectProperties;
}
+ public static NodeIterator collectChildNodes(
+ Node node, String namePattern) throws RepositoryException {
+ Collection<Item> nodes = new ArrayList<Item>();
+ node.accept(new ChildrenCollectorFilter(
+ namePattern, nodes, true, false, 1));
+ return new NodeIteratorAdapter(nodes);
+ }
+
+ public static NodeIterator collectChildNodes(
+ Node node, String[] nameGlobs) throws RepositoryException {
+ Collection<Item> nodes = new ArrayList<Item>();
+ node.accept(new ChildrenCollectorFilter(
+ nameGlobs, nodes, true, false, 1));
+ return new NodeIteratorAdapter(nodes);
+ }
+
+ public static PropertyIterator collectProperties(
+ Node node, String namePattern) throws RepositoryException {
+ Collection<Item> properties = new ArrayList<Item>();
+ node.accept(new ChildrenCollectorFilter(
+ namePattern, properties, false, true, 1));
+ return new PropertyIteratorAdapter(properties);
+ }
+
+ public static PropertyIterator collectProperties(
+ Node node, String[] nameGlobs) throws RepositoryException {
+ Collection<Item> properties = new ArrayList<Item>();
+ node.accept(new ChildrenCollectorFilter(
+ nameGlobs, properties, false, true, 1));
+ return new PropertyIteratorAdapter(properties);
+ }
+
/**
* {@inheritDoc}
*/
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/TransientFileFactory.java Tue Sep 8 16:09:28 2009
@@ -45,18 +45,19 @@
* Queue where <code>MoribundFileReference</code> instances will be enqueued
* once the associated target <code>File</code> objects have been gc'ed.
*/
- private ReferenceQueue phantomRefQueue = new ReferenceQueue();
+ private final ReferenceQueue<File> phantomRefQueue = new ReferenceQueue<File>();
/**
* Collection of <code>MoribundFileReference</code> instances currently
* being tracked.
*/
- private Collection trackedRefs = Collections.synchronizedList(new ArrayList());
+ private final Collection<MoribundFileReference> trackedRefs =
+ Collections.synchronizedList(new ArrayList<MoribundFileReference>());
/**
* The reaper thread responsible for removing files awaiting deletion
*/
- private final Thread reaper;
+ private final ReaperThread reaper;
/**
* Shutdown hook which removes all files awaiting deletion
@@ -149,9 +150,8 @@
// to avoid ConcurrentModificationException (JCR-549)
// @see java.lang.util.Collections.synchronizedList(java.util.List)
synchronized(trackedRefs) {
- for (Iterator it = trackedRefs.iterator(); it.hasNext();) {
- MoribundFileReference fileRef = (MoribundFileReference) it.next();
- fileRef.delete();
+ for (Iterator<MoribundFileReference> it = trackedRefs.iterator(); it.hasNext();) {
+ it.next().delete();
}
}
@@ -163,7 +163,9 @@
// jvm shutdown sequence has already begun,
// silently ignore...
}
+ shutdownHook = null;
}
+ reaper.stopWorking();
}
//--------------------------------------------------------< inner classes >
@@ -172,6 +174,8 @@
*/
private class ReaperThread extends Thread {
+ private volatile boolean stopping = false;
+
ReaperThread(String name) {
super(name);
}
@@ -181,11 +185,15 @@
* marker objects are reclaimed by the garbage collector.
*/
public void run() {
- while (true) {
+ while (!stopping) {
MoribundFileReference fileRef = null;
try {
// wait until a MoribundFileReference is ready for deletion
fileRef = (MoribundFileReference) phantomRefQueue.remove();
+ } catch (InterruptedException e) {
+ if (stopping) {
+ break;
+ }
} catch (Exception e) {
// silently ignore...
continue;
@@ -196,17 +204,25 @@
trackedRefs.remove(fileRef);
}
}
+
+ /**
+ * Stops the reaper thread.
+ */
+ public void stopWorking() {
+ stopping = true;
+ interrupt();
+ }
}
/**
* Tracker object for a file pending deletion.
*/
- private class MoribundFileReference extends PhantomReference {
+ private class MoribundFileReference extends PhantomReference<File> {
/**
* The full path to the file being tracked.
*/
- private String path;
+ private final String path;
/**
* Constructs an instance of this class from the supplied parameters.
@@ -214,7 +230,7 @@
* @param file The file to be tracked.
* @param queue The queue on to which the tracker will be pushed.
*/
- MoribundFileReference(File file, ReferenceQueue queue) {
+ MoribundFileReference(File file, ReferenceQueue<File> queue) {
super(file, queue);
this.path = file.getPath();
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BaseValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BaseValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BaseValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BaseValue.java Tue Sep 8 16:09:28 2009
@@ -51,12 +51,6 @@
protected static final String DEFAULT_ENCODING = "UTF-8";
- private static final short STATE_UNDEFINED = 0;
- private static final short STATE_VALUE_CONSUMED = 1;
- private static final short STATE_STREAM_CONSUMED = 2;
-
- private short state = STATE_UNDEFINED;
-
protected final int type;
protected InputStream stream = null;
@@ -71,39 +65,6 @@
}
/**
- * Checks if the non-stream value of this instance has already been
- * consumed (if any getter methods except <code>{@link #getStream()}</code> and
- * <code>{@link #getType()}</code> have been previously called at least once) and
- * sets the state to <code>STATE_STREAM_CONSUMED</code>.
- *
- * @throws IllegalStateException if any getter methods other than
- * <code>getStream()</code> and
- * <code>getType()</code> have been
- * previously called at least once.
- */
- protected void setStreamConsumed() throws IllegalStateException {
- if (state == STATE_VALUE_CONSUMED) {
- throw new IllegalStateException("non-stream value has already been consumed");
- }
- state = STATE_STREAM_CONSUMED;
- }
-
- /**
- * Checks if the stream value of this instance has already been
- * consumed (if {@link #getStream()} has been previously called
- * at least once) and sets the state to <code>STATE_VALUE_CONSUMED</code>.
- *
- * @throws IllegalStateException if <code>getStream()</code> has been
- * previously called at least once.
- */
- protected void setValueConsumed() throws IllegalStateException {
- if (state == STATE_STREAM_CONSUMED) {
- throw new IllegalStateException("stream value has already been consumed");
- }
- state = STATE_VALUE_CONSUMED;
- }
-
- /**
* Returns the internal string representation of this value without modifying
* the value state.
*
@@ -130,8 +91,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
Calendar cal = ISO8601.parse(getInternalString());
if (cal == null) {
throw new ValueFormatException("not a valid date format");
@@ -146,8 +105,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
try {
return Long.parseLong(getInternalString());
} catch (NumberFormatException e) {
@@ -161,9 +118,7 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
- return Boolean.valueOf(getInternalString()).booleanValue();
+ return Boolean.valueOf(getInternalString());
}
/**
@@ -172,8 +127,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
try {
return Double.parseDouble(getInternalString());
} catch (NumberFormatException e) {
@@ -187,8 +140,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
try {
return new BigDecimal(getInternalString());
} catch (NumberFormatException e) {
@@ -201,8 +152,6 @@
*/
public InputStream getStream()
throws IllegalStateException, RepositoryException {
- setStreamConsumed();
-
if (stream != null) {
return stream;
}
@@ -240,8 +189,6 @@
public String getString()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
return getInternalString();
}
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BinaryValue.java Tue Sep 8 16:09:28 2009
@@ -152,8 +152,6 @@
*/
public InputStream getStream()
throws IllegalStateException, RepositoryException {
- setStreamConsumed();
-
if (stream == null) {
if (bin != null) {
stream = bin.getStream();
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BooleanValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BooleanValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BooleanValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/BooleanValue.java Tue Sep 8 16:09:28 2009
@@ -49,7 +49,7 @@
*/
public BooleanValue(boolean bool) {
super(TYPE);
- this.bool = Boolean.valueOf(bool);
+ this.bool = bool;
}
/**
@@ -120,8 +120,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to date failed: inconvertible types");
}
@@ -131,8 +129,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to long failed: inconvertible types");
}
@@ -142,10 +138,8 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (bool != null) {
- return bool.booleanValue();
+ return bool;
} else {
throw new ValueFormatException("empty value");
}
@@ -157,8 +151,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to double failed: inconvertible types");
}
@@ -168,8 +160,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to Decimal failed: inconvertible types");
}
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DateValue.java Tue Sep 8 16:09:28 2009
@@ -135,8 +135,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (date != null) {
return (Calendar) date.clone();
} else {
@@ -150,8 +148,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (date != null) {
return date.getTimeInMillis();
} else {
@@ -165,8 +161,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (date != null) {
throw new ValueFormatException("cannot convert date to boolean");
} else {
@@ -180,8 +174,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (date != null) {
long ms = date.getTimeInMillis();
if (ms <= Double.MAX_VALUE) {
@@ -199,8 +191,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (date != null) {
return new BigDecimal(date.getTimeInMillis());
} else {
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DecimalValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DecimalValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DecimalValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DecimalValue.java Tue Sep 8 16:09:28 2009
@@ -117,8 +117,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (number != null) {
// loosing timezone information...
Calendar cal = Calendar.getInstance();
@@ -135,8 +133,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (number != null) {
return number.longValue();
} else {
@@ -150,8 +146,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to boolean failed: inconvertible types");
}
@@ -161,8 +155,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (number != null) {
return number.doubleValue();
} else {
@@ -176,8 +168,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (number != null) {
return number;
} else {
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DoubleValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DoubleValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DoubleValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/DoubleValue.java Tue Sep 8 16:09:28 2009
@@ -50,7 +50,7 @@
*/
public DoubleValue(double dbl) {
super(TYPE);
- this.dblNumber = new Double(dbl);
+ this.dblNumber = dbl;
}
/**
@@ -127,8 +127,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (dblNumber != null) {
// loosing timezone information...
Calendar cal = Calendar.getInstance();
@@ -145,8 +143,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (dblNumber != null) {
return dblNumber.longValue();
} else {
@@ -160,8 +156,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to boolean failed: inconvertible types");
}
@@ -171,10 +165,8 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (dblNumber != null) {
- return dblNumber.doubleValue();
+ return dblNumber;
} else {
throw new ValueFormatException("empty value");
}
@@ -186,10 +178,8 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (dblNumber != null) {
- return new BigDecimal(dblNumber.doubleValue());
+ return new BigDecimal(dblNumber);
} else {
throw new ValueFormatException("empty value");
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/LongValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/LongValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/LongValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/LongValue.java Tue Sep 8 16:09:28 2009
@@ -50,7 +50,7 @@
*/
public LongValue(long l) {
super(TYPE);
- this.lNumber = new Long(l);
+ this.lNumber = l;
}
/**
@@ -127,12 +127,10 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (lNumber != null) {
// loosing timezone information...
Calendar cal = Calendar.getInstance();
- cal.setTime(new Date(lNumber.longValue()));
+ cal.setTime(new Date(lNumber));
return cal;
} else {
throw new ValueFormatException("empty value");
@@ -145,10 +143,8 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (lNumber != null) {
- return lNumber.longValue();
+ return lNumber;
} else {
throw new ValueFormatException("empty value");
}
@@ -160,8 +156,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to boolean failed: inconvertible types");
}
@@ -171,8 +165,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (lNumber != null) {
return lNumber.doubleValue();
} else {
@@ -186,10 +178,8 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
if (lNumber != null) {
- return new BigDecimal(lNumber.longValue());
+ return new BigDecimal(lNumber);
} else {
throw new ValueFormatException("empty value");
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/NameValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/NameValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/NameValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/NameValue.java Tue Sep 8 16:09:28 2009
@@ -122,8 +122,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to date failed: inconvertible types");
}
@@ -133,8 +131,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to long failed: inconvertible types");
}
@@ -144,8 +140,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to boolean failed: inconvertible types");
}
@@ -155,8 +149,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to double failed: inconvertible types");
}
@@ -166,8 +158,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to Decimal failed: inconvertible types");
}
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/PathValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/PathValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/PathValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/PathValue.java Tue Sep 8 16:09:28 2009
@@ -122,8 +122,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to date failed: inconvertible types");
}
@@ -133,8 +131,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to long failed: inconvertible types");
}
@@ -144,8 +140,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to boolean failed: inconvertible types");
}
@@ -155,8 +149,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to double failed: inconvertible types");
}
@@ -166,8 +158,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to Decimal failed: inconvertible types");
}
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ReferenceValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ReferenceValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ReferenceValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/ReferenceValue.java Tue Sep 8 16:09:28 2009
@@ -16,14 +16,13 @@
*/
package org.apache.jackrabbit.value;
-import org.apache.jackrabbit.uuid.UUID;
-
import javax.jcr.Node;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.ValueFormatException;
import java.util.Calendar;
+import java.util.UUID;
import java.math.BigDecimal;
/**
@@ -148,8 +147,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to date failed: inconvertible types");
}
@@ -159,8 +156,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to long failed: inconvertible types");
}
@@ -170,8 +165,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to boolean failed: inconvertible types");
}
@@ -181,8 +174,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to double failed: inconvertible types");
}
@@ -192,8 +183,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to Decimal failed: inconvertible types");
}
}
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/URIValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/URIValue.java?rev=812570&r1=812569&r2=812570&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/URIValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/value/URIValue.java Tue Sep 8 16:09:28 2009
@@ -126,8 +126,6 @@
public Calendar getDate()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to date failed: inconvertible types");
}
@@ -137,8 +135,6 @@
public long getLong()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to long failed: inconvertible types");
}
@@ -148,8 +144,6 @@
public boolean getBoolean()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to boolean failed: inconvertible types");
}
@@ -159,8 +153,6 @@
public double getDouble()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to double failed: inconvertible types");
}
@@ -170,8 +162,6 @@
public BigDecimal getDecimal()
throws ValueFormatException, IllegalStateException,
RepositoryException {
- setValueConsumed();
-
throw new ValueFormatException("conversion to Decimal failed: inconvertible types");
}
}
\ No newline at end of file