Class CachingForeignSourceRepository
- java.lang.Object
-
- org.opennms.netmgt.provision.persist.AbstractForeignSourceRepository
-
- org.opennms.netmgt.provision.persist.CachingForeignSourceRepository
-
- All Implemented Interfaces:
ForeignSourceRepository
,org.springframework.beans.factory.InitializingBean
public class CachingForeignSourceRepository extends AbstractForeignSourceRepository implements org.springframework.beans.factory.InitializingBean
-
-
Constructor Summary
Constructors Constructor Description CachingForeignSourceRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
protected void
cleanCache()
void
clear()
Delete all requisitions and foreign source definitions and return to defaults.void
delete(ForeignSource foreignSource)
deletevoid
delete(Requisition requisition)
deleteprotected void
finalize()
void
flush()
For performance reasons, a get after a save on a ForeignSourceRepository is not guaranteed to return the latest saved data unless you flush first.java.util.Set<java.lang.String>
getActiveForeignSourceNames()
getActiveForeignSourceNamesForeignSource
getDefaultForeignSource()
getDefaultForeignSourceForeignSource
getForeignSource(java.lang.String foreignSourceName)
getForeignSourceint
getForeignSourceCount()
getForeignSourceCountForeignSourceRepository
getForeignSourceRepository()
java.util.Set<ForeignSource>
getForeignSources()
getForeignSourcesOnmsNodeRequisition
getNodeRequisition(java.lang.String foreignSource, java.lang.String foreignId)
getNodeRequisitionprotected java.lang.Runnable
getRefreshRunnable()
Requisition
getRequisition(java.lang.String foreignSourceName)
getRequisitionRequisition
getRequisition(ForeignSource foreignSource)
getRequisitionjava.util.Date
getRequisitionDate(java.lang.String foreignSource)
getRequisitionDatejava.util.Set<Requisition>
getRequisitions()
getRequisitionsjava.net.URL
getRequisitionURL(java.lang.String foreignSource)
getRequisitionURLRequisition
importResourceRequisition(org.springframework.core.io.Resource resource)
importResourceRequisitionvoid
putDefaultForeignSource(ForeignSource foreignSource)
putDefaultForeignSourceprotected void
readLock()
protected void
readUnlock()
void
resetDefaultForeignSource()
resetDefaultForeignSourcevoid
save(ForeignSource foreignSource)
savevoid
save(Requisition requisition)
savevoid
setForeignSourceRepository(ForeignSourceRepository fsr)
protected void
writeLock()
protected void
writeUnlock()
-
Methods inherited from class org.opennms.netmgt.provision.persist.AbstractForeignSourceRepository
validate, validate
-
-
-
-
Method Detail
-
writeUnlock
protected void writeUnlock()
-
writeLock
protected void writeLock()
-
readUnlock
protected void readUnlock()
-
readLock
protected void readLock()
-
cleanCache
protected void cleanCache()
-
getRefreshRunnable
protected java.lang.Runnable getRefreshRunnable()
-
getForeignSourceRepository
public ForeignSourceRepository getForeignSourceRepository()
-
setForeignSourceRepository
public void setForeignSourceRepository(ForeignSourceRepository fsr)
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
getActiveForeignSourceNames
public java.util.Set<java.lang.String> getActiveForeignSourceNames()
Description copied from interface:ForeignSourceRepository
getActiveForeignSourceNames
- Specified by:
getActiveForeignSourceNames
in interfaceForeignSourceRepository
- Returns:
- a
Set
object.
-
getForeignSourceCount
public int getForeignSourceCount() throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
getForeignSourceCount
- Specified by:
getForeignSourceCount
in interfaceForeignSourceRepository
- Returns:
- a int.
- Throws:
ForeignSourceRepositoryException
- if any.
-
getForeignSources
public java.util.Set<ForeignSource> getForeignSources() throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
getForeignSources
- Specified by:
getForeignSources
in interfaceForeignSourceRepository
- Returns:
- a
Set
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
getForeignSource
public ForeignSource getForeignSource(java.lang.String foreignSourceName) throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
getForeignSource
- Specified by:
getForeignSource
in interfaceForeignSourceRepository
- Parameters:
foreignSourceName
- aString
object.- Returns:
- a
ForeignSource
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
save
public void save(ForeignSource foreignSource) throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
save
- Specified by:
save
in interfaceForeignSourceRepository
- Parameters:
foreignSource
- aForeignSource
object.- Throws:
ForeignSourceRepositoryException
- if any.
-
delete
public void delete(ForeignSource foreignSource) throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
delete
- Specified by:
delete
in interfaceForeignSourceRepository
- Parameters:
foreignSource
- aForeignSource
object.- Throws:
ForeignSourceRepositoryException
- if any.
-
getDefaultForeignSource
public ForeignSource getDefaultForeignSource() throws ForeignSourceRepositoryException
Description copied from class:AbstractForeignSourceRepository
getDefaultForeignSource
- Specified by:
getDefaultForeignSource
in interfaceForeignSourceRepository
- Overrides:
getDefaultForeignSource
in classAbstractForeignSourceRepository
- Returns:
- a
ForeignSource
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
putDefaultForeignSource
public void putDefaultForeignSource(ForeignSource foreignSource) throws ForeignSourceRepositoryException
Description copied from class:AbstractForeignSourceRepository
putDefaultForeignSource
- Specified by:
putDefaultForeignSource
in interfaceForeignSourceRepository
- Overrides:
putDefaultForeignSource
in classAbstractForeignSourceRepository
- Parameters:
foreignSource
- aForeignSource
object.- Throws:
ForeignSourceRepositoryException
- if any.
-
resetDefaultForeignSource
public void resetDefaultForeignSource() throws ForeignSourceRepositoryException
Description copied from class:AbstractForeignSourceRepository
resetDefaultForeignSource
- Specified by:
resetDefaultForeignSource
in interfaceForeignSourceRepository
- Overrides:
resetDefaultForeignSource
in classAbstractForeignSourceRepository
- Throws:
ForeignSourceRepositoryException
- if any.
-
importResourceRequisition
public Requisition importResourceRequisition(org.springframework.core.io.Resource resource) throws ForeignSourceRepositoryException
Description copied from class:AbstractForeignSourceRepository
importResourceRequisition
- Specified by:
importResourceRequisition
in interfaceForeignSourceRepository
- Overrides:
importResourceRequisition
in classAbstractForeignSourceRepository
- Parameters:
resource
- aResource
object.- Returns:
- a
Requisition
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
getRequisitions
public java.util.Set<Requisition> getRequisitions() throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
getRequisitions
- Specified by:
getRequisitions
in interfaceForeignSourceRepository
- Returns:
- a
Set
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
getRequisition
public Requisition getRequisition(java.lang.String foreignSourceName) throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
getRequisition
- Specified by:
getRequisition
in interfaceForeignSourceRepository
- Parameters:
foreignSourceName
- aString
object.- Returns:
- a
Requisition
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
getRequisition
public Requisition getRequisition(ForeignSource foreignSource) throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
getRequisition
- Specified by:
getRequisition
in interfaceForeignSourceRepository
- Parameters:
foreignSource
- aForeignSource
object.- Returns:
- a
Requisition
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
getRequisitionDate
public java.util.Date getRequisitionDate(java.lang.String foreignSource)
Description copied from interface:ForeignSourceRepository
getRequisitionDate
- Specified by:
getRequisitionDate
in interfaceForeignSourceRepository
- Parameters:
foreignSource
- the Foreign Source name of the requisition.- Returns:
- The date-stamp of the requisition, as a
Date
-
getRequisitionURL
public java.net.URL getRequisitionURL(java.lang.String foreignSource)
Description copied from interface:ForeignSourceRepository
getRequisitionURL
- Specified by:
getRequisitionURL
in interfaceForeignSourceRepository
- Parameters:
foreignSource
- aString
object.- Returns:
- a
URL
object.
-
save
public void save(Requisition requisition) throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
save
- Specified by:
save
in interfaceForeignSourceRepository
- Parameters:
requisition
- aRequisition
object.- Throws:
ForeignSourceRepositoryException
- if any.
-
delete
public void delete(Requisition requisition) throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
delete
- Specified by:
delete
in interfaceForeignSourceRepository
- Parameters:
requisition
- aRequisition
object.- Throws:
ForeignSourceRepositoryException
- if any.
-
getNodeRequisition
public OnmsNodeRequisition getNodeRequisition(java.lang.String foreignSource, java.lang.String foreignId) throws ForeignSourceRepositoryException
Description copied from class:AbstractForeignSourceRepository
getNodeRequisition
- Specified by:
getNodeRequisition
in interfaceForeignSourceRepository
- Overrides:
getNodeRequisition
in classAbstractForeignSourceRepository
- Parameters:
foreignSource
- aString
object.foreignId
- aString
object.- Returns:
- a
OnmsNodeRequisition
object. - Throws:
ForeignSourceRepositoryException
- if any.
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
flush
public void flush() throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
For performance reasons, a get after a save on a ForeignSourceRepository is not guaranteed to return the latest saved data unless you flush first.- Specified by:
flush
in interfaceForeignSourceRepository
- Throws:
ForeignSourceRepositoryException
-
clear
public void clear() throws ForeignSourceRepositoryException
Description copied from interface:ForeignSourceRepository
Delete all requisitions and foreign source definitions and return to defaults.- Specified by:
clear
in interfaceForeignSourceRepository
- Overrides:
clear
in classAbstractForeignSourceRepository
- Throws:
ForeignSourceRepositoryException
-
-