NIFI-1554: - Populating component entities in the REST API to decouple key fields from the configuration DTOs. - Added initial support for components in UI when access isn't allowed. Formal styling to come later.
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/ff98d823 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/ff98d823 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/ff98d823 Branch: refs/heads/master Commit: ff98d823e20f5042dfbb05d9f8efda0daf3d3ba4 Parents: a4409d3 Author: Matt Gilman <[email protected]> Authored: Fri Apr 29 14:49:13 2016 -0400 Committer: Matt Gilman <[email protected]> Committed: Fri Apr 29 14:49:14 2016 -0400 ---------------------------------------------------------------------- .../org/apache/nifi/authorization/Resource.java | 2 +- .../nifi-framework/nifi-administration/pom.xml | 38 - .../authorization/AuthorizerFactoryBean.java | 342 --------- .../StandardAuthorizerConfigurationContext.java | 54 -- ...StandardAuthorizerInitializationContext.java | 41 -- .../java/org/apache/nifi/user/NiFiUser.java | 97 --- .../org/apache/nifi/user/NiFiUserGroup.java | 2 + .../resources/nifi-administration-context.xml | 5 - .../src/main/xsd/authorizers.xsd | 49 -- .../nifi/web/api/dto/AccessPolicyDTO.java | 62 ++ .../apache/nifi/web/api/dto/ComponentDTO.java | 94 +++ .../apache/nifi/web/api/dto/ConnectionDTO.java | 2 +- .../nifi/web/api/dto/ControllerServiceDTO.java | 2 +- .../apache/nifi/web/api/dto/DimensionsDTO.java | 61 ++ .../org/apache/nifi/web/api/dto/FunnelDTO.java | 2 +- .../org/apache/nifi/web/api/dto/LabelDTO.java | 2 +- .../nifi/web/api/dto/NiFiComponentDTO.java | 106 --- .../org/apache/nifi/web/api/dto/PortDTO.java | 2 +- .../nifi/web/api/dto/ProcessGroupDTO.java | 20 +- .../apache/nifi/web/api/dto/ProcessorDTO.java | 2 +- .../nifi/web/api/dto/RemoteProcessGroupDTO.java | 2 +- .../nifi/web/api/dto/ReportingTaskDTO.java | 2 +- .../org/apache/nifi/web/api/dto/SnippetDTO.java | 19 +- .../web/api/dto/flow/FlowBreadcrumbDTO.java | 80 +++ .../apache/nifi/web/api/dto/flow/FlowDTO.java | 174 +++++ .../web/api/dto/flow/ProcessGroupFlowDTO.java | 112 +++ .../nifi/web/api/entity/ComponentEntity.java | 119 ++++ .../nifi/web/api/entity/ConnectionEntity.java | 107 ++- .../nifi/web/api/entity/ConnectionsEntity.java | 14 +- .../web/api/entity/ControllerServiceEntity.java | 2 +- .../org/apache/nifi/web/api/entity/Entity.java | 5 +- .../apache/nifi/web/api/entity/FlowEntity.java | 44 ++ .../nifi/web/api/entity/FunnelEntity.java | 12 +- .../nifi/web/api/entity/FunnelsEntity.java | 14 +- .../nifi/web/api/entity/InputPortEntity.java | 41 -- .../nifi/web/api/entity/InputPortsEntity.java | 14 +- .../apache/nifi/web/api/entity/LabelEntity.java | 29 +- .../nifi/web/api/entity/LabelsEntity.java | 14 +- .../nifi/web/api/entity/OutputPortEntity.java | 41 -- .../nifi/web/api/entity/OutputPortsEntity.java | 14 +- .../apache/nifi/web/api/entity/PortEntity.java | 50 ++ .../nifi/web/api/entity/ProcessGroupEntity.java | 12 +- .../web/api/entity/ProcessGroupFlowEntity.java | 44 ++ .../web/api/entity/ProcessGroupsEntity.java | 15 +- .../nifi/web/api/entity/ProcessorEntity.java | 15 +- .../nifi/web/api/entity/ProcessorsEntity.java | 14 +- .../api/entity/RemoteProcessGroupEntity.java | 12 +- .../api/entity/RemoteProcessGroupsEntity.java | 14 +- .../src/main/xsd/authorizations.xsd | 1 - .../nifi-framework-authorization/pom.xml | 59 +- .../authorization/AccessDeniedException.java | 39 ++ .../authorization/AuthorizerFactoryBean.java | 341 +++++++++ .../StandardAuthorizerConfigurationContext.java | 54 ++ ...StandardAuthorizerInitializationContext.java | 41 ++ .../authorization/resource/Authorizable.java | 129 ++++ .../authorization/resource/ResourceFactory.java | 1 - .../authorization/resource/ResourceType.java | 1 + .../nifi/authorization/user/NiFiUser.java | 97 +++ .../authorization/user/NiFiUserDetails.java | 91 +++ .../nifi/authorization/user/NiFiUserUtils.java | 59 ++ .../nifi-framework-authorization-context.xml | 26 + .../src/main/xsd/authorizers.xsd | 49 ++ .../cluster/manager/impl/WebClusterManager.java | 42 +- .../nifi-framework-core-api/pom.xml | 4 + .../apache/nifi/connectable/Connectable.java | 3 +- .../org/apache/nifi/connectable/Connection.java | 3 +- .../apache/nifi/controller/AbstractPort.java | 48 +- .../apache/nifi/controller/ProcessorNode.java | 14 +- .../apache/nifi/controller/StandardFunnel.java | 49 +- .../org/apache/nifi/controller/label/Label.java | 3 +- .../org/apache/nifi/groups/ProcessGroup.java | 3 +- .../apache/nifi/groups/RemoteProcessGroup.java | 3 +- .../nifi/connectable/StandardConnection.java | 48 +- .../nifi/controller/StandardProcessorNode.java | 60 +- .../nifi/controller/label/StandardLabel.java | 23 +- .../nifi/fingerprint/FingerprintFactory.java | 6 +- .../nifi/groups/StandardProcessGroup.java | 42 +- .../nifi/remote/StandardRemoteProcessGroup.java | 70 +- .../java/org/apache/nifi/util/SnippetUtils.java | 22 +- .../controller/StandardFlowServiceTest.java | 1 - .../zookeeper/TestZooKeeperStateProvider.java | 13 +- .../nifi/remote/StandardRemoteGroupPort.java | 6 + .../nifi/audit/ComponentStateAuditor.java | 4 +- .../apache/nifi/audit/ControllerAuditor.java | 4 +- .../nifi/audit/ControllerServiceAuditor.java | 4 +- .../org/apache/nifi/audit/FunnelAuditor.java | 4 +- .../java/org/apache/nifi/audit/PortAuditor.java | 4 +- .../apache/nifi/audit/ProcessGroupAuditor.java | 4 +- .../org/apache/nifi/audit/ProcessorAuditor.java | 4 +- .../apache/nifi/audit/RelationshipAuditor.java | 4 +- .../nifi/audit/RemoteProcessGroupAuditor.java | 4 +- .../apache/nifi/audit/ReportingTaskAuditor.java | 4 +- .../org/apache/nifi/audit/SnippetAuditor.java | 4 +- .../org/apache/nifi/web/NiFiServiceFacade.java | 107 +-- .../nifi/web/NiFiWebApiConfiguration.java | 1 + .../nifi/web/StandardNiFiContentAccess.java | 4 +- .../nifi/web/StandardNiFiServiceFacade.java | 584 +++++++++++----- .../StandardNiFiWebConfigurationContext.java | 18 +- .../apache/nifi/web/StandardNiFiWebContext.java | 16 +- .../java/org/apache/nifi/web/UpdateResult.java | 40 ++ .../org/apache/nifi/web/api/AccessResource.java | 6 +- .../nifi/web/api/ApplicationResource.java | 2 +- .../apache/nifi/web/api/ClusterResource.java | 223 ------ .../apache/nifi/web/api/ConnectionResource.java | 83 +-- .../apache/nifi/web/api/ControllerResource.java | 4 +- .../nifi/web/api/ControllerServiceResource.java | 50 -- .../org/apache/nifi/web/api/FlowResource.java | 257 ++++++- .../org/apache/nifi/web/api/FunnelResource.java | 84 +-- .../apache/nifi/web/api/InputPortResource.java | 92 ++- .../org/apache/nifi/web/api/LabelResource.java | 84 +-- .../apache/nifi/web/api/OutputPortResource.java | 92 ++- .../nifi/web/api/ProcessGroupResource.java | 668 ++++++------------ .../apache/nifi/web/api/ProcessorResource.java | 102 ++- .../web/api/RemoteProcessGroupResource.java | 88 ++- .../apache/nifi/web/api/TemplateResource.java | 8 - .../api/config/AccessDeniedExceptionMapper.java | 7 +- .../org/apache/nifi/web/api/dto/DtoFactory.java | 171 ++++- .../apache/nifi/web/api/dto/EntityFactory.java | 155 +++++ .../nifi/web/controller/ControllerFacade.java | 17 +- .../org/apache/nifi/web/dao/TemplateDAO.java | 3 +- .../web/dao/impl/StandardConnectionDAO.java | 19 +- .../apache/nifi/web/filter/RequestLogger.java | 4 +- .../src/main/resources/nifi-web-api-context.xml | 20 +- .../apache/nifi/integration/NiFiWebApiTest.java | 30 +- .../accesscontrol/AccessTokenEndpointTest.java | 4 +- .../accesscontrol/AdminAccessControlTest.java | 22 +- .../accesscontrol/DfmAccessControlTest.java | 144 ++-- .../ReadOnlyAccessControlTest.java | 20 +- .../nifi-web/nifi-web-content-viewer/pom.xml | 5 + .../nifi/web/ContentViewerController.java | 2 +- .../web/StandardOptimisticLockingManager.java | 3 +- .../nifi-web/nifi-web-security/pom.xml | 4 + .../web/security/NiFiAuthenticationFilter.java | 2 +- .../nifi/web/security/ProxiedEntitiesUtils.java | 2 +- .../anonymous/NiFiAnonymousUserFilter.java | 5 +- .../security/jwt/JwtAuthenticationProvider.java | 4 +- .../security/node/NodeAuthorizedUserFilter.java | 5 +- .../security/otp/OtpAuthenticationProvider.java | 4 +- .../nifi/web/security/user/NiFiUserDetails.java | 92 --- .../nifi/web/security/user/NiFiUserUtils.java | 89 --- .../x509/X509AuthenticationProvider.java | 33 +- .../resources/nifi-web-security-context.xml | 3 +- .../otp/OtpAuthenticationProviderTest.java | 2 +- .../controllers/nf-ng-breadcrumbs-controller.js | 12 +- .../src/main/webapp/js/nf/canvas/nf-actions.js | 171 ++--- .../src/main/webapp/js/nf/canvas/nf-birdseye.js | 28 +- .../webapp/js/nf/canvas/nf-canvas-header.js | 20 +- .../webapp/js/nf/canvas/nf-canvas-toolbar.js | 93 +-- .../webapp/js/nf/canvas/nf-canvas-toolbox.js | 50 +- .../main/webapp/js/nf/canvas/nf-canvas-utils.js | 118 ++-- .../src/main/webapp/js/nf/canvas/nf-canvas.js | 29 +- .../main/webapp/js/nf/canvas/nf-connectable.js | 10 +- .../js/nf/canvas/nf-connection-configuration.js | 66 +- .../main/webapp/js/nf/canvas/nf-connection.js | 664 +++++++++--------- .../main/webapp/js/nf/canvas/nf-context-menu.js | 115 ++- .../main/webapp/js/nf/canvas/nf-draggable.js | 62 +- .../src/main/webapp/js/nf/canvas/nf-funnel.js | 62 +- .../src/main/webapp/js/nf/canvas/nf-go-to.js | 24 +- .../js/nf/canvas/nf-label-configuration.js | 6 +- .../src/main/webapp/js/nf/canvas/nf-label.js | 270 +++----- .../js/nf/canvas/nf-port-configuration.js | 17 +- .../main/webapp/js/nf/canvas/nf-port-details.js | 2 +- .../src/main/webapp/js/nf/canvas/nf-port.js | 228 +++--- .../nf/canvas/nf-process-group-configuration.js | 8 +- .../js/nf/canvas/nf-process-group-details.js | 2 +- .../webapp/js/nf/canvas/nf-process-group.js | 691 +++++++++---------- .../js/nf/canvas/nf-processor-configuration.js | 16 +- .../main/webapp/js/nf/canvas/nf-processor.js | 270 ++++---- .../webapp/js/nf/canvas/nf-queue-listing.js | 2 +- .../nf-remote-process-group-configuration.js | 8 +- .../canvas/nf-remote-process-group-details.js | 2 +- .../nf/canvas/nf-remote-process-group-ports.js | 10 +- .../js/nf/canvas/nf-remote-process-group.js | 689 +++++++++--------- .../src/main/webapp/js/nf/canvas/nf-snippet.js | 16 +- .../main/webapp/js/nf/nf-connection-details.js | 16 +- .../main/webapp/js/nf/nf-processor-details.js | 4 +- .../views/nf-ng-breadcrumbs-directive-view.html | 2 +- 177 files changed, 6082 insertions(+), 4700 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-api/src/main/java/org/apache/nifi/authorization/Resource.java ---------------------------------------------------------------------- diff --git a/nifi-api/src/main/java/org/apache/nifi/authorization/Resource.java b/nifi-api/src/main/java/org/apache/nifi/authorization/Resource.java index 7756bda..661b326 100644 --- a/nifi-api/src/main/java/org/apache/nifi/authorization/Resource.java +++ b/nifi-api/src/main/java/org/apache/nifi/authorization/Resource.java @@ -29,7 +29,7 @@ public interface Resource { String getIdentifier(); /** - * The name of this resource. + * The name of this resource. May be null. * * @return name of this resource */ http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml index c9a9c0e..2aac209 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/pom.xml @@ -21,40 +21,6 @@ <version>1.0.0-SNAPSHOT</version> </parent> <artifactId>nifi-administration</artifactId> - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/main/xsd</directory> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jaxb2-maven-plugin</artifactId> - <executions> - <execution> - <id>current</id> - <goals> - <goal>xjc</goal> - </goals> - <configuration> - <packageName>org.apache.nifi.authorization.generated</packageName> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <configuration> - <excludes>**/authorization/generated/*.java,</excludes> - </configuration> - </plugin> - </plugins> - </build> <dependencies> <dependency> <groupId>org.apache.nifi</groupId> @@ -116,9 +82,5 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-expression-language</artifactId> - </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java deleted file mode 100644 index 3d3e826..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.authorization; - -import org.apache.commons.lang3.StringUtils; -import org.apache.nifi.authorization.annotation.AuthorizerContext; -import org.apache.nifi.authorization.exception.AuthorizationAccessException; -import org.apache.nifi.authorization.exception.AuthorizerCreationException; -import org.apache.nifi.authorization.exception.AuthorizerDestructionException; -import org.apache.nifi.authorization.generated.Authorizers; -import org.apache.nifi.authorization.generated.Property; -import org.apache.nifi.nar.ExtensionManager; -import org.apache.nifi.nar.NarCloseable; -import org.apache.nifi.util.NiFiProperties; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.FactoryBean; -import org.xml.sax.SAXException; - -import javax.xml.XMLConstants; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -/** - * Factory bean for loading the configured authorizer. - */ -public class AuthorizerFactoryBean implements FactoryBean, DisposableBean, AuthorizerLookup { - - private static final Logger logger = LoggerFactory.getLogger(AuthorizerFactoryBean.class); - private static final String AUTHORIZERS_XSD = "/authorizers.xsd"; - private static final String JAXB_GENERATED_PATH = "org.apache.nifi.authorization.generated"; - private static final JAXBContext JAXB_CONTEXT = initializeJaxbContext(); - - /** - * Load the JAXBContext. - */ - private static JAXBContext initializeJaxbContext() { - try { - return JAXBContext.newInstance(JAXB_GENERATED_PATH, AuthorizerFactoryBean.class.getClassLoader()); - } catch (JAXBException e) { - throw new RuntimeException("Unable to create JAXBContext."); - } - } - - private Authorizer authorizer; - private NiFiProperties properties; - private final Map<String, Authorizer> authorizers = new HashMap<>(); - - @Override - public Authorizer getAuthorizer(String identifier) { - return authorizers.get(identifier); - } - - @Override - public Object getObject() throws Exception { - if (authorizer == null) { - // look up the authorizer to use - final String authorizerIdentifier = properties.getProperty(NiFiProperties.SECURITY_USER_AUTHORIZER); - - // ensure the authorizer class name was specified - if (StringUtils.isBlank(authorizerIdentifier)) { - // if configured for ssl, the authorizer must be specified - if (properties.getSslPort() != null) { - throw new Exception("When running securely, the authorizer identifier must be specified in the nifi properties file."); - } - - // use a default authorizer... only allowable when running not securely - authorizer = createDefaultAuthorizer(); - } else { - final Authorizers authorizerConfiguration = loadAuthorizersConfiguration(); - - // create each authorizer - for (final org.apache.nifi.authorization.generated.Authorizer authorizer : authorizerConfiguration.getAuthorizer()) { - authorizers.put(authorizer.getIdentifier(), createAuthorizer(authorizer.getIdentifier(), authorizer.getClazz())); - } - - // configure each authorizer - for (final org.apache.nifi.authorization.generated.Authorizer provider : authorizerConfiguration.getAuthorizer()) { - final Authorizer instance = authorizers.get(provider.getIdentifier()); - instance.onConfigured(loadAuthorizerConfiguration(provider)); - } - - // get the authorizer instance - authorizer = getAuthorizer(authorizerIdentifier); - - // ensure it was found - if (authorizer == null) { - throw new Exception(String.format("The specified authorizer '%s' could not be found.", authorizerIdentifier)); - } - } - } - - return authorizer; - } - - private Authorizers loadAuthorizersConfiguration() throws Exception { - final File authorizersConfigurationFile = properties.getAuthorizerConfiguraitonFile(); - - // load the authorizers from the specified file - if (authorizersConfigurationFile.exists()) { - try { - // find the schema - final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - final Schema schema = schemaFactory.newSchema(Authorizers.class.getResource(AUTHORIZERS_XSD)); - - // attempt to unmarshal - final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller(); - unmarshaller.setSchema(schema); - final JAXBElement<Authorizers> element = unmarshaller.unmarshal(new StreamSource(authorizersConfigurationFile), Authorizers.class); - return element.getValue(); - } catch (SAXException | JAXBException e) { - throw new Exception("Unable to load the authorizer configuration file at: " + authorizersConfigurationFile.getAbsolutePath(), e); - } - } else { - throw new Exception("Unable to find the authorizer configuration file at " + authorizersConfigurationFile.getAbsolutePath()); - } - } - - private Authorizer createAuthorizer(final String identifier, final String authorizerClassName) throws Exception { - // get the classloader for the specified authorizer - final ClassLoader authorizerClassLoader = ExtensionManager.getClassLoader(authorizerClassName); - if (authorizerClassLoader == null) { - throw new Exception(String.format("The specified authorizer class '%s' is not known to this nifi.", authorizerClassName)); - } - - // get the current context classloader - final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); - - final Authorizer instance; - try { - // set the appropriate class loader - Thread.currentThread().setContextClassLoader(authorizerClassLoader); - - // attempt to load the class - Class<?> rawAuthorizerClass = Class.forName(authorizerClassName, true, authorizerClassLoader); - Class<? extends Authorizer> authorizerClass = rawAuthorizerClass.asSubclass(Authorizer.class); - - // otherwise create a new instance - Constructor constructor = authorizerClass.getConstructor(); - instance = (Authorizer) constructor.newInstance(); - - // method injection - performMethodInjection(instance, authorizerClass); - - // field injection - performFieldInjection(instance, authorizerClass); - - // call post construction lifecycle event - instance.initialize(new StandardAuthorizerInitializationContext(identifier, this)); - } finally { - if (currentClassLoader != null) { - Thread.currentThread().setContextClassLoader(currentClassLoader); - } - } - - return withNarLoader(instance); - } - - private AuthorizerConfigurationContext loadAuthorizerConfiguration(final org.apache.nifi.authorization.generated.Authorizer authorizer) { - final Map<String, String> authorizerProperties = new HashMap<>(); - - for (final Property property : authorizer.getProperty()) { - authorizerProperties.put(property.getName(), property.getValue()); - } - - return new StandardAuthorizerConfigurationContext(authorizer.getIdentifier(), authorizerProperties); - } - - private void performMethodInjection(final Authorizer instance, final Class authorizerClass) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - for (final Method method : authorizerClass.getMethods()) { - if (method.isAnnotationPresent(AuthorizerContext.class)) { - // make the method accessible - final boolean isAccessible = method.isAccessible(); - method.setAccessible(true); - - try { - final Class<?>[] argumentTypes = method.getParameterTypes(); - - // look for setters (single argument) - if (argumentTypes.length == 1) { - final Class<?> argumentType = argumentTypes[0]; - - // look for well known types - if (NiFiProperties.class.isAssignableFrom(argumentType)) { - // nifi properties injection - method.invoke(instance, properties); - } - } - } finally { - method.setAccessible(isAccessible); - } - } - } - - final Class parentClass = authorizerClass.getSuperclass(); - if (parentClass != null && Authorizer.class.isAssignableFrom(parentClass)) { - performMethodInjection(instance, parentClass); - } - } - - private void performFieldInjection(final Authorizer instance, final Class authorizerClass) throws IllegalArgumentException, IllegalAccessException { - for (final Field field : authorizerClass.getDeclaredFields()) { - if (field.isAnnotationPresent(AuthorizerContext.class)) { - // make the method accessible - final boolean isAccessible = field.isAccessible(); - field.setAccessible(true); - - try { - // get the type - final Class<?> fieldType = field.getType(); - - // only consider this field if it isn't set yet - if (field.get(instance) == null) { - // look for well known types - if (NiFiProperties.class.isAssignableFrom(fieldType)) { - // nifi properties injection - field.set(instance, properties); - } - } - - } finally { - field.setAccessible(isAccessible); - } - } - } - - final Class parentClass = authorizerClass.getSuperclass(); - if (parentClass != null && Authorizer.class.isAssignableFrom(parentClass)) { - performFieldInjection(instance, parentClass); - } - } - - /** - * @return a default Authorizer to use when running unsecurely with no authorizer configured - */ - private Authorizer createDefaultAuthorizer() { - return new Authorizer() { - @Override - public AuthorizationResult authorize(final AuthorizationRequest request) throws AuthorizationAccessException { - return AuthorizationResult.approved(); - } - - @Override - public void initialize(AuthorizerInitializationContext initializationContext) throws AuthorizerCreationException { - } - - @Override - public void onConfigured(AuthorizerConfigurationContext configurationContext) throws AuthorizerCreationException { - } - - @Override - public void preDestruction() throws AuthorizerDestructionException { - } - }; - } - - /** - * Decorates the base authorizer to ensure the nar context classloader is used when invoking the underlying methods. - * - * @param baseAuthorizer base authorizer - * @return authorizer - */ - public Authorizer withNarLoader(final Authorizer baseAuthorizer) { - return new Authorizer() { - @Override - public AuthorizationResult authorize(final AuthorizationRequest request) throws AuthorizationAccessException { - try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) { - return baseAuthorizer.authorize(request); - } - } - - @Override - public void initialize(AuthorizerInitializationContext initializationContext) throws AuthorizerCreationException { - try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) { - baseAuthorizer.initialize(initializationContext); - } - } - - @Override - public void onConfigured(AuthorizerConfigurationContext configurationContext) throws AuthorizerCreationException { - try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) { - baseAuthorizer.onConfigured(configurationContext); - } - } - - @Override - public void preDestruction() throws AuthorizerDestructionException { - try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) { - baseAuthorizer.preDestruction(); - } - } - }; - } - - @Override - public Class getObjectType() { - return Authorizer.class; - } - - @Override - public boolean isSingleton() { - return true; - } - - @Override - public void destroy() throws Exception { - if (authorizer != null) { - authorizer.preDestruction(); - } - } - - public void setProperties(NiFiProperties properties) { - this.properties = properties; - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java deleted file mode 100644 index 3010c92..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerConfigurationContext.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.authorization; - -import org.apache.nifi.attribute.expression.language.StandardPropertyValue; -import org.apache.nifi.components.PropertyValue; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/** - * - */ -public class StandardAuthorizerConfigurationContext implements AuthorizerConfigurationContext { - - private final String identifier; - private final Map<String, String> properties; - - public StandardAuthorizerConfigurationContext(String identifier, Map<String, String> properties) { - this.identifier = identifier; - this.properties = Collections.unmodifiableMap(new HashMap<String, String>(properties)); - } - - @Override - public String getIdentifier() { - return identifier; - } - - @Override - public Map<String, String> getProperties() { - return properties; - } - - @Override - public PropertyValue getProperty(String property) { - return new StandardPropertyValue(properties.get(property), null); - } - -} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java deleted file mode 100644 index 344f49c..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/authorization/StandardAuthorizerInitializationContext.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.authorization; - -/** - * - */ -public class StandardAuthorizerInitializationContext implements AuthorizerInitializationContext { - - private final String identifier; - private final AuthorizerLookup authorizerLookup; - - public StandardAuthorizerInitializationContext(String identifier, AuthorizerLookup authorizerLookup) { - this.identifier = identifier; - this.authorizerLookup = authorizerLookup; - } - - @Override - public String getIdentifier() { - return identifier; - } - - public AuthorizerLookup getAuthorizerLookup() { - return authorizerLookup; - } - -} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUser.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUser.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUser.java deleted file mode 100644 index 3a919ba..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUser.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.user; - -import java.io.Serializable; -import java.util.Objects; - -/** - * An NiFiUser. - */ -public class NiFiUser implements Serializable { - - public static final NiFiUser ANONYMOUS = new NiFiUser("anonymous"); - - private String identity; - private String userName; - - private NiFiUser chain; - - public NiFiUser(String identity) { - this(identity, identity, null); - } - - public NiFiUser(String identity, String userName) { - this(identity, userName, null); - } - - public NiFiUser(String identity, NiFiUser chain) { - this(identity, identity, chain); - } - - public NiFiUser(String identity, String userName, NiFiUser chain) { - this.identity = identity; - this.userName = userName; - this.chain = chain; - } - - /* getters / setters */ - - public String getIdentity() { - return identity; - } - - public String getUserName() { - return userName; - } - - public NiFiUser getChain() { - return chain; - } - - public boolean isAnonymous() { - return this == ANONYMOUS; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final NiFiUser other = (NiFiUser) obj; - if (!Objects.equals(this.identity, other.identity)) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 53 * hash + Objects.hashCode(this.identity); - return hash; - } - - @Override - public String toString() { - return String.format("identity[%s], userName[%s]", getIdentity(), getUserName(), ", "); - } - -} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUserGroup.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUserGroup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUserGroup.java index 7586fd1..e4b7130 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUserGroup.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/user/NiFiUserGroup.java @@ -16,6 +16,8 @@ */ package org.apache.nifi.user; +import org.apache.nifi.authorization.user.NiFiUser; + import java.util.Set; /** http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/resources/nifi-administration-context.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/resources/nifi-administration-context.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/resources/nifi-administration-context.xml index deec073..e717686 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/resources/nifi-administration-context.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/resources/nifi-administration-context.xml @@ -18,11 +18,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> - <!-- user/entity authorizer --> - <bean id="authorizer" class="org.apache.nifi.authorization.AuthorizerFactoryBean"> - <property name="properties" ref="nifiProperties"/> - </bean> - <!-- initialize the user key data source --> <bean id="keyDataSource" class="org.apache.nifi.admin.KeyDataSourceFactoryBean" destroy-method="shutdown"> <property name="properties" ref="nifiProperties"/> http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/xsd/authorizers.xsd ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/xsd/authorizers.xsd b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/xsd/authorizers.xsd deleted file mode 100644 index 4b68b00..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/xsd/authorizers.xsd +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <!-- role --> - <xs:complexType name="Authorizer"> - <xs:sequence> - <xs:element name="identifier" type="NonEmptyStringType"/> - <xs:element name="class" type="NonEmptyStringType"/> - <xs:element name="property" type="Property" minOccurs="0" maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - - <!-- Name/Value properties--> - <xs:complexType name="Property"> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute name="name" type="NonEmptyStringType"></xs:attribute> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - - <xs:simpleType name="NonEmptyStringType"> - <xs:restriction base="xs:string"> - <xs:minLength value="1"/> - </xs:restriction> - </xs:simpleType> - - <!-- users --> - <xs:element name="authorizers"> - <xs:complexType> - <xs:sequence> - <xs:element name="authorizer" type="Authorizer" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> -</xs:schema> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java new file mode 100644 index 0000000..1564362 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/AccessPolicyDTO.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.web.api.dto; + +import com.wordnik.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlType; + +/** + * Details for the access configuration. + */ +@XmlType(name = "accessPolicy") +public class AccessPolicyDTO { + + private Boolean canRead; + private Boolean canWrite; + + /** + * @return Indicates whether the user can read a given resource. + */ + @ApiModelProperty( + value = "Indicates whether the user can read a given resource.", + readOnly = true + ) + public Boolean getCanRead() { + return canRead; + } + + public void setCanRead(Boolean canRead) { + this.canRead = canRead; + } + + /** + * @return Indicates whether the user can write a given resource. + */ + @ApiModelProperty( + value = "Indicates whether the user can write a given resource.", + readOnly = true + ) + public Boolean getCanWrite() { + return canWrite; + } + + public void setCanWrite(Boolean canWrite) { + this.canWrite = canWrite; + } + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java new file mode 100644 index 0000000..ca5e06f --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ComponentDTO.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.web.api.dto; + +import com.wordnik.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlType; + +/** + * Base class for all nifi components. + */ +@XmlType(name = "component") +public class ComponentDTO { + + private String id; + private String uri; + private String parentGroupId; + private PositionDTO position; + + /** + * The id for this component. + * + * @return The id + */ + @ApiModelProperty( + value = "The id of the component." + ) + public String getId() { + return this.id; + } + + public void setId(final String id) { + this.id = id; + } + + /** + * @return id for the parent group of this component if applicable, null otherwise + */ + @ApiModelProperty( + value = "The id of parent process group of this component if applicable." + ) + public String getParentGroupId() { + return parentGroupId; + } + + public void setParentGroupId(String parentGroupId) { + this.parentGroupId = parentGroupId; + } + + /** + * The uri for linking to this component in this NiFi. + * + * @return The uri + */ + @ApiModelProperty( + value = "The URI for futures requests to the component." + ) + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + /** + * The position of this component in the UI if applicable, null otherwise. + * + * @return The position + */ + @ApiModelProperty( + value = "The position of this component in the UI if applicable." + ) + public PositionDTO getPosition() { + return position; + } + + public void setPosition(final PositionDTO position) { + this.position = position; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java index 96da9e3..e4ea0cc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ConnectionDTO.java @@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlType; * A connection between two connectable components. */ @XmlType(name = "connection") -public class ConnectionDTO extends NiFiComponentDTO { +public class ConnectionDTO extends ComponentDTO { private ConnectableDTO source; private ConnectableDTO destination; http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java index 5d51698..f40e181 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java @@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlType; * A Controller Service that can be shared by other components */ @XmlType(name = "controllerService") -public class ControllerServiceDTO extends NiFiComponentDTO { +public class ControllerServiceDTO extends ComponentDTO { private String name; private String type; http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java new file mode 100644 index 0000000..58df0c0 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DimensionsDTO.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.web.api.dto; + +import com.wordnik.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlType; + +/** + * A position on the canvas. + */ +@XmlType(name = "dimensions") +public class DimensionsDTO { + + private Double width; + private Double height; + + /* getters / setters */ + + /** + * @return height of the label in pixels when at a 1:1 scale + */ + @ApiModelProperty( + value = "The height of the label in pixels when at a 1:1 scale." + ) + public Double getHeight() { + return height; + } + + public void setHeight(Double height) { + this.height = height; + } + + /** + * @return width of the label in pixels when at a 1:1 scale + */ + @ApiModelProperty( + value = "The width of the label in pixels when at a 1:1 scale." + ) + public Double getWidth() { + return width; + } + + public void setWidth(Double width) { + this.width = width; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FunnelDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FunnelDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FunnelDTO.java index 1240501..4687737 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FunnelDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FunnelDTO.java @@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlType; * Details of a funnel. */ @XmlType(name = "funnel") -public class FunnelDTO extends NiFiComponentDTO { +public class FunnelDTO extends ComponentDTO { public FunnelDTO() { } http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java index e9016db..063ff65 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/LabelDTO.java @@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlType; * Details of a label. */ @XmlType(name = "label") -public class LabelDTO extends NiFiComponentDTO { +public class LabelDTO extends ComponentDTO { private String label; http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java deleted file mode 100644 index e89fb5d..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/NiFiComponentDTO.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.web.api.dto; - -import com.wordnik.swagger.annotations.ApiModelProperty; -import javax.xml.bind.annotation.XmlType; - -/** - * Base class for all nifi components. - */ -@XmlType(name = "nifiComponent") -public class NiFiComponentDTO { - - private String id; - private String uri; - private PositionDTO position; - private String parentGroupId; - - public NiFiComponentDTO() { - } - - public NiFiComponentDTO(final String id) { - this.id = id; - } - - public NiFiComponentDTO(final String id, final double x, final double y) { - this.id = id; - this.position = new PositionDTO(x, y); - } - - /** - * The id for this component. - * - * @return The id - */ - @ApiModelProperty( - value = "The id of the component." - ) - public String getId() { - return this.id; - } - - public void setId(final String id) { - this.id = id; - } - - /** - * @return id for the parent group of this component if applicable, null otherwise - */ - @ApiModelProperty( - value = "The id of parent process group of this component if applicable." - ) - public String getParentGroupId() { - return parentGroupId; - } - - public void setParentGroupId(String parentGroupId) { - this.parentGroupId = parentGroupId; - } - - /** - * The uri for linking to this component in this NiFi. - * - * @return The uri - */ - @ApiModelProperty( - value = "The URI for futures requests to the component." - ) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public void setPosition(final PositionDTO position) { - this.position = position; - } - - /** - * The position of this component in the UI if applicable, null otherwise. - * - * @return The position - */ - @ApiModelProperty( - value = "The position of this component in the UI if applicable." - ) - public PositionDTO getPosition() { - return position; - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java index 489ed0c..f8e4081 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PortDTO.java @@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlType; * The details for a port within this NiFi flow. */ @XmlType(name = "port") -public class PortDTO extends NiFiComponentDTO { +public class PortDTO extends ComponentDTO { private String name; private String comments; http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java index 93c4ea9..224db57 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessGroupDTO.java @@ -23,14 +23,12 @@ import javax.xml.bind.annotation.XmlType; * The details for a process group within this NiFi flow. */ @XmlType(name = "processGroup") -public class ProcessGroupDTO extends NiFiComponentDTO { +public class ProcessGroupDTO extends ComponentDTO { private String name; private String comments; private Boolean running; - private ProcessGroupDTO parent; - private Integer runningCount; private Integer stoppedCount; private Integer invalidCount; @@ -64,22 +62,6 @@ public class ProcessGroupDTO extends NiFiComponentDTO { } /** - * This Process Group's parent - * - * @return This Process Group's parent - */ - @ApiModelProperty( - value = "The part of the process group." - ) - public ProcessGroupDTO getParent() { - return parent; - } - - public void setParent(ProcessGroupDTO parent) { - this.parent = parent; - } - - /** * @return comments for this process group */ @ApiModelProperty( http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java index b0b9daa..dbd06a3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java @@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlType; * Details for a processor within this NiFi. */ @XmlType(name = "processor") -public class ProcessorDTO extends NiFiComponentDTO { +public class ProcessorDTO extends ComponentDTO { private String name; private String type; http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java index 2e30001..b303d4d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/RemoteProcessGroupDTO.java @@ -27,7 +27,7 @@ import org.apache.nifi.web.api.dto.util.DateTimeAdapter; * Details of a remote process group in this NiFi. */ @XmlType(name = "remoteProcessGroup") -public class RemoteProcessGroupDTO extends NiFiComponentDTO { +public class RemoteProcessGroupDTO extends ComponentDTO { private String targetUri; private Boolean targetSecure; http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java index 182535d..5972ac7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java @@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlType; * Component that is capable of reporting internal NiFi state to an external service */ @XmlType(name = "reportingTask") -public class ReportingTaskDTO extends NiFiComponentDTO { +public class ReportingTaskDTO extends ComponentDTO { private String name; private String type; http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java index 431df17..bf5d319 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/SnippetDTO.java @@ -17,9 +17,10 @@ package org.apache.nifi.web.api.dto; import com.wordnik.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlType; import java.util.HashSet; import java.util.Set; -import javax.xml.bind.annotation.XmlType; /** * The contents of a snippet of a flow. @@ -42,8 +43,6 @@ public class SnippetDTO { private Set<String> labels = new HashSet<>(); private Set<String> funnels = new HashSet<>(); - private FlowSnippetDTO contents; - /** * @return id of this snippet */ @@ -230,18 +229,4 @@ public class SnippetDTO { this.remoteProcessGroups = remoteProcessGroups; } - /** - * @return the contents of the configuration for this snippet - */ - @ApiModelProperty( - value = "The contents of the configuration for the snippet." - ) - public FlowSnippetDTO getContents() { - return contents; - } - - public void setContents(FlowSnippetDTO contents) { - this.contents = contents; - } - } http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java new file mode 100644 index 0000000..afdfb64 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowBreadcrumbDTO.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.web.api.dto.flow; + +import com.wordnik.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlType; + +/** + * Breadcrumb for the flow. + */ +@XmlType(name = "flowBreadcrumb") +public class FlowBreadcrumbDTO { + + private String id; + private String name; + private FlowBreadcrumbDTO parentBreadcrumb; + + /** + * The id for this group. + * + * @return The id + */ + @ApiModelProperty( + value = "The id of the group." + ) + public String getId() { + return this.id; + } + + public void setId(final String id) { + this.id = id; + } + + /** + * The name for this group. + * + * @return The name + */ + @ApiModelProperty( + value = "The id of the group." + ) + public String getName() { + return this.name; + } + + public void setName(final String name) { + this.name = name; + } + + /** + * The parent breadcrumb for this breadcrumb. + * + * @return The parent breadcrumb for this breadcrumb + */ + @ApiModelProperty( + value = "The parent breadcrumb for this breadcrumb." + ) + public FlowBreadcrumbDTO getParentBreadcrumb() { + return parentBreadcrumb; + } + + public void setParentBreadcrumb(FlowBreadcrumbDTO parentBreadcrumb) { + this.parentBreadcrumb = parentBreadcrumb; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java new file mode 100644 index 0000000..a3a3ae7 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/FlowDTO.java @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.web.api.dto.flow; + +import com.wordnik.swagger.annotations.ApiModelProperty; +import org.apache.nifi.web.api.entity.ConnectionEntity; +import org.apache.nifi.web.api.entity.ControllerServiceEntity; +import org.apache.nifi.web.api.entity.FunnelEntity; +import org.apache.nifi.web.api.entity.LabelEntity; +import org.apache.nifi.web.api.entity.PortEntity; +import org.apache.nifi.web.api.entity.ProcessGroupEntity; +import org.apache.nifi.web.api.entity.ProcessorEntity; +import org.apache.nifi.web.api.entity.RemoteProcessGroupEntity; + +import javax.xml.bind.annotation.XmlType; +import java.util.LinkedHashSet; +import java.util.Set; + +/** + * The structure of the flow. + */ +@XmlType(name = "flow") +public class FlowDTO { + + private Set<ProcessGroupEntity> processGroups = new LinkedHashSet<>(); + private Set<RemoteProcessGroupEntity> remoteProcessGroups = new LinkedHashSet<>(); + private Set<ProcessorEntity> processors = new LinkedHashSet<>(); + private Set<PortEntity> inputPorts = new LinkedHashSet<>(); + private Set<PortEntity> outputPorts = new LinkedHashSet<>(); + private Set<ConnectionEntity> connections = new LinkedHashSet<>(); + private Set<LabelEntity> labels = new LinkedHashSet<>(); + private Set<FunnelEntity> funnels = new LinkedHashSet<>(); + private Set<ControllerServiceEntity> controllerServices = new LinkedHashSet<>(); + + /** + * @return connections in this flow + */ + @ApiModelProperty( + value = "The connections in this flow." + ) + public Set<ConnectionEntity> getConnections() { + return connections; + } + + public void setConnections(Set<ConnectionEntity> connections) { + this.connections = connections; + } + + /** + * @return input ports in this flow + */ + @ApiModelProperty( + value = "The input ports in this flow." + ) + public Set<PortEntity> getInputPorts() { + return inputPorts; + } + + public void setInputPorts(Set<PortEntity> inputPorts) { + this.inputPorts = inputPorts; + } + + /** + * @return labels in this flow + */ + @ApiModelProperty( + value = "The labels in this flow." + ) + public Set<LabelEntity> getLabels() { + return labels; + } + + public void setLabels(Set<LabelEntity> labels) { + this.labels = labels; + } + + /** + * @return funnels in this flow + */ + @ApiModelProperty( + value = "The funnels in this flow." + ) + public Set<FunnelEntity> getFunnels() { + return funnels; + } + + public void setFunnels(Set<FunnelEntity> funnels) { + this.funnels = funnels; + } + + /** + * @return output ports in this flow + */ + @ApiModelProperty( + value = "The output ports in this flow." + ) + public Set<PortEntity> getOutputPorts() { + return outputPorts; + } + + public void setOutputPorts(Set<PortEntity> outputPorts) { + this.outputPorts = outputPorts; + } + + /** + * @return process groups in this flow + */ + @ApiModelProperty( + value = "The process groups in this flow." + ) + public Set<ProcessGroupEntity> getProcessGroups() { + return processGroups; + } + + public void setProcessGroups(Set<ProcessGroupEntity> processGroups) { + this.processGroups = processGroups; + } + + /** + * @return processors in this flow + */ + @ApiModelProperty( + value = "The processors in this flow." + ) + public Set<ProcessorEntity> getProcessors() { + return processors; + } + + public void setProcessors(Set<ProcessorEntity> processors) { + this.processors = processors; + } + + /** + * @return remote process groups in this flow + */ + @ApiModelProperty( + value = "The remote process groups in this flow." + ) + public Set<RemoteProcessGroupEntity> getRemoteProcessGroups() { + return remoteProcessGroups; + } + + public void setRemoteProcessGroups(Set<RemoteProcessGroupEntity> remoteProcessGroups) { + this.remoteProcessGroups = remoteProcessGroups; + } + + /** + * @return the Controller Services in this flow + */ + @ApiModelProperty( + value = "The controller services in this flow." + ) + public Set<ControllerServiceEntity> getControllerServices() { + return controllerServices; + } + + public void setControllerServices(Set<ControllerServiceEntity> controllerServices) { + this.controllerServices = controllerServices; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java new file mode 100644 index 0000000..b651efc --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/flow/ProcessGroupFlowDTO.java @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.web.api.dto.flow; + +import com.wordnik.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlType; + +/** + * The NiFi flow starting at a given Process Group. + */ +@XmlType(name = "processGroupflow") +public class ProcessGroupFlowDTO { + + private String id; + private String uri; + private String parentGroupId; + private FlowBreadcrumbDTO breadcrumb; + private FlowDTO flow; + + /** + * @return contents of this process group. This field will be populated if the request is marked verbose + */ + @ApiModelProperty( + value = "The flow structure starting at this Process Group." + ) + public FlowDTO getFlow() { + return flow; + } + + public void setFlow(FlowDTO flow) { + this.flow = flow; + } + + /** + * The id for this component. + * + * @return The id + */ + @ApiModelProperty( + value = "The id of the component." + ) + public String getId() { + return this.id; + } + + public void setId(final String id) { + this.id = id; + } + + /** + * The breadcrumb for this ProcessGroup flow. + * + * @return The breadcrumb for this ProcessGroup flow + */ + @ApiModelProperty( + value = "The breadcrumb of the process group." + ) + public FlowBreadcrumbDTO getBreadcrumb() { + return breadcrumb; + } + + public void setBreadcrumb(FlowBreadcrumbDTO breadcrumb) { + this.breadcrumb = breadcrumb; + } + + /** + * @return id for the parent group of this component if applicable, null otherwise + */ + @ApiModelProperty( + value = "The id of parent process group of this component if applicable." + ) + public String getParentGroupId() { + return parentGroupId; + } + + public void setParentGroupId(String parentGroupId) { + this.parentGroupId = parentGroupId; + } + + /** + * The uri for linking to this component in this NiFi. + * + * @return The uri + */ + @ApiModelProperty( + value = "The URI for futures requests to the component." + ) + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/ff98d823/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java new file mode 100644 index 0000000..e0c85fa --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ComponentEntity.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.web.api.entity; + +import com.wordnik.swagger.annotations.ApiModelProperty; +import org.apache.nifi.web.api.dto.AccessPolicyDTO; +import org.apache.nifi.web.api.dto.PositionDTO; +import org.apache.nifi.web.api.dto.RevisionDTO; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * A base type for request/response entities. + */ +@XmlRootElement(name = "entity") +public class ComponentEntity extends Entity { + + private RevisionDTO revision; + private String id; + private String uri; + private PositionDTO position; + private AccessPolicyDTO accessPolicy; + + /** + * @return revision for this request/response + */ + @ApiModelProperty( + value = "The revision for this request/response. The revision is required for any mutable flow requests and is included in all responses." + ) + public RevisionDTO getRevision() { + if (revision == null) { + return new RevisionDTO(); + } else { + return revision; + } + } + + public void setRevision(RevisionDTO revision) { + this.revision = revision; + } + + /** + * The id for this component. + * + * @return The id + */ + @ApiModelProperty( + value = "The id of the component." + ) + public String getId() { + return this.id; + } + + public void setId(final String id) { + this.id = id; + } + + /** + * The uri for linking to this component in this NiFi. + * + * @return The uri + */ + @ApiModelProperty( + value = "The URI for futures requests to the component." + ) + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + /** + * The position of this component in the UI if applicable, null otherwise. + * + * @return The position + */ + @ApiModelProperty( + value = "The position of this component in the UI if applicable." + ) + public PositionDTO getPosition() { + return position; + } + + public void setPosition(PositionDTO position) { + this.position = position; + } + + /** + * The access policy for this component. + * + * @return The access policy + */ + @ApiModelProperty( + value = "The access policy for this component." + ) + public AccessPolicyDTO getAccessPolicy() { + return accessPolicy; + } + + public void setAccessPolicy(AccessPolicyDTO accessPolicy) { + this.accessPolicy = accessPolicy; + } +}
