[ 
https://issues.apache.org/jira/browse/NIFI-4224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118895#comment-16118895
 ] 

ASF GitHub Bot commented on NIFI-4224:
--------------------------------------

Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2051#discussion_r131983295
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
 ---
    @@ -3062,34 +3206,70 @@ public ProcessGroupEntity getProcessGroup(final 
String groupId) {
             return createProcessGroupEntity(processGroup);
         }
     
    -    private ControllerServiceEntity createControllerServiceEntity(final 
ControllerServiceNode serviceNode, final Set<String> serviceIds) {
    +    private ControllerServiceEntity createControllerServiceEntity(final 
ControllerServiceNode serviceNode, final Set<String> serviceIds, final NiFiUser 
user) {
             final ControllerServiceDTO dto = 
dtoFactory.createControllerServiceDto(serviceNode);
     
             final ControllerServiceReference ref = serviceNode.getReferences();
             final ControllerServiceReferencingComponentsEntity 
referencingComponentsEntity = 
createControllerServiceReferencingComponentsEntity(ref, serviceIds);
             
dto.setReferencingComponents(referencingComponentsEntity.getControllerServiceReferencingComponents());
     
             final RevisionDTO revision = 
dtoFactory.createRevisionDTO(revisionManager.getRevision(serviceNode.getIdentifier()));
    -        final PermissionsDTO permissions = 
dtoFactory.createPermissionsDto(serviceNode);
    +        final PermissionsDTO permissions = 
dtoFactory.createPermissionsDto(serviceNode, user);
             final List<BulletinDTO> bulletins = 
dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(serviceNode.getIdentifier()));
             final List<BulletinEntity> bulletinEntities = 
bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, 
permissions.getCanRead())).collect(Collectors.toList());
             return entityFactory.createControllerServiceEntity(dto, revision, 
permissions, bulletinEntities);
         }
     
         @Override
    -    public Set<ControllerServiceEntity> getControllerServices(final String 
groupId) {
    -        final Set<ControllerServiceNode> serviceNodes = 
controllerServiceDAO.getControllerServices(groupId);
    +    public VariableRegistryEntity getVariableRegistry(final String 
groupId) {
    +        final ProcessGroup processGroup = 
processGroupDAO.getProcessGroup(groupId);
    +        if (processGroup == null) {
    +            throw new ResourceNotFoundException("Could not find group with 
ID " + groupId);
    +        }
    +
    +        return createVariableRegistryEntity(processGroup);
    +    }
    +
    +    private VariableRegistryEntity createVariableRegistryEntity(final 
ProcessGroup processGroup) {
    +        final VariableRegistryDTO registryDto = 
dtoFactory.createVariableRegistryDto(processGroup);
    +        final RevisionDTO revision = 
dtoFactory.createRevisionDTO(revisionManager.getRevision(processGroup.getIdentifier()));
    +        final PermissionsDTO permissions = 
dtoFactory.createPermissionsDto(processGroup);
    +        return entityFactory.createVariableRegistryEntity(registryDto, 
revision, permissions);
    +    }
    +
    +    @Override
    +    public VariableRegistryEntity populateAffectedComponents(final 
VariableRegistryDTO variableRegistryDto) {
    --- End diff --
    
    `NiFiServiceFacadeLock` handles read/write locking based on the method 
name. Assuming this method needs that thread safety, the name of this method 
needs to be accounted for. Either by changing it here or adding another advice 
to intercept this method call.


> Add Variable Registry at Process Group level
> --------------------------------------------
>
>                 Key: NIFI-4224
>                 URL: https://issues.apache.org/jira/browse/NIFI-4224
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Core Framework
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>
> Currently, NiFi exposes a variable registry that is configurable by adding 
> the name of a properties file to nifi.properties and then treating the 
> referenced properties file as key/value pairs for the variable registry. 
> This, however, is very limiting, as it provides a global scope for all 
> variables, and it requires a restart of NiFi in order to pick up any updates 
> to the file. We should expose a Process Group-level Variable Registry.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to