Class RepositoryResource


  • public class RepositoryResource
    extends AbstractJaxRSResource
    The RepositoryResource service retrieves the repository files through various methods.  Allows you to execute repository content.
    • Field Detail

      • pluginManager

        protected org.pentaho.platform.api.engine.IPluginManager pluginManager
      • repository

        protected org.pentaho.platform.api.repository2.unified.IUnifiedRepository repository
      • whitelist

        protected org.pentaho.platform.repository.RepositoryDownloadWhitelist whitelist
    • Constructor Detail

      • RepositoryResource

        public RepositoryResource()
    • Method Detail

      • doFormPost

        public javax.ws.rs.core.Response doFormPost​(String contextId,
                                                    String resourceId,
                                                    javax.ws.rs.core.MultivaluedMap<String,​String> formParams)
                                             throws org.pentaho.platform.api.engine.ObjectFactoryException,
                                                    org.pentaho.platform.api.engine.PluginBeanException,
                                                    IOException,
                                                    URISyntaxException
        Gets a resource identified by the compound key contextId and resourceId. This request may include additional parameters used to render the resource.

        Example Request:
        POST pentaho/api/repos/xanalyzer/service/ajax/lookupXmiId
        POST data:

              catalog=t&cube=t&time=1389817320072
          

        Parameters:
        contextId - Identifies the context in which the resource should be retrieved. This value may be a repository file ID, repository file extension or plugin ID
        resourceId - Identifies a resource to be retrieved. This value may be a static file residing in a publicly visible plugin folder, repository file ID or content generator ID
        formParams - Any arguments needed to render the resource
        Returns:
        A jax-rs Response object with the appropriate status code, header, and body. In many cases this will trigger a streaming operation after it it is returned to the caller..

        Example Response:

            This response does not contain data.
          
        Throws:
        org.pentaho.platform.api.engine.ObjectFactoryException
        org.pentaho.platform.api.engine.PluginBeanException
        IOException
        URISyntaxException
      • doGet

        public javax.ws.rs.core.Response doGet​(String contextId,
                                               String resourceId)
                                        throws org.pentaho.platform.api.engine.ObjectFactoryException,
                                               org.pentaho.platform.api.engine.PluginBeanException,
                                               IOException,
                                               URISyntaxException
        Gets a resource identified by the compound key contextId and resourceId. This request may include additional parameters used to render the resource.

        Example Request:
        GET pentaho/api/repos/admin-plugin/resources/authenticationProviderModule/authenticationProviderAdmin.html

        Parameters:
        contextId - Identifies the context in which the resource should be retrieved. This value may be a repository file ID, repository file extension or plugin ID.
        resourceId - Identifies a resource to be retrieved. This value may be a static file residing in a publicly visible plugin folder, repository file ID or content generator ID.
        Returns:
        A jax-rs Response object with the appropriate status code, header, and body.

        Example Response:

        <!DOCTYPE html>
        <html xmlns:pho="http:/www.pentaho.com">
        <head>
        <title>Report Parameter UI</title>
        <link rel="stylesheet" type="text/css" href="authenticationProviderAdmin.css" />
        <link rel="stylesheet" type="text/css" href="../../../common-ui/resources/web/dojo/dijit/themes/pentaho/pentaho.css" />
        <script type="text/javascript" src="../../../../webcontext.js"></script>
        <script type="text/javascript">
        require(["authenticationProviderAdmin"]);
        </script>
        </head>
        <body class="soria" style="border: none">
        
        <!--  tree dialog -->
        <div id="ldapTreeDialog" data-dojo-type="dijit.Dialog"  data-dojo-props='title:"LDAP Browser"' class="dialog">
        <div id="ldapTreeDialogContent" class="dialog-content ldap-tree-padding">
        <div id="ldapTree" data-dojo-props="autoExpand:true"></div>
        </div>
        <div class="dialog-buttons">
        <div class="container">
        <button id="btn_ldapTreeDialogOk" class="pentaho-button ok-button first"> </button>
        <button id="btn_ldapTreeDialogCancel" class="pentaho-button cancel-button last"> </button>
        </div>
        </div>
        </div>
        
        <!-- override dialog -->
        <div id="ldapDirtyDialog" data-dojo-type="dijit.Dialog" class="dialog">
        <div class="dialog-content pentaho-padding-sm">
        <p class="message">You have unsaved changes. Do you want to continue?</p>
        </div>
        <div class="dialog-buttons">
        <div class="container">
        <button id="btn_ldapDirtyDialogNo" class="pentaho-button no-button first"> </button>
        <button id="btn_ldapDirtyDialogYes" class="pentaho-button yes-button last"> </button>
        </div>
        </div>
        </div>
        
        <!-- test dialog -->
        <div id="ldapTestMsgDialog" data-dojo-type="dijit.Dialog" class="dialog">
        <div class="dialog-content pentaho-padding-sm">
        <p class="message"> </p>
        </div>
        <div class="dialog-buttons">
        <div class="container">
        <button id="btn_hideTest" class="pentaho-button close-button last"> </button>
        </div>
        </div>
        </div>
        
        <!-- edit server connection -->
        <div id="editServerDialog" data-dojo-type="dijit.Dialog" data-dojo-props='title:"Edit External Authentication Server Connection"' class="dialog">
        <div class="dialog-content pentaho-padding-sm">
        <p class="message">Changing server conneciton will remove all current authentication and premissions settings. Do you want to continue?</p>
        </div>
        <div class="dialog-buttons">
        <div class="container">
        <button id="btn_editServerDialogYesClick" class="pentaho-button ok-button first"> </button>
        <button id="btn_editServerDialogNoClick" class="pentaho-button cancel-button last"> </button>
        </div>
        </div>
        </div>
        
        <!-- edit authentication method -->
        <div id="authenticationChangeDialog" data-dojo-type="dijit.Dialog" class="dialog" >
        <div class="dialog-content pentaho-padding-sm">
        <p class="message">Changing the authentication method will remove all current authentication and premissions settings. Do you want to continue?</p>
        </div>
        <div class="dialog-buttons">
        <div class="container">
        <button id="btn_processAuthenticationMethodChange" class="pentaho-button yes-change-button first"> </button>
        <button id="btn_authenticationChangeNoClick" class="pentaho-button no-button last"> </button>
        </div>
        </div>
        </div>
        
        
        
        <!-- populator dialog -->
        <div id="ldapPopTestDialog" data-dojo-type="dijit.Dialog" class="dialog">
        <div class="dialog-content pentaho-padding-sm">
        <div class="groupOption">
        <div class="ldapPopulatorGroupRoleAttributeLabel">Group Role Attribute:</div>
        <div class="ldapPopulatorGroupRoleAttributeValue value"></div>
        </div>
        <div class="groupOption">
        <div class="ldapPopulatorGroupRoleSearchBaseLabel">Group Search Base:</div>
        <div class="ldapPopulatorGroupRoleSearchBaseValue value"></div>
        </div>
        <div class="groupOption">
        <div class="ldapPopulatorGroupSearchFilterLabel">Group Search Filter:</div>
        <div class="ldapPopulatorGroupSearchFilterValue value"></div>
        </div>
        <div class="groupOption">
        <div class="ldapPopulatorRolePrefixLabel">Role Prefix:</div>
        <div class="ldapPopulatorRolePrefixValue value"></div>
        </div>
        <div class="groupOption">
        <div class="ldapUserLabel">User Name:</div>
        </div>
        <input id="ldapPopTestUserName" type="text" />
        <br />
        <div class="groupOption">
        <label class="ldapUserDomainLabel">User DN:</label>
        </div>
        <input id="ldapPopTestUserDn" type="text"/>
        <br />
        </div>
        <div class="dialog-buttons">
        <div class="container">
        <button id="btn_testPopulator" class="pentaho-button ok-button first"> </button>
        <button id="btn_hideLdapPropsTest" class="pentaho-button cancel-button last"> </button>
        </div>
        </div>
        </div>
        
        
        
        <!-- user test dialog -->
        <div id="ldapUserTestDialog" data-dojo-type="dijit.Dialog" class="dialog">
        <div class="dialog-content pentaho-padding-sm">
        <p class="message">With the search base and search filter configuration search for a user name that exists in your LDAP server.</p>
        <br/>
        <div class="groupOption">
        <div class="ldapUserTestLabel">Search For User:</div>
        </div>
        <input class="ldapUserTestUserName" type="text" />
        <br />
        </div>
        <div class="dialog-buttons">
        <div class="container">
        <button id="btn_testLdapUserSearch" class="pentaho-button ok-button first"> </button>
        <button id="btn_hideLdapUserTestDialog" class="pentaho-button cancel-button last"> </button>
        </div>
        </div>
        </div>
        
        
        <div style="padding: 0px;">
        <div class="pentaho-fieldgroup-major titleLabel">Authentication</div>
        <br/>
        <!-- CONNECTION PARAMS -->
        <div id="authenticationSelector">
        
        <div class="authenticationMethodLabel authMethod">Authentication Method</div>
        <div class="authText authenticationMethodDescriptionLabel">
        Select where user and their log in credentials will be managed:
        </div>
        
        <div class="groupOption">
        <input checked="checked" name="securityProvider" type="radio" value="jackrabbit" />
        <div class="pentahoSecurityLabel authValue">Local - Use basic Hitachi Vantara authentication</div>
        </div>
        <div class="groupOption">
        <input name="securityProvider" type="radio" value="ldap" />
        <div class="ldapSecurityLabel authValue">External - Use LDAP / Active Directory server</div>
        </div>
        </div>
        <br />
        
        
        <br />
        <div id="ldapConnection" style="display: none">
        <div class="ldapConnectionTitleLabel authMethod">LDAP Server Connection</div>
        
        <!-- to edit config -->
        <div id="ldapConnectionEdit" style="display:block">
        <div class="authText ldapServerUrlLabel">Server URL:</div>
        <input class="ldapServerUrlInput authValue adminField" type="text" />
        
        <div class="authText ldapUserLabel">User Name:</div>
        <input class="ldapUserInput authValue adminField" type="text" />
        
        <div class="authText ldapPasswordLabel">Password:</div>
        <input class="ldapPasswordInput authValue adminField" type="password" />
        
        <br/><br/>
        <div class="authText ldapTestConnectionLabel">Test connection to complete LDAP setup</div>
        <br/>
        <div class="securityConfigButton">
        <button id="testServerConnectionButton" class="pentaho-button testServerConnectionButton" >
        </button>
        </div>
        </div>
        
        <!-- edited config -->
        <div id="ldapConnectionEditor" style="display:none">
        <div class="authText ldapServerUrlLabel" >Server URL:</div>
        <div class="groupOption">
        <div class="ldapServerUrlValue authValue"></div>
        <div class="pentaho-editbutton" id="btn_editConnection" title="Edit connection"></div>
        </div>
        </div>
        
        <br />
        
        <div>
        <div id="ldapSettingsGroup" style="display: none">
        
        <!-- Ldap administration configuration -->
        <div id="ldapAdministration">
        <div class="ldapAdministrationTitleLabel authMethod">Pentaho System Administrator</div>
        <div class="ldapAdministratiorUserLabel authText">Select user from LDAP server:</div>
        <div class="groupOption">
        <input class="ldapAdministratorUserInput adminField" type="text"  />
        <button class="adminButton" id="btn_ldapAdministratorUserInput"> </button>
        </div>
        <div class="ldapAdministrationRoleLabel authText">Select role from LDAP server:</div>
        <div class="groupOption">
        <input class="ldapAdministratorRoleInput adminField" type="text"  />
        <button class="adminButton" id="btn_ldapAdministratorRoleInput" > </button>
        </div>
        </div>
        <br/><br/>
        
        <!-- ldap configuration -->
        <div class="ldapConfigurationTitle authMethod">LDAP Configuration</div>
        <div class="authText" id="customLdapProviderLabel" >Other</div>
        <div class="groupOption">
        <select id="ldapTypeSelector">
        <option class="ldapTypeSelectorApacheOption" selected="selected" value="ldapApacheConfiguration">Apache DS</option>
        <option class="ldapTypeSelectorCustomOption" value="ldapCustomConfiguration">Custom</option>
        </select>
        </div>
        
        <!-- ldap apache configuration -->
        <div id="ldapApacheConfiguration" class="ldapApacheConfiguration configuration" style="display: none;">
        <!-- User Base -->
        <div class="ldapUserBaseLabel authText">User Base:</div>
        <div class="groupOption">
        <input class="ldapUserSearchBaseInput adminField" type="text" />
        <button class="adminButton" id="btn_ldapUserSearchBaseInput"> </button>
        </div>
        <!-- Group Base -->
        <div class="ldapGroupBaseLabel authText">Group Base:</div>
        <div class="groupOption">
        <input class="ldapGroupBaseInput adminField" type="text" />
        <button class="adminButton" id="btn_ldapGroupBaseInput" > </button>
        </div>
        
        <div style="display: none">
        <!-- This stuff is hidden but populated for save functions -->
        <input class="ldapUserSearchFilterInput" />
        
        <input class="ldapRoleBaseInput" />
        <input class="ldapRoleSearchBaseInput" />
        <input class="ldapRoleSearchFilterInput" />
        
        <input class="ldapPopulatorGroupRoleAttributeInput" />
        <input class="ldapPopulatorGroupSearchFilterInput" />
        <input class="ldapPopulatorGroupRoleSearchBaseInput" />
        <input class="ldapPopulatorRolePrefixInput" />
        <input class="ldapPopulatorSubtreeInput" name="ldapPopulatorSubtreeInput" type="radio" value="false" />
        <input class="ldapPopulatorUpperCaseInput" name="ldapPopulatorUpperCaseInput" type="radio" value="false" />
        </div>
        </div>
        
        <div id="ldapMicrosoftConfiguration" class="microsoftConfigPanel configuration" style="display: none;">
        <div class="ldapUserBaseLabel authText">User Base:</div>
        <div class="groupOption">
        <input class="ldapUserSearchBaseInput adminField" type="text"  />
        <button class="adminButton" id="btn_ldapUserSearchBaseInput2" > </button>
        </div>
        
        <div class="ldapGroupBaseLabel authText">Group Base:</div>
        <div class="groupOption">
        <input class="ldapGroupBaseInput adminField" type="text"  />
        <button class="adminButton" id="btn_ldapGroupBaseInput2"> </button>
        </div>
        
        <div style="display: none">
        <!-- This stuff is hidden but populated for test and save functions -->
        <input class="ldapUserSearchFilterInput" />
        
        <input class="ldapRoleBaseInput" />
        <input class="ldapRoleSearchBaseInput" />
        <input class="ldapRoleSearchFilterInput" />
        
        <input class="ldapPopulatorGroupRoleAttributeInput" />
        <input class="ldapPopulatorGroupSearchFilterInput" />
        <input class="ldapPopulatorGroupRoleSearchBaseInput" />
        <input class="ldapPopulatorRolePrefixInput" />
        <input class="ldapPopulatorSubtreeInput" name="ldapPopulatorSubtreeInput" type="radio" value="false" />
        <input class="ldapPopulatorUpperCaseInput" name="ldapPopulatorUpperCaseInput" type="radio" value="false" />
        </div>
        </div>
        
        <!-- ldap custom configuration -->
        <div id="ldapCustomConfiguration" class="ldapCustomConfiguration configuration" style="display: none;">
        <!-- user search configuration -->
        <br/>
        <span class="ldapCustomUserSearchTitle authMethod">User Search</span>
        <br/>
        <div>
        <div class="ldapUserSearchBaseLabel authText">Search Base:</div>
        <input class="ldapUserSearchBaseInput adminField" type="text"  />
        
        <div class="ldapUserSearchFilderLabel authText">Search Filter:</div>
        <input class="ldapUserSearchFilterInput adminField" type="text"  />
        
        <br/> <br/>
        
        <div class="securityConfigButton">
        <button class="pentaho-button test-button" id="btn_showLdapUserTestDialog"> </button>
        </div>
        </div>
        <br/> <br/>
        <!-- roles configuration -->
        <span class="ldapRolesTitle authMethod">Roles</span>
        <br/>
        <div>
        <div class="ldapRoleBaseLabel authText">Role Attribute:</div>
        <input class="ldapRoleBaseInput adminField" type="text"  />
        
        <div class="ldapRoleSearchFilterLabel authText">Role Search Filter:</div>
        <input class="ldapRoleSearchFilterInput adminField" type="text"  />
        
        <div class="ldapRoleSearchBaseLabel authText">Role Search Base:</div>
        <input class="ldapRoleSearchBaseInput adminField" type="text"  />
        
        <br/> <br/>
        
        <div class="securityConfigButton">
        <button class="pentaho-button test-button" id="btn_testAuthoritiesSearch"> </button>
        </div>
        </div>
        <br/> <br/>
        <span class="ldapPopulatorTitle authMethod">Populator</span>
        <br/>
        <div>
        <div class="ldapPopulatorGroupRoleAttributeLabel authText">Group Role Attribute:</div>
        <input class="ldapPopulatorGroupRoleAttributeInput adminField" type="text"  />
        
        <div class="ldapPopulatorGroupRoleSearchBaseLabel authText">Group Search Base:</div>
        <input class="ldapPopulatorGroupRoleSearchBaseInput adminField" type="text"  />
        
        <div class="ldapPopulatorGroupSearchFilterLabel authText">Group Search Filter:</div>
        <input class="ldapPopulatorGroupSearchFilterInput adminField" type="text"  />
        
        <div class="ldapPopulatorRolePrefixLabel authText">Role Prefix:</div>
        <input  class="ldapPopulatorRolePrefixInput adminField" type="text"  />
        
        <div class="ldapPopulatorUpperCaseLabel authText">Convert To Upper Case:</div>
        <div class="ldapPopulatorUpperCaseDescription groupOption">
        <input name="ldapPopulatorUpperCaseInput" class="ldapPopulatorUpperCaseInput" type="radio" value="true" />
        <label class="yes-button">Yes</label>
        <input name="ldapPopulatorUpperCaseInput" class="ldapPopulatorUpperCaseInput" type="radio" checked="checked" value="false" />
        <label class="no-button">No</label>
        </div>
        <div class="ldapPopulatorSubtreeLabel authText">Subtree:</div>
        <div class="ldapPopulatorSubtreeDescription groupOption">
        <input name="ldapPopulatorSubtreeInput" class="ldapPopulatorSubtreeInput" type="radio" value="true" />
        <label class="yes-button">Yes</label>
        <input name="ldapPopulatorSubtreeInput" class="ldapPopulatorSubtreeInput" type="radio" checked="checked" value="false" />
        <label class="no-button">No</label>
        </div>
        <br/>
        <div class="securityConfigButton">
        <button class="pentaho-button test-button" id="btn_showPopulatorTestDialog"> </button>
        </div>
        </div>
        </div>
        </div>
        </div>
        </div>
        </div>
        
        
        <footer>
        <br/><br/>
        <div id="buttonDivSave" class="securityConfigButton" style="display: none;">
        <button id="saveConfigButton" class="pentaho-button" >Save</button>
        </div>
        </footer>
        </body>
        </html>
         
        Throws:
        org.pentaho.platform.api.engine.ObjectFactoryException
        org.pentaho.platform.api.engine.PluginBeanException
        IOException
        URISyntaxException
      • getExecutableTypes

        public javax.ws.rs.core.Response getExecutableTypes()
        Retrieves the list of supported content type in the platform
        Returns:
        list of ExecutableFileTypeDto
      • doService

        protected javax.ws.rs.core.Response doService​(String contextId,
                                                      String resourceId)
                                               throws org.pentaho.platform.api.engine.ObjectFactoryException,
                                                      org.pentaho.platform.api.engine.PluginBeanException,
                                                      IOException,
                                                      URISyntaxException
        Throws:
        org.pentaho.platform.api.engine.ObjectFactoryException
        org.pentaho.platform.api.engine.PluginBeanException
        IOException
        URISyntaxException
      • getContentGeneratorResponse

        protected javax.ws.rs.core.Response getContentGeneratorResponse​(org.pentaho.platform.web.http.api.resources.RepositoryResource.CGFactory fac)
      • extractUrl

        protected String extractUrl​(org.pentaho.platform.api.repository2.unified.RepositoryFile file)
      • getWhitelist

        public org.pentaho.platform.repository.RepositoryDownloadWhitelist getWhitelist()
      • setWhitelist

        public void setWhitelist​(org.pentaho.platform.repository.RepositoryDownloadWhitelist whitelist)