Package com.iizix.wsfile
Interface IWSFile
public interface IWSFile
Interface used to hold a file for a file provider. The file has a unique name for access to the web server and can be published or unpublished.- Author:
- Christopher Mindus
- See Also:
URNResourceType
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
delete()
Unpublishes and deletes the file, including a potential database backup of the file.java.lang.String
getDescription()
Gets the file description.java.io.File
getFile()
Gets the file, regardless of existence or published state.java.lang.String
getFileName()
Gets the file name.java.lang.String
getFullTargetURL()
Gets the URL, i.e.java.lang.Object
getID()
Gets the ID used for databases.java.io.File
getPublishedFile()
Returns the publish file for access from the web server.java.lang.String
getURLName()
Gets the unique name used for the external URL path assigned to the file.boolean
isPublished()
Returns whether the file is published or not.boolean
publish()
Starts publishing the file on the web server.boolean
unpublish()
Stops publishing the file on the web server.
Method Detail
getFile
java.io.File getFile()
Gets the file, regardless of existence or published state.- Returns:
- The file, never null.
getFileName
java.lang.String getFileName()
Gets the file name.- Returns:
- The file name with file extension of the file resource on disk, without path.
getURLName
java.lang.String getURLName()
Gets the unique name used for the external URL path assigned to the file.- Returns:
- The unique external URL name without path of the file with file extension.
getDescription
java.lang.String getDescription()
Gets the file description.
getID
java.lang.Object getID()
Gets the ID used for databases.- Returns:
- The ID as a
Long
orString
, ornull
when no database is present or an ID is not required.
getPublishedFile
java.io.File getPublishedFile()
Returns the publish file for access from the web server.- Returns:
- The file published, or null for unpublished or non-existent.
publish
boolean publish() throws java.io.IOException
Starts publishing the file on the web server. If the file already is published, nothing will happen.- Returns:
- true for success, false if already published.
- Throws:
java.io.IOException
- If the file no longer exists.
unpublish
boolean unpublish()
Stops publishing the file on the web server. If the file already is unpublished or never published, nothing will happen.- Returns:
- true for success, false if already unpublished or publisher provider is disposed of.
isPublished
boolean isPublished()
Returns whether the file is published or not.- Returns:
- true if published to the web server, false otherwise.
delete
boolean delete() throws java.io.IOException
Unpublishes and deletes the file, including a potential database backup of the file.- Returns:
- true for unpublish success, false if already unpublished.
- Throws:
java.io.IOException
- If the file failed to be deleted from disk and/or potential database.
getFullTargetURL
java.lang.String getFullTargetURL()
Gets the URL, i.e. the path to the file in the web server for external use, without protocol and host.- Returns:
- The path on the web server, null a file is not found or not published.