Class FileSite
- java.lang.Object
-
- com.inductiveautomation.rm.base.RMListenerList
-
- com.inductiveautomation.rm.base.RMObject
-
- com.inductiveautomation.snap.web.WebSite
-
- com.inductiveautomation.snap.websites.FileSite
-
- All Implemented Interfaces:
RMJSONArchiver.GetKeys
,RMPropertyChanger
,java.beans.PropertyChangeListener
,java.lang.Cloneable
,java.util.EventListener
- Direct Known Subclasses:
EclipseSite
,LocalSite
,SandboxSite
public class FileSite extends WebSite
A data source to read/write data and files to a file system.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inductiveautomation.snap.web.WebSite
WebSite.Servlet
-
-
Field Summary
-
Fields inherited from class com.inductiveautomation.snap.web.WebSite
Refresh_Prop
-
-
Constructor Summary
Constructors Constructor Description FileSite()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
deleteEntityImpl(Entity anEntity)
Delete entity file and entity table data file.protected void
deleteFileImpl(WebFile aFile)
Deletes file.protected void
deleteRowImpl(Row aRow)
Deletes a given row.void
deleteSite()
Deletes this data source, assuming it corresponds to something that can be deleted, like a database.protected void
flushImpl()
Override to Saves changes if any made.protected Entity
getEntityImpl(java.lang.String aName)
Get entity by loading from entity file.protected java.util.List<Row>
getEntityRows(Entity anEntity)
Returns the list of rows for a given entity.protected byte[]
getFileBytesImpl(WebFile aFile)
Gets file bytes.protected WebFile
getFileImpl(java.lang.String aPath)
Returns a file atprotected java.util.List<WebFile>
getFilesImpl(WebFile aFile)
Returns files at path.long
getModifiedTime(WebFile aFile)
Override to get modified time from Java file.protected java.util.List<Row>
getRowsImpl(Entity anEntity, Query aQuery)
Returns a set of rows for the given properties and condition.protected java.io.File
getStandardFile(WebFile aFile)
Returns the Java file for a WebFile.protected java.io.File
getStandardFile(java.lang.String aPath)
Returns the Java file for RMFile.protected WebFile
getTableDataFile(java.lang.String aName, boolean doCreate)
Returns the file for the given entity.protected WebFile
getTableEntityFile(java.lang.String aName, boolean doCreate)
Returns the file for the given entity.protected void
saveEntityFile(Entity anEntity)
Save entity files for changed entities.protected void
saveEntityFiles()
Save entity files for changed entities.protected void
saveEntityImpl(Entity anEntity)
Save entity by saving entity bytes to entity file.protected void
saveFileImpl(WebFile aFile)
Writes file bytes.protected void
saveRowImpl(Row aRow)
Inserts or updates a given row.protected void
setModifiedTimeImpl(WebFile aFile, long aTime)
Saves the modified time for a file to underlying file system.-
Methods inherited from class com.inductiveautomation.snap.web.WebSite
addDeepChangeListener, bulkImport, createClassLoader, createDataTable, createDataTableImpl, createEntity, createEntityImpl, createFile, createFileImpl, createRow, createRow, createRowImpl, createSandbox, createSandboxURL, createSandboxURLS, createSchema, createSite, createURL, deleteEntity, deleteFile, deleteRow, flush, getClassLoader, getDataTable, getDataTables, getEntity, getExists, getFile, getHostName, getJSONKeys, getName, getPassword, getPath, getProp, getRequest, getResponse, getRootDirectory, getRow, getRow, getRowImpl, getRows, getSandbox, getSchema, getServlet, getURL, getURL, getURLString, getUserName, handleDelete, handleGet, handleHead, handlePut, isRunning, propertyChange, refresh, refreshFile, refreshFileImpl, removeDeepChangeListener, saveEntity, saveFile, saveRow, setClassLoader, setExists, setModifiedTime, setPassword, setProp, setSandbox, setServlet, setURL, setUserName, toString
-
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
-
-
-
-
Method Detail
-
getFileImpl
protected WebFile getFileImpl(java.lang.String aPath)
Returns a file at- Overrides:
getFileImpl
in classWebSite
-
getFilesImpl
protected java.util.List<WebFile> getFilesImpl(WebFile aFile) throws java.lang.Exception
Returns files at path.- Overrides:
getFilesImpl
in classWebSite
- Throws:
java.lang.Exception
-
getFileBytesImpl
protected byte[] getFileBytesImpl(WebFile aFile) throws java.lang.Exception
Gets file bytes.- Overrides:
getFileBytesImpl
in classWebSite
- Throws:
java.lang.Exception
-
saveFileImpl
protected void saveFileImpl(WebFile aFile) throws java.lang.Exception
Writes file bytes.- Overrides:
saveFileImpl
in classWebSite
- Throws:
java.lang.Exception
-
deleteFileImpl
protected void deleteFileImpl(WebFile aFile) throws java.lang.Exception
Deletes file.- Overrides:
deleteFileImpl
in classWebSite
- Throws:
java.lang.Exception
-
getModifiedTime
public long getModifiedTime(WebFile aFile)
Override to get modified time from Java file.- Overrides:
getModifiedTime
in classWebSite
-
setModifiedTimeImpl
protected void setModifiedTimeImpl(WebFile aFile, long aTime) throws java.lang.Exception
Saves the modified time for a file to underlying file system.- Overrides:
setModifiedTimeImpl
in classWebSite
- Throws:
java.lang.Exception
-
getEntityImpl
protected Entity getEntityImpl(java.lang.String aName) throws java.lang.Exception
Get entity by loading from entity file.- Overrides:
getEntityImpl
in classWebSite
- Throws:
java.lang.Exception
-
saveEntityImpl
protected void saveEntityImpl(Entity anEntity) throws java.lang.Exception
Save entity by saving entity bytes to entity file.- Overrides:
saveEntityImpl
in classWebSite
- Throws:
java.lang.Exception
-
deleteEntityImpl
protected void deleteEntityImpl(Entity anEntity) throws java.lang.Exception
Delete entity file and entity table data file.- Overrides:
deleteEntityImpl
in classWebSite
- Throws:
java.lang.Exception
-
getRowsImpl
protected java.util.List<Row> getRowsImpl(Entity anEntity, Query aQuery)
Returns a set of rows for the given properties and condition.- Specified by:
getRowsImpl
in classWebSite
-
saveRowImpl
protected void saveRowImpl(Row aRow)
Inserts or updates a given row.- Specified by:
saveRowImpl
in classWebSite
-
deleteRowImpl
protected void deleteRowImpl(Row aRow)
Deletes a given row.- Specified by:
deleteRowImpl
in classWebSite
-
saveEntityFiles
protected void saveEntityFiles() throws java.lang.Exception
Save entity files for changed entities.- Throws:
java.lang.Exception
-
saveEntityFile
protected void saveEntityFile(Entity anEntity) throws java.lang.Exception
Save entity files for changed entities.- Throws:
java.lang.Exception
-
flushImpl
protected void flushImpl() throws java.lang.Exception
Override to Saves changes if any made.
-
getTableEntityFile
protected WebFile getTableEntityFile(java.lang.String aName, boolean doCreate)
Returns the file for the given entity.
-
getTableDataFile
protected WebFile getTableDataFile(java.lang.String aName, boolean doCreate)
Returns the file for the given entity.
-
getEntityRows
protected java.util.List<Row> getEntityRows(Entity anEntity)
Returns the list of rows for a given entity.
-
deleteSite
public void deleteSite() throws java.lang.Exception
Deletes this data source, assuming it corresponds to something that can be deleted, like a database.- Overrides:
deleteSite
in classWebSite
- Throws:
java.lang.Exception
-
getStandardFile
protected java.io.File getStandardFile(WebFile aFile)
Returns the Java file for a WebFile.- Overrides:
getStandardFile
in classWebSite
-
getStandardFile
protected java.io.File getStandardFile(java.lang.String aPath)
Returns the Java file for RMFile.
-
-