You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/04/24 14:20:07 UTC
[09/24] jena git commit: Module jena-seurity becomes jena-permissions
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredProperty.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredProperty.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredProperty.java
deleted file mode 100644
index 6c9518f..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredProperty.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model;
-
-import org.apache.jena.rdf.model.Property ;
-import org.apache.jena.security.AccessDeniedException;
-
-/**
- * The interface for secured Property instances.
- *
- * Use the SecuredProperty.Factory to create instances
- */
-public interface SecuredProperty extends SecuredResource, Property
-{
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public int getOrdinal() throws AccessDeniedException;
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFList.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFList.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFList.java
deleted file mode 100644
index 08bac61..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFList.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.security.AccessDeniedException;
-import org.apache.jena.security.SecurityEvaluator.Action;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-
-public interface SecuredRDFList extends RDFList, SecuredResource
-{
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple(SecNode.FUTURE, listFirst(), value)
- * @sec.triple Create SecTriple(SecNode.FUTURE, listFirst(), listNil())
- * @throws AccessDeniedException
- */
- @Override
- public void add( final RDFNode value ) throws AccessDeniedException;
-
- /**
- * 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 )
- */
- @Override
- public RDFList append( final Iterator<? extends RDFNode> nodes )
- throws AccessDeniedException;
-
- /**
- * Resulting list will contain the readable nodes from this list
- * 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 )
- */
- @Override
- public RDFList append( final RDFList list ) throws AccessDeniedException;
-
- /**
- * Uses the security settings for the application of the function calls.
- * Thus if the function reads data the Read must be allowed, etc.
- *
- * @sec.graph Read
- * @sec.triple Read (to be included in the calculation)
- * @sec.triple other permissions required by the function.
- * @throws AccessDeniedException
- * graph Read or other permissions are not met
- */
- @Override
- public void apply( final ApplyFn fn ) throws AccessDeniedException;
-
- /**
- * This method is intended to provide the capabilities to apply functions
- * 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.
- *
- * @param constraints
- * The permissions the user must have on the items in the list.
- * @param fn
- * The function to apply.
- *
- * @sec.graph Read
- * @sec.triple Read and constraints
- * @throws AccessDeniedException
- */
- public void apply( Set<Action> constraints, final ApplyFn fn )
- throws AccessDeniedException;
-
- /**
- * @sec.triple Read for triples containing the returned RDFNodes.
- * @return List<SecuredRDFNode>
- */
- @Override
- public List<RDFNode> asJavaList();
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, node ) for each
- * node in
- * nodes.
- * @throws AccessDeniedException
- */
- @Override
- public void concatenate( final Iterator<? extends RDFNode> nodes )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, node ) for each
- * node in
- * list.
- * @throws AccessDeniedException
- */
- @Override
- public void concatenate( final RDFList list ) throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( SecNode.FUTURE, RDF.first, value )
- * @sec.triple Create SecTriple( SecNode.FUTURE, RDF.rest, this )
- * @throws AccessDeniedException
- */
- @Override
- public SecuredRDFList cons( final RDFNode value )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read for triple containing value.
- * @throws AccessDeniedException
- */
- @Override
- public boolean contains( final RDFNode value ) throws AccessDeniedException;
-
- /**
- * 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 )
- */
- @Override
- public SecuredRDFList copy();
-
- /**
- * 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.
- *
- * List may be shortened by security constraints.
- *
- * @sec.graph Read
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public SecuredRDFNode get( final int i ) throws AccessDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
-
- /**
- * The value that is at the head of the list.
- *
- * head may be shifted by security constraints.
- *
- * @sec.graph Read
- * @sec.triple Read for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- */
- @Override
- public RDFNode getHead() throws AccessDeniedException, EmptyListException;
-
- /**
- * The value that is at the tail of the list.
- *
- * tail may be shifted by security constraints.
- *
- * @sec.graph Read
- * @sec.triple Read for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public SecuredRDFList getTail() throws AccessDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
-
- /**
- * @sec.graph Read
- */
- @Override
- public String getValidityErrorMessage() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public int indexOf( final RDFNode value ) throws AccessDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public int indexOf( final RDFNode value, final int start )
- throws AccessDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public boolean isEmpty() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public boolean isValid() throws AccessDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read for triple containing value to be included in the result.
- * @throws AccessDeniedException
- */
- @Override
- public ExtendedIterator<RDFNode> iterator() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read + requiredPerms for triple containing value to be
- * included in the result.
- * @throws AccessDeniedException
- */
- public ExtendedIterator<RDFNode> iterator( Set<Action> requiredPerms )
- throws AccessDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
-
- /**
- * Only readable triples will be passed to the function. If the function
- * does
- * any action other than read those permissions must also be granted.
- *
- * @sec.graph Read
- * @sec.triple Read for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public Object reduce( final ReduceFn fn, final Object initial )
- throws AccessDeniedException, EmptyListException,
- ListIndexException, InvalidListException;
-
- /**
- * 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
- * @sec.triple Read for triple containing value.
- * @param requiredActions
- * The set of permission (in addition to Read) that the user must
- * have
- * @param fn
- * The reduction function
- * @param initial
- * The initial state for the ruduce value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- public Object reduce( Set<Action> requiredActions, final ReduceFn fn,
- final Object initial ) throws AccessDeniedException,
- EmptyListException, ListIndexException, InvalidListException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public RDFList remove( final RDFNode val ) throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete for all triples.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- @Deprecated
- public void removeAll() throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete for the head triple.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public RDFList removeHead() throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public void removeList() throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update for triplie i, and value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public SecuredRDFNode replace( final int i, final RDFNode value )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read for triples included in the comparison.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public boolean sameListAs( final RDFList list )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create for triple containing value.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public SecuredRDFNode setHead( final RDFNode value )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @throws AccessDeniedException
- */
- @Override
- public void setStrict( final boolean strict ) throws AccessDeniedException;
-
- /**
- * Size may be modified by security constraionts.
- *
- * @sec.graph Read
- * @sec.triple Read for triples counted in the result.
- * @throws AccessDeniedException
- * @throws EmptyListException
- * @throws ListIndexException
- * @throws InvalidListException
- */
- @Override
- public int size() throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create for triple containing value.
- * @throws AccessDeniedException
- */
- @Override
- public SecuredRDFList with( final RDFNode value )
- throws AccessDeniedException;
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFNode.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFNode.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFNode.java
deleted file mode 100644
index 5002366..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredRDFNode.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model;
-
-import org.apache.jena.graph.Node ;
-import org.apache.jena.rdf.model.Model ;
-import org.apache.jena.rdf.model.RDFNode ;
-import org.apache.jena.security.AccessDeniedException;
-import org.apache.jena.security.impl.SecuredItem;
-
-/**
- * The interface for secured RDFNode instances.
- *
- * Use one the SecuredRDFNode derived class Factories to create instances
- */
-public interface SecuredRDFNode extends RDFNode, SecuredItem
-{
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public Node asNode() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public <T extends RDFNode> boolean canAs( final Class<T> view )
- throws AccessDeniedException;
-
- @Override
- public SecuredModel getModel();
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public RDFNode inModel( final Model m ) throws AccessDeniedException;
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredReifiedStatement.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredReifiedStatement.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredReifiedStatement.java
deleted file mode 100644
index 67e33ad..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredReifiedStatement.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model;
-
-import org.apache.jena.rdf.model.ReifiedStatement ;
-import org.apache.jena.security.AccessDeniedException;
-
-/**
- * The interface for secured ReifiedStatement instances.
- *
- * Use the SecuredReifiedStatement.Factory to create instances
- */
-public interface SecuredReifiedStatement extends ReifiedStatement,
- SecuredResource
-{
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement getStatement();
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredResource.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredResource.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredResource.java
deleted file mode 100644
index 18ba568..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredResource.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model;
-
-import org.apache.jena.datatypes.RDFDatatype ;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.security.AccessDeniedException;
-import org.apache.jena.security.model.impl.SecuredStatementIterator;
-
-/**
- * The interface for secured Resource instances.
- *
- * Use the SecuredResource.Factory to create instances
- */
-public interface SecuredResource extends Resource, SecuredRDFNode
-{
-
- @Override
- public SecuredResource abort();
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public SecuredResource addLiteral( final Property p, final boolean o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addLiteral( final Property p, final char o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, value, d )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addLiteral( final Property value, final double d )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, value, d )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addLiteral( final Property value, final float d )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addLiteral( final Property p, final Literal o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addLiteral( final Property p, final long o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addLiteral( final Property p, final Object o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addProperty( final Property p, final RDFNode o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addProperty( final Property p, final String o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, literal(lexicalForm,datatype) )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addProperty( final Property p, final String lexicalForm,
- final RDFDatatype datatype ) throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create (this, p, o )
- * @throws AccessDeniedException
- */
- @Override
- public Resource addProperty( final Property p, final String o,
- final String l ) throws AccessDeniedException;
-
- @Override
- public SecuredResource asResource();
-
- @Override
- public SecuredResource begin();
-
- @Override
- public SecuredResource commit();
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public boolean equals( final Object o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public AnonId getId() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public String getLocalName() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public String getNameSpace() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement getProperty( final Property p )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public SecuredResource getPropertyResourceValue( final Property p )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement getRequiredProperty( final Property p )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public String getURI() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasLiteral( final Property p, final boolean o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasLiteral( final Property p, final char o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasLiteral( final Property p, final double o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasLiteral( final Property p, final float o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasLiteral( final Property p, final long o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasLiteral( final Property p, final Object o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasProperty( final Property p ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasProperty( final Property p, final RDFNode o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,o)
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasProperty( final Property p, final String o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple(this,p,literal(o,l))
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasProperty( final Property p, final String o, final String l )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasURI( final String uri ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read on returned Statements
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatementIterator listProperties()
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read on returned Statements
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatementIterator listProperties( final Property p )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete on associated Statements
- * @throws AccessDeniedException
- */
- @Override
- public SecuredResource removeAll( final Property p )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete on all Statements
- * @throws AccessDeniedException
- */
- @Override
- public SecuredResource removeProperties() throws AccessDeniedException;
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredSeq.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredSeq.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredSeq.java
deleted file mode 100644
index 05977ea..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredSeq.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.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.security.AccessDeniedException;
-
-/**
- * The interface for secured Seq instances.
- *
- * Use the SecuredSeq.Factory to create instances
- *
- * Sequence may have breaks in the order.
- * http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#Containers
- *
- */
-public interface SecuredSeq extends Seq, SecuredContainer
-{
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final boolean o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final char o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final double o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final float o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final long o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final Object o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final RDFNode o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final String o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Create SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq add( final int index, final String o, final String l )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredAlt getAlt( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredBag getBag( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public boolean getBoolean( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public byte getByte( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public char getChar( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public double getDouble( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public float getFloat( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int getInt( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public String getLanguage( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredLiteral getLiteral( final int index )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public long getLong( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredRDFNode getObject( final int index )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredResource getResource( final int index )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- @Deprecated
- public SecuredResource getResource( final int index, final ResourceF f )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public SecuredSeq getSeq( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public short getShort( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public String getString( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final boolean o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final char o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final double o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final float o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final long o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final Object o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final RDFNode o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final String o ) throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read SecTriple( this, RDF.li(1), o )
- */
- @Override
- public int indexOf( final String o, final String l )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete SecTriple( this, RDF.li(1), o )
- * @sec.triple Update Triples after index
- */
- @Override
- public SecuredSeq remove( final int index ) throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final boolean o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final char o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final double o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final float o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final long o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final Object o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final RDFNode o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final String o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update SecTriple( this, RDF.li(index), old ) SecTriple( this,
- * RDF.li(index), o )
- */
- @Override
- public SecuredSeq set( final int index, final String o, final String l )
- throws AccessDeniedException;
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredStatement.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredStatement.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredStatement.java
deleted file mode 100644
index 1f293fa..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredStatement.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model;
-
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.security.AccessDeniedException;
-import org.apache.jena.security.impl.SecuredItem;
-
-/**
- * The interface for secured Statement instances.
- *
- * Use the SecuredStatement.Factory to create instances
- */
-public interface SecuredStatement extends Statement, SecuredItem
-{
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeLiteralObject( boolean o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeLiteralObject( char o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeLiteralObject( double o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeLiteralObject( float o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeLiteralObject( int o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeLiteralObject( long o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeObject( RDFNode o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeObject( String o )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeObject( String o, boolean wellFormed )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeObject( String o, String l )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Update
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement changeObject( String o, String l, boolean wellFormed )
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read, Update
- * @sec.triple Create
- * @throws AccessDeniedException
- */
- @Override
- public SecuredReifiedStatement createReifiedStatement()
- throws AccessDeniedException;
-
- /**
- * @sec.graph Read, Update
- * @sec.triple Create
- * @throws AccessDeniedException
- */
- @Override
- public SecuredReifiedStatement createReifiedStatement( String uri )
- throws AccessDeniedException;
-
- @Override
- public SecuredAlt getAlt();
-
- @Override
- public SecuredBag getBag();
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public boolean getBoolean() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public byte getByte() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public char getChar() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public double getDouble() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public float getFloat() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public int getInt() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public String getLanguage() throws AccessDeniedException;
-
- @Override
- public SecuredLiteral getLiteral();
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public long getLong() throws AccessDeniedException;
-
- @Override
- public SecuredModel getModel();
-
- @Override
- public SecuredRDFNode getObject();
-
- @Override
- public SecuredProperty getPredicate();
-
- @Override
- public SecuredStatement getProperty( Property p );
-
- @Override
- public SecuredResource getResource();
-
- @Override
- @Deprecated
- public SecuredResource getResource( ResourceF f );
-
- @Override
- public SecuredSeq getSeq();
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public short getShort() throws AccessDeniedException;
-
- @Override
- public SecuredStatement getStatementProperty( Property p );
-
- /**
- * @sec.graph Read
- * @throws AccessDeniedException
- */
- @Override
- public String getString() throws AccessDeniedException;
-
- @Override
- public SecuredResource getSubject();
-
- /**
- * @sec.graph Read
- * @sec.triple Read
- * @throws AccessDeniedException
- */
- @Override
- public boolean hasWellFormedXML() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read
- * @throws AccessDeniedException
- */
- @Override
- public boolean isReified() throws AccessDeniedException;
-
- /**
- * @sec.graph Read
- * @sec.triple Read
- * @throws AccessDeniedException
- */
- @Override
- public RSIterator listReifiedStatements() throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete
- * @throws AccessDeniedException
- */
- @Override
- public SecuredStatement remove() throws AccessDeniedException;
-
- /**
- * @sec.graph Update
- * @sec.triple Delete
- * @throws AccessDeniedException
- */
- @Override
- public void removeReification() throws AccessDeniedException;
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/SecuredUnsupportedPolymorphismException.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/SecuredUnsupportedPolymorphismException.java b/jena-security/src/main/java/org/apache/jena/security/model/SecuredUnsupportedPolymorphismException.java
deleted file mode 100644
index 0fe619c..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/SecuredUnsupportedPolymorphismException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model;
-
-import org.apache.jena.enhanced.UnsupportedPolymorphismException ;
-import org.apache.jena.security.model.impl.SecuredRDFNodeImpl;
-
-/**
- * An extension to the UnsupportedPolymorphismException to handle
- * secured polymorphic changes.
- */
-public class SecuredUnsupportedPolymorphismException extends
- UnsupportedPolymorphismException
-{
-
- public SecuredUnsupportedPolymorphismException(
- final SecuredRDFNodeImpl node, final Class<?> type )
- {
- super( node, node.getModel() != null, type);
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredAltImpl.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredAltImpl.java b/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredAltImpl.java
deleted file mode 100644
index 0d082fa..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredAltImpl.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model.impl;
-
-import org.apache.jena.graph.Triple ;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.security.SecurityEvaluator.Action;
-import org.apache.jena.security.impl.ItemHolder;
-import org.apache.jena.security.impl.SecuredItemInvoker;
-import org.apache.jena.security.model.SecuredAlt;
-import org.apache.jena.security.model.SecuredBag;
-import org.apache.jena.security.model.SecuredLiteral;
-import org.apache.jena.security.model.SecuredModel;
-import org.apache.jena.security.model.SecuredRDFNode;
-import org.apache.jena.security.model.SecuredResource;
-import org.apache.jena.security.model.SecuredSeq;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-
-/**
- * Implementation of SecuredAlt to be used by a SecuredItemInvoker proxy.
- */
-public class SecuredAltImpl extends SecuredContainerImpl implements SecuredAlt
-{
- /**
- * Get an instance of SecuredAlt.
- *
- * @param securedModel
- * the Secured Model to use.
- * @param alt
- * The Alt to be secured.
- * @return The secured Alt instance.
- */
- 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)
- {
- throw new IllegalArgumentException("Alt may not be null");
- }
- final ItemHolder<Alt, SecuredAlt> holder = new ItemHolder<Alt, SecuredAlt>(
- alt);
- 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))
- {
- return (SecuredAlt) alt;
- }
- }
- return holder.setSecuredItem(new SecuredItemInvoker(alt.getClass(),
- checker));
- }
-
- // The item holder holding this SecuredAlt
- private final ItemHolder<? extends Alt, ? extends SecuredAlt> holder;
-
- /**
- * Constructor.
- *
- * @param securedModel
- * the securedModel to use.
- * @param holder
- * The item holder that will hold this SecuredAlt.
- */
- protected SecuredAltImpl( final SecuredModel securedModel,
- final ItemHolder<? extends Alt, ? extends SecuredAlt> holder )
- {
- super(securedModel, holder);
- this.holder = holder;
- }
-
- @Override
- public SecuredRDFNode getDefault()
- {
- // getDefaultStatement() calls checkRead
- return SecuredRDFNodeImpl.getInstance(getModel(), getDefaultStatement()
- .getObject());
- }
-
- @Override
- public SecuredAlt getDefaultAlt()
- {
- // getDefaultStatement() calls checkRead
- return SecuredAltImpl.getInstance(getModel(), getDefaultStatement()
- .getAlt());
- }
-
- @Override
- public SecuredBag getDefaultBag()
- {
- // getDefaultStatement() calls checkRead
- return SecuredBagImpl.getInstance(getModel(), getDefaultStatement()
- .getBag());
- }
-
- @Override
- public boolean getDefaultBoolean()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getBoolean();
- }
-
- @Override
- public byte getDefaultByte()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getByte();
- }
-
- @Override
- public char getDefaultChar()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getChar();
- }
-
- @Override
- public double getDefaultDouble()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getDouble();
- }
-
- @Override
- public float getDefaultFloat()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getFloat();
- }
-
- @Override
- public int getDefaultInt()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getInt();
- }
-
- @Override
- public String getDefaultLanguage()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getLanguage();
- }
-
- @Override
- public SecuredLiteral getDefaultLiteral()
- {
- // getDefaultStatement() calls checkRead
- return SecuredLiteralImpl.getInstance(getModel(), getDefaultStatement()
- .getLiteral());
- }
-
- @Override
- public long getDefaultLong()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getLong();
- }
-
- @Override
- public SecuredResource getDefaultResource()
- {
- // getDefaultStatement() calls checkRead
- return SecuredResourceImpl.getInstance(getModel(),
- getDefaultStatement().getResource());
- }
-
- @Override
- @Deprecated
- public SecuredResource getDefaultResource( final ResourceF f )
- {
- // getDefaultStatement() calls checkRead
- return SecuredResourceImpl.getInstance(getModel(),
- getDefaultStatement().getResource(f));
- }
-
- @Override
- public SecuredSeq getDefaultSeq()
- {
- // getDefaultStatement() calls checkRead
- return SecuredSeqImpl.getInstance(getModel(), getDefaultStatement()
- .getSeq());
- }
-
- @Override
- public short getDefaultShort()
- {
- // getDefaultStatement() calls checkRead
- return getDefaultStatement().getShort();
-
- }
-
- private Statement getDefaultStatement()
- {
- checkRead();
- final ExtendedIterator<Statement> iter = getStatementIterator(Action.Read);
- try
- {
- if (iter.hasNext())
- {
- return iter.next();
- }
- throw new AltHasNoDefaultException(this);
- }
- finally
- {
- iter.close();
- }
- }
-
- @Override
- public String getDefaultString()
- {
- // 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 ));
- }
-
- @Override
- public SecuredAlt setDefault( final char o )
- {
- return setDefault( asObject( o ));
- }
-
- @Override
- public SecuredAlt setDefault( final double o )
- {
- return setDefault( asObject( o ));
- }
-
- @Override
- public SecuredAlt setDefault( final float o )
- {
- return setDefault( asObject( o ));
- }
-
- @Override
- public SecuredAlt setDefault( final long o )
- {
- return setDefault( asObject( o ));
- }
-
- @Override
- public SecuredAlt setDefault( final Object o )
- {
- return setDefault( asObject( o ));
- }
-
- @Override
- public SecuredAlt setDefault( final RDFNode o )
- {
- checkUpdate();
- final ExtendedIterator<Statement> iter = getStatementIterator(Action.Read);
- try {
- if (iter.hasNext())
- {
- final Statement stmt = iter.next();
- final Triple t = stmt.asTriple();
- final Triple t2 = new Triple(t.getSubject(), t.getPredicate(),
- o.asNode());
- checkUpdate(t, t2);
- stmt.changeObject(o);
- return holder.getSecuredItem();
- }
- else
- {
- add( o );
- return holder.getSecuredItem();
- }
- }
- finally {
- iter.close();
- }
-
- }
-
- @Override
- public SecuredAlt setDefault( final String o )
- {
- return setDefault( asLiteral( o, "" ));
- }
-
- @Override
- public SecuredAlt setDefault( final String o, final String l )
- {
- return setDefault( asLiteral( o, l) );
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredBagImpl.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredBagImpl.java b/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredBagImpl.java
deleted file mode 100644
index 9c8b3a1..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredBagImpl.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model.impl;
-
-import org.apache.jena.rdf.model.Bag ;
-import org.apache.jena.security.impl.ItemHolder;
-import org.apache.jena.security.impl.SecuredItemInvoker;
-import org.apache.jena.security.model.SecuredBag;
-import org.apache.jena.security.model.SecuredModel;
-
-/**
- * Implementation of SecuredBag to be used by a SecuredItemInvoker proxy.
- */
-public class SecuredBagImpl extends SecuredContainerImpl implements SecuredBag
-{
- /**
- * Get an instance of SecuredBag
- *
- * @param securedModel
- * The Secured Model to use.
- * @param bag
- * The bag to secure
- * @return The SecuredBag
- */
- public static SecuredBag getInstance( final SecuredModel securedModel,
- final Bag bag )
- {
- if (securedModel == null)
- {
- throw new IllegalArgumentException(
- "Secured securedModel may not be null");
- }
- if (bag == null)
- {
- throw new IllegalArgumentException("Bag may not be null");
- }
- final ItemHolder<Bag, SecuredBag> holder = new ItemHolder<Bag, SecuredBag>(
- bag);
- final SecuredBagImpl checker = new SecuredBagImpl(securedModel, holder);
- // if we are going to create a duplicate proxy, just return this
- // one.
- if (bag instanceof SecuredBag)
- {
- if (checker.isEquivalent((SecuredBag) bag))
- {
- return (SecuredBag) bag;
- }
- }
- return holder.setSecuredItem(new SecuredItemInvoker(bag.getClass(),
- checker));
- }
-
- /**
- * Constructor.
- *
- * @param securedModel
- * The Secured Model to use.
- * @param holder
- * The holder that will contain this SecuredBag.
- */
- protected SecuredBagImpl( final SecuredModel securedModel,
- final ItemHolder<? extends Bag, ? extends SecuredBag> holder )
- {
- super(securedModel, holder);
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredContainerImpl.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredContainerImpl.java b/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredContainerImpl.java
deleted file mode 100644
index 2de34fa..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredContainerImpl.java
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model.impl;
-
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-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.rdf.model.* ;
-import org.apache.jena.security.SecurityEvaluator.Action;
-import org.apache.jena.security.impl.ItemHolder;
-import org.apache.jena.security.impl.SecuredItemInvoker;
-import org.apache.jena.security.model.SecuredContainer;
-import org.apache.jena.security.model.SecuredModel;
-import org.apache.jena.security.utils.ContainerFilter;
-import org.apache.jena.security.utils.PermStatementFilter;
-import org.apache.jena.util.iterator.ExtendedIterator ;
-import org.apache.jena.util.iterator.Map1 ;
-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
-{
- /**
- * Constructor
- *
- * @param securedModel
- * the Secured Model to use.
- * @param container
- * The container to secure.
- * @return The SecuredResource
- */
- 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)
- {
- throw new IllegalArgumentException("Container may not be null");
- }
-
- // check that resource has a securedModel.
- Container goodContainer = container;
- if (goodContainer.getModel() == null)
- {
- container.asNode();
- goodContainer = securedModel.createBag();
- }
-
- final ItemHolder<Container, SecuredContainer> holder = new ItemHolder<Container, SecuredContainer>(
- goodContainer);
-
- final SecuredContainerImpl checker = new SecuredContainerImpl(
- securedModel, holder);
- // if we are going to create a duplicate proxy, just return this
- // one.
- if (goodContainer instanceof SecuredContainer)
- {
- if (checker.isEquivalent((SecuredContainer) goodContainer))
- {
- return (SecuredContainer) goodContainer;
- }
- }
-
- return holder.setSecuredItem(new SecuredItemInvoker(container
- .getClass(), checker));
-
- }
-
- // the item holder that contains this SecuredContainer.
- private final ItemHolder<? extends Container, ? extends SecuredContainer> holder;
-
- /**
- * Constructor
- *
- * @param securedModel
- * the Secured Model to use.
- * @param holder
- * The item holder that will contain this SecuredContainer
- */
- protected SecuredContainerImpl(
- final SecuredModel securedModel,
- 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 )
- {
- return holder.getBaseItem().getModel().createLiteral(o, l);
- }
-
- @Override
- public SecuredContainer add( final boolean o )
- {
- return add( asObject( o ));
- }
-
- @Override
- public SecuredContainer add( final char o )
- {
- return add( asObject( o ));
- }
-
- @Override
- public SecuredContainer add( final double o )
- {
- return add( asObject( o ));
- }
-
- @Override
- public SecuredContainer add( final float o )
- {
- return add( asObject( o ));
- }
-
- @Override
- public SecuredContainer add( final long o )
- {
- return add( asObject( o ));
- }
-
- @Override
- public SecuredContainer add( final Object o )
- {
- return add( asObject( o ));
- }
-
- @Override
- public SecuredContainer add( final RDFNode o )
- {
- checkUpdate();
- final int pos = holder.getBaseItem().size();
- checkAdd(pos, o.asNode());
- holder.getBaseItem().add(o);
- return holder.getSecuredItem();
- }
-
- @Override
- public SecuredContainer add( final String o )
- {
- return add( asLiteral( o, "" ));
- }
-
- @Override
- public SecuredContainer add( final String o, final String l )
- {
- return add( asLiteral( o, l));
- }
-
- protected void checkAdd( final int pos, final Literal literal )
- {
- checkAdd(pos, literal.asNode());
- }
-
- protected void checkAdd( final int pos, final Node node )
- {
- checkCreate(new Triple(holder.getBaseItem().asNode(), RDF.li(pos)
- .asNode(), node));
- }
-
- @Override
- public boolean contains( final boolean o )
- {
- return contains( asObject( o ) );
- }
-
- @Override
- public boolean contains( final char o )
- {
- return contains( asObject( o ) );
- }
-
- @Override
- public boolean contains( final double o )
- {
- return contains( asObject( o ) );
- }
-
- @Override
- public boolean contains( final float o )
- {
- return contains( asObject( o ) );
- }
-
- @Override
- public boolean contains( final long o )
- {
- return contains( asObject( o ) );
- }
-
- @Override
- public boolean contains( final Object o )
- {
- return contains( asObject( o ) );
- }
-
- @Override
- public boolean contains( final RDFNode o )
- {
- // iterator check reads
- final SecuredNodeIterator<RDFNode> iter = iterator();
- while (iter.hasNext())
- {
- if (iter.next().asNode().equals(o.asNode()))
- {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean contains( final String o )
- {
- return contains( asLiteral( o, "" ));
- }
-
- @Override
- public boolean contains( final String o, final String l )
- {
- return contains( asLiteral( o, l ));
- }
-
- protected int getAddIndex()
- {
- int pos = -1;
- final ExtendedIterator<Statement> iter = holder.getBaseItem()
- .listProperties();
- try
- {
- while (iter.hasNext())
- {
- pos = Math.max(pos, getIndex(iter.next().getPredicate()));
- }
- }
- finally
- {
- iter.close();
- }
- return pos + 1;
- }
-
- protected static int getIndex( final Property p )
- {
- if (p.getNameSpace().equals(RDF.getURI())
- && p.getLocalName().startsWith("_"))
- {
- try
- {
- return Integer.parseInt(p.getLocalName().substring(1));
- }
- catch (final NumberFormatException e)
- {
- // acceptable;
- }
- }
- return -1;
- }
-
- 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 )
- {
- return holder.getBaseItem().listProperties()
- .filterKeep(new ContainerFilter())
- .filterKeep(new PermStatementFilter(perm, this));
- }
-
- @Override
- public boolean isAlt()
- {
- return holder.getBaseItem().isAlt();
- }
-
- @Override
- public boolean isBag()
- {
- return holder.getBaseItem().isBag();
- }
-
- @Override
- public boolean isSeq()
- {
- return holder.getBaseItem().isSeq();
- }
-
- @Override
- 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( new NodeMap() ) );
- }
- finally {
- iter.close();
- }
- }
-
- @Override
- public SecuredNodeIterator<RDFNode> iterator( final Set<Action> perms )
- {
- checkRead();
- final Set<Action> permsCopy = new HashSet<Action>(perms);
- permsCopy.add(Action.Read);
- final ExtendedIterator<RDFNode> ni = getStatementIterator(perms)
- .mapWith(new Map1<Statement, RDFNode>() {
-
- @Override
- public RDFNode map1( final Statement o )
- {
- return o.getObject();
- }
- });
- return new SecuredNodeIterator<RDFNode>(getModel(), ni);
-
- }
-
- @Override
- public SecuredContainer remove( final Statement s )
- {
- checkUpdate();
- checkDelete(s.asTriple());
- holder.getBaseItem().remove(s);
- return holder.getSecuredItem();
- }
-
- @Override
- public int size()
- {
- 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 NodeMap implements Map1<Statement,RDFNode>
- {
-
- @Override
- public RDFNode map1( Statement o )
- {
- return o.getObject();
- }
-
- }
-
- static class ContainerComparator implements Comparator<Statement>
- {
-
- @Override
- public int compare( Statement arg0, Statement arg1 )
- {
- return Integer.valueOf(arg0.getPredicate().getOrdinal()).compareTo( arg1.getPredicate().getOrdinal());
- }
-
- }
-
- static class StatementRemovingIterator extends WrappedIterator<Statement>
- {
- private Statement stmt;
-
- public StatementRemovingIterator( Iterator<? extends Statement> base )
- {
- super(base);
- }
-
- @Override
- public Statement next()
- {
- stmt = super.next();
- return stmt;
- }
-
- @Override
- public void remove()
- {
- stmt.remove();
- super.remove();
- }
-
-
- }
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/b712fb28/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredLiteralImpl.java
----------------------------------------------------------------------
diff --git a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredLiteralImpl.java b/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredLiteralImpl.java
deleted file mode 100644
index 9d78388..0000000
--- a/jena-security/src/main/java/org/apache/jena/security/model/impl/SecuredLiteralImpl.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.security.model.impl;
-
-import org.apache.jena.datatypes.RDFDatatype ;
-import org.apache.jena.graph.Node ;
-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.security.impl.ItemHolder;
-import org.apache.jena.security.impl.SecuredItemInvoker;
-import org.apache.jena.security.model.SecuredLiteral;
-import org.apache.jena.security.model.SecuredModel;
-import org.apache.jena.security.model.SecuredResource;
-
-/**
- * Implementation of SecuredLiteral to be used by a SecuredItemInvoker proxy.
- */
-public class SecuredLiteralImpl extends SecuredRDFNodeImpl implements
- SecuredLiteral
-{
- /**
- * Get an instance of SecuredLiteral
- *
- * @param securedModel
- * the item providing the security context.
- * @param literal
- * the literal to secure
- * @return SecuredLiteral
- */
- 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)
- {
- throw new IllegalArgumentException("literal may not be null");
- }
-
- // check that literal has a securedModel.
- Literal goodLiteral = literal;
- if (goodLiteral.getModel() == null)
- {
- goodLiteral = securedModel.createTypedLiteral(
- literal.getLexicalForm(), literal.getDatatype());
- }
-
- final ItemHolder<Literal, SecuredLiteral> holder = new ItemHolder<Literal, SecuredLiteral>(
- goodLiteral);
- final SecuredLiteralImpl checker = new SecuredLiteralImpl(securedModel,
- holder);
- // if we are going to create a duplicate proxy, just return this
- // one.
- if (goodLiteral instanceof SecuredLiteral)
- {
- if (checker.isEquivalent((SecuredLiteral) goodLiteral))
- {
- return (SecuredLiteral) goodLiteral;
- }
- }
- return holder.setSecuredItem(new SecuredItemInvoker(literal.getClass(),
- checker));
- }
-
- // the item holder that contains this SecuredLiteral
- private final ItemHolder<? extends Literal, ? extends SecuredLiteral> holder;
-
- /**
- * Constructor
- *
- * @param securityEvaluator
- * The security evaluator to use.
- * @param graphIRI
- * the graph IRI to validate against.
- * @param holder
- * The item holder that will contain this SecuredLiteral.
- */
-
- private SecuredLiteralImpl( final SecuredModel securedModel,
- final ItemHolder<? extends Literal, ? extends SecuredLiteral> holder )
- {
- super(securedModel, holder);
- this.holder = holder;
- }
-
- @Override
- public SecuredLiteral asLiteral()
- {
- return holder.getSecuredItem();
- }
-
- @Override
- public SecuredResource asResource()
- {
- if (canRead())
- {
- throw new ResourceRequiredException(asNode());
- }
- else
- {
- throw new ResourceRequiredException(
- Node.createLiteral("Can not read"));
- }
- }
-
- @Override
- public boolean getBoolean()
- {
- checkRead();
- return holder.getBaseItem().getBoolean();
- }
-
- @Override
- public byte getByte()
- {
- checkRead();
- return holder.getBaseItem().getByte();
- }
-
- @Override
- public char getChar()
- {
- checkRead();
- return holder.getBaseItem().getChar();
- }
-
- /**
- * Return the datatype of the literal. This will be null in the
- * case of plain literals.
- */
- @Override
- public RDFDatatype getDatatype()
- {
- checkRead();
- return holder.getBaseItem().getDatatype();
- }
-
- /**
- * Return the uri of the datatype of the literal. This will be null in the
- * case of plain literals.
- */
- @Override
- public String getDatatypeURI()
- {
- checkRead();
- return holder.getBaseItem().getDatatypeURI();
- }
-
- @Override
- public double getDouble()
- {
- checkRead();
- return holder.getBaseItem().getDouble();
- }
-
- @Override
- public float getFloat()
- {
- checkRead();
- return holder.getBaseItem().getFloat();
- }
-
- @Override
- public int getInt()
- {
- checkRead();
- return holder.getBaseItem().getInt();
- }
-
- @Override
- public String getLanguage()
- {
- checkRead();
- return holder.getBaseItem().getLanguage();
- }
-
- /**
- * Return the lexical form of the literal.
- */
- @Override
- public String getLexicalForm()
- {
- checkRead();
- return holder.getBaseItem().getLexicalForm();
- }
-
- @Override
- public long getLong()
- {
- checkRead();
- return holder.getBaseItem().getLong();
- }
-
- @Override
- public short getShort()
- {
- checkRead();
- return holder.getBaseItem().getShort();
- }
-
- @Override
- public String getString()
- {
- 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.
- */
- @Override
- public Object getValue()
- {
- checkRead();
- return holder.getBaseItem().getValue();
- }
-
- @Override
- public Literal inModel( final Model m )
- {
- checkRead();
- return m.createTypedLiteral(holder.getBaseItem().getLexicalForm(),
- holder.getBaseItem().getDatatype());
- }
-
- @Override
- public boolean isWellFormedXML()
- {
- 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
- * in order to support round tripping.
- */
- @Override
- public boolean sameValueAs( final Literal other )
- {
- checkRead();
- return holder.getBaseItem().sameValueAs(other);
- }
-
- @Override
- public Object visitWith( final RDFVisitor rv )
- {
- return rv.visitLiteral(this);
- }
-}