Package org.opennms.netmgt.config
Class ViewsDisplayFactory
- java.lang.Object
-
- org.opennms.netmgt.config.ViewsDisplayFactory
-
public class ViewsDisplayFactory extends Object
ViewsDisplayFactory class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Field Summary
Fields Modifier and Type Field Description protected booleaninitializedBoolean indicating if the init() method has been called.protected longm_lastModifiedTimestamp of the viewDisplay file, used to know when to reload from disk.protected Filem_viewsDisplayFileFile path of groups.xml.protected Map<String,View>m_viewsMapMap of view objects by name.
-
Constructor Summary
Constructors Constructor Description ViewsDisplayFactory(String file)Constructor for ViewsDisplayFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ViewgetDefaultView()getDefaultViewintgetDisconnectTimeout()getDisconnectTimeoutstatic ViewsDisplayFactorygetInstance()Singleton static call to get the only instance that should exist for the ViewsDisplayFactoryViewgetView(String viewName)Can be nullFilegetViewsDisplayFile()getViewsDisplayFilestatic voidinit()Be sure to call this method before calling getInstance().voidreload()Parses the viewsdisplay.xmlstatic voidsetInstance(ViewsDisplayFactory instance)setInstancevoidsetViewsDisplayFile(File viewsDisplayFile)setViewsDisplayFileprotected voidupdateFromFile()Reload the viewsdisplay.xml file if it has been changed since we last read it.
-
-
-
Field Detail
-
m_viewsDisplayFile
protected File m_viewsDisplayFile
File path of groups.xml.
-
initialized
protected boolean initialized
Boolean indicating if the init() method has been called.
-
m_lastModified
protected long m_lastModified
Timestamp of the viewDisplay file, used to know when to reload from disk.
-
-
Constructor Detail
-
ViewsDisplayFactory
public ViewsDisplayFactory(String file) throws FileNotFoundException, IOException
Constructor for ViewsDisplayFactory.
- Parameters:
file- aStringobject.- Throws:
FileNotFoundException- if any.IOException- if any.
-
-
Method Detail
-
init
public static void init() throws IOException, FileNotFoundExceptionBe sure to call this method before calling getInstance().- Throws:
IOException- if any.FileNotFoundException- if any.
-
getInstance
public static ViewsDisplayFactory getInstance()
Singleton static call to get the only instance that should exist for the ViewsDisplayFactory- Returns:
- the single views display factory instance
- Throws:
IllegalStateException- if init has not been called
-
reload
public void reload() throws IOException, FileNotFoundExceptionParses the viewsdisplay.xml- Throws:
IOException- if any.FileNotFoundException- if any.
-
setViewsDisplayFile
public void setViewsDisplayFile(File viewsDisplayFile)
setViewsDisplayFile
- Parameters:
viewsDisplayFile- aFileobject.
-
getViewsDisplayFile
public File getViewsDisplayFile() throws IOException
getViewsDisplayFile
- Returns:
- a
Fileobject. - Throws:
IOException- if any.
-
getView
public View getView(String viewName) throws IOException
Can be null- Parameters:
viewName- aStringobject.- Returns:
- a
Viewobject. - Throws:
IOException- if any.
-
updateFromFile
protected void updateFromFile() throws IOExceptionReload the viewsdisplay.xml file if it has been changed since we last read it.- Throws:
IOException- if any.
-
setInstance
public static void setInstance(ViewsDisplayFactory instance)
setInstance
- Parameters:
instance- aViewsDisplayFactoryobject.
-
getDisconnectTimeout
public int getDisconnectTimeout()
getDisconnectTimeout
- Returns:
- a int.
-
-