public class FileResource extends AbstractJaxRSResource
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_ZIP |
protected FileService |
fileService |
protected static org.apache.commons.logging.Log |
logger |
protected IPlatformMimeResolver |
mimeResolver |
static String |
PATH_SEPARATOR |
protected static IAuthorizationPolicy |
policy |
protected static IUnifiedRepository |
repository |
protected static DefaultUnifiedRepositoryWebService |
repoWs |
protected SchedulerResource |
schedulerResource |
protected RepositoryDownloadWhitelist |
whitelist |
acceptableMediaTypes, httpServletRequest, httpServletResponse, TEXT_HTML
Constructor and Description |
---|
FileResource() |
FileResource(javax.servlet.http.HttpServletResponse httpServletResponse) |
Modifier and Type | Method and Description |
---|---|
protected javax.ws.rs.core.Response |
buildOkResponse() |
protected javax.ws.rs.core.Response |
buildOkResponse(FileService.RepositoryFileToStreamWrapper wrapper) |
protected javax.ws.rs.core.Response |
buildOkResponse(Object o,
String s) |
protected javax.ws.rs.core.Response |
buildOkResponse(String msg) |
protected javax.ws.rs.core.Response |
buildPlainTextOkResponse(String msg) |
protected javax.ws.rs.core.Response |
buildSafeHtmlServerErrorResponse(Exception e) |
protected javax.ws.rs.core.Response |
buildServerErrorResponse(String msg) |
protected javax.ws.rs.core.Response |
buildServerErrorResponse(Throwable t) |
protected javax.ws.rs.core.Response |
buildStatusResponse(javax.ws.rs.core.Response.Status status) |
protected javax.ws.rs.core.Response |
buildZipOkResponse(FileService.DownloadFileWrapper wrapper) |
javax.ws.rs.core.Response |
createFile(String pathId,
InputStream fileContents)
Creates a new file with the provided contents at a given path.
|
javax.ws.rs.core.Response |
doCopyFiles(String pathId,
Integer mode,
String params)
Copy selected list of files to a new specified location.
|
javax.ws.rs.core.Response |
doCreateDirs(String pathId)
Creates a new folder with the specified name.
|
javax.ws.rs.core.Response |
doDeleteFiles(String params)
Move a list of files to the user's trash folder.
|
javax.ws.rs.core.Response |
doDeleteFilesPermanent(String params)
Permanently deletes the selected list of files from the repository.
|
javax.ws.rs.core.Response |
doDeleteLocale(String pathId,
String locale)
Delete the locale for the selected file.
|
String |
doGetCanAccess(String pathId,
String permissions)
Check whether the current user has specific permission on the selected repository file.
|
List<Setting> |
doGetCanAccessList(String pathId,
String permissions)
Checks whether the current user has permissions to the selected files.
|
String |
doGetCanAdminister()
Checks to see if the current user is an administer of the platform and returns a boolean response.
|
String |
doGetCanCreate()
Checks the users permission to determine if that user can create new content in the repository.
|
List<RepositoryFileDto> |
doGetChildren(String pathId,
String filter,
Boolean showHidden,
Boolean includeAcls)
Retrieve a list of child files from the selected repository path of the repository.
|
RepositoryFileDto |
doGetContentCreator(String pathId)
Retrieves the file by creator id
|
List<RepositoryFileDto> |
doGetDeletedFiles()
Retrieve the list of files in the user's trash folder.
|
javax.ws.rs.core.Response |
doGetDirAsZip(RepositoryFile repositoryFile) |
javax.ws.rs.core.Response |
doGetDirAsZip(String pathId) |
RepositoryFileAclDto |
doGetFileAcl(String pathId)
Retrieves the ACL settings of the requested repository file in either xml or json format.
|
javax.ws.rs.core.Response |
doGetFileAsInline(String pathId)
Retrieves the file from the repository as inline.
|
List<LocaleMapDto> |
doGetFileLocales(String pathId)
Retrieves the list of locale maps for the selected repository file.
|
javax.ws.rs.core.Response |
doGetFileOrDir(String pathId)
Takes a pathId and returns a Response with the output stream based on the file located at the pathId.
|
javax.ws.rs.core.Response |
doGetFileOrDirAsDownload(String userAgent,
String pathId,
String strWithManifest)
Download the selected file or folder from the repository.
|
List<RepositoryFileDto> |
doGetGeneratedContent(String pathId)
Retrieve the list of executed contents for a selected content from the repository.
|
List<RepositoryFileDto> |
doGetGeneratedContentForSchedule(String lineageId)
Retrieve the list of execute content by lineage id.
|
List<RepositoryFileDto> |
doGetGeneratedContentForUser(String pathId,
String user)
Retrieve the executed contents for a selected repository file and a given user.
|
List<StringKeyStringValueDto> |
doGetLocaleProperties(String pathId,
String locale)
Retrieve the list of locale properties for a given locale.
|
List<StringKeyStringValueDto> |
doGetMetadata(String pathId)
Retrieve the metadata of the selected file.
|
List<Setting> |
doGetPathsAccessList(StringListWrapper pathsWrapper)
Checks whether the current user has permissions to the provided list of paths.
|
RepositoryFileDto |
doGetProperties(String pathId)
Retrieves the properties of a selected repository file.
|
javax.ws.rs.core.Response |
doGetReservedCharactersDisplay()
Returns the list of reserved characters from the repository.
|
javax.ws.rs.core.Response |
doGetReservedChars()
Returns the list of reserved characters from the repository.
|
List<RepositoryFileDto> |
doGetRootChildren(String filter,
Boolean showHidden,
Boolean includeAcls)
Retrieve a list of child files from the root of the repository.
|
RepositoryFileDto |
doGetRootProperties()
Retrieves the properties of the root directory.
|
RepositoryFileTreeDto |
doGetRootTree(Integer depth,
String filter,
Boolean showHidden,
Boolean includeAcls)
Retrieve the recursive list of files from root of the repository based on the filters provided.
|
RepositoryFileTreeDto |
doGetTree(String pathId,
Integer depth,
String filter,
Boolean showHidden,
Boolean includeAcls,
Boolean includeSystemFolders)
Retrieve the recursive list of children of the selected repository file.
|
String |
doIsParameterizable(String pathId)
Determines whether a selected file supports parameters or not
|
javax.ws.rs.core.Response |
doMove(String destPathId,
String params)
Moves a list of files from its current location to another.
|
javax.ws.rs.core.Response |
doRename(String pathId,
String newName)
Rename the selected file.
|
javax.ws.rs.core.Response |
doRestore(String params,
Integer mode)
Restores a list of files from the user's trash folder to their previous locations.
|
javax.ws.rs.core.Response |
doSetContentCreator(String pathId,
RepositoryFileDto contentCreator)
Store content creator for the given path of created content.
|
javax.ws.rs.core.Response |
doSetLocaleProperties(String pathId,
String locale,
List<StringKeyStringValueDto> properties)
Save list of locale properties for a given locale.
|
javax.ws.rs.core.Response |
doSetMetadata(String pathId,
List<StringKeyStringValueDto> metadata)
Store the metadata of the selected file.
|
FileVersioningConfiguration |
doVersioningConfiguration(String pathId)
This method is used to determine whether versioning should be active for the given path
|
protected String |
encode(String s) |
protected ByteArrayOutputStream |
getByteArrayOutputStream() |
protected IContentGenerator |
getContentGenerator(RepositoryFile repositoryFile) |
protected Exporter |
getExporter() |
protected FileInputStream |
getFileInputStream(File file) |
protected Messages |
getMessagesInstance() |
static IAuthorizationPolicy |
getPolicy() |
static IUnifiedRepository |
getRepository() |
static DefaultUnifiedRepositoryWebService |
getRepoWs() |
protected IPentahoSession |
getSession() |
protected SimpleParameterProvider |
getSimpleParameterProvider() |
protected javax.ws.rs.core.StreamingOutput |
getStreamingOutput(InputStream is) |
protected String |
getUserHomeFolder() |
RepositoryDownloadWhitelist |
getWhitelist() |
protected boolean |
hasParameterUi(RepositoryFile repositoryFile) |
static String |
idToPath(String pathId) |
protected boolean |
isPathValid(String path) |
protected org.dom4j.Document |
parseText(String text) |
void |
setConverterHandler(IRepositoryContentConverterHandler converterHandler) |
javax.ws.rs.core.Response |
setFileAcls(String pathId,
RepositoryFileAclDto acl)
This method is used to update and save the acls of the selected file to the repository.
|
void |
setMimeResolver(IPlatformMimeResolver mimeResolver) |
void |
setWhitelist(RepositoryDownloadWhitelist whitelist) |
javax.ws.rs.core.Response |
systemBackup(String userAgent)
Performs a system back up of the Pentaho system.
|
javax.ws.rs.core.Response |
systemRestore(InputStream fileUpload,
String overwriteFile)
Performs a system restore of the Hitachi Vantara system.
|
setHttpHeaders
public static final String PATH_SEPARATOR
public static final String APPLICATION_ZIP
protected static final org.apache.commons.logging.Log logger
protected FileService fileService
protected SchedulerResource schedulerResource
protected RepositoryDownloadWhitelist whitelist
protected static IUnifiedRepository repository
protected static DefaultUnifiedRepositoryWebService repoWs
protected static IAuthorizationPolicy policy
protected IPlatformMimeResolver mimeResolver
public FileResource()
public FileResource(javax.servlet.http.HttpServletResponse httpServletResponse)
public javax.ws.rs.core.Response systemBackup(@HeaderParam(value="user-agent") String userAgent)
Example Request:
GET pentaho/api/repo/files/backup
userAgent
- A string representing the type of browser to use. Currently only applicable if contains 'FireFox' as FireFox
requires a header with encoding information (UTF-8) and a quoted filename, otherwise encoding information is not
supplied and the filename is not quoted.Example Response:
Encrypted file stream
public javax.ws.rs.core.Response systemRestore(InputStream fileUpload, String overwriteFile)
Example Request:
POST pentaho/api/repo/files/systemRestore
fileUpload
- The zip file generated using the backup endpoint, used to do a full system restore.public javax.ws.rs.core.Response doDeleteFiles(String params)
Example Request:
PUT pentaho/api/repo/files/delete
params
- Comma separated list of the files to be moved to trash folder.public javax.ws.rs.core.Response doDeleteFilesPermanent(String params)
Example Request:
PUT pentaho/api/repo/files/deletepermanent
params
- Comma separated list of the files to be deleted.public javax.ws.rs.core.Response doMove(String destPathId, String params)
Example Request:
PUT pentaho/api/repo/files/{pathId}/move
destPathId
- Colon separated path for the destination path.params
- Comma separated list of files to be moved.public javax.ws.rs.core.Response doRestore(String params, Integer mode)
Example Request:
PUT pentaho/api/repo/files/restore - restore files to original location
PUT pentaho/api/repo/files/restore?overwriteMode=2 - restore files to user home folder, RENAME mode
params
- comma separated list of file ids to be restored.mode
- needed only when restoring files to user home folder,
representing which type of overwrite mode to use. Can be one of this values:
MODE_OVERWRITE (1) - will just replace existing
RENAME (2) - adds a number to the end of the file name.
MODE_NO_OVERWRITE (3) - will not overwrite if file exist.
null - no overwrite modepublic javax.ws.rs.core.Response createFile(String pathId, InputStream fileContents)
Example Request:
PUT pentaho/api/repo/files/:jmeter-test:test_file_1.xml
PUT data:
This PUT body does not contain data.
pathId
- The path from the root folder to the root node of the tree to return using colon characters in place of /
or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file.fileContents
- An Input Stream with the contents of the file to be created.Example Response:
This response does not contain data.
public javax.ws.rs.core.Response doCopyFiles(String pathId, Integer mode, String params)
Example Request:
PUT pentaho/api/repo/files/{pathId}/children?mode=2
pathId
- Colon separated path for the destination for files to be copied.mode
- Default is RENAME (2) which adds a number to the end of the file name. MODE_OVERWRITE (1) will just replace existing
or MODE_NO_OVERWRITE (3) will not copy if file exist.params
- Comma separated list of file ids to be copied.public javax.ws.rs.core.Response doGetFileOrDir(String pathId)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml
pathId
- Colon separated path for the repository file.Example Response:
This response does not contain data.
public javax.ws.rs.core.Response doGetDirAsZip(String pathId)
public javax.ws.rs.core.Response doGetDirAsZip(RepositoryFile repositoryFile)
repositoryFile
- public String doIsParameterizable(String pathId) throws FileNotFoundException
pathId
- Colon separated path for the repository file.FileNotFoundException
public javax.ws.rs.core.Response doGetFileOrDirAsDownload(@HeaderParam(value="user-agent") String userAgent, String pathId, String strWithManifest)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/download?locale=de
pathId
- Colon separated path for the repository file.strWithManifest
- true or false (download file with manifest). Defaults to true (include manifest) if this string can't be directly
parsed to 'false' (case sensitive). This argument is only used if a directory is being downloaded.userAgent
- A string representing the type of browser to use. Currently only applicable if contains 'FireFox' as FireFox
requires a header with encoding information (UTF-8) and a quoted filename, otherwise encoding information is not
supplied and the filename is not quoted.Example Response:
Encrypted file stream
public javax.ws.rs.core.Response doGetFileAsInline(String pathId)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/inline
pathId
- Colon separated path for the repository file.Example Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><repositoryFileAclDto><entriesInheriting>true</entriesInheriting><id>d45d4972-989e-48d5-8bd0-f7024a77f08f</id><owner>admin</owner><ownerType>0</ownerType></repositoryFileAclDto>
public javax.ws.rs.core.Response setFileAcls(String pathId, RepositoryFileAclDto acl)
Example Request:
PUT pentaho/api/repo/files/:jmeter-test:test_file_1.xml/acl
PUT data:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><repositoryFileAclDto><entriesInheriting>true</entriesInheriting><id>d45d4972-989e-48d5-8bd0-f7024a77f08f</id><owner>admin</owner><ownerType>0</ownerType></repositoryFileAclDto>
pathId
- Colon separated path for the repository file.acl
- Acl of the repository file RepositoryFileAclDto.Example Response:
This response does not contain data.
public javax.ws.rs.core.Response doSetContentCreator(String pathId, RepositoryFileDto contentCreator)
pathId
- colon separated path for the repository file that was created by the contenCreator below
:path:to:file:id
contentCreator
- Repository file that created the file at the above pathId location
<repositoryFileDto> <createdDate>1402911997019</createdDate> <fileSize>3461</fileSize> <folder>false</folder> <hidden>false</hidden> <id>ff11ac89-7eda-4c03-aab1-e27f9048fd38</id> <lastModifiedDate>1406647160536</lastModifiedDate> <locale>en</locale> <localePropertiesMapEntries> <localeMapDto> <locale>default</locale> <properties> <stringKeyStringValueDto> <key>file.title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>file.description</key> <value>myFile Description</value> </stringKeyStringValueDto> </properties> </localeMapDto> </localePropertiesMapEntries> <locked>false</locked> <name>myFile.prpt</name></name> <originalParentFolderPath>/public/admin</originalParentFolderPath> <ownerType>-1</ownerType> <path>/public/admin/ff11ac89-7eda-4c03-aab1-e27f9048fd38</path> <title>myFile</title> <versionId>1.9</versionId> <versioned>true</versioned> </repositoryFileAclDto>
public List<LocaleMapDto> doGetFileLocales(String pathId)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/locales
pathId
- Colon separated path for the repository file.Example Response:
<localePropertiesMapEntries> <localeMapDto> <locale>default</locale> <properties> <stringKeyStringValueDto> <key>file.title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>file.description</key> <value>myFile Description</value> </stringKeyStringValueDto> </properties> </localeMapDto> </localePropertiesMapEntries>
public List<StringKeyStringValueDto> doGetLocaleProperties(String pathId, String locale)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/localeProperties?locale=ja
pathId
- Colon separated path for the repository file.locale
- The specified locale.Example Response:
<stringKeyStringValueDtoes> <stringKeyStringValueDto> <key>file.title</key> <value>File Title</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>File Title</value> </stringKeyStringValueDto> </stringKeyStringValueDtoes>
public javax.ws.rs.core.Response doSetLocaleProperties(String pathId, String locale, List<StringKeyStringValueDto> properties)
Example Request:
PUT pentaho/api/repo/files/:jmeter-test:test_file_1.xml/localeProperties?locale=ja
PUT data:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><stringKeyStringValueDtoes><stringKeyStringValueDto><key>file.title</key><value>ãã£ã¼ãé¸æãªã¹ã</value></stringKeyStringValueDto><stringKeyStringValueDto><key>jcr:primaryType</key><value>nt:unstructured</value></stringKeyStringValueDto><stringKeyStringValueDto><key>file.description</key><value>è¤æ°ã®ãã£ã¼ãã¿ã¤ãã表示ãã¾ã</value></stringKeyStringValueDto></stringKeyStringValueDtoes>
pathId
- Colon separated path for the repository file.locale
- A string representation of the locale to set properties on.properties
- The list of locale properties.Example Response:
This response does not contain data.
public javax.ws.rs.core.Response doDeleteLocale(String pathId, String locale)
Example Request:
PUT pentaho/api/repo/files/:jmeter-test:test_file_1.xml/deleteLocale?locale=ja
PUT data:
This PUT body does not contain data.
pathId
- Colon separated path for the repository file.locale
- A string representations of the locale to be deleted.Example Response:
This response does not contain data.
public RepositoryFileDto doGetRootProperties()
Example Request:
GET pentaho/api/repo/files/properties
Example Response:
<repositoryFileDto> <createdDate>1406731649407</createdDate> <fileSize>-1</fileSize> <folder>true</folder> <hidden>false</hidden> <id>6d93372c-4908-47af-9815-3aa6307e392c</id> <locale>en</locale> <locked>false</locked> <name/> <ownerType>-1</ownerType> <path>/</path> <title/> <versioned>false</versioned> </repositoryFileDto>
public List<Setting> doGetCanAccessList(String pathId, String permissions)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.txt/canAccessMap?permissions=1
pathId
- Colon separated path for the repository file.permissions
- Pipe separated permissions to be checked.Example Response:
{"setting":[{"name":"1","value":"true"}]}
public List<Setting> doGetPathsAccessList(StringListWrapper pathsWrapper)
Example Request:
POST pentaho/api/repo/files/pathsAccessList
POST data:
<?xml version="1.0" encoding="UTF-8"?> <stringListWrapper> <strings>/public</strings> </stringListWrapper>
pathsWrapper
- Collection of Strings containing the paths to be checked.Example Response:
<settings> <setting> <name> /public </name> <value> 0 </value> </setting> <setting> <name> /public </name> <value> 1 </value> </setting> </settings>
public String doGetCanAccess(String pathId, String permissions)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/canAccess?permissions=1
pathId
- Colon separated path for the repository file.permissions
- Pipe separated list of permissions.Example Response:
true
public String doGetCanAdminister()
Example Request:
GET pentaho/api/repo/files/canAdminister
Example Response:
true
public javax.ws.rs.core.Response doGetReservedChars()
Example Request:
GET pentaho/api/repo/files/reservedCharacters
Example Response:
"/ \"
public javax.ws.rs.core.Response doGetReservedCharactersDisplay()
Example Request:
GET pentaho/api/repo/files/reservedCharactersDisplay
Example Response:
"/, \, \t, \r, \nF"
public String doGetCanCreate()
Example Request:
GET pentaho/api/repo/files/canCreate
Example Response:
true
public RepositoryFileAclDto doGetFileAcl(String pathId)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/acl
pathId
- colon separated path for the repository file.Example Response:
<repositoryFileAclDto> <aces> <modifiable>true</modifiable> <permissions>4</permissions> <recipient>admin</recipient> <recipientType>0</recipientType> </aces> <aces> <modifiable>false</modifiable> <permissions>4</permissions> <recipient>Administrator</recipient> <recipientType>1</recipientType> </aces> <entriesInheriting>true</entriesInheriting> <id>068390ba-f90d-46e3-8c55-bbe55e24b2fe</id> <owner>admin</owner> <ownerType>0</ownerType> </repositoryFileAclDto>
public RepositoryFileDto doGetProperties(String pathId)
Example Request:
GET pentaho/api/repo/files/:/properties
pathId
- Colon separated path for the repository file.Example Response:
{ "createdDate":"1406732545857", "description":"description", "fileSize":"1234", "folder":"false", "hidden":"false", "id":"fileId", "lastModifiedDate":"1406732545858", "locale":"en", "localePropertiesMapEntries":[ { "locale":"default", "properties":[ {"key":"file.title","value":"afile"}, {"key":"description","value":"afile.prpti"}, {"key":"jcr:primaryType","value":"nt:unstructured"}, {"key":"title","value":"afile"}, {"key":"file.description","value":"afile.prpti"} ] } ], "locked":"false", "name":"filename", "ownerType":"-1","path":"pathToFile:filename", "title":"title","versioned":"false" }
public RepositoryFileDto doGetContentCreator(String pathId)
pathId
- Colon separated path for the destination for files to be copied.public List<RepositoryFileDto> doGetGeneratedContent(String pathId)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/generatedContent?locale=de
pathId
- Colon separated path for the destination for files to be copied.Example Response:
<List> <repositoryFileDto> <createdDate>1402911997019</createdDate> <fileSize>3461</fileSize> <folder>false</folder> <hidden>false</hidden> <id>ff11ac89-7eda-4c03-aab1-e27f9048fd38</id> <lastModifiedDate>1406647160536</lastModifiedDate> <locale>en</locale> <localePropertiesMapEntries> <localeMapDto> <locale>default</locale> <properties> <stringKeyStringValueDto> <key>file.title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>file.description</key> <value>myFile Description</value> </stringKeyStringValueDto> </properties> </localeMapDto> </localePropertiesMapEntries> <locked>false</locked> <name>myFile.prpt</name></name> <originalParentFolderPath>/public/admin</originalParentFolderPath> <ownerType>-1</ownerType> <path>/public/admin/ff11ac89-7eda-4c03-aab1-e27f9048fd38</path> <title>myFile</title> <versionId>1.9</versionId> <versioned>true</versioned> </repositoryFileAclDto> </List>
public List<RepositoryFileDto> doGetGeneratedContentForUser(String pathId, String user)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/generatedContentForUser?user=admin
pathId
- Colon separated path for the destination for files to be copied.user
- The username for the generated content folder.Example Response:
<List> <repositoryFileDto> <createdDate>1402911997019</createdDate> <fileSize>3461</fileSize> <folder>false</folder> <hidden>false</hidden> <id>ff11ac89-7eda-4c03-aab1-e27f9048fd38</id> <lastModifiedDate>1406647160536</lastModifiedDate> <locale>en</locale> <localePropertiesMapEntries> <localeMapDto> <locale>default</locale> <properties> <stringKeyStringValueDto> <key>file.title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>file.description</key> <value>myFile Description</value> </stringKeyStringValueDto> </properties> </localeMapDto> </localePropertiesMapEntries> <locked>false</locked> <name>myFile.prpt</name></name> <originalParentFolderPath>/public/admin</originalParentFolderPath> <ownerType>-1</ownerType> <path>/public/admin/ff11ac89-7eda-4c03-aab1-e27f9048fd38</path> <title>myFile</title> <versionId>1.9</versionId> <versioned>true</versioned> </repositoryFileAclDto> </List>
public RepositoryFileTreeDto doGetRootTree(Integer depth, String filter, Boolean showHidden, Boolean includeAcls)
Example Request:
GET pentaho/api/repo/files/tree?showHidden=false&filter=*|FILES&_=1389042244670
depth
- How many level should the search go.filter
- Filter to be applied for search. The filter can be broken down into 3 parts; File types, Child Node
Filter, and Member Filters. Each part is separated with a pipe (|) character.
File Types are represented by a word phrase. This phrase is recognized as a file type phrase and processed
accordingly. Valid File Type word phrases include "FILES", "FOLDERS", and "FILES_FOLDERS" and denote
whether to return files, folders, or both files and folders, respectively.
The Child Node Filter is a list of allowed names of files separated by the pipe (|) character. Each file
name in the filter may be a full name or a partial name with one or more wildcard characters ("*"). The
filter does not apply to root node.
The Member Filter portion of the filter parameter allows the caller to specify which properties of the
metadata to return. Member Filters start with "includeMembers=" or "excludeMembers=" followed by a list of
comma separated field names that are to be included in, or, excluded from, the list. Valid field names can
be found in org.pentaho.platform.repository2.unified.webservices#RepositoryFileAdapter.
Omission of a member filter will return all members. It is invalid to both and includeMembers= and an
excludeMembers= clause in the same service call.showHidden
- Include or exclude hidden files from the file list.Example Response:
<repositoryFileTreeDto> <children> <file> <createdDate>1405356318621</createdDate> <fileSize>-1</fileSize> <folder>true</folder> <hidden>false</hidden> <id>fileId;/id> <locale>en</locale> <locked>false</locked> <name>admin</name> <ownerType>-1</ownerType> <path>/path/to/dir</path> <title>admin</title> <versioned>false</versioned> </file> </children> </repositoryFileTreeDto>
public List<RepositoryFileDto> doGetRootChildren(String filter, Boolean showHidden, Boolean includeAcls)
Example Request:
GET pentaho/api/repo/files/children?showHidden=false&filter=*|FILES&_=1389042244670
filter
- Filter to be applied for search. The filter can be broken down into 3 parts; File types, Child Node
Filter, and Member Filters. Each part is separated with a pipe (|) character.
File Types are represented by a word phrase. This phrase is recognized as a file type phrase and processed
accordingly. Valid File Type word phrases include "FILES", "FOLDERS", and "FILES_FOLDERS" and denote
whether to return files, folders, or both files and folders, respectively.
The Child Node Filter is a list of allowed names of files separated by the pipe (|) character. Each file
name in the filter may be a full name or a partial name with one or more wildcard characters ("*"). The
filter does not apply to root node.
The Member Filter portion of the filter parameter allows the caller to specify which properties of the
metadata to return. Member Filters start with "includeMembers=" or "excludeMembers=" followed by a list of
comma separated field names that are to be included in, or, excluded from, the list. Valid field names can
be found in org.pentaho.platform.repository2.unified.webservices#RepositoryFileAdapter.
Omission of a member filter will return all members. It is invalid to both and includeMembers= and an
excludeMembers= clause in the same service call.showHidden
- Include or exclude hidden files from the file list.includeAcls
- Include permission information about the file in the output.Example Response:
<repositoryFileTreeDto> <children> <file> <createdDate>1405356318621</createdDate> <fileSize>-1</fileSize> <folder>true</folder> <hidden>false</hidden> <id>fileId;/id> <locale>en</locale> <locked>false</locked> <name>admin</name> <ownerType>-1</ownerType> <path>/path/to/dir</path> <title>admin</title> <versioned>false</versioned> </file> </children> </repositoryFileTreeDto>
public RepositoryFileTreeDto doGetTree(String pathId, Integer depth, String filter, Boolean showHidden, Boolean includeAcls, Boolean includeSystemFolders)
Example Request:
GET pentaho/api/repo/files/:public/tree?showHidden=false&filter=*|FILES&_=1389042244670
pathId
- The path from the root folder to the root node of the tree to return using colon characters in place of /
or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file.depth
- How many level should the search go.filter
- Filter to be applied for search. The filter can be broken down into 3 parts; File types, Child Node
Filter, and Member Filters. Each part is separated with a pipe (|) character.
File Types are represented by a word phrase. This phrase is recognized as a file type phrase and processed
accordingly. Valid File Type word phrases include "FILES", "FOLDERS", and "FILES_FOLDERS" and denote
whether to return files, folders, or both files and folders, respectively.
The Child Node Filter is a list of allowed names of files separated by the pipe (|) character. Each file
name in the filter may be a full name or a partial name with one or more wildcard characters ("*"). The
filter does not apply to root node.
The Member Filter portion of the filter parameter allows the caller to specify which properties of the
metadata to return. Member Filters start with "includeMembers=" or "excludeMembers=" followed by a list of
comma separated field names that are to be included in, or, excluded from, the list. Valid field names can
be found in org.pentaho.platform.repository2.unified.webservices#RepositoryFileAdapter.
Omission of a member filter will return all members. It is invalid to both and includeMembers= and an
excludeMembers= clause in the same service call.showHidden
- Include or exclude hidden files from the file list.includeAcls
- Include permission information about the file in the output.Example Response:
<repositoryFileTreeDto> <children> <file> <createdDate>1405356318621</createdDate> <fileSize>-1</fileSize> <folder>true</folder> <hidden>false</hidden> <id>fileId;/id> <locale>en</locale> <locked>false</locked> <name>admin</name> <ownerType>-1</ownerType> <path>/path/to/dir</path> <title>admin</title> <versioned>false</versioned> </file> </children> </repositoryFileTreeDto>
public List<RepositoryFileDto> doGetChildren(String pathId, String filter, Boolean showHidden, Boolean includeAcls)
Example Request:
GET pentaho/api/repo/files/:jmeter-test/children
pathId
- The path from the root folder to the root node of the tree to return using colon characters in place of /
or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file.filter
- Filter to be applied for search. The filter can be broken down into 3 parts; File types, Child Node
Filter, and Member Filters. Each part is separated with a pipe (|) character.
File Types are represented by a word phrase. This phrase is recognized as a file type phrase and processed
accordingly. Valid File Type word phrases include "FILES", "FOLDERS", and "FILES_FOLDERS" and denote
whether to return files, folders, or both files and folders, respectively.
The Child Node Filter is a list of allowed names of files separated by the pipe (|) character. Each file
name in the filter may be a full name or a partial name with one or more wildcard characters ("*"). The
filter does not apply to root node.
The Member Filter portion of the filter parameter allows the caller to specify which properties of the
metadata to return. Member Filters start with "includeMembers=" or "excludeMembers=" followed by a list of
comma separated field names that are to be included in, or, excluded from, the list. Valid field names can
be found in org.pentaho.platform.repository2.unified.webservices#RepositoryFileAdapter.
Omission of a member filter will return all members. It is invalid to both and includeMembers= and an
excludeMembers= clause in the same service call.showHidden
- Include or exclude hidden files from the file list.includeAcls
- Include permission information about the file in the output.Example Response:
<repositoryFileTreeDto> <children> <file> <createdDate>1405356318621</createdDate> <fileSize>-1</fileSize> <folder>true</folder> <hidden>false</hidden> <id>fileId;/id> <locale>en</locale> <locked>false</locked> <name>admin</name> <ownerType>-1</ownerType> <path>/path/to/dir</path> <title>admin</title> <versioned>false</versioned> </file> </children> </repositoryFileTreeDto>
public List<RepositoryFileDto> doGetDeletedFiles()
Example Request:
GET pentaho/api/repo/files/deleted
Example Response:
<repositoryFileDtoes> <repositoryFileDto> <createdDate>1405356406448</createdDate> <deletedDate>1406573914167</deletedDate> <fileSize>10477</fileSize> <folder>false</folder> <hidden>false</hidden> <id>fileId</id> <lastModifiedDate>1405356406448</lastModifiedDate> <locale>en</locale> <localePropertiesMapEntries> <locale>default</locale> <properties> <key>file.title</key> <value>File Title</value> </properties> <properties> <key>jcr:primaryType</key> <value>nt:unstructured</value> </properties> <properties> <key>title</key> <value>filename</value> </properties> <properties> <key>file.description</key> <value /> </properties> </localePropertiesMapEntries> <locked>false</locked> <name>filename.ext</name> <originalParentFolderPath>/original/path/to/file</originalParentFolderPath> <ownerType>-1</ownerType> <path>/path/to/file</path> <title>File Title</title> <versionId>1.3</versionId> <versioned>true</versioned> </repositoryFileDto> </repositoryFileDtoes>
public List<StringKeyStringValueDto> doGetMetadata(String pathId)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.xml/metadata
pathId
- The path from the root folder to the root node of the tree to return using colon characters in place of /
or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file.Example Response:
<stringKeyStringValueDtos> <stringKeyStringValueDto> <key>KEY<key> <value>KEY<value> </stringKeyStringValueDto> </stringKeyStringValueDtos>
public javax.ws.rs.core.Response doRename(String pathId, String newName)
Example Request:
PUT pentaho/api/repo/files/:jmeter-test:test_file_1.xml/rename?newName=test_file_8
PUT data:
This PUT body does not contain data.
pathId
- The path from the root folder to the root node of the tree to return using colon characters in place of /
or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file.newName
- String indicating the new name of the file.Example Response:
This response does not contain data.
public javax.ws.rs.core.Response doSetMetadata(String pathId, List<StringKeyStringValueDto> metadata)
Example Request:
PUT pentaho/api/repo/files/:jmeter-test:test_file_1.xml/metadata
PUT data:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><stringKeyStringValueDtoes><stringKeyStringValueDto><key>metadata.key.1</key><value>metadata.value.1</value></stringKeyStringValueDto></stringKeyStringValueDtoes>
pathId
- The path from the root folder to the root node of the tree to return using colon characters in place of /
or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file.metadata
- A list of StringKeyStringValueDto objects.Example Response:
This response does not contain data.
public javax.ws.rs.core.Response doCreateDirs(String pathId)
Example Request:
PUT pentaho/api/repo/files/:public:jmeter-test-dir/createDir
PUT data:
This PUT body does not contain data.
pathId
- The path from the root folder to the root node of the tree to return using colon characters in
place of / or \ characters. To clarify /path/to/file, the encoded pathId would be :path:to:file.Example Response:
This response does not contain data.
public List<RepositoryFileDto> doGetGeneratedContentForSchedule(String lineageId)
Example Request:
GET pentaho/api/repo/files/generatedContentForSchedule?lineageId=
lineageId
- the path for the file.Example Response:
<List> <repositoryFileDto> <createdDate>1402911997019</createdDate> <fileSize>3461</fileSize> <folder>false</folder> <hidden>false</hidden> <id>ff11ac89-7eda-4c03-aab1-e27f9048fd38</id> <lastModifiedDate>1406647160536</lastModifiedDate> <locale>en</locale> <localePropertiesMapEntries> <localeMapDto> <locale>default</locale> <properties> <stringKeyStringValueDto> <key>file.title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>jcr:primaryType</key> <value>nt:unstructured</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>title</key> <value>myFile</value> </stringKeyStringValueDto> <stringKeyStringValueDto> <key>file.description</key> <value>myFile Description</value> </stringKeyStringValueDto> </properties> </localeMapDto> </localePropertiesMapEntries> <locked>false</locked> <name>myFile.prpt</name></name> <originalParentFolderPath>/public/admin</originalParentFolderPath> <ownerType>-1</ownerType> <path>/public/admin/ff11ac89-7eda-4c03-aab1-e27f9048fd38</path> <title>myFile</title> <versionId>1.9</versionId> <versioned>true</versioned> </repositoryFileAclDto> </List>
public FileVersioningConfiguration doVersioningConfiguration(String pathId)
Example Request:
GET pentaho/api/repo/files/:jmeter-test:test_file_1.ktr/versioningConfiguration
pathId
- Colon separated path for the repository file.Example Response:
<fileVersioningConfiguration> <versionCommentEnabled>true</versionCommentEnabled> <versioningEnabled>true</versioningEnabled> </fileVersioningConfiguration>
protected boolean isPathValid(String path)
public RepositoryDownloadWhitelist getWhitelist()
public void setWhitelist(RepositoryDownloadWhitelist whitelist)
public static IAuthorizationPolicy getPolicy()
public static IUnifiedRepository getRepository()
public static DefaultUnifiedRepositoryWebService getRepoWs()
public void setConverterHandler(IRepositoryContentConverterHandler converterHandler)
public void setMimeResolver(IPlatformMimeResolver mimeResolver)
protected javax.ws.rs.core.Response buildOkResponse()
protected javax.ws.rs.core.Response buildOkResponse(String msg)
protected javax.ws.rs.core.Response buildPlainTextOkResponse(String msg)
protected javax.ws.rs.core.Response buildStatusResponse(javax.ws.rs.core.Response.Status status)
protected javax.ws.rs.core.Response buildServerErrorResponse(Throwable t)
protected javax.ws.rs.core.Response buildServerErrorResponse(String msg)
protected javax.ws.rs.core.Response buildSafeHtmlServerErrorResponse(Exception e)
protected javax.ws.rs.core.Response buildOkResponse(FileService.RepositoryFileToStreamWrapper wrapper)
protected javax.ws.rs.core.Response buildZipOkResponse(FileService.DownloadFileWrapper wrapper)
protected Exporter getExporter()
protected FileInputStream getFileInputStream(File file) throws FileNotFoundException
FileNotFoundException
protected javax.ws.rs.core.StreamingOutput getStreamingOutput(InputStream is)
protected boolean hasParameterUi(RepositoryFile repositoryFile)
protected IContentGenerator getContentGenerator(RepositoryFile repositoryFile)
protected SimpleParameterProvider getSimpleParameterProvider()
protected String encode(String s) throws UnsupportedEncodingException
UnsupportedEncodingException
protected IPentahoSession getSession()
protected ByteArrayOutputStream getByteArrayOutputStream()
protected org.dom4j.Document parseText(String text) throws org.dom4j.DocumentException
org.dom4j.DocumentException
protected Messages getMessagesInstance()
protected String getUserHomeFolder()
Copyright © 2017 Hitachi Vantara. All rights reserved.