You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2011/03/16 19:44:00 UTC
svn commit: r1082257 [2/4] - in /incubator/stanbol/trunk/entityhub: ./
generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/
generic/core/src/main/java/org/apache/stanbol/entityhub/core/mapping/
generic/core/src/main/java/org/apache/stanbo...
Modified: incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/utils/TypeSaveIterator.java Wed Mar 16 18:43:57 2011
@@ -26,10 +26,6 @@ import java.util.Iterator;
*/
public class TypeSaveIterator<T> extends AdaptingIterator<Object,T> implements Iterator<T> {
-// protected final Iterator<?> it;
-// protected final Class<T> type;
-// private T next;
-// private Boolean hasNext;
/**
* Constructs an iterator that selects only elements of the parsed iterator
* that are assignable to the parse type
@@ -39,76 +35,8 @@ public class TypeSaveIterator<T> extends
@SuppressWarnings("unchecked")
public TypeSaveIterator(Iterator<?> it,Class<T> type){
super((Iterator<Object>)it,new AssignableFormAdapter<T>(),type);
-// if(it == null){
-// throw new IllegalArgumentException("Parsed iterator MUST NOT be NULL!");
-// }
-// if(type == null){
-// throw new IllegalArgumentException("Parsed type MUST NOT be NULL!");
-// }
-// this.it = it;
-// this.type = type;
}
-// @Override
-// public final void remove() {
-// /*
-// * TODO: Any Iterator that filters elements of the underlying Iterator
-// * needs to call Iterator#next() in the underlying Iterator to get the
-// * next element that confirms with the filter.
-// * However the Iterator#remove() is defined as removing the last element
-// * to be returned by Iterator#next(). Therefore calling hasNext would
-// * change the element to be removed by this method.
-// * Currently I do not know a way around that but I would also like to
-// * keep the remove functionality for Iterator that filter elements of an
-// * underlying Iterator. To prevent unpredictable behaviour in such cases
-// * I throw an IllegalStateException in such cases.
-// * This decision assumes, that in most usage scenarios hasNext will not
-// * likely be called before calling remove and even in such cases
-// * it will be most likely be possible to refactor the code to confirm
-// * with this restriction.
-// * I hope this will help developers that encounter this exception to
-// * modify there code!
-// * If someone has a better Idea how to solve this please let me know!
-// * best
-// * Rupert Westenthaler
-// */
-// if(hasNext!= null){
-// throw new IllegalStateException("Remove can not be called after calling hasNext() because this Method needs to call next() on the underlying Interator and therefore would change the element to be removed :(");
-// }
-// it.remove();
-// }
-//
-// @Override
-// public final T next() {
-// hasNext(); //call hasNext (to init next Element if not already done)
-// if(!hasNext){
-// throw new NoSuchElementException();
-// } else {
-// T current = next;
-// next = null;
-// hasNext = null;
-// return current;
-// }
-// }
-//
-// @Override
-// public final boolean hasNext() {
-// if(hasNext == null){ // only once even with multiple calls
-// next = prepareNext();
-// hasNext = next != null;
-// }
-// return hasNext;
-// }
-// @SuppressWarnings("unchecked")
-// protected T prepareNext(){
-// Object check;
-// while(it.hasNext()){
-// check = it.next();
-// if(type.isAssignableFrom(check.getClass())){
-// return (T)check;
-// }
-// }
-// return null;
-// }
+
/**
* Adapter implementation that uses {@link Class#isAssignableFrom(Class)}
* to check whether a value can be casted to the requested type
Modified: incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/yard/AbstractYard.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/yard/AbstractYard.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/yard/AbstractYard.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/yard/AbstractYard.java Wed Mar 16 18:43:57 2011
@@ -58,17 +58,17 @@ public abstract class AbstractYard imple
/**
* This Yard uses the default in-memory implementation of the Entityhub model.
*/
- protected ValueFactory valueFactory;
+ private ValueFactory valueFactory;
/**
* The QueryFactory as required by {@link Yard#getQueryFactory()}. This
* Yard uses the default implementation as provided by the
* {@link DefaultQueryFactory}.
*/
- protected FieldQueryFactory queryFactory;
+ private FieldQueryFactory queryFactory;
/**
* Holds the configuration of the Yard.
*/
- protected YardConfig config;
+ private YardConfig config;
/**
* The default prefix used for created URIs.
@@ -104,13 +104,13 @@ public abstract class AbstractYard imple
*/
protected final void activate(ValueFactory valueFactory,FieldQueryFactory queryFactory, YardConfig config) {
if(valueFactory == null){
- throw new NullPointerException("Unable to activate: The ValueFactory MUST NOT be NULL!");
+ throw new IllegalArgumentException("Unable to activate: The ValueFactory MUST NOT be NULL!");
}
if(queryFactory == null){
- throw new NullPointerException("Unable to activate: The QueryFactory MUST NOT be NULL!");
+ throw new IllegalArgumentException("Unable to activate: The QueryFactory MUST NOT be NULL!");
}
if(config == null){
- throw new NullPointerException("Unable to activate: The YardConfig MUST NOT be NULL!");
+ throw new IllegalArgumentException("Unable to activate: The YardConfig MUST NOT be NULL!");
}
this.queryFactory = queryFactory;
this.valueFactory = valueFactory;
@@ -220,6 +220,14 @@ public abstract class AbstractYard imple
protected String getUriPrefix(){
return defaultPrefix;
}
+ protected final YardConfig getConfig() {
+ return config;
+ }
+
+ protected final void setConfig(YardConfig config) {
+ this.config = config;
+ }
+
/**
* Creates an unique ID by using the {@link #getUriPrefix()} the parsed
* separator (non if <code>null</code>) and an uuid created by using
@@ -297,7 +305,7 @@ public abstract class AbstractYard imple
* Representations of this Yard within the SolrIndex.
* @param the id of the yard. Required, not null, not empty!
*/
- public void setId(String id) {
+ public final void setId(String id) {
if(id != null){
config.put(Yard.ID, id);
} else {
@@ -309,7 +317,7 @@ public abstract class AbstractYard imple
* Getter for the ID of the yard
* @return the id of the yard
*/
- public String getId() {
+ public final String getId() {
Object value = config.get(Yard.ID);
return value==null?null:value.toString();
}
@@ -319,7 +327,7 @@ public abstract class AbstractYard imple
* is used as default
* @param name The name or <code>null</code> to use {@link #getId()}.
*/
- public void setName(String name) {
+ public final void setName(String name) {
if(name != null){
config.put(Yard.NAME, name);
} else {
@@ -331,7 +339,7 @@ public abstract class AbstractYard imple
* Getter for the human readable name of the Yard
* @return the name
*/
- public String getName() {
+ public final String getName() {
Object value = config.get(Yard.NAME);
return value==null?getId():value.toString();
}
@@ -340,7 +348,7 @@ public abstract class AbstractYard imple
* Setter for the description of this Yard
* @param description the description. Optional parameter
*/
- public void setDescription(String description) {
+ public final void setDescription(String description) {
if(description != null){
config.put(Yard.DESCRIPTION, description);
} else {
@@ -352,7 +360,7 @@ public abstract class AbstractYard imple
* Getter for the description
* @return description The description or <code>null</code> if not defined
*/
- public String getDescription() {
+ public final String getDescription() {
Object value = config.get(Yard.DESCRIPTION);
return value==null?null:value.toString();
}
@@ -364,7 +372,7 @@ public abstract class AbstractYard imple
* <code>null</code> or a negative number to use the default value defined
* by the Yard.
*/
- public void setDefaultQueryResultNumber(Integer defaultQueryResults) {
+ public final void setDefaultQueryResultNumber(Integer defaultQueryResults) {
if(defaultQueryResults != null){
config.put(DEFAULT_QUERY_RESULT_NUMBER, defaultQueryResults);
} else {
@@ -382,7 +390,7 @@ public abstract class AbstractYard imple
* if the value was set to a number lower or equals 0 and -1 if the
* value is not configured at all.
*/
- public int getDefaultQueryResultNumber() throws NumberFormatException {
+ public final int getDefaultQueryResultNumber() throws NumberFormatException {
Object value = config.get(DEFAULT_QUERY_RESULT_NUMBER);
Integer number;
if(value != null){
@@ -390,7 +398,7 @@ public abstract class AbstractYard imple
number = (Integer) value;
} else {
try {
- number = new Integer(value.toString());
+ number = Integer.valueOf(value.toString());
} catch (NumberFormatException e){
return -1;
}
@@ -417,7 +425,7 @@ public abstract class AbstractYard imple
* <code>null</code> or a negative number to use the default as defined by
* the Yard implementation.
*/
- public void setMaxQueryResultNumber(Integer maxQueryResults) {
+ public final void setMaxQueryResultNumber(Integer maxQueryResults) {
if(maxQueryResults != null){
config.put(MAX_QUERY_RESULT_NUMBER, maxQueryResults);
} else {
@@ -433,7 +441,7 @@ public abstract class AbstractYard imple
* if the value was set to a number lower or equals 0 and -1 if the
* value is not configured at all.
*/
- public int getMaxQueryResultNumber() {
+ public final int getMaxQueryResultNumber() {
Object value = config.get(MAX_QUERY_RESULT_NUMBER);
Integer number;
if(value != null){
@@ -441,7 +449,7 @@ public abstract class AbstractYard imple
number = (Integer) value;
} else {
try {
- number = new Integer(value.toString());
+ number = Integer.valueOf(value.toString());
}catch (NumberFormatException e) {
return -1;
}
Modified: incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentationTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentationTest.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentationTest.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryRepresentationTest.java Wed Mar 16 18:43:57 2011
@@ -16,7 +16,6 @@
*/
package org.apache.stanbol.entityhub.core.model;
-import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
import org.apache.stanbol.entityhub.servicesapi.model.ValueFactory;
import org.apache.stanbol.entityhub.test.model.RepresentationTest;
import org.junit.Before;
Modified: incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryValueFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryValueFactoryTest.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryValueFactoryTest.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/test/java/org/apache/stanbol/entityhub/core/model/InMemoryValueFactoryTest.java Wed Mar 16 18:43:57 2011
@@ -16,7 +16,6 @@
*/
package org.apache.stanbol.entityhub.core.model;
-import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
import org.apache.stanbol.entityhub.servicesapi.model.ValueFactory;
import org.apache.stanbol.entityhub.test.model.ValueFactoryTest;
import org.junit.Before;
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/DataTypeEnum.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/DataTypeEnum.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/DataTypeEnum.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/DataTypeEnum.java Wed Mar 16 18:43:57 2011
@@ -86,11 +86,11 @@ public enum DataTypeEnum {
DateTime("dateTime",Date.class),
Duration("duration",Duration.class),
;
- final Class<?> javaType;
- final QName qName;
- final String shortName;
- final String uri;
- final Set<Class<?>> additional;
+ private final Class<?> javaType;
+ private final QName qName;
+ private final String shortName;
+ private final String uri;
+ private final Set<Class<?>> additional;
private DataTypeEnum(Class<?> javaType,Class<?>...additional){
this(null,null,javaType,additional);
}
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java Wed Mar 16 18:43:57 2011
@@ -68,8 +68,8 @@ public enum NamespaceEnum {
dbpediaProp("dbp-prop","http://dbpedia.org/property/"),
geonames("http://www.geonames.org/ontology#"),
;
- String ns;
- String prefix;
+ private String ns;
+ private String prefix;
private NamespaceEnum(String ns) {
if(ns == null){
throw new IllegalArgumentException("The namespace MUST NOT be NULL");
@@ -151,7 +151,9 @@ public enum NamespaceEnum {
* Enumeration. Otherwise the parsed value.
*/
public static String getFullName(String shortUri){
- if(shortUri == null) return null;
+ if(shortUri == null) {
+ return null;
+ }
int index = shortUri.indexOf(':');
if(index>0){
NamespaceEnum namespace = NamespaceEnum.forPrefix(shortUri.substring(0, index));
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapping.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapping.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapping.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapping.java Wed Mar 16 18:43:57 2011
@@ -44,12 +44,12 @@ import org.apache.stanbol.entityhub.serv
*/
public class FieldMapping {
- protected final String pattern;
- protected final Pattern regex;
- protected final boolean usesWildcard;
- protected Set<String> mappings;
- protected Constraint filter;
- protected final boolean inverse;
+ private final String pattern;
+ private final Pattern regex;
+ private final boolean usesWildcard;
+ private Set<String> mappings;
+ private Constraint filter;
+ private final boolean inverse;
private final boolean global;
/**
* Returns <code>true</code> if fields that match the pattern are ignored.
@@ -237,8 +237,7 @@ public class FieldMapping {
}
@Override
public boolean equals(Object obj) {
- return obj != null && //not null
- obj instanceof FieldMapping && // check type
+ return obj instanceof FieldMapping && // check type
((FieldMapping)obj).pattern.equals(pattern) && //check field pattern
((FieldMapping)obj).inverse == inverse && //check inverse
((FieldMapping)obj).mappings.equals(mappings) && //check mappings
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/EntityMapping.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/EntityMapping.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/EntityMapping.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/EntityMapping.java Wed Mar 16 18:43:57 2011
@@ -61,7 +61,7 @@ public interface EntityMapping extends S
*/
confirmed(RdfResourceEnum.mappingStateConfirmed.getUri()),
;
- String uri;
+ private String uri;
MappingState(String uri){
this.uri = uri;
}
@@ -73,7 +73,7 @@ public interface EntityMapping extends S
return uri;
}
// ---- reverse Mapping based on URI ----
- static Map<String,MappingState> uri2state;
+ private static Map<String,MappingState> uri2state;
static {
Map<String, MappingState> mappings = new HashMap<String, MappingState>();
for(MappingState state : MappingState.values()){
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Representation.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Representation.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Representation.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Representation.java Wed Mar 16 18:43:57 2011
@@ -54,10 +54,10 @@ public interface Representation {
* @param type the type of the values
* @return the (first) value of that field
* @throws IllegalArgumentException if the type is not supported
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- <T> T getFirst(String field,Class<T> type) throws UnsupportedTypeException, NullPointerException, IllegalArgumentException;
+ <T> T getFirst(String field,Class<T> type) throws UnsupportedTypeException, IllegalArgumentException;
/**
* Getter for all values of a field
@@ -66,26 +66,26 @@ public interface Representation {
* @param type the type
* @return the values of the field
* @throws UnsupportedTypeException if the parsed type is not supported
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- <T> Iterator<T> get(String field,Class<T> type) throws UnsupportedTypeException, NullPointerException, IllegalArgumentException;
+ <T> Iterator<T> get(String field,Class<T> type) throws UnsupportedTypeException, IllegalArgumentException;
/**
* Getter for the (first) value for a field
* @param field the field
* @return the first value of a field
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- Object getFirst(String field) throws NullPointerException, IllegalArgumentException;
+ Object getFirst(String field) throws IllegalArgumentException;
/**
* Getter for the first reference value for a field
* @param field the field
* @return the reference or null of the field has no reference as value
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- Reference getFirstReference(String field) throws NullPointerException, IllegalArgumentException;
+ Reference getFirstReference(String field) throws IllegalArgumentException;
/**
* Getter for the first natural language text value of a specific language
* @param field the field
@@ -93,26 +93,26 @@ public interface Representation {
* (If <code>null</code> is parsed as language, than also labels
* without language tag are included in the Result)
* @return the first natural language text found for the parsed field
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- Text getFirst(String field, String...language) throws NullPointerException, IllegalArgumentException;
+ Text getFirst(String field, String...language) throws IllegalArgumentException;
/**
* Getter for all values for the requested field
* @param field the field
* @return the values of the field
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- Iterator<Object> get(String field) throws NullPointerException, IllegalArgumentException;
+ Iterator<Object> get(String field) throws IllegalArgumentException;
/**
* Getter for all natural language text values of a field
* @param field the field
* @return the natural text values
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- Iterator<Text> getText(String field) throws NullPointerException, IllegalArgumentException;
+ Iterator<Text> getText(String field) throws IllegalArgumentException;
/**
* Getter for all natural language text values of a field
* @param field the field
@@ -121,18 +121,18 @@ public interface Representation {
* without language tag are included in the Result)
* @return iterator over all natural language text values in the requested
* language.
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- Iterator<Text> get(String field,String...language) throws NullPointerException, IllegalArgumentException;
+ Iterator<Text> get(String field,String...language) throws IllegalArgumentException;
/**
* Getter for all reference values of a field
* @param field the field
* @return Iterator over all reference values of a field
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- Iterator<Reference> getReferences(String field) throws NullPointerException, IllegalArgumentException;
+ Iterator<Reference> getReferences(String field) throws IllegalArgumentException;
/**
* Adds the object as value to the field.
* <p>The type of the value is inferred based on the type of the Object.<br>
@@ -153,11 +153,11 @@ public interface Representation {
* </ul>
* @param field the field
* @param value the value to add
- * @throws NullPointerException if <code>null</code> is parsed as field or
- * value
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws NullPointerException
+ * @throws IllegalArgumentException if <code>null</code> is parsed as field or
+ * value and/or if an empty string is parsed as field
*/
- void add(String field, Object value) throws NullPointerException, IllegalArgumentException;
+ void add(String field, Object value) throws IllegalArgumentException;
/**
* Adds an reference to the field.
* @param field the field
@@ -165,12 +165,11 @@ public interface Representation {
* the value will be interpreted as a "reference" so there might apply
* some rules about the format of the string. Regardless of the implementation
* any valid URI and URL need to be accepted as a valid reference value
- * @throws NullPointerException if <code>null</code> is parsed as field or
- * reference
- * @throws IllegalArgumentException if an empty string is parsed as field
- * or reference and/or <code>null</code> is parsed as value.
+ * @throws NullPointerException
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field or reference
*/
- void addReference(String field, String reference) throws NullPointerException,IllegalArgumentException;
+ void addReference(String field, String reference) throws IllegalArgumentException;
/**
* Adds a natural language text as value for one or more languages
* @param field the field to add the text as value
@@ -178,12 +177,12 @@ public interface Representation {
* @param language the text is set for all the parsed languages. Parse
* <code>null</code> to set the text also without any language
* information.
- * @throws NullPointerException if <code>null</code> is parsed as field.
- * @throws IllegalArgumentException if an empty string is parsed as field
- * and/or <code>null</code> is parsed as text. NOTE that <code>null</code>
- * is supported for languages.
+ * @throws NullPointerException
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field; if <code>null</code> is parsed as text.
+ * NOTE that <code>null</code> is supported for languages.
*/
- void addNaturalText(String field,String text, String...languages) throws NullPointerException,IllegalArgumentException;
+ void addNaturalText(String field,String text, String...languages) throws IllegalArgumentException;
/**
* Sets the value of the field to the parsed object. If the parsed value
* is <code>null</code> than this method removes all values for the given
@@ -193,10 +192,11 @@ public interface Representation {
* details.
* @param field the field
* @param value the new value for the field
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws NullPointerException
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as field
*/
- void set(String field, Object value) throws NullPointerException, IllegalArgumentException;
+ void set(String field, Object value) throws IllegalArgumentException;
/**
* Setter for the reference of a field. If the parsed value
* is <code>null</code> than this method removes all values for the given
@@ -206,10 +206,10 @@ public interface Representation {
* the value will be interpreted as a "reference" so there might apply
* some rules about the format of the string. Regardless of the implementation
* any valid URI and URL need to be accepted as a valid reference value
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code>or an emtpy string is
+ * parsed as field
*/
- void setReference(String field, String reference) throws NullPointerException, IllegalArgumentException;
+ void setReference(String field, String reference) throws IllegalArgumentException;
/**
* Setter for the natural language text value of a field in the given
* languages. If <code>null</code> is parsed as text, all present values
@@ -220,10 +220,10 @@ public interface Representation {
* @param language the languages of the parsed text. Parse
* <code>null</code> to set the text also without any language
* information.
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code>or an emtpy string is
+ * parsed as field
*/
- void setNaturalText(String field,String text, String...language) throws NullPointerException, IllegalArgumentException;
+ void setNaturalText(String field,String text, String...language) throws IllegalArgumentException;
/**
* Removes the parsed value form the field. If <code>null</code> is parsed
* as value than the call is ignored.<p>
@@ -233,10 +233,10 @@ public interface Representation {
* for details.
* @param field the field
* @param value the value to remove
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code>or an emtpy string is
+ * parsed as field
*/
- void remove(String field, Object value) throws NullPointerException, IllegalArgumentException;
+ void remove(String field, Object value) throws IllegalArgumentException;
/**
* Removes to parsed reference as value for the given field. If <code>null</code>
* is parsed as reference, that the call is ignored.
@@ -256,17 +256,17 @@ public interface Representation {
* @param language the language(s) of the natural language text
* (If <code>null</code> is parsed as language, than also labels
* without language tag might be removed)
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code>or an emtpy string is
+ * parsed as field
*/
- void removeNaturalText(String field,String text,String...languages) throws NullPointerException, IllegalArgumentException;
+ void removeNaturalText(String field,String text,String...languages) throws IllegalArgumentException;
/**
* Removes all values of the field
* @param field the field
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code>or an emtpy string is
+ * parsed as field
*/
- void removeAll(String field) throws NullPointerException, IllegalArgumentException;
+ void removeAll(String field) throws IllegalArgumentException;
/**
* Removes all natural language texts for the given languages or all natural
* language labels of no language or an empty array is parsed as language.
@@ -278,10 +278,10 @@ public interface Representation {
* natural language label are removed. To remove only labels with
* no language, <code>null</code> needs to be parsed as entry of
* this array.
- * @throws NullPointerException if <code>null</code> is parsed as field
- * @throws IllegalArgumentException if an empty string is parsed as field
+ * @throws IllegalArgumentException if <code>null</code>or an emtpy string is
+ * parsed as field
*/
- void removeAllNaturalText(String field,String...languages) throws NullPointerException, IllegalArgumentException;
+ void removeAllNaturalText(String field,String...languages) throws IllegalArgumentException;
/**
* Getter for all the present fields
* @return the fields
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Symbol.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Symbol.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Symbol.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/Symbol.java Wed Mar 16 18:43:57 2011
@@ -52,7 +52,7 @@ public interface Symbol extends Sign{
*/
active(RdfResourceEnum.symbolStateActive.getUri()),
;
- String uri;
+ private String uri;
SymbolState(String uri){
this.uri = uri;
}
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/ValueFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/ValueFactory.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/ValueFactory.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/ValueFactory.java Wed Mar 16 18:43:57 2011
@@ -36,20 +36,20 @@ public interface ValueFactory {
* @return the Text instance for the parsed object
* @throws UnsupportedTypeException if the type of the parsed object is not
* can not be used to create Text instances
- * @throws IllegalArgumentException If the parsed instance type is supported, but
+ * @throws IllegalArgumentException If <code>null</code> is parsed or if the
+ * parsed instance type is supported, but
* the parsed instance can not be used to create a text instance
- * @throws NullPointerException If <code>null</code> is parsed
*/
- Text createText(Object value) throws UnsupportedTypeException, IllegalArgumentException,NullPointerException;
+ Text createText(Object value) throws UnsupportedTypeException, IllegalArgumentException;
/**
* Creates a Text instance for a language
* @param text the text
* @param language the language or <code>null</code>.
* @return the Text instance
- * @throws IllegalArgumentException if the parsed parameter can not be used to create a Text instance
- * @throws NullPointerException if <code>null</code> is parsed as text.
+ * @throws IllegalArgumentException if <code>null</code> is parsed as text or
+ * if the parsed parameter can not be used to create a Text instance
*/
- Text createText(String text,String language) throws IllegalArgumentException, NullPointerException;
+ Text createText(String text,String language) throws IllegalArgumentException;
/**
* Creates a reference instance for the parsed value. Implementations might
* support special support for specific classes. As an default the
@@ -66,20 +66,20 @@ public interface ValueFactory {
* @return the reference instance
* @throws UnsupportedTypeException if the type of the parsed object can
* not be converted to a Reference.
- * @throws IllegalArgumentException if the parsed value can not be used to
+ * @throws IllegalArgumentException if the parsed value is <code>null</code>
+ * or if the parsed value can not be used to
* create a valid Reference (e.g. when parsing an empty String)
- * @throws NullPointerException if the parsed value is <code>null</code>
*/
- Reference createReference(Object value) throws UnsupportedTypeException, IllegalArgumentException, NullPointerException;
+ Reference createReference(Object value) throws UnsupportedTypeException, IllegalArgumentException;
/**
* Creates an empty representation instance of with the type {@link SignTypeEnum#Sign}
* for the parsed ID. The id MUST not be <code>null</code> nor empty
* @param id The id of the representation
* @return the representation
- * @throws NullPointerException If <code>null</code> is parsed as ID
- * @throws IllegalArgumentException if an empty string is parsed as ID
+ * @throws IllegalArgumentException if <code>null</code> or an empty string
+ * is parsed as ID
*/
- Representation createRepresentation(String id) throws NullPointerException, IllegalArgumentException;
+ Representation createRepresentation(String id) throws IllegalArgumentException;
// /**
// * Creates a value of the parsed data type for the parsed object
// * @param dataTypeUri the data type of the created object
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java Wed Mar 16 18:43:57 2011
@@ -163,7 +163,7 @@ public enum RdfResourceEnum {
*/
TextDataType(null,"text"),
;
- String uri;
+ private String uri;
/**
* Initialise a new property by using the parse URI. If <code>null</code> is
* parsed, the URI is generated by using the Entityhub model namespace (
@@ -222,7 +222,7 @@ public enum RdfResourceEnum {
}
@Override
public String toString() {
- return uri.toString();
+ return uri;
}
}
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/ValueConstraint.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/ValueConstraint.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/ValueConstraint.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/ValueConstraint.java Wed Mar 16 18:43:57 2011
@@ -32,8 +32,8 @@ import java.util.LinkedHashSet;
public class ValueConstraint extends Constraint {
- protected final Object value;
- protected final Collection<String> dataTypeUris;
+ private final Object value;
+ private final Collection<String> dataTypeUris;
public ValueConstraint(Object value) {
this(value,null);
Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/util/PatternUtils.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/util/PatternUtils.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/util/PatternUtils.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/util/PatternUtils.java Wed Mar 16 18:43:57 2011
@@ -18,7 +18,8 @@ package org.apache.stanbol.entityhub.ser
import java.util.regex.Pattern;
-public class PatternUtils {
+public final class PatternUtils {
+ private PatternUtils(){}
/**
* Converts a Wildcard search string to REGEX. If strict is enabled, than
* the REGEX pattern searches only full labels ("^Patt?er.*$") otherwise
Modified: incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/Utils.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/Utils.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/Utils.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/Utils.java Wed Mar 16 18:43:57 2011
@@ -20,7 +20,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-public class Utils {
+public final class Utils {
+ private Utils(){}
/**
* Converts an Iterator to a Collection by iterating over all elements and
* adding them to a List.
Modified: incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java Wed Mar 16 18:43:57 2011
@@ -21,14 +21,12 @@ import static junit.framework.Assert.ass
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
-
import static org.apache.stanbol.entityhub.test.Utils.asCollection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
@@ -66,107 +64,107 @@ public abstract class RepresentationTest
protected abstract Object getUnsupportedValueInstance();
/*--------------------------------------------------------------------------
- * Set of Tests that check if all Methods correctly throw a NullPointerException
+ * Set of Tests that check if all Methods correctly throw an IllegalArgumentException
* when parsing null as field!
* - important to prevent NULL fields within the Entityhub
*--------------------------------------------------------------------------
*/
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldAdd(){
Representation rep = createRepresentation(null);
rep.add(null, "test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldAddNaturalText(){
Representation rep = createRepresentation(null);
rep.addNaturalText(null, "test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldAddReference(){
Representation rep = createRepresentation(null);
rep.addReference(null, "urn:test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGet(){
Representation rep = createRepresentation(null);
rep.get(null);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetDataType(){
Representation rep = createRepresentation(null);
rep.get(null, Integer.class);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetNaturalLanguateText(){
Representation rep = createRepresentation(null);
rep.get(null,"en");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetFirst(){
Representation rep = createRepresentation(null);
rep.getFirst(null);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetFirstReference(){
Representation rep = createRepresentation(null);
rep.getFirstReference(null);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetFirstDataType(){
Representation rep = createRepresentation(null);
rep.getFirst(null, Integer.class);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetFirstNaturalLanguage(){
Representation rep = createRepresentation(null);
rep.getFirst(null, "en");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetReferences(){
Representation rep = createRepresentation(null);
rep.getReferences(null);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldGetText(){
Representation rep = createRepresentation(null);
rep.getText(null);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldRemove(){
Representation rep = createRepresentation(null);
rep.remove(null, "test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldRemoveAll(){
Representation rep = createRepresentation(null);
rep.removeAll(null);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldRemoveAllNaturalText(){
Representation rep = createRepresentation(null);
rep.removeAllNaturalText(null, "de");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldRemoveNaturalText(){
Representation rep = createRepresentation(null);
rep.removeNaturalText(null, "test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldRemoveReference(){
Representation rep = createRepresentation(null);
rep.removeReference(null, "urn:test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldSet(){
Representation rep = createRepresentation(null);
rep.set(null, "test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldSetNaturalText(){
Representation rep = createRepresentation(null);
rep.setNaturalText(null, "test");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullFieldSetReference(){
Representation rep = createRepresentation(null);
rep.setReference(null, "urn:test");
@@ -848,7 +846,6 @@ public abstract class RepresentationTest
for(Iterator<Text> texts = rep.getText(field);texts.hasNext();textSet.remove(texts.next().getText()));
//and check that the value we expect to be removed is still in the set
assertTrue(textSet.size() == 1);
- System.out.println("TextSet: "+textSet);
assertTrue(textSet.contains(NL_TEST_en2));
}
/**
Modified: incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java Wed Mar 16 18:43:57 2011
@@ -69,7 +69,7 @@ public abstract class ValueFactoryTest {
*/
protected abstract Object getUnsupportedTextType();
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullReference(){
testRef(null);
}
@@ -108,7 +108,7 @@ public abstract class ValueFactoryTest {
Reference ref = testRef(refObject);
assertEquals(ref.getReference(), refObject.toString());
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullText(){
testText(null, "en");
}
@@ -154,7 +154,7 @@ public abstract class ValueFactoryTest {
* NOTE: automatic generation of IDs is supported by the {@link Yard#create()}
* but not by the {@link Representation} itself.
*/
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testNullIdRepresentation(){
testRepresentation(null);
}
Modified: incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/yard/YardTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/yard/YardTest.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/yard/YardTest.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/yard/YardTest.java Wed Mar 16 18:43:57 2011
@@ -16,7 +16,12 @@
*/
package org.apache.stanbol.entityhub.test.yard;
-import static junit.framework.Assert.*;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNotSame;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
import static org.apache.stanbol.entityhub.test.Utils.asCollection;
import java.util.Arrays;
@@ -27,8 +32,6 @@ import java.util.Iterator;
import org.apache.stanbol.entityhub.servicesapi.model.Representation;
import org.apache.stanbol.entityhub.servicesapi.yard.Yard;
import org.apache.stanbol.entityhub.servicesapi.yard.YardException;
-import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Test;
@@ -123,7 +126,7 @@ public abstract class YardTest {
yard.create(test.getId()); //throws an IllegalArgumentException
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testIsRepresentationWithNull() throws YardException {
getYard().isRepresentation(null);
}
@@ -132,12 +135,12 @@ public abstract class YardTest {
public void testIsRepresentationWithEmptyString() throws YardException{
getYard().isRepresentation("");
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testStoreRepresentationWithNull() throws YardException {
getYard().store((Representation)null);
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testStoreRepresentationsWithNull() throws YardException {
getYard().store((Iterable<Representation>)null);
}
@@ -200,7 +203,7 @@ public abstract class YardTest {
assertEquals(test, addedIt.next());
assertFalse(addedIt.hasNext());
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testGetRepresentationWithNull() throws YardException {
getYard().getRepresentation(null);
}
@@ -288,7 +291,7 @@ public abstract class YardTest {
yard.remove(test2.getId());
assertFalse(yard.isRepresentation(test2.getId()));
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testUpdateRepresentationWithNull() throws YardException {
getYard().update((Representation)null);
}
@@ -298,7 +301,7 @@ public abstract class YardTest {
Representation test = create(id,false);
getYard().update(test); //throws an Exception because test is not part of the yard
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testUpdateRepresentationsWithNull() throws YardException {
getYard().update((Iterable<Representation>)null);
}
@@ -375,7 +378,7 @@ public abstract class YardTest {
assertFalse(updatedIt.hasNext());
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testRemoveRepresentationWithNull() throws YardException {
getYard().remove((String)null);
}
@@ -412,7 +415,7 @@ public abstract class YardTest {
//it represents form the store (2)
assertEquals(testValue, test.getFirst(field));
}
- @Test(expected=NullPointerException.class)
+ @Test(expected=IllegalArgumentException.class)
public void testRemoveRepresentationsWithNull() throws YardException {
getYard().remove((Iterable<String>)null);
}
Modified: incubator/stanbol/trunk/entityhub/indexing/dbPedia/src/main/java/org/apache/stanbol/entityhub/indexing/dbPedia/cli/CommandLineRunner.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/indexing/dbPedia/src/main/java/org/apache/stanbol/entityhub/indexing/dbPedia/cli/CommandLineRunner.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/indexing/dbPedia/src/main/java/org/apache/stanbol/entityhub/indexing/dbPedia/cli/CommandLineRunner.java (original)
+++ incubator/stanbol/trunk/entityhub/indexing/dbPedia/src/main/java/org/apache/stanbol/entityhub/indexing/dbPedia/cli/CommandLineRunner.java Wed Mar 16 18:43:57 2011
@@ -31,7 +31,6 @@ import static org.apache.stanbol.entityh
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.Dictionary;
@@ -59,7 +58,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class CommandLineRunner {
+public final class CommandLineRunner {
+ private CommandLineRunner(){}
+
public static final String[] defaultFieldMappings = new String [] {
// --- Define the Languages for all fields ---
//NOTE: the leading space is required for the global filter!
Modified: incubator/stanbol/trunk/entityhub/indexing/dblp/src/main/java/org/apache/stanbol/entityhub/indexing/dblp/cli/CommandLineRunner.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/indexing/dblp/src/main/java/org/apache/stanbol/entityhub/indexing/dblp/cli/CommandLineRunner.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/indexing/dblp/src/main/java/org/apache/stanbol/entityhub/indexing/dblp/cli/CommandLineRunner.java (original)
+++ incubator/stanbol/trunk/entityhub/indexing/dblp/src/main/java/org/apache/stanbol/entityhub/indexing/dblp/cli/CommandLineRunner.java Wed Mar 16 18:43:57 2011
@@ -31,7 +31,6 @@ import static org.apache.stanbol.entityh
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.Dictionary;
@@ -59,7 +58,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class CommandLineRunner {
+public final class CommandLineRunner {
+ private CommandLineRunner(){}
+
+
public static final String[] defaultFieldMappings = new String [] {
// --- Define the Languages for all fields ---
//NOTE: the leading space is required for the global filter!
Modified: incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexer.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexer.java (original)
+++ incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexer.java Wed Mar 16 18:43:57 2011
@@ -269,7 +269,9 @@ public class RdfIndexer {
// private final ParsingProvider parser = new JenaParserProvider();
//private final WeightedTcProvider provider;
private final FieldMapper mapper;
- private final Set<String> types;
+
+ @SuppressWarnings("unused") //TODO: Implement filtering based on rdf:type
+ private final Set<String> types;
//private MGraph indexingGraph;
private final DatasetGraphTDB indexingDataset;
private final boolean skipRead;
@@ -285,7 +287,7 @@ public class RdfIndexer {
private boolean resumeMode;
- public RdfIndexer(Dictionary<String, Object> config){
+ public RdfIndexer(Dictionary<String, Object> config){
this.yard = (Yard)config.get(KEY_YARD);
if(yard == null){
throw new IllegalArgumentException("Parsed config MUST CONTAIN a Yard. Use the key "+KEY_YARD+" to parse the YardInstance used to store the geonames.org index!");
@@ -294,35 +296,35 @@ public class RdfIndexer {
yard.getName(),yard.getId()));
}
this.vf = yard.getValueFactory();
- Object rdfFiles = config.get(KEY_RDF_FILES);
- if(rdfFiles instanceof Iterable<?>){
+ Object rdfFilesObject = config.get(KEY_RDF_FILES);
+ if(rdfFilesObject instanceof Iterable<?>){
this.rdfFiles = new ArrayList<File>();
- for(Object value : (Iterable<?>)rdfFiles){
+ for(Object value : (Iterable<?>)rdfFilesObject){
this.rdfFiles.add(checkFile(value.toString()));
}
} else {
- this.rdfFiles = Collections.singletonList(checkFile(rdfFiles.toString()));
+ this.rdfFiles = Collections.singletonList(checkFile(rdfFilesObject.toString()));
}
- Object indexingDir = config.get(KEY_RDF_STORE_DIR);
- if(indexingDir == null){
- indexingDir = "indexingData";
- config.put(KEY_RDF_STORE_DIR, indexingDir);
- }
- this.indexingDir = checkFile(indexingDir.toString(), false, true);
- Object modelName = config.get(KEY_MODEL_NAME);
- if(modelName == null){
- modelName = "indexingModel-"+ModelUtils.randomUUID().toString();
- config.put(KEY_MODEL_NAME, modelName);
+ Object indexingDirObject = config.get(KEY_RDF_STORE_DIR);
+ if(indexingDirObject == null){
+ indexingDirObject = "indexingData";
+ config.put(KEY_RDF_STORE_DIR, indexingDirObject);
+ }
+ this.indexingDir = checkFile(indexingDirObject.toString(), false, true);
+ Object modelNameObject = config.get(KEY_MODEL_NAME);
+ if(modelNameObject == null){
+ modelNameObject = "indexingModel-"+ModelUtils.randomUUID().toString();
+ config.put(KEY_MODEL_NAME, modelNameObject);
}
- this.modelName = modelName.toString();
+ this.modelName = modelNameObject.toString();
//init the types!
- Iterable<?> types = (Iterable<?>)config.get(KEY_RDF_TYPES);
- if(types != null){
+ Iterable<?> typeIterator = (Iterable<?>)config.get(KEY_RDF_TYPES);
+ if(typeIterator != null){
Set<String> typeSet = new HashSet<String>();
- for(Object type : types){
- if(type != null){
- typeSet.add(type.toString());
- log.info(" - adding Resoures with rdf:type "+type);
+ for(Object typeObject : typeIterator){
+ if(typeObject != null){
+ typeSet.add(typeObject.toString());
+ log.info(" - adding Resoures with rdf:type "+typeObject);
}
}
if(typeSet.isEmpty()){
@@ -336,14 +338,14 @@ public class RdfIndexer {
this.types = null; //null or an iterable with one or more elements!
}
//init the indexing mode
- Object indexingMode = config.get(KEY_INDEXING_MODE);
- if(indexingMode == null){
+ Object indexingModeObject = config.get(KEY_INDEXING_MODE);
+ if(indexingModeObject == null){
this.indexingMode = IndexingMode.NORMAL; //default to replace
- } else if(indexingMode instanceof IndexingMode){
- this.indexingMode = (IndexingMode)indexingMode;
+ } else if(indexingModeObject instanceof IndexingMode){
+ this.indexingMode = (IndexingMode)indexingModeObject;
} else {
try {
- this.indexingMode = IndexingMode.valueOf(indexingMode.toString());
+ this.indexingMode = IndexingMode.valueOf(indexingModeObject.toString());
}catch (IllegalArgumentException e) {
//catch and re-throw with a better message!
throw new IllegalArgumentException(
@@ -352,11 +354,11 @@ public class RdfIndexer {
}
}
//init the fieldMapper
- Iterable<?> mappings = (Iterable<?>)config.get(KEY_FIELD_MAPPINGS);
+ Iterable<?> mappingIterator = (Iterable<?>)config.get(KEY_FIELD_MAPPINGS);
List<FieldMapping> fieldMappings;
- if(mappings != null){
+ if(mappingIterator != null){
fieldMappings = new ArrayList<FieldMapping>();
- for(Object mappingString : mappings){
+ for(Object mappingString : mappingIterator){
if(mappingString != null){
FieldMapping fieldMapping = FieldMappingUtils.parseFieldMapping(mappingString.toString());
if(fieldMapping != null){
@@ -383,12 +385,12 @@ public class RdfIndexer {
} else if(!modelDir.isDirectory()){
throw new IllegalStateException(String.format("A directory for %s already exists but is not a directory!",modelDir.getAbsoluteFile()));
} //else exists and is a dir -> nothing to do
- Object skipRead = config.get(KEY_SKIP_READ);
- if(skipRead != null){
- if(skipRead instanceof Boolean){
- this.skipRead = ((Boolean)skipRead).booleanValue();
+ Object skipReadObject = config.get(KEY_SKIP_READ);
+ if(skipReadObject != null){
+ if(skipReadObject instanceof Boolean){
+ this.skipRead = ((Boolean)skipReadObject).booleanValue();
} else {
- this.skipRead = Boolean.parseBoolean(skipRead.toString());
+ this.skipRead = Boolean.parseBoolean(skipReadObject.toString());
}
} else {
this.skipRead = false;
@@ -452,12 +454,12 @@ public class RdfIndexer {
this.minimumRequiredEntityRanking = minRanking;
}
- Object resumeMode = config.get(KEY_RESUME_MODE);
- if(resumeMode != null) {
- if(resumeMode instanceof Boolean){
- this.resumeMode = (Boolean)resumeMode;
+ Object resumeModeObject = config.get(KEY_RESUME_MODE);
+ if(resumeModeObject != null) {
+ if(resumeModeObject instanceof Boolean){
+ this.resumeMode = (Boolean)resumeModeObject;
} else {
- this.resumeMode = Boolean.parseBoolean(resumeMode.toString());
+ this.resumeMode = Boolean.parseBoolean(resumeModeObject.toString());
}
} else {
this.resumeMode = false;
@@ -594,8 +596,9 @@ public class RdfIndexer {
}
} else {
if(literalValue instanceof String){
- if(!((String)literalValue).isEmpty())
- source.add(field, literalValue);
+ if(!((String)literalValue).isEmpty()){
+ source.add(field, literalValue);
+ }
} else {
source.add(field, literalValue);
}
@@ -674,7 +677,7 @@ public class RdfIndexer {
//remove leading path separators!
value = value.substring(File.pathSeparator.length());
}
- File testFile = new File(value.toString());
+ File testFile = new File(value);
if(!testFile.exists()){
if(create){ //create
Modified: incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexerConfig.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexerConfig.java?rev=1082257&r1=1082256&r2=1082257&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexerConfig.java (original)
+++ incubator/stanbol/trunk/entityhub/indexing/genericRdf/src/main/java/org/apache/stanbol/entityhub/indexing/rdf/RdfIndexerConfig.java Wed Mar 16 18:43:57 2011
@@ -107,7 +107,7 @@ public class RdfIndexerConfig {
* @param sourceFiles
* the source files to add
*/
- public void addSourceFile(File... sourceFiles) {
+ public final void addSourceFile(File... sourceFiles) {
if (sourceFiles != null) {
for (File sourceFile : sourceFiles) {
checkAndAddSrouceFile(sourceFile);
@@ -121,7 +121,7 @@ public class RdfIndexerConfig {
* @param sourceFile
* the source files to remove
*/
- public void removeSourceFile(File... sourceFile) {
+ public final void removeSourceFile(File... sourceFile) {
if (sourceFile == null) {
return;
}
@@ -136,7 +136,7 @@ public class RdfIndexerConfig {
*
* @return the unmodifiable list of files or <code>null</code>if no source files are present.
*/
- public Collection<File> getSourceFiles() {
+ public final Collection<File> getSourceFiles() {
Collection<File> sourceFiles = (Collection<File>) config.get(KEY_RDF_FILES);
return sourceFiles == null ? null : Collections.unmodifiableCollection((Collection<File>) config
.get(KEY_RDF_FILES));
@@ -150,7 +150,7 @@ public class RdfIndexerConfig {
* @return <code>true</code> if the parsed file can be used as indexing
* directory (exists and is a directory or !exists)
*/
- public boolean setIndexingDir(File file) throws IllegalArgumentException {
+ public final boolean setIndexingDir(File file) throws IllegalArgumentException {
if (checkFile(file, false, null)) { // isDirectory or !exists
config.put(KEY_RDF_STORE_DIR, file);
return true;
@@ -162,7 +162,7 @@ public class RdfIndexerConfig {
* Getter for the indexing directory
* @return the directory used for indexing
*/
- public File getIndexingDir() {
+ public final File getIndexingDir() {
return (File) config.get(KEY_RDF_STORE_DIR);
}
/**
@@ -170,7 +170,7 @@ public class RdfIndexerConfig {
* for indexing
* @param modelName the RDF model name
*/
- public void setModelName(String modelName) {
+ public final void setModelName(String modelName) {
if (modelName != null && !modelName.isEmpty()) {
config.put(KEY_MODEL_NAME, modelName);
} else {
@@ -182,7 +182,7 @@ public class RdfIndexerConfig {
* for indexing
* @return the RDF model name
*/
- public String getModelName() {
+ public final String getModelName() {
return (String) config.get(KEY_MODEL_NAME);
}
/**
@@ -191,7 +191,7 @@ public class RdfIndexerConfig {
* about ranking of entities)
* @param entityRankings the entity ranking map
*/
- public void setEntityRankings(Map<String,Float> entityRankings) {
+ public final void setEntityRankings(Map<String,Float> entityRankings) {
if (entityRankings == null) {
config.remove(KEY_ENTITY_RANKINGS);
} else {
@@ -205,7 +205,7 @@ public class RdfIndexerConfig {
* @return the entity rankings or <code>null</code> if no entity rankings
* are present
*/
- public Map<String,Float> getNetityRankings() {
+ public final Map<String,Float> getNetityRankings() {
return (Map<String,Float>) config.get(KEY_ENTITY_RANKINGS);
}
/**
@@ -213,7 +213,7 @@ public class RdfIndexerConfig {
* {@link RdfIndexer#KEY_INDEXING_MODE} before setting this property.
* @param mode the indexing mode
*/
- public void setIndexingMode(IndexingMode mode) {
+ public final void setIndexingMode(IndexingMode mode) {
if (mode != null) {
config.put(KEY_INDEXING_MODE, mode);
} else {
@@ -225,7 +225,7 @@ public class RdfIndexerConfig {
* @return the indexing mode or <code>null</code> if not set by this
* configuration.
*/
- public IndexingMode getIndexingMode() {
+ public final IndexingMode getIndexingMode() {
return (IndexingMode) config.get(KEY_INDEXING_MODE);
}
/**
@@ -235,7 +235,7 @@ public class RdfIndexerConfig {
* indexing session that has already completed with reading the RDF data.
* @param state the state or <code>null</code> to remove any present config
*/
- public void setSkipRead(Boolean state) {
+ public final void setSkipRead(Boolean state) {
if (state == null) {
config.remove(KEY_SKIP_READ);
} else {
@@ -246,7 +246,7 @@ public class RdfIndexerConfig {
* Getter for the skip reading state.
* @return the state or <code>null</code> if not set
*/
- public Boolean getSkipRead() {
+ public final Boolean getSkipRead() {
return (Boolean) config.get(KEY_SKIP_READ);
}
/**
@@ -258,7 +258,7 @@ public class RdfIndexerConfig {
* at once. Parse <code>null</code> or a value smaller equals zero to remove
* this optional configuration.
*/
- public void setChunkSize(Integer size) {
+ public final void setChunkSize(Integer size) {
if (size == null || size < 1) {
config.remove(KEY_CHUNK_SIZE);
} else {
@@ -270,7 +270,7 @@ public class RdfIndexerConfig {
* in the {@link Yard}.
* @return the chunk size or <code>null</code> if not present
*/
- public Integer getChunkSize() {
+ public final Integer getChunkSize() {
return (Integer) config.get(KEY_CHUNK_SIZE);
}
/**
@@ -279,7 +279,7 @@ public class RdfIndexerConfig {
* @param state the state or <code>null</code> to remove the configuration
* and go with the default.
*/
- public void setIgnoreEntitiesWithoutRanking(Boolean state) {
+ public final void setIgnoreEntitiesWithoutRanking(Boolean state) {
if (state == null) {
config.remove(KEY_IGNORE_ENTITIES_WITHOUT_ENTITY_RANKING);
} else {
@@ -291,7 +291,7 @@ public class RdfIndexerConfig {
* ignored.
* @return the state or <code>null</code> if not present
*/
- public Boolean getIgnoreEntitiesWithoutRanking() {
+ public final Boolean getIgnoreEntitiesWithoutRanking() {
return (Boolean) config.get(KEY_IGNORE_ENTITIES_WITHOUT_ENTITY_RANKING);
}
/**
@@ -301,7 +301,7 @@ public class RdfIndexerConfig {
* value smaller equals 0 to remove this configuration and go with the
* default.
*/
- public void setMinEntityRanking(Float minRanking) {
+ public final void setMinEntityRanking(Float minRanking) {
if (minRanking == null || minRanking <= 0) {
config.remove(KEY_REQUIRED_ENTITY_RANKING);
} else {
@@ -313,7 +313,7 @@ public class RdfIndexerConfig {
* @return the minimum required ranking or <code>null</code> if not defined
* by this configuration
*/
- public Float getMinEntityRanking() {
+ public final Float getMinEntityRanking() {
return (Float) config.get(KEY_REQUIRED_ENTITY_RANKING);
}
/**
@@ -323,7 +323,7 @@ public class RdfIndexerConfig {
* information. Parse <code>null</code> or a value smaller equals zero to
* remove this configuration.
*/
- public void setDefaultEntityRanking(Float defaultRanking) {
+ public final void setDefaultEntityRanking(Float defaultRanking) {
if (defaultRanking == null || defaultRanking <= 0) {
config.remove(defaultRanking);
} else {
@@ -336,7 +336,7 @@ public class RdfIndexerConfig {
* @return the default ranking or <code>null</code> if not present within
* this configuration.
*/
- public Float getDefaultEntityRanking() {
+ public final Float getDefaultEntityRanking() {
return (Float) config.get(KEY_DEFAULT_ENTITY_RANKING);
}
@@ -345,7 +345,7 @@ public class RdfIndexerConfig {
* if OK add them to the configuration.
* @param sourceFile the file to add
*/
- private void checkAndAddSrouceFile(File sourceFile) {
+ private final void checkAndAddSrouceFile(File sourceFile) {
if (checkFile(sourceFile, true, true)) {
Set<File> files = (Set<File>) config.get(KEY_RDF_FILES);
if (files == null) {
@@ -364,7 +364,7 @@ public class RdfIndexerConfig {
* If <code>null</code> or an empty collection is parsed the configuration
* is removed.
*/
- public void setMappings(Collection<String> mappings){
+ public final void setMappings(Collection<String> mappings){
if(mappings == null || mappings.isEmpty()){
config.remove(KEY_FIELD_MAPPINGS);
} else {
@@ -379,7 +379,7 @@ public class RdfIndexerConfig {
* @param mapper the FieldMapper instance with the FieldMappings to be used
* for the configuration of the indexer.
*/
- public void setMappings(FieldMapper mapper){
+ public final void setMappings(FieldMapper mapper){
if(mapper != null){
String[] mappingStrings = FieldMappingUtils.serialiseFieldMapper(mapper);
setMappings(mappingStrings != null ? Arrays.asList(mappingStrings):null);
@@ -392,7 +392,7 @@ public class RdfIndexerConfig {
* @return the field mappings or <code>null</code> if no are defined for
* this configuration.
*/
- public Collection<String> getMappings(){
+ public final Collection<String> getMappings(){
Collection<String> mappings = (Collection<String>)config.get(KEY_FIELD_MAPPINGS);
return mappings == null ? null: Collections.unmodifiableCollection(mappings);
}
@@ -408,7 +408,7 @@ public class RdfIndexerConfig {
* @return <code>true</code> if the parsed {@link File} fulfils the stated
* requirements.
*/
- private boolean checkFile(File file, boolean isFile, Boolean exists) {
+ private final boolean checkFile(File file, boolean isFile, Boolean exists) {
//exists null means that it will be created if not existence
//therefore we need only to check the state if not null.
if (exists != null) {