You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by cl...@apache.org on 2015/08/07 20:56:12 UTC
[01/13] jena git commit: Added
SecurityEvaluator.isPrincipalAuthenticated( Object principal) to verify
authentication. Part of issue JENA-992
Repository: jena
Updated Branches:
refs/heads/master 744216169 -> 7e7bf2b3a
Added SecurityEvaluator.isPrincipalAuthenticated( Object principal) to verify authentication.
Part of issue JENA-992
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/31af91ff
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/31af91ff
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/31af91ff
Branch: refs/heads/master
Commit: 31af91ff1b536dae980ea8585cdce98940c818c8
Parents: 4723a8a
Author: Claude Warren <cl...@apache.org>
Authored: Sun Jul 19 11:55:21 2015 +0100
Committer: Claude Warren <cl...@apache.org>
Committed: Sun Jul 19 11:55:21 2015 +0100
----------------------------------------------------------------------
.../jena/permissions/example/ExampleEvaluator.java | 6 ++++++
.../permissions/example/ShiroExampleEvaluator.java | 12 ++++++++++++
.../apache/jena/permissions/SecurityEvaluator.java | 14 ++++++++++++++
.../permissions/impl/CachedSecurityEvaluator.java | 5 +++++
.../jena/permissions/query/SecuredQueryEngine.java | 5 +++++
.../jena/permissions/MockSecurityEvaluator.java | 6 ++++++
.../jena/permissions/ModelBasedSecurityEvaluator.java | 9 ++++++++-
.../jena/permissions/StaticSecurityEvaluator.java | 5 +++++
.../permissions/model/SecuredModelDetailTest.java | 5 +++++
9 files changed, 66 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
index f67aa40..2c74c4e 100644
--- a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
+++ b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
@@ -126,9 +126,15 @@ public class ExampleEvaluator implements SecurityEvaluator {
}
principal = new BasicUserPrincipal( userName );
}
+
@Override
public Principal getPrincipal() {
return principal;
}
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ return principal != null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
index 6feeff1..4bac59b 100644
--- a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
+++ b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
@@ -218,5 +218,17 @@ public class ShiroExampleEvaluator implements SecurityEvaluator {
return SecurityUtils.getSubject();
}
+ /**
+ * Verify the Shiro subject is authenticated.
+ */
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ if (principal instanceof Subject)
+ {
+ return ((Subject)principal).isAuthenticated();
+ }
+ return false;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java b/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
index bb10e7c..898c41f 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
@@ -389,4 +389,18 @@ public interface SecurityEvaluator {
* @return The current principal
*/
public Object getPrincipal();
+
+ /**
+ * Returns true if the principal is recognized as an authenticated principal by the
+ * underlying authentication mechanism.
+ *
+ * This is to handle the case where an authentication mechanism returns a non-null object to
+ * indicate a non-authenticated principal. (e.g. Shiro).
+ *
+ * The principal is guaranteed to have been the return value from an earlier getPrincipal() call.
+ *
+ * @param principal The principal to check.
+ * @return true if authenticated, false if not.
+ */
+ public boolean isPrincipalAuthenticated( Object principal );
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java b/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
index b27bde7..5b7b07d 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
@@ -89,4 +89,9 @@ public class CachedSecurityEvaluator implements SecurityEvaluator {
return origPrincipal;
}
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ return wrapped.isPrincipalAuthenticated(principal);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java b/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
index 65fde31..d4ed844 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
@@ -146,6 +146,11 @@ public class SecuredQueryEngine extends QueryEngineMain
{
return null;
}
+
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ return true;
+ }
};
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/test/java/org/apache/jena/permissions/MockSecurityEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/MockSecurityEvaluator.java b/jena-permissions/src/test/java/org/apache/jena/permissions/MockSecurityEvaluator.java
index dd2e8d7..8e2fc09 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/MockSecurityEvaluator.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/MockSecurityEvaluator.java
@@ -227,4 +227,10 @@ public class MockSecurityEvaluator implements SecurityEvaluator
update, delete, forceTripleChecks);
}
+
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ return principal != null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/test/java/org/apache/jena/permissions/ModelBasedSecurityEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/ModelBasedSecurityEvaluator.java b/jena-permissions/src/test/java/org/apache/jena/permissions/ModelBasedSecurityEvaluator.java
index 61fc094..ca2f3cc 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/ModelBasedSecurityEvaluator.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/ModelBasedSecurityEvaluator.java
@@ -73,7 +73,14 @@ public class ModelBasedSecurityEvaluator implements SecurityEvaluator {
@Override
public Object getPrincipal() {
- return null;
+ return "principal";
+ }
+
+
+
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ return principal != null;
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/test/java/org/apache/jena/permissions/StaticSecurityEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/StaticSecurityEvaluator.java b/jena-permissions/src/test/java/org/apache/jena/permissions/StaticSecurityEvaluator.java
index 94e47e9..37c9fed 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/StaticSecurityEvaluator.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/StaticSecurityEvaluator.java
@@ -80,4 +80,9 @@ public class StaticSecurityEvaluator implements SecurityEvaluator {
return user;
}
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ return principal != null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/jena/blob/31af91ff/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelDetailTest.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelDetailTest.java b/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelDetailTest.java
index 51375ac..77f705d 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelDetailTest.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelDetailTest.java
@@ -376,6 +376,11 @@ public class SecuredModelDetailTest {
return principal;
}
+ @Override
+ public boolean isPrincipalAuthenticated(Object principal) {
+ return principal != null;
+ }
+
}
}
[08/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredProperty.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredProperty.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredProperty.java
index 20e8951..f066ca4 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredProperty.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredProperty.java
@@ -17,7 +17,8 @@
*/
package org.apache.jena.permissions.model;
-import org.apache.jena.rdf.model.Property ;
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.ReadDeniedException;
/**
@@ -25,14 +26,16 @@ import org.apache.jena.shared.ReadDeniedException;
*
* Use the SecuredProperty.Factory to create instances
*/
-public interface SecuredProperty extends SecuredResource, Property
-{
+public interface SecuredProperty extends SecuredResource, Property {
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int getOrdinal() throws ReadDeniedException;
+ public int getOrdinal() throws ReadDeniedException,
+ AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFList.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFList.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFList.java
index 07e2464..0f07a13 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFList.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFList.java
@@ -22,15 +22,15 @@ import java.util.List;
import java.util.Set;
import org.apache.jena.permissions.SecurityEvaluator.Action;
-import org.apache.jena.rdf.model.* ;
+import org.apache.jena.rdf.model.*;
import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.util.iterator.ExtendedIterator;
-public interface SecuredRDFList extends RDFList, SecuredResource
-{
+public interface SecuredRDFList extends RDFList, SecuredResource {
/**
* @sec.graph Update
@@ -38,35 +38,45 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @sec.triple Create SecTriple(SecNode.FUTURE, listFirst(), listNil())
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void add( final RDFNode value ) throws UpdateDeniedException, AddDeniedException;
+ public void add(final RDFNode value) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* Resulting list will contain the readable nodes from this list
* concatenated with nodes
+ *
* @sec.graph Update
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, value )
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.rest, this )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFList append( final Iterator<? extends RDFNode> nodes )
- throws UpdateDeniedException, AddDeniedException;
+ public RDFList append(final Iterator<? extends RDFNode> nodes)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* Resulting list will contain the readable nodes from this list
- * concatenated
- * with the list argument
+ * concatenated with the list argument
+ *
* @sec.graph Update
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, value )
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.rest, this )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFList append( final RDFList list ) throws UpdateDeniedException, AddDeniedException;
+ public RDFList append(final RDFList list) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* Uses the security settings for the application of the function calls.
@@ -77,18 +87,19 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @sec.triple other permissions required by the function.
* @throws ReadDeniedException
* graph Read or other permissions are not met
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void apply( final ApplyFn fn ) throws ReadDeniedException;
+ public void apply(final ApplyFn fn) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* This method is intended to provide the capabilities to apply functions
- * that
- * need to do more than read the graph.
+ * that need to do more than read the graph.
*
* If the user does not have constraints access to the item in the list the
- * item
- * is not included in the function.
+ * item is not included in the function.
*
* @param constraints
* The permissions the user must have on the items in the list.
@@ -98,39 +109,47 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @sec.graph Read
* @sec.triple Read and constraints
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public void apply( Set<Action> constraints, final ApplyFn fn )
- throws ReadDeniedException;
+ public void apply(Set<Action> constraints, final ApplyFn fn)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.triple Read for triples containing the returned RDFNodes.
* @return List<SecuredRDFNode>
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public List<RDFNode> asJavaList();
+ public List<RDFNode> asJavaList() throws AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, node ) for each
- * node in
- * nodes.
+ * node in nodes.
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void concatenate( final Iterator<? extends RDFNode> nodes )
- throws UpdateDeniedException, AddDeniedException;
+ public void concatenate(final Iterator<? extends RDFNode> nodes)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, node ) for each
- * node in
- * list.
+ * node in list.
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void concatenate( final RDFList list ) throws UpdateDeniedException, AddDeniedException;
+ public void concatenate(final RDFList list) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -138,36 +157,46 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.rest, this )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFList cons( final RDFNode value )
- throws UpdateDeniedException, AddDeniedException;
+ public SecuredRDFList cons(final RDFNode value)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read for triple containing value.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final RDFNode value ) throws ReadDeniedException;
+ public boolean contains(final RDFNode value) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* Creates a copy of this list comprising the readable elements of this
* list.
+ *
* @sec.graph Read to read the items to copy
* @sec.triple Read on each triple to be read.
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, value )
* @sec.triple Create SecTriple( SecNode.FUTURE, RDF.rest, this )
* @throws ReadDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFList copy() throws ReadDeniedException, AddDeniedException;
+ public SecuredRDFList copy() throws ReadDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* Answer the node that is the i'th element of the list, assuming that the
- * head is item zero. If the list is too
- * short to have an i'th element, throws a ListIndexException.
+ * head is item zero. If the list is too short to have an i'th element,
+ * throws a ListIndexException.
*
* List may be shortened by security constraints.
*
@@ -176,10 +205,13 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFNode get( final int i ) throws ReadDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
+ public SecuredRDFNode get(final int i) throws ReadDeniedException,
+ EmptyListException, ListIndexException, InvalidListException,
+ AuthenticationRequiredException;
/**
* The value that is at the head of the list.
@@ -190,9 +222,12 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @sec.triple Read for triple containing value.
* @throws ReadDeniedException
* @throws EmptyListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFNode getHead() throws ReadDeniedException, EmptyListException;
+ public RDFNode getHead() throws ReadDeniedException, EmptyListException,
+ AuthenticationRequiredException;
/**
* The value that is at the tail of the list.
@@ -205,17 +240,23 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredRDFList getTail() throws ReadDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
+ EmptyListException, ListIndexException, InvalidListException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getValidityErrorMessage() throws ReadDeniedException;
+ public String getValidityErrorMessage() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
@@ -224,10 +265,13 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final RDFNode value ) throws ReadDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
+ public int indexOf(final RDFNode value) throws ReadDeniedException,
+ EmptyListException, ListIndexException, InvalidListException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
@@ -236,49 +280,62 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final RDFNode value, final int start )
- throws ReadDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
+ public int indexOf(final RDFNode value, final int start)
+ throws ReadDeniedException, EmptyListException, ListIndexException,
+ InvalidListException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isEmpty() throws ReadDeniedException;
+ public boolean isEmpty() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public boolean isValid() throws ReadDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
+ ListIndexException, InvalidListException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read for triple containing value to be included in the result.
+ * @sec.triple Read for triple containing value to be included in the
+ * result.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public ExtendedIterator<RDFNode> iterator() throws ReadDeniedException;
+ public ExtendedIterator<RDFNode> iterator() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read + requiredPerms for triple containing value to be
- * included in the result.
+ * included in the result.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public ExtendedIterator<RDFNode> iterator( Set<Action> requiredPerms )
- throws ReadDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
+ public ExtendedIterator<RDFNode> iterator(Set<Action> requiredPerms)
+ throws ReadDeniedException, EmptyListException, ListIndexException,
+ InvalidListException, AuthenticationRequiredException;
/**
* Only readable triples will be passed to the function. If the function
- * does
- * any action other than read those permissions must also be granted.
+ * does any action other than read those permissions must also be granted.
*
* @sec.graph Read
* @sec.triple Read for triple containing value.
@@ -286,15 +343,17 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Object reduce( final ReduceFn fn, final Object initial )
- throws ReadDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
+ public Object reduce(final ReduceFn fn, final Object initial)
+ throws ReadDeniedException, EmptyListException, ListIndexException,
+ InvalidListException, AuthenticationRequiredException;
/**
- * Only readable triples will be passed to the function. In addition,
- * only triples that pass the requiredActions tests will be passed to the
+ * Only readable triples will be passed to the function. In addition, only
+ * triples that pass the requiredActions tests will be passed to the
* function.
*
* @sec.graph Read
@@ -310,10 +369,13 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public Object reduce( Set<Action> requiredActions, final ReduceFn fn,
- final Object initial ) throws ReadDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
+ public Object reduce(Set<Action> requiredActions, final ReduceFn fn,
+ final Object initial) throws ReadDeniedException,
+ EmptyListException, ListIndexException, InvalidListException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -323,9 +385,12 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFList remove( final RDFNode val ) throws UpdateDeniedException, DeleteDeniedException;
+ public RDFList remove(final RDFNode val) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -335,10 +400,13 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
@Deprecated
- public void removeAll() throws UpdateDeniedException, DeleteDeniedException;
+ public void removeAll() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -348,9 +416,12 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFList removeHead() throws UpdateDeniedException, DeleteDeniedException;
+ public RDFList removeHead() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -360,9 +431,12 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void removeList() throws UpdateDeniedException, DeleteDeniedException;
+ public void removeList() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -371,10 +445,12 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFNode replace( final int i, final RDFNode value )
- throws UpdateDeniedException;
+ public SecuredRDFNode replace(final int i, final RDFNode value)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
@@ -383,10 +459,12 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean sameListAs( final RDFList list )
- throws ReadDeniedException;
+ public boolean sameListAs(final RDFList list) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -396,17 +474,23 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFNode setHead( final RDFNode value )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredRDFNode setHead(final RDFNode value)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void setStrict( final boolean strict ) throws UpdateDeniedException;
+ public void setStrict(final boolean strict) throws UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* Size may be modified by security constraionts.
@@ -417,18 +501,24 @@ public interface SecuredRDFList extends RDFList, SecuredResource
* @throws EmptyListException
* @throws ListIndexException
* @throws InvalidListException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int size() throws ReadDeniedException;
+ public int size() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create for triple containing value.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFList with( final RDFNode value )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredRDFList with(final RDFNode value)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFNode.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFNode.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFNode.java
index c67cdb4..d650ec0 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFNode.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredRDFNode.java
@@ -17,10 +17,11 @@
*/
package org.apache.jena.permissions.model;
-import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.Node;
import org.apache.jena.permissions.SecuredItem;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.RDFNode ;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.ReadDeniedException;
/**
@@ -28,23 +29,27 @@ import org.apache.jena.shared.ReadDeniedException;
*
* Use one the SecuredRDFNode derived class Factories to create instances
*/
-public interface SecuredRDFNode extends RDFNode, SecuredItem
-{
+public interface SecuredRDFNode extends RDFNode, SecuredItem {
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Node asNode() throws ReadDeniedException;
+ public Node asNode() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public <T extends RDFNode> boolean canAs( final Class<T> view )
- throws ReadDeniedException;
+ public <T extends RDFNode> boolean canAs(final Class<T> view)
+ throws ReadDeniedException, AuthenticationRequiredException;
@Override
public SecuredModel getModel();
@@ -52,8 +57,11 @@ public interface SecuredRDFNode extends RDFNode, SecuredItem
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFNode inModel( final Model m ) throws ReadDeniedException;
+ public RDFNode inModel(final Model m) throws ReadDeniedException,
+ AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredReifiedStatement.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredReifiedStatement.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredReifiedStatement.java
index 5661ec9..ada6886 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredReifiedStatement.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredReifiedStatement.java
@@ -17,8 +17,8 @@
*/
package org.apache.jena.permissions.model;
-
-import org.apache.jena.rdf.model.ReifiedStatement ;
+import org.apache.jena.rdf.model.ReifiedStatement;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.ReadDeniedException;
/**
@@ -27,13 +27,15 @@ import org.apache.jena.shared.ReadDeniedException;
* Use the SecuredReifiedStatement.Factory to create instances
*/
public interface SecuredReifiedStatement extends ReifiedStatement,
- SecuredResource
-{
+ SecuredResource {
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement getStatement() throws ReadDeniedException;
+ public SecuredStatement getStatement() throws ReadDeniedException,
+ AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredResource.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredResource.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredResource.java
index c549685..361cf18 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredResource.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredResource.java
@@ -17,10 +17,11 @@
*/
package org.apache.jena.permissions.model;
-import org.apache.jena.datatypes.RDFDatatype ;
+import org.apache.jena.datatypes.RDFDatatype;
import org.apache.jena.permissions.model.impl.SecuredStatementIterator;
-import org.apache.jena.rdf.model.* ;
+import org.apache.jena.rdf.model.*;
import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
@@ -30,8 +31,7 @@ import org.apache.jena.shared.UpdateDeniedException;
*
* Use the SecuredResource.Factory to create instances
*/
-public interface SecuredResource extends Resource, SecuredRDFNode
-{
+public interface SecuredResource extends Resource, SecuredRDFNode {
@Override
public SecuredResource abort();
@@ -41,110 +41,143 @@ public interface SecuredResource extends Resource, SecuredRDFNode
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource addLiteral( final Property p, final boolean o )
- throws UpdateDeniedException, AddDeniedException;
+ public SecuredResource addLiteral(final Property p, final boolean o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addLiteral( final Property p, final char o )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addLiteral(final Property p, final char o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, value, d )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addLiteral( final Property value, final double d )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addLiteral(final Property value, final double d)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, value, d )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addLiteral( final Property value, final float d )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addLiteral(final Property value, final float d)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addLiteral( final Property p, final Literal o )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addLiteral(final Property p, final Literal o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addLiteral( final Property p, final long o )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addLiteral(final Property p, final long o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addLiteral( final Property p, final Object o )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addLiteral(final Property p, final Object o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addProperty( final Property p, final RDFNode o )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addProperty(final Property p, final RDFNode o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addProperty( final Property p, final String o )
- throws UpdateDeniedException, AddDeniedException;
+ public Resource addProperty(final Property p, final String o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, literal(lexicalForm,datatype) )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addProperty( final Property p, final String lexicalForm,
- final RDFDatatype datatype ) throws UpdateDeniedException, AddDeniedException;
+ public Resource addProperty(final Property p, final String lexicalForm,
+ final RDFDatatype datatype) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create (this, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Resource addProperty( final Property p, final String o,
- final String l ) throws UpdateDeniedException, AddDeniedException;
+ public Resource addProperty(final Property p, final String o, final String l)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
@Override
public SecuredResource asResource();
@@ -158,192 +191,247 @@ public interface SecuredResource extends Resource, SecuredRDFNode
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean equals( final Object o ) throws ReadDeniedException;
+ public boolean equals(final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public AnonId getId() throws ReadDeniedException;
+ public AnonId getId() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getLocalName() throws ReadDeniedException;
+ public String getLocalName() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getNameSpace() throws ReadDeniedException;
+ public String getNameSpace() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement getProperty( final Property p )
- throws ReadDeniedException;
+ public SecuredStatement getProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource getPropertyResourceValue( final Property p )
- throws ReadDeniedException;
+ public SecuredResource getPropertyResourceValue(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement getRequiredProperty( final Property p )
- throws ReadDeniedException;
+ public SecuredStatement getRequiredProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getURI() throws ReadDeniedException;
+ public String getURI() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasLiteral( final Property p, final boolean o )
- throws ReadDeniedException;
+ public boolean hasLiteral(final Property p, final boolean o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasLiteral( final Property p, final char o )
- throws ReadDeniedException;
+ public boolean hasLiteral(final Property p, final char o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasLiteral( final Property p, final double o )
- throws ReadDeniedException;
+ public boolean hasLiteral(final Property p, final double o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasLiteral( final Property p, final float o )
- throws ReadDeniedException;
+ public boolean hasLiteral(final Property p, final float o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasLiteral( final Property p, final long o )
- throws ReadDeniedException;
+ public boolean hasLiteral(final Property p, final long o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasLiteral( final Property p, final Object o )
- throws ReadDeniedException;
+ public boolean hasLiteral(final Property p, final Object o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasProperty( final Property p ) throws ReadDeniedException;
+ public boolean hasProperty(final Property p) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasProperty( final Property p, final RDFNode o )
- throws ReadDeniedException;
+ public boolean hasProperty(final Property p, final RDFNode o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,o)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasProperty( final Property p, final String o )
- throws ReadDeniedException;
+ public boolean hasProperty(final Property p, final String o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this,p,literal(o,l))
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasProperty( final Property p, final String o, final String l )
- throws ReadDeniedException;
+ public boolean hasProperty(final Property p, final String o, final String l)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasURI( final String uri ) throws ReadDeniedException;
+ public boolean hasURI(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read on returned Statements
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredStatementIterator listProperties()
- throws ReadDeniedException;
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read on returned Statements
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatementIterator listProperties( final Property p )
- throws ReadDeniedException;
+ public SecuredStatementIterator listProperties(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Delete on associated Statements
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource removeAll( final Property p )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredResource removeAll(final Property p)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Delete on all Statements
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource removeProperties() throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredResource removeProperties() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredSeq.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredSeq.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredSeq.java
index 62dd772..e72084b 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredSeq.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredSeq.java
@@ -17,10 +17,10 @@
*/
package org.apache.jena.permissions.model;
-
-import org.apache.jena.rdf.model.RDFNode ;
-import org.apache.jena.rdf.model.ResourceF ;
-import org.apache.jena.rdf.model.Seq ;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.ResourceF;
+import org.apache.jena.rdf.model.Seq;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
@@ -35,311 +35,410 @@ import org.apache.jena.shared.UpdateDeniedException;
*
*/
@SuppressWarnings("deprecation")
-public interface SecuredSeq extends Seq, SecuredContainer
-{
- /** *
+public interface SecuredSeq extends Seq, SecuredContainer {
+ /**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final boolean o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final boolean o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final char o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final char o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final double o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final double o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final float o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final float o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final long o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final long o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final Object o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final Object o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final RDFNode o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final RDFNode o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final String o )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final String o)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li(1), o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq add( final int index, final String o, final String l )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq add(final int index, final String o, final String l)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt getAlt( final int index ) throws ReadDeniedException;
+ public SecuredAlt getAlt(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredBag getBag( final int index ) throws ReadDeniedException;
+ public SecuredBag getBag(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean getBoolean( final int index ) throws ReadDeniedException;
+ public boolean getBoolean(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public byte getByte( final int index ) throws ReadDeniedException;
+ public byte getByte(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public char getChar( final int index ) throws ReadDeniedException;
+ public char getChar(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public double getDouble( final int index ) throws ReadDeniedException;
+ public double getDouble(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public float getFloat( final int index ) throws ReadDeniedException;
+ public float getFloat(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int getInt( final int index ) throws ReadDeniedException;
+ public int getInt(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getLanguage( final int index ) throws ReadDeniedException;
+ public String getLanguage(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredLiteral getLiteral( final int index )
- throws ReadDeniedException;
+ public SecuredLiteral getLiteral(final int index)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public long getLong( final int index ) throws ReadDeniedException;
+ public long getLong(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFNode getObject( final int index )
- throws ReadDeniedException;
+ public SecuredRDFNode getObject(final int index)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource getResource( final int index )
- throws ReadDeniedException;
+ public SecuredResource getResource(final int index)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
@Deprecated
- public SecuredResource getResource( final int index, final ResourceF f )
- throws ReadDeniedException;
+ public SecuredResource getResource(final int index, final ResourceF f)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq getSeq( final int index ) throws ReadDeniedException;
+ public SecuredSeq getSeq(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public short getShort( final int index ) throws ReadDeniedException;
+ public short getShort(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getString( final int index ) throws ReadDeniedException;
+ public String getString(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final boolean o ) throws ReadDeniedException;
+ public int indexOf(final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final char o ) throws ReadDeniedException;
+ public int indexOf(final char o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final double o ) throws ReadDeniedException;
+ public int indexOf(final double o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final float o ) throws ReadDeniedException;
+ public int indexOf(final float o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final long o ) throws ReadDeniedException;
+ public int indexOf(final long o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final Object o ) throws ReadDeniedException;
+ public int indexOf(final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final RDFNode o ) throws ReadDeniedException;
+ public int indexOf(final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final String o ) throws ReadDeniedException;
+ public int indexOf(final String o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int indexOf( final String o, final String l )
- throws ReadDeniedException;
+ public int indexOf(final String o, final String l)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
@@ -347,98 +446,119 @@ public interface SecuredSeq extends Seq, SecuredContainer
* @sec.triple Update Triples after index
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq remove( final int index ) throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredSeq remove(final int index) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final boolean o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final boolean o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final char o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final char o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final double o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final double o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final float o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final float o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final long o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final long o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final Object o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final Object o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final RDFNode o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final RDFNode o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final String o )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final String o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
+ * RDF.li(index), o )
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq set( final int index, final String o, final String l )
- throws UpdateDeniedException;
+ public SecuredSeq set(final int index, final String o, final String l)
+ throws UpdateDeniedException, AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredStatement.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredStatement.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredStatement.java
index 8c83f1c..b6efe03 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredStatement.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredStatement.java
@@ -17,10 +17,10 @@
*/
package org.apache.jena.permissions.model;
-
import org.apache.jena.permissions.SecuredItem;
-import org.apache.jena.rdf.model.* ;
+import org.apache.jena.rdf.model.*;
import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
@@ -30,106 +30,127 @@ import org.apache.jena.shared.UpdateDeniedException;
*
* Use the SecuredStatement.Factory to create instances
*/
-public interface SecuredStatement extends Statement, SecuredItem
-{
+public interface SecuredStatement extends Statement, SecuredItem {
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeLiteralObject( boolean o )
- throws UpdateDeniedException;
+ public SecuredStatement changeLiteralObject(boolean o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeLiteralObject( char o )
- throws UpdateDeniedException;
+ public SecuredStatement changeLiteralObject(char o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeLiteralObject( double o )
- throws UpdateDeniedException;
+ public SecuredStatement changeLiteralObject(double o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeLiteralObject( float o )
- throws UpdateDeniedException;
+ public SecuredStatement changeLiteralObject(float o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeLiteralObject( int o )
- throws UpdateDeniedException;
+ public SecuredStatement changeLiteralObject(int o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeLiteralObject( long o )
- throws UpdateDeniedException;
+ public SecuredStatement changeLiteralObject(long o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeObject( RDFNode o )
- throws UpdateDeniedException;
+ public SecuredStatement changeObject(RDFNode o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeObject( String o )
- throws UpdateDeniedException;
+ public SecuredStatement changeObject(String o)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeObject( String o, boolean wellFormed )
- throws UpdateDeniedException;
+ public SecuredStatement changeObject(String o, boolean wellFormed)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeObject( String o, String l )
- throws UpdateDeniedException;
+ public SecuredStatement changeObject(String o, String l)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement changeObject( String o, String l, boolean wellFormed )
- throws UpdateDeniedException;
+ public SecuredStatement changeObject(String o, String l, boolean wellFormed)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read, Update
@@ -137,10 +158,13 @@ public interface SecuredStatement extends Statement, SecuredItem
* @throws ReadDeniedException
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredReifiedStatement createReifiedStatement()
- throws ReadDeniedException, UpdateDeniedException, AddDeniedException;
+ throws ReadDeniedException, UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read, Update
@@ -148,10 +172,13 @@ public interface SecuredStatement extends Statement, SecuredItem
* @throws ReadDeniedException
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredReifiedStatement createReifiedStatement( String uri )
- throws ReadDeniedException, UpdateDeniedException, AddDeniedException;
+ public SecuredReifiedStatement createReifiedStatement(String uri)
+ throws ReadDeniedException, UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
@Override
public SecuredAlt getAlt();
@@ -162,51 +189,72 @@ public interface SecuredStatement extends Statement, SecuredItem
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean getBoolean() throws ReadDeniedException;
+ public boolean getBoolean() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public byte getByte() throws ReadDeniedException;
+ public byte getByte() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public char getChar() throws ReadDeniedException;
+ public char getChar() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public double getDouble() throws ReadDeniedException;
+ public double getDouble() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public float getFloat() throws ReadDeniedException;
+ public float getFloat() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int getInt() throws ReadDeniedException;
+ public int getInt() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getLanguage() throws ReadDeniedException;
+ public String getLanguage() throws ReadDeniedException,
+ AuthenticationRequiredException;
@Override
public SecuredLiteral getLiteral();
@@ -214,9 +262,12 @@ public interface SecuredStatement extends Statement, SecuredItem
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public long getLong() throws ReadDeniedException;
+ public long getLong() throws ReadDeniedException,
+ AuthenticationRequiredException;
@Override
public SecuredModel getModel();
@@ -228,14 +279,14 @@ public interface SecuredStatement extends Statement, SecuredItem
public SecuredProperty getPredicate();
@Override
- public SecuredStatement getProperty( Property p );
+ public SecuredStatement getProperty(Property p);
@Override
public SecuredResource getResource();
@Override
@Deprecated
- public SecuredResource getResource( ResourceF f );
+ public SecuredResource getResource(ResourceF f);
@Override
public SecuredSeq getSeq();
@@ -243,19 +294,25 @@ public interface SecuredStatement extends Statement, SecuredItem
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public short getShort() throws ReadDeniedException;
+ public short getShort() throws ReadDeniedException,
+ AuthenticationRequiredException;
@Override
- public SecuredStatement getStatementProperty( Property p );
+ public SecuredStatement getStatementProperty(Property p);
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getString() throws ReadDeniedException;
+ public String getString() throws ReadDeniedException,
+ AuthenticationRequiredException;
@Override
public SecuredResource getSubject();
@@ -264,42 +321,57 @@ public interface SecuredStatement extends Statement, SecuredItem
* @sec.graph Read
* @sec.triple Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean hasWellFormedXML() throws ReadDeniedException;
+ public boolean hasWellFormedXML() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isReified() throws ReadDeniedException;
+ public boolean isReified() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RSIterator listReifiedStatements() throws ReadDeniedException;
+ public RSIterator listReifiedStatements() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Delete
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement remove() throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredStatement remove() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Delete
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void removeReification() throws UpdateDeniedException, DeleteDeniedException;
+ public void removeReification() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException;
}
[03/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/test/java/org/apache/jena/permissions/graph/TDBGraphTest.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/graph/TDBGraphTest.java b/jena-permissions/src/test/java/org/apache/jena/permissions/graph/TDBGraphTest.java
index 857784a..09488b9 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/graph/TDBGraphTest.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/graph/TDBGraphTest.java
@@ -17,7 +17,6 @@
*/
package org.apache.jena.permissions.graph;
-import java.io.File;
import java.io.IOException;
import org.apache.jena.graph.Graph;
@@ -31,8 +30,6 @@ public class TDBGraphTest extends MemGraphTest {
private DatasetGraph dsGraph;
- private File f;
-
public TDBGraphTest(final MockSecurityEvaluator securityEvaluator) {
super(securityEvaluator);
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelTest.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelTest.java b/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelTest.java
index d336038..b0e6be3 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelTest.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelTest.java
@@ -412,11 +412,11 @@ public class SecuredModelTest {
final List<RDFNode> nodeList = new ArrayList<RDFNode>();
try {
securedModel.createList();
- if (!securityEvaluator.evaluate(Action.Update)) {
+ if ( ! securityEvaluator.evaluate(CU)) {
Assert.fail("Should have thrown UpdateDeniedException Exception");
}
- } catch (final UpdateDeniedException e) {
- if (securityEvaluator.evaluate(Action.Update)) {
+ } catch (final AccessDeniedException e) {
+ if (securityEvaluator.evaluate(CU)) {
Assert.fail(String
.format("Should not have thrown UpdateDeniedException Exception: %s - %s",
e, e.getTriple()));
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/test/java/org/apache/jena/permissions/query/DataSetTest.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/query/DataSetTest.java b/jena-permissions/src/test/java/org/apache/jena/permissions/query/DataSetTest.java
index 12ed85b..1284365 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/query/DataSetTest.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/query/DataSetTest.java
@@ -56,11 +56,7 @@ public class DataSetTest {
dsg.getContext().set(TDB.symUnionDefaultGraph, true);
Dataset myDataset = DatasetFactory.create(dsg);
- // DatasetGraph dsg = DatasetGraphFactory.createMem() ;
- //
- // Dataset myDataset = TDBFactory.createDataset();
baseModel = myDataset.getNamedModel("http://example.com/baseModel");
- // baseModel = myDataset.getDefaultModel();
baseModel = QueryEngineTest.populateModel(baseModel);
dftModel = Factory.getInstance(eval, "http://example.com/securedModel",
@@ -68,9 +64,6 @@ public class DataSetTest {
dataset = DatasetFactory.createMem();
dataset.setDefaultModel(dftModel);
-
- // // dataset.addNamedModel( dftModel.getModelIRI(), dftModel);
-
}
@Test
@@ -92,7 +85,7 @@ public class DataSetTest {
int count = 0;
for (; results.hasNext();) {
count++;
- final QuerySolution soln = results.nextSolution();
+ results.nextSolution();
}
Assert.assertEquals(8, count);
} finally {
@@ -170,8 +163,7 @@ public class DataSetTest {
int count = 0;
for (; results.hasNext();) {
count++;
- final QuerySolution soln = results.nextSolution();
- // System.out.println( soln );
+ results.nextSolution();
}
// 2x 3 values + type triple
Assert.assertEquals(8, count);
@@ -186,8 +178,7 @@ public class DataSetTest {
int count = 0;
for (; results.hasNext();) {
count++;
- final QuerySolution soln = results.nextSolution();
- // System.out.println( soln );
+ results.nextSolution();
}
// 2x 3 values + type triple
// all are in the base graph so no named graphs
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/test/java/org/apache/jena/permissions/query/QueryEngineTest.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/test/java/org/apache/jena/permissions/query/QueryEngineTest.java b/jena-permissions/src/test/java/org/apache/jena/permissions/query/QueryEngineTest.java
index daeff21..12e13f3 100644
--- a/jena-permissions/src/test/java/org/apache/jena/permissions/query/QueryEngineTest.java
+++ b/jena-permissions/src/test/java/org/apache/jena/permissions/query/QueryEngineTest.java
@@ -26,7 +26,6 @@ import org.apache.jena.graph.Node;
import org.apache.jena.graph.Triple;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
-import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
@@ -130,7 +129,7 @@ public class QueryEngineTest {
int count = 0;
for (; results.hasNext();) {
count++;
- final QuerySolution soln = results.nextSolution();
+ results.nextSolution();
}
Assert.assertEquals(8, count);
} finally {
@@ -208,8 +207,7 @@ public class QueryEngineTest {
int count = 0;
for (; results.hasNext();) {
count++;
- final QuerySolution soln = results.nextSolution();
- // System.out.println( soln );
+ results.nextSolution();
}
// 2x 3 values + type triple
Assert.assertEquals(8, count);
@@ -224,8 +222,7 @@ public class QueryEngineTest {
int count = 0;
for (; results.hasNext();) {
count++;
- final QuerySolution soln = results.nextSolution();
- // System.out.println( soln );
+ results.nextSolution();
}
// 2x 3 values + type triple
// no named graphs so no results.
[04/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSeqImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSeqImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSeqImpl.java
index d2515b8..a184302 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSeqImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSeqImpl.java
@@ -19,13 +19,18 @@ package org.apache.jena.permissions.model.impl;
import java.util.function.Predicate;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemInvoker;
import org.apache.jena.permissions.model.*;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-import org.apache.jena.vocabulary.RDF ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.DeleteDeniedException;
+import org.apache.jena.shared.ReadDeniedException;
+import org.apache.jena.shared.UpdateDeniedException;
+import org.apache.jena.util.iterator.ExtendedIterator;
+import org.apache.jena.vocabulary.RDF;
/**
* Implementation of SecuredSeq to be used by a SecuredItemInvoker proxy.
@@ -34,20 +39,16 @@ import org.apache.jena.vocabulary.RDF ;
* http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#Containers
*
*/
-public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
-{
- private class RDFNodeFilter implements Predicate<Statement>
- {
+public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq {
+ private class RDFNodeFilter implements Predicate<Statement> {
private final RDFNode n;
- public RDFNodeFilter( final RDFNode n )
- {
+ public RDFNodeFilter(final RDFNode n) {
this.n = n;
}
@Override
- public boolean test( final Statement o )
- {
+ public boolean test(final Statement o) {
return (o.getPredicate().getOrdinal() != 0)
&& n.equals(o.getObject());
}
@@ -63,16 +64,13 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
* The Seq to secure.
* @return the SecuredSeq
*/
- public static SecuredSeq getInstance( final SecuredModel securedModel,
- final Seq seq )
- {
- if (securedModel == null)
- {
+ public static SecuredSeq getInstance(final SecuredModel securedModel,
+ final Seq seq) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (seq == null)
- {
+ if (seq == null) {
throw new IllegalArgumentException("Seq may not be null");
}
final ItemHolder<Seq, SecuredSeq> holder = new ItemHolder<Seq, SecuredSeq>(
@@ -80,10 +78,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
final SecuredSeqImpl checker = new SecuredSeqImpl(securedModel, holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (seq instanceof SecuredSeq)
- {
- if (checker.isEquivalent((SecuredSeq) seq))
- {
+ if (seq instanceof SecuredSeq) {
+ if (checker.isEquivalent((SecuredSeq) seq)) {
return (SecuredSeq) seq;
}
}
@@ -102,52 +98,58 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
* @param holder
* The item holder that will contain this SecuredSeq.
*/
- protected SecuredSeqImpl( final SecuredModel securedModel,
- final ItemHolder<? extends Seq, ? extends SecuredSeq> holder )
- {
+ protected SecuredSeqImpl(final SecuredModel securedModel,
+ final ItemHolder<? extends Seq, ? extends SecuredSeq> holder) {
super(securedModel, holder);
this.holder = holder;
}
@Override
- public SecuredSeq add( final int index, final boolean o )
- {
- return add( index, asObject( o ));
+ public SecuredSeq add(final int index, final boolean o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, asObject(o));
}
@Override
- public SecuredSeq add( final int index, final char o )
- {
- return add( index, asObject( o ));
+ public SecuredSeq add(final int index, final char o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, asObject(o));
}
@Override
- public SecuredSeq add( final int index, final double o )
- {
- return add( index, asObject( o ));
+ public SecuredSeq add(final int index, final double o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, asObject(o));
}
@Override
- public SecuredSeq add( final int index, final float o )
- {
- return add( index, asObject( o ));
+ public SecuredSeq add(final int index, final float o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, asObject(o));
}
@Override
- public SecuredSeq add( final int index, final long o )
- {
- return add( index, asObject( o ));
+ public SecuredSeq add(final int index, final long o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, asObject(o));
}
@Override
- public SecuredSeq add( final int index, final Object o )
- {
- return add( index, asObject( o ));
+ public SecuredSeq add(final int index, final Object o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, asObject(o));
}
@Override
- public SecuredSeq add( final int index, final RDFNode o )
- {
+ public SecuredSeq add(final int index, final RDFNode o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
final Literal l = holder.getBaseItem().getModel().createTypedLiteral(o);
checkCreate(index, l);
@@ -156,47 +158,41 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredSeq add( final int index, final String o )
- {
- return add( index, o, "" );
+ public SecuredSeq add(final int index, final String o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, o, "");
}
@Override
- public SecuredSeq add( final int index, final String o, final String l )
- {
- return add( index, holder.getBaseItem().getModel().createLiteral(o, l));
+ public SecuredSeq add(final int index, final String o, final String l)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return add(index, holder.getBaseItem().getModel().createLiteral(o, l));
}
- private void checkCreate( final int index, final Literal l )
- {
+ private void checkCreate(final int index, final Literal l) {
checkCreate(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
.asNode(), l.asNode()));
}
- private Statement containerIndexOf( final RDFNode n )
- {
+ private Statement containerIndexOf(final RDFNode n) {
final ExtendedIterator<Statement> iter = listProperties().filterKeep(
new RDFNodeFilter(n));
- try
- {
- if (iter.hasNext())
- {
+ try {
+ if (iter.hasNext()) {
return iter.next();
- }
- else
- {
+ } else {
return null;
}
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public SecuredAlt getAlt( final int index )
- {
+ public SecuredAlt getAlt(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final Alt a = holder.getBaseItem().getAlt(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -205,8 +201,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredBag getBag( final int index )
- {
+ public SecuredBag getBag(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final Bag b = holder.getBaseItem().getBag(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -215,8 +211,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public boolean getBoolean( final int index )
- {
+ public boolean getBoolean(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final boolean retval = holder.getBaseItem().getBoolean(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -225,8 +221,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public byte getByte( final int index )
- {
+ public byte getByte(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final byte retval = holder.getBaseItem().getByte(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -235,8 +231,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public char getChar( final int index )
- {
+ public char getChar(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final char retval = holder.getBaseItem().getChar(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -246,8 +242,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public double getDouble( final int index )
- {
+ public double getDouble(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final double retval = holder.getBaseItem().getDouble(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -256,8 +252,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public float getFloat( final int index )
- {
+ public float getFloat(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final float retval = holder.getBaseItem().getFloat(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -266,8 +262,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public int getInt( final int index )
- {
+ public int getInt(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final int retval = holder.getBaseItem().getInt(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -276,8 +272,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public String getLanguage( final int index )
- {
+ public String getLanguage(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final Literal literal = holder.getBaseItem().getLiteral(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -286,8 +282,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredLiteral getLiteral( final int index )
- {
+ public SecuredLiteral getLiteral(final int index)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final Literal literal = holder.getBaseItem().getLiteral(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -296,8 +292,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public long getLong( final int index )
- {
+ public long getLong(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final long retval = holder.getBaseItem().getLong(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -306,8 +302,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredRDFNode getObject( final int index )
- {
+ public SecuredRDFNode getObject(final int index)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final RDFNode retval = holder.getBaseItem().getObject(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -316,8 +312,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredResource getResource( final int index )
- {
+ public SecuredResource getResource(final int index)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final Resource retval = holder.getBaseItem().getResource(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -327,8 +323,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
@Override
@Deprecated
- public SecuredResource getResource( final int index, final ResourceF f )
- {
+ public SecuredResource getResource(final int index, final ResourceF f)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final Resource retval = holder.getBaseItem().getResource(index, f);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -337,8 +333,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredSeq getSeq( final int index )
- {
+ public SecuredSeq getSeq(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final Seq retval = holder.getBaseItem().getSeq(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -347,8 +343,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public short getShort( final int index )
- {
+ public short getShort(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final short retval = holder.getBaseItem().getShort(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -357,8 +353,8 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public String getString( final int index )
- {
+ public String getString(final int index) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final String retval = holder.getBaseItem().getString(index);
checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
@@ -367,48 +363,47 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public int indexOf( final boolean o )
- {
- return indexOf( asObject( o ));
+ public int indexOf(final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return indexOf(asObject(o));
}
@Override
- public int indexOf( final char o )
- {
- return indexOf( asObject( o ));
+ public int indexOf(final char o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return indexOf(asObject(o));
}
@Override
- public int indexOf( final double o )
- {
- return indexOf( asObject( o ));
+ public int indexOf(final double o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return indexOf(asObject(o));
}
@Override
- public int indexOf( final float o )
- {
- return indexOf( asObject( o ));
+ public int indexOf(final float o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return indexOf(asObject(o));
}
@Override
- public int indexOf( final long o )
- {
- return indexOf( asObject( o ));
+ public int indexOf(final long o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return indexOf(asObject(o));
}
@Override
- public int indexOf( final Object o )
- {
- return indexOf( asObject( o ));
+ public int indexOf(final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return indexOf(asObject(o));
}
@Override
- public int indexOf( final RDFNode o )
- {
+ public int indexOf(final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final Statement stmt = containerIndexOf(o);
- if (stmt == null)
- {
+ if (stmt == null) {
return 0;
}
checkRead(stmt);
@@ -416,24 +411,23 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public int indexOf( final String o )
- {
- return indexOf( asLiteral( o, "" ));
+ public int indexOf(final String o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return indexOf(asLiteral(o, ""));
}
@Override
- public int indexOf( final String o, final String l )
- {
- return indexOf( asLiteral( o, l));
+ public int indexOf(final String o, final String l)
+ throws ReadDeniedException, AuthenticationRequiredException {
+ return indexOf(asLiteral(o, l));
}
@Override
- public SecuredSeq remove( final int index )
- {
+ public SecuredSeq remove(final int index) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
final RDFNode rdfNode = holder.getBaseItem().getObject(index);
- if (rdfNode != null)
- {
+ if (rdfNode != null) {
checkDelete(new Triple(holder.getBaseItem().asNode(), RDF.li(index)
.asNode(), rdfNode.asNode()));
holder.getBaseItem().remove(index);
@@ -442,56 +436,60 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredSeq set( final int index, final boolean o )
- {
- return set( index, asObject( o ));
+ public SecuredSeq set(final int index, final boolean o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asObject(o));
}
@Override
- public SecuredSeq set( final int index, final char o )
- {
- return set( index, asObject( o ));
+ public SecuredSeq set(final int index, final char o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asObject(o));
}
@Override
- public SecuredSeq set( final int index, final double o )
- {
- return set( index, asObject( o ));
+ public SecuredSeq set(final int index, final double o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asObject(o));
}
@Override
- public SecuredSeq set( final int index, final float o )
- {
- return set( index, asObject( o ));
+ public SecuredSeq set(final int index, final float o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asObject(o));
}
@Override
- public SecuredSeq set( final int index, final long o )
- {
- return set( index, asObject( o ));
+ public SecuredSeq set(final int index, final long o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asObject(o));
}
@Override
- public SecuredSeq set( final int index, final Object o )
- {
- return set( index, asObject( o ));
+ public SecuredSeq set(final int index, final Object o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asObject(o));
}
@Override
- public SecuredSeq set( final int index, final RDFNode o )
- {
+ public SecuredSeq set(final int index, final RDFNode o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
final Triple t2 = new Triple(holder.getBaseItem().asNode(), RDF.li(
index).asNode(), o.asNode());
final RDFNode rdfNode = holder.getBaseItem().getObject(index);
- if (rdfNode != null)
- {
+ if (rdfNode != null) {
final Triple t1 = new Triple(holder.getBaseItem().asNode(), RDF.li(
index).asNode(), rdfNode.asNode());
checkUpdate(t1, t2);
- }
- else
- {
+ } else {
checkCreate(t2);
}
holder.getBaseItem().set(index, o);
@@ -499,14 +497,16 @@ public class SecuredSeqImpl extends SecuredContainerImpl implements SecuredSeq
}
@Override
- public SecuredSeq set( final int index, final String o )
- {
- return set( index, asLiteral( o, "" ));
+ public SecuredSeq set(final int index, final String o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asLiteral(o, ""));
}
@Override
- public SecuredSeq set( final int index, final String o, final String l )
- {
- return set( index, asLiteral(o, l));
+ public SecuredSeq set(final int index, final String o, final String l)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return set(index, asLiteral(o, l));
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementImpl.java
index 99c7ed6..f3efedd 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredStatementImpl.java
@@ -17,21 +17,25 @@
*/
package org.apache.jena.permissions.model.impl;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemImpl;
import org.apache.jena.permissions.impl.SecuredItemInvoker;
import org.apache.jena.permissions.model.*;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.shared.PropertyNotFoundException ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.DeleteDeniedException;
+import org.apache.jena.shared.PropertyNotFoundException;
+import org.apache.jena.shared.ReadDeniedException;
+import org.apache.jena.shared.UpdateDeniedException;
/**
* Implementation of SecuredStatement to be used by a SecuredItemInvoker proxy.
*/
public class SecuredStatementImpl extends SecuredItemImpl implements
- SecuredStatement
-{
+ SecuredStatement {
/**
* get a SecuredStatement
*
@@ -41,16 +45,13 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
* The statement to secure.
* @return the SecuredStatement
*/
- public static SecuredStatement getInstance(
- final SecuredModel securedModel, final Statement stmt )
- {
- if (securedModel == null)
- {
+ public static SecuredStatement getInstance(final SecuredModel securedModel,
+ final Statement stmt) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (stmt == null)
- {
+ if (stmt == null) {
throw new IllegalArgumentException("Statement may not be null");
}
@@ -61,10 +62,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
securedModel, holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (stmt instanceof SecuredStatement)
- {
- if (checker.isEquivalent((SecuredStatement) stmt))
- {
+ if (stmt instanceof SecuredStatement) {
+ if (checker.isEquivalent((SecuredStatement) stmt)) {
return (SecuredStatement) stmt;
}
}
@@ -87,17 +86,16 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
* @param holder
* The item holder that will contain this SecuredStatement.
*/
- private SecuredStatementImpl( final SecuredModel securedModel,
- final ItemHolder<Statement, SecuredStatement> holder )
- {
+ private SecuredStatementImpl(final SecuredModel securedModel,
+ final ItemHolder<Statement, SecuredStatement> holder) {
super(securedModel, holder);
this.holder = holder;
this.securedModel = securedModel;
}
@Override
- public Triple asTriple()
- {
+ public Triple asTriple() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final Triple retval = holder.getBaseItem().asTriple();
checkRead(retval);
@@ -105,26 +103,23 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public boolean canCreate()
- {
+ public boolean canCreate() throws AuthenticationRequiredException {
return super.canCreate() ? canCreate(holder.getBaseItem()) : false;
}
@Override
- public boolean canDelete()
- {
+ public boolean canDelete() throws AuthenticationRequiredException {
return super.canDelete() ? canDelete(holder.getBaseItem()) : false;
}
@Override
- public boolean canRead()
- {
+ public boolean canRead() throws AuthenticationRequiredException {
return super.canRead() ? canRead(holder.getBaseItem()) : false;
}
@Override
- public SecuredStatement changeLiteralObject( final boolean o )
- {
+ public SecuredStatement changeLiteralObject(final boolean o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = getNewTriple(base, o);
@@ -134,8 +129,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeLiteralObject( final char o )
- {
+ public SecuredStatement changeLiteralObject(final char o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = getNewTriple(base, o);
@@ -145,8 +140,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeLiteralObject( final double o )
- {
+ public SecuredStatement changeLiteralObject(final double o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = getNewTriple(base, o);
@@ -156,8 +151,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeLiteralObject( final float o )
- {
+ public SecuredStatement changeLiteralObject(final float o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = getNewTriple(base, o);
@@ -167,8 +162,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeLiteralObject( final int o )
- {
+ public SecuredStatement changeLiteralObject(final int o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = getNewTriple(base, o);
@@ -178,8 +173,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeLiteralObject( final long o )
- {
+ public SecuredStatement changeLiteralObject(final long o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = getNewTriple(base, o);
@@ -189,8 +184,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeObject( final RDFNode o )
- {
+ public SecuredStatement changeObject(final RDFNode o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = new Triple(base.getSubject(),
@@ -201,8 +196,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeObject( final String o )
- {
+ public SecuredStatement changeObject(final String o)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = getNewTriple(base, o);
@@ -212,21 +207,22 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeObject( final String o,
- final boolean wellFormed )
- {
+ public SecuredStatement changeObject(final String o,
+ final boolean wellFormed) throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = new Triple(base.getSubject(),
- base.getPredicate(), NodeFactory.createLiteral(o, "", wellFormed));
+ base.getPredicate(), NodeFactory.createLiteral(o, "",
+ wellFormed));
checkUpdate(base, newBase);
return SecuredStatementImpl.getInstance(getModel(), holder
.getBaseItem().changeObject(o));
}
@Override
- public SecuredStatement changeObject( final String o, final String l )
- {
+ public SecuredStatement changeObject(final String o, final String l)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = new Triple(base.getSubject(),
@@ -237,13 +233,14 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement changeObject( final String o, final String l,
- final boolean wellFormed )
- {
+ public SecuredStatement changeObject(final String o, final String l,
+ final boolean wellFormed) throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
final Triple base = holder.getBaseItem().asTriple();
final Triple newBase = new Triple(base.getSubject(),
- base.getPredicate(), NodeFactory.createLiteral(o, l, wellFormed));
+ base.getPredicate(),
+ NodeFactory.createLiteral(o, l, wellFormed));
checkUpdate(base, newBase);
return SecuredStatementImpl.getInstance(getModel(), holder
.getBaseItem().changeObject(o, l, wellFormed));
@@ -251,7 +248,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
@Override
public SecuredReifiedStatement createReifiedStatement()
- {
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreateReified(null, holder.getBaseItem());
return SecuredReifiedStatementImpl.getInstance(getModel(), holder
@@ -259,8 +257,9 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredReifiedStatement createReifiedStatement( final String uri )
- {
+ public SecuredReifiedStatement createReifiedStatement(final String uri)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreateReified(uri, holder.getBaseItem());
return SecuredReifiedStatementImpl.getInstance(getModel(), holder
@@ -268,38 +267,36 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredAlt getAlt()
- {
+ public SecuredAlt getAlt() {
return SecuredAltImpl.getInstance(getModel(), holder.getBaseItem()
.getAlt());
}
@Override
- public SecuredBag getBag()
- {
+ public SecuredBag getBag() {
return SecuredBagImpl.getInstance(getModel(), holder.getBaseItem()
.getBag());
}
@Override
- public boolean getBoolean()
- {
+ public boolean getBoolean() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getBoolean();
}
@Override
- public byte getByte()
- {
+ public byte getByte() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getByte();
}
@Override
- public char getChar()
- {
+ public char getChar() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getChar();
@@ -307,67 +304,64 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public double getDouble()
- {
+ public double getDouble() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getDouble();
}
@Override
- public float getFloat()
- {
+ public float getFloat() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getFloat();
}
@Override
- public int getInt()
- {
+ public int getInt() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getInt();
}
@Override
- public String getLanguage()
- {
+ public String getLanguage() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getLiteral().getLanguage();
}
@Override
- public SecuredLiteral getLiteral()
- {
+ public SecuredLiteral getLiteral() {
return SecuredLiteralImpl.getInstance(getModel(), holder.getBaseItem()
.getLiteral());
}
@Override
- public long getLong()
- {
+ public long getLong() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getLong();
}
@Override
- public SecuredModel getModel()
- {
+ public SecuredModel getModel() {
return securedModel;
}
- private Triple getNewTriple( final Triple t, final Object o )
- {
- return new Triple(t.getSubject(), t.getPredicate(),
- NodeFactory.createLiteral(String.valueOf(o), "", false));
+ private Triple getNewTriple(final Triple t, final Object o) {
+ return new Triple(t.getSubject(), t.getPredicate(),
+ NodeFactory.createLiteral(String.valueOf(o), "", false));
}
@Override
- public SecuredRDFNode getObject()
- {
+ public SecuredRDFNode getObject() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
final RDFNode rdfNode = holder.getBaseItem().getObject();
@@ -376,15 +370,14 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredProperty getPredicate()
- {
+ public SecuredProperty getPredicate() {
return SecuredPropertyImpl.getInstance(getModel(), holder.getBaseItem()
.getPredicate());
}
@Override
- public SecuredStatement getProperty( final Property p )
- {
+ public SecuredStatement getProperty(final Property p)
+ throws AuthenticationRequiredException {
final StmtIterator s = holder
.getBaseItem()
.getModel()
@@ -392,120 +385,102 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
p, (RDFNode) null);
final SecuredStatementIterator iter = new SecuredStatementIterator(
getModel(), s);
- try
- {
- if (iter.hasNext())
- {
+ try {
+ if (iter.hasNext()) {
return SecuredStatementImpl
.getInstance(getModel(), iter.next());
- }
- else
- {
+ } else {
throw new PropertyNotFoundException(p);
}
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public SecuredResource getResource()
- {
+ public SecuredResource getResource() {
return SecuredResourceImpl.getInstance(getModel(), holder.getBaseItem()
.getResource());
}
@Override
@Deprecated
- public SecuredResource getResource( final ResourceF f )
- {
+ public SecuredResource getResource(final ResourceF f) {
return SecuredResourceImpl.getInstance(getModel(), holder.getBaseItem()
.getResource(f));
}
@Override
- public SecuredSeq getSeq()
- {
+ public SecuredSeq getSeq() {
return SecuredSeqImpl.getInstance(getModel(), holder.getBaseItem()
.getSeq());
}
@Override
- public short getShort()
- {
+ public short getShort() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getShort();
}
@Override
- public SecuredStatement getStatementProperty( final Property p )
- {
+ public SecuredStatement getStatementProperty(final Property p) {
final RSIterator rsIter = holder.getBaseItem().listReifiedStatements();
- try
- {
- while (rsIter.hasNext())
- {
+ try {
+ while (rsIter.hasNext()) {
final ReifiedStatement s = rsIter.next();
- if (s.hasProperty(p))
- {
+ if (s.hasProperty(p)) {
return SecuredStatementImpl.getInstance(getModel(),
s.getProperty(p));
}
}
throw new PropertyNotFoundException(p);
- }
- finally
- {
+ } finally {
rsIter.close();
}
}
@Override
- public String toString()
- {
- if (canRead() && canRead(holder.getBaseItem().asTriple()))
- {
+ public String toString() throws ReadDeniedException,
+ AuthenticationRequiredException {
+ if (canRead() && canRead(holder.getBaseItem().asTriple())) {
return holder.getBaseItem().toString();
- }
- else
- {
+ } else {
return super.toString();
}
}
-
+
@Override
- public String getString()
- { return getLiteral().getLexicalForm(); }
+ public String getString() {
+ return getLiteral().getLexicalForm();
+ }
@Override
- public SecuredResource getSubject()
- {
+ public SecuredResource getSubject() {
return SecuredResourceImpl.getInstance(getModel(), holder.getBaseItem()
.getSubject());
}
@Override
- public boolean hasWellFormedXML()
- {
+ public boolean hasWellFormedXML() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().getLiteral().isWellFormedXML();
}
@Override
- public boolean isReified()
- {
+ public boolean isReified() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return holder.getBaseItem().isReified();
}
@Override
- public RSIterator listReifiedStatements()
- {
+ public RSIterator listReifiedStatements() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(holder.getBaseItem().asTriple());
return new SecuredRSIterator(getModel(), holder.getBaseItem()
@@ -513,8 +488,8 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public SecuredStatement remove()
- {
+ public SecuredStatement remove() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
checkDelete(holder.getBaseItem());
holder.getBaseItem().remove();
@@ -522,32 +497,25 @@ public class SecuredStatementImpl extends SecuredItemImpl implements
}
@Override
- public void removeReification()
- {
+ public void removeReification() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
- if (!canDelete(Triple.ANY))
- {
+ if (!canDelete(Triple.ANY)) {
StmtIterator iter = null;
final RSIterator rsIter = holder.getBaseItem()
.listReifiedStatements();
- try
- {
- while (rsIter.hasNext())
- {
+ try {
+ while (rsIter.hasNext()) {
final ReifiedStatement stmt = rsIter.next();
iter = stmt.listProperties();
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
final Statement s = iter.next();
checkDelete(s);
}
}
- }
- finally
- {
+ } finally {
rsIter.close();
- if (iter != null)
- {
+ if (iter != null) {
iter.close();
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java b/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
index d4ed844..147f170 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/query/SecuredQueryEngine.java
@@ -20,130 +20,109 @@ package org.apache.jena.permissions.query;
import java.security.Principal;
import java.util.Set;
-import org.apache.jena.graph.Graph ;
+import org.apache.jena.graph.Graph;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.Triple;
import org.apache.jena.graph.NodeFactory;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.query.rewriter.OpRewriter;
-import org.apache.jena.query.Query ;
+import org.apache.jena.query.Query;
import org.apache.jena.permissions.graph.SecuredGraph;
-import org.apache.jena.sparql.algebra.Op ;
-import org.apache.jena.sparql.core.DatasetGraph ;
-import org.apache.jena.sparql.engine.binding.Binding ;
-import org.apache.jena.sparql.engine.main.QueryEngineMain ;
-import org.apache.jena.sparql.util.Context ;
+import org.apache.jena.sparql.algebra.Op;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.engine.binding.Binding;
+import org.apache.jena.sparql.engine.main.QueryEngineMain;
+import org.apache.jena.sparql.util.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SecuredQueryEngine extends QueryEngineMain
-{
+public class SecuredQueryEngine extends QueryEngineMain {
private static Logger LOG = LoggerFactory
.getLogger(SecuredQueryEngine.class);
private SecurityEvaluator securityEvaluator;
private Node graphIRI;
- /*
- * public SecuredQueryEngine( Op op, DatasetGraph dataset, Binding input,
- * Context context )
- * {
- * super(op, dataset, input, context);
- * setGraphIRI( dataset );
- * }
- */
- public SecuredQueryEngine( final Query query, final DatasetGraph dataset,
- final Binding input, final Context context )
- {
+ public SecuredQueryEngine(final Query query, final DatasetGraph dataset,
+ final Binding input, final Context context) {
super(query, dataset, input, context);
setGraphIRI(dataset);
}
- public SecurityEvaluator getSecurityEvaluator()
- {
+ public SecurityEvaluator getSecurityEvaluator() {
return securityEvaluator;
}
@Override
- protected Op modifyOp( final Op op )
- {
+ protected Op modifyOp(final Op op) {
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
- SecuredQueryEngine.LOG.debug("Before: {}", op);
+ LOG.debug("Before: {}", op);
op.visit(rewriter);
Op result = rewriter.getResult();
result = result == null ? op : result;
- SecuredQueryEngine.LOG.debug("After: {}", result);
+ LOG.debug("After: {}", result);
result = super.modifyOp(result);
- SecuredQueryEngine.LOG.debug("After Optimize: {}", result);
+ LOG.debug("After Optimize: {}", result);
return result;
}
- private void setGraphIRI( final DatasetGraph dataset )
- {
+ private void setGraphIRI(final DatasetGraph dataset) {
final Graph g = dataset.getDefaultGraph();
- if (g instanceof SecuredGraph)
- {
+ if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
graphIRI = sg.getModelNode();
this.securityEvaluator = sg.getSecurityEvaluator();
- }
- else
- {
- graphIRI = NodeFactory.createURI( "urn:x-arq:DefaultGraph");
+ } else {
+ graphIRI = NodeFactory.createURI("urn:x-arq:DefaultGraph");
this.securityEvaluator = new SecurityEvaluator() {
@Override
- public boolean evaluate( final Object principal, final Action action,
- final Node graphIRI )
- {
+ public boolean evaluate(final Object principal,
+ final Action action, final Node graphIRI) {
return true;
}
@Override
- public boolean evaluate( final Object principal, final Action action,
- final Node graphIRI, final Triple triple )
- {
+ public boolean evaluate(final Object principal,
+ final Action action, final Node graphIRI,
+ final Triple triple) {
return true;
}
@Override
- public boolean evaluate( final Object principal, final Set<Action> action,
- final Node graphIRI )
- {
+ public boolean evaluate(final Object principal,
+ final Set<Action> action, final Node graphIRI) {
return true;
}
@Override
- public boolean evaluate( final Object principal, final Set<Action> action,
- final Node graphIRI, final Triple triple )
- {
+ public boolean evaluate(final Object principal,
+ final Set<Action> action, final Node graphIRI,
+ final Triple triple) {
return true;
}
@Override
- public boolean evaluateAny( final Object principal, final Set<Action> action,
- final Node graphIRI )
- {
+ public boolean evaluateAny(final Object principal,
+ final Set<Action> action, final Node graphIRI) {
return true;
}
@Override
- public boolean evaluateAny( final Object principal, final Set<Action> action,
- final Node graphIRI, final Triple triple )
- {
+ public boolean evaluateAny(final Object principal,
+ final Set<Action> action, final Node graphIRI,
+ final Triple triple) {
return true;
}
@Override
- public boolean evaluateUpdate( final Object principal, final Node graphIRI,
- final Triple from, final Triple to )
- {
+ public boolean evaluateUpdate(final Object principal,
+ final Node graphIRI, final Triple from, final Triple to) {
return true;
}
@Override
- public Principal getPrincipal()
- {
+ public Principal getPrincipal() {
return null;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java
index d47a246..cdd40ed 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/OpRewriter.java
@@ -20,17 +20,18 @@ package org.apache.jena.permissions.query.rewriter;
import java.util.ArrayList;
import java.util.List;
-import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.ReadDeniedException;
-import org.apache.jena.sparql.algebra.Op ;
-import org.apache.jena.sparql.algebra.OpVisitor ;
-import org.apache.jena.sparql.algebra.op.* ;
-import org.apache.jena.sparql.core.BasicPattern ;
+import org.apache.jena.sparql.algebra.Op;
+import org.apache.jena.sparql.algebra.OpVisitor;
+import org.apache.jena.sparql.algebra.op.*;
+import org.apache.jena.sparql.core.BasicPattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,8 +42,7 @@ import org.slf4j.LoggerFactory;
* This implementation inserts security evaluator checks where necessary.
* </p>
*/
-public class OpRewriter implements OpVisitor
-{
+public class OpRewriter implements OpVisitor {
private static Logger LOG = LoggerFactory.getLogger(OpRewriter.class);
private OpSequence result;
private final Node graphIRI;
@@ -53,12 +53,14 @@ public class OpRewriter implements OpVisitor
/**
* Constructor
- * @param securityEvaluator The security evaluator to use
- * @param graphIRI The IRI for the default graph.
+ *
+ * @param securityEvaluator
+ * The security evaluator to use
+ * @param graphIRI
+ * The IRI for the default graph.
*/
- public OpRewriter( final SecurityEvaluator securityEvaluator,
- final Node graphIRI )
- {
+ public OpRewriter(final SecurityEvaluator securityEvaluator,
+ final Node graphIRI) {
this.securityEvaluator = securityEvaluator;
this.graphIRI = graphIRI;
this.silentFail = false;
@@ -67,40 +69,41 @@ public class OpRewriter implements OpVisitor
/**
* Constructor
- * @param securityEvaluator The security evaluator to use
- * @param graphIRI The IRI for the default graph.
+ *
+ * @param securityEvaluator
+ * The security evaluator to use
+ * @param graphIRI
+ * The IRI for the default graph.
*/
- public OpRewriter( final SecurityEvaluator securityEvaluator,
- final String graphIRI )
- {
- this(securityEvaluator, NodeFactory.createURI( graphIRI));
+ public OpRewriter(final SecurityEvaluator securityEvaluator,
+ final String graphIRI) {
+ this(securityEvaluator, NodeFactory.createURI(graphIRI));
}
/**
* Add the operation to the result.
- * @param op the operation to add.
+ *
+ * @param op
+ * the operation to add.
*/
- private void addOp( final Op op )
- {
+ private void addOp(final Op op) {
result.add(op);
}
/**
* Get the result of the rewrite.
+ *
* @return the resulting operator
*/
- public Op getResult()
- {
- if (result.size() == 0)
- {
+ public Op getResult() {
+ if (result.size() == 0) {
return OpNull.create();
}
- if (result.size() == 1)
- {
+ if (result.size() == 1) {
return result.get(0);
}
return result;
-
+
}
/**
@@ -108,14 +111,14 @@ public class OpRewriter implements OpVisitor
*
* Registers n as a variable if it is one.
*
- * @param n the node to check
- * @param variables the list of variable nodes
+ * @param n
+ * the node to check
+ * @param variables
+ * the list of variable nodes
* @Return n for chaining.
*/
- private Node registerVariables( final Node n, final List<Node> variables )
- {
- if (n.isVariable() && !variables.contains(n))
- {
+ private Node registerVariables(final Node n, final List<Node> variables) {
+ if (n.isVariable() && !variables.contains(n)) {
variables.add(n);
}
return n;
@@ -123,23 +126,24 @@ public class OpRewriter implements OpVisitor
/**
* Reset the rewriter to the initial state.
+ *
* @return this rewriter for chaining.
*/
- public OpRewriter reset()
- {
+ public OpRewriter reset() {
result = OpSequence.create();
return this;
}
/**
* Register all the variables in the triple.
- * @param t the triple to register.
- * @param variables The list of variables.
+ *
+ * @param t
+ * the triple to register.
+ * @param variables
+ * The list of variables.
* @return t for chaining
*/
- private Triple registerBGPTriple( final Triple t,
- final List<Node> variables )
- {
+ private Triple registerBGPTriple(final Triple t, final List<Node> variables) {
registerVariables(t.getSubject(), variables);
registerVariables(t.getPredicate(), variables);
registerVariables(t.getObject(), variables);
@@ -152,23 +156,21 @@ public class OpRewriter implements OpVisitor
* @param op1
* @return the rewritten op.
*/
- private Op rewriteOp1( final Op1 op1 )
- {
+ private Op rewriteOp1(final Op1 op1) {
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
op1.getSubOp().visit(rewriter);
return rewriter.getResult();
}
/**
- * rewrites the left and right parts of the op2 the left part is
- * returned the right part is placed in the rewriter
+ * rewrites the left and right parts of the op2 the left part is returned
+ * the right part is placed in the rewriter
*
* @param op2
* @param rewriter
* @return the rewritten op.
*/
- private Op rewriteOp2( final Op2 op2, final OpRewriter rewriter )
- {
+ private Op rewriteOp2(final Op2 op2, final OpRewriter rewriter) {
op2.getLeft().visit(rewriter.reset());
final Op left = rewriter.getResult();
op2.getRight().visit(rewriter.reset());
@@ -182,11 +184,9 @@ public class OpRewriter implements OpVisitor
* @param dest
* @return the rewritten op.
*/
- private OpN rewriteOpN( final OpN source, final OpN dest )
- {
+ private OpN rewriteOpN(final OpN source, final OpN dest) {
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
- for (final Op o : source.getElements())
- {
+ for (final Op o : source.getElements()) {
o.visit(rewriter.reset());
dest.add(rewriter.getResult());
}
@@ -197,50 +197,48 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of assign.
*/
@Override
- public void visit( final OpAssign opAssign )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpAssign"); }
+ public void visit(final OpAssign opAssign) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpAssign");
+ }
addOp(OpAssign.assign(rewriteOp1(opAssign), opAssign.getVarExprList()));
}
@Override
- public void visit( final OpBGP opBGP )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpBGP"); }
+ public void visit(final OpBGP opBGP) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpBGP");
+ }
Object principal = securityEvaluator.getPrincipal();
- if (!securityEvaluator.evaluate(principal, Action.Read, graphIRI))
- {
- if (silentFail)
- {
+ if (!securityEvaluator.evaluate(principal, Action.Read, graphIRI)) {
+ if (silentFail) {
return;
- }
- else
- {
- throw new ReadDeniedException(SecuredItem.Util.modelPermissionMsg(graphIRI));
+ } else {
+ throw new ReadDeniedException(
+ SecuredItem.Util.modelPermissionMsg(graphIRI));
}
}
// if the user can read any triple just add the opBGP
- if (securityEvaluator.evaluate(principal, Action.Read, graphIRI, Triple.ANY))
- {
+ if (securityEvaluator.evaluate(principal, Action.Read, graphIRI,
+ Triple.ANY)) {
addOp(opBGP);
- }
- else
- {
+ } else {
// add security filtering to the resulting triples
final List<Triple> newBGP = new ArrayList<Triple>();
final List<Node> variables = new ArrayList<Node>();
// register all variables
- for (final Triple t : opBGP.getPattern().getList())
- {
+ for (final Triple t : opBGP.getPattern().getList()) {
newBGP.add(registerBGPTriple(t, variables));
}
// create the security function.
final SecuredFunction secFunc = new SecuredFunction(graphIRI,
securityEvaluator, variables, newBGP);
// create the filter
- Op filter = OpFilter.filter(secFunc, new OpBGP(BasicPattern.wrap(newBGP)));
- // add the filter
+ Op filter = OpFilter.filter(secFunc,
+ new OpBGP(BasicPattern.wrap(newBGP)));
+ // add the filter
addOp(filter);
}
}
@@ -249,9 +247,10 @@ public class OpRewriter implements OpVisitor
* Rewrite left and right
*/
@Override
- public void visit( final OpConditional opCondition )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpConditional"); }
+ public void visit(final OpConditional opCondition) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpConditional");
+ }
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
addOp(new OpConditional(rewriteOp2(opCondition, rewriter),
rewriter.getResult()));
@@ -261,9 +260,10 @@ public class OpRewriter implements OpVisitor
* returns the dsNames
*/
@Override
- public void visit( final OpDatasetNames dsNames )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpDatasetName"); }
+ public void visit(final OpDatasetNames dsNames) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpDatasetName");
+ }
addOp(dsNames);
}
@@ -271,9 +271,10 @@ public class OpRewriter implements OpVisitor
* Rewrite left and right
*/
@Override
- public void visit( final OpDiff opDiff )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpDiff"); }
+ public void visit(final OpDiff opDiff) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpDiff");
+ }
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
addOp(OpDiff.create(rewriteOp2(opDiff, rewriter), rewriter.getResult()));
}
@@ -282,9 +283,10 @@ public class OpRewriter implements OpVisitor
* Rewrite sequence elements
*/
@Override
- public void visit( final OpDisjunction opDisjunction )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpDisjunction"); }
+ public void visit(final OpDisjunction opDisjunction) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpDisjunction");
+ }
addOp(rewriteOpN(opDisjunction, OpDisjunction.create()));
}
@@ -292,9 +294,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of distinct
*/
@Override
- public void visit( final OpDistinct opDistinct )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpDistinct"); }
+ public void visit(final OpDistinct opDistinct) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpDistinct");
+ }
addOp(new OpDistinct(rewriteOp1(opDistinct)));
}
@@ -302,9 +305,10 @@ public class OpRewriter implements OpVisitor
* Returns the Ext
*/
@Override
- public void visit( final OpExt opExt )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpExt"); }
+ public void visit(final OpExt opExt) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpExt");
+ }
addOp(opExt);
}
@@ -312,9 +316,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of extend.
*/
@Override
- public void visit( final OpExtend opExtend )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpExtend"); }
+ public void visit(final OpExtend opExtend) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpExtend");
+ }
addOp(OpExtend.extend(rewriteOp1(opExtend), opExtend.getVarExprList()));
}
@@ -322,9 +327,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of filter.
*/
@Override
- public void visit( final OpFilter opFilter )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpFilter"); }
+ public void visit(final OpFilter opFilter) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpFilter");
+ }
addOp(OpFilter.filter(opFilter.getExprs(), rewriteOp1(opFilter)));
}
@@ -332,10 +338,12 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of graph.
*/
@Override
- public void visit( final OpGraph opGraph )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpGraph"); }
- final OpRewriter rewriter = new OpRewriter(securityEvaluator, opGraph.getNode());
+ public void visit(final OpGraph opGraph) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpGraph");
+ }
+ final OpRewriter rewriter = new OpRewriter(securityEvaluator,
+ opGraph.getNode());
opGraph.getSubOp().visit(rewriter);
addOp(new OpGraph(opGraph.getNode(), rewriter.getResult()));
}
@@ -344,9 +352,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of group.
*/
@Override
- public void visit( final OpGroup opGroup )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpGroup"); }
+ public void visit(final OpGroup opGroup) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpGroup");
+ }
addOp(new OpGroup(rewriteOp1(opGroup), opGroup.getGroupVars(),
opGroup.getAggregators()));
}
@@ -355,9 +364,10 @@ public class OpRewriter implements OpVisitor
* Parses the joins and recursively calls the left and right parts
*/
@Override
- public void visit( final OpJoin opJoin )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpJoin"); }
+ public void visit(final OpJoin opJoin) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpJoin");
+ }
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
addOp(OpJoin.create(rewriteOp2(opJoin, rewriter), rewriter.getResult()));
}
@@ -366,9 +376,10 @@ public class OpRewriter implements OpVisitor
* returns the label
*/
@Override
- public void visit( final OpLabel opLabel )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpLabel"); }
+ public void visit(final OpLabel opLabel) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpLabel");
+ }
addOp(opLabel);
}
@@ -376,9 +387,10 @@ public class OpRewriter implements OpVisitor
* Parses the joins and recursively calls the left and right parts
*/
@Override
- public void visit( final OpLeftJoin opLeftJoin )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpLeftJoin"); }
+ public void visit(final OpLeftJoin opLeftJoin) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpLeftJoin");
+ }
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
addOp(OpLeftJoin.create(rewriteOp2(opLeftJoin, rewriter),
rewriter.getResult(), opLeftJoin.getExprs()));
@@ -388,9 +400,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of list.
*/
@Override
- public void visit( final OpList opList )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpList"); }
+ public void visit(final OpList opList) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpList");
+ }
addOp(new OpList(rewriteOp1(opList)));
}
@@ -398,9 +411,10 @@ public class OpRewriter implements OpVisitor
* Rewrite left and right
*/
@Override
- public void visit( final OpMinus opMinus )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpMinus"); }
+ public void visit(final OpMinus opMinus) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpMinus");
+ }
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
addOp(OpMinus.create(rewriteOp2(opMinus, rewriter),
rewriter.getResult()));
@@ -410,9 +424,10 @@ public class OpRewriter implements OpVisitor
* returns the null
*/
@Override
- public void visit( final OpNull opNull )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpNull"); }
+ public void visit(final OpNull opNull) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpNull");
+ }
addOp(opNull);
}
@@ -420,9 +435,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of order.
*/
@Override
- public void visit( final OpOrder opOrder )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpOrder"); }
+ public void visit(final OpOrder opOrder) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpOrder");
+ }
addOp(new OpOrder(rewriteOp1(opOrder), opOrder.getConditions()));
}
@@ -430,9 +446,10 @@ public class OpRewriter implements OpVisitor
* Returns the path
*/
@Override
- public void visit( final OpPath opPath )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpPath"); }
+ public void visit(final OpPath opPath) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpPath");
+ }
addOp(opPath);
}
@@ -440,16 +457,14 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of proc.
*/
@Override
- public void visit( final OpProcedure opProc )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpProc"); }
- if (opProc.getProcId() != null)
- {
+ public void visit(final OpProcedure opProc) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpProc");
+ }
+ if (opProc.getProcId() != null) {
addOp(new OpProcedure(opProc.getProcId(), opProc.getArgs(),
rewriteOp1(opProc)));
- }
- else
- {
+ } else {
addOp(new OpProcedure(opProc.getURI(), opProc.getArgs(),
rewriteOp1(opProc)));
}
@@ -459,9 +474,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of project.
*/
@Override
- public void visit( final OpProject opProject )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpProject"); }
+ public void visit(final OpProject opProject) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpProject");
+ }
addOp(new OpProject(rewriteOp1(opProject), opProject.getVars()));
}
@@ -469,9 +485,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of propFunc.
*/
@Override
- public void visit( final OpPropFunc opPropFunc )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpPropFunc"); }
+ public void visit(final OpPropFunc opPropFunc) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpPropFunc");
+ }
addOp(new OpPropFunc(opPropFunc.getProperty(),
opPropFunc.getSubjectArgs(), opPropFunc.getObjectArgs(),
rewriteOp1(opPropFunc)));
@@ -481,9 +498,10 @@ public class OpRewriter implements OpVisitor
* Returns the quad
*/
@Override
- public void visit( final OpQuad opQuad )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpQuad"); }
+ public void visit(final OpQuad opQuad) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpQuad");
+ }
addOp(opQuad);
}
@@ -491,9 +509,10 @@ public class OpRewriter implements OpVisitor
* Returns the quadpattern
*/
@Override
- public void visit( final OpQuadPattern quadPattern )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpQuadPattern"); }
+ public void visit(final OpQuadPattern quadPattern) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpQuadPattern");
+ }
addOp(quadPattern);
}
@@ -501,9 +520,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of reduced.
*/
@Override
- public void visit( final OpReduced opReduced )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpReduced"); }
+ public void visit(final OpReduced opReduced) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpReduced");
+ }
addOp(OpReduced.create(rewriteOp1(opReduced)));
}
@@ -511,9 +531,10 @@ public class OpRewriter implements OpVisitor
* Rewrite sequence elements
*/
@Override
- public void visit( final OpSequence opSequence )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpSequence"); }
+ public void visit(final OpSequence opSequence) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpSequence");
+ }
addOp(rewriteOpN(opSequence, OpSequence.create()));
}
@@ -521,9 +542,10 @@ public class OpRewriter implements OpVisitor
* returns the service
*/
@Override
- public void visit( final OpService opService )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting opService"); }
+ public void visit(final OpService opService) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting opService");
+ }
addOp(opService);
}
@@ -533,9 +555,10 @@ public class OpRewriter implements OpVisitor
* This also handles the limit case
*/
@Override
- public void visit( final OpSlice opSlice )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpSlice"); }
+ public void visit(final OpSlice opSlice) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpSlice");
+ }
addOp(opSlice);
}
@@ -543,9 +566,10 @@ public class OpRewriter implements OpVisitor
* returns the table
*/
@Override
- public void visit( final OpTable opTable )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpTable"); }
+ public void visit(final OpTable opTable) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpTable");
+ }
addOp(opTable);
}
@@ -553,9 +577,10 @@ public class OpRewriter implements OpVisitor
* rewrites the subop of top.
*/
@Override
- public void visit( final OpTopN opTop )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpTop"); }
+ public void visit(final OpTopN opTop) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpTop");
+ }
addOp(new OpTopN(rewriteOp1(opTop), opTop.getLimit(),
opTop.getConditions()));
}
@@ -564,9 +589,10 @@ public class OpRewriter implements OpVisitor
* Converts to BGP
*/
@Override
- public void visit( final OpTriple opTriple )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpTriple"); }
+ public void visit(final OpTriple opTriple) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpTriple");
+ }
visit(opTriple.asBGP());
}
@@ -574,9 +600,10 @@ public class OpRewriter implements OpVisitor
* Rewrite left and right
*/
@Override
- public void visit( final OpUnion opUnion )
- {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpUnion"); }
+ public void visit(final OpUnion opUnion) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpUnion");
+ }
final OpRewriter rewriter = new OpRewriter(securityEvaluator, graphIRI);
addOp(OpUnion.create(rewriteOp2(opUnion, rewriter),
rewriter.getResult()));
@@ -584,7 +611,9 @@ public class OpRewriter implements OpVisitor
@Override
public void visit(OpQuadBlock quadBlock) {
- if (LOG.isDebugEnabled()) { LOG.debug( "Starting visiting OpQuadBlock"); }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Starting visiting OpQuadBlock");
+ }
addOp(quadBlock);
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/SecuredFunction.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/SecuredFunction.java b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/SecuredFunction.java
index fa2819f..79ac8c4 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/SecuredFunction.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/query/rewriter/SecuredFunction.java
@@ -17,119 +17,101 @@
*/
package org.apache.jena.permissions.query.rewriter;
-import java.util.List ;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.permissions.SecurityEvaluator ;
-import org.apache.jena.permissions.SecurityEvaluator.Action ;
-import org.apache.jena.sparql.core.Var ;
-import org.apache.jena.sparql.engine.binding.Binding ;
-import org.apache.jena.sparql.expr.* ;
-import org.apache.jena.sparql.function.FunctionEnv ;
-import org.apache.jena.sparql.graph.NodeTransform ;
-
-public class SecuredFunction extends ExprFunctionN
-{
+import java.util.List;
+
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.permissions.SecurityEvaluator;
+import org.apache.jena.permissions.SecurityEvaluator.Action;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.sparql.core.Var;
+import org.apache.jena.sparql.engine.binding.Binding;
+import org.apache.jena.sparql.expr.*;
+import org.apache.jena.sparql.function.FunctionEnv;
+import org.apache.jena.sparql.graph.NodeTransform;
+
+public class SecuredFunction extends ExprFunctionN {
private final SecurityEvaluator securityEvaluator;
private final List<Node> variables;
private final List<Triple> bgp;
private final Node graphIRI;
-
- private static ExprList createArgs( List<Node> variables )
- {
+
+ private static ExprList createArgs(List<Node> variables) {
ExprList retval = new ExprList();
- for (Node n : variables )
- {
- retval.add( new ExprVar( n ));
+ for (Node n : variables) {
+ retval.add(new ExprVar(n));
}
return retval;
}
- public SecuredFunction( final Node graphIRI,
+ public SecuredFunction(final Node graphIRI,
final SecurityEvaluator securityEvaluator,
- final List<Node> variables, final List<Triple> bgp )
- {
- super(String.format("<java:%s>", SecuredFunction.class.getName() ), createArgs( variables));
- //,
- // new ElementTriplesBlock( BasicPattern.wrap(bgp) ),
- // new OpBGP( BasicPattern.wrap(bgp) )
- // );
+ final List<Node> variables, final List<Triple> bgp) {
+ super(String.format("<java:%s>", SecuredFunction.class.getName()),
+ createArgs(variables));
this.securityEvaluator = securityEvaluator;
this.variables = variables;
this.bgp = bgp;
this.graphIRI = graphIRI;
}
-
- private boolean checkAccess( Binding values )
- {
+
+ private boolean checkAccess(Binding values)
+ throws AuthenticationRequiredException {
Object principal = securityEvaluator.getPrincipal();
- for (final Triple t : bgp)
- {
+ for (final Triple t : bgp) {
final Triple secT = resolveTriple(t, values);
- if (!securityEvaluator.evaluate(principal, Action.Read, graphIRI, secT))
- {
+ if (!securityEvaluator.evaluate(principal, Action.Read, graphIRI,
+ secT)) {
return false;
}
}
return true;
}
- private Triple resolveTriple( final Triple t, final Binding values )
- {
+ private Triple resolveTriple(final Triple t, final Binding values) {
int idx = variables.indexOf(t.getSubject());
- final Node s = idx ==-1 ? t.getSubject()
- : values.get(Var.alloc( variables.get(idx)));
+ final Node s = idx == -1 ? t.getSubject() : values.get(Var
+ .alloc(variables.get(idx)));
idx = variables.indexOf(t.getPredicate());
- final Node p = idx == -1 ? t
- .getPredicate()
- : values.get(Var.alloc( variables.get(idx)));
+ final Node p = idx == -1 ? t.getPredicate() : values.get(Var
+ .alloc(variables.get(idx)));
idx = variables.indexOf(t.getObject());
- final Node o = idx == -1 ? t.getObject()
- : values.get(Var.alloc( variables.get(idx)));
+ final Node o = idx == -1 ? t.getObject() : values.get(Var
+ .alloc(variables.get(idx)));
return new Triple(s, p, o);
}
-
@Override
- public Expr copySubstitute( Binding binding )
- {
+ public Expr copySubstitute(Binding binding) {
return this;
}
@Override
- public Expr applyNodeTransform( NodeTransform transform )
- {
+ public Expr applyNodeTransform(NodeTransform transform) {
return this;
}
@Override
- public void visit( ExprVisitor visitor )
- {
- visitor.visit( this );
+ public void visit(ExprVisitor visitor) {
+ visitor.visit(this);
}
@Override
- public NodeValue eval( List<NodeValue> args )
- {
+ public NodeValue eval(List<NodeValue> args) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Expr copy( ExprList newArgs )
- {
+ public Expr copy(ExprList newArgs) {
return this;
}
@Override
- protected NodeValue evalSpecial( Binding binding, FunctionEnv env )
- {
- return NodeValue.booleanReturn( checkAccess( binding ));
+ protected NodeValue evalSpecial(Binding binding, FunctionEnv env) {
+ return NodeValue.booleanReturn(checkAccess(binding));
}
-
-
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermStatementFilter.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermStatementFilter.java b/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermStatementFilter.java
index b304fc7..aed4269 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermStatementFilter.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermStatementFilter.java
@@ -25,15 +25,14 @@ import org.apache.jena.graph.Node;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
-import org.apache.jena.rdf.model.Statement ;
+import org.apache.jena.rdf.model.Statement;
+import org.apache.jena.shared.AuthenticationRequiredException;
/**
- * A filter for to filter ExtendedIterators on Statements.
- * This filter removes any triple that the user can not perform all
- * the actions on.
+ * A filter for to filter ExtendedIterators on Statements. This filter removes
+ * any triple that the user can not perform all the actions on.
*/
-public class PermStatementFilter implements Predicate<Statement>
-{
+public class PermStatementFilter implements Predicate<Statement> {
private final SecurityEvaluator evaluator;
private final Node modelNode;
private final Set<Action> actions;
@@ -48,9 +47,8 @@ public class PermStatementFilter implements Predicate<Statement>
* @param securedItem
* The secured item that secures this iterator.
*/
- public PermStatementFilter( final Action action,
- final SecuredItem securedItem )
- {
+ public PermStatementFilter(final Action action,
+ final SecuredItem securedItem) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(new Action[] { action });
this.evaluator = securedItem.getSecurityEvaluator();
@@ -68,9 +66,8 @@ public class PermStatementFilter implements Predicate<Statement>
* @param evaluator
* The security evaluator to evaluate the security queries.
*/
- public PermStatementFilter( final Action action,
- final SecuredItem securedItem, final SecurityEvaluator evaluator )
- {
+ public PermStatementFilter(final Action action,
+ final SecuredItem securedItem, final SecurityEvaluator evaluator) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(new Action[] { action });
this.evaluator = evaluator;
@@ -86,9 +83,8 @@ public class PermStatementFilter implements Predicate<Statement>
* @param securedItem
* The secured item that secures this iterator.
*/
- public PermStatementFilter( final Action[] actions,
- final SecuredItem securedItem )
- {
+ public PermStatementFilter(final Action[] actions,
+ final SecuredItem securedItem) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = securedItem.getSecurityEvaluator();
@@ -106,9 +102,8 @@ public class PermStatementFilter implements Predicate<Statement>
* @param evaluator
* The security evaluator to evaluate the security queries.
*/
- public PermStatementFilter( final Action[] actions,
- final SecuredItem securedItem, final SecurityEvaluator evaluator )
- {
+ public PermStatementFilter(final Action[] actions,
+ final SecuredItem securedItem, final SecurityEvaluator evaluator) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = evaluator;
@@ -124,9 +119,8 @@ public class PermStatementFilter implements Predicate<Statement>
* @param securedItem
* The secured item that secures this iterator.
*/
- public PermStatementFilter( final Collection<Action> actions,
- final SecuredItem securedItem )
- {
+ public PermStatementFilter(final Collection<Action> actions,
+ final SecuredItem securedItem) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = securedItem.getSecurityEvaluator();
@@ -144,9 +138,8 @@ public class PermStatementFilter implements Predicate<Statement>
* @param evaluator
* The security evaluator to evaluate the security queries.
*/
- public PermStatementFilter( final Collection<Action> actions,
- final SecuredItem securedItem, final SecurityEvaluator evaluator )
- {
+ public PermStatementFilter(final Collection<Action> actions,
+ final SecuredItem securedItem, final SecurityEvaluator evaluator) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = evaluator;
@@ -154,9 +147,10 @@ public class PermStatementFilter implements Predicate<Statement>
}
@Override
- public boolean test( final Statement s )
- {
- return evaluator.evaluateAny(principal, actions, modelNode, s.asTriple());
+ public boolean test(final Statement s)
+ throws AuthenticationRequiredException {
+ return evaluator.evaluateAny(principal, actions, modelNode,
+ s.asTriple());
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermTripleFilter.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermTripleFilter.java b/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermTripleFilter.java
index 48d7d0e..bc0d2ad 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermTripleFilter.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/utils/PermTripleFilter.java
@@ -22,18 +22,17 @@ import java.util.Set;
import java.util.function.Predicate;
import org.apache.jena.graph.Node;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
+import org.apache.jena.shared.AuthenticationRequiredException;
/**
- * A filter for to filter ExtendedIterators on Triples.
- * This filter removes any triple that the user can not perform all
- * the actions on.
+ * A filter for to filter ExtendedIterators on Triples. This filter removes any
+ * triple that the user can not perform all the actions on.
*/
-public class PermTripleFilter implements Predicate<Triple>
-{
+public class PermTripleFilter implements Predicate<Triple> {
private final SecurityEvaluator evaluator;
private final Node modelNode;
private final Set<Action> actions;
@@ -48,8 +47,7 @@ public class PermTripleFilter implements Predicate<Triple>
* @param securedItem
* The secured item that secures this iterator.
*/
- public PermTripleFilter( final Action action, final SecuredItem securedItem )
- {
+ public PermTripleFilter(final Action action, final SecuredItem securedItem) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(new Action[] { action });
this.evaluator = securedItem.getSecurityEvaluator();
@@ -67,9 +65,8 @@ public class PermTripleFilter implements Predicate<Triple>
* @param evaluator
* The security evaluator to evaluate the security queries.
*/
- public PermTripleFilter( final Action action,
- final SecuredItem securedItem, final SecurityEvaluator evaluator )
- {
+ public PermTripleFilter(final Action action, final SecuredItem securedItem,
+ final SecurityEvaluator evaluator) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(new Action[] { action });
this.evaluator = evaluator;
@@ -85,9 +82,8 @@ public class PermTripleFilter implements Predicate<Triple>
* @param securedItem
* The secured item that secures this iterator.
*/
- public PermTripleFilter( final Action[] actions,
- final SecuredItem securedItem )
- {
+ public PermTripleFilter(final Action[] actions,
+ final SecuredItem securedItem) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = securedItem.getSecurityEvaluator();
@@ -105,9 +101,8 @@ public class PermTripleFilter implements Predicate<Triple>
* @param evaluator
* The security evaluator to evaluate the security queries.
*/
- public PermTripleFilter( final Action[] actions,
- final SecuredItem securedItem, final SecurityEvaluator evaluator )
- {
+ public PermTripleFilter(final Action[] actions,
+ final SecuredItem securedItem, final SecurityEvaluator evaluator) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = evaluator;
@@ -123,9 +118,8 @@ public class PermTripleFilter implements Predicate<Triple>
* @param securedItem
* The secured item that secures this iterator.
*/
- public PermTripleFilter( final Collection<Action> actions,
- final SecuredItem securedItem )
- {
+ public PermTripleFilter(final Collection<Action> actions,
+ final SecuredItem securedItem) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = securedItem.getSecurityEvaluator();
@@ -143,9 +137,8 @@ public class PermTripleFilter implements Predicate<Triple>
* @param evaluator
* The security evaluator to evaluate the security queries.
*/
- public PermTripleFilter( final Collection<Action> actions,
- final SecuredItem securedItem, final SecurityEvaluator evaluator )
- {
+ public PermTripleFilter(final Collection<Action> actions,
+ final SecuredItem securedItem, final SecurityEvaluator evaluator) {
this.modelNode = securedItem.getModelNode();
this.actions = SecurityEvaluator.Util.asSet(actions);
this.evaluator = evaluator;
@@ -153,9 +146,9 @@ public class PermTripleFilter implements Predicate<Triple>
}
@Override
- public boolean test( final Triple triple )
- {
- return evaluator.evaluateAny(principal, actions, modelNode,triple);
+ public boolean test(final Triple triple)
+ throws AuthenticationRequiredException {
+ return evaluator.evaluateAny(principal, actions, modelNode, triple);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/utils/RDFListSecFilter.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/utils/RDFListSecFilter.java b/jena-permissions/src/main/java/org/apache/jena/permissions/utils/RDFListSecFilter.java
index b66a48c..01888ea 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/utils/RDFListSecFilter.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/utils/RDFListSecFilter.java
@@ -23,34 +23,31 @@ import java.util.function.Predicate;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
-import org.apache.jena.rdf.model.RDFList ;
-import org.apache.jena.rdf.model.Statement ;
-import org.apache.jena.vocabulary.RDF ;
+import org.apache.jena.rdf.model.RDFList;
+import org.apache.jena.rdf.model.Statement;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.vocabulary.RDF;
-public class RDFListSecFilter<T extends RDFList> implements Predicate<T>
-{
+public class RDFListSecFilter<T extends RDFList> implements Predicate<T> {
private final SecuredItem securedItem;
private final Set<Action> perms;
private final Object principal;
- public RDFListSecFilter( final SecuredItem securedItem, final Action perm )
- {
+ public RDFListSecFilter(final SecuredItem securedItem, final Action perm) {
this(securedItem, SecurityEvaluator.Util.asSet(new Action[] { perm }));
}
- public RDFListSecFilter( final SecuredItem securedItem,
- final Set<Action> perms )
- {
+ public RDFListSecFilter(final SecuredItem securedItem,
+ final Set<Action> perms) {
this.securedItem = securedItem;
this.perms = perms;
this.principal = securedItem.getSecurityEvaluator().getPrincipal();
}
@Override
- public boolean test( final RDFList o )
- {
+ public boolean test(final RDFList o) throws AuthenticationRequiredException {
final Statement s = o.getRequiredProperty(RDF.first);
return securedItem.getSecurityEvaluator().evaluate(principal, perms,
- securedItem.getModelNode(), s.asTriple());
+ securedItem.getModelNode(), s.asTriple());
}
}
[11/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
Added throw exception documentation
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/2c0454c6
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/2c0454c6
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/2c0454c6
Branch: refs/heads/master
Commit: 2c0454c63f71b4bda5c55e448f8cdacadb6b9008
Parents: b44125a
Author: Claude Warren <cl...@apache.org>
Authored: Sat Jul 25 21:29:28 2015 +0100
Committer: Claude Warren <cl...@apache.org>
Committed: Sat Jul 25 21:29:28 2015 +0100
----------------------------------------------------------------------
.../permissions/example/ExampleEvaluator.java | 5 +
.../example/ShiroExampleEvaluator.java | 3 +-
.../apache/jena/permissions/SecuredItem.java | 142 +-
.../jena/permissions/SecurityEvaluator.java | 114 +-
.../jena/permissions/graph/SecuredGraph.java | 102 +-
.../graph/SecuredGraphEventManager.java | 233 ++--
.../permissions/graph/SecuredPrefixMapping.java | 81 +-
.../graph/impl/SecuredGraphImpl.java | 184 ++-
.../graph/impl/SecuredPrefixMappingImpl.java | 89 +-
.../impl/CachedSecurityEvaluator.java | 23 +-
.../jena/permissions/impl/SecuredItemImpl.java | 779 +++++------
.../jena/permissions/model/SecuredAlt.java | 163 ++-
.../permissions/model/SecuredContainer.java | 133 +-
.../jena/permissions/model/SecuredLiteral.java | 93 +-
.../jena/permissions/model/SecuredModel.java | 1243 ++++++++++++------
.../jena/permissions/model/SecuredProperty.java | 11 +-
.../jena/permissions/model/SecuredRDFList.java | 236 +++-
.../jena/permissions/model/SecuredRDFNode.java | 26 +-
.../model/SecuredReifiedStatement.java | 12 +-
.../jena/permissions/model/SecuredResource.java | 214 ++-
.../jena/permissions/model/SecuredSeq.java | 288 ++--
.../permissions/model/SecuredStatement.java | 166 ++-
.../permissions/model/impl/SecuredAltImpl.java | 207 ++-
.../model/impl/SecuredContainerImpl.java | 438 ++----
.../model/impl/SecuredLiteralImpl.java | 162 ++-
.../model/impl/SecuredModelImpl.java | 610 +++++----
.../model/impl/SecuredPropertyImpl.java | 51 +-
.../model/impl/SecuredRDFListImpl.java | 704 ++++------
.../model/impl/SecuredRDFNodeImpl.java | 211 ++-
.../model/impl/SecuredReifiedStatementImpl.java | 29 +-
.../model/impl/SecuredResourceImpl.java | 570 ++++----
.../permissions/model/impl/SecuredSelector.java | 39 +-
.../permissions/model/impl/SecuredSeqImpl.java | 326 ++---
.../model/impl/SecuredStatementImpl.java | 278 ++--
.../permissions/query/SecuredQueryEngine.java | 95 +-
.../permissions/query/rewriter/OpRewriter.java | 379 +++---
.../query/rewriter/SecuredFunction.java | 104 +-
.../permissions/utils/PermStatementFilter.java | 48 +-
.../permissions/utils/PermTripleFilter.java | 45 +-
.../permissions/utils/RDFListSecFilter.java | 23 +-
.../jena/permissions/graph/TDBGraphTest.java | 3 -
.../permissions/model/SecuredModelTest.java | 6 +-
.../jena/permissions/query/DataSetTest.java | 15 +-
.../jena/permissions/query/QueryEngineTest.java | 9 +-
44 files changed, 4641 insertions(+), 4051 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
index 2c74c4e..a5659e1 100644
--- a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
+++ b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ExampleEvaluator.java
@@ -25,6 +25,7 @@ import org.apache.jena.graph.Node;
import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecurityEvaluator ;
import org.apache.jena.rdf.model.* ;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.vocabulary.RDF ;
/**
@@ -61,6 +62,10 @@ public class ExampleEvaluator implements SecurityEvaluator {
// a message is only available to sender or recipient
if (r.hasProperty( RDF.type, msgType ))
{
+ if (principal == null)
+ {
+ throw new AuthenticationRequiredException();
+ }
return r.hasProperty( pTo, principal.getName() ) ||
r.hasProperty( pFrom, principal.getName());
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
index 4bac59b..3f71957 100644
--- a/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
+++ b/jena-permissions/src/example/java/org/apache/jena/permissions/example/ShiroExampleEvaluator.java
@@ -20,7 +20,6 @@ package org.apache.jena.permissions.example;
import java.util.Set ;
import org.apache.jena.graph.Node;
-import org.apache.jena.graph.NodeFactory ;
import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecurityEvaluator ;
import org.apache.jena.rdf.model.* ;
@@ -81,6 +80,8 @@ public class ShiroExampleEvaluator implements SecurityEvaluator {
Subject subject = (Subject)principalObj;
if (! subject.isAuthenticated())
{
+ // we could throw an AuthenticationRequiredException but
+ // in our case we just return false.
LOG.info( "User not authenticated");
return false;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/SecuredItem.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/SecuredItem.java b/jena-permissions/src/main/java/org/apache/jena/permissions/SecuredItem.java
index 6c4021f..c982c99 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/SecuredItem.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/SecuredItem.java
@@ -20,20 +20,19 @@ package org.apache.jena.permissions;
import org.apache.jena.graph.FrontsTriple;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.Triple;
+import org.apache.jena.shared.AuthenticationRequiredException;
/**
* The secured item interface is mixed into instances of secured objects by the
* proxy. It provides the security context for the security checks as well as
* several useful shorthand methods for common checks.
*/
-public interface SecuredItem
-{
-
+public interface SecuredItem {
+
/**
* Utilities for SecuredItem implementations.
*/
- public static class Util
- {
+ public static class Util {
/**
* Secured items are equivalent if their security evaluators and
* modelIRIs are equal.
@@ -44,48 +43,45 @@ public interface SecuredItem
* A second secured item to check
* @return true if si1 is equivalent to si2.
*/
- public static boolean isEquivalent( final SecuredItem si1,
- final SecuredItem si2 )
- {
+ public static boolean isEquivalent(final SecuredItem si1,
+ final SecuredItem si2) {
return si1.getSecurityEvaluator()
.equals(si2.getSecurityEvaluator())
&& si1.getModelIRI().equals(si2.getModelIRI());
}
-
- public static String modelPermissionMsg( final Node modelURI )
- {
+
+ public static String modelPermissionMsg(final Node modelURI) {
return String.format("Model permissions violation: %s", modelURI);
}
-
- public static String triplePermissionMsg( final Node modelURI )
- {
+
+ public static String triplePermissionMsg(final Node modelURI) {
return String.format("Triple permissions violation: %s", modelURI);
}
}
/**
* @return true if the securedModel allows items to to be created.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canCreate();
+ public boolean canCreate() throws AuthenticationRequiredException;
/**
- * Return true if the triple can be created.
- * If any s,p or o is SecNode.ANY then this method must return false if
- * there
- * are
- * any restrictions where the remaining nodes and held constant and the ANY
- * node
- * is allowed to vary.
+ * Return true if the triple can be created. If any s,p or o is SecNode.ANY
+ * then this method must return false if there are any restrictions where
+ * the remaining nodes and held constant and the ANY node is allowed to
+ * vary.
*
* See canRead(Triple t)
*
* @param t
* The triple to check
* @return true if the triple can be created.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canCreate( Triple t );
+ public boolean canCreate(Triple t) throws AuthenticationRequiredException;
-
/**
* Return true if the fronted triple can be created.
*
@@ -94,31 +90,35 @@ public interface SecuredItem
* @param t
* The fronted triple to check
* @return true if the triple can be created.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canCreate( FrontsTriple t );
-
+ public boolean canCreate(FrontsTriple t)
+ throws AuthenticationRequiredException;
+
/**
* @return true if the securedModel allows items to to be deleted.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canDelete();
+ public boolean canDelete() throws AuthenticationRequiredException;
/**
- * Return true if the triple can be deleted.
- * If any s,p or o is SecNode.ANY then this method must return false if
- * there
- * are
- * any restrictions where the remaining nodes and held constant and the ANY
- * node
- * is allowed to vary.
+ * Return true if the triple can be deleted. If any s,p or o is SecNode.ANY
+ * then this method must return false if there are any restrictions where
+ * the remaining nodes and held constant and the ANY node is allowed to
+ * vary.
*
* See canRead(Triple t)
*
* @param t
* The triple to check
* @return true if the triple can be deleted.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canDelete( Triple t );
-
+ public boolean canDelete(Triple t) throws AuthenticationRequiredException;
+
/**
* Return true if the fronted triple can be deleted.
*
@@ -127,33 +127,37 @@ public interface SecuredItem
* @param t
* The fronted triple to check
* @return true if the triple can be deleted.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canDelete( FrontsTriple t );
+ public boolean canDelete(FrontsTriple t)
+ throws AuthenticationRequiredException;
/**
* @return true if the securedModel allows items to to be read.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canRead();
+ public boolean canRead() throws AuthenticationRequiredException;
/**
- * Return true if the triple can be read.
- * If any s,p or o is SecNode.ANY then this method must return false if
- * there
- * are
- * any restrictions where the remaining nodes and held constant and the ANY
- * node
- * is allowed to vary.
+ * Return true if the triple can be read. If any s,p or o is SecNode.ANY
+ * then this method must return false if there are any restrictions where
+ * the remaining nodes and held constant and the ANY node is allowed to
+ * vary.
*
- * (S, P, O) check if S,P,O can be read.
- * (S, P, ANY) check if there are any S,P,x restrictions.
- * (S, ANY, P) check if there are any S,x,P restrictions.
- * (ANY, ANY, ANY) check if there are any restricitons on reading.
+ * (S, P, O) check if S,P,O can be read. (S, P, ANY) check if there are any
+ * S,P,x restrictions. (S, ANY, P) check if there are any S,x,P
+ * restrictions. (ANY, ANY, ANY) check if there are any restricitons on
+ * reading.
*
* @param t
* The triple to check
* @return true if the triple can be read.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canRead( Triple t );
+ public boolean canRead(Triple t) throws AuthenticationRequiredException;
/**
* Return true if the fronted triple can be read.
@@ -161,22 +165,24 @@ public interface SecuredItem
* @param t
* The frontedtriple to check
* @return true if the triple can be read.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canRead( FrontsTriple t );
-
+ public boolean canRead(FrontsTriple t)
+ throws AuthenticationRequiredException;
+
/**
* @return true if the securedModel allows items to to be updated.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canUpdate();
+ public boolean canUpdate() throws AuthenticationRequiredException;
/**
- * Return true if the triple can be updated.
- * If any s,p or o is SecNode.ANY then this method must return false if
- * there
- * are
- * any restrictions where the remaining nodes and held constant and the ANY
- * node
- * is allowed to vary.
+ * Return true if the triple can be updated. If any s,p or o is SecNode.ANY
+ * then this method must return false if there are any restrictions where
+ * the remaining nodes and held constant and the ANY node is allowed to
+ * vary.
*
* See canRead(Triple t)
*
@@ -185,8 +191,11 @@ public interface SecuredItem
* @param to
* The resulting triple.
* @return true if the from triple can be updated as the to triple.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canUpdate( Triple from, Triple to );
+ public boolean canUpdate(Triple from, Triple to)
+ throws AuthenticationRequiredException;
/**
* Return true if the fronted triple can be updated.
@@ -199,11 +208,14 @@ public interface SecuredItem
* @param to
* The resulting fronted triple.
* @return true if the from triple can be updated as the to triple.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean canUpdate( FrontsTriple from, FrontsTriple to );
-
+ public boolean canUpdate(FrontsTriple from, FrontsTriple to)
+ throws AuthenticationRequiredException;
+
@Override
- public boolean equals( Object o );
+ public boolean equals(Object o);
/**
* @return the base item that is being secured.
@@ -236,6 +248,6 @@ public interface SecuredItem
* the other secured item.
* @return True if they are equivalent, false otherwise.
*/
- public boolean isEquivalent( SecuredItem securedItem );
+ public boolean isEquivalent(SecuredItem securedItem);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java b/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
index 898c41f..1ee4d2a 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/SecurityEvaluator.java
@@ -25,7 +25,7 @@ import java.util.Set;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.Triple;
import org.apache.jena.graph.NodeFactory;
-
+import org.apache.jena.shared.AuthenticationRequiredException;
/**
* SecurityEvaluator.
@@ -76,8 +76,8 @@ import org.apache.jena.graph.NodeFactory;
* the user can execute the CRUD action against any arbitrary triple the system
* should return <code>false</code>. </li>
* <li>See <code>Node.ANY</code>, <code>SecurityEvaluator.FUTURE</code>, and
- * <code>SecurityEvaluator.VARIABLE</code> for discussion of specifics of their respective
- * usages.</li>
+ * <code>SecurityEvaluator.VARIABLE</code> for discussion of specifics of their
+ * respective usages.</li>
* </ul>
* </p>
* </dd>
@@ -143,8 +143,7 @@ public interface SecurityEvaluator {
public static Set<Action> asSet(final Collection<Action> actions) {
if (actions instanceof Set) {
return (Set<Action>) actions;
- }
- else {
+ } else {
return new LinkedHashSet<Action>(actions);
}
}
@@ -154,62 +153,63 @@ public interface SecurityEvaluator {
* Indicates a variable in the triple.
* <p>
* </p>
- * This differs from <code>ANY</code> in that the system is asking if
- * there are any prohibitions not if the user may perform. Thus queries
- * with the VARIABLE type node should return <code>true</code> where
- * <code>ANY</code> returns <code>false</code>. In general this type is
- * used in the query to determine if triple level filtering of results
- * must be performed.
+ * This differs from <code>ANY</code> in that the system is asking if there
+ * are any prohibitions not if the user may perform. Thus queries with the
+ * VARIABLE type node should return <code>true</code> where <code>ANY</code>
+ * returns <code>false</code>. In general this type is used in the query to
+ * determine if triple level filtering of results must be performed.
* <p>
* </p>
* <p>
* <dl>
* <dt><code>(VARIABLE, X, Y )</code></dt>
* <dd>
- * Asks if there are any prohibitions against the user seeing all
- * subjects that have property X and object Y.</dd>
+ * Asks if there are any prohibitions against the user seeing all subjects
+ * that have property X and object Y.</dd>
* <dt>
* <code>(X, VARIABLE, Y )</code></dt>
* <dd>
- * Asks if there are any prohibitions against the user seeing all
- * predicates that have subject X and object Y.</dd>
+ * Asks if there are any prohibitions against the user seeing all predicates
+ * that have subject X and object Y.</dd>
* <dt>
* <code>(X, Y, VARIABLE)</code></dt>
* <dd>
- * Asks if there are any prohibitions against the user seeing all
- * objects that have subject X and predicate Y.</dd>
+ * Asks if there are any prohibitions against the user seeing all objects
+ * that have subject X and predicate Y.</dd>
* </dl>
- * The <code>VARIABLE</code> may occur multiple times and may occur with
- * the <code>ANY</code> node.
+ * The <code>VARIABLE</code> may occur multiple times and may occur with the
+ * <code>ANY</code> node.
* </p>
*
*/
- public static final Node VARIABLE = NodeFactory.createBlankNode( "urn:jena-permissions:VARIABLE");
+ public static final Node VARIABLE = NodeFactory
+ .createBlankNode("urn:jena-permissions:VARIABLE");
/**
* This is a blank (anonymous) node that will be created in the future.
* <p>
- * FUTURE is used to check that a blank node may be created in as
- * specific position in a triple.
+ * FUTURE is used to check that a blank node may be created in as specific
+ * position in a triple.
* </p>
* <p>
* <dl>
* <dt><code>(FUTURE, X, Y )</code></dt>
* <dd>
- * Asks if there the user may create a blank node that has property
- * X and object Y.</dd>
+ * Asks if there the user may create a blank node that has property X and
+ * object Y.</dd>
* <dt>
* <code>(X, Y, FUTURE)</code></dt>
* <dd>
- * Asks if there the user may create a blank node that has subject
- * X and property Y.</dd>
+ * Asks if there the user may create a blank node that has subject X and
+ * property Y.</dd>
* </dl>
- * The <code>FUTURE</code> may occur multiple times and may occur with
- * the <code>ANY</code> node.
+ * The <code>FUTURE</code> may occur multiple times and may occur with the
+ * <code>ANY</code> node.
* </p>
*/
- public static final Node FUTURE = NodeFactory.createBlankNode( "urn:jena-permissions:FUTURE");
-
+ public static final Node FUTURE = NodeFactory
+ .createBlankNode("urn:jena-permissions:FUTURE");
+
/**
* Determine if the action is allowed on the graph.
*
@@ -221,9 +221,11 @@ public interface SecurityEvaluator {
* @param graphIRI
* The IRI of the graph to check
* @return true if the action is allowed, false otherwise.
- *
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean evaluate(Object principal, Action action, Node graphIRI);
+ public boolean evaluate(Object principal, Action action, Node graphIRI)
+ throws AuthenticationRequiredException;
/**
* Determine if the action is allowed on the triple within the graph.
@@ -268,9 +270,11 @@ public interface SecurityEvaluator {
* @return true if the action is allowed, false otherwise.
* @throws IllegalArgumentException
* if any argument is null.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
public boolean evaluate(Object principal, Action action, Node graphIRI,
- Triple triple);
+ Triple triple) throws AuthenticationRequiredException;
/**
* Determine if all actions are allowed on the graph.
@@ -286,9 +290,11 @@ public interface SecurityEvaluator {
* @return true if all the actions are allowed, false otherwise.
* @throws IllegalArgumentException
* if any argument is null.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean evaluate(Object principal, Set<Action> actions,
- Node graphIRI);
+ public boolean evaluate(Object principal, Set<Action> actions, Node graphIRI)
+ throws AuthenticationRequiredException;
/**
* Determine if all the actions are allowed on the triple within the graph.
@@ -307,9 +313,12 @@ public interface SecurityEvaluator {
* @return true if all the actions are allowed, false otherwise.
* @throws IllegalArgumentException
* if any argument is null.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
public boolean evaluate(Object principal, Set<Action> actions,
- Node graphIRI, Triple triple);
+ Node graphIRI, Triple triple)
+ throws AuthenticationRequiredException;
/**
* Determine if any of the actions are allowed on the graph.
@@ -325,9 +334,11 @@ public interface SecurityEvaluator {
* @return true true if any the actions are allowed, false otherwise.
* @throws IllegalArgumentException
* if any argument is null.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
public boolean evaluateAny(Object principal, Set<Action> actions,
- Node graphIRI);
+ Node graphIRI) throws AuthenticationRequiredException;
/**
* Determine if any of the actions are allowed on the triple within the
@@ -350,9 +361,12 @@ public interface SecurityEvaluator {
* @return true if any the actions are allowed, false otherwise.
* @throws IllegalArgumentException
* if any argument is null.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
public boolean evaluateAny(Object principal, Set<Action> actions,
- Node graphIRI, Triple triple);
+ Node graphIRI, Triple triple)
+ throws AuthenticationRequiredException;
/**
* Determine if the user is allowed to update the "from" triple to the "to"
@@ -374,9 +388,11 @@ public interface SecurityEvaluator {
* @return true if the user may make the change, false otherwise.
* @throws IllegalArgumentException
* if any argument is null.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public boolean evaluateUpdate(Object principal, Node graphIRI,
- Triple from, Triple to);
+ public boolean evaluateUpdate(Object principal, Node graphIRI, Triple from,
+ Triple to) throws AuthenticationRequiredException;
/**
* returns the current principal or null if there is no current principal.
@@ -389,18 +405,20 @@ public interface SecurityEvaluator {
* @return The current principal
*/
public Object getPrincipal();
-
+
/**
- * Returns true if the principal is recognized as an authenticated principal by the
- * underlying authentication mechanism.
+ * Returns true if the principal is recognized as an authenticated principal
+ * by the underlying authentication mechanism.
*
- * This is to handle the case where an authentication mechanism returns a non-null object to
- * indicate a non-authenticated principal. (e.g. Shiro).
+ * This is to handle the case where an authentication mechanism returns a
+ * non-null object to indicate a non-authenticated principal. (e.g. Shiro).
*
- * The principal is guaranteed to have been the return value from an earlier getPrincipal() call.
+ * The principal is guaranteed to have been the return value from an earlier
+ * getPrincipal() call.
*
- * @param principal The principal to check.
+ * @param principal
+ * The principal to check.
* @return true if authenticated, false if not.
*/
- public boolean isPrincipalAuthenticated( Object principal );
+ public boolean isPrincipalAuthenticated(Object principal);
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraph.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraph.java b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraph.java
index 4274bc4..378a39b 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraph.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraph.java
@@ -17,82 +17,105 @@
*/
package org.apache.jena.permissions.graph;
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.GraphStatisticsHandler ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.GraphStatisticsHandler;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
-import org.apache.jena.shared.AddDeniedException ;
-import org.apache.jena.shared.DeleteDeniedException ;
+import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.DeleteDeniedException;
import org.apache.jena.shared.ReadDeniedException;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.shared.UpdateDeniedException;
+import org.apache.jena.util.iterator.ExtendedIterator;
/**
* The interface for secured Graph instances.
*
* Use the SecuredGraph.Factory to create instances
*/
-public interface SecuredGraph extends Graph, SecuredItem
-{
+public interface SecuredGraph extends Graph, SecuredItem {
/**
* @sec.graph Update
* @sec.triple Create
* @throws AddDeniedException
+ * @throws UpdateDeniedException
+ * if the graph can not be updated.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void add( final Triple t ) throws AddDeniedException;
+ public void add(final Triple t) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Node s, final Node p, final Node o )
- throws ReadDeniedException;
+ public boolean contains(final Node s, final Node p, final Node o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Triple t ) throws ReadDeniedException;
+ public boolean contains(final Triple t) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Delete
* @throws DeleteDeniedException
+ * @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void delete( final Triple t ) throws DeleteDeniedException;
+ public void delete(final Triple t) throws DeleteDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean dependsOn( final Graph other ) throws ReadDeniedException;
+ public boolean dependsOn(final Graph other) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read, otherwise filtered from iterator.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public ExtendedIterator<Triple> find( final Node s, final Node p,
- final Node o ) throws ReadDeniedException;
+ public ExtendedIterator<Triple> find(final Node s, final Node p,
+ final Node o) throws ReadDeniedException,
+ AuthenticationRequiredException;
- /**
+ /**
* @sec.graph Read
* @sec.triple Read, otherwise filtered from iterator.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public ExtendedIterator<Triple> find( final Triple triple )
- throws ReadDeniedException;
+ public ExtendedIterator<Triple> find(final Triple triple)
+ throws ReadDeniedException, AuthenticationRequiredException;
@Override
public SecuredCapabilities getCapabilities();
@@ -102,63 +125,80 @@ public interface SecuredGraph extends Graph, SecuredItem
/**
* Return the name of the graph.
+ *
* @return The name of the graph as a node.
*/
@Override
- public Node getModelNode();
+ public Node getModelNode();
@Override
public SecuredPrefixMapping getPrefixMapping();
@Override
- public SecurityEvaluator getSecurityEvaluator();
+ public SecurityEvaluator getSecurityEvaluator();
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public GraphStatisticsHandler getStatisticsHandler()
- throws ReadDeniedException;
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isEmpty() throws ReadDeniedException;
+ public boolean isEmpty() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isIsomorphicWith( final Graph g )
- throws ReadDeniedException;
-
+ public boolean isIsomorphicWith(final Graph g) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int size() throws ReadDeniedException;
-
+ public int size() throws ReadDeniedException,
+ AuthenticationRequiredException;
+
/**
* @sec.graph Update
* @sec.triple Delete for every triple
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void clear() throws DeleteDeniedException;
+ public void clear() throws DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Delete (s, p, o )
* @throws DeleteDeniedException
+ * @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void remove( Node s, Node p, Node o ) throws DeleteDeniedException;
+ public void remove(Node s, Node p, Node o) throws DeleteDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraphEventManager.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraphEventManager.java b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraphEventManager.java
index 192b015..e660f07 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraphEventManager.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredGraphEventManager.java
@@ -28,18 +28,19 @@ import java.util.Map;
import java.util.Set;
import java.util.Stack;
-import org.apache.jena.graph.Graph ;
-import org.apache.jena.graph.GraphEventManager ;
-import org.apache.jena.graph.GraphListener ;
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.graph.impl.CollectionGraph ;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.GraphEventManager;
+import org.apache.jena.graph.GraphListener;
+import org.apache.jena.graph.Triple;
+import org.apache.jena.graph.impl.CollectionGraph;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
import org.apache.jena.permissions.impl.CachedSecurityEvaluator;
import org.apache.jena.permissions.utils.PermTripleFilter;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-import org.apache.jena.util.iterator.NiceIterator ;
-import org.apache.jena.util.iterator.WrappedIterator ;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.util.iterator.ExtendedIterator;
+import org.apache.jena.util.iterator.NiceIterator;
+import org.apache.jena.util.iterator.WrappedIterator;
/**
* Since we sit between the graph and other items we have to determine when the
@@ -60,11 +61,12 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
private Triple[] getArray(final Graph g, final Triple[] triples,
- final Set<Action> perms) {
+ final Set<Action> perms) throws AuthenticationRequiredException {
Triple[] retval = triples;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (evaluator.evaluateAny(runAs, perms, sg.getModelNode())) {
if (!evaluator.evaluateAny(runAs, perms, sg.getModelNode(),
Triple.ANY)) {
@@ -72,12 +74,10 @@ public class SecuredGraphEventManager implements GraphEventManager {
Arrays.asList(triples).iterator(), perms)
.toList();
retval = list.toArray(new Triple[list.size()]);
- }
- else {
+ } else {
retval = triples;
}
- }
- else {
+ } else {
retval = new Triple[0];
}
}
@@ -85,7 +85,8 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyAddArray(final Graph g, final Triple[] triples) {
+ public void notifyAddArray(final Graph g, final Triple[] triples)
+ throws AuthenticationRequiredException {
final Triple[] added = getArray(g, triples,
SecuredGraphEventManager.ADD);
@@ -95,11 +96,13 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyAddGraph(final Graph g, final Graph added) {
+ public void notifyAddGraph(final Graph g, final Graph added)
+ throws AuthenticationRequiredException {
Graph addGraph = added;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (evaluator.evaluateAny(runAs, SecuredGraphEventManager.ADD,
sg.getModelNode())) {
if (!evaluator.evaluateAny(runAs,
@@ -110,12 +113,10 @@ public class SecuredGraphEventManager implements GraphEventManager {
addGraph = new CollectionGraph(Arrays.asList(getArray(
g, lst.toArray(new Triple[lst.size()]),
SecuredGraphEventManager.ADD)));
- }
- else {
+ } else {
addGraph = added;
}
- }
- else {
+ } else {
addGraph = new CollectionGraph(
Collections.<Triple> emptyList());
}
@@ -127,11 +128,13 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyAddIterator(final Graph g, final Iterator<Triple> it) {
+ public void notifyAddIterator(final Graph g, final Iterator<Triple> it)
+ throws AuthenticationRequiredException {
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
// only report if we can write to the graph
if (evaluator.evaluateAny(runAs, SecuredGraphEventManager.ADD,
sg.getModelNode())) {
@@ -143,19 +146,20 @@ public class SecuredGraphEventManager implements GraphEventManager {
iter.close();
}
}
- }
- else {
+ } else {
wrapped.notifyAddIterator(g, it);
}
}
@Override
- public void notifyAddList(final Graph g, final List<Triple> triples) {
+ public void notifyAddList(final Graph g, final List<Triple> triples)
+ throws AuthenticationRequiredException {
List<Triple> list = triples;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (evaluator.evaluateAny(runAs, SecuredGraphEventManager.ADD,
sg.getModelNode())) {
if (!evaluator.evaluateAny(runAs,
@@ -163,12 +167,10 @@ public class SecuredGraphEventManager implements GraphEventManager {
Triple.ANY)) {
list = wrapPermIterator(sg, triples.iterator(),
SecuredGraphEventManager.ADD).toList();
- }
- else {
+ } else {
list = triples;
}
- }
- else {
+ } else {
list = Collections.emptyList();
}
}
@@ -180,19 +182,20 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyAddTriple(final Graph g, final Triple t) {
+ public void notifyAddTriple(final Graph g, final Triple t)
+ throws AuthenticationRequiredException {
boolean notify = false;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
notify = evaluator.evaluateAny(runAs,
SecuredGraphEventManager.ADD, sg.getModelNode());
if (notify) {
notify = evaluator.evaluateAny(runAs,
SecuredGraphEventManager.ADD, sg.getModelNode(), t);
}
- }
- else {
+ } else {
notify = true;
}
if (notify) {
@@ -201,11 +204,13 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyDeleteArray(final Graph g, final Triple[] triples) {
+ public void notifyDeleteArray(final Graph g, final Triple[] triples)
+ throws AuthenticationRequiredException {
Triple[] deleted = triples;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (evaluator.evaluateAny(runAs,
SecuredGraphEventManager.DELETE, sg.getModelNode())) {
if (!evaluator.evaluateAny(runAs,
@@ -215,12 +220,10 @@ public class SecuredGraphEventManager implements GraphEventManager {
Arrays.asList(triples).iterator(),
SecuredGraphEventManager.DELETE).toList();
deleted = list.toArray(new Triple[list.size()]);
- }
- else {
+ } else {
deleted = triples;
}
- }
- else {
+ } else {
deleted = new Triple[0];
}
}
@@ -231,10 +234,12 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyDeleteGraph(final Graph g, final Graph removed) {
+ public void notifyDeleteGraph(final Graph g, final Graph removed)
+ throws AuthenticationRequiredException {
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (evaluator.evaluateAny(runAs,
SecuredGraphEventManager.DELETE, sg.getModelNode())) {
Graph g2 = removed;
@@ -243,31 +248,31 @@ public class SecuredGraphEventManager implements GraphEventManager {
Triple.ANY)) {
g2 = new CollectionGraph(
removed.find(Triple.ANY)
- .filterKeep(
- new PermTripleFilter(
- SecuredGraphEventManager.DELETE,
- sg, evaluator))
- .toList());
+ .filterKeep(
+ new PermTripleFilter(
+ SecuredGraphEventManager.DELETE,
+ sg, evaluator))
+ .toList());
}
wrapped.notifyDeleteGraph(g, g2);
- }
- else {
+ } else {
// do nothing.
}
- }
- else {
+ } else {
wrapped.notifyDeleteGraph(g, removed);
}
}
@Override
public void notifyDeleteIterator(final Graph g,
- final Iterator<Triple> it) {
+ final Iterator<Triple> it)
+ throws AuthenticationRequiredException {
Iterator<Triple> iter = it;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (evaluator.evaluateAny(runAs,
SecuredGraphEventManager.DELETE, sg.getModelNode())) {
@@ -281,23 +286,23 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
// else use the default list as all can bee seen
wrapped.notifyDeleteIterator(g, iter);
- }
- else {
+ } else {
// do nothing.
}
- }
- else {
+ } else {
wrapped.notifyDeleteIterator(g, iter);
}
}
@Override
- public void notifyDeleteList(final Graph g, final List<Triple> triples) {
+ public void notifyDeleteList(final Graph g, final List<Triple> triples)
+ throws AuthenticationRequiredException {
List<Triple> list = triples;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (evaluator.evaluateAny(runAs,
SecuredGraphEventManager.DELETE, sg.getModelNode())) {
if (!evaluator.evaluateAny(runAs,
@@ -311,8 +316,7 @@ public class SecuredGraphEventManager implements GraphEventManager {
sg, evaluator)).toList();
}
// else use the default list as all can bee seen
- }
- else {
+ } else {
list = Collections.emptyList();
}
}
@@ -323,19 +327,21 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyDeleteTriple(final Graph g, final Triple t) {
+ public void notifyDeleteTriple(final Graph g, final Triple t)
+ throws AuthenticationRequiredException {
boolean notify = false;
if (g instanceof SecuredGraph) {
final SecuredGraph sg = (SecuredGraph) g;
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
notify = evaluator.evaluateAny(runAs,
SecuredGraphEventManager.DELETE, sg.getModelNode());
if (notify) {
notify = evaluator.evaluateAny(runAs,
- SecuredGraphEventManager.DELETE, sg.getModelNode(), t);
+ SecuredGraphEventManager.DELETE, sg.getModelNode(),
+ t);
}
- }
- else {
+ } else {
notify = true;
}
if (notify) {
@@ -350,8 +356,9 @@ public class SecuredGraphEventManager implements GraphEventManager {
private ExtendedIterator<Triple> wrapPermIterator(
final SecuredGraph sg, final Iterator<Triple> it,
- final Set<Action> perms) {
- final SecurityEvaluator evaluator = new CachedSecurityEvaluator(sg.getSecurityEvaluator(), runAs);
+ final Set<Action> perms) throws AuthenticationRequiredException {
+ final SecurityEvaluator evaluator = new CachedSecurityEvaluator(
+ sg.getSecurityEvaluator(), runAs);
if (!evaluator.evaluateAny(runAs, perms, sg.getModelNode(),
Triple.ANY)) {
// nope so wrap the iterator with security iterator
@@ -359,7 +366,7 @@ public class SecuredGraphEventManager implements GraphEventManager {
new PermTripleFilter(perms, sg, evaluator));
}
return WrappedIterator.create(it);
- }
+ }
}
@@ -372,13 +379,9 @@ public class SecuredGraphEventManager implements GraphEventManager {
static {
SecuredGraphEventManager.ADD = new HashSet<Action>(
- Arrays.asList(new Action[] {
- Action.Create, Action.Read
- }));
+ Arrays.asList(new Action[] { Action.Create, Action.Read }));
SecuredGraphEventManager.DELETE = new HashSet<Action>(
- Arrays.asList(new Action[] {
- Action.Delete, Action.Read
- }));
+ Arrays.asList(new Action[] { Action.Delete, Action.Read }));
}
public SecuredGraphEventManager(final SecuredGraph securedGraph,
@@ -403,170 +406,171 @@ public class SecuredGraphEventManager implements GraphEventManager {
}
@Override
- public void notifyAddArray(final Graph g, final Triple[] triples) {
+ public void notifyAddArray(final Graph g, final Triple[] triples)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyAddArray(securedGraph, triples);
- }
- else {
+ } else {
sgl.notifyAddArray(g, triples);
}
}
}
@Override
- public void notifyAddGraph(final Graph g, final Graph added) {
+ public void notifyAddGraph(final Graph g, final Graph added)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyAddGraph(securedGraph, added);
- }
- else {
+ } else {
sgl.notifyAddGraph(g, added);
}
}
}
@Override
- public void notifyAddIterator(final Graph g, final Iterator<Triple> it) {
+ public void notifyAddIterator(final Graph g, final Iterator<Triple> it)
+ throws AuthenticationRequiredException {
notifyAddIterator(g, WrappedIterator.create(it).toList());
baseGraph.equals(g);
}
@Override
- public void notifyAddIterator(final Graph g, final List<Triple> triples) {
+ public void notifyAddIterator(final Graph g, final List<Triple> triples)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyAddIterator(securedGraph, triples.iterator());
- }
- else {
+ } else {
sgl.notifyAddIterator(g, triples.iterator());
}
}
}
@Override
- public void notifyAddList(final Graph g, final List<Triple> triples) {
+ public void notifyAddList(final Graph g, final List<Triple> triples)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyAddList(securedGraph, triples);
- }
- else {
+ } else {
sgl.notifyAddList(g, triples);
}
}
}
@Override
- public void notifyAddTriple(final Graph g, final Triple t) {
+ public void notifyAddTriple(final Graph g, final Triple t)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyAddTriple(securedGraph, t);
- }
- else {
+ } else {
sgl.notifyAddTriple(g, t);
}
}
}
@Override
- public void notifyDeleteArray(final Graph g, final Triple[] triples) {
+ public void notifyDeleteArray(final Graph g, final Triple[] triples)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyDeleteArray(securedGraph, triples);
- }
- else {
+ } else {
sgl.notifyDeleteArray(g, triples);
}
}
}
@Override
- public void notifyDeleteGraph(final Graph g, final Graph removed) {
+ public void notifyDeleteGraph(final Graph g, final Graph removed)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyDeleteGraph(securedGraph, removed);
- }
- else {
+ } else {
sgl.notifyDeleteGraph(g, removed);
}
}
}
@Override
- public void notifyDeleteIterator(final Graph g, final Iterator<Triple> it) {
+ public void notifyDeleteIterator(final Graph g, final Iterator<Triple> it)
+ throws AuthenticationRequiredException {
notifyDeleteIterator(g, WrappedIterator.create(it).toList());
}
@Override
- public void notifyDeleteIterator(final Graph g, final List<Triple> triples) {
+ public void notifyDeleteIterator(final Graph g, final List<Triple> triples)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyDeleteIterator(securedGraph, triples.iterator());
- }
- else {
+ } else {
sgl.notifyDeleteIterator(g, triples.iterator());
}
}
}
@Override
- public void notifyDeleteList(final Graph g, final List<Triple> L) {
+ public void notifyDeleteList(final Graph g, final List<Triple> L)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyDeleteList(securedGraph, L);
- }
- else {
+ } else {
sgl.notifyDeleteList(g, L);
}
}
}
@Override
- public void notifyDeleteTriple(final Graph g, final Triple t) {
+ public void notifyDeleteTriple(final Graph g, final Triple t)
+ throws AuthenticationRequiredException {
final boolean wrap = baseGraph.equals(g);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyDeleteTriple(securedGraph, t);
- }
- else {
+ } else {
sgl.notifyDeleteTriple(g, t);
}
}
}
@Override
- public void notifyEvent(final Graph source, final Object value) {
+ public void notifyEvent(final Graph source, final Object value)
+ throws AuthenticationRequiredException {
if ((source instanceof SecuredGraph) && securedGraph.equals(source)) {
baseGraph.getEventManager().notifyEvent(baseGraph, value);
- }
- else {
+ } else {
final boolean wrap = baseGraph.equals(source);
for (final SecuredGraphListener sgl : getListenerCollection()) {
if (wrap) {
sgl.notifyEvent(securedGraph, value);
- }
- else {
+ } else {
sgl.notifyEvent(source, value);
}
}
@@ -591,8 +595,7 @@ public class SecuredGraphEventManager implements GraphEventManager {
if (sgl != null) {
if (sgl.size() == 1) {
listenerMap.remove(listener);
- }
- else {
+ } else {
sgl.pop();
listenerMap.put(listener, sgl);
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredPrefixMapping.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredPrefixMapping.java b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredPrefixMapping.java
index 0888aa4..13d8fa4 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredPrefixMapping.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/SecuredPrefixMapping.java
@@ -20,7 +20,8 @@ package org.apache.jena.permissions.graph;
import java.util.Map;
import org.apache.jena.permissions.SecuredItem;
-import org.apache.jena.shared.PrefixMapping ;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.PrefixMapping;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
@@ -29,106 +30,136 @@ import org.apache.jena.shared.UpdateDeniedException;
*
* Use the SecuredPrefixMapping.Factory to create instances
*/
-public interface SecuredPrefixMapping extends PrefixMapping, SecuredItem
-{
+public interface SecuredPrefixMapping extends PrefixMapping, SecuredItem {
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String expandPrefix( final String prefixed )
- throws ReadDeniedException;
+ public String expandPrefix(final String prefixed)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Map<String, String> getNsPrefixMap() throws ReadDeniedException;
+ public Map<String, String> getNsPrefixMap() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getNsPrefixURI( final String prefix )
- throws ReadDeniedException;
+ public String getNsPrefixURI(final String prefix)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getNsURIPrefix( final String uri )
- throws ReadDeniedException;
+ public String getNsURIPrefix(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping lock() throws ReadDeniedException;
+ public SecuredPrefixMapping lock() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String qnameFor( final String uri ) throws ReadDeniedException;
+ public String qnameFor(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping removeNsPrefix( final String prefix )
- throws ReadDeniedException;
+ public SecuredPrefixMapping removeNsPrefix(final String prefix)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean samePrefixMappingAs( final PrefixMapping other )
- throws ReadDeniedException;
+ public boolean samePrefixMappingAs(final PrefixMapping other)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping setNsPrefix( final String prefix,
- final String uri ) throws UpdateDeniedException;
+ public SecuredPrefixMapping setNsPrefix(final String prefix,
+ final String uri) throws UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping setNsPrefixes( final Map<String, String> map )
- throws UpdateDeniedException;
+ public SecuredPrefixMapping setNsPrefixes(final Map<String, String> map)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping setNsPrefixes( final PrefixMapping other )
- throws UpdateDeniedException;
+ public SecuredPrefixMapping setNsPrefixes(final PrefixMapping other)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String shortForm( final String uri ) throws ReadDeniedException;
+ public String shortForm(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping withDefaultMappings( final PrefixMapping map )
- throws UpdateDeniedException;
+ public SecuredPrefixMapping withDefaultMappings(final PrefixMapping map)
+ throws UpdateDeniedException, AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java
index 3f147ee..01e9029 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredGraphImpl.java
@@ -17,7 +17,7 @@
*/
package org.apache.jena.permissions.graph.impl;
-import org.apache.jena.graph.* ;
+import org.apache.jena.graph.*;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
@@ -25,16 +25,17 @@ import org.apache.jena.permissions.graph.*;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemImpl;
import org.apache.jena.permissions.utils.PermTripleFilter;
-import org.apache.jena.shared.AddDeniedException ;
-import org.apache.jena.shared.DeleteDeniedException ;
+import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.DeleteDeniedException;
+import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.util.iterator.ExtendedIterator;
/**
* Implementation of SecuredGraph to be used by a SecuredItemInvoker proxy.
*/
-public class SecuredGraphImpl extends SecuredItemImpl implements SecuredGraph
-{
+public class SecuredGraphImpl extends SecuredItemImpl implements SecuredGraph {
// the prefixMapping for this graph.
private SecuredPrefixMapping prefixMapping;
@@ -53,19 +54,17 @@ public class SecuredGraphImpl extends SecuredItemImpl implements SecuredGraph
* @param holder
* The item holder that will contain this SecuredGraph.
*/
- SecuredGraphImpl( final SecuredItem securedItem,
- final ItemHolder<Graph, SecuredGraphImpl> holder )
- {
+ SecuredGraphImpl(final SecuredItem securedItem,
+ final ItemHolder<Graph, SecuredGraphImpl> holder) {
super(securedItem, holder);
this.holder = holder;
this.eventManager = new SecuredGraphEventManager(this,
holder.getBaseItem(), holder.getBaseItem().getEventManager());
}
- SecuredGraphImpl( final SecurityEvaluator securityEvaluator,
+ SecuredGraphImpl(final SecurityEvaluator securityEvaluator,
final String modelURI,
- final ItemHolder<Graph, SecuredGraphImpl> holder )
- {
+ final ItemHolder<Graph, SecuredGraphImpl> holder) {
super(securityEvaluator, modelURI, holder);
this.holder = holder;
this.eventManager = new SecuredGraphEventManager(this,
@@ -73,123 +72,107 @@ public class SecuredGraphImpl extends SecuredItemImpl implements SecuredGraph
}
@Override
- public void add( final Triple t ) throws AddDeniedException, UpdateDeniedException
- {
+ public void add(final Triple t) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(t);
holder.getBaseItem().add(t);
}
@Override
- public void close()
- {
+ public void close() {
holder.getBaseItem().close();
}
@Override
- public boolean contains( final Node s, final Node p, final Node o )
- {
+ public boolean contains(final Node s, final Node p, final Node o)
+ throws ReadDeniedException, AuthenticationRequiredException {
return contains(new Triple(s, p, o));
}
@Override
- public boolean contains( final Triple t )
- {
+ public boolean contains(final Triple t) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
- if (canRead(t))
- {
+ if (canRead(t)) {
return holder.getBaseItem().contains(t);
}
final ExtendedIterator<Triple> iter = holder.getBaseItem().find(t);
- try
- {
- while (iter.hasNext())
- {
- if (canRead(iter.next()))
- {
+ try {
+ while (iter.hasNext()) {
+ if (canRead(iter.next())) {
return true;
}
}
return false;
- }
- finally
- {
+ } finally {
iter.close();
}
}
- private synchronized void createPrefixMapping()
- {
- if (prefixMapping == null)
- {
+ private synchronized void createPrefixMapping() {
+ if (prefixMapping == null) {
prefixMapping = org.apache.jena.permissions.graph.impl.Factory
.getInstance(this, holder.getBaseItem().getPrefixMapping());
}
}
@Override
- public void delete( final Triple t ) throws DeleteDeniedException
- {
+ public void delete(final Triple t) throws DeleteDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkDelete(t);
holder.getBaseItem().delete(t);
}
@Override
- public boolean dependsOn( final Graph other )
- {
+ public boolean dependsOn(final Graph other) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
- if (other.equals(holder.getBaseItem()))
- {
+ if (other.equals(holder.getBaseItem())) {
return true;
}
return holder.getBaseItem().dependsOn(other);
}
@Override
- public ExtendedIterator<Triple> find( final Node s, final Node p,
- final Node o )
- {
+ public ExtendedIterator<Triple> find(final Node s, final Node p,
+ final Node o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Triple> retval = holder.getBaseItem().find(s, p, o);
- if (!canRead(Triple.ANY))
- {
+ if (!canRead(Triple.ANY)) {
+ retval = retval.filterKeep(new PermTripleFilter(Action.Read, this));
+ }
+ return retval;
+ }
+
+ @Override
+ public ExtendedIterator<Triple> find(final Triple m)
+ throws ReadDeniedException, AuthenticationRequiredException {
+ checkRead();
+ ExtendedIterator<Triple> retval = holder.getBaseItem().find(m);
+ if (!canRead(Triple.ANY)) {
retval = retval.filterKeep(new PermTripleFilter(Action.Read, this));
}
return retval;
}
-
- @Override
- public ExtendedIterator<Triple> find( final Triple m )
- {
- checkRead();
- ExtendedIterator<Triple> retval = holder.getBaseItem().find(m);
- if (!canRead(Triple.ANY))
- {
- retval = retval.filterKeep(new PermTripleFilter(Action.Read, this));
- }
- return retval;
- }
- @Override
- public SecuredCapabilities getCapabilities()
- {
+ @Override
+ public SecuredCapabilities getCapabilities() {
return new SecuredCapabilities(getSecurityEvaluator(), getModelIRI(),
holder.getBaseItem().getCapabilities());
}
@Override
- public SecuredGraphEventManager getEventManager()
- {
+ public SecuredGraphEventManager getEventManager() {
return eventManager;
}
@Override
- public SecuredPrefixMapping getPrefixMapping()
- {
- if (prefixMapping == null)
- {
+ public SecuredPrefixMapping getPrefixMapping() {
+ if (prefixMapping == null) {
createPrefixMapping();
}
return prefixMapping;
@@ -197,44 +180,39 @@ public class SecuredGraphImpl extends SecuredItemImpl implements SecuredGraph
@Override
public GraphStatisticsHandler getStatisticsHandler()
- {
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getStatisticsHandler();
}
@Override
- public TransactionHandler getTransactionHandler()
- {
+ public TransactionHandler getTransactionHandler() {
return holder.getBaseItem().getTransactionHandler();
}
@Override
- public boolean isClosed()
- {
+ public boolean isClosed() {
return holder.getBaseItem().isClosed();
}
@Override
- public boolean isEmpty()
- {
+ public boolean isEmpty() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().isEmpty();
}
@Override
- public boolean isIsomorphicWith( final Graph g )
- {
+ public boolean isIsomorphicWith(final Graph g) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
- if (g.size() != holder.getBaseItem().size())
- {
+ if (g.size() != holder.getBaseItem().size()) {
return false;
}
final Triple t = new Triple(Node.ANY, Node.ANY, Node.ANY);
- if (!canRead(t))
- {
+ if (!canRead(t)) {
final ExtendedIterator<Triple> iter = g.find(t);
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
checkRead(iter.next());
}
}
@@ -242,42 +220,38 @@ public class SecuredGraphImpl extends SecuredItemImpl implements SecuredGraph
}
@Override
- public int size()
- {
+ public int size() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().size();
}
@Override
- public void clear()
- {
+ public void clear() throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
- if (! canDelete( Triple.ANY ))
- {
- ExtendedIterator<Triple> iter = holder.getBaseItem().find( Triple.ANY );
- while (iter.hasNext())
- {
- checkDelete( iter.next() );
+ if (!canDelete(Triple.ANY)) {
+ ExtendedIterator<Triple> iter = holder.getBaseItem().find(
+ Triple.ANY);
+ while (iter.hasNext()) {
+ checkDelete(iter.next());
}
}
holder.getBaseItem().clear();
}
@Override
- public void remove( Node s, Node p, Node o )
- {
+ public void remove(Node s, Node p, Node o) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
- Triple t = new Triple( s, p, o );
- if (t.isConcrete())
- {
- checkDelete( t );
- }
- else
- {
- ExtendedIterator<Triple> iter = holder.getBaseItem().find( Triple.ANY );
- while (iter.hasNext())
- {
- checkDelete( iter.next() );
+ Triple t = new Triple(s, p, o);
+ if (t.isConcrete()) {
+ checkDelete(t);
+ } else {
+ ExtendedIterator<Triple> iter = holder.getBaseItem().find(
+ Triple.ANY);
+ while (iter.hasNext()) {
+ checkDelete(iter.next());
}
}
holder.getBaseItem().remove(s, p, o);
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredPrefixMappingImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredPrefixMappingImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredPrefixMappingImpl.java
index 610ed92..daa6a0f 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredPrefixMappingImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/graph/impl/SecuredPrefixMappingImpl.java
@@ -23,16 +23,18 @@ import java.util.Map.Entry;
import org.apache.jena.permissions.graph.SecuredPrefixMapping;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemImpl;
-import org.apache.jena.shared.PrefixMapping ;
-import org.apache.jena.shared.impl.PrefixMappingImpl ;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.PrefixMapping;
+import org.apache.jena.shared.ReadDeniedException;
+import org.apache.jena.shared.UpdateDeniedException;
+import org.apache.jena.shared.impl.PrefixMappingImpl;
/**
* Implementation of SecuredPrefixMapping to be used by a SecuredItemInvoker
* proxy.
*/
public class SecuredPrefixMappingImpl extends SecuredItemImpl implements
- SecuredPrefixMapping
-{
+ SecuredPrefixMapping {
// the item holder that holds this SecuredPrefixMapping
private final ItemHolder<PrefixMapping, SecuredPrefixMapping> holder;
@@ -44,121 +46,120 @@ public class SecuredPrefixMappingImpl extends SecuredItemImpl implements
* @param holder
* The item holder that will contain this SecuredPrefixMapping.
*/
- SecuredPrefixMappingImpl( final SecuredGraphImpl graph,
- final ItemHolder<PrefixMapping, SecuredPrefixMapping> holder )
- {
+ SecuredPrefixMappingImpl(final SecuredGraphImpl graph,
+ final ItemHolder<PrefixMapping, SecuredPrefixMapping> holder) {
super(graph, holder);
this.holder = holder;
}
@Override
- public String expandPrefix( final String prefixed )
- {
+ public String expandPrefix(final String prefixed)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().expandPrefix(prefixed);
}
@Override
- public Map<String, String> getNsPrefixMap()
- {
+ public Map<String, String> getNsPrefixMap() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getNsPrefixMap();
}
@Override
- public String getNsPrefixURI( final String prefix )
- {
+ public String getNsPrefixURI(final String prefix)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getNsPrefixURI(prefix);
}
@Override
- public String getNsURIPrefix( final String uri )
- {
+ public String getNsURIPrefix(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getNsURIPrefix(uri);
}
@Override
- public SecuredPrefixMapping lock()
- {
+ public SecuredPrefixMapping lock() throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().lock();
return holder.getSecuredItem();
}
@Override
- public String qnameFor( final String uri )
- {
+ public String qnameFor(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().qnameFor(uri);
}
@Override
- public SecuredPrefixMapping removeNsPrefix( final String prefix )
- {
+ public SecuredPrefixMapping removeNsPrefix(final String prefix)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().removeNsPrefix(prefix);
return holder.getSecuredItem();
}
@Override
- public boolean samePrefixMappingAs( final PrefixMapping other )
- {
+ public boolean samePrefixMappingAs(final PrefixMapping other)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().samePrefixMappingAs(other);
}
@Override
- public SecuredPrefixMapping setNsPrefix( final String prefix,
- final String uri )
- {
+ public SecuredPrefixMapping setNsPrefix(final String prefix,
+ final String uri) throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().setNsPrefix(prefix, uri);
return holder.getSecuredItem();
}
@Override
- public SecuredPrefixMapping setNsPrefixes( final Map<String, String> map )
- {
+ public SecuredPrefixMapping setNsPrefixes(final Map<String, String> map)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().setNsPrefixes(map);
return holder.getSecuredItem();
}
@Override
- public SecuredPrefixMapping setNsPrefixes( final PrefixMapping other )
- {
+ public SecuredPrefixMapping setNsPrefixes(final PrefixMapping other)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().setNsPrefixes(other);
return holder.getSecuredItem();
}
@Override
- public String shortForm( final String uri )
- {
+ public String shortForm(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().shortForm(uri);
}
@Override
- public SecuredPrefixMapping withDefaultMappings( final PrefixMapping map )
- {
- // mapping only updates if there are map entries to add. Since this gets called
- // when we are doing deep triple checks while writing we need to attempt the
+ public SecuredPrefixMapping withDefaultMappings(final PrefixMapping map)
+ throws UpdateDeniedException, AuthenticationRequiredException {
+ // mapping only updates if there are map entries to add. Since this gets
+ // called
+ // when we are doing deep triple checks while writing we need to attempt
+ // the
// update only if there are new updates to add.
-
+
PrefixMapping m = holder.getBaseItem();
PrefixMappingImpl pm = new PrefixMappingImpl();
- for ( Entry<String, String> e : map.getNsPrefixMap().entrySet())
- {
- if (m.getNsPrefixURI(e.getKey()) == null && m.getNsURIPrefix(e.getValue()) == null )
- {
- pm.setNsPrefix( e.getKey(), e.getValue() );
+ for (Entry<String, String> e : map.getNsPrefixMap().entrySet()) {
+ if (m.getNsPrefixURI(e.getKey()) == null
+ && m.getNsURIPrefix(e.getValue()) == null) {
+ pm.setNsPrefix(e.getKey(), e.getValue());
}
}
- if ( !pm.getNsPrefixMap().isEmpty())
- {
+ if (!pm.getNsPrefixMap().isEmpty()) {
checkUpdate();
holder.getBaseItem().withDefaultMappings(pm);
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java b/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
index 5b7b07d..41ee222 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/impl/CachedSecurityEvaluator.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecurityEvaluator;
+import org.apache.jena.shared.AuthenticationRequiredException;
/**
* A SecurityEvaluator that can be cached for later use.
@@ -43,44 +44,48 @@ public class CachedSecurityEvaluator implements SecurityEvaluator {
@Override
public boolean evaluate(final Object principal, final Action action,
- final Node graphIRI) {
+ final Node graphIRI) throws AuthenticationRequiredException {
return wrapped.evaluate(principal, action, graphIRI);
}
@Override
public boolean evaluate(final Object principal, final Action action,
- final Node graphIRI, final Triple triple) {
+ final Node graphIRI, final Triple triple)
+ throws AuthenticationRequiredException {
return wrapped.evaluate(principal, action, graphIRI, triple);
}
@Override
public boolean evaluate(final Object principal, final Set<Action> actions,
- final Node graphIRI) {
+ final Node graphIRI) throws AuthenticationRequiredException {
return wrapped.evaluate(principal, actions, graphIRI);
}
@Override
public boolean evaluate(final Object principal, final Set<Action> actions,
- final Node graphIRI, final Triple triple) {
+ final Node graphIRI, final Triple triple)
+ throws AuthenticationRequiredException {
return wrapped.evaluate(principal, actions, graphIRI, triple);
}
@Override
public boolean evaluateAny(final Object principal,
- final Set<Action> actions, final Node graphIRI) {
+ final Set<Action> actions, final Node graphIRI)
+ throws AuthenticationRequiredException {
return wrapped.evaluateAny(principal, actions, graphIRI);
}
@Override
public boolean evaluateAny(final Object principal,
- final Set<Action> actions, final Node graphIRI,
- final Triple triple) {
+ final Set<Action> actions, final Node graphIRI, final Triple triple)
+ throws AuthenticationRequiredException {
return wrapped.evaluateAny(principal, actions, graphIRI, triple);
}
@Override
- public boolean evaluateUpdate(final Object principal,
- final Node graphIRI, final Triple from, final Triple to) {
+ public boolean evaluateUpdate(final Object principal, final Node graphIRI,
+ final Triple from, final Triple to)
+ throws AuthenticationRequiredException {
return wrapped.evaluateUpdate(principal, graphIRI, from, to);
}
[07/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredAltImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredAltImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredAltImpl.java
index 598c070..f5947ab 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredAltImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredAltImpl.java
@@ -17,7 +17,7 @@
*/
package org.apache.jena.permissions.model.impl;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecurityEvaluator.Action;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemInvoker;
@@ -28,14 +28,16 @@ import org.apache.jena.permissions.model.SecuredModel;
import org.apache.jena.permissions.model.SecuredRDFNode;
import org.apache.jena.permissions.model.SecuredResource;
import org.apache.jena.permissions.model.SecuredSeq;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.ReadDeniedException;
+import org.apache.jena.shared.UpdateDeniedException;
+import org.apache.jena.util.iterator.ExtendedIterator;
/**
* Implementation of SecuredAlt to be used by a SecuredItemInvoker proxy.
*/
-public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt
-{
+public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt {
/**
* Get an instance of SecuredAlt.
*
@@ -45,16 +47,13 @@ public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt
* The Alt to be secured.
* @return The secured Alt instance.
*/
- public static SecuredAlt getInstance( final SecuredModel securedModel,
- final Alt alt )
- {
- if (securedModel == null)
- {
+ public static SecuredAlt getInstance(final SecuredModel securedModel,
+ final Alt alt) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (alt == null)
- {
+ if (alt == null) {
throw new IllegalArgumentException("Alt may not be null");
}
final ItemHolder<Alt, SecuredAlt> holder = new ItemHolder<Alt, SecuredAlt>(
@@ -62,10 +61,8 @@ public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt
final SecuredAltImpl checker = new SecuredAltImpl(securedModel, holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (alt instanceof SecuredAlt)
- {
- if (checker.isEquivalent((SecuredAlt) alt))
- {
+ if (alt instanceof SecuredAlt) {
+ if (checker.isEquivalent((SecuredAlt) alt)) {
return (SecuredAlt) alt;
}
}
@@ -84,104 +81,103 @@ public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt
* @param holder
* The item holder that will hold this SecuredAlt.
*/
- protected SecuredAltImpl( final SecuredModel securedModel,
- final ItemHolder<? extends Alt, ? extends SecuredAlt> holder )
- {
+ protected SecuredAltImpl(final SecuredModel securedModel,
+ final ItemHolder<? extends Alt, ? extends SecuredAlt> holder) {
super(securedModel, holder);
this.holder = holder;
}
@Override
- public SecuredRDFNode getDefault()
- {
+ public SecuredRDFNode getDefault() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return SecuredRDFNodeImpl.getInstance(getModel(), getDefaultStatement()
.getObject());
}
@Override
- public SecuredAlt getDefaultAlt()
- {
+ public SecuredAlt getDefaultAlt() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return SecuredAltImpl.getInstance(getModel(), getDefaultStatement()
.getAlt());
}
@Override
- public SecuredBag getDefaultBag()
- {
+ public SecuredBag getDefaultBag() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return SecuredBagImpl.getInstance(getModel(), getDefaultStatement()
.getBag());
}
@Override
- public boolean getDefaultBoolean()
- {
+ public boolean getDefaultBoolean() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getBoolean();
}
@Override
- public byte getDefaultByte()
- {
+ public byte getDefaultByte() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getByte();
}
@Override
- public char getDefaultChar()
- {
+ public char getDefaultChar() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getChar();
}
@Override
- public double getDefaultDouble()
- {
+ public double getDefaultDouble() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getDouble();
}
@Override
- public float getDefaultFloat()
- {
+ public float getDefaultFloat() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getFloat();
}
@Override
- public int getDefaultInt()
- {
+ public int getDefaultInt() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getInt();
}
@Override
- public String getDefaultLanguage()
- {
+ public String getDefaultLanguage() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getLanguage();
}
@Override
- public SecuredLiteral getDefaultLiteral()
- {
+ public SecuredLiteral getDefaultLiteral() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return SecuredLiteralImpl.getInstance(getModel(), getDefaultStatement()
.getLiteral());
}
@Override
- public long getDefaultLong()
- {
+ public long getDefaultLong() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getLong();
}
@Override
- public SecuredResource getDefaultResource()
- {
+ public SecuredResource getDefaultResource() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return SecuredResourceImpl.getInstance(getModel(),
getDefaultStatement().getResource());
@@ -189,122 +185,94 @@ public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt
@Override
@Deprecated
- public SecuredResource getDefaultResource( final ResourceF f )
- {
+ public SecuredResource getDefaultResource(final ResourceF f)
+ throws ReadDeniedException, AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return SecuredResourceImpl.getInstance(getModel(),
getDefaultStatement().getResource(f));
}
@Override
- public SecuredSeq getDefaultSeq()
- {
+ public SecuredSeq getDefaultSeq() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return SecuredSeqImpl.getInstance(getModel(), getDefaultStatement()
.getSeq());
}
@Override
- public short getDefaultShort()
- {
+ public short getDefaultShort() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getShort();
}
- private Statement getDefaultStatement()
- {
+ private Statement getDefaultStatement() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = getStatementIterator(Action.Read);
- try
- {
- if (iter.hasNext())
- {
+ try {
+ if (iter.hasNext()) {
return iter.next();
}
throw new AltHasNoDefaultException(this);
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public String getDefaultString()
- {
+ public String getDefaultString() throws ReadDeniedException,
+ AuthenticationRequiredException {
// getDefaultStatement() calls checkRead
return getDefaultStatement().getString();
}
- /*
- * private SecTriple getDefaultTriple()
- * {
- * final StmtIterator iter = holder.getBaseItem().getModel()
- * .listStatements(this, RDF.li(1), (RDFNode) null);
- * try
- * {
- * return iter.hasNext() ? iter.nextStatement().asTriple() : null;
- * }
- * finally
- * {
- * iter.close();
- * }
- *
- * }
- *
- * private SecTriple getNewTriple( final SecTriple t, final Object o )
- * {
- * return new SecTriple(t.getSubject(), t.getPredicate(),
- * SecNode.createLiteral(
- * String.valueOf(o), "", false));
- * }
- */
@Override
- public SecuredAlt setDefault( final boolean o )
- {
- return setDefault( asObject( o ));
+ public SecuredAlt setDefault(final boolean o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ return setDefault(asObject(o));
}
@Override
- public SecuredAlt setDefault( final char o )
- {
- return setDefault( asObject( o ));
+ public SecuredAlt setDefault(final char o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ return setDefault(asObject(o));
}
@Override
- public SecuredAlt setDefault( final double o )
- {
- return setDefault( asObject( o ));
+ public SecuredAlt setDefault(final double o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ return setDefault(asObject(o));
}
@Override
- public SecuredAlt setDefault( final float o )
- {
- return setDefault( asObject( o ));
+ public SecuredAlt setDefault(final float o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ return setDefault(asObject(o));
}
@Override
- public SecuredAlt setDefault( final long o )
- {
- return setDefault( asObject( o ));
+ public SecuredAlt setDefault(final long o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ return setDefault(asObject(o));
}
@Override
- public SecuredAlt setDefault( final Object o )
- {
- return setDefault( asObject( o ));
+ public SecuredAlt setDefault(final Object o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ return setDefault(asObject(o));
}
@Override
- public SecuredAlt setDefault( final RDFNode o )
- {
- checkUpdate();
+ public SecuredAlt setDefault(final RDFNode o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ checkUpdate();
final ExtendedIterator<Statement> iter = getStatementIterator(Action.Read);
try {
- if (iter.hasNext())
- {
+ if (iter.hasNext()) {
final Statement stmt = iter.next();
final Triple t = stmt.asTriple();
final Triple t2 = new Triple(t.getSubject(), t.getPredicate(),
@@ -312,28 +280,25 @@ public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt
checkUpdate(t, t2);
stmt.changeObject(o);
return holder.getSecuredItem();
- }
- else
- {
- add( o );
+ } else {
+ add(o);
return holder.getSecuredItem();
}
- }
- finally {
+ } finally {
iter.close();
}
-
+
}
@Override
- public SecuredAlt setDefault( final String o )
- {
- return setDefault( asLiteral( o, "" ));
+ public SecuredAlt setDefault(final String o) throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ return setDefault(asLiteral(o, ""));
}
@Override
- public SecuredAlt setDefault( final String o, final String l )
- {
- return setDefault( asLiteral( o, l) );
+ public SecuredAlt setDefault(final String o, final String l)
+ throws UpdateDeniedException, AuthenticationRequiredException {
+ return setDefault(asLiteral(o, l));
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredContainerImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredContainerImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredContainerImpl.java
index 1f7f969..9fc4490 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredContainerImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredContainerImpl.java
@@ -24,8 +24,8 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecurityEvaluator.Action;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemInvoker;
@@ -33,17 +33,21 @@ import org.apache.jena.permissions.model.SecuredContainer;
import org.apache.jena.permissions.model.SecuredModel;
import org.apache.jena.permissions.utils.ContainerFilter;
import org.apache.jena.permissions.utils.PermStatementFilter;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-import org.apache.jena.util.iterator.WrappedIterator ;
-import org.apache.jena.vocabulary.RDF ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.DeleteDeniedException;
+import org.apache.jena.shared.ReadDeniedException;
+import org.apache.jena.shared.UpdateDeniedException;
+import org.apache.jena.util.iterator.ExtendedIterator;
+import org.apache.jena.util.iterator.WrappedIterator;
+import org.apache.jena.vocabulary.RDF;
/**
* Implementation of SecuredContainer to be used by a SecuredItemInvoker proxy.
*/
public class SecuredContainerImpl extends SecuredResourceImpl implements
- SecuredContainer
-{
+ SecuredContainer {
/**
* Constructor
*
@@ -53,23 +57,19 @@ public class SecuredContainerImpl extends SecuredResourceImpl implements
* The container to secure.
* @return The SecuredResource
*/
- public static SecuredContainer getInstance(
- final SecuredModel securedModel, final Container container )
- {
- if (securedModel == null)
- {
+ public static SecuredContainer getInstance(final SecuredModel securedModel,
+ final Container container) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (container == null)
- {
+ if (container == null) {
throw new IllegalArgumentException("Container may not be null");
}
// check that resource has a securedModel.
Container goodContainer = container;
- if (goodContainer.getModel() == null)
- {
+ if (goodContainer.getModel() == null) {
container.asNode();
goodContainer = securedModel.createBag();
}
@@ -81,10 +81,8 @@ public class SecuredContainerImpl extends SecuredResourceImpl implements
securedModel, holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (goodContainer instanceof SecuredContainer)
- {
- if (checker.isEquivalent((SecuredContainer) goodContainer))
- {
+ if (goodContainer instanceof SecuredContainer) {
+ if (checker.isEquivalent((SecuredContainer) goodContainer)) {
return (SecuredContainer) goodContainer;
}
}
@@ -107,63 +105,61 @@ public class SecuredContainerImpl extends SecuredResourceImpl implements
*/
protected SecuredContainerImpl(
final SecuredModel securedModel,
- final ItemHolder<? extends Container, ? extends SecuredContainer> holder )
- {
+ final ItemHolder<? extends Container, ? extends SecuredContainer> holder) {
super(securedModel, holder);
this.holder = holder;
// listener=new ChangeListener();
// holder.getBaseItem().getModel().register(listener);
}
- protected RDFNode asObject( Object o )
- {
- return o instanceof RDFNode ? (RDFNode) o : ResourceFactory.createTypedLiteral( o );
- }
-
- protected RDFNode asLiteral( String o, String l )
- {
+ protected RDFNode asObject(Object o) {
+ return o instanceof RDFNode ? (RDFNode) o : ResourceFactory
+ .createTypedLiteral(o);
+ }
+
+ protected RDFNode asLiteral(String o, String l) {
return holder.getBaseItem().getModel().createLiteral(o, l);
}
-
+
@Override
- public SecuredContainer add( final boolean o )
- {
- return add( asObject( o ));
+ public SecuredContainer add(final boolean o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
+ return add(asObject(o));
}
@Override
- public SecuredContainer add( final char o )
- {
- return add( asObject( o ));
+ public SecuredContainer add(final char o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
+ return add(asObject(o));
}
@Override
- public SecuredContainer add( final double o )
- {
- return add( asObject( o ));
+ public SecuredContainer add(final double o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
+ return add(asObject(o));
}
@Override
- public SecuredContainer add( final float o )
- {
- return add( asObject( o ));
+ public SecuredContainer add(final float o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
+ return add(asObject(o));
}
@Override
- public SecuredContainer add( final long o )
- {
- return add( asObject( o ));
+ public SecuredContainer add(final long o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
+ return add(asObject(o));
}
@Override
- public SecuredContainer add( final Object o )
- {
- return add( asObject( o ));
+ public SecuredContainer add(final Object o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
+ return add(asObject(o));
}
@Override
- public SecuredContainer add( final RDFNode o )
- {
+ public SecuredContainer add(final RDFNode o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final int pos = holder.getBaseItem().size();
checkAdd(pos, o.asNode());
@@ -172,73 +168,74 @@ public class SecuredContainerImpl extends SecuredResourceImpl implements
}
@Override
- public SecuredContainer add( final String o )
- {
- return add( asLiteral( o, "" ));
+ public SecuredContainer add(final String o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
+ return add(asLiteral(o, ""));
}
@Override
- public SecuredContainer add( final String o, final String l )
- {
- return add( asLiteral( o, l));
+ public SecuredContainer add(final String o, final String l)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException {
+ return add(asLiteral(o, l));
}
- protected void checkAdd( final int pos, final Literal literal )
- {
+ protected void checkAdd(final int pos, final Literal literal)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException {
checkAdd(pos, literal.asNode());
}
- protected void checkAdd( final int pos, final Node node )
- {
+ protected void checkAdd(final int pos, final Node node)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException {
checkCreate(new Triple(holder.getBaseItem().asNode(), RDF.li(pos)
.asNode(), node));
}
@Override
- public boolean contains( final boolean o )
- {
- return contains( asObject( o ) );
+ public boolean contains(final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return contains(asObject(o));
}
@Override
- public boolean contains( final char o )
- {
- return contains( asObject( o ) );
+ public boolean contains(final char o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return contains(asObject(o));
}
@Override
- public boolean contains( final double o )
- {
- return contains( asObject( o ) );
+ public boolean contains(final double o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return contains(asObject(o));
}
@Override
- public boolean contains( final float o )
- {
- return contains( asObject( o ) );
+ public boolean contains(final float o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return contains(asObject(o));
}
@Override
- public boolean contains( final long o )
- {
- return contains( asObject( o ) );
+ public boolean contains(final long o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return contains(asObject(o));
}
@Override
- public boolean contains( final Object o )
- {
- return contains( asObject( o ) );
+ public boolean contains(final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return contains(asObject(o));
}
@Override
- public boolean contains( final RDFNode o )
- {
+ public boolean contains(final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException {
// iterator check reads
final SecuredNodeIterator<RDFNode> iter = iterator();
- while (iter.hasNext())
- {
- if (iter.next().asNode().equals(o.asNode()))
- {
+ while (iter.hasNext()) {
+ if (iter.next().asNode().equals(o.asNode())) {
return true;
}
}
@@ -246,111 +243,94 @@ public class SecuredContainerImpl extends SecuredResourceImpl implements
}
@Override
- public boolean contains( final String o )
- {
- return contains( asLiteral( o, "" ));
+ public boolean contains(final String o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ return contains(asLiteral(o, ""));
}
@Override
- public boolean contains( final String o, final String l )
- {
- return contains( asLiteral( o, l ));
+ public boolean contains(final String o, final String l)
+ throws ReadDeniedException, AuthenticationRequiredException {
+ return contains(asLiteral(o, l));
}
- protected int getAddIndex()
- {
+ protected int getAddIndex() {
int pos = -1;
final ExtendedIterator<Statement> iter = holder.getBaseItem()
.listProperties();
- try
- {
- while (iter.hasNext())
- {
+ try {
+ while (iter.hasNext()) {
pos = Math.max(pos, getIndex(iter.next().getPredicate()));
}
- }
- finally
- {
+ } finally {
iter.close();
}
return pos + 1;
}
- protected static int getIndex( final Property p )
- {
+ protected static int getIndex(final Property p) {
if (p.getNameSpace().equals(RDF.getURI())
- && p.getLocalName().startsWith("_"))
- {
- try
- {
+ && p.getLocalName().startsWith("_")) {
+ try {
return Integer.parseInt(p.getLocalName().substring(1));
- }
- catch (final NumberFormatException e)
- {
+ } catch (final NumberFormatException e) {
// acceptable;
}
}
return -1;
}
- protected ExtendedIterator<Statement> getStatementIterator(
- final Action perm )
- {
+ protected ExtendedIterator<Statement> getStatementIterator(final Action perm) {
return holder.getBaseItem().listProperties()
.filterKeep(new ContainerFilter())
.filterKeep(new PermStatementFilter(perm, this));
}
protected ExtendedIterator<Statement> getStatementIterator(
- final Set<Action> perm )
- {
+ final Set<Action> perm) {
return holder.getBaseItem().listProperties()
.filterKeep(new ContainerFilter())
.filterKeep(new PermStatementFilter(perm, this));
}
@Override
- public boolean isAlt()
- {
+ public boolean isAlt() {
return holder.getBaseItem().isAlt();
}
@Override
- public boolean isBag()
- {
+ public boolean isBag() {
return holder.getBaseItem().isBag();
}
@Override
- public boolean isSeq()
- {
+ public boolean isSeq() {
return holder.getBaseItem().isSeq();
}
@Override
- public SecuredNodeIterator<RDFNode> iterator()
- {
+ public SecuredNodeIterator<RDFNode> iterator() {
// listProperties calls checkRead();
- SecuredStatementIterator iter = listProperties();
- try {
- SortedSet<Statement> result = new TreeSet<Statement>( new ContainerComparator() );
- while (iter.hasNext()) {
- Statement stmt = iter.next();
- if (stmt.getPredicate().getOrdinal() > 0)
- {
- result.add( stmt );
- }
- }
- return new SecuredNodeIterator<RDFNode>(getModel(), new StatementRemovingIterator(result.iterator()).mapWith( s -> s.getObject() ) );
- }
- finally {
- iter.close();
- }
+ SecuredStatementIterator iter = listProperties();
+ try {
+ SortedSet<Statement> result = new TreeSet<Statement>(
+ new ContainerComparator());
+ while (iter.hasNext()) {
+ Statement stmt = iter.next();
+ if (stmt.getPredicate().getOrdinal() > 0) {
+ result.add(stmt);
+ }
+ }
+ return new SecuredNodeIterator<RDFNode>(getModel(),
+ new StatementRemovingIterator(result.iterator())
+ .mapWith(s -> s.getObject()));
+ } finally {
+ iter.close();
+ }
}
@Override
- public SecuredNodeIterator<RDFNode> iterator( final Set<Action> perms )
- {
+ public SecuredNodeIterator<RDFNode> iterator(final Set<Action> perms) {
checkRead();
final Set<Action> permsCopy = new HashSet<Action>(perms);
permsCopy.add(Action.Read);
@@ -361,8 +341,9 @@ public class SecuredContainerImpl extends SecuredResourceImpl implements
}
@Override
- public SecuredContainer remove( final Statement s )
- {
+ public SecuredContainer remove(final Statement s)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkDelete(s.asTriple());
holder.getBaseItem().remove(s);
@@ -370,188 +351,39 @@ public class SecuredContainerImpl extends SecuredResourceImpl implements
}
@Override
- public int size()
- {
+ public int size() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().size();
}
- /*
- * private synchronized void resetIndexes()
- * {
- * indexes.clear();
- * }
- */
- /*
- /**
- * find the position of i in the array
- *
- * @param i
- * @return the position or x<0 if not found.
- */
- /*
- * protected int mapValue( int i )
- * {
- * rebuildIndex();
- * return Collections.binarySearch( indexes, i );
- * }
- *
- * // return the value at position i
- * protected int unmapValue( int i )
- * {
- * return indexes.get(i);
- * }
- *
- *
- * private synchronized void rebuildIndex()
- * {
- * if (indexes.isEmpty())
- * {
- * ExtendedIterator<Statement> iter = getStatementIterator( Action.Read );
- * try {
- * while (iter.hasNext())
- * {
- * indexes.add( getIndex( iter.next().getPredicate() ) );
- * }
- * }
- * finally {
- * iter.close();
- * }
- * Collections.sort(indexes);
- * }
- * }
- *
- * private class ChangeListener implements ModelChangedListener
- * {
- *
- * private void checkStatement( Statement s )
- * {
- * if (indexes != null && s.getSubject().equals( holder.getBaseItem()))
- * {
- * resetIndexes();
- * }
- * }
- *
- * private void checkStatements( Iterator<Statement> iter )
- * {
- * while( indexes != null && iter.hasNext())
- * {
- * checkStatement( iter.next() );
- * }
- * }
- *
- * @Override
- * public void addedStatement( Statement s )
- * {
- * checkStatement( s );
- * }
- *
- * @Override
- * public void addedStatements( Statement[] statements )
- * {
- * checkStatements( Arrays.asList(statements).iterator() );
- * }
- *
- * @Override
- * public void addedStatements( List<Statement> statements )
- * {
- * checkStatements( statements.iterator() );
- * }
- *
- * @Override
- * public void addedStatements( StmtIterator statements )
- * {
- * try {
- * checkStatements( statements );
- * }
- * finally {
- * statements.close();
- * }
- * }
- *
- * @Override
- * public void addedStatements( Model baseModel )
- * {
- * addedStatements( baseModel.listStatements() );
- * }
- *
- * @Override
- * public void removedStatement( Statement s )
- * {
- * checkStatement( s );
- * }
- *
- * @Override
- * public void removedStatements( Statement[] statements )
- * {
- * checkStatements( Arrays.asList(statements).iterator() );
- * }
- *
- * @Override
- * public void removedStatements( List<Statement> statements )
- * {
- * checkStatements( statements.iterator() );
- * }
- *
- * @Override
- * public void removedStatements( StmtIterator statements )
- * {
- * try {
- * checkStatements( statements );
- * }
- * finally {
- * statements.close();
- * }
- * }
- *
- * @Override
- * public void removedStatements( Model baseModel )
- * {
- * removedStatements( baseModel.listStatements() );
- * }
- *
- * @Override
- * public void notifyEvent( Model baseModel, Object event )
- * {
- * // do nothing
- * }
- *
- * }
- */
- static class ContainerComparator implements Comparator<Statement>
- {
+ static class ContainerComparator implements Comparator<Statement> {
@Override
- public int compare( Statement arg0, Statement arg1 )
- {
- return Integer.valueOf(arg0.getPredicate().getOrdinal()).compareTo( arg1.getPredicate().getOrdinal());
+ public int compare(Statement arg0, Statement arg1) {
+ return Integer.valueOf(arg0.getPredicate().getOrdinal()).compareTo(
+ arg1.getPredicate().getOrdinal());
}
-
+
}
-
- static class StatementRemovingIterator extends WrappedIterator<Statement>
- {
+
+ static class StatementRemovingIterator extends WrappedIterator<Statement> {
private Statement stmt;
-
- public StatementRemovingIterator( Iterator<? extends Statement> base )
- {
+
+ public StatementRemovingIterator(Iterator<? extends Statement> base) {
super(base);
}
@Override
- public Statement next()
- {
+ public Statement next() {
stmt = super.next();
return stmt;
}
@Override
- public void remove()
- {
+ public void remove() {
stmt.remove();
super.remove();
}
-
-
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredLiteralImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredLiteralImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredLiteralImpl.java
index 3291bd1..21d9bb2 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredLiteralImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredLiteralImpl.java
@@ -17,24 +17,25 @@
*/
package org.apache.jena.permissions.model.impl;
-import org.apache.jena.datatypes.RDFDatatype ;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.permissions.impl.ItemHolder ;
-import org.apache.jena.permissions.impl.SecuredItemInvoker ;
-import org.apache.jena.permissions.model.SecuredLiteral ;
-import org.apache.jena.permissions.model.SecuredModel ;
-import org.apache.jena.permissions.model.SecuredResource ;
-import org.apache.jena.rdf.model.Literal ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.RDFVisitor ;
-import org.apache.jena.rdf.model.ResourceRequiredException ;
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.permissions.impl.ItemHolder;
+import org.apache.jena.permissions.impl.SecuredItemInvoker;
+import org.apache.jena.permissions.model.SecuredLiteral;
+import org.apache.jena.permissions.model.SecuredModel;
+import org.apache.jena.permissions.model.SecuredResource;
+import org.apache.jena.rdf.model.Literal;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.RDFVisitor;
+import org.apache.jena.rdf.model.ResourceRequiredException;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.ReadDeniedException;
/**
* Implementation of SecuredLiteral to be used by a SecuredItemInvoker proxy.
*/
public class SecuredLiteralImpl extends SecuredRDFNodeImpl implements
- SecuredLiteral
-{
+ SecuredLiteral {
/**
* Get an instance of SecuredLiteral
*
@@ -44,23 +45,19 @@ public class SecuredLiteralImpl extends SecuredRDFNodeImpl implements
* the literal to secure
* @return SecuredLiteral
*/
- public static SecuredLiteral getInstance( final SecuredModel securedModel,
- final Literal literal )
- {
- if (securedModel == null)
- {
+ public static SecuredLiteral getInstance(final SecuredModel securedModel,
+ final Literal literal) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (literal == null)
- {
+ if (literal == null) {
throw new IllegalArgumentException("literal may not be null");
}
// check that literal has a securedModel.
Literal goodLiteral = literal;
- if (goodLiteral.getModel() == null)
- {
+ if (goodLiteral.getModel() == null) {
goodLiteral = securedModel.createTypedLiteral(
literal.getLexicalForm(), literal.getDatatype());
}
@@ -71,10 +68,8 @@ public class SecuredLiteralImpl extends SecuredRDFNodeImpl implements
holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (goodLiteral instanceof SecuredLiteral)
- {
- if (checker.isEquivalent((SecuredLiteral) goodLiteral))
- {
+ if (goodLiteral instanceof SecuredLiteral) {
+ if (checker.isEquivalent((SecuredLiteral) goodLiteral)) {
return (SecuredLiteral) goodLiteral;
}
}
@@ -96,60 +91,55 @@ public class SecuredLiteralImpl extends SecuredRDFNodeImpl implements
* The item holder that will contain this SecuredLiteral.
*/
- private SecuredLiteralImpl( final SecuredModel securedModel,
- final ItemHolder<? extends Literal, ? extends SecuredLiteral> holder )
- {
+ private SecuredLiteralImpl(final SecuredModel securedModel,
+ final ItemHolder<? extends Literal, ? extends SecuredLiteral> holder) {
super(securedModel, holder);
this.holder = holder;
}
@Override
- public SecuredLiteral asLiteral()
- {
+ public SecuredLiteral asLiteral() {
return holder.getSecuredItem();
}
@Override
- public SecuredResource asResource()
- {
- if (canRead())
- {
+ public SecuredResource asResource() {
+ if (canRead()) {
throw new ResourceRequiredException(asNode());
- }
- else
- {
- throw new ResourceRequiredException(NodeFactory.createLiteral("Can not read"));
+ } else {
+ throw new ResourceRequiredException(
+ NodeFactory.createLiteral("Can not read"));
}
}
@Override
- public boolean getBoolean()
- {
+ public boolean getBoolean() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getBoolean();
}
@Override
- public byte getByte()
- {
+ public byte getByte() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getByte();
}
@Override
- public char getChar()
- {
+ public char getChar() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getChar();
}
/**
- * Return the datatype of the literal. This will be null in the
- * case of plain literals.
+ * Return the datatype of the literal. This will be null in the case of
+ * plain literals.
*/
@Override
- public RDFDatatype getDatatype()
- {
+ public RDFDatatype getDatatype() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getDatatype();
}
@@ -159,36 +149,36 @@ public class SecuredLiteralImpl extends SecuredRDFNodeImpl implements
* case of plain literals.
*/
@Override
- public String getDatatypeURI()
- {
+ public String getDatatypeURI() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getDatatypeURI();
}
@Override
- public double getDouble()
- {
+ public double getDouble() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getDouble();
}
@Override
- public float getFloat()
- {
+ public float getFloat() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getFloat();
}
@Override
- public int getInt()
- {
+ public int getInt() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getInt();
}
@Override
- public String getLanguage()
- {
+ public String getLanguage() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getLanguage();
}
@@ -197,80 +187,78 @@ public class SecuredLiteralImpl extends SecuredRDFNodeImpl implements
* Return the lexical form of the literal.
*/
@Override
- public String getLexicalForm()
- {
+ public String getLexicalForm() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getLexicalForm();
}
@Override
- public long getLong()
- {
+ public long getLong() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getLong();
}
@Override
- public short getShort()
- {
+ public short getShort() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getShort();
}
@Override
- public String getString()
- {
+ public String getString() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getString();
}
/**
- * Return the value of the literal. In the case of plain literals
- * this will return the literal string. In the case of typed literals
- * it will return a java object representing the value. In the case
- * of typed literals representing a java primitive then the appropriate
- * java wrapper class (Integer etc) will be returned.
+ * Return the value of the literal. In the case of plain literals this will
+ * return the literal string. In the case of typed literals it will return a
+ * java object representing the value. In the case of typed literals
+ * representing a java primitive then the appropriate java wrapper class
+ * (Integer etc) will be returned.
*/
@Override
- public Object getValue()
- {
+ public Object getValue() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getValue();
}
@Override
- public Literal inModel( final Model m )
- {
+ public Literal inModel(final Model m) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return m.createTypedLiteral(holder.getBaseItem().getLexicalForm(),
holder.getBaseItem().getDatatype());
}
@Override
- public boolean isWellFormedXML()
- {
+ public boolean isWellFormedXML() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().isWellFormedXML();
}
/**
- * Test that two literals are semantically equivalent.
- * In some cases this may be the sames as equals, in others
- * equals is stricter. For example, two xsd:int literals with
- * the same value but different language tag are semantically
- * equivalent but distinguished by the java equality function
+ * Test that two literals are semantically equivalent. In some cases this
+ * may be the sames as equals, in others equals is stricter. For example,
+ * two xsd:int literals with the same value but different language tag are
+ * semantically equivalent but distinguished by the java equality function
* in order to support round tripping.
*/
@Override
- public boolean sameValueAs( final Literal other )
- {
+ public boolean sameValueAs(final Literal other) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().sameValueAs(other);
}
@Override
- public Object visitWith( final RDFVisitor rv )
- {
+ public Object visitWith(final RDFVisitor rv) {
return rv.visitLiteral(this);
}
}
[12/13] jena git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/jena
Posted by cl...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/jena
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/da8b2205
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/da8b2205
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/da8b2205
Branch: refs/heads/master
Commit: da8b22057d8caed503a501991a693bdea88bee15
Parents: 2c0454c 4d1a711
Author: Claude Warren <cl...@apache.org>
Authored: Thu Jul 30 21:18:45 2015 +0100
Committer: Claude Warren <cl...@apache.org>
Committed: Thu Jul 30 21:18:45 2015 +0100
----------------------------------------------------------------------
apache-jena-libs/pom.xml | 6 +-
apache-jena-osgi/jena-osgi/pom.xml | 12 +-
apache-jena-osgi/pom.xml | 4 +-
apache-jena/bin/tdbloader2common | 13 +-
apache-jena/bin/tdbloader2index | 25 +--
apache-jena/pom.xml | 25 ++-
jena-arq/pom.xml | 12 +-
jena-base/pom.xml | 6 +-
jena-core/pom.xml | 13 +-
jena-csv/pom.xml | 8 +-
jena-elephas/jena-elephas-common/pom.xml | 2 +-
jena-elephas/jena-elephas-io/pom.xml | 2 +-
jena-elephas/jena-elephas-mapreduce/pom.xml | 2 +-
jena-elephas/jena-elephas-stats/pom.xml | 2 +-
jena-elephas/pom.xml | 6 +-
.../jena/example/helloworld/HelloWorld.java | 8 +-
.../jena/example/pizza/PizzaSparqlNoInf.java | 16 +-
jena-extras/jena-querybuilder/pom.xml | 2 +-
jena-extras/pom.xml | 6 +-
jena-fuseki1/pom.xml | 18 +-
jena-fuseki2/apache-jena-fuseki/pom.xml | 4 +-
jena-fuseki2/jena-fuseki-core/pom.xml | 14 +-
.../apache/jena/fuseki/mgt/ActionDatasets.java | 171 +++++++++----------
.../fuseki/server/DataAccessPointRegistry.java | 14 ++
.../java/org/apache/jena/fuseki/TestAdmin.java | 24 +--
jena-fuseki2/jena-fuseki-server/pom.xml | 2 +-
jena-fuseki2/jena-fuseki-war/pom.xml | 2 +-
jena-fuseki2/pom.xml | 4 +-
jena-iri/pom.xml | 4 +-
jena-jdbc/jena-jdbc-core/pom.xml | 4 +-
jena-jdbc/jena-jdbc-driver-bundle/pom.xml | 20 +--
jena-jdbc/jena-jdbc-driver-mem/pom.xml | 6 +-
jena-jdbc/jena-jdbc-driver-remote/pom.xml | 10 +-
jena-jdbc/jena-jdbc-driver-tdb/pom.xml | 10 +-
jena-jdbc/pom.xml | 4 +-
jena-maven-tools/pom.xml | 6 +-
jena-parent/pom.xml | 2 +-
jena-permissions/pom.xml | 4 +-
jena-sdb/pom.xml | 12 +-
jena-shaded-guava/pom.xml | 4 +-
jena-spatial/pom.xml | 8 +-
jena-tdb/pom.xml | 12 +-
jena-text/pom.xml | 8 +-
pom.xml | 2 +-
44 files changed, 264 insertions(+), 275 deletions(-)
----------------------------------------------------------------------
[05/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFListImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFListImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFListImpl.java
index 36c524f..3ad07ef 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFListImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFListImpl.java
@@ -24,8 +24,8 @@ import java.util.List;
import java.util.Set;
import java.util.function.Function;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
@@ -36,143 +36,54 @@ import org.apache.jena.permissions.model.SecuredRDFList;
import org.apache.jena.permissions.model.SecuredRDFNode;
import org.apache.jena.permissions.utils.RDFListIterator;
import org.apache.jena.permissions.utils.RDFListSecFilter;
-import org.apache.jena.rdf.model.* ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-import org.apache.jena.util.iterator.WrappedIterator ;
-import org.apache.jena.vocabulary.RDF ;
+import org.apache.jena.shared.ReadDeniedException;
+import org.apache.jena.shared.UpdateDeniedException;
+import org.apache.jena.util.iterator.ExtendedIterator;
+import org.apache.jena.util.iterator.WrappedIterator;
+import org.apache.jena.vocabulary.RDF;
public class SecuredRDFListImpl extends SecuredResourceImpl implements
- SecuredRDFList
-{
+ SecuredRDFList {
// called plain node but still returns a secured node
- private class PlainNodeMap implements Function<RDFList, RDFNode>
- {
+ private class PlainNodeMap implements Function<RDFList, RDFNode> {
@Override
- public RDFNode apply( final RDFList o )
- {
+ public RDFNode apply(final RDFList o) {
return SecuredRDFNodeImpl.getInstance(getModel(), o
.getRequiredProperty(listFirst()).getObject());
}
}
- private class SecuredListMap implements Function<RDFList, SecuredRDFList>
- {
+ private class SecuredListMap implements Function<RDFList, SecuredRDFList> {
@Override
- public SecuredRDFList apply( final RDFList o )
- {
+ public SecuredRDFList apply(final RDFList o) {
return SecuredRDFListImpl.getInstance(getModel(), o);
}
}
- private class SecuredNodeMap implements Function<RDFList, SecuredRDFNode>
- {
+ private class SecuredNodeMap implements Function<RDFList, SecuredRDFNode> {
private Property p;
- public SecuredNodeMap(Property p)
- {
- this.p=p;
+
+ public SecuredNodeMap(Property p) {
+ this.p = p;
}
-
+
@Override
- public SecuredRDFNode apply( final RDFList o )
- {
+ public SecuredRDFNode apply(final RDFList o) {
return SecuredRDFNodeImpl.getInstance(getModel(), o
.getRequiredProperty(p).getObject());
}
}
- /*
- * private class SecuredRDFListIterator implements Iterator<SecuredRDFList>
- * {
- * private SecuredRDFList current;
- * private Boolean found;
- * private final Set<Action> restrictions;
- *
- * private SecuredRDFListIterator( final Action restriction )
- * {
- * this(SecurityEvaluator.Util.asSet(new Action[] { restriction }));
- * }
- *
- * private SecuredRDFListIterator( final Set<Action> restrictions )
- * {
- * this.current = SecuredRDFListImpl.this.holder.getSecuredItem();
- * this.restrictions = restrictions;
- * }
- *
- * private boolean checkCandidate()
- * {
- * if (!endOfList())
- * {
- * final SecNode candidate = current.getRequiredProperty(listFirst())
- * .getObject().asNode();
- * return getSecurityEvaluator().evaluate(
- * restrictions,
- * getModelNode(),
- * new SecurityEvaluator.SecTriple(SecuredItemImpl
- * .convert(current.asNode()), SecuredItemImpl
- * .convert(RDF.first.asNode()), SecuredItemImpl
- * .convert(candidate)));
- * }
- * return false;
- * }
- *
- * private boolean endOfList()
- * {
- * return current.equals(listNil());
- * }
- *
- * @Override
- * public boolean hasNext()
- * {
- * if ((found == null) && !endOfList())
- * {
- * found = checkCandidate();
- * while (!found && !endOfList())
- * {
- * incrementCurrent();
- * found = checkCandidate();
- * }
- * }
- * return found == null ? false : found;
- * }
- *
- * private void incrementCurrent()
- * {
- * if (!endOfList())
- * {
- * current = (SecuredRDFList) current
- * .getRequiredProperty(listRest()).getResource()
- * .as(RDFList.class);
- * }
- * }
- *
- * @Override
- * public SecuredRDFList next()
- * {
- * if (hasNext())
- * {
- * found = null;
- * final SecuredRDFList retval = current;
- * incrementCurrent();
- * return retval;
- * }
- * throw new NoSuchElementException();
- * }
- *
- * @Override
- * public void remove()
- * {
- * throw new UnsupportedOperationException();
- * }
- *
- * }
- */
/**
* Get an instance of SecuredProperty
*
@@ -182,23 +93,19 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
* The rdfList to secure
* @return The SecuredProperty
*/
- public static <T extends RDFList> SecuredRDFList getInstance( final SecuredModel securedModel,
- final T rdfList )
- {
- if (securedModel == null)
- {
+ public static <T extends RDFList> SecuredRDFList getInstance(
+ final SecuredModel securedModel, final T rdfList) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (rdfList == null)
- {
+ if (rdfList == null) {
throw new IllegalArgumentException("RDFList may not be null");
}
// check that property has a securedModel.
RDFList goodList = rdfList;
- if (goodList.getModel() == null)
- {
+ if (goodList.getModel() == null) {
goodList = securedModel.createList(rdfList.asJavaList().iterator());
}
@@ -208,10 +115,8 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (goodList instanceof SecuredRDFList)
- {
- if (checker.isEquivalent((SecuredRDFList) goodList))
- {
+ if (goodList instanceof SecuredRDFList) {
+ if (checker.isEquivalent((SecuredRDFList) goodList)) {
return (SecuredRDFList) goodList;
}
}
@@ -239,34 +144,28 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
private final ItemHolder<RDFList, SecuredRDFList> holder;
- protected SecuredRDFListImpl( final SecuredModel securedModel,
- final ItemHolder<RDFList, SecuredRDFList> holder )
- {
+ protected SecuredRDFListImpl(final SecuredModel securedModel,
+ final ItemHolder<RDFList, SecuredRDFList> holder) {
super(securedModel, holder);
this.holder = holder;
}
@Override
- public void add( final RDFNode value )
- {
+ public void add(final RDFNode value) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreateNewList(value, listNil());
holder.getBaseItem().add(value);
}
@Override
- public SecuredRDFList append( final Iterator<? extends RDFNode> nodes )
- {
+ public SecuredRDFList append(final Iterator<? extends RDFNode> nodes)
+ throws ReadDeniedException, AuthenticationRequiredException {
SecuredRDFList copy = copy();
- if (nodes.hasNext())
- {
- if (((RDFList)copy.getBaseItem()).size()>0)
-// if (copy.size() > 0)
- {
+ if (nodes.hasNext()) {
+ if (((RDFList) copy.getBaseItem()).size() > 0) {
copy.concatenate(copy.getModel().createList(nodes));
- }
- else
- {
+ } else {
copy = copy.getModel().createList(nodes);
}
}
@@ -274,18 +173,14 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public RDFList append( final RDFList list )
- {
- if (holder.getBaseItem().isEmpty())
- {
+ public RDFList append(final RDFList list) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ if (holder.getBaseItem().isEmpty()) {
return list.size() == 0 ? ModelFactory.createDefaultModel()
.createList() : list.copy();
- }
- else
- {
+ } else {
final RDFList copy = copy();
- if (list.size() > 0)
- {
+ if (list.size() > 0) {
copy.concatenate(list.copy());
}
return copy;
@@ -293,44 +188,36 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public void apply( final ApplyFn fn )
- {
+ public void apply(final ApplyFn fn) throws ReadDeniedException,
+ AuthenticationRequiredException {
// iterator() checks Read
final ExtendedIterator<RDFNode> i = iterator();
- try
- {
- while (i.hasNext())
- {
+ try {
+ while (i.hasNext()) {
fn.apply(i.next());
}
- }
- finally
- {
+ } finally {
i.close();
}
}
@Override
- public void apply( final Set<Action> perms, final ApplyFn fn )
- {
+ public void apply(final Set<Action> perms, final ApplyFn fn)
+ throws ReadDeniedException, AuthenticationRequiredException {
// iterator() checks Read
final ExtendedIterator<RDFNode> i = iterator(perms);
- try
- {
- while (i.hasNext())
- {
+ try {
+ while (i.hasNext()) {
fn.apply(i.next());
}
- }
- finally
- {
+ } finally {
i.close();
}
}
@Override
- public List<RDFNode> asJavaList()
- {
+ public List<RDFNode> asJavaList() throws ReadDeniedException,
+ AuthenticationRequiredException {
// iterator() checks Read
return iterator().toList();
}
@@ -341,21 +228,17 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
* @param val
* @return the modified RDFList.
*/
- private RDFList baseRemove( final RDFList val )
- {
+ private RDFList baseRemove(final RDFList val) {
RDFList prev = null;
RDFList cell = holder.getBaseItem();
final boolean searching = true;
- while (searching && !cell.isEmpty())
- {
- if (cell.equals(val))
- {
+ while (searching && !cell.isEmpty()) {
+ if (cell.equals(val)) {
// found the value to be removed
final RDFList tail = cell.getTail();
- if (prev != null)
- {
+ if (prev != null) {
prev.setTail(tail);
}
@@ -363,9 +246,7 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
// return this unless we have removed the head element
return (prev == null) ? tail : this;
- }
- else
- {
+ } else {
// not found yet
prev = cell;
cell = cell.getTail();
@@ -376,107 +257,79 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
return this;
}
- private void checkCreateNewList( final RDFNode value, final Resource tail )
- {
- checkCreate(new Triple(
- SecurityEvaluator.FUTURE,
- listFirst().asNode(),
+ private void checkCreateNewList(final RDFNode value, final Resource tail)
+ throws AddDeniedException, AuthenticationRequiredException {
+ checkCreate(new Triple(SecurityEvaluator.FUTURE, listFirst().asNode(),
value.asNode()));
- checkCreate(new Triple(
- SecurityEvaluator.FUTURE,
- listRest().asNode(),
+ checkCreate(new Triple(SecurityEvaluator.FUTURE, listRest().asNode(),
tail.asNode()));
}
- private Set<Statement> collectStatements( final Set<Action> actions )
- {
+ private Set<Statement> collectStatements(final Set<Action> actions) {
final Set<Statement> stmts = new HashSet<Statement>();
final ExtendedIterator<RDFList> iter = WrappedIterator.create(
new RDFListIterator(holder.getBaseItem())).filterKeep(
new RDFListSecFilter<RDFList>(this, actions));
- try
- {
- while (iter.hasNext())
- {
+ try {
+ while (iter.hasNext()) {
stmts.addAll(iter.next().listProperties().toSet());
}
return stmts;
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public void concatenate( final Iterator<? extends RDFNode> nodes )
- {
+ public void concatenate(final Iterator<? extends RDFNode> nodes)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
- if (holder.getBaseItem().isEmpty())
- {
+ if (holder.getBaseItem().isEmpty()) {
// concatenating list onto the empty list is an error
throw new EmptyListUpdateException(
"Tried to concatenate onto the empty list");
- }
- else
- {
-
- Triple t = new Triple(
- SecurityEvaluator.FUTURE,
- listFirst().asNode(), Node.ANY);
- if (!canCreate(t))
- {
+ } else {
+
+ Triple t = new Triple(SecurityEvaluator.FUTURE, listFirst()
+ .asNode(), Node.ANY);
+ if (!canCreate(t)) {
final List<RDFNode> list = new ArrayList<RDFNode>();
- while (nodes.hasNext())
- {
+ while (nodes.hasNext()) {
final RDFNode n = nodes.next();
- t = new Triple(
- SecurityEvaluator.FUTURE,
- listFirst().asNode(), n.asNode());
+ t = new Triple(SecurityEvaluator.FUTURE, listFirst()
+ .asNode(), n.asNode());
checkCreate(t);
list.add(n);
}
holder.getBaseItem().concatenate(list.iterator());
- }
- else
- {
+ } else {
holder.getBaseItem().concatenate(nodes);
}
}
}
@Override
- public void concatenate( final RDFList list )
- {
+ public void concatenate(final RDFList list) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
- if (holder.getBaseItem().isEmpty())
- {
+ if (holder.getBaseItem().isEmpty()) {
// concatenating list onto the empty list is an error
throw new EmptyListUpdateException(
"Tried to concatenate onto the empty list");
- }
- else
- {
- Triple t = new Triple(
- SecurityEvaluator.FUTURE,
- listFirst().asNode(), Node.ANY);
- if (!canCreate(t))
- {
+ } else {
+ Triple t = new Triple(SecurityEvaluator.FUTURE, listFirst()
+ .asNode(), Node.ANY);
+ if (!canCreate(t)) {
final ExtendedIterator<RDFNode> iter = list.iterator();
- try
- {
- while (iter.hasNext())
- {
- t = new Triple(
- SecurityEvaluator.FUTURE,
- listFirst().asNode(),
- iter.next().asNode());
+ try {
+ while (iter.hasNext()) {
+ t = new Triple(SecurityEvaluator.FUTURE, listFirst()
+ .asNode(), iter.next().asNode());
checkCreate(t);
}
- }
- finally
- {
+ } finally {
iter.close();
}
}
@@ -485,8 +338,9 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public SecuredRDFList cons( final RDFNode value )
- {
+ public SecuredRDFList cons(final RDFNode value)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreateNewList(value, holder.getBaseItem());
return SecuredRDFListImpl.getInstance(getModel(), holder.getBaseItem()
@@ -494,214 +348,177 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public boolean contains( final RDFNode value )
- {
+ public boolean contains(final RDFNode value) throws ReadDeniedException,
+ AuthenticationRequiredException {
// iterator() checks Read
final ExtendedIterator<RDFNode> iter = iterator();
- try
- {
- while (iter.hasNext())
- {
- if (value.equals(iter.next()))
- {
+ try {
+ while (iter.hasNext()) {
+ if (value.equals(iter.next())) {
return true;
}
}
return false;
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public SecuredRDFList copy()
- {
+ public SecuredRDFList copy() throws ReadDeniedException,
+ AuthenticationRequiredException {
SecuredRDFList retval = null;
- if (canRead())
- {
- final ExtendedIterator<RDFNode> iter = getSecuredRDFListIterator(Action.Read)
- .mapWith( list -> list.getRequiredProperty(listFirst()).getObject());
- if (iter.hasNext())
- {
+ if (canRead()) {
+ final ExtendedIterator<RDFNode> iter = getSecuredRDFListIterator(
+ Action.Read).mapWith(
+ list -> list.getRequiredProperty(listFirst()).getObject());
+ if (iter.hasNext()) {
retval = getModel().createList(iter);
- }
- else
- {
+ } else {
retval = getModel().createList();
}
- }
- else
- {
+ } else {
retval = getModel().createList();
}
return retval;
}
@Override
- public SecuredRDFNode get( final int i )
- {
+ public SecuredRDFNode get(final int i) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final ExtendedIterator<SecuredRDFNode> iter = getSecuredRDFListIterator(
Action.Read).mapWith(new SecuredNodeMap(listFirst()));
int idx = 0;
- try
- {
- while (iter.hasNext())
- {
- if (i == idx)
- {
+ try {
+ while (iter.hasNext()) {
+ if (i == idx) {
return iter.next();
- }
- else
- {
+ } else {
idx++;
iter.next();
}
}
throw new ListIndexException();
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public SecuredRDFNode getHead()
- {
+ public SecuredRDFNode getHead() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
- Statement s = holder.getBaseItem().getRequiredProperty( listFirst() );
- checkRead( s );
+ Statement s = holder.getBaseItem().getRequiredProperty(listFirst());
+ checkRead(s);
return SecuredRDFNodeImpl.getInstance(getModel(), s.getObject());
}
private ExtendedIterator<RDFList> getSecuredRDFListIterator(
- final Action perm )
- {
+ final Action perm) {
return WrappedIterator
.create(new RDFListIterator(holder.getBaseItem())).filterKeep(
new RDFListSecFilter<RDFList>(this, perm));
}
private ExtendedIterator<RDFList> getSecuredRDFListIterator(
- final Set<Action> perm )
- {
+ final Set<Action> perm) {
return WrappedIterator
.create(new RDFListIterator(holder.getBaseItem())).filterKeep(
new RDFListSecFilter<RDFList>(this, perm));
}
@Override
- public boolean getStrict()
- {
+ public boolean getStrict() {
return holder.getBaseItem().getStrict();
}
@Override
- public SecuredRDFList getTail()
- {
+ public SecuredRDFList getTail() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
- Statement s = holder.getBaseItem().getRequiredProperty( listRest() );
- checkRead( s );
- return SecuredRDFListImpl.getInstance(getModel(), s.getObject().as(RDFList.class));
+ Statement s = holder.getBaseItem().getRequiredProperty(listRest());
+ checkRead(s);
+ return SecuredRDFListImpl.getInstance(getModel(),
+ s.getObject().as(RDFList.class));
}
@Override
- public String getValidityErrorMessage()
- {
+ public String getValidityErrorMessage() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getValidityErrorMessage();
}
@Override
- public int indexOf( final RDFNode value )
- {
+ public int indexOf(final RDFNode value) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final ExtendedIterator<SecuredRDFNode> iter = getSecuredRDFListIterator(
Action.Read).mapWith(new SecuredNodeMap(listFirst()));
- try
- {
+ try {
int retval = 0;
- while (iter.hasNext())
- {
- if (value.equals(iter.next()))
- {
+ while (iter.hasNext()) {
+ if (value.equals(iter.next())) {
return retval;
- }
- else
- {
+ } else {
retval++;
}
}
return -1;
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public int indexOf( final RDFNode value, final int start )
- {
+ public int indexOf(final RDFNode value, final int start)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<SecuredRDFNode> iter = getSecuredRDFListIterator(
Action.Read).mapWith(new SecuredNodeMap(listFirst()));
- try
- {
+ try {
int retval = 0;
- while (iter.hasNext() && (retval < start))
- {
+ while (iter.hasNext() && (retval < start)) {
iter.next();
retval++;
}
- while (iter.hasNext())
- {
- if (value.equals(iter.next()))
- {
+ while (iter.hasNext()) {
+ if (value.equals(iter.next())) {
return retval;
- }
- else
- {
+ } else {
retval++;
}
}
return -1;
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public boolean isEmpty()
- {
+ public boolean isEmpty() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final ExtendedIterator<RDFNode> iter = iterator();
- try
- {
+ try {
return !iter.hasNext();
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public boolean isValid()
- {
+ public boolean isValid() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().isValid();
}
@Override
- public ExtendedIterator<RDFNode> iterator()
- {
+ public ExtendedIterator<RDFNode> iterator() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return getSecuredRDFListIterator(Action.Read).mapWith(
new PlainNodeMap());
@@ -709,8 +526,8 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public ExtendedIterator<RDFNode> iterator( final Set<Action> constraints )
- {
+ public ExtendedIterator<RDFNode> iterator(final Set<Action> constraints)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final Set<Action> req = new HashSet<Action>(constraints);
req.add(Action.Read);
@@ -718,44 +535,38 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
- public Class<? extends RDFList> listAbstractionClass()
- {
+ public Class<? extends RDFList> listAbstractionClass() {
return RDFList.class;
}
- public Property listFirst()
- {
+ public Property listFirst() {
return m_listFirst;
}
- public Resource listNil()
- {
+ public Resource listNil() {
return m_listNil;
}
- public Property listRest()
- {
+ public Property listRest() {
return m_listRest;
}
- public Resource listType()
- {
+ public Resource listType() {
return m_listType;
}
@Override
- public <T> ExtendedIterator<T> mapWith( final Function<RDFNode, T> fn )
- {
+ public <T> ExtendedIterator<T> mapWith(final Function<RDFNode, T> fn)
+ throws ReadDeniedException, AuthenticationRequiredException {
return iterator().mapWith(fn);
}
@Override
- public Object reduce( final ReduceFn fn, final Object initial )
- {
+ public Object reduce(final ReduceFn fn, final Object initial)
+ throws ReadDeniedException, AuthenticationRequiredException {
Object acc = initial;
- for (final Iterator<RDFNode> i = iterator(); i.hasNext();)
- {
+ for (final Iterator<RDFNode> i = iterator(); i.hasNext();) {
acc = fn.reduce(i.next(), acc);
}
@@ -763,15 +574,14 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public Object reduce( final Set<Action> requiredActions, final ReduceFn fn,
- final Object initial ) throws
- EmptyListException, ListIndexException, InvalidListException
- {
+ public Object reduce(final Set<Action> requiredActions, final ReduceFn fn,
+ final Object initial) throws EmptyListException,
+ ListIndexException, InvalidListException, ReadDeniedException,
+ AuthenticationRequiredException {
Object acc = initial;
final Set<Action> perms = new HashSet<Action>(requiredActions);
perms.add(Action.Read);
- for (final Iterator<RDFNode> i = iterator(perms); i.hasNext();)
- {
+ for (final Iterator<RDFNode> i = iterator(perms); i.hasNext();) {
acc = fn.reduce(i.next(), acc);
}
@@ -779,48 +589,38 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public RDFList remove( final RDFNode val )
- {
+ public RDFList remove(final RDFNode val) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
RDFList cell = null;
boolean denied = false;
- if (!canDelete(new Triple(Node.ANY, listFirst().asNode(), val.asNode())))
- {
+ if (!canDelete(new Triple(Node.ANY, listFirst().asNode(), val.asNode()))) {
// iterate over the deletable items
final ExtendedIterator<RDFList> iter = getSecuredRDFListIterator(Action.Delete);// .mapWith(new
// SecuredListMap());
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
cell = iter.next();
if (val.equals(cell.getRequiredProperty(listFirst())
- .getObject()))
- {
+ .getObject())) {
if (canDelete(new Triple(cell.asNode(), listFirst()
- .asNode(), val.asNode())))
- {
+ .asNode(), val.asNode()))) {
return SecuredRDFListImpl.getInstance(getModel(),
baseRemove(cell));
- }
- else
- {
+ } else {
denied = true;
}
}
}
- if (denied)
- {
- throw new DeleteDeniedException(SecuredItem.Util.triplePermissionMsg(getModelNode()));
- }
- else
- {
+ if (denied) {
+ throw new DeleteDeniedException(
+ SecuredItem.Util.triplePermissionMsg(getModelNode()));
+ } else {
return this;
}
- }
- else
- {
+ } else {
return SecuredRDFListImpl.getInstance(getModel(), holder
.getBaseItem().remove(val));
}
@@ -828,21 +628,19 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
@Override
@Deprecated
- public void removeAll()
- {
+ public void removeAll() throws UpdateDeniedException,
+ AuthenticationRequiredException {
removeList();
}
@Override
- public SecuredRDFList removeHead()
- {
+ public SecuredRDFList removeHead() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
final ExtendedIterator<SecuredRDFList> iter = getSecuredRDFListIterator(
Action.Read).mapWith(new SecuredListMap());
- try
- {
- if (!iter.hasNext())
- {
+ try {
+ if (!iter.hasNext()) {
throw new EmptyListException(
"Attempted to delete the head of a nil list");
}
@@ -851,39 +649,27 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
checkDelete(s);
return SecuredRDFListImpl.getInstance(getModel(), baseRemove(cell));
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public void removeList()
- {
+ public void removeList() throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
final Triple t = new Triple(Node.ANY, listFirst().asNode(), Node.ANY);
- /*
- * if (!canRead(t))
- * {
- * throw new EmptyListException(
- * "Attempted to delete the head of a nil list" );
- * }
- */
+
// have to be able to read and delete to delete all.
final Set<Action> perms = SecurityEvaluator.Util.asSet(new Action[] {
Action.Delete, Action.Read });
- if (getSecurityEvaluator().evaluate(getSecurityEvaluator().getPrincipal(), perms, this.getModelNode(),
- t))
- {
+ if (getSecurityEvaluator().evaluate(
+ getSecurityEvaluator().getPrincipal(), perms,
+ this.getModelNode(), t)) {
holder.getBaseItem().removeList();
- }
- else
- {
- for (final Statement s : collectStatements(perms))
- {
- if (canDelete(s))
- {
+ } else {
+ for (final Statement s : collectStatements(perms)) {
+ if (canDelete(s)) {
s.remove();
}
}
@@ -891,19 +677,17 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public SecuredRDFNode replace( final int i, final RDFNode value )
- {
+ public SecuredRDFNode replace(final int i, final RDFNode value)
+ throws UpdateDeniedException, AuthenticationRequiredException,
+ ListIndexException {
checkUpdate();
final SecuredNodeMap map = new SecuredNodeMap(listFirst());
final ExtendedIterator<SecuredRDFList> iter = getSecuredRDFListIterator(
Action.Read).mapWith(new SecuredListMap());
int idx = 0;
- try
- {
- while (iter.hasNext())
- {
- if (i == idx)
- {
+ try {
+ while (iter.hasNext()) {
+ if (i == idx) {
final SecuredRDFList list = iter.next();
final SecuredRDFNode retval = map.apply(list);
final Triple t = new Triple(list.asNode(), listFirst()
@@ -914,90 +698,73 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
final RDFList base = (RDFList) list.getBaseItem();
base.getRequiredProperty(listFirst()).changeObject(value);
return retval;
- }
- else
- {
+ } else {
idx++;
iter.next();
}
}
throw new ListIndexException();
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public boolean sameListAs( final RDFList list )
- {
+ public boolean sameListAs(final RDFList list) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<RDFNode> thisIter = null;
ExtendedIterator<RDFNode> thatIter = null;
- try
- {
+ try {
thisIter = iterator();
thatIter = list.iterator();
- while (thisIter.hasNext() && thatIter.hasNext())
- {
+ while (thisIter.hasNext() && thatIter.hasNext()) {
final RDFNode thisN = thisIter.next();
final RDFNode thatN = thatIter.next();
- if ((thisN == null) || !thisN.equals(thatN))
- {
+ if ((thisN == null) || !thisN.equals(thatN)) {
// not equal at this position
return false;
}
}
return !(thisIter.hasNext() || thatIter.hasNext());
- }
- finally
- {
- if (thisIter != null)
- {
+ } finally {
+ if (thisIter != null) {
thisIter.close();
}
- if (thatIter != null)
- {
+ if (thatIter != null) {
thatIter.close();
}
}
}
@Override
- public SecuredRDFNode setHead( final RDFNode value )
- {
+ public SecuredRDFNode setHead(final RDFNode value)
+ throws EmptyListException, AuthenticationRequiredException {
final ExtendedIterator<SecuredRDFList> iter = getSecuredRDFListIterator(
Action.Read).mapWith(new SecuredListMap());
- try
- {
- if (iter.hasNext())
- {
+ try {
+ if (iter.hasNext()) {
return replace(0, value);
- }
- else
- {
+ } else {
throw new EmptyListException(
"Tried to set the head of an empty list");
}
- }
- finally
- {
+ } finally {
iter.close();
}
}
@Override
- public void setStrict( final boolean strict )
- {
+ public void setStrict(final boolean strict) throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().setStrict(strict);
}
@Override
- public SecuredRDFList setTail( final RDFList tail )
- {
+ public SecuredRDFList setTail(final RDFList tail)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
final Statement rest = holder.getBaseItem().getRequiredProperty(
@@ -1014,18 +781,16 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public int size()
- {
+ public int size() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final Triple t = new Triple(Node.ANY, listFirst().asNode(), Node.ANY);
- if (canRead(t))
- {
+ if (canRead(t)) {
return holder.getBaseItem().size();
}
final ExtendedIterator<RDFNode> iter = iterator();
int i = 0;
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
i++;
iter.next();
}
@@ -1033,12 +798,11 @@ public class SecuredRDFListImpl extends SecuredResourceImpl implements
}
@Override
- public SecuredRDFList with( final RDFNode value )
- {
+ public SecuredRDFList with(final RDFNode value)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
- checkCreate(new Triple(
- SecurityEvaluator.FUTURE,
- listFirst().asNode(),
+ checkCreate(new Triple(SecurityEvaluator.FUTURE, listFirst().asNode(),
value.asNode()));
return SecuredRDFListImpl.getInstance(getModel(), holder.getBaseItem()
.with(value));
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFNodeImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFNodeImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFNodeImpl.java
index aba6977..fa640e5 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFNodeImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredRDFNodeImpl.java
@@ -20,42 +20,40 @@ package org.apache.jena.permissions.model.impl;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import org.apache.jena.enhanced.UnsupportedPolymorphismException ;
-import org.apache.jena.graph.FrontsNode ;
-import org.apache.jena.graph.Node ;
+import org.apache.jena.enhanced.UnsupportedPolymorphismException;
+import org.apache.jena.graph.FrontsNode;
+import org.apache.jena.graph.Node;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemImpl;
import org.apache.jena.permissions.model.SecuredModel;
import org.apache.jena.permissions.model.SecuredRDFNode;
import org.apache.jena.permissions.model.SecuredUnsupportedPolymorphismException;
-import org.apache.jena.rdf.model.Literal ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.RDFNode ;
-import org.apache.jena.rdf.model.Resource ;
+import org.apache.jena.rdf.model.Literal;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.ReadDeniedException;
/**
* Implementation of SecuredRDFNode to be used by a SecuredItemInvoker proxy.
*/
public abstract class SecuredRDFNodeImpl extends SecuredItemImpl implements
- SecuredRDFNode
-{
+ SecuredRDFNode {
/**
*
* @param securedModel
* the Secured Model to use.
- * @param rdfNode the node to secure.
+ * @param rdfNode
+ * the node to secure.
* @return the secured RDFNode
*/
- public static SecuredRDFNode getInstance( final SecuredModel securedModel,
- final RDFNode rdfNode )
- {
- if (rdfNode instanceof Literal)
- {
+ public static SecuredRDFNode getInstance(final SecuredModel securedModel,
+ final RDFNode rdfNode) {
+ if (rdfNode instanceof Literal) {
return SecuredLiteralImpl.getInstance(securedModel,
(Literal) rdfNode);
- }
- else
- {
+ } else {
return SecuredResourceImpl.getInstance(securedModel,
(Resource) rdfNode);
}
@@ -75,12 +73,10 @@ public abstract class SecuredRDFNodeImpl extends SecuredItemImpl implements
* @param holder
* the item holder that will contain this SecuredRDFNode.
*/
- protected SecuredRDFNodeImpl( final SecuredModel securedModel,
- final ItemHolder<? extends RDFNode, ? extends SecuredRDFNode> holder )
- {
+ protected SecuredRDFNodeImpl(final SecuredModel securedModel,
+ final ItemHolder<? extends RDFNode, ? extends SecuredRDFNode> holder) {
super(securedModel, holder);
- if (holder.getBaseItem().getModel() == null)
- {
+ if (holder.getBaseItem().getModel() == null) {
throw new IllegalArgumentException(String.format(
"Holder base item (%s) must have a securedModel", holder
.getBaseItem().getClass()));
@@ -89,113 +85,84 @@ public abstract class SecuredRDFNodeImpl extends SecuredItemImpl implements
this.holder = holder;
}
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
@Override
- public <T extends RDFNode> T as( final Class<T> view )
- {
+ public <T extends RDFNode> T as(final Class<T> view)
+ throws ReadDeniedException, AuthenticationRequiredException,
+ SecuredUnsupportedPolymorphismException {
checkRead();
// see if the base Item can as
T baseAs = holder.getBaseItem().as(view);
-
- if (view.equals(SecuredRDFNodeImpl.class)
- || view.equals(RDFNode.class))
- {
- return (T) this;
- }
- final Method m = getConstructor(view);
- if (m == null)
- {
- throw new SecuredUnsupportedPolymorphismException(this, view);
- }
- try
- {
- return (T) m.invoke(null, securedModel, holder.getBaseItem()
- .as(view));
- }
- catch (final UnsupportedPolymorphismException e)
- {
- throw new SecuredUnsupportedPolymorphismException(this, view);
- }
- catch (final IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (final IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (final InvocationTargetException e)
- {
- throw new RuntimeException(e);
- }
- /*
- else
- {
+
+ if (view.equals(SecuredRDFNodeImpl.class) || view.equals(RDFNode.class)) {
+ return (T) this;
+ }
+ final Method m = getConstructor(view);
+ if (m == null) {
+ throw new SecuredUnsupportedPolymorphismException(this, view);
+ }
+ try {
+ return (T) m.invoke(null, securedModel,
+ holder.getBaseItem().as(view));
+ } catch (final UnsupportedPolymorphismException e) {
throw new SecuredUnsupportedPolymorphismException(this, view);
+ } catch (final IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ } catch (final IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (final InvocationTargetException e) {
+ throw new RuntimeException(e);
}
- */
}
@Override
- public Node asNode()
- {
+ public Node asNode() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().asNode();
}
@Override
- public <T extends RDFNode> boolean canAs( final Class<T> view )
- {
+ public <T extends RDFNode> boolean canAs(final Class<T> view)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
// see if the base Item can as
- if (holder.getBaseItem().canAs(view))
- {
+ if (holder.getBaseItem().canAs(view)) {
return getConstructor(view) != null;
}
return false;
}
- private <T extends RDFNode> Method getConstructor( final Class<T> view )
- {
+ private <T extends RDFNode> Method getConstructor(final Class<T> view) {
String classNm = SecuredRDFNodeImpl.class.getName();
classNm = String.format("%s.Secured%sImpl",
classNm.substring(0, classNm.lastIndexOf(".")),
view.getSimpleName());
- try
- {
+ try {
final Class<?> c = Class.forName(classNm);
return c.getDeclaredMethod("getInstance", SecuredModel.class, view);
- }
- catch (final ClassNotFoundException e)
- {
+ } catch (final ClassNotFoundException e) {
return null;
- }
- catch (final SecurityException e)
- {
+ } catch (final SecurityException e) {
return null;
- }
- catch (final NoSuchMethodException e)
- {
+ } catch (final NoSuchMethodException e) {
return null;
}
}
@Override
- public SecuredModel getModel()
- {
+ public SecuredModel getModel() {
return securedModel;
}
@Override
- public RDFNode inModel( final Model m )
- {
+ public RDFNode inModel(final Model m) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
- if (securedModel.equals(m))
- {
+ if (securedModel.equals(m)) {
return this;
}
- if (m instanceof SecuredModel)
- {
+ if (m instanceof SecuredModel) {
return SecuredRDFNodeImpl.getInstance((SecuredModel) m, holder
.getBaseItem().inModel(m));
}
@@ -203,51 +170,55 @@ public abstract class SecuredRDFNodeImpl extends SecuredItemImpl implements
}
@Override
- public boolean isAnon()
- {
+ public boolean isAnon() {
return holder.getBaseItem().isAnon();
}
@Override
- public boolean isLiteral()
- {
+ public boolean isLiteral() {
return holder.getBaseItem().isLiteral();
}
@Override
- public boolean isResource()
- {
+ public boolean isResource() {
return holder.getBaseItem().isResource();
}
@Override
- public boolean isURIResource()
- {
+ public boolean isURIResource() {
return holder.getBaseItem().isURIResource();
}
/**
- * An RDFNode is equal to another enhanced node n iff the underlying
- * nodes are equal. We generalise to allow the other object to be any class
- * implementing asNode, because we allow other implemementations of
- * Resource, at least in principle.
- * This is deemed to be a complete and correct interpretation of RDFNode
- * equality, which is why this method has been marked final.
- *
- * @param o An object to test for equality with this node
- * @return True if o is equal to this node.
- */
- @Override final public boolean equals( Object o )
- {
- checkRead();
- return o instanceof FrontsNode && asNode().equals(((FrontsNode) o).asNode());
- }
-
- /**
- * The hash code of an RDFnode is defined to be the same as the underlying node.
- * @return The hashcode as an int
- */
- @Override final public int hashCode() {
- return holder.getBaseItem().asNode().hashCode();
- }
+ * An RDFNode is equal to another enhanced node n iff the underlying nodes
+ * are equal. We generalise to allow the other object to be any class
+ * implementing asNode, because we allow other implemementations of
+ * Resource, at least in principle. This is deemed to be a complete and
+ * correct interpretation of RDFNode equality, which is why this method has
+ * been marked final.
+ *
+ * @param o
+ * An object to test for equality with this node
+ * @return True if o is equal to this node.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ */
+ @Override
+ final public boolean equals(Object o) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ checkRead();
+ return o instanceof FrontsNode
+ && asNode().equals(((FrontsNode) o).asNode());
+ }
+
+ /**
+ * The hash code of an RDFnode is defined to be the same as the underlying
+ * node.
+ *
+ * @return The hashcode as an int
+ */
+ @Override
+ final public int hashCode() {
+ return holder.getBaseItem().asNode().hashCode();
+ }
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredReifiedStatementImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredReifiedStatementImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredReifiedStatementImpl.java
index b085598..de4759e 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredReifiedStatementImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredReifiedStatementImpl.java
@@ -22,15 +22,16 @@ import org.apache.jena.permissions.impl.SecuredItemInvoker;
import org.apache.jena.permissions.model.SecuredModel;
import org.apache.jena.permissions.model.SecuredReifiedStatement;
import org.apache.jena.permissions.model.SecuredStatement;
-import org.apache.jena.rdf.model.ReifiedStatement ;
+import org.apache.jena.rdf.model.ReifiedStatement;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.ReadDeniedException;
/**
* Implementation of SecuredReifiedStatement to be used by a SecuredItemInvoker
* proxy.
*/
public class SecuredReifiedStatementImpl extends SecuredResourceImpl implements
- SecuredReifiedStatement
-{
+ SecuredReifiedStatement {
/**
* Get an instance of SecuredReifiedStatement
*
@@ -41,15 +42,12 @@ public class SecuredReifiedStatementImpl extends SecuredResourceImpl implements
* @return SecuredReifiedStatement
*/
public static SecuredReifiedStatement getInstance(
- final SecuredModel securedModel, final ReifiedStatement stmt )
- {
- if (securedModel == null)
- {
+ final SecuredModel securedModel, final ReifiedStatement stmt) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (stmt == null)
- {
+ if (stmt == null) {
throw new IllegalArgumentException("Statement may not be null");
}
final ItemHolder<ReifiedStatement, SecuredReifiedStatement> holder = new ItemHolder<ReifiedStatement, SecuredReifiedStatement>(
@@ -58,10 +56,8 @@ public class SecuredReifiedStatementImpl extends SecuredResourceImpl implements
securedModel, holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (stmt instanceof SecuredReifiedStatement)
- {
- if (checker.isEquivalent((SecuredReifiedStatement) stmt))
- {
+ if (stmt instanceof SecuredReifiedStatement) {
+ if (checker.isEquivalent((SecuredReifiedStatement) stmt)) {
return (SecuredReifiedStatement) stmt;
}
}
@@ -82,15 +78,14 @@ public class SecuredReifiedStatementImpl extends SecuredResourceImpl implements
*/
protected SecuredReifiedStatementImpl(
final SecuredModel securedModel,
- final ItemHolder<? extends ReifiedStatement, ? extends SecuredReifiedStatement> holder )
- {
+ final ItemHolder<? extends ReifiedStatement, ? extends SecuredReifiedStatement> holder) {
super(securedModel, holder);
this.holder = holder;
}
@Override
- public SecuredStatement getStatement()
- {
+ public SecuredStatement getStatement() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return SecuredStatementImpl.getInstance(getModel(), holder
.getBaseItem().getStatement());
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredResourceImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredResourceImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredResourceImpl.java
index 2db14e6..e28815b 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredResourceImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredResourceImpl.java
@@ -17,10 +17,10 @@
*/
package org.apache.jena.permissions.model.impl;
-import org.apache.jena.datatypes.RDFDatatype ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.graph.Triple ;
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator.Action;
import org.apache.jena.permissions.impl.ItemHolder;
@@ -29,17 +29,19 @@ import org.apache.jena.permissions.model.SecuredModel;
import org.apache.jena.permissions.model.SecuredResource;
import org.apache.jena.permissions.model.SecuredStatement;
import org.apache.jena.permissions.utils.PermStatementFilter;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.shared.PropertyNotFoundException ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.PropertyNotFoundException;
import org.apache.jena.shared.ReadDeniedException;
-import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.shared.UpdateDeniedException;
+import org.apache.jena.util.iterator.ExtendedIterator;
/**
* Implementation of SecuredResource to be used by a SecuredItemInvoker proxy.
*/
public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
- SecuredResource
-{
+ SecuredResource {
/**
* Get a SecuredResource.
*
@@ -49,33 +51,26 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* The resource to secure.
* @return The SecuredResource
*/
- public static SecuredResource getInstance( final SecuredModel securedModel,
- final Resource resource )
- {
- if (securedModel == null)
- {
+ public static SecuredResource getInstance(final SecuredModel securedModel,
+ final Resource resource) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (resource == null)
- {
+ if (resource == null) {
throw new IllegalArgumentException("Resource may not be null");
}
- if (resource.isLiteral())
- {
+ if (resource.isLiteral()) {
throw new IllegalArgumentException("Resource may not be a literal");
}
// check that resource has a securedModel.
Resource goodResource = resource;
- if (goodResource.getModel() == null)
- {
+ if (goodResource.getModel() == null) {
final Node n = resource.asNode();
- if (resource.isAnon())
- {
- goodResource = securedModel.createResource(new AnonId(n.getBlankNodeId()));
- }
- else
- {
+ if (resource.isAnon()) {
+ goodResource = securedModel.createResource(new AnonId(n
+ .getBlankNodeId()));
+ } else {
goodResource = securedModel.createResource(n.getURI());
}
}
@@ -87,10 +82,8 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
securedModel, holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (goodResource instanceof SecuredResource)
- {
- if (checker.isEquivalent((SecuredResource) goodResource))
- {
+ if (goodResource instanceof SecuredResource) {
+ if (checker.isEquivalent((SecuredResource) goodResource)) {
return (SecuredResource) goodResource;
}
}
@@ -113,8 +106,7 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
*/
protected SecuredResourceImpl(
final SecuredModel securedModel,
- final ItemHolder<? extends Resource, ? extends SecuredResource> holder )
- {
+ final ItemHolder<? extends Resource, ? extends SecuredResource> holder) {
super(securedModel, holder);
this.holder = holder;
}
@@ -125,8 +117,7 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @return This resource to permit cascading.
*/
@Override
- public SecuredResource abort()
- {
+ public SecuredResource abort() {
holder.getBaseItem().abort();
return holder.getSecuredItem();
}
@@ -134,93 +125,127 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
/**
* Add the property <code>p</code> with the typed-literal value
* <code>o</code> to this resource, <i>ie</i> add (this, p, typed(o)) to
- * this's securedModel. Answer
- * this resource. The typed literal is equal to one constructed by using
+ * this's securedModel. Answer this resource. The typed literal is equal to
+ * one constructed by using
* <code>this.getModel().createTypedLiteral(o)</code>.
+ *
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addLiteral( final Property p, final boolean o )
- {
- return addProperty( p, ResourceFactory.createTypedLiteral(o) );
+ public SecuredResource addLiteral(final Property p, final boolean o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(p, ResourceFactory.createTypedLiteral(o));
}
/**
* Add the property <code>p</code> with the typed-literal value
* <code>o</code> to this resource, <i>ie</i> add (this, p, typed(o)) to
- * this's securedModel. Answer
- * this resource. The typed literal is equal to one constructed by using
+ * this's securedModel. Answer this resource. The typed literal is equal to
+ * one constructed by using
* <code>this.getModel().createTypedLiteral(o)</code>.
+ *
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addLiteral( final Property p, final char o )
- {
- return addProperty( p, ResourceFactory.createTypedLiteral(o));
+ public SecuredResource addLiteral(final Property p, final char o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(p, ResourceFactory.createTypedLiteral(o));
}
/**
* Add the property <code>p</code> with the typed-literal value
* <code>o</code> to this resource, <i>ie</i> add (this, p, typed(o)) to
- * this's securedModel. Answer
- * this resource. The typed literal is equal to one constructed by using
+ * this's securedModel. Answer this resource. The typed literal is equal to
+ * one constructed by using
* <code>this.getModel().createTypedLiteral(o)</code>.
+ *
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addLiteral( final Property value, final double d )
- {
- return addProperty( value, ResourceFactory.createTypedLiteral(d));
+ public SecuredResource addLiteral(final Property value, final double d)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(value, ResourceFactory.createTypedLiteral(d));
}
/**
* Add the property <code>p</code> with the typed-literal value
* <code>o</code> to this resource, <i>ie</i> add (this, p, typed(o)) to
- * this's securedModel. Answer
- * this resource. The typed literal is equal to one constructed by using
+ * this's securedModel. Answer this resource. The typed literal is equal to
+ * one constructed by using
* <code>this.getModel().createTypedLiteral(o)</code>.
+ *
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addLiteral( final Property value, final float d )
- {
- return addProperty( value, ResourceFactory.createTypedLiteral(d) );
+ public SecuredResource addLiteral(final Property value, final float d)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(value, ResourceFactory.createTypedLiteral(d));
}
/**
* Add the property <code>p</code> with the pre-constructed Literal value
* <code>o</code> to this resource, <i>ie</i> add (this, p, o) to this's
* securedModel. Answer this resource. <b>NOTE</b> thjat this is distinct
- * from the
- * other addLiteral methods in that the Literal is not turned into a
- * Literal.
+ * from the other addLiteral methods in that the Literal is not turned into
+ * a Literal.
+ *
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addLiteral( final Property p, final Literal o )
- {
- return addProperty( p, o );
+ public SecuredResource addLiteral(final Property p, final Literal o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(p, o);
}
/**
* Add the property <code>p</code> with the typed-literal value
* <code>o</code> to this resource, <i>ie</i> add (this, p, typed(o)) to
- * this's securedModel. Answer
- * this resource. The typed literal is equal to one constructed by using
+ * this's securedModel. Answer this resource. The typed literal is equal to
+ * one constructed by using
* <code>this.getModel().createTypedLiteral(o)</code>.
+ *
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addLiteral( final Property p, final long o )
- {
- return addProperty( p, ResourceFactory.createTypedLiteral(o));
+ public SecuredResource addLiteral(final Property p, final long o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(p, ResourceFactory.createTypedLiteral(o));
}
/**
* Add the property <code>p</code> with the typed-literal value
* <code>o</code> to this resource, <i>ie</i> add (this, p, typed(o)) to
- * this's securedModel. Answer
- * this resource. The typed literal is equal to one constructed by using
+ * this's securedModel. Answer this resource. The typed literal is equal to
+ * one constructed by using
* <code>this.getModel().createTypedLiteral(o)</code>.
+ *
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addLiteral( final Property p, final Object o )
- {
- return addProperty( p, ResourceFactory.createTypedLiteral(o));
+ public SecuredResource addLiteral(final Property p, final Object o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(p, ResourceFactory.createTypedLiteral(o));
}
/**
@@ -236,10 +261,14 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @param o
* The value of the property to be added.
* @return This resource to allow cascading calls.
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addProperty( final Property p, final RDFNode o )
- {
+ public SecuredResource addProperty(final Property p, final RDFNode o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(holder.getBaseItem().asNode(), p.asNode(),
o.asNode()));
@@ -260,11 +289,15 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @param o
* The value of the property to be added.
* @return This resource to allow cascading calls.
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addProperty( final Property p, final String o )
- {
- return addProperty( p, o, "");
+ public SecuredResource addProperty(final Property p, final String o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
+ return addProperty(p, o, "");
}
/**
@@ -282,11 +315,15 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @param datatype
* The datatype
* @return This resource to allow cascading calls.
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addProperty( final Property p, final String lexicalForm,
- final RDFDatatype datatype )
- {
+ public SecuredResource addProperty(final Property p,
+ final String lexicalForm, final RDFDatatype datatype)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
final Literal l = ResourceFactory.createTypedLiteral(lexicalForm,
datatype);
@@ -311,27 +348,28 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @param l
* the language of the property
* @return This resource to allow cascading calls.
+ * @throws UpdadeDeniedException
+ * @throws AddDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource addProperty( final Property p, final String o,
- final String l )
- {
+ public SecuredResource addProperty(final Property p, final String o,
+ final String l) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(holder.getBaseItem().asNode(), p.asNode(),
- NodeFactory.createLiteral(o, l, false)));
+ NodeFactory.createLiteral(o, l, false)));
holder.getBaseItem().addProperty(p, o, l);
return holder.getSecuredItem();
}
@Override
- public Literal asLiteral()
- {
+ public Literal asLiteral() {
throw new LiteralRequiredException(asNode());
}
@Override
- public SecuredResource asResource()
- {
+ public SecuredResource asResource() {
return holder.getSecuredItem();
}
@@ -341,24 +379,34 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @return This resource to permit cascading.
*/
@Override
- public SecuredResource begin()
- {
+ public SecuredResource begin() {
holder.getBaseItem().begin();
return holder.getSecuredItem();
}
- public boolean canReadProperty( final Node p )
- {
+ /**
+ * @param p The property to test.
+ * @return true if p can be read as a property with an ANY value
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ */
+ public boolean canReadProperty(final Node p) throws ReadDeniedException,
+ AuthenticationRequiredException {
return canRead(new Triple(holder.getBaseItem().asNode(), p, Node.ANY));
}
- protected void checkReadProperty( final Node p )
- {
- if (!canReadProperty(p))
- {
- throw new ReadDeniedException(SecuredItem.Util.triplePermissionMsg(getModelNode()),
- new Triple(holder.getBaseItem().asNode(), p,
- Node.ANY));
+ /**
+ *
+ * @param p
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ */
+ protected void checkReadProperty(final Node p) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ if (!canReadProperty(p)) {
+ throw new ReadDeniedException(
+ SecuredItem.Util.triplePermissionMsg(getModelNode()),
+ new Triple(holder.getBaseItem().asNode(), p, Node.ANY));
}
}
@@ -368,8 +416,7 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @return This resource to permit cascading.
*/
@Override
- public SecuredResource commit()
- {
+ public SecuredResource commit() {
holder.getBaseItem().commit();
return holder.getSecuredItem();
}
@@ -389,10 +436,12 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* </p>
*
* @return A unique id for an anonymous resource.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public AnonId getId()
- {
+ public AnonId getId() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getId();
@@ -402,10 +451,12 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* Returns the name of this resource within its namespace.
*
* @return The name of this property within its namespace.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public String getLocalName()
- {
+ public String getLocalName() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getLocalName();
}
@@ -414,75 +465,68 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* Returns the namespace associated with this resource.
*
* @return The namespace for this property.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public String getNameSpace()
- {
+ public String getNameSpace() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getNameSpace();
}
/**
* Answer some statement (this, p, O) in the associated securedModel. If
- * there are
- * several
- * such statements, any one of them may be returned. If no such statements
- * exist,
- * null is returned - in this is differs from getRequiredProperty.
+ * there are several such statements, any one of them may be returned. If no
+ * such statements exist, null is returned - in this is differs from
+ * getRequiredProperty.
*
* @param p
* the property sought
* @return a statement (this, p, O), or null if no such statements exist
* here
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredStatement getProperty( final Property p )
- {
+ public SecuredStatement getProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem()
.listProperties(p)
.filterKeep(new PermStatementFilter(Action.Read, this));
- try
- {
- if (iter.hasNext())
- {
+ try {
+ if (iter.hasNext()) {
return org.apache.jena.permissions.model.impl.SecuredStatementImpl
.getInstance(getModel(), iter.next());
- }
- else
- {
+ } else {
return null;
}
- }
- finally
- {
+ } finally {
iter.close();
}
}
/**
- * Answer some resource R for which this.hasProperty( p, R ),
- * or null if no such R exists.
+ * Answer some resource R for which this.hasProperty( p, R ), or null if no
+ * such R exists.
+ *
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource getPropertyResourceValue( final Property p )
- {
+ public SecuredResource getPropertyResourceValue(final Property p)
+ throws AuthenticationRequiredException {
final SecuredStatementIterator iter = listProperties(p);
- try
- {
- while (iter.hasNext())
- {
+ try {
+ while (iter.hasNext()) {
final Statement s = iter.next();
- if (s.getObject().isResource())
- {
+ if (s.getObject().isResource()) {
return SecuredResourceImpl.getInstance(getModel(), s
.getObject().asResource());
}
}
return null;
- }
- finally
- {
+ } finally {
iter.close();
}
}
@@ -503,55 +547,54 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @return some (this, p, ?O) statement if one exists
* @throws PropertyNotFoundException
* if no such statement found
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredStatement getRequiredProperty( final Property p )
- throws PropertyNotFoundException
- {
+ public SecuredStatement getRequiredProperty(final Property p)
+ throws PropertyNotFoundException, ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem()
.listProperties(p)
.filterKeep(new PermStatementFilter(Action.Read, this));
- try
- {
- if (iter.hasNext())
- {
+ try {
+ if (iter.hasNext()) {
return org.apache.jena.permissions.model.impl.SecuredStatementImpl
.getInstance(getModel(), iter.next());
- }
- else
- {
+ } else {
throw new PropertyNotFoundException(p);
}
- }
- finally
- {
+ } finally {
iter.close();
}
- // return org.apache.jena.security.model.impl.Factory.getInstance(
- // this, holder.getBaseItem().getRequiredProperty(p));
}
/**
* Return the URI of the resource, or null if it's a bnode.
*
* @return The URI of the resource, or null if it's a bnode.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public String getURI()
- {
+ public String getURI() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getURI();
}
/**
- * Answer true iff this resource has the value <code>o</code> for
- * property <code>p</code>. <code>o</code> is interpreted as
- * a typed literal with the appropriate RDF type.
+ * Answer true iff this resource has the value <code>o</code> for property
+ * <code>p</code>. <code>o</code> is interpreted as a typed literal with the
+ * appropriate RDF type.
+ *
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasLiteral( final Property p, final boolean o )
- {
+ public boolean hasLiteral(final Property p, final boolean o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(new Triple(holder.getBaseItem().asNode(), p.asNode(),
ResourceFactory.createTypedLiteral(o).asNode()));
@@ -559,13 +602,16 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
}
/**
- * Answer true iff this resource has the value <code>o</code> for
- * property <code>p</code>. <code>o</code> is interpreted as
- * a typed literal with the appropriate RDF type.
+ * Answer true iff this resource has the value <code>o</code> for property
+ * <code>p</code>. <code>o</code> is interpreted as a typed literal with the
+ * appropriate RDF type.
+ *
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasLiteral( final Property p, final char o )
- {
+ public boolean hasLiteral(final Property p, final char o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(new Triple(holder.getBaseItem().asNode(), p.asNode(),
ResourceFactory.createTypedLiteral(o).asNode()));
@@ -573,13 +619,16 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
}
/**
- * Answer true iff this resource has the value <code>o</code> for
- * property <code>p</code>. <code>o</code> is interpreted as
- * a typed literal with the appropriate RDF type.
+ * Answer true iff this resource has the value <code>o</code> for property
+ * <code>p</code>. <code>o</code> is interpreted as a typed literal with the
+ * appropriate RDF type.
+ *
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasLiteral( final Property p, final double o )
- {
+ public boolean hasLiteral(final Property p, final double o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(new Triple(holder.getBaseItem().asNode(), p.asNode(),
ResourceFactory.createTypedLiteral(o).asNode()));
@@ -587,13 +636,16 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
}
/**
- * Answer true iff this resource has the value <code>o</code> for
- * property <code>p</code>. <code>o</code> is interpreted as
- * a typed literal with the appropriate RDF type.
+ * Answer true iff this resource has the value <code>o</code> for property
+ * <code>p</code>. <code>o</code> is interpreted as a typed literal with the
+ * appropriate RDF type.
+ *
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasLiteral( final Property p, final float o )
- {
+ public boolean hasLiteral(final Property p, final float o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(new Triple(holder.getBaseItem().asNode(), p.asNode(),
ResourceFactory.createTypedLiteral(o).asNode()));
@@ -601,13 +653,16 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
}
/**
- * Answer true iff this resource has the value <code>o</code> for
- * property <code>p</code>. <code>o</code> is interpreted as
- * a typed literal with the appropriate RDF type.
+ * Answer true iff this resource has the value <code>o</code> for property
+ * <code>p</code>. <code>o</code> is interpreted as a typed literal with the
+ * appropriate RDF type.
+ *
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasLiteral( final Property p, final long o )
- {
+ public boolean hasLiteral(final Property p, final long o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(new Triple(holder.getBaseItem().asNode(), p.asNode(),
ResourceFactory.createTypedLiteral(o).asNode()));
@@ -615,13 +670,16 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
}
/**
- * Answer true iff this resource has the value <code>o</code> for
- * property <code>p</code>. <code>o</code> is interpreted as
- * a typed literal with the appropriate RDF type.
+ * Answer true iff this resource has the value <code>o</code> for property
+ * <code>p</code>. <code>o</code> is interpreted as a typed literal with the
+ * appropriate RDF type.
+ *
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasLiteral( final Property p, final Object o )
- {
+ public boolean hasLiteral(final Property p, final Object o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(new Triple(holder.getBaseItem().asNode(), p.asNode(),
ResourceFactory.createTypedLiteral(o).asNode()));
@@ -633,22 +691,21 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
*
* @param p
* The property sought.
- * @return true if and only if this resource has at least one
- * value for the property.
+ * @return true if and only if this resource has at least one value for the
+ * property.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasProperty( final Property p )
- {
+ public boolean hasProperty(final Property p) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem()
.listProperties(p)
.filterKeep(new PermStatementFilter(Action.Read, this));
- try
- {
+ try {
return iter.hasNext();
- }
- finally
- {
+ } finally {
iter.close();
}
}
@@ -660,22 +717,20 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* The property sought.
* @param o
* The value of the property sought.
- * @return true if and only if this resource has property p with
- * value o.
+ * @return true if and only if this resource has property p with value o.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasProperty( final Property p, final RDFNode o )
- {
+ public boolean hasProperty(final Property p, final RDFNode o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem()
.getModel().listStatements(this, p, o)
.filterKeep(new PermStatementFilter(Action.Read, this));
- try
- {
+ try {
return iter.hasNext();
- }
- finally
- {
+ } finally {
iter.close();
}
}
@@ -687,22 +742,20 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* The property sought.
* @param o
* The value of the property sought.
- * @return true if and only if this resource has property p with
- * value o.
+ * @return true if and only if this resource has property p with value o.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasProperty( final Property p, final String o )
- {
+ public boolean hasProperty(final Property p, final String o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem()
.getModel().listStatements(this, p, o)
.filterKeep(new PermStatementFilter(Action.Read, this));
- try
- {
+ try {
return iter.hasNext();
- }
- finally
- {
+ } finally {
iter.close();
}
}
@@ -716,41 +769,41 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* The value of the property sought.
* @param l
* The language of the property sought.
- * @return true if and only if this resource has property p with
- * value o.
+ * @return true if and only if this resource has property p with value o.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasProperty( final Property p, final String o, final String l )
- {
+ public boolean hasProperty(final Property p, final String o, final String l)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final Literal ll = holder.getBaseItem().getModel().createLiteral(o, l);
final ExtendedIterator<Statement> iter = holder.getBaseItem()
.getModel().listStatements(this, p, ll)
.filterKeep(new PermStatementFilter(Action.Read, this));
- try
- {
+ try {
return iter.hasNext();
- }
- finally
- {
+ } finally {
iter.close();
}
}
/**
- * Answer true iff this Resource is a URI resource with the given URI.
- * Using this is preferred to using getURI() and .equals().
+ * Answer true iff this Resource is a URI resource with the given URI. Using
+ * this is preferred to using getURI() and .equals().
+ *
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean hasURI( final String uri )
- {
+ public boolean hasURI(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().hasURI(uri);
}
@Override
- public Resource inModel( final Model m )
- {
+ public Resource inModel(final Model m) {
return (Resource) super.inModel(m);
}
@@ -764,10 +817,12 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* </p>
*
* @return An iterator over all the statements about this object.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
public SecuredStatementIterator listProperties()
- {
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(getModel(), holder.getBaseItem()
.listProperties());
@@ -784,10 +839,12 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @param p
* The predicate sought.
* @return An iterator over the statements.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredStatementIterator listProperties( final Property p )
- {
+ public SecuredStatementIterator listProperties(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(getModel(), holder.getBaseItem()
.listProperties(p));
@@ -801,29 +858,25 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* @param p
* the property to remove
* @return this resource, to permit cascading
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource removeAll( final Property p )
- {
+ public SecuredResource removeAll(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkUpdate();
if (!canDelete(new Triple(holder.getBaseItem().asNode(), p.asNode(),
- Node.ANY)))
- {
+ Node.ANY))) {
final StmtIterator iter = holder.getBaseItem().listProperties(p);
- try
- {
- if (!iter.hasNext())
- {
+ try {
+ if (!iter.hasNext()) {
// thre arn't any to delete -- so return
return holder.getSecuredItem();
}
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
checkDelete(iter.next().asTriple());
}
- }
- finally
- {
+ } finally {
iter.close();
}
}
@@ -836,29 +889,25 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
* securedModel.
*
* @return This resource to permit cascading.
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public SecuredResource removeProperties()
- {
+ public SecuredResource removeProperties() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (!canDelete(new Triple(holder.getBaseItem().asNode(), Node.ANY,
- Node.ANY)))
- {
+ Node.ANY))) {
final StmtIterator iter = holder.getBaseItem().listProperties();
- try
- {
- if (!iter.hasNext())
- {
+ try {
+ if (!iter.hasNext()) {
// thre arn't any to delete -- so return
return holder.getSecuredItem();
}
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
checkDelete(iter.next().asTriple());
}
- }
- finally
- {
+ } finally {
iter.close();
}
}
@@ -869,22 +918,19 @@ public class SecuredResourceImpl extends SecuredRDFNodeImpl implements
/**
* Return a string representation of the resource.
*
- * Returns the URI of the resource unless the resource is anonymous
- * in which case it returns the id of the resource enclosed in square
- * brackets.
+ * Returns the URI of the resource unless the resource is anonymous in which
+ * case it returns the id of the resource enclosed in square brackets.
*
- * @return Return a string representation of the resource.
- * if it is anonymous.
+ * @return Return a string representation of the resource. if it is
+ * anonymous.
*/
@Override
- public String toString()
- {
+ public String toString() {
return holder.getBaseItem().toString();
}
@Override
- public Object visitWith( final RDFVisitor rv )
- {
+ public Object visitWith(final RDFVisitor rv) {
return isAnon() ? rv.visitBlank(this, getId()) : rv.visitURI(this,
getURI());
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSelector.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSelector.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSelector.java
index a6593e8..906a542 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSelector.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredSelector.java
@@ -18,63 +18,58 @@
package org.apache.jena.permissions.model.impl;
import org.apache.jena.permissions.SecuredItem;
-import org.apache.jena.rdf.model.* ;
+import org.apache.jena.rdf.model.*;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.ReadDeniedException;
-public class SecuredSelector implements Selector
-{
+public class SecuredSelector implements Selector {
private final SecuredItem securedItem;
private final Selector selector;
- public SecuredSelector( final SecuredItem securedItem )
- {
+ public SecuredSelector(final SecuredItem securedItem) {
this(securedItem, new SimpleSelector());
}
- public SecuredSelector( final SecuredItem securedItem,
- final Selector selector )
- {
+ public SecuredSelector(final SecuredItem securedItem,
+ final Selector selector) {
this.securedItem = securedItem;
this.selector = selector;
}
@Override
- public RDFNode getObject()
- {
+ public RDFNode getObject() {
return selector.getObject();
}
@Override
- public Property getPredicate()
- {
+ public Property getPredicate() {
return selector.getPredicate();
}
@Override
- public Resource getSubject()
- {
+ public Resource getSubject() {
return selector.getSubject();
}
@Override
- public boolean isSimple()
- {
+ public boolean isSimple() {
return selector.isSimple();
}
/**
* This method is designed to be over ridden by subclasses to define
- * application
- * specific constraints on the statements selected.
+ * application specific constraints on the statements selected.
*
* @param s
* the statement to be tested
* @return true if the statement satisfies the constraint
+ * @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
*/
@Override
- public boolean test( final Statement s )
- {
- if (securedItem.canRead(s))
- {
+ public boolean test(final Statement s) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ if (securedItem.canRead(s)) {
return selector.test(s);
}
return false;
[09/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredModel.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredModel.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredModel.java
index f0088aa..e16f735 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredModel.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredModel.java
@@ -17,27 +17,28 @@
*/
package org.apache.jena.permissions.model;
-import java.io.InputStream ;
-import java.io.OutputStream ;
-import java.io.Reader ;
-import java.io.Writer ;
-import java.util.Calendar ;
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.datatypes.RDFDatatype ;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.Triple ;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.Triple;
import org.apache.jena.permissions.graph.SecuredGraph;
import org.apache.jena.permissions.graph.SecuredPrefixMapping;
import org.apache.jena.permissions.model.impl.SecuredNodeIterator;
import org.apache.jena.permissions.model.impl.SecuredRSIterator;
import org.apache.jena.permissions.model.impl.SecuredResIterator;
import org.apache.jena.permissions.model.impl.SecuredStatementIterator;
-import org.apache.jena.rdf.model.* ;
+import org.apache.jena.rdf.model.*;
import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
-import org.apache.jena.shared.PropertyNotFoundException ;
+import org.apache.jena.shared.PropertyNotFoundException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
@@ -46,8 +47,7 @@ import org.apache.jena.shared.UpdateDeniedException;
*
* Use the SecuredModel.Factory to create instances
*/
-public interface SecuredModel extends Model, SecuredPrefixMapping
-{
+public interface SecuredModel extends Model, SecuredPrefixMapping {
@Override
public SecuredModel abort();
@@ -57,184 +57,236 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Create for each statement as a triple.
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final List<Statement> statements )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final List<Statement> statements)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create for each statement in the securedModel as a triple.
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Model m ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Model m) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create the triple SecTriple(s,p,o)
+ * @sec.triple Create the triple Triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Resource s, final Property p, final RDFNode o )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Resource s, final Property p, final RDFNode o)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create the triple SecTriple(s,p,o)
+ * @sec.triple Create the triple Triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Resource s, final Property p, final String o )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Resource s, final Property p, final String o)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create the triple SecTriple(s,p,o)
+ * @sec.triple Create the triple Triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Resource s, final Property p,
- final String o, final boolean wellFormed )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Resource s, final Property p, final String o,
+ final boolean wellFormed) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create the triple SecTriple(s,p,literal(lex,datatype))
+ * @sec.triple Create the triple Triple(s,p,literal(lex,datatype))
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Resource s, final Property p,
- final String lex, final RDFDatatype datatype )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Resource s, final Property p,
+ final String lex, final RDFDatatype datatype)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create the triple SecTriple(s,p,literal(o,l,false))
+ * @sec.triple Create the triple Triple(s,p,literal(o,l,false))
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Resource s, final Property p,
- final String o, final String l ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Resource s, final Property p, final String o,
+ final String l) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create the statement as a triple
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Statement s ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Statement s) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create all the statements as triples.
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final Statement[] statements )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final Statement[] statements)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create all the statements as triples.
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel add( final StmtIterator iter )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel add(final StmtIterator iter) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel addLiteral( final Resource s, final Property p,
- final boolean o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final boolean o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel addLiteral( final Resource s, final Property p,
- final char o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final char o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel addLiteral( final Resource s, final Property p,
- final double o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final double o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel addLiteral( final Resource s, final Property p,
- final float o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final float o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel addLiteral( final Resource s, final Property p,
- final int o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final int o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel addLiteral( final Resource s, final Property p,
- final Literal o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final Literal o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel addLiteral( final Resource s, final Property p,
- final long o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final long o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create triple(s,p,o)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
@Deprecated
- public SecuredModel addLiteral( final Resource s, final Property p,
- final Object o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredModel addLiteral(final Resource s, final Property p,
+ final Object o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
@Override
- public SecuredRDFNode asRDFNode( final Node n );
+ public SecuredRDFNode asRDFNode(final Node n);
@Override
/**
@@ -245,9 +297,12 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @throws UpdateDeniedException
* @throws AddDeniedException
* @throws ReadException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public SecuredStatement asStatement( final Triple t )
- throws UpdateDeniedException, AddDeniedException, ReadDeniedException;
+ public SecuredStatement asStatement(final Triple t)
+ throws UpdateDeniedException, AddDeniedException,
+ ReadDeniedException, AuthenticationRequiredException;
@Override
public SecuredModel begin();
@@ -257,605 +312,737 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, SecNode.ANY )
+ * @sec.triple Read Triple( s, p, SecNode.ANY )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Resource s, final Property p )
- throws ReadDeniedException;
+ public boolean contains(final Resource s, final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, o )
+ * @sec.triple Read Triple( s, p, o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Resource s, final Property p, final RDFNode o )
- throws ReadDeniedException;
+ public boolean contains(final Resource s, final Property p, final RDFNode o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, o )
+ * @sec.triple Read Triple( s, p, o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Resource s, final Property p, final String o )
- throws ReadDeniedException;
+ public boolean contains(final Resource s, final Property p, final String o)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, literal(o,l,null) )
+ * @sec.triple Read Triple( s, p, literal(o,l,null) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Resource s, final Property p,
- final String o, final String l ) throws ReadDeniedException;
+ public boolean contains(final Resource s, final Property p, final String o,
+ final String l) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read s as a triple with null replaced by SecNode.ANY
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Statement s ) throws ReadDeniedException;
+ public boolean contains(final Statement s) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read every statement in securedModel.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsAll( final Model model ) throws ReadDeniedException;
+ public boolean containsAll(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read every statement
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsAll( final StmtIterator iter )
- throws ReadDeniedException;
+ public boolean containsAll(final StmtIterator iter)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read any statement in securedModel to be included in check, if
- * no
- * statement in securedModel can be read will return false;
+ * @sec.triple Read any statement in securedModel to be included in check,
+ * if no statement in securedModel can be read will return
+ * false;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsAny( final Model model )
- throws ReadDeniedException;
+ public boolean containsAny(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read any statement in iter to be included in check, if no
- * statement in iter can be read will return false;
+ * statement in iter can be read will return false;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsAny( final StmtIterator iter )
- throws ReadDeniedException;
+ public boolean containsAny(final StmtIterator iter)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, literal(o) )
+ * @sec.triple Read Triple( s, p, literal(o) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsLiteral( final Resource s, final Property p,
- final boolean o ) throws ReadDeniedException;
+ public boolean containsLiteral(final Resource s, final Property p,
+ final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, literal(o) )
+ * @sec.triple Read Triple( s, p, literal(o) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsLiteral( final Resource s, final Property p,
- final char o ) throws ReadDeniedException;
+ public boolean containsLiteral(final Resource s, final Property p,
+ final char o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, literal(o) )
+ * @sec.triple Read Triple( s, p, literal(o) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsLiteral( final Resource s, final Property p,
- final double o ) throws ReadDeniedException;
+ public boolean containsLiteral(final Resource s, final Property p,
+ final double o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, literal(o) )
+ * @sec.triple Read Triple( s, p, literal(o) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsLiteral( final Resource s, final Property p,
- final float o ) throws ReadDeniedException;
+ public boolean containsLiteral(final Resource s, final Property p,
+ final float o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, literal(o) )
+ * @sec.triple Read Triple( s, p, literal(o) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsLiteral( final Resource s, final Property p,
- final int o ) throws ReadDeniedException;
+ public boolean containsLiteral(final Resource s, final Property p,
+ final int o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, literal(o) )
+ * @sec.triple Read Triple( s, p, literal(o) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsLiteral( final Resource s, final Property p,
- final long o ) throws ReadDeniedException;
+ public boolean containsLiteral(final Resource s, final Property p,
+ final long o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, typedLiteral(o) )
+ * @sec.triple Read Triple( s, p, typedLiteral(o) )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsLiteral( final Resource s, final Property p,
- final Object o ) throws ReadDeniedException;
+ public boolean containsLiteral(final Resource s, final Property p,
+ final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( s, p, resource) where SecTriple(s,p,resource) is in the
- * securedModel.
+ * @sec.triple Read Triple( s, p, resource) where Triple(s,p,resource) is in
+ * the securedModel.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean containsResource( final RDFNode r )
- throws ReadDeniedException;
+ public boolean containsResource(final RDFNode r)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( SecNode.ANY, RDF.type, Rdf.Alt)
+ * @sec.triple Create Triple( SecNode.ANY, RDF.type, Rdf.Alt)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt createAlt() throws AddDeniedException, UpdateDeniedException;
+ public SecuredAlt createAlt() throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( uri, RDF.type, Rdf.Alt)
+ * @sec.triple Create Triple( uri, RDF.type, Rdf.Alt)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt createAlt( final String uri )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredAlt createAlt(final String uri) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( SecNode.ANY, RDF.type, Rdf.Bag)
+ * @sec.triple Create Triple( SecNode.ANY, RDF.type, Rdf.Bag)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredBag createBag() throws AddDeniedException, UpdateDeniedException;
+ public SecuredBag createBag() throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( uri, RDF.type, Rdf.Bag)
+ * @sec.triple Create Triple( uri, RDF.type, Rdf.Bag)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredBag createBag( final String uri )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredBag createBag(final String uri) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFList createList() throws AddDeniedException, UpdateDeniedException;
+ public SecuredRDFList createList() throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( RDF.nil, SecNode.IGNORE, SecNode.IGNORE)
- * @sec.triple Create for each member SecTriple(SecNode.ANY,
- * RDF.first.asNode(),
- * member.asNode())
- * @sec.triple Create SecTriple(SecNode.ANY, RDF.rest.asNode(), SecNode.ANY)
+ * @sec.triple Create Triple( RDF.nil, SecNode.IGNORE, SecNode.IGNORE)
+ * @sec.triple Create for each member Triple(SecNode.ANY,
+ * RDF.first.asNode(), member.asNode())
+ * @sec.triple Create Triple(SecNode.ANY, RDF.rest.asNode(), SecNode.ANY)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFList createList( final Iterator<? extends RDFNode> members )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredRDFList createList(final Iterator<? extends RDFNode> members)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( RDF.nil, SecNode.IGNORE, SecNode.IGNORE)
- * @sec.triple Create for each member SecTriple(SecNode.ANY,
- * RDF.first.asNode(),
- * member.asNode())
- * @sec.triple Create SecTriple(SecNode.ANY, RDF.rest.asNode(), SecNode.ANY)
+ * @sec.triple Create Triple( RDF.nil, SecNode.IGNORE, SecNode.IGNORE)
+ * @sec.triple Create for each member Triple(SecNode.ANY,
+ * RDF.first.asNode(), member.asNode())
+ * @sec.triple Create Triple(SecNode.ANY, RDF.rest.asNode(), SecNode.ANY)
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFList createList( final RDFNode[] members )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredRDFList createList(final RDFNode[] members)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
+ * @sec.triple Create Triple( s,p,o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createLiteralStatement( final Resource s,
- final Property p, final boolean o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createLiteralStatement(final Resource s,
+ final Property p, final boolean o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
+ * @sec.triple Create Triple( s,p,o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createLiteralStatement( final Resource s,
- final Property p, final char o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createLiteralStatement(final Resource s,
+ final Property p, final char o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
+ * @sec.triple Create Triple( s,p,o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createLiteralStatement( final Resource s,
- final Property p, final double o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createLiteralStatement(final Resource s,
+ final Property p, final double o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
+ * @sec.triple Create Triple( s,p,o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createLiteralStatement( final Resource s,
- final Property p, final float o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createLiteralStatement(final Resource s,
+ final Property p, final float o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
+ * @sec.triple Create Triple( s,p,o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createLiteralStatement( final Resource s,
- final Property p, final int o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createLiteralStatement(final Resource s,
+ final Property p, final int o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
+ * @sec.triple Create Triple( s,p,o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createLiteralStatement( final Resource s,
- final Property p, final long o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createLiteralStatement(final Resource s,
+ final Property p, final long o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
+ * @sec.triple Create Triple( s,p,o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createLiteralStatement( final Resource s,
- final Property p, final Object o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createLiteralStatement(final Resource s,
+ final Property p, final Object o) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
- * @throws UpdateDeniedException
- * @throws AddDeniedException
- */
@Override
- public Property createProperty( final String uri )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredProperty createProperty(final String uri);
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( s,p,o )
- * @throws UpdateDeniedException
- * @throws AddDeniedException
- */
@Override
- public Property createProperty( final String nameSpace,
- final String localName ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredProperty createProperty(final String nameSpace,
+ final String localName);
/**
* @sec.graph Update
* @sec.triple Read s as a triple
- * @sec.triple create SecTriple( SecNode.Future, RDF.subject, t.getSubject()
- * )
- * @sec.triple create SecTriple( SecNode.Future, RDF.subject,
- * t.getPredicate() )
- * @sec.triple create SecTriple( SecNode.Future, RDF.subject, t.getObject() )
+ * @sec.triple create Triple( SecNode.Future, RDF.subject, t.getSubject() )
+ * @sec.triple create Triple( SecNode.Future, RDF.subject, t.getPredicate()
+ * )
+ * @sec.triple create Triple( SecNode.Future, RDF.subject, t.getObject() )
* @throws UpdateDeniedException
* @throws ReadDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public ReifiedStatement createReifiedStatement( final Statement s )
- throws AddDeniedException, UpdateDeniedException, ReadDeniedException;
+ public ReifiedStatement createReifiedStatement(final Statement s)
+ throws AddDeniedException, UpdateDeniedException,
+ ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Read s as a triple
- * @sec.triple create SecTriple( uri, RDF.subject, t.getSubject() )
- * @sec.triple create SecTriple( uri, RDF.subject, t.getPredicate() )
- * @sec.triple create SecTriple( uri, RDF.subject, t.getObject() )
+ * @sec.triple create Triple( uri, RDF.subject, t.getSubject() )
+ * @sec.triple create Triple( uri, RDF.subject, t.getPredicate() )
+ * @sec.triple create Triple( uri, RDF.subject, t.getObject() )
* @throws UpdateDeniedException
* @throws ReadDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public ReifiedStatement createReifiedStatement( final String uri,
- final Statement s ) throws AddDeniedException, UpdateDeniedException, ReadDeniedException;
+ public ReifiedStatement createReifiedStatement(final String uri,
+ final Statement s) throws AddDeniedException,
+ UpdateDeniedException, ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Read s as a triple
- * @sec.triple Create SecTriple( SecNode.FUTURE, SecNode.IGNORE,
- * SecNode.IGNORE )
+ * @sec.triple Create Triple( SecNode.FUTURE, SecNode.IGNORE, SecNode.IGNORE
+ * )
* @throws UpdateDeniedException
* @throws ReadDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource createResource() throws AddDeniedException, UpdateDeniedException, ReadDeniedException;
+ public SecuredResource createResource() throws AddDeniedException,
+ UpdateDeniedException, ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Read s as a triple
- * @sec.triple Create SecTriple( Anonymous(id), SecNode.IGNORE,
- * SecNode.IGNORE )
+ * @sec.triple Create Triple( Anonymous(id), SecNode.IGNORE, SecNode.IGNORE
+ * )
* @throws UpdateDeniedException
* @throws ReadDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource createResource( final AnonId id )
- throws AddDeniedException, UpdateDeniedException, ReadDeniedException;
+ public SecuredResource createResource(final AnonId id)
+ throws AddDeniedException, UpdateDeniedException,
+ ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( SecNode.FUTURE, RDF.type, type )
+ * @sec.triple Create Triple( SecNode.FUTURE, RDF.type, type )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource createResource( final Resource type )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredResource createResource(final Resource type)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
@Override
@Deprecated
- public SecuredResource createResource( final ResourceF f );
+ public SecuredResource createResource(final ResourceF f);
@Override
- public SecuredResource createResource( final String uri );
+ public SecuredResource createResource(final String uri);
/**
* @sec.graph Update if uri exists
* @sec.graph Create if uri does not exist
- * @sec.triple Read if SecTriple( uri, RDF.type, type ) exists
- * @sec.triple Create if SecTriple( uri, RDF.type, type ) does not exist
+ * @sec.triple Read if Triple( uri, RDF.type, type ) exists
+ * @sec.triple Create if Triple( uri, RDF.type, type ) does not exist
* @throws UpdateDeniedException
* @throws ReadDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource createResource( final String uri, final Resource type )
- throws AddDeniedException, UpdateDeniedException, ReadDeniedException;
+ public SecuredResource createResource(final String uri, final Resource type)
+ throws AddDeniedException, UpdateDeniedException,
+ ReadDeniedException, AuthenticationRequiredException;
@Override
@Deprecated
- public SecuredResource createResource( final String uri, final ResourceF f );
+ public SecuredResource createResource(final String uri, final ResourceF f);
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( SecNode.FUTURE, RDF.type, RDF.Alt )
+ * @sec.triple Create Triple( SecNode.FUTURE, RDF.type, RDF.Alt )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq createSeq() throws AddDeniedException, UpdateDeniedException;
+ public SecuredSeq createSeq() throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( uri, RDF.type, RDF.Alt )
+ * @sec.triple Create Triple( uri, RDF.type, RDF.Alt )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq createSeq( final String uri )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredSeq createSeq(final String uri) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s, p, o )
+ * @sec.triple Create Triple( s, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createStatement( final Resource s,
- final Property p, final RDFNode o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createStatement(final Resource s, final Property p,
+ final RDFNode o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s, p, o )
+ * @sec.triple Create Triple( s, p, o )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createStatement( final Resource s,
- final Property p, final String o ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createStatement(final Resource s, final Property p,
+ final String o) throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s, p, o )
+ * @sec.triple Create Triple( s, p, o )
* @throws AddDeniedException
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createStatement( final Resource s,
- final Property p, final String o, final boolean wellFormed )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createStatement(final Resource s, final Property p,
+ final String o, final boolean wellFormed)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s, p, literal(o,l,false ))
+ * @sec.triple Create Triple( s, p, literal(o,l,false ))
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createStatement( final Resource s,
- final Property p, final String o, final String l )
- throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createStatement(final Resource s, final Property p,
+ final String o, final String l) throws AddDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
- * @sec.triple Create SecTriple( s, p, literal(o,l,wellFormed )
+ * @sec.triple Create Triple( s, p, literal(o,l,wellFormed )
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement createStatement( final Resource s,
- final Property p, final String o, final String l,
- final boolean wellFormed ) throws AddDeniedException, UpdateDeniedException;
+ public SecuredStatement createStatement(final Resource s, final Property p,
+ final String o, final String l, final boolean wellFormed)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
@Override
- public SecuredLiteral createTypedLiteral( final boolean v );
+ public SecuredLiteral createTypedLiteral(final boolean v);
@Override
- public Literal createTypedLiteral( final Calendar d );
+ public Literal createTypedLiteral(final Calendar d);
@Override
- public SecuredLiteral createTypedLiteral( final char v );
+ public SecuredLiteral createTypedLiteral(final char v);
@Override
- public SecuredLiteral createTypedLiteral( final double v );
+ public SecuredLiteral createTypedLiteral(final double v);
@Override
- public SecuredLiteral createTypedLiteral( final float v );
+ public SecuredLiteral createTypedLiteral(final float v);
@Override
- public SecuredLiteral createTypedLiteral( final int v );
+ public SecuredLiteral createTypedLiteral(final int v);
@Override
- public SecuredLiteral createTypedLiteral( final long v );
+ public SecuredLiteral createTypedLiteral(final long v);
@Override
- public SecuredLiteral createTypedLiteral( final Object value );
+ public SecuredLiteral createTypedLiteral(final Object value);
@Override
- public SecuredLiteral createTypedLiteral( final Object value,
- final RDFDatatype dtype );
+ public SecuredLiteral createTypedLiteral(final Object value,
+ final RDFDatatype dtype);
@Override
- public SecuredLiteral createTypedLiteral( final Object value,
- final String typeURI );
+ public SecuredLiteral createTypedLiteral(final Object value,
+ final String typeURI);
@Override
- public SecuredLiteral createTypedLiteral( final String v );
+ public SecuredLiteral createTypedLiteral(final String v);
@Override
- public SecuredLiteral createTypedLiteral( final String lex,
- final RDFDatatype dtype );
+ public SecuredLiteral createTypedLiteral(final String lex,
+ final RDFDatatype dtype);
@Override
- public SecuredLiteral createTypedLiteral( final String lex,
- final String typeURI );
+ public SecuredLiteral createTypedLiteral(final String lex,
+ final String typeURI);
/**
* @sec.graph Read
* @sec.triple Read for every triple contributed to the difference.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Model difference( final Model model ) throws ReadDeniedException;
+ public Model difference(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read if read lock is requested
* @sec.graph Update if write lock is requested
* @throws ReadDeniedException
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void enterCriticalSection( final boolean readLockRequested ) throws ReadDeniedException, UpdateDeniedException;
+ public void enterCriticalSection(final boolean readLockRequested)
+ throws ReadDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String expandPrefix( final String prefixed ) throws ReadDeniedException;
+ public String expandPrefix(final String prefixed)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( resource, RDF.type, RDF.alt )
+ * @sec.triple Read Triple( resource, RDF.type, RDF.alt )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt getAlt( final Resource r ) throws ReadDeniedException;
+ public SecuredAlt getAlt(final Resource r) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( uri, RDF.type, RDF.alt )
+ * @sec.triple Read Triple( uri, RDF.type, RDF.alt )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt getAlt( final String uri ) throws ReadDeniedException;
+ public SecuredAlt getAlt(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read if statement exists
* @sec.graph Update if statement does not exist
* @sec.triple Read s as a triple
- * @sec.triple Read SecTriple( result, RDF.subject, s.getSubject() ) if
- * reification existed
- * @sec.triple Read SecTriple( result, RDF.predicate, s.getPredicate() ) if
- * reification existed
- * @sec.triple Read SecTriple( result, RDF.object, s.getObject() ) if
- * reification existed
- * @sec.triple Create SecTriple( result, RDF.subject, s.getSubject() ) if
- * reification did not exist.
- * @sec.triple Create SecTriple( result, RDF.redicate, s.getPredicate() ) if
- * reification did not exist
- * @sec.triple Create SecTriple( result, RDF.object, s.getObject() ) if
- * reification did not exist
+ * @sec.triple Read Triple( result, RDF.subject, s.getSubject() ) if
+ * reification existed
+ * @sec.triple Read Triple( result, RDF.predicate, s.getPredicate() ) if
+ * reification existed
+ * @sec.triple Read Triple( result, RDF.object, s.getObject() ) if
+ * reification existed
+ * @sec.triple Create Triple( result, RDF.subject, s.getSubject() ) if
+ * reification did not exist.
+ * @sec.triple Create Triple( result, RDF.redicate, s.getPredicate() ) if
+ * reification did not exist
+ * @sec.triple Create Triple( result, RDF.object, s.getObject() ) if
+ * reification did not exist
* @throws ReadDeniedException
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource getAnyReifiedStatement( final Statement s )
- throws AddDeniedException, ReadDeniedException, UpdateDeniedException;
+ public SecuredResource getAnyReifiedStatement(final Statement s)
+ throws AddDeniedException, ReadDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( resource, RDF.type, RDF.Bag )
+ * @sec.triple Read Triple( resource, RDF.type, RDF.Bag )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredBag getBag( final Resource r ) throws ReadDeniedException;
+ public SecuredBag getBag(final Resource r) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
- * @sec.triple Read SecTriple( uri, RDF.type, RDF.Bag )
+ * @sec.triple Read Triple( uri, RDF.type, RDF.Bag )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredBag getBag( final String uri ) throws ReadDeniedException;
+ public SecuredBag getBag(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
@Override
public SecuredGraph getGraph();
@@ -864,103 +1051,130 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.graph Read
* @sec.triple Read on the returned statement.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement getProperty( final Resource s, final Property p ) throws ReadDeniedException;
+ public SecuredStatement getProperty(final Resource s, final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Property getProperty( final String uri ) throws ReadDeniedException;
+ public Property getProperty(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Property getProperty( final String nameSpace, final String localName ) throws ReadDeniedException;
+ public Property getProperty(final String nameSpace, final String localName)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read if the node exists
* @sec.graph Update if the node does not exist
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFNode getRDFNode( final Node n ) throws ReadDeniedException;
+ public RDFNode getRDFNode(final Node n) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
- * .
- * If the PropertyNotFoundException was thrown by the enclosed securedModel
- * and the
- * user can not read SecTriple(s, p, SecNode.ANY) AccessDeniedExcepiton is
- * thrown,
- * otherwise the PropertyNotFoundException will be thrown.
+ * . If the PropertyNotFoundException was thrown by the enclosed
+ * securedModel and the user can not read Triple(s, p, SecNode.ANY)
+ * AccessDeniedExcepiton is thrown, otherwise the PropertyNotFoundException
+ * will be thrown.
*
* @sec.graph Read
* @sec.triple Read on the returned statement
- * @sec.triple Read on SecTriple(s, p, SecNode.ANY) if
- * PropertyNotFoundException
- * was thrown
+ * @sec.triple Read on Triple(s, p, SecNode.ANY) if
+ * PropertyNotFoundException was thrown
* @throws ReadDeniedException
* @throws PropertyNotFoundException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatement getRequiredProperty( final Resource s,
- final Property p ) throws PropertyNotFoundException, ReadDeniedException;
+ public SecuredStatement getRequiredProperty(final Resource s,
+ final Property p) throws PropertyNotFoundException,
+ ReadDeniedException, AuthenticationRequiredException;
@Override
- public SecuredResource getResource( final String uri );
+ public SecuredResource getResource(final String uri);
@Override
@Deprecated
- public SecuredResource getResource( final String uri, final ResourceF f );
+ public SecuredResource getResource(final String uri, final ResourceF f);
/**
*
* @sec.graph Read
- * @sec.triple Read on SecTriple(resource, RDF.type, RDF.Seq)
+ * @sec.triple Read on Triple(resource, RDF.type, RDF.Seq)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq getSeq( final Resource r ) throws ReadDeniedException;
+ public SecuredSeq getSeq(final Resource r) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read on SecTriple(uri, RDF.type, RDF.Seq)
+ * @sec.triple Read on Triple(uri, RDF.type, RDF.Seq)
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq getSeq( final String uri ) throws ReadDeniedException;
+ public SecuredSeq getSeq(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples contributed to the new securedModel.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Model intersection( final Model model ) throws ReadDeniedException;
+ public Model intersection(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isEmpty() throws ReadDeniedException;
+ public boolean isEmpty() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read all compared triples. Triples that can not be read will
- * not be compared.
+ * not be compared.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isIsomorphicWith( final Model g ) throws ReadDeniedException;
+ public boolean isIsomorphicWith(final Model g) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
@@ -968,405 +1182,512 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Read on s as triple
* @sec.triple Read on at least one set reified statements.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isReified( final Statement s ) throws ReadDeniedException;
+ public boolean isReified(final Statement s) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredStatementIterator listLiteralStatements(
final Resource subject, final Property predicate,
- final boolean object ) throws ReadDeniedException;
+ final boolean object) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredStatementIterator listLiteralStatements(
- final Resource subject, final Property predicate, final char object ) throws ReadDeniedException;
+ final Resource subject, final Property predicate, final char object)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredStatementIterator listLiteralStatements(
final Resource subject, final Property predicate,
- final double object ) throws ReadDeniedException;
+ final double object) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredStatementIterator listLiteralStatements(
- final Resource subject, final Property predicate, final float object ) throws ReadDeniedException;
+ final Resource subject, final Property predicate, final float object)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public SecuredStatementIterator listLiteralStatements(
- final Resource subject, final Property predicate, final long object ) throws ReadDeniedException;
+ final Resource subject, final Property predicate, final long object)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public NsIterator listNameSpaces() throws ReadDeniedException;
+ public NsIterator listNameSpaces() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on each RDFNode returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredNodeIterator<RDFNode> listObjects() throws ReadDeniedException;
+ public SecuredNodeIterator<RDFNode> listObjects()
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on each RDFNode returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredNodeIterator<RDFNode> listObjectsOfProperty( final Property p ) throws ReadDeniedException;
+ public SecuredNodeIterator<RDFNode> listObjectsOfProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on each RDFNode returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredNodeIterator<RDFNode> listObjectsOfProperty( final Resource s,
- final Property p ) throws ReadDeniedException;
+ public SecuredNodeIterator<RDFNode> listObjectsOfProperty(final Resource s,
+ final Property p) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on each Reified statement returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRSIterator listReifiedStatements() throws ReadDeniedException;
+ public SecuredRSIterator listReifiedStatements()
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on each Reified statement returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRSIterator listReifiedStatements( final Statement st ) throws ReadDeniedException;
+ public SecuredRSIterator listReifiedStatements(final Statement st)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned;
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned;
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p,
- final boolean o ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p,
+ final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned;
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p,
- final char o ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p,
+ final char o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned;
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p,
- final double o ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p,
+ final double o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned;
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p,
- final float o ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p,
+ final float o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned;
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p,
- final long o ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p,
+ final long o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned;
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p,
- final Object o ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p,
+ final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listResourcesWithProperty( final Property p,
- final RDFNode o ) throws ReadDeniedException;
+ public SecuredResIterator listResourcesWithProperty(final Property p,
+ final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatementIterator listStatements() throws ReadDeniedException;
+ public SecuredStatementIterator listStatements()
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatementIterator listStatements( final Resource s,
- final Property p, final RDFNode o ) throws ReadDeniedException;
+ public SecuredStatementIterator listStatements(final Resource s,
+ final Property p, final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatementIterator listStatements( final Resource subject,
- final Property predicate, final String object ) throws ReadDeniedException;
+ public SecuredStatementIterator listStatements(final Resource subject,
+ final Property predicate, final String object)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatementIterator listStatements( final Resource subject,
- final Property predicate, final String object, final String lang ) throws ReadDeniedException;
+ public SecuredStatementIterator listStatements(final Resource subject,
+ final Property predicate, final String object, final String lang)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all triples returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredStatementIterator listStatements( final Selector s ) throws ReadDeniedException;
+ public SecuredStatementIterator listStatements(final Selector s)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listSubjects() throws ReadDeniedException;
+ public SecuredResIterator listSubjects() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listSubjectsWithProperty( final Property p ) throws ReadDeniedException;
+ public SecuredResIterator listSubjectsWithProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listSubjectsWithProperty( final Property p,
- final RDFNode o ) throws ReadDeniedException;
+ public SecuredResIterator listSubjectsWithProperty(final Property p,
+ final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listSubjectsWithProperty( final Property p,
- final String o ) throws ReadDeniedException;
+ public SecuredResIterator listSubjectsWithProperty(final Property p,
+ final String o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
- * @sec.triple Read at least one SecTriple( resource, p, o ) for each
- * resource
- * returned
+ * @sec.triple Read at least one Triple( resource, p, o ) for each resource
+ * returned
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResIterator listSubjectsWithProperty( final Property p,
- final String o, final String l ) throws ReadDeniedException;
+ public SecuredResIterator listSubjectsWithProperty(final Property p,
+ final String o, final String l) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping lock() throws ReadDeniedException;
+ public SecuredPrefixMapping lock() throws ReadDeniedException,
+ AuthenticationRequiredException;
@Override
- public SecuredModel notifyEvent( final Object e );
+ public SecuredModel notifyEvent(final Object e);
/**
*
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String qnameFor( final String uri ) throws ReadDeniedException;
+ public String qnameFor(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel query( final Selector s ) throws ReadDeniedException;
+ public SecuredModel query(final Selector s) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel read( final InputStream in, final String base ) throws UpdateDeniedException;
+ public SecuredModel read(final InputStream in, final String base)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel read( final InputStream in, final String base,
- final String lang ) throws UpdateDeniedException;
+ public SecuredModel read(final InputStream in, final String base,
+ final String lang) throws UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel read( final Reader reader, final String base ) throws UpdateDeniedException;
+ public SecuredModel read(final Reader reader, final String base)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel read( final Reader reader, final String base,
- final String lang ) throws UpdateDeniedException;
+ public SecuredModel read(final Reader reader, final String base,
+ final String lang) throws UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel read( final String url ) throws UpdateDeniedException;
+ public SecuredModel read(final String url) throws UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel read( final String url, final String lang ) throws UpdateDeniedException;
+ public SecuredModel read(final String url, final String lang)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel read( final String url, final String base,
- final String lang ) throws UpdateDeniedException;
+ public SecuredModel read(final String url, final String base,
+ final String lang) throws UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
@@ -1374,9 +1695,12 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
*
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel register( final ModelChangedListener listener ) throws ReadDeniedException;
+ public SecuredModel register(final ModelChangedListener listener)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
*
@@ -1384,10 +1708,13 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Delete on every statement in statments.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel remove( final List<Statement> statements )
- throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel remove(final List<Statement> statements)
+ throws DeleteDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
@@ -1395,19 +1722,26 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Delete on every statement in baseModel.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel remove( final Model m ) throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel remove(final Model m) throws DeleteDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
- * @sec.triple Delete on SecTriple( s, p, o )
+ * @sec.triple Delete on Triple( s, p, o )
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel remove( final Resource s, final Property p, final RDFNode o ) throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel remove(final Resource s, final Property p,
+ final RDFNode o) throws DeleteDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
*
@@ -1415,10 +1749,12 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Delete on statment.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel remove( final Statement s )
- throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel remove(final Statement s) throws DeleteDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
*
@@ -1426,10 +1762,13 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Delete on every statement in statments.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel remove( final Statement[] statements )
- throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel remove(final Statement[] statements)
+ throws DeleteDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
@@ -1437,10 +1776,13 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Delete on every statement in iter.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel remove( final StmtIterator iter )
- throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel remove(final StmtIterator iter)
+ throws DeleteDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
@@ -1448,159 +1790,202 @@ public interface SecuredModel extends Model, SecuredPrefixMapping
* @sec.triple Delete on every statement in the securedModel
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel removeAll() throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel removeAll() throws DeleteDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
- * @sec.triple Delete on every statement identified by SecTriple( s,p,o)
+ * @sec.triple Delete on every statement identified by Triple( s,p,o)
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredModel removeAll( final Resource s, final Property p,
- final RDFNode r ) throws DeleteDeniedException, UpdateDeniedException;
+ public SecuredModel removeAll(final Resource s, final Property p,
+ final RDFNode r) throws DeleteDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @sec.triple Delete on every reification statement for each statement in
- * statments.
+ * statments.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void removeAllReifications( final Statement s )
- throws DeleteDeniedException, UpdateDeniedException;
+ public void removeAllReifications(final Statement s)
+ throws DeleteDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredPrefixMapping removeNsPrefix( final String prefix )
- throws UpdateDeniedException;
+ public SecuredPrefixMapping removeNsPrefix(final String prefix)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @sec.triple Delete on every reification statement fore each statement in
- * rs.
+ * rs.
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public void removeReification( final ReifiedStatement rs )
- throws DeleteDeniedException, UpdateDeniedException;
+ public void removeReification(final ReifiedStatement rs)
+ throws DeleteDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String setReaderClassName( final String lang, final String className ) throws UpdateDeniedException;
+ public String setReaderClassName(final String lang, final String className)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Update
* @throws UpdateDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String setWriterClassName( final String lang, final String className ) throws UpdateDeniedException;
+ public String setWriterClassName(final String lang, final String className)
+ throws UpdateDeniedException, AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String shortForm( final String uri ) throws ReadDeniedException;
+ public String shortForm(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public long size() throws ReadDeniedException;
+ public long size() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
*
* @sec.graph Read
* @sec.triple Read on all statements contributed to the union.
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Model union( final Model model ) throws ReadDeniedException;
+ public Model union(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException;
@Override
- public SecuredModel unregister( final ModelChangedListener listener );
+ public SecuredModel unregister(final ModelChangedListener listener);
@Override
- public SecuredResource wrapAsResource( final Node n );
+ public SecuredResource wrapAsResource(final Node n);
/**
*
* @sec.graph Read
* @sec.triple Read on all statements that are written.
<TRUNCATED>
[06/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredModelImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredModelImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredModelImpl.java
index f64372f..1e11238 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredModelImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredModelImpl.java
@@ -56,14 +56,16 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void addedStatement(final Statement s) {
+ public void addedStatement(final Statement s)
+ throws AuthenticationRequiredException {
if (canRead(s)) {
wrapped.addedStatement(s);
}
}
@Override
- public void addedStatements(final List<Statement> statements) {
+ public void addedStatements(final List<Statement> statements)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.addedStatements(statements);
} else {
@@ -79,7 +81,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void addedStatements(final Model m) {
+ public void addedStatements(final Model m)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.addedStatements(m);
} else {
@@ -89,7 +92,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void addedStatements(final Statement[] statements) {
+ public void addedStatements(final Statement[] statements)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.addedStatements(statements);
} else {
@@ -107,7 +111,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void addedStatements(final StmtIterator statements) {
+ public void addedStatements(final StmtIterator statements)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.addedStatements(statements);
} else {
@@ -127,14 +132,16 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void removedStatement(final Statement s) {
+ public void removedStatement(final Statement s)
+ throws AuthenticationRequiredException {
if (canRead(s)) {
wrapped.removedStatement(s);
}
}
@Override
- public void removedStatements(final List<Statement> statements) {
+ public void removedStatements(final List<Statement> statements)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.removedStatements(statements);
@@ -151,7 +158,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void removedStatements(final Model m) {
+ public void removedStatements(final Model m)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.removedStatements(m);
} else {
@@ -161,7 +169,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void removedStatements(final Statement[] statements) {
+ public void removedStatements(final Statement[] statements)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.removedStatements(statements);
} else {
@@ -179,7 +188,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void removedStatements(final StmtIterator statements) {
+ public void removedStatements(final StmtIterator statements)
+ throws AuthenticationRequiredException {
if (canRead(Triple.ANY)) {
wrapped.removedStatements(statements);
} else {
@@ -194,20 +204,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
}
- /*
- * private class ReadFilter extends Filter<Resource> { private SecuredItem
- * si; private SecuredResource r; private Property p; ReadFilter(
- * SecuredItem si, SecuredResource r, Property p ) { this.si = si; this.r =
- * r; this.p = p; }
- *
- * @Override public boolean test(Resource o) { Triple t = new Triple(
- * r.asNode(), p.asNode(), o.asNode()); return si.canRead(
- * SecuredItemImpl.convert( t ) ); }};
- */
private static final RDFReaderF readerFactory = new RDFReaderFImpl();
- // private static final RDFWriterF writerFactory = new RDFWriterFImpl();
-
/**
* Get an instance of SecuredModel
*
@@ -260,7 +258,6 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
// The secured graph that this securedModel contains.
private final SecuredGraph graph;
- //
Map<ModelChangedListener, SecuredModelChangedListener> listeners = new HashMap<ModelChangedListener, SecuredModelChangedListener>();
/**
@@ -293,7 +290,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel add(final List<Statement> statements) {
+ public SecuredModel add(final List<Statement> statements)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreateFrontsTriples(WrappedIterator.create(statements.iterator()));
holder.getBaseItem().add(statements);
@@ -301,7 +300,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel add(final Model m) {
+ public SecuredModel add(final Model m) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
if (!canCreate(Triple.ANY)) {
checkCreateFrontsTriples(m.listStatements());
@@ -311,7 +311,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel add(final Resource s, final Property p, final RDFNode o) {
+ public SecuredModel add(final Resource s, final Property p, final RDFNode o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(s.asNode(), p.asNode(), o.asNode()));
holder.getBaseItem().add(s, p, o);
@@ -319,13 +321,16 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel add(final Resource s, final Property p, final String o) {
+ public SecuredModel add(final Resource s, final Property p, final String o)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
return add(s, p, o, false);
}
@Override
public SecuredModel add(final Resource s, final Property p, final String o,
- final boolean wellFormed) {
+ final boolean wellFormed) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(s.asNode(), p.asNode(),
NodeFactory.createLiteral(o, "", wellFormed)));
@@ -335,7 +340,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredModel add(final Resource s, final Property p,
- final String lex, final RDFDatatype datatype) {
+ final String lex, final RDFDatatype datatype)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(s.asNode(), p.asNode(),
NodeFactory.createLiteral(lex, datatype)));
@@ -345,7 +352,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredModel add(final Resource s, final Property p, final String o,
- final String l) {
+ final String l) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(s.asNode(), p.asNode(),
NodeFactory.createLiteral(o, l, false)));
@@ -354,7 +362,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel add(final Statement s) {
+ public SecuredModel add(final Statement s) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(s);
holder.getBaseItem().add(s);
@@ -362,7 +371,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel add(final Statement[] statements) {
+ public SecuredModel add(final Statement[] statements)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (!canCreate(Triple.ANY)) {
for (final Statement s : statements) {
@@ -375,7 +386,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel add(final StmtIterator iter) {
+ public SecuredModel add(final StmtIterator iter)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (!canCreate(Triple.ANY)) {
final List<Triple> lst = new ArrayList<Triple>();
@@ -399,51 +412,58 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredModel addLiteral(final Resource s, final Property p,
- final boolean o) {
+ final boolean o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final Literal l = ResourceFactory.createTypedLiteral(o);
if (l == null) {
- throw new IllegalArgumentException("HOw did we get a null");
+ throw new IllegalArgumentException("How did we get a null");
}
return add(s, p, l);
}
@Override
public SecuredModel addLiteral(final Resource s, final Property p,
- final char o) {
+ final char o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final Literal l = ResourceFactory.createTypedLiteral(o);
return add(s, p, l);
}
@Override
public SecuredModel addLiteral(final Resource s, final Property p,
- final double o) {
+ final double o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final Literal l = ResourceFactory.createTypedLiteral(o);
return add(s, p, l);
}
@Override
public SecuredModel addLiteral(final Resource s, final Property p,
- final float o) {
+ final float o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final Literal l = ResourceFactory.createTypedLiteral(o);
return add(s, p, l);
}
@Override
public SecuredModel addLiteral(final Resource s, final Property p,
- final int o) {
+ final int o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final Literal l = ResourceFactory.createTypedLiteral(o);
return add(s, p, l);
}
@Override
public SecuredModel addLiteral(final Resource s, final Property p,
- final Literal o) {
+ final Literal o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
return add(s, p, o);
}
@Override
public SecuredModel addLiteral(final Resource s, final Property p,
- final long o) {
+ final long o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final Literal l = ResourceFactory.createTypedLiteral(o);
return add(s, p, l);
}
@@ -451,7 +471,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
@Deprecated
public SecuredModel addLiteral(final Resource s, final Property p,
- final Object o) {
+ final Object o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
return add(s, p, asObject(o));
}
@@ -462,7 +483,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredStatement asStatement(final Triple t) {
+ public SecuredStatement asStatement(final Triple t)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final ExtendedIterator<Triple> iter = holder.getBaseItem().getGraph()
.find(t);
final boolean exists = iter.hasNext();
@@ -484,27 +507,6 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
return holder.getSecuredItem();
}
- // private void checkCreate( final Node n, final Triple t )
- // {
- // checkRead(t);
- // checkCreate(new SecurityEvaluator.SecTriple(n,
- // SecuredItemImpl.convert(RDF.subject.asNode()),
- // SecuredItemImpl.convert(t.getSubject())));
- // checkCreate(new SecurityEvaluator.SecTriple(n,
- // SecuredItemImpl.convert(RDF.predicate.asNode()),
- // SecuredItemImpl.convert(t.getPredicate())));
- // checkCreate(new SecurityEvaluator.SecTriple(n,
- // SecuredItemImpl.convert(RDF.object.asNode()),
- // SecuredItemImpl.convert(t.getObject())));
- // }
-
- /*
- * private void checkCreateAnonymousResource( final
- * SecurityEvaluator.SecNode n ) { checkUpdate(); final
- * SecurityEvaluator.SecTriple t = new SecurityEvaluator.SecTriple(n,
- * SecurityEvaluator.SecNode.IGNORE, SecurityEvaluator.SecNode.IGNORE);
- * checkCreate(t); }
- */
@Override
public void close() {
holder.getBaseItem().close();
@@ -517,7 +519,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean contains(final Resource s, final Property p) {
+ public boolean contains(final Resource s, final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final SecuredStatementIterator iter = new SecuredStatementIterator(
holder.getSecuredItem(), holder.getBaseItem().listStatements(s,
@@ -530,7 +533,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean contains(final Resource s, final Property p, final RDFNode o) {
+ public boolean contains(final Resource s, final Property p, final RDFNode o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final SecuredStatementIterator iter = new SecuredStatementIterator(
holder.getSecuredItem(), holder.getBaseItem().listStatements(s,
@@ -543,7 +547,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean contains(final Resource s, final Property p, final String o) {
+ public boolean contains(final Resource s, final Property p, final String o)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final SecuredStatementIterator iter = new SecuredStatementIterator(
holder.getSecuredItem(), holder.getBaseItem().listStatements(s,
@@ -557,7 +562,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public boolean contains(final Resource s, final Property p, final String o,
- final String l) {
+ final String l) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final SecuredStatementIterator iter = new SecuredStatementIterator(
holder.getSecuredItem(), holder.getBaseItem().listStatements(s,
@@ -570,19 +576,22 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean contains(final Statement s) {
+ public boolean contains(final Statement s) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(s);
return holder.getBaseItem().contains(s);
}
@Override
- public boolean containsAll(final Model model) {
+ public boolean containsAll(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException {
return containsAll(model.listStatements());
}
@Override
- public boolean containsAll(final StmtIterator iter) {
+ public boolean containsAll(final StmtIterator iter)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final boolean doCheck = canRead(Triple.ANY);
try {
@@ -602,13 +611,15 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean containsAny(final Model model) {
+ public boolean containsAny(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException {
return containsAny(model.listStatements());
}
@Override
- public boolean containsAny(final StmtIterator iter) {
+ public boolean containsAny(final StmtIterator iter)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final boolean skipCheck = canRead(Triple.ANY);
try {
@@ -628,48 +639,56 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public boolean containsLiteral(final Resource s, final Property p,
- final boolean o) {
+ final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException {
return contains(s, p, ResourceFactory.createTypedLiteral(o));
}
@Override
public boolean containsLiteral(final Resource s, final Property p,
- final char o) {
+ final char o) throws ReadDeniedException,
+ AuthenticationRequiredException {
return contains(s, p, ResourceFactory.createTypedLiteral(o));
}
@Override
public boolean containsLiteral(final Resource s, final Property p,
- final double o) {
+ final double o) throws ReadDeniedException,
+ AuthenticationRequiredException {
return contains(s, p, ResourceFactory.createTypedLiteral(o));
}
@Override
public boolean containsLiteral(final Resource s, final Property p,
- final float o) {
+ final float o) throws ReadDeniedException,
+ AuthenticationRequiredException {
return contains(s, p, ResourceFactory.createTypedLiteral(o));
}
@Override
public boolean containsLiteral(final Resource s, final Property p,
- final int o) {
+ final int o) throws ReadDeniedException,
+ AuthenticationRequiredException {
return contains(s, p, ResourceFactory.createTypedLiteral(o));
}
@Override
public boolean containsLiteral(final Resource s, final Property p,
- final long o) {
+ final long o) throws ReadDeniedException,
+ AuthenticationRequiredException {
return contains(s, p, ResourceFactory.createTypedLiteral(o));
}
@Override
public boolean containsLiteral(final Resource s, final Property p,
- final Object o) {
+ final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException {
return contains(s, p, asObject(o));
}
@Override
- public boolean containsResource(final RDFNode r) {
+ public boolean containsResource(final RDFNode r)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
if (canRead(new Triple(Node.ANY, Node.ANY, Node.ANY))) {
return holder.getBaseItem().containsResource(r);
@@ -699,7 +718,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredAlt createAlt() {
+ public SecuredAlt createAlt() throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(SecurityEvaluator.FUTURE, RDF.type.asNode(),
RDF.Alt.asNode()));
@@ -708,7 +728,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredAlt createAlt(final String uri) {
+ public SecuredAlt createAlt(final String uri) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(NodeFactory.createURI(uri), RDF.type.asNode(),
RDF.Alt.asNode()));
@@ -717,17 +738,18 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredBag createBag() {
+ public SecuredBag createBag() throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
- checkCreate(new Triple(SecurityEvaluator.FUTURE,
- RDF.type.asNode(),
+ checkCreate(new Triple(SecurityEvaluator.FUTURE, RDF.type.asNode(),
RDF.Bag.asNode()));
return SecuredBagImpl.getInstance(holder.getSecuredItem(), holder
.getBaseItem().createBag());
}
@Override
- public SecuredBag createBag(final String uri) {
+ public SecuredBag createBag(final String uri) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(NodeFactory.createURI(uri), RDF.type.asNode(),
RDF.Bag.asNode()));
@@ -735,19 +757,25 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
.getBaseItem().createBag(uri));
}
- private Model createCopy() {
+ private Model createCopy() throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
return ModelFactory.createDefaultModel().add(holder.getSecuredItem());
}
@Override
- public SecuredRDFList createList() {
+ public SecuredRDFList createList() throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
+ checkCreate(new Triple(SecurityEvaluator.FUTURE, RDF.first.asNode(),
+ RDF.nil.asNode()));
return SecuredRDFListImpl.getInstance(holder.getSecuredItem(), holder
.getBaseItem().createList());
}
@Override
- public SecuredRDFList createList(final Iterator<? extends RDFNode> members) {
+ public SecuredRDFList createList(final Iterator<? extends RDFNode> members)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(SecurityEvaluator.FUTURE, RDF.rest.asNode(),
SecurityEvaluator.FUTURE));
@@ -775,7 +803,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredRDFList createList(final RDFNode[] members) {
+ public SecuredRDFList createList(final RDFNode[] members)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
return createList(Arrays.asList(members).iterator());
}
@@ -849,13 +879,14 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredProperty createProperty(final String nameSpace,
final String localName) {
- checkUpdate();
return SecuredPropertyImpl.getInstance(holder.getSecuredItem(), holder
.getBaseItem().createProperty(nameSpace, localName));
}
@Override
- public ReifiedStatement createReifiedStatement(final Statement s) {
+ public SecuredReifiedStatement createReifiedStatement(final Statement s)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreateReified(null, s);
return SecuredReifiedStatementImpl.getInstance(holder.getSecuredItem(),
@@ -863,8 +894,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public ReifiedStatement createReifiedStatement(final String uri,
- final Statement s) {
+ public SecuredReifiedStatement createReifiedStatement(final String uri,
+ final Statement s) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreateReified(uri, s);
return SecuredReifiedStatementImpl.getInstance(holder.getSecuredItem(),
@@ -887,7 +919,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredResource createResource(final Resource type) {
+ public SecuredResource createResource(final Resource type)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
final Triple t = new Triple(SecurityEvaluator.FUTURE,
RDF.type.asNode(), type.asNode());
@@ -899,7 +933,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
@Deprecated
- public SecuredResource createResource(final ResourceF f) {
+ public SecuredResource createResource(final ResourceF f)
+ throws AuthenticationRequiredException {
return createResource(null, f);
}
@@ -911,7 +946,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredResource createResource(final String uri, final Resource type) {
+ public SecuredResource createResource(final String uri, final Resource type)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
final Resource r = ResourceFactory.createResource(uri);
final Triple t = new Triple(r.asNode(), RDF.type.asNode(),
type.asNode());
@@ -935,17 +972,18 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredSeq createSeq() {
+ public SecuredSeq createSeq() throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
- checkCreate(new Triple(SecurityEvaluator.FUTURE,
- RDF.type.asNode(),
+ checkCreate(new Triple(SecurityEvaluator.FUTURE, RDF.type.asNode(),
RDF.Alt.asNode()));
return SecuredSeqImpl.getInstance(holder.getSecuredItem(), holder
.getBaseItem().createSeq());
}
@Override
- public SecuredSeq createSeq(final String uri) {
+ public SecuredSeq createSeq(final String uri) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(NodeFactory.createURI(uri), RDF.type.asNode(),
RDF.Alt.asNode()));
@@ -955,7 +993,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatement createStatement(final Resource s, final Property p,
- final RDFNode o) {
+ final RDFNode o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(s.asNode(), p.asNode(), o.asNode()));
return SecuredStatementImpl.getInstance(holder.getSecuredItem(), holder
@@ -964,7 +1003,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatement createStatement(final Resource s, final Property p,
- final String o) {
+ final String o) throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(s.asNode(), p.asNode(), NodeFactory.createURI(o)));
return SecuredStatementImpl.getInstance(holder.getSecuredItem(), holder
@@ -973,19 +1013,24 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatement createStatement(final Resource s, final Property p,
- final String o, final boolean wellFormed) {
+ final String o, final boolean wellFormed)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
return createStatement(s, p, o, "", wellFormed);
}
@Override
public SecuredStatement createStatement(final Resource s, final Property p,
- final String o, final String l) {
+ final String o, final String l) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
return createStatement(s, p, o, l, false);
}
@Override
public SecuredStatement createStatement(final Resource s, final Property p,
- final String o, final String l, final boolean wellFormed) {
+ final String o, final String l, final boolean wellFormed)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
checkCreate(new Triple(s.asNode(), p.asNode(),
NodeFactory.createLiteral(o, l, wellFormed)));
@@ -1076,7 +1121,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public Model difference(final Model model) {
+ public Model difference(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
return holder.getBaseItem().difference(model);
@@ -1086,7 +1132,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void enterCriticalSection(final boolean readLockRequested) {
+ public void enterCriticalSection(final boolean readLockRequested)
+ throws UpdateDeniedException, ReadDeniedException,
+ AuthenticationRequiredException {
if (readLockRequested) {
checkRead();
} else {
@@ -1101,13 +1149,15 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public String expandPrefix(final String prefixed) {
+ public String expandPrefix(final String prefixed)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().expandPrefix(prefixed);
}
@Override
- public SecuredAlt getAlt(final Resource r) {
+ public SecuredAlt getAlt(final Resource r) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(new Triple(r.asNode(), RDF.type.asNode(), RDF.Alt.asNode()));
return SecuredAltImpl.getInstance(holder.getSecuredItem(), holder
@@ -1115,7 +1165,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredAlt getAlt(final String uri) {
+ public SecuredAlt getAlt(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(new Triple(NodeFactory.createURI(uri), RDF.type.asNode(),
RDF.Alt.asNode()));
@@ -1124,7 +1175,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredResource getAnyReifiedStatement(final Statement s) {
+ public SecuredResource getAnyReifiedStatement(final Statement s)
+ throws ReadDeniedException, UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException {
final RSIterator it = listReifiedStatements(s);
if (it.hasNext()) {
try {
@@ -1140,7 +1193,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredBag getBag(final Resource r) {
+ public SecuredBag getBag(final Resource r) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(new Triple(r.asNode(), RDF.type.asNode(), RDF.Bag.asNode()));
return SecuredBagImpl.getInstance(holder.getSecuredItem(), holder
@@ -1148,7 +1202,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredBag getBag(final String uri) {
+ public SecuredBag getBag(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(new Triple(NodeFactory.createURI(uri), RDF.type.asNode(),
RDF.Bag.asNode()));
@@ -1167,25 +1222,29 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public Map<String, String> getNsPrefixMap() {
+ public Map<String, String> getNsPrefixMap() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getNsPrefixMap();
}
@Override
- public String getNsPrefixURI(final String prefix) {
+ public String getNsPrefixURI(final String prefix)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getNsPrefixURI(prefix);
}
@Override
- public String getNsURIPrefix(final String uri) {
+ public String getNsURIPrefix(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getNsURIPrefix(uri);
}
@Override
- public SecuredStatement getProperty(final Resource s, final Property p) {
+ public SecuredStatement getProperty(final Resource s, final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
final StmtIterator stmt = listStatements(s, p, (RDFNode) null);
try {
if (stmt.hasNext()) {
@@ -1201,7 +1260,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredProperty getProperty(final String uri) {
+ public SecuredProperty getProperty(final String uri)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return SecuredPropertyImpl.getInstance(holder.getSecuredItem(), holder
.getBaseItem().getProperty(uri));
@@ -1209,14 +1269,16 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredProperty getProperty(final String nameSpace,
- final String localName) {
+ final String localName) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return SecuredPropertyImpl.getInstance(holder.getSecuredItem(), holder
.getBaseItem().getProperty(nameSpace, localName));
}
@Override
- public SecuredRDFNode getRDFNode(final Node n) {
+ public SecuredRDFNode getRDFNode(final Node n) throws ReadDeniedException,
+ UpdateDeniedException, AuthenticationRequiredException {
RDFNode rdfNode = null;
if (n.isLiteral()) {
rdfNode = ResourceFactory.createTypedLiteral(
@@ -1227,7 +1289,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
rdfNode = ResourceFactory.createResource(n.getBlankNodeId()
.toString());
} else {
- throw new IllegalArgumentException("Illegal SecNode type: " + n);
+ throw new IllegalArgumentException("Illegal Node type: "
+ + n.getClass());
}
if (holder.getBaseItem().containsResource(rdfNode)) {
@@ -1268,7 +1331,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatement getRequiredProperty(final Resource s,
- final Property p) {
+ final Property p) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
return SecuredStatementImpl.getInstance(holder.getSecuredItem(),
@@ -1300,7 +1364,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredSeq getSeq(final Resource r) {
+ public SecuredSeq getSeq(final Resource r) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(new Triple(r.asNode(), RDF.type.asNode(), RDF.Seq.asNode()));
return SecuredSeqImpl.getInstance(holder.getSecuredItem(), holder
@@ -1308,7 +1373,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredSeq getSeq(final String uri) {
+ public SecuredSeq getSeq(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(new Triple(NodeFactory.createURI(uri), RDF.type.asNode(),
RDF.Seq.asNode()));
@@ -1344,7 +1410,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public Model intersection(final Model model) {
+ public Model intersection(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
if (!canRead(Triple.ANY)) {
return holder.getBaseItem().intersection(model);
@@ -1359,13 +1426,15 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean isEmpty() {
+ public boolean isEmpty() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().isEmpty();
}
@Override
- public boolean isIsomorphicWith(final Model g) {
+ public boolean isIsomorphicWith(final Model g) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
final boolean retval = holder.getBaseItem().isIsomorphicWith(g);
if (retval && !canRead(Triple.ANY)) {
@@ -1390,7 +1459,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean isReified(final Statement s) {
+ public boolean isReified(final Statement s) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
checkRead(s);
@@ -1410,7 +1480,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listLiteralStatements(
final Resource subject, final Property predicate,
- final boolean object) {
+ final boolean object) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem()
@@ -1419,7 +1490,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listLiteralStatements(
- final Resource subject, final Property predicate, final char object) {
+ final Resource subject, final Property predicate, final char object)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem()
@@ -1429,7 +1501,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listLiteralStatements(
final Resource subject, final Property predicate,
- final double object) {
+ final double object) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem()
@@ -1438,7 +1511,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listLiteralStatements(
- final Resource subject, final Property predicate, final float object) {
+ final Resource subject, final Property predicate, final float object)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem()
@@ -1447,7 +1521,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listLiteralStatements(
- final Resource subject, final Property predicate, final long object) {
+ final Resource subject, final Property predicate, final long object)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem()
@@ -1455,13 +1530,15 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public NsIterator listNameSpaces() {
+ public NsIterator listNameSpaces() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().listNameSpaces();
}
@Override
- public SecuredNodeIterator<RDFNode> listObjects() {
+ public SecuredNodeIterator<RDFNode> listObjects()
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
ExtendedIterator<RDFNode> nIter = holder.getBaseItem().listObjects();
if (!canRead(Triple.ANY)) {
@@ -1471,7 +1548,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredNodeIterator<RDFNode> listObjectsOfProperty(final Property p) {
+ public SecuredNodeIterator<RDFNode> listObjectsOfProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
ExtendedIterator<RDFNode> nIter = holder.getBaseItem()
.listObjectsOfProperty(p);
@@ -1483,7 +1561,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredNodeIterator<RDFNode> listObjectsOfProperty(final Resource s,
- final Property p) {
+ final Property p) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<RDFNode> nIter = holder.getBaseItem()
.listObjectsOfProperty(s, p);
@@ -1494,14 +1573,16 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredRSIterator listReifiedStatements() {
+ public SecuredRSIterator listReifiedStatements()
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredRSIterator(holder.getSecuredItem(), holder
.getBaseItem().listReifiedStatements());
}
@Override
- public SecuredRSIterator listReifiedStatements(final Statement st) {
+ public SecuredRSIterator listReifiedStatements(final Statement st)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
checkRead(st);
return new SecuredRSIterator(holder.getSecuredItem(), holder
@@ -1509,7 +1590,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredResIterator listResourcesWithProperty(final Property p) {
+ public SecuredResIterator listResourcesWithProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p);
@@ -1522,7 +1604,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listResourcesWithProperty(final Property p,
- final boolean o) {
+ final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p, o);
@@ -1535,7 +1618,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listResourcesWithProperty(final Property p,
- final char o) {
+ final char o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p, o);
@@ -1548,7 +1632,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listResourcesWithProperty(final Property p,
- final double o) {
+ final double o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p, o);
@@ -1561,7 +1646,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listResourcesWithProperty(final Property p,
- final float o) {
+ final float o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p, o);
@@ -1574,7 +1660,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listResourcesWithProperty(final Property p,
- final long o) {
+ final long o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p, o);
@@ -1587,7 +1674,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listResourcesWithProperty(final Property p,
- final Object o) {
+ final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p, o);
@@ -1600,7 +1688,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listResourcesWithProperty(final Property p,
- final RDFNode o) {
+ final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listResourcesWithProperty(p, o);
@@ -1611,7 +1700,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredStatementIterator listStatements() {
+ public SecuredStatementIterator listStatements()
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem().listStatements());
@@ -1619,7 +1709,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listStatements(final Resource s,
- final Property p, final RDFNode o) {
+ final Property p, final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem().listStatements(s, p, o));
@@ -1627,7 +1718,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listStatements(final Resource subject,
- final Property predicate, final String object) {
+ final Property predicate, final String object)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem().listStatements(subject, predicate, object));
@@ -1635,21 +1727,24 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredStatementIterator listStatements(final Resource subject,
- final Property predicate, final String object, final String lang) {
+ final Property predicate, final String object, final String lang)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem().listStatements(subject, predicate, object, lang));
}
@Override
- public SecuredStatementIterator listStatements(final Selector s) {
+ public SecuredStatementIterator listStatements(final Selector s)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return new SecuredStatementIterator(holder.getSecuredItem(), holder
.getBaseItem().listStatements(s));
}
@Override
- public SecuredResIterator listSubjects() {
+ public SecuredResIterator listSubjects() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem().listSubjects();
if (!canRead(Triple.ANY)) {
@@ -1659,7 +1754,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredResIterator listSubjectsWithProperty(final Property p) {
+ public SecuredResIterator listSubjectsWithProperty(final Property p)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listSubjectsWithProperty(p);
@@ -1671,7 +1767,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listSubjectsWithProperty(final Property p,
- final RDFNode o) {
+ final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listSubjectsWithProperty(p, o);
@@ -1683,7 +1780,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listSubjectsWithProperty(final Property p,
- final String o) {
+ final String o) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listSubjectsWithProperty(p, o);
@@ -1696,7 +1794,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredResIterator listSubjectsWithProperty(final Property p,
- final String o, final String l) {
+ final String o, final String l) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
ExtendedIterator<Resource> rIter = holder.getBaseItem()
.listSubjectsWithProperty(p, o, l);
@@ -1708,7 +1807,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredPrefixMapping lock() {
+ public SecuredPrefixMapping lock() throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().lock();
return holder.getSecuredItem();
@@ -1721,13 +1821,15 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public String qnameFor(final String uri) {
+ public String qnameFor(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().qnameFor(uri);
}
@Override
- public SecuredModel query(final Selector s) {
+ public SecuredModel query(final Selector s) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return SecuredModelImpl.getInstance(
holder.getSecuredItem(),
@@ -1736,130 +1838,65 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel read(final InputStream in, final String base) {
+ public SecuredModel read(final InputStream in, final String base)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
- // try
- // {
SecuredModelImpl.readerFactory.getReader().read(
holder.getSecuredItem(), in, base);
return holder.getSecuredItem();
- // }
- // catch (final JenaException e)
- // {
- // if ((e.getCause() != null)
- // && (e.getCause() instanceof AccessDeniedRuntimeException))
- // {
- // throw (AccessDeniedRuntimeException) e.getCause();
- // }
- // throw e;
- // }
}
@Override
public SecuredModel read(final InputStream in, final String base,
- final String lang) {
+ final String lang) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
- // try
- // {
SecuredModelImpl.readerFactory.getReader(lang).read(
holder.getSecuredItem(), in, base);
return holder.getSecuredItem();
- // }
- // catch (final JenaException e)
- // {
- // if ((e.getCause() != null)
- // && (e.getCause() instanceof AccessDeniedRuntimeException))
- // {
- // throw (AccessDeniedRuntimeException) e.getCause();
- // }
- // throw e;
- // }
}
@Override
- public SecuredModel read(final Reader reader, final String base) {
+ public SecuredModel read(final Reader reader, final String base)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkUpdate();
- // try
- // {
SecuredModelImpl.readerFactory.getReader().read(
holder.getSecuredItem(), reader, base);
return holder.getSecuredItem();
- // }
- // catch (final JenaException e)
- // {
- // if ((e.getCause() != null)
- // && (e.getCause() instanceof AccessDeniedRuntimeException))
- // {
- // throw (AccessDeniedRuntimeException) e.getCause();
- // }
- // throw e;
- // }
}
@Override
public SecuredModel read(final Reader reader, final String base,
- final String lang) {
+ final String lang) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
- // try
- // {
SecuredModelImpl.readerFactory.getReader(lang).read(
holder.getSecuredItem(), reader, base);
return holder.getSecuredItem();
- // }
- // catch (final JenaException e)
- // {
- // if ((e.getCause() != null)
- // && (e.getCause() instanceof AccessDeniedRuntimeException))
- // {
- // throw (AccessDeniedRuntimeException) e.getCause();
- // }
- // throw e;
- // }
}
@Override
- public SecuredModel read(final String url) {
+ public SecuredModel read(final String url) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
- // try
- // {
SecuredModelImpl.readerFactory.getReader().read(
holder.getSecuredItem(), url);
return holder.getSecuredItem();
- // }
- // catch (final JenaException e)
- // {
- // if ((e.getCause() != null)
- // && (e.getCause() instanceof AccessDeniedRuntimeException))
- // {
- // throw (AccessDeniedRuntimeException) e.getCause();
- // }
- // throw e;
- // }
}
@Override
- public SecuredModel read(final String url, final String lang) {
+ public SecuredModel read(final String url, final String lang)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkUpdate();
- // try
- // {
SecuredModelImpl.readerFactory.getReader(lang).read(
holder.getSecuredItem(), url);
return holder.getSecuredItem();
- // }
- // catch (final JenaException e)
- // {
- // if ((e.getCause() != null)
- // && (e.getCause() instanceof AccessDeniedRuntimeException))
- // {
- // throw (AccessDeniedRuntimeException) e.getCause();
- // }
- // throw e;
- // }
}
@Override
public SecuredModel read(final String url, final String base,
- final String lang) {
+ final String lang) throws ReadDeniedException,
+ AuthenticationRequiredException {
try {
final InputStream is = new URL(url).openStream();
try {
@@ -1876,7 +1913,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel register(final ModelChangedListener listener) {
+ public SecuredModel register(final ModelChangedListener listener)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
if (!listeners.containsKey(listener)) {
final SecuredModelChangedListener secL = new SecuredModelChangedListener(
@@ -1888,7 +1926,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel remove(final List<Statement> statements) {
+ public SecuredModel remove(final List<Statement> statements)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (!canDelete(Triple.ANY)) {
for (final Statement s : statements) {
@@ -1900,7 +1940,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel remove(final Model m) {
+ public SecuredModel remove(final Model m) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
if (!canDelete(Triple.ANY)) {
final StmtIterator iter = m.listStatements();
@@ -1920,7 +1961,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredModel remove(final Resource s, final Property p,
- final RDFNode o) {
+ final RDFNode o) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
checkDelete(new Triple(s.asNode(), p.asNode(), o.asNode()));
holder.getBaseItem().remove(s, p, o);
@@ -1928,7 +1970,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel remove(final Statement s) {
+ public SecuredModel remove(final Statement s) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
checkDelete(wildCardTriple(s));
holder.getBaseItem().remove(s);
@@ -1936,7 +1979,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel remove(final Statement[] statements) {
+ public SecuredModel remove(final Statement[] statements)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (!canDelete(Triple.ANY)) {
for (final Statement s : statements) {
@@ -1948,7 +1993,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel remove(final StmtIterator iter) {
+ public SecuredModel remove(final StmtIterator iter)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (!canDelete(Triple.ANY)) {
final List<Triple> lst = new ArrayList<Triple>();
@@ -1971,7 +2018,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel removeAll() {
+ public SecuredModel removeAll() throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
if (!canDelete(Triple.ANY)) {
final StmtIterator iter = holder.getBaseItem().listStatements();
@@ -1989,7 +2037,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredModel removeAll(final Resource s, final Property p,
- final RDFNode r) {
+ final RDFNode r) throws UpdateDeniedException,
+ DeleteDeniedException, AuthenticationRequiredException {
checkUpdate();
if (!canDelete(new Triple(wildCardNode(s), wildCardNode(p),
wildCardNode(r)))) {
@@ -2008,7 +2057,9 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public void removeAllReifications(final Statement s) {
+ public void removeAllReifications(final Statement s)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (canDelete(new Triple(Node.ANY, RDF.subject.asNode(),
wildCardNode(s.getSubject())))
@@ -2039,14 +2090,17 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredPrefixMapping removeNsPrefix(final String prefix) {
+ public SecuredPrefixMapping removeNsPrefix(final String prefix)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().removeNsPrefix(prefix);
return holder.getSecuredItem();
}
@Override
- public void removeReification(final ReifiedStatement rs) {
+ public void removeReification(final ReifiedStatement rs)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
if (!canDelete(Triple.ANY)) {
final StmtIterator stmtIter = rs.listProperties();
@@ -2062,28 +2116,32 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public boolean samePrefixMappingAs(final PrefixMapping other) {
+ public boolean samePrefixMappingAs(final PrefixMapping other)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().samePrefixMappingAs(other);
}
@Override
public SecuredPrefixMapping setNsPrefix(final String prefix,
- final String uri) {
+ final String uri) throws UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().setNsPrefix(prefix, uri);
return holder.getSecuredItem();
}
@Override
- public SecuredPrefixMapping setNsPrefixes(final Map<String, String> map) {
+ public SecuredPrefixMapping setNsPrefixes(final Map<String, String> map)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().setNsPrefixes(map);
return holder.getSecuredItem();
}
@Override
- public SecuredPrefixMapping setNsPrefixes(final PrefixMapping other) {
+ public SecuredPrefixMapping setNsPrefixes(final PrefixMapping other)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().setNsPrefixes(other);
return holder.getSecuredItem();
@@ -2091,33 +2149,37 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@SuppressWarnings("deprecation")
@Override
- public String setReaderClassName(final String lang, final String className) {
+ public String setReaderClassName(final String lang, final String className)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
return holder.getBaseItem().setReaderClassName(lang, className);
}
@SuppressWarnings("deprecation")
@Override
- public String setWriterClassName(final String lang, final String className) {
+ public String setWriterClassName(final String lang, final String className)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
return holder.getBaseItem().setWriterClassName(lang, className);
}
@Override
- public String shortForm(final String uri) {
+ public String shortForm(final String uri) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().shortForm(uri);
}
@Override
- public long size() {
+ public long size() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().size();
}
@Override
public boolean supportsSetOperations() {
- return holder.getBaseItem().supportsTransactions();
+ return holder.getBaseItem().supportsSetOperations();
}
@Override
@@ -2126,7 +2188,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public Model union(final Model model) {
+ public Model union(final Model model) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
return holder.getBaseItem().union(model);
@@ -2155,7 +2218,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredPrefixMapping withDefaultMappings(final PrefixMapping map) {
+ public SecuredPrefixMapping withDefaultMappings(final PrefixMapping map)
+ throws UpdateDeniedException, AuthenticationRequiredException {
checkUpdate();
holder.getBaseItem().withDefaultMappings(map);
return holder.getSecuredItem();
@@ -2168,7 +2232,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel write(final OutputStream out) {
+ public SecuredModel write(final OutputStream out)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
holder.getBaseItem().write(out);
@@ -2180,7 +2245,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel write(final OutputStream out, final String lang) {
+ public SecuredModel write(final OutputStream out, final String lang)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
holder.getBaseItem().write(out, lang);
@@ -2192,7 +2258,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredModel write(final OutputStream out, final String lang,
- final String base) {
+ final String base) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
holder.getBaseItem().write(out, lang, base);
@@ -2204,7 +2271,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel write(final Writer writer) {
+ public SecuredModel write(final Writer writer) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
holder.getBaseItem().write(writer);
@@ -2215,7 +2283,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
}
@Override
- public SecuredModel write(final Writer writer, final String lang) {
+ public SecuredModel write(final Writer writer, final String lang)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
holder.getBaseItem().write(writer, lang);
@@ -2227,7 +2296,8 @@ public class SecuredModelImpl extends SecuredItemImpl implements SecuredModel {
@Override
public SecuredModel write(final Writer writer, final String lang,
- final String base) {
+ final String base) throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
if (canRead(Triple.ANY)) {
holder.getBaseItem().write(writer, lang, base);
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredPropertyImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredPropertyImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredPropertyImpl.java
index ad05b0b..2189a62 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredPropertyImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/impl/SecuredPropertyImpl.java
@@ -17,20 +17,21 @@
*/
package org.apache.jena.permissions.model.impl;
-import org.apache.jena.graph.Node ;
+import org.apache.jena.graph.Node;
import org.apache.jena.permissions.impl.ItemHolder;
import org.apache.jena.permissions.impl.SecuredItemInvoker;
import org.apache.jena.permissions.model.SecuredModel;
import org.apache.jena.permissions.model.SecuredProperty;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.Property ;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.Property;
+import org.apache.jena.shared.AuthenticationRequiredException;
+import org.apache.jena.shared.ReadDeniedException;
/**
* Implementation of SecuredProperty to be used by a SecuredItemInvoker proxy.
*/
public class SecuredPropertyImpl extends SecuredResourceImpl implements
- SecuredProperty
-{
+ SecuredProperty {
/**
* Get an instance of SecuredProperty
*
@@ -40,31 +41,24 @@ public class SecuredPropertyImpl extends SecuredResourceImpl implements
* The property to secure
* @return The SecuredProperty
*/
- public static SecuredProperty getInstance( final SecuredModel securedModel,
- final Property property )
- {
- if (securedModel == null)
- {
+ public static SecuredProperty getInstance(final SecuredModel securedModel,
+ final Property property) {
+ if (securedModel == null) {
throw new IllegalArgumentException(
"Secured securedModel may not be null");
}
- if (property == null)
- {
+ if (property == null) {
throw new IllegalArgumentException("Property may not be null");
}
// check that property has a securedModel.
Property goodProp = property;
- if (goodProp.getModel() == null)
- {
+ if (goodProp.getModel() == null) {
final Node n = property.asNode();
- if (property.isAnon())
- {
+ if (property.isAnon()) {
goodProp = securedModel.createProperty(n.getBlankNodeId()
.getLabelString());
- }
- else
- {
+ } else {
goodProp = securedModel.createProperty(property.asNode()
.getURI());
}
@@ -76,10 +70,8 @@ public class SecuredPropertyImpl extends SecuredResourceImpl implements
securedModel, holder);
// if we are going to create a duplicate proxy, just return this
// one.
- if (goodProp instanceof SecuredProperty)
- {
- if (checker.isEquivalent((SecuredProperty) goodProp))
- {
+ if (goodProp instanceof SecuredProperty) {
+ if (checker.isEquivalent((SecuredProperty) goodProp)) {
return (SecuredProperty) goodProp;
}
}
@@ -102,28 +94,25 @@ public class SecuredPropertyImpl extends SecuredResourceImpl implements
*/
private SecuredPropertyImpl(
final SecuredModel securedModel,
- final ItemHolder<? extends Property, ? extends SecuredProperty> holder )
- {
+ final ItemHolder<? extends Property, ? extends SecuredProperty> holder) {
super(securedModel, holder);
this.holder = holder;
}
@Override
- public int getOrdinal()
- {
+ public int getOrdinal() throws ReadDeniedException,
+ AuthenticationRequiredException {
checkRead();
return holder.getBaseItem().getOrdinal();
}
@Override
- public Property inModel( final Model m )
- {
+ public Property inModel(final Model m) {
return (Property) super.inModel(m);
}
@Override
- public boolean isProperty()
- {
+ public boolean isProperty() {
return true;
}
}
[13/13] jena git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/jena
Posted by cl...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/jena
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/7e7bf2b3
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/7e7bf2b3
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/7e7bf2b3
Branch: refs/heads/master
Commit: 7e7bf2b3a3f16c11ad451321c1b4b4a20f6496b9
Parents: da8b220 7442161
Author: Claude Warren <cl...@apache.org>
Authored: Fri Aug 7 19:50:19 2015 +0100
Committer: Claude Warren <cl...@apache.org>
Committed: Fri Aug 7 19:50:19 2015 +0100
----------------------------------------------------------------------
.../sparql/pfunction/PropertyFunctionBase.java | 25 +-
jena-core/src/main/java/jena/schemagen.java | 3 +-
.../apache/jena/fuseki/mgt/ActionDatasets.java | 57 +-
.../apache/jena/fuseki/server/FusekiEnv.java | 53 +-
.../jena/fuseki/servlets/SPARQL_Protocol.java | 68 +-
.../jena/fuseki/servlets/SPARQL_Query.java | 2 +-
.../fuseki/servlets/SPARQL_QueryDataset.java | 20 +-
.../fuseki/servlets/SPARQL_QueryGeneral.java | 100 +-
.../java/org/apache/jena/fuseki/TestQuery.java | 134 ++-
jena-parent/pom.xml | 5 +-
.../java/org/apache/jena/tdb/TDBFactory.java | 17 +-
.../jena/tdb/setup/DatasetBuilderBasic.java | 197 ----
.../jena/tdb/setup/DatasetBuilderStd.java | 27 +-
.../org/apache/jena/tdb/sys/TDBInternal.java | 128 ++-
.../java/org/apache/jena/tdb/sys/TDBMaker.java | 92 +-
.../org/apache/jena/query/text/TextQueryPF.java | 914 +++++++++++--------
16 files changed, 900 insertions(+), 942 deletions(-)
----------------------------------------------------------------------
[02/13] jena git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/jena
Posted by cl...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/jena
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/b44125aa
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/b44125aa
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/b44125aa
Branch: refs/heads/master
Commit: b44125aa23b0668e6ace9eb7636ebca21fd6756c
Parents: 31af91f 62558f4
Author: Claude Warren <cl...@apache.org>
Authored: Fri Jul 24 17:38:56 2015 +0100
Committer: Claude Warren <cl...@apache.org>
Committed: Fri Jul 24 17:38:56 2015 +0100
----------------------------------------------------------------------
apache-jena-osgi/jena-osgi/pom.xml | 4 +-
apache-jena/bin/arq | 6 +-
apache-jena/bin/infer | 6 +-
apache-jena/bin/iri | 6 +-
apache-jena/bin/juuid | 6 +-
apache-jena/bin/nquads | 6 +-
apache-jena/bin/ntriples | 6 +-
apache-jena/bin/qparse | 6 +-
apache-jena/bin/rdfcat | 6 +-
apache-jena/bin/rdfcompare | 6 +-
apache-jena/bin/rdfcopy | 6 +-
apache-jena/bin/rdfparse | 6 +-
apache-jena/bin/rdfxml | 6 +-
apache-jena/bin/riot | 6 +-
apache-jena/bin/rset | 6 +-
apache-jena/bin/rsparql | 6 +-
apache-jena/bin/rupdate | 6 +-
apache-jena/bin/schemagen | 6 +-
apache-jena/bin/sparql | 6 +-
apache-jena/bin/tdbbackup | 6 +-
apache-jena/bin/tdbdump | 6 +-
apache-jena/bin/tdbloader | 6 +-
apache-jena/bin/tdbloader2 | 8 +--
apache-jena/bin/tdbloader2common | 20 ++++++-
apache-jena/bin/tdbloader2data | 15 ++---
apache-jena/bin/tdbloader2index | 62 ++++++++++++--------
apache-jena/bin/tdbquery | 6 +-
apache-jena/bin/tdbstats | 6 +-
apache-jena/bin/tdbupdate | 6 +-
apache-jena/bin/trig | 6 +-
apache-jena/bin/turtle | 6 +-
apache-jena/bin/uparse | 6 +-
apache-jena/bin/update | 6 +-
apache-jena/bin/utf8 | 6 +-
apache-jena/bin/wwwdec | 6 +-
apache-jena/bin/wwwenc | 6 +-
apache-jena/jena-log4j.properties | 29 ++-------
apache-jena/template.bin | 6 +-
.../java/org/apache/jena/riot/RDFLanguages.java | 2 +-
.../apache/jena/riot/TestJenaReaderRIOT.java | 6 +-
.../java/org/apache/jena/riot/TestLangRIOT.java | 3 +-
.../jena/riot/stream/TestStreamManager.java | 6 +-
jena-arq/testing/RIOT/Reader/D.json | 5 --
jena-arq/testing/RIOT/Reader/D.jsonld | 10 ++++
jena-arq/testing/RIOT/Reader/D.rj | 5 ++
jena-arq/testing/RIOT/StreamManager/D.json | 5 --
jena-arq/testing/RIOT/StreamManager/D.jsonld | 10 ++++
jena-arq/testing/RIOT/StreamManager/D.rj | 5 ++
.../org/apache/jena/atlas/logging/LogCtl.java | 57 ++++++++----------
.../jena/ontology/CardinalityQRestriction.java | 3 +-
jena-elephas/jena-elephas-common/pom.xml | 13 ++--
jena-elephas/jena-elephas-io/pom.xml | 21 ++++---
jena-elephas/jena-elephas-mapreduce/pom.xml | 31 +++++-----
jena-elephas/pom.xml | 52 ++++++++--------
jena-maven-tools/pom.xml | 8 ++-
jena-parent/pom.xml | 23 ++++++--
.../jena/permissions/graph/SecuredGraph.java | 8 ++-
.../graph/SecuredGraphEventManager.java | 1 -
.../jena/permissions/model/SecuredModel.java | 21 +++----
.../model/impl/SecuredRDFListImpl.java | 1 -
.../model/impl/SecuredRSIterator.java | 1 -
.../permissions/query/rewriter/OpRewriter.java | 1 -
.../query/rewriter/SecuredFunction.java | 10 ++--
.../graph/GraphEventManagerTest.java | 9 +--
.../jena/permissions/graph/MemGraphTest.java | 1 -
.../model/SecuredModelDetailTest.java | 5 +-
.../model/SecuredReifiedStatementTest.java | 4 --
.../permissions/model/SecuredResourceTest.java | 1 -
.../permissions/model/SecuredStatementTest.java | 1 -
.../query/rewriter/OpRewriterTest.java | 8 +--
jena-text/pom.xml | 7 ++-
.../apache/jena/query/text/TextIndexLucene.java | 2 +-
.../org/apache/jena/query/text/TextQueryPF.java | 4 +-
.../text/AbstractTestDatasetWithTextIndex.java | 16 +++++
.../AbstractTestDatasetWithTextIndexBase.java | 5 +-
.../text/TestLuceneWithMultipleThreads.java | 2 +-
.../org/apache/jena/query/text/TestTextTDB.java | 26 ++++++++
77 files changed, 379 insertions(+), 350 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/b44125aa/jena-permissions/src/test/java/org/apache/jena/permissions/model/SecuredModelDetailTest.java
----------------------------------------------------------------------
[10/13] jena git commit: Added throw exception documentation
Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/impl/SecuredItemImpl.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/impl/SecuredItemImpl.java b/jena-permissions/src/main/java/org/apache/jena/permissions/impl/SecuredItemImpl.java
index 3816dd6..3a717e7 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/impl/SecuredItemImpl.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/impl/SecuredItemImpl.java
@@ -30,130 +30,110 @@ import org.apache.jena.permissions.SecuredItem;
import org.apache.jena.permissions.SecurityEvaluator;
import org.apache.jena.permissions.SecurityEvaluator.Action;
import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
import org.apache.jena.sparql.expr.Expr;
import org.apache.jena.sparql.util.NodeUtils;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-import org.apache.jena.vocabulary.RDF ;
+import org.apache.jena.util.iterator.ExtendedIterator;
+import org.apache.jena.vocabulary.RDF;
/**
* An abstract implementation of SecuredItem that caches security checks.
* <p>
- * Security checks are performed at multiple locations. This implementation ensures that
- * during a single operation the specific check is only evaluated once by caching the result.
+ * Security checks are performed at multiple locations. This implementation
+ * ensures that during a single operation the specific check is only evaluated
+ * once by caching the result.
* </p>
*
*/
-public abstract class SecuredItemImpl implements SecuredItem
-{
+public abstract class SecuredItemImpl implements SecuredItem {
// a key for the secured item.
- private class CacheKey implements Comparable<CacheKey>
- {
+ private class CacheKey implements Comparable<CacheKey> {
private final Action action;
private final Node modelNode;
private final Triple from;
private final Triple to;
private Integer hashCode;
- public CacheKey( final Action action, final Node modelNode )
- {
+ public CacheKey(final Action action, final Node modelNode) {
this(action, modelNode, null, null);
}
- public CacheKey( final Action action, final Node modelNode,
- final Triple to )
- {
+ public CacheKey(final Action action, final Node modelNode,
+ final Triple to) {
this(action, modelNode, to, null);
}
- public CacheKey( final Action action, final Node modelNode,
- final Triple to, final Triple from )
- {
+ public CacheKey(final Action action, final Node modelNode,
+ final Triple to, final Triple from) {
this.action = action;
this.modelNode = modelNode;
this.to = to;
this.from = from;
}
-
- private int compare(Node n1, Node n2)
- {
- if (Node.ANY.equals( n1 ))
- {
- if (Node.ANY.equals(n2))
- {
+
+ private int compare(Node n1, Node n2) {
+ if (Node.ANY.equals(n1)) {
+ if (Node.ANY.equals(n2)) {
return Expr.CMP_EQUAL;
}
return Expr.CMP_LESS;
}
- if (Node.ANY.equals( n2 ))
- {
+ if (Node.ANY.equals(n2)) {
return Expr.CMP_GREATER;
}
- return NodeUtils.compareRDFTerms( n1, n2 );
+ return NodeUtils.compareRDFTerms(n1, n2);
}
- private int compare(Triple t1, Triple t2)
- {
- if (t1 == null)
- {
- if (t2 == null)
- {
+ private int compare(Triple t1, Triple t2) {
+ if (t1 == null) {
+ if (t2 == null) {
return Expr.CMP_EQUAL;
}
return Expr.CMP_LESS;
}
- if (t2 == null)
- {
+ if (t2 == null) {
return Expr.CMP_GREATER;
}
int retval = compare(t1.getSubject(), t2.getSubject());
- if (retval == Expr.CMP_EQUAL)
- {
+ if (retval == Expr.CMP_EQUAL) {
retval = compare(t1.getPredicate(), t2.getPredicate());
}
- if (retval == Expr.CMP_EQUAL)
- {
+ if (retval == Expr.CMP_EQUAL) {
retval = compare(t1.getObject(), t2.getObject());
}
return retval;
}
-
+
@Override
- public int compareTo( final CacheKey other )
- {
+ public int compareTo(final CacheKey other) {
int retval = this.action.compareTo(other.action);
- if (retval == Expr.CMP_EQUAL)
- {
- retval = NodeUtils.compareRDFTerms(this.modelNode,other.modelNode);
+ if (retval == Expr.CMP_EQUAL) {
+ retval = NodeUtils.compareRDFTerms(this.modelNode,
+ other.modelNode);
}
- if (retval == Expr.CMP_EQUAL)
- {
- retval =compare(this.to, other.to);
+ if (retval == Expr.CMP_EQUAL) {
+ retval = compare(this.to, other.to);
}
- if (retval == Expr.CMP_EQUAL)
- {
+ if (retval == Expr.CMP_EQUAL) {
retval = compare(this.from, other.from);
}
return retval;
}
@Override
- public boolean equals( final Object o )
- {
- if (o instanceof CacheKey)
- {
+ public boolean equals(final Object o) {
+ if (o instanceof CacheKey) {
return this.compareTo((CacheKey) o) == 0;
}
return false;
}
@Override
- public int hashCode()
- {
- if (hashCode == null)
- {
+ public int hashCode() {
+ if (hashCode == null) {
hashCode = new HashCodeBuilder().append(action)
.append(modelNode).append(from).append(to).toHashCode();
}
@@ -164,20 +144,21 @@ public abstract class SecuredItemImpl implements SecuredItem
// the maximum size of the cache
public static int MAX_CACHE = 100;
// the cache for this thread.
- public static final ThreadLocal<LRUMap<CacheKey,Boolean>> CACHE = new ThreadLocal<LRUMap<CacheKey,Boolean>>();
+ public static final ThreadLocal<LRUMap<CacheKey, Boolean>> CACHE = new ThreadLocal<LRUMap<CacheKey, Boolean>>();
// the number of times this thread has recursively called the constructor.
public static final ThreadLocal<Integer> COUNT = new ThreadLocal<Integer>();
-
+
/**
- * May Convert a Jena Node object into the SecurityEvaluator.VARIABLE instance.
- * @param jenaNode The Jena node to convert.
+ * May Convert a Jena Node object into the SecurityEvaluator.VARIABLE
+ * instance.
+ *
+ * @param jenaNode
+ * The Jena node to convert.
* @return The Node that represents the jenaNode.
*/
- private static Node convert( final Node jenaNode )
- {
-
- if (jenaNode.isVariable())
- {
+ private static Node convert(final Node jenaNode) {
+
+ if (jenaNode.isVariable()) {
return SecurityEvaluator.VARIABLE;
}
return jenaNode;
@@ -185,17 +166,18 @@ public abstract class SecuredItemImpl implements SecuredItem
/**
* Convert a Jena Triple into a SecTriple.
- * @param jenaTriple The Jena Triple to convert.
+ *
+ * @param jenaTriple
+ * The Jena Triple to convert.
* @return The SecTriple that represents the jenaTriple.
*/
- private static Triple convert(
- final Triple jenaTriple )
- {
- if (jenaTriple.getSubject().isVariable() || jenaTriple.getPredicate().isVariable() || jenaTriple.getObject().isVariable())
- {
- return new Triple(SecuredItemImpl.convert(jenaTriple.getSubject()),
- SecuredItemImpl.convert(jenaTriple.getPredicate()),
- SecuredItemImpl.convert(jenaTriple.getObject()));
+ private static Triple convert(final Triple jenaTriple) {
+ if (jenaTriple.getSubject().isVariable()
+ || jenaTriple.getPredicate().isVariable()
+ || jenaTriple.getObject().isVariable()) {
+ return new Triple(SecuredItemImpl.convert(jenaTriple.getSubject()),
+ SecuredItemImpl.convert(jenaTriple.getPredicate()),
+ SecuredItemImpl.convert(jenaTriple.getObject()));
}
return jenaTriple;
}
@@ -203,47 +185,37 @@ public abstract class SecuredItemImpl implements SecuredItem
/**
* Decrement the number of instances of SecuredItem.
*/
- public static void decrementUse()
- {
+ public static void decrementUse() {
final Integer i = SecuredItemImpl.COUNT.get();
- if (i == null)
- {
+ if (i == null) {
throw new IllegalStateException("No count on exit");
}
- if (i < 1)
- {
+ if (i < 1) {
throw new IllegalStateException("No count less than 1");
}
- if (i == 1)
- {
+ if (i == 1) {
SecuredItemImpl.CACHE.remove();
SecuredItemImpl.COUNT.remove();
- }
- else
- {
- SecuredItemImpl.COUNT.set( i - 1 );
+ } else {
+ SecuredItemImpl.COUNT.set(i - 1);
}
}
/**
* Increment the number of instances of SecuredItem.
*/
- public static void incrementUse()
- {
+ public static void incrementUse() {
final Integer i = SecuredItemImpl.COUNT.get();
- if (i == null)
- {
- SecuredItemImpl.CACHE.set(new LRUMap<CacheKey,Boolean>(Math.max(
+ if (i == null) {
+ SecuredItemImpl.CACHE.set(new LRUMap<CacheKey, Boolean>(Math.max(
SecuredItemImpl.MAX_CACHE, 100)));
- SecuredItemImpl.COUNT.set( 1 );
- }
- else
- {
- SecuredItemImpl.COUNT.set( i + 1 );
+ SecuredItemImpl.COUNT.set(1);
+ } else {
+ SecuredItemImpl.COUNT.set(i + 1);
}
}
- // the evaluator we are using
+ // the evaluator we are using
private final SecurityEvaluator securityEvaluator;
// the secured node for that names the graph.
@@ -254,55 +226,56 @@ public abstract class SecuredItemImpl implements SecuredItem
/**
* Create the SecuredItemImpl.
- * @param securedItem The securedItem.
- * @param holder The Item holder for the securedItem.
- * @throws IllegalArgumentException if securedItem is null or securedItem.getSecurityEvaluator()
- * returns null, or the holder is null.
+ *
+ * @param securedItem
+ * The securedItem.
+ * @param holder
+ * The Item holder for the securedItem.
+ * @throws IllegalArgumentException
+ * if securedItem is null or securedItem.getSecurityEvaluator()
+ * returns null, or the holder is null.
*/
- protected SecuredItemImpl( final SecuredItem securedItem,
- final ItemHolder<?, ?> holder )
- {
- if (securedItem == null)
- {
+ protected SecuredItemImpl(final SecuredItem securedItem,
+ final ItemHolder<?, ?> holder) {
+ if (securedItem == null) {
throw new IllegalArgumentException("Secured item may not be null");
}
- if (securedItem.getSecurityEvaluator() == null)
- {
+ if (securedItem.getSecurityEvaluator() == null) {
throw new IllegalArgumentException(
"Security evaluator in secured item may not be null");
}
- if (holder == null)
- {
+ if (holder == null) {
throw new IllegalArgumentException("ItemHolder may not be null");
}
this.securityEvaluator = securedItem.getSecurityEvaluator();
- this.modelNode = securedItem.getModelNode();
+ this.modelNode = securedItem.getModelNode();
this.itemHolder = holder;
}
/**
* Create the SecuredItemImpl.
- * @param securityEvaluator the secured evaluator to use.
- * @param modelURI the URI for the model.
- * @param holder The holder to use.
- * @throws IllegalArgumentException if security evaluator is null, modelURI is null or empty,
- * or holder is null.
+ *
+ * @param securityEvaluator
+ * the secured evaluator to use.
+ * @param modelURI
+ * the URI for the model.
+ * @param holder
+ * The holder to use.
+ * @throws IllegalArgumentException
+ * if security evaluator is null, modelURI is null or empty, or
+ * holder is null.
*/
- protected SecuredItemImpl( final SecurityEvaluator securityEvaluator,
- final String modelURI, final ItemHolder<?, ?> holder )
- {
- if (securityEvaluator == null)
- {
+ protected SecuredItemImpl(final SecurityEvaluator securityEvaluator,
+ final String modelURI, final ItemHolder<?, ?> holder) {
+ if (securityEvaluator == null) {
throw new IllegalArgumentException(
"Security evaluator may not be null");
}
- if (StringUtils.isEmpty(modelURI))
- {
+ if (StringUtils.isEmpty(modelURI)) {
throw new IllegalArgumentException(
"ModelURI may not be empty or null");
}
- if (holder == null)
- {
+ if (holder == null) {
throw new IllegalArgumentException("ItemHolder may not be null");
}
this.securityEvaluator = securityEvaluator;
@@ -311,191 +284,171 @@ public abstract class SecuredItemImpl implements SecuredItem
}
@Override
- public String toString() {
- if (canRead())
- {
+ public String toString() throws AuthenticationRequiredException {
+ if (canRead()) {
return itemHolder.getBaseItem().toString();
}
return super.toString();
}
-
+
/**
* get the cached value.
- * @param key The key to look for.
- * @return the value of the security check or <code>null</code> if the value has not been cached.
+ *
+ * @param key
+ * The key to look for.
+ * @return the value of the security check or <code>null</code> if the value
+ * has not been cached.
*/
- private Boolean cacheGet( final CacheKey key )
- {
- final LRUMap<CacheKey,Boolean> cache = SecuredItemImpl.CACHE.get();
+ private Boolean cacheGet(final CacheKey key) {
+ final LRUMap<CacheKey, Boolean> cache = SecuredItemImpl.CACHE.get();
return (cache == null) ? null : (Boolean) cache.get(key);
}
/**
* set the cache value.
- * @param key The key to set the value for.
- * @param value The value to set.
+ *
+ * @param key
+ * The key to set the value for.
+ * @param value
+ * The value to set.
*/
- private void cachePut( final CacheKey key, final boolean value )
- {
- final LRUMap<CacheKey,Boolean> cache = SecuredItemImpl.CACHE.get();
- if (cache != null)
- {
+ private void cachePut(final CacheKey key, final boolean value) {
+ final LRUMap<CacheKey, Boolean> cache = SecuredItemImpl.CACHE.get();
+ if (cache != null) {
cache.put(key, value);
SecuredItemImpl.CACHE.set(cache);
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#canCreate()
- */
@Override
- public boolean canCreate()
- {
+ public boolean canCreate() throws AuthenticationRequiredException {
final CacheKey key = new CacheKey(Action.Create, modelNode);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluate(securityEvaluator.getPrincipal(),Action.Create, modelNode);
+ if (retval == null) {
+ retval = securityEvaluator.evaluate(
+ securityEvaluator.getPrincipal(), Action.Create, modelNode);
cachePut(key, retval);
}
return retval;
}
-
@Override
- public boolean canCreate( final Triple triple )
- {
+ public boolean canCreate(final Triple triple)
+ throws AuthenticationRequiredException {
Triple t = convert(triple);
final CacheKey key = new CacheKey(Action.Create, modelNode, t);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluate(securityEvaluator.getPrincipal(),Action.Create, modelNode, t);
+ if (retval == null) {
+ retval = securityEvaluator.evaluate(
+ securityEvaluator.getPrincipal(), Action.Create, modelNode,
+ t);
cachePut(key, retval);
}
return retval;
}
@Override
- public boolean canCreate( final FrontsTriple frontsTriple )
- {
+ public boolean canCreate(final FrontsTriple frontsTriple)
+ throws AuthenticationRequiredException {
return canCreate(frontsTriple.asTriple());
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#canDelete()
- */
@Override
- public boolean canDelete()
- {
+ public boolean canDelete() throws AuthenticationRequiredException {
final CacheKey key = new CacheKey(Action.Delete, modelNode);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluate(securityEvaluator.getPrincipal(),Action.Delete, modelNode);
+ if (retval == null) {
+ retval = securityEvaluator.evaluate(
+ securityEvaluator.getPrincipal(), Action.Delete, modelNode);
cachePut(key, retval);
}
return retval;
}
@Override
- public boolean canDelete( final Triple triple )
- {
+ public boolean canDelete(final Triple triple)
+ throws AuthenticationRequiredException {
Triple t = convert(triple);
final CacheKey key = new CacheKey(Action.Delete, modelNode, t);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluate(securityEvaluator.getPrincipal(),Action.Delete, modelNode, t);
+ if (retval == null) {
+ retval = securityEvaluator.evaluate(
+ securityEvaluator.getPrincipal(), Action.Delete, modelNode,
+ t);
cachePut(key, retval);
}
return retval;
}
@Override
- public boolean canDelete( final FrontsTriple frontsTriple )
- {
+ public boolean canDelete(final FrontsTriple frontsTriple)
+ throws AuthenticationRequiredException {
return canDelete(frontsTriple.asTriple());
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#canRead()
- */
@Override
- public boolean canRead()
- {
+ public boolean canRead() throws AuthenticationRequiredException {
final CacheKey key = new CacheKey(Action.Read, modelNode);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluate(securityEvaluator.getPrincipal(),Action.Read, modelNode);
+ if (retval == null) {
+ retval = securityEvaluator.evaluate(
+ securityEvaluator.getPrincipal(), Action.Read, modelNode);
cachePut(key, retval);
}
return retval;
}
@Override
- public boolean canRead( final Triple triple )
- {
+ public boolean canRead(final Triple triple)
+ throws AuthenticationRequiredException {
Triple t = convert(triple);
final CacheKey key = new CacheKey(Action.Read, modelNode, t);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluate(securityEvaluator.getPrincipal(),Action.Read, modelNode, t);
+ if (retval == null) {
+ retval = securityEvaluator
+ .evaluate(securityEvaluator.getPrincipal(), Action.Read,
+ modelNode, t);
cachePut(key, retval);
}
return retval;
}
@Override
- public boolean canRead( final FrontsTriple frontsTriple )
- {
+ public boolean canRead(final FrontsTriple frontsTriple)
+ throws AuthenticationRequiredException {
return canRead(frontsTriple.asTriple());
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#canUpdate()
- */
@Override
- public boolean canUpdate()
- {
+ public boolean canUpdate() throws AuthenticationRequiredException {
final CacheKey key = new CacheKey(Action.Update, modelNode);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluate(securityEvaluator.getPrincipal(),Action.Update, modelNode);
+ if (retval == null) {
+ retval = securityEvaluator.evaluate(
+ securityEvaluator.getPrincipal(), Action.Update, modelNode);
cachePut(key, retval);
}
return retval;
}
@Override
- public boolean canUpdate( final Triple f, final Triple t )
- {
+ public boolean canUpdate(final Triple f, final Triple t)
+ throws AuthenticationRequiredException {
Triple from = convert(f);
Triple to = convert(t);
final CacheKey key = new CacheKey(Action.Update, modelNode, from, to);
Boolean retval = cacheGet(key);
- if (retval == null)
- {
- retval = securityEvaluator.evaluateUpdate(securityEvaluator.getPrincipal(),modelNode, from, to);
+ if (retval == null) {
+ retval = securityEvaluator.evaluateUpdate(
+ securityEvaluator.getPrincipal(), modelNode, from, to);
cachePut(key, retval);
}
return retval;
}
@Override
- public boolean canUpdate( final FrontsTriple from, final FrontsTriple to )
- {
+ public boolean canUpdate(final FrontsTriple from, final FrontsTriple to)
+ throws AuthenticationRequiredException {
return canUpdate(from.asTriple(), to.asTriple());
}
@@ -504,12 +457,14 @@ public abstract class SecuredItemImpl implements SecuredItem
*
* @throws AddDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkCreate() throws AddDeniedException
- {
- if (!canCreate())
- {
- throw new AddDeniedException( SecuredItem.Util.modelPermissionMsg(modelNode));
+ protected void checkCreate() throws AddDeniedException,
+ AuthenticationRequiredException {
+ if (!canCreate()) {
+ throw new AddDeniedException(
+ SecuredItem.Util.modelPermissionMsg(modelNode));
}
}
@@ -518,74 +473,100 @@ public abstract class SecuredItemImpl implements SecuredItem
*
* @throws AddDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkCreate( final Triple t ) throws AddDeniedException
- {
- if (!canCreate(t))
- {
- throw new AddDeniedException(SecuredItem.Util.triplePermissionMsg(modelNode), t );
+ protected void checkCreate(final Triple t) throws AddDeniedException,
+ AuthenticationRequiredException {
+ if (!canCreate(t)) {
+ throw new AddDeniedException(
+ SecuredItem.Util.triplePermissionMsg(modelNode), t);
}
}
/**
* check that the statement can be created.
- * @param s The statement.
- * @throws AddDeniedException on failure
+ *
+ * @param s
+ * The statement.
+ * @throws AddDeniedException
+ * on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkCreate( final FrontsTriple frontsTriple ) throws AddDeniedException
- {
+ protected void checkCreate(final FrontsTriple frontsTriple)
+ throws AddDeniedException, AuthenticationRequiredException {
checkCreate(frontsTriple.asTriple());
}
/**
* Check that a triple can be reified.
- * @param uri The URI for the reification subject. May be null.
- * @param front the frontstriple that is to be reified.
- * @throws AddDeniedException on failure to add triple
- * @throws UpdateDenied if the updates of the graph are not allowed.
+ *
+ * @param uri
+ * The URI for the reification subject. May be null.
+ * @param front
+ * the frontstriple that is to be reified.
+ * @throws AddDeniedException
+ * on failure to add triple
+ * @throws UpdateDeniedException
+ * if the updates of the graph are not allowed.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkCreateReified( final String uri, final FrontsTriple front ) throws AddDeniedException, UpdateDeniedException
- {
+ protected void checkCreateReified(final String uri, final FrontsTriple front)
+ throws AddDeniedException, UpdateDeniedException,
+ AuthenticationRequiredException {
checkUpdate();
Triple t = front.asTriple();
- final Node n = uri == null ? SecurityEvaluator.FUTURE : NodeFactory.createURI(uri);
+ final Node n = uri == null ? SecurityEvaluator.FUTURE : NodeFactory
+ .createURI(uri);
checkCreate(new Triple(n, RDF.subject.asNode(), t.getSubject()));
checkCreate(new Triple(n, RDF.predicate.asNode(), t.getPredicate()));
checkCreate(new Triple(n, RDF.object.asNode(), t.getObject()));
}
- protected void checkCreateFrontsTriples( final ExtendedIterator<? extends FrontsTriple> stmts ) throws AddDeniedException
- {
- if (!canCreate(Triple.ANY))
- {
- try
- {
- while (stmts.hasNext())
- {
- checkCreate(stmts.next());
+ /**
+ * Check that all the triples can be created.
+ *
+ * @param FrontsTripleIter
+ * an iterator of FrontsTriple objects.
+ * @throws AddDeniedException
+ * if a triple can not be added.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
+ protected void checkCreateFrontsTriples(
+ final ExtendedIterator<? extends FrontsTriple> FrontsTripleIter)
+ throws AddDeniedException, AuthenticationRequiredException {
+ if (!canCreate(Triple.ANY)) {
+ try {
+ while (FrontsTripleIter.hasNext()) {
+ checkCreate(FrontsTripleIter.next());
}
- }
- finally
- {
- stmts.close();
+ } finally {
+ FrontsTripleIter.close();
}
}
}
- protected void checkCreateTriples(
- final ExtendedIterator<Triple> triples ) throws AddDeniedException
- {
- if (!canCreate(Triple.ANY))
- {
- try
- {
- while (triples.hasNext())
- {
+ /**
+ * Check that all the triples can be created.
+ *
+ * @param triples
+ * an iterator of triples.
+ * @throws AddDeniedException
+ * if a triple can not be added.
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
+ protected void checkCreateTriples(final ExtendedIterator<Triple> triples)
+ throws AddDeniedException, AuthenticationRequiredException {
+ if (!canCreate(Triple.ANY)) {
+ try {
+ while (triples.hasNext()) {
checkCreate(triples.next());
}
- }
- finally
- {
+ } finally {
triples.close();
}
}
@@ -596,67 +577,92 @@ public abstract class SecuredItemImpl implements SecuredItem
*
* @throws DeleteDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkDelete() throws DeleteDeniedException
- {
- if (!canDelete())
- {
- throw new DeleteDeniedException(SecuredItem.Util.modelPermissionMsg(modelNode));
+ protected void checkDelete() throws DeleteDeniedException,
+ AuthenticationRequiredException {
+ if (!canDelete()) {
+ throw new DeleteDeniedException(
+ SecuredItem.Util.modelPermissionMsg(modelNode));
}
}
/**
* check that the triple can be deleted in the securedModel.,
*
+ * @param triple
+ * The triple to check.
* @throws DeleteDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkDelete( final Triple t )
- {
- if (!canDelete(t))
- {
- throw new DeleteDeniedException(SecuredItem.Util.triplePermissionMsg(modelNode), t);
+ protected void checkDelete(final Triple triple)
+ throws DeleteDeniedException, AuthenticationRequiredException {
+ if (!canDelete(triple)) {
+ throw new DeleteDeniedException(
+ SecuredItem.Util.triplePermissionMsg(modelNode), triple);
}
}
- protected void checkDelete( final FrontsTriple frontsTriple )
- {
+ /**
+ * check that the triple can be deleted in the securedModel.,
+ *
+ * @param frontsTriple
+ * An object fronting the triple to check.
+ * @throws DeleteDeniedException
+ * on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
+ protected void checkDelete(final FrontsTriple frontsTriple)
+ throws DeleteDeniedException, AuthenticationRequiredException {
checkDelete(frontsTriple.asTriple());
}
+ /**
+ * check that the triples can be deleted in the securedModel.,
+ *
+ * @param frontsTripleIter
+ * An iterator of objects fronting triples to check.
+ * @throws DeleteDeniedException
+ * on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
protected void checkDeleteFrontsTriples(
- final ExtendedIterator<? extends FrontsTriple> stmts )
- {
- if (!canDelete(Triple.ANY))
- {
- try
- {
- while (stmts.hasNext())
- {
- checkDelete(stmts.next());
+ final ExtendedIterator<? extends FrontsTriple> frontsTriplesIter)
+ throws DeleteDeniedException, AuthenticationRequiredException {
+ if (!canDelete(Triple.ANY)) {
+ try {
+ while (frontsTriplesIter.hasNext()) {
+ checkDelete(frontsTriplesIter.next());
}
- }
- finally
- {
- stmts.close();
+ } finally {
+ frontsTriplesIter.close();
}
}
}
- protected void checkDeleteTriples(
- final ExtendedIterator<Triple> triples )
- {
- if (!canDelete(Triple.ANY))
- {
- try
- {
- while (triples.hasNext())
- {
+ /**
+ * check that the triples can be deleted in the securedModel.,
+ *
+ * @param triples
+ * An iterator of triples to check.
+ * @throws DeleteDeniedException
+ * on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
+ protected void checkDeleteTriples(final ExtendedIterator<Triple> triples)
+ throws DeleteDeniedException, AuthenticationRequiredException {
+ if (!canDelete(Triple.ANY)) {
+ try {
+ while (triples.hasNext()) {
checkDelete(triples.next());
}
- }
- finally
- {
+ } finally {
triples.close();
}
}
@@ -667,61 +673,89 @@ public abstract class SecuredItemImpl implements SecuredItem
*
* @throws ReadDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkRead() throws ReadDeniedException
- {
- if (!canRead())
- {
- throw new ReadDeniedException(SecuredItem.Util.modelPermissionMsg(modelNode));
+ protected void checkRead() throws ReadDeniedException,
+ AuthenticationRequiredException {
+ if (!canRead()) {
+ throw new ReadDeniedException(
+ SecuredItem.Util.modelPermissionMsg(modelNode));
}
}
/**
* check that the triple can be read in the securedModel.,
*
+ * @param triple
+ * The triple to check.
* @throws ReadDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkRead( final Triple t ) throws ReadDeniedException
- {
- if (!canRead(t))
- {
- throw new ReadDeniedException(SecuredItem.Util.triplePermissionMsg(modelNode), t);
+ protected void checkRead(final Triple triple) throws ReadDeniedException,
+ AuthenticationRequiredException {
+ if (!canRead(triple)) {
+ throw new ReadDeniedException(
+ SecuredItem.Util.triplePermissionMsg(modelNode), triple);
}
}
- protected void checkRead( final FrontsTriple frontsTriple ) throws ReadDeniedException
- {
+ /**
+ * check that the triple can be read in the securedModel.,
+ *
+ * @param frontsTriple
+ * The object fronting the triple to check.
+ * @throws ReadDeniedException
+ * on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
+ protected void checkRead(final FrontsTriple frontsTriple)
+ throws ReadDeniedException, AuthenticationRequiredException {
checkRead(frontsTriple.asTriple());
}
- protected void checkReadFrontsTriples( final ExtendedIterator<FrontsTriple> stmts ) throws ReadDeniedException
- {
- try
- {
- while (stmts.hasNext())
- {
- checkRead(stmts.next());
+ /**
+ * check that the triple can be read in the securedModel.,
+ *
+ * @param frontsTripleIter
+ * The iterator of fronts triple objects to check.
+ * @throws ReadDeniedException
+ * on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
+ protected void checkReadFrontsTriples(
+ final ExtendedIterator<FrontsTriple> frontsTripleIter)
+ throws ReadDeniedException, AuthenticationRequiredException {
+ try {
+ while (frontsTripleIter.hasNext()) {
+ checkRead(frontsTripleIter.next());
}
- }
- finally
- {
- stmts.close();
+ } finally {
+ frontsTripleIter.close();
}
}
- protected void checkReadTriples(
- final ExtendedIterator<Triple> triples ) throws ReadDeniedException
- {
- try
- {
- while (triples.hasNext())
- {
+ /**
+ * check that the triple can be read in the securedModel.,
+ *
+ * @param triples
+ * The iterator of triples to check.
+ * @throws ReadDeniedException
+ * on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
+ */
+ protected void checkReadTriples(final ExtendedIterator<Triple> triples)
+ throws ReadDeniedException, AuthenticationRequiredException {
+ try {
+ while (triples.hasNext()) {
checkRead(triples.next());
}
- }
- finally
- {
+ } finally {
triples.close();
}
}
@@ -731,78 +765,62 @@ public abstract class SecuredItemImpl implements SecuredItem
*
* @throws UpdateDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkUpdate() throws UpdateDeniedException
- {
- if (!canUpdate())
- {
- throw new UpdateDeniedException(SecuredItem.Util.modelPermissionMsg(modelNode));
+ protected void checkUpdate() throws UpdateDeniedException,
+ AuthenticationRequiredException {
+ if (!canUpdate()) {
+ throw new UpdateDeniedException(
+ SecuredItem.Util.modelPermissionMsg(modelNode));
}
}
/**
* check that the triple can be updated in the securedModel.,
*
- * @param from the starting triple
- * @param to the final triple.
+ * @param from
+ * the starting triple
+ * @param to
+ * the final triple.
* @throws UpdateDeniedException
* on failure
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- protected void checkUpdate( final Triple from, final Triple to ) throws UpdateDeniedException
- {
- if (!canUpdate(from, to))
- {
- throw new UpdateDeniedException( String.format(
- "%s: %s to %s", SecuredItem.Util.modelPermissionMsg(modelNode), from, to));
+ protected void checkUpdate(final Triple from, final Triple to)
+ throws UpdateDeniedException, AuthenticationRequiredException {
+ if (!canUpdate(from, to)) {
+ throw new UpdateDeniedException(String.format("%s: %s to %s",
+ SecuredItem.Util.modelPermissionMsg(modelNode), from, to));
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#equals(java.lang.Object)
- */
@Override
- public boolean equals( final Object o )
- {
- if (Proxy.isProxyClass(o.getClass()))
- {
+ public boolean equals(final Object o) {
+ if (Proxy.isProxyClass(o.getClass())) {
return o.equals(itemHolder.getSecuredItem());
- }
- else
- {
- if (o instanceof SecuredItemImpl)
- {
- return itemHolder.getBaseItem().equals( ((SecuredItemImpl)o).getBaseItem());
+ } else {
+ if (o instanceof SecuredItemImpl) {
+ return itemHolder.getBaseItem().equals(
+ ((SecuredItemImpl) o).getBaseItem());
}
return false;
}
}
@Override
- public int hashCode()
- {
+ public int hashCode() {
return itemHolder.getBaseItem().hashCode();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#getBaseItem()
- */
+
@Override
- public Object getBaseItem()
- {
+ public Object getBaseItem() {
return itemHolder.getBaseItem();
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#getModelIRI()
- */
@Override
- public String getModelIRI()
- {
+ public String getModelIRI() {
return modelNode.getURI();
}
@@ -810,30 +828,17 @@ public abstract class SecuredItemImpl implements SecuredItem
* get the name of the model.
*/
@Override
- public Node getModelNode()
- {
+ public Node getModelNode() {
return modelNode;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.SecuredItem#getSecurityEvaluator()
- */
@Override
- public SecurityEvaluator getSecurityEvaluator()
- {
+ public SecurityEvaluator getSecurityEvaluator() {
return securityEvaluator;
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jena.security.isEquivalent()
- */
@Override
- public boolean isEquivalent( final SecuredItem securedItem )
- {
+ public boolean isEquivalent(final SecuredItem securedItem) {
return SecuredItem.Util.isEquivalent(this, securedItem);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredAlt.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredAlt.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredAlt.java
index fb640e8..2ee8281 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredAlt.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredAlt.java
@@ -17,10 +17,11 @@
*/
package org.apache.jena.permissions.model;
-import org.apache.jena.rdf.model.Alt ;
-import org.apache.jena.rdf.model.RDFNode ;
-import org.apache.jena.rdf.model.ResourceF ;
+import org.apache.jena.rdf.model.Alt;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.ResourceF;
import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
@@ -30,246 +31,320 @@ import org.apache.jena.shared.UpdateDeniedException;
* Use the SecuredAlt.Factory to create instances
*/
@SuppressWarnings("deprecation")
-public interface SecuredAlt extends Alt, SecuredContainer
-{
+public interface SecuredAlt extends Alt, SecuredContainer {
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredRDFNode getDefault() throws ReadDeniedException;
+ public SecuredRDFNode getDefault() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt getDefaultAlt() throws ReadDeniedException;
+ public SecuredAlt getDefaultAlt() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredBag getDefaultBag() throws ReadDeniedException;
+ public SecuredBag getDefaultBag() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean getDefaultBoolean() throws ReadDeniedException;
+ public boolean getDefaultBoolean() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public byte getDefaultByte() throws ReadDeniedException;
+ public byte getDefaultByte() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public char getDefaultChar() throws ReadDeniedException;
+ public char getDefaultChar() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public double getDefaultDouble() throws ReadDeniedException;
+ public double getDefaultDouble() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public float getDefaultFloat() throws ReadDeniedException;
+ public float getDefaultFloat() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int getDefaultInt() throws ReadDeniedException;
+ public int getDefaultInt() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getDefaultLanguage() throws ReadDeniedException;
+ public String getDefaultLanguage() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredLiteral getDefaultLiteral() throws ReadDeniedException;
+ public SecuredLiteral getDefaultLiteral() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public long getDefaultLong() throws ReadDeniedException;
+ public long getDefaultLong() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredResource getDefaultResource() throws ReadDeniedException;
+ public SecuredResource getDefaultResource() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
@Deprecated
- public SecuredResource getDefaultResource( final ResourceF f )
- throws ReadDeniedException;
+ public SecuredResource getDefaultResource(final ResourceF f)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredSeq getDefaultSeq() throws ReadDeniedException;
+ public SecuredSeq getDefaultSeq() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public short getDefaultShort() throws ReadDeniedException;
+ public short getDefaultShort() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple(this, RDF.li(1), o )
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getDefaultString() throws ReadDeniedException;
+ public String getDefaultString() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final boolean o )
- throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final boolean o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final char o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final char o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final double o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final double o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final float o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final float o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final long o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final long o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final Object o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final Object o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final RDFNode o )
- throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final RDFNode o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final String o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final String o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Update SecTriple(this, RDF.li(1), existing ), SecTriple(this,
- * RDF.li(1), o )
+ * RDF.li(1), o )
* @sec.triple Create SecTriple(this, RDF.li(1), o ) if no current default
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredAlt setDefault( final String o, final String l )
- throws UpdateDeniedException, AddDeniedException;
+ public SecuredAlt setDefault(final String o, final String l)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredContainer.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredContainer.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredContainer.java
index b8a624e..b2ddae8 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredContainer.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredContainer.java
@@ -21,10 +21,11 @@ import java.util.Set;
import org.apache.jena.permissions.SecurityEvaluator.Action;
import org.apache.jena.permissions.model.impl.SecuredNodeIterator;
-import org.apache.jena.rdf.model.Container ;
-import org.apache.jena.rdf.model.RDFNode ;
-import org.apache.jena.rdf.model.Statement ;
+import org.apache.jena.rdf.model.Container;
+import org.apache.jena.rdf.model.RDFNode;
+import org.apache.jena.rdf.model.Statement;
import org.apache.jena.shared.AddDeniedException;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.DeleteDeniedException;
import org.apache.jena.shared.ReadDeniedException;
import org.apache.jena.shared.UpdateDeniedException;
@@ -35,197 +36,261 @@ import org.apache.jena.shared.UpdateDeniedException;
* Use one of the SecuredContainer derived class Factory methods to create
* instances
*/
-public interface SecuredContainer extends Container, SecuredResource
-{
+public interface SecuredContainer extends Container, SecuredResource {
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final boolean o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final boolean o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final char o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final char o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final double o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final double o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final float o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final float o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final long o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final long o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final Object o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final Object o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final RDFNode o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final RDFNode o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final String o ) throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final String o) throws UpdateDeniedException,
+ AddDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Create SecTriple( this, RDF.li, o );
* @throws UpdateDeniedException
* @throws AddDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer add( final String o, final String l )
- throws UpdateDeniedException, AddDeniedException;
+ public SecuredContainer add(final String o, final String l)
+ throws UpdateDeniedException, AddDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final boolean o ) throws ReadDeniedException;
+ public boolean contains(final boolean o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final char o ) throws ReadDeniedException;
+ public boolean contains(final char o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final double o ) throws ReadDeniedException;
+ public boolean contains(final double o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final float o ) throws ReadDeniedException;
+ public boolean contains(final float o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final long o ) throws ReadDeniedException;
+ public boolean contains(final long o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final Object o ) throws ReadDeniedException;
+ public boolean contains(final Object o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final RDFNode o ) throws ReadDeniedException;
+ public boolean contains(final RDFNode o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final String o ) throws ReadDeniedException;
+ public boolean contains(final String o) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read SecTriple( this, RDF.li, o );
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean contains( final String o, final String l )
- throws ReadDeniedException;
+ public boolean contains(final String o, final String l)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @sec.triple Read on each triple ( this, rdf:li_? node ) returned by
- * iterator;
+ * iterator;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredNodeIterator<RDFNode> iterator() throws ReadDeniedException;
+ public SecuredNodeIterator<RDFNode> iterator() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
- * @param perms the Permissions required on each node returned
+ * @param perms
+ * the Permissions required on each node returned
* @sec.graph Read
* @sec.triple Read + perms on each triple ( this, rdf:li_? node ) returned
- * by iterator;
+ * by iterator;
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
- public SecuredNodeIterator<RDFNode> iterator( Set<Action> perms )
- throws ReadDeniedException;
+ public SecuredNodeIterator<RDFNode> iterator(Set<Action> perms)
+ throws ReadDeniedException, AuthenticationRequiredException;
/**
* @sec.graph Update
* @sec.triple Delete s as triple;
* @throws UpdateDeniedException
* @throws DeleteDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public SecuredContainer remove( final Statement s )
- throws UpdateDeniedException, DeleteDeniedException;
+ public SecuredContainer remove(final Statement s)
+ throws UpdateDeniedException, DeleteDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public int size() throws ReadDeniedException;
+ public int size() throws ReadDeniedException,
+ AuthenticationRequiredException;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/2c0454c6/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredLiteral.java
----------------------------------------------------------------------
diff --git a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredLiteral.java b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredLiteral.java
index 05194a6..10d0215 100644
--- a/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredLiteral.java
+++ b/jena-permissions/src/main/java/org/apache/jena/permissions/model/SecuredLiteral.java
@@ -17,10 +17,11 @@
*/
package org.apache.jena.permissions.model;
-import org.apache.jena.datatypes.DatatypeFormatException ;
-import org.apache.jena.datatypes.RDFDatatype ;
-import org.apache.jena.rdf.model.Literal ;
-import org.apache.jena.rdf.model.Model ;
+import org.apache.jena.datatypes.DatatypeFormatException;
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.rdf.model.Literal;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.shared.AuthenticationRequiredException;
import org.apache.jena.shared.ReadDeniedException;
/**
@@ -28,8 +29,7 @@ import org.apache.jena.shared.ReadDeniedException;
*
* Use the SecuredLiteral.Factory to create instances
*/
-public interface SecuredLiteral extends Literal, SecuredRDFNode
-{
+public interface SecuredLiteral extends Literal, SecuredRDFNode {
@Override
public SecuredLiteral asLiteral();
@@ -38,135 +38,180 @@ public interface SecuredLiteral extends Literal, SecuredRDFNode
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public boolean getBoolean() throws ReadDeniedException,
- DatatypeFormatException;
+ DatatypeFormatException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public byte getByte() throws ReadDeniedException, DatatypeFormatException;
+ public byte getByte() throws ReadDeniedException, DatatypeFormatException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public char getChar() throws ReadDeniedException, DatatypeFormatException;
+ public char getChar() throws ReadDeniedException, DatatypeFormatException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public RDFDatatype getDatatype() throws ReadDeniedException;
+ public RDFDatatype getDatatype() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getDatatypeURI() throws ReadDeniedException;
+ public String getDatatypeURI() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public double getDouble() throws ReadDeniedException,
- DatatypeFormatException;
+ DatatypeFormatException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public float getFloat() throws ReadDeniedException,
- DatatypeFormatException;
+ DatatypeFormatException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
* @throws DatatypeFormatException
*/
@Override
- public int getInt() throws ReadDeniedException, DatatypeFormatException;
+ public int getInt() throws ReadDeniedException, DatatypeFormatException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getLanguage() throws ReadDeniedException;
+ public String getLanguage() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public String getLexicalForm() throws ReadDeniedException;
+ public String getLexicalForm() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public long getLong() throws ReadDeniedException, DatatypeFormatException;
+ public long getLong() throws ReadDeniedException, DatatypeFormatException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public short getShort() throws ReadDeniedException,
- DatatypeFormatException;
+ DatatypeFormatException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
* @throws DatatypeFormatException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
public String getString() throws ReadDeniedException,
- DatatypeFormatException;
+ DatatypeFormatException, AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Object getValue() throws ReadDeniedException;
+ public Object getValue() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public Literal inModel( final Model m ) throws ReadDeniedException;
+ public Literal inModel(final Model m) throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean isWellFormedXML() throws ReadDeniedException;
+ public boolean isWellFormedXML() throws ReadDeniedException,
+ AuthenticationRequiredException;
/**
* @sec.graph Read
* @throws ReadDeniedException
+ * @throws AuthenticationRequiredException
+ * if user is not authenticated and is required to be.
*/
@Override
- public boolean sameValueAs( final Literal other )
- throws ReadDeniedException;
+ public boolean sameValueAs(final Literal other) throws ReadDeniedException,
+ AuthenticationRequiredException;
}