Package com.iizix.server.wsfile
Class WSFile
- java.lang.Object
-
- com.iizix.server.wsfile.WSFile
-
public class WSFile extends java.lang.Object
Class 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:
WSFileType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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
remove()
Unpublishes and deletes the file.java.lang.String
toString()
Gets the debug information string.boolean
unpublish()
Unpublishes the file from the web server.
-
-
-
Method Detail
-
getFile
public java.io.File getFile()
Gets the file, regardless of existence or published state.- Returns:
- The file, never null.
-
getFileName
public java.lang.String getFileName()
Gets the file name.- Returns:
- The file name with file extension of the file resource on disk, without path.
-
getURLName
public 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
public java.lang.String getDescription()
Gets the file description.
-
getPublishedFile
public 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
public 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
public boolean unpublish()
Unpublishes the file from 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 provides is disposed of.
-
isPublished
public boolean isPublished()
Returns whether the file is published or not.- Returns:
- true if published to the web server, false otherwise.
-
remove
public boolean remove() throws java.io.IOException
Unpublishes and deletes the file.- Returns:
- true for unpublish success, false if already unpublished.
- Throws:
java.io.IOException
- If the file failed to be deleted.
-
getFullTargetURL
public 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.
-
toString
public java.lang.String toString()
Gets the debug information string.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Used for logging, etc.
-
-