public class DefaultSandboxSupport extends SandboxSupport
oracle.adf.share.sandbox.SandboxSupport.| Constructor and Description |
|---|
DefaultSandboxSupport()
Constructs an instance of
DefaultSandboxSupport. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addAdministrator(Sandbox sandbox,
java.lang.String userName)
Adds a user to the list of administrators of a sandbox.
|
void |
addRepository(Sandbox sandbox,
SandboxedRepository repos)
Adds a repository in its latest certified state to a sandbox.
|
boolean |
canSynchronizedPublish(Sandbox sandbox)
Returns
true if all locks needed for
synchronizedPublish are available at the time of the
invocation. |
void |
destroy(Sandbox sandbox)
Destroys a sandbox and deletes all information pertaining to the sandbox.
|
void |
destroy(Sandbox sandbox,
boolean retainInfo)
Destroys a sandbox and optionally retains the sandbox information such as
operation logs.
|
boolean |
enableFeature(Sandbox sandbox,
java.lang.String featureClassName)
Enables a feature in the sandbox.
|
java.util.Map<java.lang.String,java.lang.Throwable> |
enableFeatures(Sandbox sandbox,
java.util.List<java.lang.String> featureIdList)
Enables a list of features.
|
java.util.List<SandboxedFeature> |
getEnabledFeatures(Sandbox sandbox)
Returns the list of features enabled in a sandbox.
|
java.util.List<SandboxedRepository> |
getRepositories(Sandbox sandbox)
Returns the list of repositories that have been branched for a sandbox.
|
RepositoryErrorLog |
getRepositoryErrorLog(Sandbox sandbox,
java.lang.String reposId)
Returns the error log from the last repository operation if any.
|
ChangeSet |
getRepositoryLastChanges(Sandbox sandbox,
java.lang.String reposId)
Returns the changes obtained last time from a repository branch.
|
Sandbox |
getSandbox(java.lang.String id)
Returns the information of an existing sandbox.
|
SandboxArchive |
getSandboxArchive(Sandbox sandbox)
Returns the
SandboxArchive object if the given sandbox is
from an archive. |
SandboxLog |
getSandboxOperationLog(Sandbox sandbox)
Returns the log from the last sandbox operation.
|
java.lang.Long |
getSandboxOperationLogId(java.lang.String sandboxId,
SandboxState.Condition condition)
Returns the ID of an open log for a sandbox.
|
int |
getSandboxOperationProgress(Sandbox sandbox)
Returns an integer from 0 (inclusive) to 100 (inclusive) to indicate the
progress of the current sandbox operation.
|
int |
getSandboxOperationProgress(Sandbox sandbox,
java.lang.String featureId)
Returns an integer from 0 (inclusive) to 100 (inclusive) to indicate the
progress of the current sandbox operation by feature.
|
boolean |
isLockedBySandboxArchive()
Returns
true if the mainline of any repository is locked by
a sandbox archive at the time of invcation. |
java.util.List<java.lang.String> |
listAdministrators(Sandbox sandbox)
Returns the list of administrators of a sandbox.
|
java.util.List<java.lang.String> |
listOpenSandboxes(boolean includeArchives)
Returns the IDs of the sandboxes that are open at the time of invocation.
|
java.util.List<java.lang.String> |
listSandboxes(java.lang.String name,
boolean exactMatch)
Returns the IDs of the sandboxes whose names contain or match the
specified name.
|
protected void |
logEvent(Sandbox sandbox,
RepositoryEvent e)
Logs a repository event.
|
Sandbox |
newSandbox(SandboxArchive archive)
Creates a new sandbox from an archive as its initial contents.
|
Sandbox |
newSandbox(java.lang.String name)
Creates a new sandbox.
|
protected Sandbox |
newSandboxInstance(java.lang.String sandboxId)
Constructs a new
Sandbox instance. |
void |
notifyRefreshRequired(java.lang.String reposId)
Notifies sandboxes that contain a branch of a specific repository that
they must be refreshed before any further sandboxed changes are made.
|
java.util.Map<SandboxedRepository,ChangeSet> |
publish(Sandbox sandbox)
Merges changes in a sandbox back into the repositories.
|
java.util.Map<SandboxedRepository,ChangeSet> |
refresh(Sandbox sandbox)
Merges changes made in participating repositories into a sandbox.
|
boolean |
removeAdministrator(Sandbox sandbox,
java.lang.String userName)
Removes a user from the list of administrators of a sandbox.
|
boolean |
removeProcessLock(Sandbox sandbox,
int minElapsedHours)
Forcefully removes the synchronization lock placed by a Java process
performing a sandbox operation.
|
void |
setDescription(Sandbox sandbox,
java.lang.String desc)
Updates the description of a sandbox.
|
void |
setName(Sandbox sandbox,
java.lang.String name)
Updates the name of a sandbox.
|
void |
setPrivate(Sandbox sandbox,
boolean p)
Marks a sandbox private or not.
|
void |
setPublishable(Sandbox sandbox,
boolean p)
Marks a sandbox publishable or not.
|
void |
setSandboxConstraints(Sandbox sandbox,
SandboxConstraints constraints)
Sets constraints for a sandbox.
|
void |
setSandboxOperationChangeHint(Sandbox sandbox,
ChangeHint changeHint)
Gives a change hint to all repositories involved in the current operation.
|
java.util.Map<SandboxedRepository,ChangeSet> |
synchronizedPublish(Sandbox sandbox,
boolean refreshBefore)
Publishes a sandbox only when all mainline exclusive locks of the branched
repositories are available; in other words, a
ConcurrentSandboxOperationException is thrown when another
synchronizedPublish call is in progress, or when a mainline
exclusive lock of any branched repository has been acquired by an archive. |
boolean |
tryLock(SandboxArchive archive)
Tries to acquire the lock for processing a sandbox archive.
|
void |
unlock(SandboxArchive archive)
Releases the lock acquired for processing a sandbox archive.
|
void |
unpublish(Sandbox sandbox)
Unpublishes a sandbox if it's eligible.
|
IneligibleForUnpublishException |
unpublishCheck(Sandbox sandbox)
Checks if a sandbox is eligible for unpublish at this moment.
|
getInstance, getRepositoryErrorLogs, isCompatible, listOpenSandboxes, listSandboxpublic DefaultSandboxSupport()
DefaultSandboxSupport.public Sandbox newSandbox(java.lang.String name) throws SandboxException
SandboxSupportnewSandbox in class SandboxSupportname - the name of the sandboxSandboxException - if an error occurs while creating a sandboxprotected Sandbox newSandboxInstance(java.lang.String sandboxId)
Sandbox instance.sandboxId - the ID of the sandboxpublic SandboxArchive getSandboxArchive(Sandbox sandbox)
SandboxSupportSandboxArchive object if the given sandbox is
from an archive.getSandboxArchive in class SandboxSupportsandbox - the sandbox the SandboxArchive object is
associated withSandboxArchive object if the given sandbox is
from an archive; null otherwisepublic Sandbox newSandbox(SandboxArchive archive) throws SandboxException
SandboxSupportnewSandbox in class SandboxSupportarchive - the archive that contains the initial contentsSandboxException - if an error occurs while creating a sandboxpublic void setName(Sandbox sandbox, java.lang.String name)
SandboxSupportsetName in class SandboxSupportsandbox - the sandbox to updatename - the new namepublic void setDescription(Sandbox sandbox, java.lang.String desc)
SandboxSupportsetDescription in class SandboxSupportsandbox - the sandboxdesc - the descriptionpublic void setPrivate(Sandbox sandbox, boolean p)
SandboxSupportsetPrivate in class SandboxSupportsandbox - the sandbox to be set private or sharedp - true if the given sandbox is to be set to privatepublic void setPublishable(Sandbox sandbox, boolean p)
SandboxSupportsetPublishable in class SandboxSupportsandbox - the sandbox to be set publishable or notp - true if the given sandbox is to be set to
publishablepublic java.util.List<java.lang.String> listSandboxes(java.lang.String name,
boolean exactMatch)
SandboxSupportlistSandboxes in class SandboxSupportname - the name of the sandboxexactMatch - true if the names of the returned sandboxes
must match the specified name exactlypublic Sandbox getSandbox(java.lang.String id)
SandboxSupportgetSandbox in class SandboxSupportid - the ID of the sandboxnull if there is no such
sandboxpublic void addRepository(Sandbox sandbox, SandboxedRepository repos) throws SandboxException
SandboxSupportaddRepository in class SandboxSupportsandbox - the sandboxrepos - the participating repositorySandboxException - if an error occurs while adding the repositorypublic java.util.List<SandboxedRepository> getRepositories(Sandbox sandbox)
SandboxSupportgetRepositories in class SandboxSupportsandbox - the sandboxpublic java.util.List<SandboxedFeature> getEnabledFeatures(Sandbox sandbox)
SandboxSupportgetEnabledFeatures in class SandboxSupportsandbox - the sandboxprotected void logEvent(Sandbox sandbox, RepositoryEvent e)
SandboxSupportlogEvent in class SandboxSupportsandbox - the sandboxe - the repository eventpublic int getSandboxOperationProgress(Sandbox sandbox)
SandboxSupportgetSandboxOperationProgress in class SandboxSupportsandbox - the sandbox on which the operation is in progresspublic int getSandboxOperationProgress(Sandbox sandbox, java.lang.String featureId)
SandboxSupportgetSandboxOperationProgress in class SandboxSupportsandbox - the sandbox on which the operation is in progressfeatureId - the ID of the enabled featurepublic java.lang.Long getSandboxOperationLogId(java.lang.String sandboxId,
SandboxState.Condition condition)
SandboxSupportgetSandboxOperationLogId in class SandboxSupportsandboxId - the ID of the sandbox for which the log is createdcondition - the condition when the log is availablenull if no log is available for the given
sandbox in the given conditionpublic SandboxLog getSandboxOperationLog(Sandbox sandbox)
SandboxSupportgetSandboxOperationLog in class SandboxSupportsandbox - the sandbox where the operation was performednull if
not availablepublic ChangeSet getRepositoryLastChanges(Sandbox sandbox, java.lang.String reposId)
SandboxSupportgetRepositoryLastChanges in class SandboxSupportsandbox - the sandbox that contains the repository branchnull if such information is unavailablepublic RepositoryErrorLog getRepositoryErrorLog(Sandbox sandbox, java.lang.String reposId)
SandboxSupportgetRepositoryErrorLog in class SandboxSupportsandbox - the sandbox where the repository is branchedreposId - the ID of the repositorynull if there is no error, or the error log is not
availablepublic boolean removeProcessLock(Sandbox sandbox, int minElapsedHours)
SandboxSupportNormally a lock is placed on a sandbox before a process starts handling an operation and is removed after the process ends, so that a sandbox is handled by one process at a time. For example, when a process is refreshing a sandbox, a lock will prevent other processes from enabling new features in the same sandbox.
Occassionally a lock may not be removed due to unexpected situations such as the Java process that performs the operation is terminated prematurely. In such cases the lock must be removed explicitly. To avoid removing a lock while an operation is actually in progress, a minimum elapsed time may be specified, so that a lock is removed only if the duration between its placement and now is greater than the specified elapsed time.
removeProcessLock in class SandboxSupportsandbox - the sandbox where the lock is placedminElapsedHours - the minimum elapsed time in hourstrue if the lock has been removed; false
a lock is in place but cannot be removed because the elapsed
time is shorter than or the same as the specified minimumpublic java.util.Map<SandboxedRepository,ChangeSet> refresh(Sandbox sandbox) throws SuspendedSandboxOperationException, RepositoryExceptions
SandboxSupportSandboxState.INACTIVE.refresh in class SandboxSupportsandbox - the sandboxRepositoryExceptions - if merge conflicts are detected or any error
occurs during the processSuspendedSandboxOperationExceptionpublic java.util.List<java.lang.String> listOpenSandboxes(boolean includeArchives)
SandboxSupportdestroy to be performed on it. In other words, a sandbox that
is not open can only be destroyed.listOpenSandboxes in class SandboxSupportincludeArchives - true if the returned list should include
the sandboxes that are created from archivespublic void notifyRefreshRequired(java.lang.String reposId)
SandboxSupportnotifyRefreshRequired in class SandboxSupportreposId - the ID of the repositorySandbox.isRefreshRequired(),
SandboxSupport.refresh(oracle.adf.share.sandbox.Sandbox)public boolean canSynchronizedPublish(Sandbox sandbox)
SandboxSupporttrue if all locks needed for
synchronizedPublish are available at the time of the
invocation. This information serves as a hint only. A
ConcurrentSandboxOperationException may still be thrown
when synchronizedPublish is invoked because the locks
may be acquired by another sandbox between the invocation of this method
and that of synchronizedPublish. If a client must block
on synchronizedPublish, skip this check and call
synchronizedPublish periodically until
ConcurrentSandboxOperationException is not thrown.canSynchronizedPublish in class SandboxSupportsandbox - the sandbox to be publishedtrue if all locks needed for
synchronizedPublish are available at the time of the
invocationpublic java.util.Map<SandboxedRepository,ChangeSet> synchronizedPublish(Sandbox sandbox, boolean refreshBefore) throws RepositoryExceptions, ConcurrentSandboxOperationException
SandboxSupportConcurrentSandboxOperationException is thrown when another
synchronizedPublish call is in progress, or when a mainline
exclusive lock of any branched repository has been acquired by an archive.synchronizedPublish in class SandboxSupportsandbox - the sandbox to be publishedrefreshBefore - true if refresh should be
called first after acquiring the necessary locks.
If a repository is pending resume after the first
pass, the process will be resumed once with change
hint ChangeHint.STOP_AT_CONFLICTS.
If any repository is still pending resume after the
second pass, a SsuspendedSandboxOperation
is thrown.RepositoryExceptions - if any error occurs during the publishConcurrentSandboxOperationException - if refreshBefore
is true and any repository is still pending
resume after the first resumepublic java.util.Map<SandboxedRepository,ChangeSet> publish(Sandbox sandbox) throws RepositoryExceptions
SandboxSupportSandboxState.INACTIVE.publish in class SandboxSupportsandbox - the sandboxRepositoryExceptions - if merge conflicts are detected or any error
occurs during the processpublic IneligibleForUnpublishException unpublishCheck(Sandbox sandbox)
SandboxSupportunpublish is called.unpublishCheck in class SandboxSupportsandbox - the sandbox to be checkednull if the given sandbox is eligible for unpublish;
otherwise an object is returned to indicate the reasonSandboxSupport.unpublish(oracle.adf.share.sandbox.Sandbox)public void unpublish(Sandbox sandbox) throws IneligibleForUnpublishException
SandboxSupportunpublish in class SandboxSupportsandbox - the sandbox to be unpublishedIneligibleForUnpublishException - if the given sandbox is ineligible
for unpublishSandboxSupport.unpublishCheck(oracle.adf.share.sandbox.Sandbox)public void destroy(Sandbox sandbox) throws RepositoryExceptions
SandboxSupportdestroy in class SandboxSupportsandbox - the sandbox to be destroyedRepositoryExceptions - if there is any error coming from the repositoriespublic void destroy(Sandbox sandbox, boolean retainInfo) throws RepositoryExceptions
SandboxSupportSandboxState.IRRECOVERABLE.destroy in class SandboxSupportsandbox - the sandbox to be destroyedretainInfo - true if the sandbox information should be
retainedRepositoryExceptionsSandboxSupport.destroy(Sandbox)public boolean enableFeature(Sandbox sandbox, java.lang.String featureClassName) throws IncompatibleFeatureException, SandboxException
SandboxSupportenableFeature in class SandboxSupportsandbox - the sandboxfeatureClassName - the ID of the sandboxed featurefalse if the feature was already enabled prior to this
callIncompatibleFeatureException - if the feature is incompatible with
the sandboxSandboxException - if an error occurs while enabling the featurepublic java.util.Map<java.lang.String,java.lang.Throwable> enableFeatures(Sandbox sandbox, java.util.List<java.lang.String> featureIdList) throws IncompatibleFeatureException, SandboxException
SandboxSupportenableFeatures in class SandboxSupportsandbox - the sandbox where the features are to be enabledfeatureIdList - the IDs of the features to be enabledIncompatibleFeatureExceptionSandboxExceptionpublic void setSandboxConstraints(Sandbox sandbox, SandboxConstraints constraints)
SandboxSupportsetSandboxConstraints in class SandboxSupportsandbox - the sandbox with which the constraints are to be associatedconstraints - the constraints for the sandboxpublic void setSandboxOperationChangeHint(Sandbox sandbox, ChangeHint changeHint)
SandboxSupportsetSandboxOperationChangeHint in class SandboxSupportsandbox - the sandbox on which the current operation is in progresschangeHint - the change hint; null if the default hint
should be givenSandboxTransactionpublic boolean tryLock(SandboxArchive archive)
SandboxSupportunlock(SandboxArchive). The behavior of
calling this method again with a different SandboxArchive
object before releasing the lock for the first call is undefined.tryLock in class SandboxSupportarchive - the sandbox archive to be processedtrue if the lock is acquired successfully;
false if the involved repositories are currently
locked by other sandboxesSandboxSupport.unlock(oracle.adf.share.sandbox.SandboxArchive)public void unlock(SandboxArchive archive)
SandboxSupportSandboxArchive object.unlock in class SandboxSupportarchive - the sandbox archive that was just processed; or
null if the information of the archive is no
longer availableSandboxSupport.tryLock(oracle.adf.share.sandbox.SandboxArchive)public boolean isLockedBySandboxArchive()
SandboxSupporttrue if the mainline of any repository is locked by
a sandbox archive at the time of invcation. When the processing of a
sandbox archive is in progress,
ConcurrentSandboxOperationException
may be thrown by methods that require the same locks already acquired
by the archive, such as enableFeature or
synchronizedPublish. The client may simply skip all
operations and wait until this method returns false again.isLockedBySandboxArchive in class SandboxSupporttrue if the mainline of any repository is locked by
a sandbox archive at the time of invocationSandboxSupport.tryLock(oracle.adf.share.sandbox.SandboxArchive),
SandboxSupport.unlock(oracle.adf.share.sandbox.SandboxArchive)public boolean addAdministrator(Sandbox sandbox, java.lang.String userName)
SandboxSupportaddAdministrator in class SandboxSupportsandbox - the sandbox administereduserName - the user to be added as an administratortrue if the user is not an administrator prior to
this call; false if the user was not added to the
list because he is already an administrator of the sandboxpublic boolean removeAdministrator(Sandbox sandbox, java.lang.String userName)
SandboxSupportremoveAdministrator in class SandboxSupportsandbox - the sandbox administered by the useruserName - the user to be removed from the list of administratorstrue if the user is an administrator prior to this
call and is successfully removed from the list;
false if the user is not on the list or cannot be
removed because he is the owner of the sandboxpublic java.util.List<java.lang.String> listAdministrators(Sandbox sandbox)
SandboxSupportlistAdministrators in class SandboxSupportsandbox - the sandbox