Class LocalResource
java.lang.Object
org.eclipse.dirigible.repository.local.LocalEntity
org.eclipse.dirigible.repository.local.LocalResource
public class LocalResource extends LocalEntity implements IResource
The file system based implementation of
IResource.-
Field Summary
-
Constructor Summary
Constructors Constructor Description LocalResource(FileSystemRepository repository, RepositoryPath path)Instantiates a new local resource. -
Method Summary
Modifier and Type Method Description voidcopyTo(String path)Copy to.voidcreate()Creates the.voiddelete()Delete.booleanequals(Object obj)Equals.booleanexists()Exists.byte[]getContent()Gets the content.StringgetContentType()Gets the content type.protected LocalFilegetDocument()Returns theLocalFileobject matching thisLocalResource.protected LocalFilegetDocumentSafe()Returns theLocalFileobject matching thisLocalResource.protected LocalFilegetFile()Returns theLocalFileobject matching thisLocalResource.inthashCode()Hash code.booleanisBinary()Checks if is binary.booleanisEmpty()Checks if is empty.voidmoveTo(String path)Move to.voidrenameTo(String name)Rename to.voidsetContent(byte[] content)Sets the content.voidsetContent(byte[] content, boolean isBinary, String contentType)Sets the content.Methods inherited from class org.eclipse.dirigible.repository.local.LocalEntity
createAncestorsAndSelfIfMissing, createAncestorsIfMissing, getInformation, getLocalObject, getLocalObjectSafe, getName, getParent, getPath, getRepository, getRepositoryPathMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.dirigible.repository.api.IEntity
getInformation, getName, getParent, getPath, getRepository
-
Constructor Details
-
LocalResource
Instantiates a new local resource.- Parameters:
repository- the repositorypath- the path
-
-
Method Details
-
create
Creates the.- Specified by:
createin interfaceIEntity- Throws:
RepositoryWriteException- the repository write exception
-
delete
Delete.- Specified by:
deletein interfaceIEntity- Throws:
RepositoryWriteException- the repository write exception
-
renameTo
Rename to.- Specified by:
renameToin interfaceIEntity- Parameters:
name- the name- Throws:
RepositoryWriteException- the repository write exception
-
moveTo
Move to.- Specified by:
moveToin interfaceIEntity- Parameters:
path- the path- Throws:
RepositoryWriteException- the repository write exception
-
copyTo
Copy to.- Specified by:
copyToin interfaceIEntity- Parameters:
path- the path- Throws:
RepositoryWriteException- the repository write exception
-
exists
Exists.- Specified by:
existsin interfaceIEntity- Returns:
- true, if successful
- Throws:
RepositoryReadException- the repository read exception
-
isEmpty
Checks if is empty.- Specified by:
isEmptyin interfaceIEntity- Returns:
- true, if is empty
- Throws:
RepositoryReadException- the repository read exception
-
getContent
Gets the content.- Specified by:
getContentin interfaceIResource- Returns:
- the content
- Throws:
RepositoryReadException- the repository read exception
-
setContent
Sets the content.- Specified by:
setContentin interfaceIResource- Parameters:
content- the new content- Throws:
RepositoryWriteException- the repository write exception
-
equals
Equals.- Overrides:
equalsin classLocalEntity- Parameters:
obj- the obj- Returns:
- true, if successful
-
hashCode
public int hashCode()Hash code.- Overrides:
hashCodein classLocalEntity- Returns:
- the int
-
getDocument
Returns theLocalFileobject matching thisLocalResource. If there is no such object, thennullis returned.- Returns:
- the document
- Throws:
RepositoryReadException- the repository read exception
-
getFile
Returns theLocalFileobject matching thisLocalResource. If there is no such object, thennullis returned.- Returns:
- the local file
- Throws:
RepositoryReadException- the repository read exception
-
getDocumentSafe
Returns theLocalFileobject matching thisLocalResource. If there is no such object, then anRepositoryNotFoundExceptionis thrown.- Returns:
- the document safe
- Throws:
RepositoryNotFoundException- the repository not found exception
-
isBinary
public boolean isBinary()Checks if is binary. -
getContentType
Gets the content type.- Specified by:
getContentTypein interfaceIResource- Returns:
- the content type
-
setContent
public void setContent(byte[] content, boolean isBinary, String contentType) throws RepositoryWriteExceptionSets the content.- Specified by:
setContentin interfaceIResource- Parameters:
content- the contentisBinary- the is binarycontentType- the content type- Throws:
RepositoryWriteException- the repository write exception
-