Package com.inductiveautomation.snap.web
Class WebSite
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.snap.web.WebSite
- All Implemented Interfaces:
RMJSONArchiver.GetKeys
,RMPropertyChanger
,PropertyChangeListener
,Cloneable
,EventListener
public abstract class WebSite
extends RMObject
implements PropertyChangeListener, RMJSONArchiver.GetKeys
This is an abstract class to provide data management (create, get, put, delete) and file management.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDeepChangeListener
(DeepChangeListener aListener) Adds a deep (property) change listener to get notified when this WebSite sees changes (to files).void
bulkImport
(Map<String, List<Map>> theMaps) Bulk import.protected WebClassLoader
Creates the DataClassLoader.protected DataTable
createDataTable
(String aName) Returns the DataTable for given name.protected DataTable
Creates an instance of DataTable.createEntity
(String aName) Creates an entity for given name.protected Entity
createEntityImpl
(String aName) Returns the entity for given name.createFile
(String aPath, boolean isDirectory) Returns a new file at the given path, regardless of whether it exists in the data source.protected WebFile
createFileImpl
(String aPath, boolean isDirectory) Creates a new file.Returns a row for an entity and primary value that is guaranteed to be unique for this data source.Returns a row for an entity and primary value that is guaranteed to be unique for this data source.protected Row
createRowImpl
(Entity anEntity, Object aPrimaryValue) Creates a new row for source.protected WebSite
Creates a WebSite that can be used for storing persistent support files.protected WebURL
Creates a WebSite that can be used for storing persistent support files.protected String
Creates a WebSite that can be used for storing persistent support files.protected Schema
Creates the schema.void
Creates the data site remote site (database, directory file, etc.).protected WebURL
Creates a URL for string.void
deleteEntity
(Entity anEntity) Saves the given entity.protected void
deleteEntityImpl
(Entity anEntity) Saves the given entity.protected void
deleteFile
(WebFile aFile) Delete file.protected void
deleteFileImpl
(WebFile aFile) Deletes a file.void
Deletes a given row.protected abstract void
deleteRowImpl
(Row aRow) Deletes a given row.void
Deletes this data site, assuming it corresponds to something that can be deleted, like a database.void
flush()
Flushes any unsaved changes to backing store.protected void
Flushes any unsaved changes to backing store.Returns the DataClassLoader.getDataTable
(String aName) Returns the DataTable for given nameReturns the list of known data tables.Returns the entity for given name.protected Entity
getEntityImpl
(String aName) Returns the entity for given name.boolean
Returns whether data source exists.Returns the individual file with the given path.protected byte[]
getFileBytesImpl
(WebFile aFile) Returns file bytes.protected WebFile
getFileImpl
(String aPath) Returns a data source file for given path (if file exists).getFilesImpl
(WebFile aFile) Returns a list of files at path.Returns the host name.RMJSONArchiver GetKeys method.long
getModifiedTime
(WebFile aFile) Returns the modified time for a file to underlying file system.getName()
Returns the name for this data source.Returns the password.getPath()
Returns the data source name-space and name in standard path form.Returns a file property for key.getRequest
(WebURL aURL) Returns a request object for a URL.getResponse
(Request aRequest) Returns a response instance for a request.Returns the root directory.Returns a row for a given entity and primary value.Returns a row for given query.protected Row
getRowImpl
(Entity anEntity, Object aPrimaryValue) Returns a row for a given entity and primary value.Returns a set of rows for the given properties and condition.getRowsImpl
(Entity anEntity, Query aQuery) Returns a set of rows for the given properties and condition.Returns a WebSite that can be used for storing persistent support files.Returns the schema of represented WebSite as a hierarchy of RMEntity and RMProperty objects.getServlet
(WebURL aUrl) Returns the Servlet for URL.protected File
getStandardFile
(WebFile aFile) Returns a standard java.io.File, if available.getURL()
Returns the URL.Returns a URL for the given file path.Returns the URL root.Returns the user name.protected Response
handleDelete
(Request aRequest) Handle a DELETE request.protected Response
Handle a get request.protected Response
handleHead
(Request aRequest) Handles a head request.protected Response
Handle a PUT request.boolean
Returns whether this data source is running background processes.void
propertyChange
(PropertyChangeEvent anEvent) Handle property changes on row objects by forwarding to listener.void
refresh()
Clears all cached data in the data source, forcing everything to reload.void
refreshFile
(WebFile aFile) Revert file from saved version.protected void
refreshFileImpl
(WebFile aFile) Reverts a file.void
removeDeepChangeListener
(DeepChangeListener aListener) Removes a deep (property) change listener to get notified when this WebSite sees changes (to files).void
saveEntity
(Entity anEntity) Saves the given entity.protected void
saveEntityImpl
(Entity anEntity) Saves the given entity.protected void
Save file.protected void
saveFileImpl
(WebFile aFile) Saves a file.void
Inserts or updates a given row.protected abstract void
saveRowImpl
(Row aRow) Inserts or updates a given row.void
setClassLoader
(WebClassLoader aClassLoader) Sets the DataClassLoader.protected void
Sets whether a file exists.void
setModifiedTime
(WebFile aFile, long aTime) Saves the modified time for a file to underlying file system.protected void
setModifiedTimeImpl
(WebFile aFile, long aTime) Saves the modified time for a file to underlying file system.void
setPassword
(String aPassword) Sets the password.void
Sets a property for a key.void
setSandbox
(WebSite aSandbox) Sets a WebSite that can be used for storing persistent support files.void
setServlet
(WebURL aUrl, WebSite.Servlet aServlet) Sets a Servlet for URL.protected void
Sets the URL.void
setUserName
(String aName) Sets the user name.toString()
Standard toString implementation.Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
Methods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, clone, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
-
Field Details
-
Refresh_Prop
- See Also:
-
-
Constructor Details
-
WebSite
public WebSite()
-
-
Method Details
-
getURL
Returns the URL. -
setURL
Sets the URL. -
getURLString
Returns the URL root. -
getName
Returns the name for this data source. -
getHostName
Returns the host name. -
getPath
Returns the data source name-space and name in standard path form. -
getUserName
Returns the user name. -
setUserName
Sets the user name. -
getPassword
Returns the password. -
setPassword
Sets the password. -
getExists
public boolean getExists()Returns whether data source exists. -
getRootDirectory
Returns the root directory. -
getRequest
Returns a request object for a URL. -
getResponse
Returns a response instance for a request. -
handleHead
Handles a head request. -
handleGet
Handle a get request. -
handlePut
Handle a PUT request. -
handleDelete
Handle a DELETE request. -
createFile
Returns a new file at the given path, regardless of whether it exists in the data source. -
getFile
Returns the individual file with the given path. -
saveFile
Save file.- Throws:
ResponseException
-
deleteFile
Delete file.- Throws:
ResponseException
-
createFileImpl
Creates a new file. -
getFileImpl
Returns a data source file for given path (if file exists).- Throws:
Exception
-
getFilesImpl
Returns a list of files at path.- Throws:
Exception
-
getFileBytesImpl
Returns file bytes.- Throws:
Exception
-
saveFileImpl
Saves a file.- Throws:
Exception
-
deleteFileImpl
Deletes a file.- Throws:
Exception
-
refreshFile
Revert file from saved version. -
refreshFileImpl
Reverts a file.- Throws:
Exception
-
getModifiedTime
Returns the modified time for a file to underlying file system. -
setModifiedTime
Saves the modified time for a file to underlying file system.- Throws:
Exception
-
setModifiedTimeImpl
Saves the modified time for a file to underlying file system.- Throws:
Exception
-
setExists
Sets whether a file exists. -
getStandardFile
Returns a standard java.io.File, if available. -
getURL
Returns a URL for the given file path. -
createURL
Creates a URL for string. -
createSite
Creates the data site remote site (database, directory file, etc.).- Throws:
Exception
-
deleteSite
Deletes this data site, assuming it corresponds to something that can be deleted, like a database.- Throws:
Exception
-
getSchema
Returns the schema of represented WebSite as a hierarchy of RMEntity and RMProperty objects. -
createSchema
Creates the schema. -
createEntity
Creates an entity for given name. -
createEntityImpl
Returns the entity for given name. -
getEntity
Returns the entity for given name. -
getEntityImpl
Returns the entity for given name.- Throws:
Exception
-
saveEntity
Saves the given entity.- Throws:
Exception
-
saveEntityImpl
Saves the given entity.- Throws:
Exception
-
deleteEntity
Saves the given entity.- Throws:
Exception
-
deleteEntityImpl
Saves the given entity.- Throws:
Exception
-
getDataTables
Returns the list of known data tables. -
getDataTable
Returns the DataTable for given name -
createDataTable
Returns the DataTable for given name. -
createDataTableImpl
Creates an instance of DataTable. -
createRow
Returns a row for an entity and primary value that is guaranteed to be unique for this data source. -
createRow
Returns a row for an entity and primary value that is guaranteed to be unique for this data source. -
createRowImpl
Creates a new row for source. -
getRow
Returns a row for a given entity and primary value. -
getRowImpl
Returns a row for a given entity and primary value. -
getRow
Returns a row for given query. -
getRows
Returns a set of rows for the given properties and condition. -
getRowsImpl
Returns a set of rows for the given properties and condition. -
saveRow
Inserts or updates a given row.- Throws:
Exception
-
saveRowImpl
Inserts or updates a given row.- Throws:
Exception
-
deleteRow
Deletes a given row.- Throws:
Exception
-
deleteRowImpl
Deletes a given row.- Throws:
Exception
-
bulkImport
Bulk import.- Throws:
Exception
-
getProp
Returns a file property for key. -
setProp
Sets a property for a key. -
getSandbox
Returns a WebSite that can be used for storing persistent support files. -
setSandbox
Sets a WebSite that can be used for storing persistent support files. -
createSandbox
Creates a WebSite that can be used for storing persistent support files. -
createSandboxURL
Creates a WebSite that can be used for storing persistent support files. -
createSandboxURLS
Creates a WebSite that can be used for storing persistent support files. -
getServlet
Returns the Servlet for URL. -
setServlet
Sets a Servlet for URL. -
getClassLoader
Returns the DataClassLoader. -
setClassLoader
Sets the DataClassLoader. -
createClassLoader
Creates the DataClassLoader. -
isRunning
public boolean isRunning()Returns whether this data source is running background processes. -
addDeepChangeListener
Adds a deep (property) change listener to get notified when this WebSite sees changes (to files). -
removeDeepChangeListener
Removes a deep (property) change listener to get notified when this WebSite sees changes (to files). -
propertyChange
Handle property changes on row objects by forwarding to listener.- Specified by:
propertyChange
in interfacePropertyChangeListener
-
refresh
public void refresh()Clears all cached data in the data source, forcing everything to reload. -
flush
Flushes any unsaved changes to backing store.- Throws:
Exception
-
flushImpl
Flushes any unsaved changes to backing store.- Throws:
Exception
-
getJSONKeys
RMJSONArchiver GetKeys method.- Specified by:
getJSONKeys
in interfaceRMJSONArchiver.GetKeys
-
toString
Standard toString implementation.
-