added javadoc

This commit is contained in:
Sebastian Sdorra
2011-07-03 17:01:06 +02:00
parent 7feec4163b
commit 1083f53acd
25 changed files with 229 additions and 145 deletions

View File

@@ -46,35 +46,36 @@ import java.io.InputStream;
import java.util.Properties;
/**
* The default implementation of {@link SCMContextProvider}.
*
* @author Sebastian Sdorra
*/
public class BasicContextProvider implements SCMContextProvider
{
/** Field description */
/** Default version {@link String} */
public static final String DEFAULT_VERSION = "unknown";
/** Field description */
/** Default name of the SCM-Manager base directory */
public static final String DIRECTORY_DEFAULT = ".scm";
/** Field description */
/** Environment varibale for the SCM-Manager base directory */
public static final String DIRECTORY_ENVIRONMENT = "SCM_HOME";
/** Field description */
/** Java system property for the SCM-Manager base directory */
public static final String DIRECTORY_PROPERTY = "scm.home";
/** Field description */
/** Path to the maven properties file of the scm-core artifact */
public static final String MAVEN_PROPERTIES =
"/META-INF/maven/sonia.scm/scm-core/pom.properties";
/** Field description */
/** Maven property for the version of the artifact */
public static final String MAVEN_PROPERTY_VERSION = "version";
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
* Constructs a new {@link BasicContextProvider} object.
*
*/
public BasicContextProvider()
@@ -86,7 +87,7 @@ public class BasicContextProvider implements SCMContextProvider
//~--- methods --------------------------------------------------------------
/**
* Method description
* {@see java.io.Closeable#close()}
*
*
* @throws IOException
@@ -95,7 +96,7 @@ public class BasicContextProvider implements SCMContextProvider
public void close() throws IOException {}
/**
* Method description
* {@see SCMContextProvider#init()}
*
*/
@Override
@@ -104,10 +105,10 @@ public class BasicContextProvider implements SCMContextProvider
//~--- get methods ----------------------------------------------------------
/**
* Method description
* {@see SCMContextProvider#getBaseDirectory()}
*
*
* @return
* @return {@see SCMContextProvider#getBaseDirectory()}
*/
@Override
public File getBaseDirectory()
@@ -116,10 +117,11 @@ public class BasicContextProvider implements SCMContextProvider
}
/**
* Method description
* Returns the version of the SCM-Manager. If the version is not set, the
* {@link #DEFAULT_VERSION} is returned.
*
*
* @return
* @return the version of the SCM-Manager
*/
@Override
public String getVersion()
@@ -130,10 +132,10 @@ public class BasicContextProvider implements SCMContextProvider
//~--- methods --------------------------------------------------------------
/**
* Method description
* Find the base directory of SCM-Manager.
*
*
* @return
* @return base directory SCM-Manager
*/
private File findBaseDirectory()
{
@@ -161,10 +163,10 @@ public class BasicContextProvider implements SCMContextProvider
}
/**
* Method description
* Loads the version of the SCM-Manager from maven properties file.
*
*
* @return
* @return the version of the SCM-Manager
*/
private String loadVersion()
{
@@ -189,9 +191,9 @@ public class BasicContextProvider implements SCMContextProvider
//~--- fields ---------------------------------------------------------------
/** Field description */
/** The base directory of the SCM-Manager */
private File baseDirectory;
/** Field description */
/** the version of the SCM-Manager */
private String version;
}

View File

@@ -29,9 +29,12 @@
*
*/
package sonia.scm;
/**
* Callback listener for setting properties that are changed.
*
* @author Sebastian Sdorra
*/
@@ -39,7 +42,8 @@ public interface ConfigChangedListener
{
/**
* Method description
* This method is called when a configuration has changed
*
*
*
* @param config

View File

@@ -29,9 +29,12 @@
*
*/
package sonia.scm;
/**
* Exception for problems with the SCM-Manager configuration.
*
* @author Sebastian Sdorra
*/
@@ -44,7 +47,7 @@ public class ConfigurationException extends RuntimeException
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
* Constructs a {@link ConfigurationException}
*
*/
public ConfigurationException()
@@ -53,7 +56,7 @@ public class ConfigurationException extends RuntimeException
}
/**
* Constructs ...
* Constructs a {@link ConfigurationException}
*
*
* @param message
@@ -64,7 +67,7 @@ public class ConfigurationException extends RuntimeException
}
/**
* Constructs ...
* Constructs a {@link ConfigurationException}
*
*
* @param cause
@@ -75,7 +78,7 @@ public class ConfigurationException extends RuntimeException
}
/**
* Constructs ...
* Constructs a {@link ConfigurationException}
*
*
* @param message

View File

@@ -34,6 +34,7 @@
package sonia.scm;
/**
* Util class for filtering of objects.
*
* @author Sebastian Sdorra
*
@@ -43,12 +44,12 @@ public interface Filter<T>
{
/**
* Method description
* Tests whether the item is filtered.
*
*
* @param item
* @param item for the accept test
*
* @return
* @return true if the object is accepted
*/
public boolean accept(T item);
}

View File

@@ -37,7 +37,7 @@ package sonia.scm;
*
* @author Sebastian Sdorra
*
* @param <T>
* @param <T> a typed object
* @param <E>
*/
public interface Handler<T extends TypedObject, E extends Exception>
@@ -45,18 +45,18 @@ public interface Handler<T extends TypedObject, E extends Exception>
{
/**
* Method description
* Returns the type object of the handler.
*
*
* @return
* @return type object of the handler
*/
public Type getType();
/**
* Method description
* Returns true if the hanlder is configured.
*
*
* @return
* @return true if the hanlder is configured
*/
public boolean isConfigured();
}

View File

@@ -39,21 +39,22 @@ import java.io.Closeable;
import java.io.IOException;
/**
* The base class of all handlers.
*
* @author Sebastian Sdorra
*
* @param <T>
* @param <E>
* @param <T> type object of the handler
* @param <E> exception type of the handler
*/
public interface HandlerBase<T extends TypedObject, E extends Exception>
extends Initable, Closeable
{
/**
* Method description
* Persists a new object.
*
*
* @param object
* @param object to store
*
* @throws E
* @throws IOException
@@ -61,10 +62,10 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
public void create(T object) throws E, IOException;
/**
* Method description
* Removes a persistent object.
*
*
* @param object
* @param object to delete
*
* @throws E
* @throws IOException
@@ -72,10 +73,10 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
public void delete(T object) throws E, IOException;
/**
* Method description
* Modifies a persistent object.
*
*
* @param object
* @param object to modify
*
* @throws E
* @throws IOException

View File

@@ -32,7 +32,16 @@
package sonia.scm;
/**
* Handler event type.
*
* @author Sebastian Sdorra
*/
public enum HandlerEvent { CREATE, MODIFY, DELETE }
public enum HandlerEvent
{
/** The type of the event, if a new object is stored by a handler. */
CREATE,
/** The type of the event, if a object is modified by a handler. */
MODIFY,
/** The type of the event, if a object is removed by a handler. */
DELETE
}

View File

@@ -32,6 +32,7 @@
package sonia.scm;
/**
* Base interface for all initable objects.
*
* @author Sebastian Sdorra
*/
@@ -39,10 +40,10 @@ public interface Initable
{
/**
* Method description
* This method is called when the SCM manager is started.
*
*
* @param context
* @param the context provider of the SCM-Manager
*/
public void init(SCMContextProvider context);
}

View File

@@ -34,6 +34,7 @@
package sonia.scm;
/**
* Base interface of all objects which have a last modified date.
*
* @author Sebastian Sdorra
*/
@@ -41,10 +42,10 @@ public interface LastModifiedAware
{
/**
* Method description
* Returns a timestamp of the last modified date.
*
*
* @return
* @return timestamp of the last modified date
*/
public Long getLastModified();
}

View File

@@ -38,24 +38,25 @@ package sonia.scm;
import java.util.Collection;
/**
* Base interface for all objects have support for listeners.
*
* @author Sebastian Sdorra
*
* @param <T>
* @param <T> type of the listeners
*/
public interface ListenerSupport<T>
{
/**
* Method description
* Register a listener.
*
*
* @param listener
* @param listener to register
*/
public void addListener(T listener);
/**
* Method description
* Register a {@link java.util.Collection} of listeners.
*
*
* @param listeners
@@ -63,10 +64,10 @@ public interface ListenerSupport<T>
public void addListeners(Collection<T> listeners);
/**
* Method description
* Unregister a listener.
*
*
* @param listener
* @param listener to unregister
*/
public void removeListener(T listener);
}

View File

@@ -41,18 +41,19 @@ import java.util.Collection;
import java.util.Comparator;
/**
* Base interface for all manager classes.
*
* @author Sebastian Sdorra
*
* @param <T>
* @param <E>
* @param <T> type of the model object
* @param <E> type of the exception
*/
public interface Manager<T extends ModelObject, E extends Exception>
extends HandlerBase<T, E>, LastModifiedAware
{
/**
* Method description
* Reloads a object from store and overwrites all changes.
*
*
* @param object
@@ -65,59 +66,61 @@ public interface Manager<T extends ModelObject, E extends Exception>
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns the object with the given id.
*
*
* @param id of the object
*
* @param id
*
* @return
* @return object with the given id
*/
public T get(String id);
/**
* Method description
* Returns a {@link java.util.Collection} of all objects in the store.
*
*
* @return
* @return all object in the store
*/
public Collection<T> getAll();
/**
* Method description
* Returns all object of the store sorted by the given {@link java.util.Comparator}
*
*
*
* @param comparator
* @return
* @param comparator to sort the returned objects
* @since 1.4
* @return all object of the store sorted by the given {@link java.util.Comparator}
*/
public Collection<T> getAll(Comparator<T> comparator);
/**
* Method description
* Returns all objects from the store which are between the given start and
* end parameter.
*
*
* @param start
* @param start parameter
* @param limit
*
* @return
* @since 1.4
* @returnall objects from the store which are between the given start and
* end parameter
*
* @return
*/
public Collection<T> getAll(int start, int limit);
/**
* Method description
* Returns all objects from the store which are between the given start and
* end parameter sorted by the given comparator.
*
*
*
*
* @param comparator
* @param start
* @param comparator to sort the returned objects
* @param start parameter
* @param limit
*
* @return
* @since 1.4
* @return all objects from the store which are between the given start and
* end parameter sorted by the given comparator
*/
public Collection<T> getAll(Comparator<T> comparator, int start, int limit);
}

View File

@@ -38,6 +38,7 @@ package sonia.scm;
import java.io.Serializable;
/**
* Base interface for all model objects.
*
* @author Sebastian Sdorra
*/
@@ -47,10 +48,10 @@ public interface ModelObject
{
/**
* Method description
* Returns the unique id of the model object
*
*
* @return
* @return unique id
*/
public String getId();
}

View File

@@ -38,6 +38,7 @@ package sonia.scm;
import sonia.scm.util.Util;
/**
* Represents the platform on which the SCM manager running.
*
* @author Sebastian Sdorra
*/
@@ -45,12 +46,12 @@ public class Platform
{
/**
* Constructs ...
* Constructs a {@link Platform} object
*
*
* @param osName
* @param archModel
* @param osArch
* @param osName - name of the operation system
* @param archModel - name of the host architecture model
* @param archModel - name of the operation system architecture
*/
public Platform(String osName, String archModel, String osArch)
{
@@ -74,10 +75,10 @@ public class Platform
//~--- methods --------------------------------------------------------------
/**
* Method description
* Returns true if the operating system is 32 bit operating system.
*
*
* @return
* @return true if the operating system is 32 bit operating system
*/
public boolean is32Bit()
{

View File

@@ -34,6 +34,7 @@
package sonia.scm;
/**
* Type of the SCM-Manager host platform.
*
* @author Sebastian Sdorra
*/
@@ -44,11 +45,11 @@ public enum PlatformType
OPENBSD(true, true);
/**
* Constructs ...
* Constructs {@link PlatformType} object.
*
*
* @param unix
* @param posix
* @param unix - unix operating system
* @param posix - support for posix
*/
private PlatformType(boolean unix, boolean posix)
{
@@ -59,12 +60,12 @@ public enum PlatformType
//~--- methods --------------------------------------------------------------
/**
* Method description
* Returns {@link PlatformType} object for the given operating system name.
*
*
* @param osName
* @param osName - name of the operating system
*
* @return
* @return {@link PlatformType} object for the given operating system name
*/
public static PlatformType createPlatformType(String osName)
{
@@ -103,10 +104,10 @@ public enum PlatformType
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns true if the platform has support for posix.
*
*
* @return
* @return true if the platform has support for posix
*/
public boolean isPosix()
{
@@ -114,10 +115,10 @@ public enum PlatformType
}
/**
* Method description
* Returns true if the platform is a unix system.
*
*
* @return
* @return true if the platform is a unix system
*/
public boolean isUnix()
{
@@ -126,9 +127,9 @@ public enum PlatformType
//~--- fields ---------------------------------------------------------------
/** Field description */
/** has the platform support for posix */
private boolean posix;
/** Field description */
/** is the platform is a unix system */
private boolean unix;
}

View File

@@ -38,28 +38,30 @@ package sonia.scm;
import sonia.scm.util.ServiceUtil;
/**
* The SCMConext searches a implementation of {@link SCMContextProvider} and
* holds a singleton instance of this implementation.
*
* @author Sebastian Sdorra
*/
public class SCMContext
{
/** Field description */
/** Default java package for finding extensions */
public static final String DEFAULT_PACKAGE = "sonia.scm";
/** Field description */
/** Name of the anonymous user */
public static final String USER_ANONYMOUS = "anonymous";
/** Field description */
/** Singleton instance of {@link SCMContextProvider} */
private static volatile SCMContextProvider provider;
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns the singleton instance of {@link SCMContextProvider}
*
*
* @return
* @return singleton instance of {@link SCMContextProvider}
*/
public static SCMContextProvider getContext()
{

View File

@@ -39,6 +39,9 @@ import java.io.Closeable;
import java.io.File;
/**
* The main class for retrieving the home and the version of the SCM-Manager.
* This class is a singleton which can be retrieved via
* inject or with the static {@link SCMContext#getContext()} method.
*
* @author Sebastian Sdorra
*/
@@ -46,7 +49,8 @@ public interface SCMContextProvider extends Closeable
{
/**
* Method description
* Initializes the {@link SCMContextProvider}.
* This method is called when the SCM manager is started.
*
*/
public void init();
@@ -54,18 +58,18 @@ public interface SCMContextProvider extends Closeable
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns the base directory of the SCM-Manager.
*
*
* @return
* @return base directory of the SCM-Manager
*/
public File getBaseDirectory();
/**
* Method description
* Returns the version of the SCM-Manager.
*
*
* @return
* @return version of the SCM-Manager
*/
public String getVersion();
}

View File

@@ -34,6 +34,8 @@
package sonia.scm;
/**
* Configuration object for the SCM-Manager
* client (WebInterface, RestClient, ...).
*
* @author Sebastian Sdorra
*/
@@ -41,13 +43,13 @@ public class ScmClientConfig
{
/**
* Constructs ...
* Constructs {@link ScmClientConfig} object
*
*/
public ScmClientConfig() {}
/**
* Constructs ...
* Constructs {@link ScmClientConfig} object
*
*
* @param dateFormat
@@ -60,10 +62,12 @@ public class ScmClientConfig
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns the date format for the user interface. This format is a
* JavaScript date format, see
* {@link http://jacwright.com/projects/javascript/date_format}.
*
*
* @return
* @return JavaScript date format
*/
public String getDateFormat()
{
@@ -73,7 +77,8 @@ public class ScmClientConfig
//~--- set methods ----------------------------------------------------------
/**
* Method description
* Setter for the date format
*
*
*
* @param dateFormat

View File

@@ -57,15 +57,13 @@ public class ScmState
{
/**
* Constructs ...
* Constructs {@link ScmState} object. This constructor is required by JAXB.
*
*/
public ScmState() {}
/**
* Constructs ...
*
*
* Constructs {@link ScmState} object.
*
*
* @param provider

View File

@@ -34,21 +34,22 @@
package sonia.scm;
/**
* Util class to transform multiple objects.
*
* @author Sebastian Sdorra
*
* @param <T>
* @param <T> type of objects to transform
*/
public interface TransformFilter<T>
{
/**
* Method description
* Transform the given object.
*
*
* @param item
* @param object to transform
*
* @return
* @return tranformed object
*/
public T accept(T item);
}

View File

@@ -39,6 +39,7 @@ import sonia.scm.util.AssertUtil;
import sonia.scm.util.Util;
/**
* Base class for all objects which supports different types.
*
* @author Sebastian Sdorra
*/
@@ -46,13 +47,14 @@ public class Type
{
/**
* Constructor is required for JAXB
* Constructs {@link Type} object.
* This constructor is required for JAXB.
*
*/
public Type() {}
/**
* Constructs ...
* Constructs {@link Type} object
*
*
* @param name
@@ -76,12 +78,12 @@ public class Type
//~--- methods --------------------------------------------------------------
/**
* Method description
* Returns true if the given ovject is equals.
*
*
* @param obj
*
* @return
* @return true if the given ovject is equals
*/
@Override
public boolean equals(Object obj)
@@ -116,10 +118,10 @@ public class Type
}
/**
* Method description
* Returns the hash code of the object.
*
*
* @return
* @return hash code of the object
*/
@Override
public int hashCode()
@@ -137,10 +139,10 @@ public class Type
}
/**
* Method description
* Returns {@link String} representation of the type.
*
*
* @return
* @return {@link String} representation of the type
*/
@Override
public String toString()
@@ -155,10 +157,10 @@ public class Type
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns the display name of the type.
*
*
* @return
* @return display name of the type
*/
public String getDisplayName()
{
@@ -166,10 +168,10 @@ public class Type
}
/**
* Method description
* Returns the unique name of the type.
*
*
* @return
* @return unique name of the type
*/
public String getName()
{
@@ -179,7 +181,8 @@ public class Type
//~--- set methods ----------------------------------------------------------
/**
* Method description
* Setter for the display name of the type
*
*
*
* @param displayName
@@ -190,10 +193,10 @@ public class Type
}
/**
* Method description
* Setter for the type name
*
*
* @param name
* @param name of the type
*/
public void setName(String name)
{
@@ -202,9 +205,9 @@ public class Type
//~--- fields ---------------------------------------------------------------
/** Field description */
/** display name of the type */
private String displayName;
/** Field description */
/** unique name of the type */
private String name;
}

View File

@@ -38,32 +38,35 @@ package sonia.scm;
import java.util.Collection;
/**
* Base interface for all type manager classes.
*
* @author Sebastian Sdorra
*
* @param <T>
* @param <E>
* @param <T> type of the model object
* @param <E> type of the exception
*/
public interface TypeManager<T extends ModelObject, E extends Exception>
extends Manager<T, E>
{
/**
* Method description
* Returns the handler for given type or
* null if no handler of that type is available.
*
*
* @param type
* @param <H>
* @param type name of the handler
* @param <H> type of the handler
*
* @return
* @return the handler for given type
*/
public <H extends Handler<T, E>> H getHandler(String type);
/**
* Method description
* Returns a {@link java.util.Collection} of all
* available and configured types.
*
*
* @return
* @return all available types
*/
public Collection<Type> getTypes();
}

View File

@@ -34,6 +34,7 @@
package sonia.scm;
/**
* Base interface for all objects of specific type.
*
* @author Sebastian Sdorra
*/
@@ -41,10 +42,10 @@ public interface TypedObject
{
/**
* Method description
* Returns the type of the object.
*
*
* @return
* @return type of the object
*/
public String getType();
}

View File

@@ -34,6 +34,7 @@
package sonia.scm;
/**
* Base interface for all validateable objects.
*
* @author Sebastian Sdorra
*/
@@ -41,10 +42,10 @@ public interface Validateable
{
/**
* Method description
* Returns true if the object is valid.
*
*
* @return
* @return true if the object is valid
*/
public boolean isValid();
}

View File

@@ -520,6 +520,7 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
*
*
* @param servername
* @deprecated use {@link #setBaseUrl(String)}
*/
public void setServername(String servername)
{

View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) 2010, Sebastian Sdorra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of SCM-Manager; nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* http://bitbucket.org/sdorra/scm-manager
*
*/
/**
* Base classes and interfaces of the SCM-Manager.
*/
package sonia.scm;