public class RepositoryManager extends Object
The client code specifies (in the constructor) the file path or the File which is to hold the persisted registration repository. Note that any public method that modifies any part of the DOM for the repository also flushes the repository to the file before returning.
If the specified file exists, the manager loads its contents as the initial value of the document. If the file does not exist, the manager creates a new in-memory document containing the top-level registry element and the default registrationstatus element but does NOT write out this initial data. Writes to the file occur only in response to the client code invoking one of the methods that modifies the DOM.
| Constructor and Description |
|---|
RepositoryManager(File registrationFile)
Creates a new manager which persists the registration data in the specified File.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ServiceTag serviceTag)
Adds an element for the specified ServiceTag object (and writes the revised
DOM to the file).
|
String |
getInstanceURN(String productURN) |
RegistrationService.RegistrationReminder |
getRegistrationReminder()
Returns the current registration status value.
|
RegistrationService.RegistrationStatus |
getRegistrationStatus()
Returns the current registration status value.
|
RegistrationDescriptor.RegistrationStatus |
getRegistrationStatus(ServiceTag serviceTag) |
List<ServiceTag> |
getServiceTags()
Returns a list of all service tag objects represented in the repository.
|
ServiceTag.Status |
getStatus(ServiceTag serviceTag) |
void |
remove(ServiceTag serviceTag)
Removes the XML element corresponding to the specified service tag (and
persists the change to the file).
|
boolean |
setInstanceURN(String productURN,
String instanceURN) |
void |
setRegistrationReminder(RegistrationService.RegistrationReminder reminder)
Sets the registration status value and persists the change to the on-disk
repository.
|
void |
setRegistrationStatus(RegistrationService.RegistrationStatus status)
Sets the registration status value for all service tags and persists the change
to the on-disk repository.
|
void |
setRegistrationStatus(ServiceTag serviceTag,
RegistrationDescriptor.RegistrationStatus status)
Sets the status for the specified service tag in the repository (and
persists the change to the file).
|
void |
setStatus(ServiceTag serviceTag,
ServiceTag.Status status) |
void |
updateRuntimeValues()
Goes through all service tags in the repository, and updates runtime
values if necessary.
|
public RepositoryManager(File registrationFile) throws RegistrationException
RegistrationException - for any errors creating the XML parser or
transformer used for reading and writing the registration data or during
the initial load of the repository from the local filepublic List<ServiceTag> getServiceTags()
public RegistrationService.RegistrationStatus getRegistrationStatus()
public void setRegistrationStatus(RegistrationService.RegistrationStatus status) throws RegistrationException
status - the new RegistrationStatus valueRegistrationException - for errors writing the registration data
to the local repositorypublic RegistrationService.RegistrationReminder getRegistrationReminder()
public void setRegistrationReminder(RegistrationService.RegistrationReminder reminder) throws RegistrationException
reminder - the new RegistrationReminder valueRegistrationException - for errors writing the registration data
to the local repositorypublic void add(ServiceTag serviceTag) throws RegistrationException
serviceTag - the ServiceTag for which to add an XML elementRegistrationException - for errors writing the registration data
to the local repositorypublic void remove(ServiceTag serviceTag) throws RegistrationException
serviceTag - the ServiceTag for which the XML element should be removedRegistrationException - for errors writing the registration data
to the local repositorypublic void setRegistrationStatus(ServiceTag serviceTag, RegistrationDescriptor.RegistrationStatus status) throws RegistrationException
serviceTag - the service tag of interestthe - status to be assignedRegistrationException - for errors writing the registration data
to the local repositorypublic RegistrationDescriptor.RegistrationStatus getRegistrationStatus(ServiceTag serviceTag) throws RegistrationException
RegistrationExceptionpublic void setStatus(ServiceTag serviceTag, ServiceTag.Status status) throws RegistrationException
RegistrationExceptionpublic ServiceTag.Status getStatus(ServiceTag serviceTag) throws RegistrationException
RegistrationExceptionpublic String getInstanceURN(String productURN) throws RegistrationException
RegistrationExceptionpublic boolean setInstanceURN(String productURN, String instanceURN) throws RegistrationException
RegistrationExceptionpublic void updateRuntimeValues()
throws RegistrationException
RegistrationException - in case of errors writing the outputCopyright © 2017. All rights reserved.