public class XMLPersistenceProvider extends java.lang.Object implements IPersistenceProvider, java.lang.Runnable, IReader, IWriter
Constructor and Description |
---|
XMLPersistenceProvider()
Empty default constructor.
|
XMLPersistenceProvider(org.eclipse.core.resources.IProject projectSpace)
An alternative constructor that allows the project space to be set for
testing.
|
Modifier and Type | Method and Description |
---|---|
void |
addBuilder(ItemBuilder builder)
This operation registers an ItemBuilder with the persistence provider.
|
boolean |
deleteItem(Item item)
This operation deletes the Item.
|
java.util.ArrayList<Entry> |
findAll(org.eclipse.core.resources.IFile file,
java.lang.String regex)
This method can be used by realizations of this interface to provide the
functionality needed to find all occurrences of a String regular
expression in a file with the given URI and return a list of Entries
representing those occurrences.
|
java.lang.String |
getReaderType()
This method is used by the IOService to store unique references of
IReaders.
|
java.lang.String |
getWriterType()
This method is used by the IOService to store unique references of
IWriters.
|
Item |
loadItem(int itemID)
This operation loads the Item.
|
java.util.ArrayList<Item> |
loadItems()
This operation loads all of the Items that this provider can find.
|
boolean |
persistItem(Item item)
This operation persists the Item.
|
Form |
read(org.eclipse.core.resources.IFile file)
Return a Form representation of the input file with given URI.
|
void |
registerClassProvider(IJAXBClassProvider provider)
This operation registers an IJAXBClassProvider with the persistence
provider.
|
void |
replace(org.eclipse.core.resources.IFile file,
java.lang.String regex,
java.lang.String value)
This method provides clients with a basic search and replace
functionality.
|
void |
run()
The event loop.
|
void |
start()
This operation is called to start the XMLPersistenceProvider by the OSGi
Declarative Services engine.
|
void |
stop()
This operation is called to stop the XMLPersistenceProvider by the OSGi
Declarative Services engine.
|
boolean |
updateItem(Item item)
This operation updates the Item.
|
void |
write(Form formToWrite,
org.eclipse.core.resources.IFile file)
This method lets clients write a Form to a specific file format.
|
public XMLPersistenceProvider()
public XMLPersistenceProvider(org.eclipse.core.resources.IProject projectSpace)
projectSpace
- The project space that should be used instead of the default.public void registerClassProvider(IJAXBClassProvider provider)
provider
- The IJAXBClassProvider to be used in creation of the
JAXBContext.public void start() throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
- An exception indicating that the JAXB Context could not be
created.public void stop()
public void addBuilder(ItemBuilder builder)
builder
- public void run()
run
in interface java.lang.Runnable
public boolean persistItem(Item item)
persistItem
in interface IPersistenceProvider
item
- The Item to persist.public Item loadItem(int itemID)
loadItem
in interface IPersistenceProvider
itemID
- id of the Item to load.public boolean deleteItem(Item item)
deleteItem
in interface IPersistenceProvider
item
- Item that should be deleted.public boolean updateItem(Item item)
updateItem
in interface IPersistenceProvider
item
- Item to update.public java.util.ArrayList<Item> loadItems()
loadItems
in interface IPersistenceProvider
public void write(Form formToWrite, org.eclipse.core.resources.IFile file)
IWriter
public void replace(org.eclipse.core.resources.IFile file, java.lang.String regex, java.lang.String value)
IWriter
public java.lang.String getWriterType()
IWriter
getWriterType
in interface IWriter
public Form read(org.eclipse.core.resources.IFile file)
IReader
public java.util.ArrayList<Entry> findAll(org.eclipse.core.resources.IFile file, java.lang.String regex)
IReader
public java.lang.String getReaderType()
IReader
getReaderType
in interface IReader