com.pmease.quickbuild.repositorysupport
Class Repository<T extends Revision>

java.lang.Object
  extended by com.pmease.quickbuild.extensionpoint.support.TypeInstance
      extended by com.pmease.quickbuild.repositorysupport.Repository<T>
Type Parameters:
T - represents the repository revision class
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
FailSafeRepository, QuickbuildRepository

public abstract class Repository<T extends Revision>
extends TypeInstance

Base class for the repository type

See Also:
Serialized Form

Nested Class Summary
static class Repository.SerializedForm
           
 
Field Summary
static java.lang.String LOCAL_CHANGE_DIR
           
static java.lang.String REVERT_CHANGE_DIR
           
 
Constructor Summary
Repository()
           
 
Method Summary
 void checkout()
          Checkout the repository using current revision.
protected abstract  void checkoutByRevision(T revision)
          Checkout from the repository using specified revision
 void commit(java.lang.String comment)
           
 boolean equals(java.lang.Object other)
           
static Repository<?> fromDOM(Configuration configuration, VersionedDocument dom)
           
 T getBaseRevision()
           
 Build getBuild()
           
 java.util.List<Changeset> getChanges()
           
 java.util.List<Changeset> getChanges(boolean retrieve)
          Get list of change sets since previous build.
protected abstract  java.util.List<Changeset> getChangesBetween(T startRevision, T endRevision)
          Get changes between two revisions.
 java.util.List<Changeset> getChangesSince(Build build)
           
 java.util.List<java.lang.String> getCommitters()
           
 java.util.List<java.lang.String> getCommitters(java.lang.String repositoryPath, boolean exactMatch)
           
 java.util.List<java.lang.String> getCommittersSincePrevSuccess()
           
 java.lang.String getDescription()
           
 java.lang.String getEmail(java.lang.String committer)
          Get email of the committer from repository.
protected abstract  T getHeadRevision()
          Get the head revision of the repository.
 java.lang.String getName()
           
abstract  ProofBuildSupport<? extends LocalChange> getProofBuildSupport()
           
 int getQuietPeriod()
           
 T getRevision()
           
 T getRevision(Build build)
          Get revision of this repository used to construct specified build.
 RepositoryRuntime getRuntime()
          Get the object holding runtime information of this repository, such as revision, checkout mark, etc.
abstract  SourceViewSupport<T> getSourceViewSupport()
           
 java.lang.String getType()
           
 UserMapping getUserMapping()
           
 java.lang.String getUserName(java.lang.String committer)
           
 int hashCode()
           
 boolean isChanged()
           
 boolean isChanged(java.lang.String pathPatterns)
           
 boolean isChangesRecorded()
           
 boolean isCheckout()
           
 boolean isDirty()
           
protected  boolean isLocalChangeApplied()
          Whether or not the local change is collected and applied to the checkout area.
protected abstract  boolean isQuietSince(java.util.Date date)
          Whether or not the repository is quiet since specified date.
 void label(java.lang.String label, java.lang.String comment)
          Label the repository with specified label name and comment.
protected abstract  void labelOnRevision(T revision, java.lang.String label, java.lang.String comment)
          Create a new label on the set of source code associated with specified revision
 void promoteLabel(java.lang.String label, java.lang.String destination)
           
protected  void revertLocalChange()
          Revert the checkout area to the state before applying local change.
 void setBuild(Build build)
           
 void setChanges(java.util.List<Changeset> changes)
           
 void setChangesRecorded(boolean changesRecorded)
           
 void setCheckout(boolean checkout)
          Mark the repository as being used for checkout.
 void setDescription(java.lang.String description)
           
 void setDirty(boolean dirty)
           
 void setName(java.lang.String name)
           
 void setQuietPeriod(int quietPeriod)
           
 void setRevision(T revision)
           
 void setUserMapping(UserMapping userMapping)
           
 void switchToHead()
           
 T takeSnapshot()
          Take snapshot of the repository by returning the repository revision.
 java.lang.String toString()
           
 java.lang.Object writeReplace()
           
 
Methods inherited from class com.pmease.quickbuild.extensionpoint.support.TypeInstance
getPlugin
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCAL_CHANGE_DIR

public static final java.lang.String LOCAL_CHANGE_DIR
See Also:
Constant Field Values

REVERT_CHANGE_DIR

public static final java.lang.String REVERT_CHANGE_DIR
See Also:
Constant Field Values
Constructor Detail

Repository

public Repository()
Method Detail

getName

@NotEmpty
public java.lang.String getName()
Get name of the repository.


setName

public void setName(java.lang.String name)

getType

public java.lang.String getType()

getDescription

public java.lang.String getDescription()
Get description of the repository.


setDescription

public void setDescription(java.lang.String description)

getQuietPeriod

public int getQuietPeriod()
Get quiet period of the repository. 0 will be returned if quiet period is disabled.


setQuietPeriod

public void setQuietPeriod(int quietPeriod)

getUserMapping

@NotNull
public UserMapping getUserMapping()
Get user mapping script.


setUserMapping

public void setUserMapping(UserMapping userMapping)

getRevision

public T getRevision()
Get internal revision of the repository. Depending on the repository type, this maybe a changelist number, a transaction number of a timestamp. The revision stands for a snapshot of the repository.


setRevision

public final void setRevision(T revision)
Set revision of this repository.


isDirty

public boolean isDirty()

setDirty

public void setDirty(boolean dirty)

label

public void label(java.lang.String label,
                  java.lang.String comment)
Label the repository with specified label name and comment.

Parameters:
label - an non-empty label name
comment - null if no comment is provided

checkout

public void checkout()
Checkout the repository using current revision.


commit

public void commit(java.lang.String comment)

switchToHead

public void switchToHead()

isLocalChangeApplied

protected boolean isLocalChangeApplied()
Whether or not the local change is collected and applied to the checkout area.

Returns:

revertLocalChange

protected void revertLocalChange()
Revert the checkout area to the state before applying local change. This is necessary before updating the checkout area from SCM.


isCheckout

public boolean isCheckout()
Whether or not this repository have been used for checkout.


setCheckout

public void setCheckout(boolean checkout)
Mark the repository as being used for checkout.

Parameters:
checkout -

takeSnapshot

public T takeSnapshot()
Take snapshot of the repository by returning the repository revision.

Returns:
current revision of the repository

isChanged

public boolean isChanged()
Whether or not the repository is changed since last build.


isChanged

public boolean isChanged(java.lang.String pathPatterns)
Whether or not specified path patterns are changed in the repository. Path patterns will be used to match paths displayed in the change set. Path patterns specified here should not be null.
Refer to the file patterns reference for details of the path patterns.


getChanges

public java.util.List<Changeset> getChanges()
Get current changes in the repository. Changes are sorted with latest change being the first element.


getChanges

public java.util.List<Changeset> getChanges(boolean retrieve)
Get list of change sets since previous build.

Parameters:
retrieve - if this param is set to true, QuickBuild will try to retrieve the change sets from SCM if necessary; otherwise, simply return the change sets stored in the repository object.
Returns:

setChanges

public void setChanges(java.util.List<Changeset> changes)

isChangesRecorded

public boolean isChangesRecorded()

setChangesRecorded

public void setChangesRecorded(boolean changesRecorded)

getRevision

public T getRevision(Build build)
Get revision of this repository used to construct specified build.

Parameters:
build -
Returns:
null if the repository is not found in the build, or revision of found repository is null

getBaseRevision

public T getBaseRevision()

getChangesSince

public java.util.List<Changeset> getChangesSince(Build build)
Get changes since specified build. Changes are sorted with the first entry being the most recent change.


checkoutByRevision

protected abstract void checkoutByRevision(T revision)
Checkout from the repository using specified revision

Parameters:
revision - repository revision to checkout. Should not be null.

getHeadRevision

protected abstract T getHeadRevision()
Get the head revision of the repository. Should never be null.


labelOnRevision

protected abstract void labelOnRevision(T revision,
                                        java.lang.String label,
                                        java.lang.String comment)
Create a new label on the set of source code associated with specified revision

Parameters:
revision - repository revision to create label on. Should not be null.

promoteLabel

public void promoteLabel(java.lang.String label,
                         java.lang.String destination)

getChangesBetween

protected abstract java.util.List<Changeset> getChangesBetween(T startRevision,
                                                               T endRevision)
Get changes between two revisions.

Parameters:
startRevision - start repository revision. Should not be null.
endRevision - end repository revision. Should not be null.

isQuietSince

protected abstract boolean isQuietSince(java.util.Date date)
Whether or not the repository is quiet since specified date.

Parameters:
date -
Returns:

getProofBuildSupport

public abstract ProofBuildSupport<? extends LocalChange> getProofBuildSupport()
Get proof build support object. Null if this repository does not support proof build or do not want to enable proof build.


getSourceViewSupport

public abstract SourceViewSupport<T> getSourceViewSupport()
Get source view support of this repository. Null if this repository does not support to view source files.


getEmail

public java.lang.String getEmail(java.lang.String committer)
Get email of the committer from repository.

Parameters:
committer -
Returns:
null if not found

getCommitters

public java.util.List<java.lang.String> getCommitters(java.lang.String repositoryPath,
                                                      boolean exactMatch)
Get list of committers of this repository, with latest committer comes at top of the list.


getCommitters

public java.util.List<java.lang.String> getCommitters()
Get list of committers of this repository, with latest committer comes at the top of the list.


getCommittersSincePrevSuccess

public java.util.List<java.lang.String> getCommittersSincePrevSuccess()
Get list of committers of this repository since previous successful build, with latest committer comes at the top of the list.


getUserName

public java.lang.String getUserName(java.lang.String committer)
Map committer to QuickBuild user name. Null will be returned if the committer can not be mapped to a QuickBuild user.


fromDOM

public static Repository<?> fromDOM(Configuration configuration,
                                    VersionedDocument dom)

getRuntime

public RepositoryRuntime getRuntime()
Get the object holding runtime information of this repository, such as revision, checkout mark, etc.

Returns:

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getBuild

public Build getBuild()
Get build object associated with the repository. Null if no build object is associated with this repository.


setBuild

public void setBuild(Build build)

writeReplace

public java.lang.Object writeReplace()
                              throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException


Copyright © 2005-2010 PMEase Inc. All Rights Reserved.