Author: desruisseaux
Date: Sat Sep 15 16:01:41 2012
New Revision: 1385098
URL: http://svn.apache.org/viewvc?rev=1385098&view=rev
Log:
Creation of sis-utility module (SIS-62). This commit contains only a few trivial classes to
be used by other classes to be committed tomorrow.
Added:
incubator/sis/trunk/sis-utility/ (with props)
incubator/sis/trunk/sis-utility/pom.xml (with props)
incubator/sis/trunk/sis-utility/src/
incubator/sis/trunk/sis-utility/src/main/
incubator/sis/trunk/sis-utility/src/main/java/
incubator/sis/trunk/sis-utility/src/main/java/org/
incubator/sis/trunk/sis-utility/src/main/java/org/apache/
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/Objects.java (with
props)
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/package-info.java
(with props)
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/resources/
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Debug.java (with props)
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
(with props)
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java (with
props)
incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/package-info.java
(with props)
Modified:
incubator/sis/trunk/pom.xml
incubator/sis/trunk/sis-metadata/pom.xml
Modified: incubator/sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/pom.xml?rev=1385098&r1=1385097&r2=1385098&view=diff
==============================================================================
--- incubator/sis/trunk/pom.xml (original)
+++ incubator/sis/trunk/pom.xml Sat Sep 15 16:01:41 2012
@@ -244,6 +244,13 @@ Apache SIS is a toolkit for describing l
<artifactId>georss-rome</artifactId>
<version>0.9.8</version>
</dependency>
+
+ <!-- Libraries (language, XML, network) -->
+ <dependency>
+ <groupId>net.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ <version>1.0</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -433,6 +440,7 @@ Apache SIS is a toolkit for describing l
<modules>
<module>sis-build-helper</module>
<module>sis-core</module>
+ <module>sis-utility</module>
<module>sis-metadata</module>
<module>sis-webapp</module>
<module>sis-app</module>
Modified: incubator/sis/trunk/sis-metadata/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-metadata/pom.xml?rev=1385098&r1=1385097&r2=1385098&view=diff
==============================================================================
--- incubator/sis/trunk/sis-metadata/pom.xml (original)
+++ incubator/sis/trunk/sis-metadata/pom.xml Sat Sep 15 16:01:41 2012
@@ -99,6 +99,11 @@ Implementations of metadata derived from
=========================================================== -->
<dependencies>
<dependency>
+ <groupId>org.apache.sis</groupId>
+ <artifactId>sis-utility</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.opengis</groupId>
<artifactId>geoapi</artifactId>
</dependency>
Propchange: incubator/sis/trunk/sis-utility/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Sep 15 16:01:41 2012
@@ -0,0 +1 @@
+target
Added: incubator/sis/trunk/sis-utility/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-utility/pom.xml?rev=1385098&view=auto
==============================================================================
--- incubator/sis/trunk/sis-utility/pom.xml (added)
+++ incubator/sis/trunk/sis-utility/pom.xml Sat Sep 15 16:01:41 2012
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<project xmlns = "http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.sis</groupId>
+ <artifactId>sis-parent</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ </parent>
+
+
+ <!-- ===========================================================
+ Module Description
+ =========================================================== -->
+ <artifactId>sis-utility</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache SIS utilities</name>
+ <description>
+ <!-- Left alignment because this description will be copied in META-INF/MANIFEST.MF
+ The leading space after the first line is necessary for proper formatting. -->
+Miscellaneous utilities.
+ </description>
+
+
+ <!-- ===========================================================
+ Developers and Contributors
+ =========================================================== -->
+ <developers>
+ <developer>
+ <id>desruisseaux</id>
+ <name>Martin Desruisseaux</name>
+ <email>martin.desruisseaux@geomatys.fr</email>
+ <organization>Geomatys</organization>
+ <organizationUrl>http://www.geomatys.com/</organizationUrl>
+ <timezone>+1</timezone>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ </developer>
+ </developers>
+ <contributors>
+ <contributor>
+ <name>Cédric Briançon</name>
+ <email>cedric.briancon@geomatys.com</email>
+ <organization>Geomatys</organization>
+ <timezone>+1</timezone>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ </contributor>
+ <contributor>
+ <name>Guilhem Legal</name>
+ <email>guilhem.legal@geomatys.com</email>
+ <organization>Geomatys</organization>
+ <timezone>+1</timezone>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ </contributor>
+ <contributor>
+ <name>Touraïvane</name>
+ <organization>
+ Institut de Recherche pour le Développement (IRD)
+ </organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ </contributor>
+ </contributors>
+
+
+ <!-- ===========================================================
+ Dependencies
+ =========================================================== -->
+ <dependencies>
+ <dependency>
+ <groupId>org.opengis</groupId>
+ <artifactId>geoapi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opengis</groupId>
+ <artifactId>geoapi-conformance</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: incubator/sis/trunk/sis-utility/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sis/trunk/sis-utility/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/Objects.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/Objects.java?rev=1385098&view=auto
==============================================================================
--- incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/Objects.java (added)
+++ incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/Objects.java Sat
Sep 15 16:01:41 2012
@@ -0,0 +1,58 @@
+/*
+ * 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.sis.internal;
+
+
+/**
+ * Place holder for {@link java.util.Objects}. This class will be deleted when we will be
allowed
+ * to compile for JDK7.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from GeoAPI)
+ * @version 0.3
+ * @module
+ */
+public final class Objects {
+ /**
+ * Do not allow instantiation of this class.
+ */
+ private Objects() {
+ }
+
+ /**
+ * See JDK7 javadoc.
+ *
+ * @param value Reference to check against null value.
+ * @param message Exception message.
+ */
+ public static void requireNonNull(final Object value, final String message) {
+ if (value == null) {
+ throw new NullPointerException(message);
+ }
+ }
+
+ /**
+ * See JDK7 javadoc.
+ *
+ * @param o1 First object to compare.
+ * @param o2 Second object to compare.
+ * @return {@code true} if both objects are equal.
+ */
+ public static boolean equals(final Object o1, final Object o2) {
+ return (o1 == o2) || (o1 != null && o1.equals(o2));
+ }
+}
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/Objects.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/Objects.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/package-info.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/package-info.java?rev=1385098&view=auto
==============================================================================
--- incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/package-info.java
(added)
+++ incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/package-info.java
Sat Sep 15 16:01:41 2012
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+/**
+ * A set of helper classes for the SIS implementation.
+ *
+ * <STRONG>Do not use!</STRONG>
+ *
+ * This package is for internal use by SIS only. Classes in this package
+ * may change in incompatible ways in any future version without notice.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-2.0)
+ * @version 0.3
+ * @module
+ */
+package org.apache.sis.internal;
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Debug.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Debug.java?rev=1385098&view=auto
==============================================================================
--- incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Debug.java (added)
+++ incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Debug.java Sat Sep 15
16:01:41 2012
@@ -0,0 +1,45 @@
+/*
+ * 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.sis.util;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+
+/**
+ * Annotates classes or methods that are provided mostly for debugging purpose. This annotation
+ * is defined in order to make easier to find which debugging tools are available in case
of
+ * problem. See the "<cite>Use</cite>" javadoc link for a list of annotated classes
and methods.
+ *
+ * {@section <code>toString()</code> policy}
+ * Note that many {@link Object#toString()} methods are overridden for debugging purpose.
+ * This {@code Debug} annotation does not apply to those {@code toString()} methods,
+ * because they are too numerous and their policy usage can change at any time.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.19)
+ * @version 0.3
+ * @module
+ */
+@Documented
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.SOURCE)
+public @interface Debug {
+}
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Debug.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Debug.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java?rev=1385098&view=auto
==============================================================================
--- incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
(added)
+++ incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
Sat Sep 15 16:01:41 2012
@@ -0,0 +1,58 @@
+/*
+ * 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.sis.util;
+
+
+/**
+ * Throws when a null argument has been given to a method that doesn't accept them.
+ * This exception extends {@link NullPointerException} in order to stress out that
+ * the error is an illegal argument rather than an unexpected usage of a null pointer
+ * inside a method body.
+ *
+ * {@note We could argue that this exception should extend <code>IllegalArgumentException</code>.
+ * However <code>NullPointerException</code> has become a more widely
adopted practice and
+ * is now the recommended one in the <cite>Effective Java</cite> book.}
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.00)
+ * @version 0.3
+ * @module
+ *
+ * @see ArgumentChecks#ensureNonNull(String, Object)
+ */
+public class NullArgumentException extends NullPointerException {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = -9191547216229354211L;
+
+ /**
+ * Constructs an exception with no detail message.
+ */
+ public NullArgumentException() {
+ super();
+ }
+
+ /**
+ * Constructs an exception with the specified detail message.
+ *
+ * @param message The detail message.
+ */
+ public NullArgumentException(final String message) {
+ super(message);
+ }
+}
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java?rev=1385098&view=auto
==============================================================================
--- incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java (added)
+++ incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java Sat Sep
15 16:01:41 2012
@@ -0,0 +1,51 @@
+/*
+ * 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.sis.util;
+
+
+/**
+ * Parent of classes that contain only static utility methods. This parent is for documentation
+ * purpose only. The list below summarizes some of the utility classes:
+ *
+ * <table>
+ * <tr><th colspan="2">Primitives and classes</th></tr>
+ * <tr><td>{@link CharSequences}</td>
+ * <td>Methods working on {@link CharSequence} or {@link String} instances.</td></tr>
+ *
+ * <tr><th colspan="2" bgcolor="lightblue">Structures (trees, collections, arrays,
parameters)</th></tr>
+ * <tr><td>{@link Arrays}</td>
+ * <td>Insert or remove elements in the middle of arrays.</td></tr>
+ *
+ * <tr><th colspan="2">Loggings and exceptions</th></tr>
+ * <tr><td>{@link ArgumentChecks}</td>
+ * <td>Perform argument checks and throw {@link IllegalArgumentException} if needed.</td></tr>
+ * </table>
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.00)
+ * @version 0.3
+ * @module
+ */
+public class Static {
+ /**
+ * Do not allow instantiation. This construction is defined only in order to allow
+ * subclassing. Subclasses shall declare their own private constructor in order to
+ * prevent instantiation.
+ */
+ protected Static() {
+ }
+}
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/package-info.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/package-info.java?rev=1385098&view=auto
==============================================================================
--- incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/package-info.java (added)
+++ incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/package-info.java Sat
Sep 15 16:01:41 2012
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+/**
+ * Simple data objects and miscellaneous utilities. This package provides:
+ *
+ * <ul>
+ * <li><p>General purpose static methods working on:</p>
+ * <ul>
+ * <li>Primitive or basic Java types:
+ * {@link org.apache.sis.util.CharSequences}.</li>
+ * </ul></li>
+ * </ul>
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-2.0)
+ * @version 0.3
+ * @module
+ */
+package org.apache.sis.util;
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/package-info.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
|