Skip to content

Commit

Permalink
NIFI-10497 Making RegistryClient an extension point (apache#6433)
Browse files Browse the repository at this point in the history
- NIFI-10497 Mae FlowRegistryClient an extension point
  • Loading branch information
simonbence authored Sep 26, 2022
1 parent 320aed0 commit 94fdc79
Show file tree
Hide file tree
Showing 193 changed files with 6,019 additions and 2,367 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public enum Component {
Connection,
ControllerService,
ReportingTask,
FlowRegistryClient,
ParameterContext,
ParameterProvider,
AccessPolicy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* <p>
* Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService},
* {@link org.apache.nifi.registry.flow.FlowRegistryClient FlowRegistryClient}
* {@link org.apache.nifi.parameter.ParameterProvider ParameterProvider}, or
* {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
* can use to indicate a method should be called whenever the component is added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* <p>
* Marker annotation a {@link org.apache.nifi.processor.Processor Processor},
* {@link org.apache.nifi.controller.ControllerService ControllerService},
* {@link org.apache.nifi.registry.flow.FlowRegistryClient FlowRegistryClient}
* {@link org.apache.nifi.parameter.ParameterProvider ParameterProvider}, or
* {@link org.apache.nifi.reporting.ReportingTask ReportingTask} implementation
* can use to indicate a method should be called whenever the component is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public enum ComponentType {
REPORTING_TASK("Reporting Task"),
PARAMETER_CONTEXT("Parameter Context"),
PARAMETER_PROVIDER("Parameter Provider"),
TEMPLATE("Template");
TEMPLATE("Template"),
FLOW_REGISTRY_CLIENT("Flow Registry Client");


private final String typeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,44 @@

package org.apache.nifi.flow;

import java.util.Objects;

import io.swagger.annotations.ApiModelProperty;

import java.util.Objects;

public class VersionedFlowCoordinates {
private String registryId;
private String storageLocation;
private String registryUrl;
private String bucketId;
private String flowId;
private int version;
private Boolean latest;

@ApiModelProperty("The identifier of the Flow Registry that contains the flow")
public String getRegistryId() {
return registryId;
}

public void setRegistryId(String registryId) {
this.registryId = registryId;
}

@ApiModelProperty("The location of the Flow Registry that stores the flow")
public String getStorageLocation() {
return storageLocation;
}

public void setStorageLocation(String storageLocation) {
this.storageLocation = storageLocation;
}

@Deprecated
@ApiModelProperty("The URL of the Flow Registry that contains the flow")
public String getRegistryUrl() {
return registryUrl;
}

@Deprecated
public void setRegistryUrl(String registryUrl) {
this.registryUrl = registryUrl;
}
Expand Down Expand Up @@ -75,7 +97,7 @@ public void setLatest(Boolean latest) {

@Override
public int hashCode() {
return Objects.hash(registryUrl, bucketId, flowId, version);
return Objects.hash(registryId, storageLocation, registryUrl, bucketId, flowId, version);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@
* limitations under the License.
*/

package org.apache.nifi.controller.flow;
package org.apache.nifi.flow;

import io.swagger.annotations.ApiModelProperty;

public class VersionedRegistry {
public class VersionedFlowRegistryClient extends VersionedConfigurableExtension {
@Deprecated
private String id;
private String name;
@Deprecated
private String url;
private String description;
private String annotationData;

@ApiModelProperty("The ID of the registry")
@Override
public ComponentType getComponentType() {
return ComponentType.FLOW_REGISTRY_CLIENT;
}

/**
* @deprecated use {@link #getIdentifier()} instead.
*/
@Deprecated
@ApiModelProperty("The ID of the Registry. This method is deprecated. Use #getIdentifier instead.")
public String getId() {
return id;
}
Expand All @@ -34,20 +45,13 @@ public void setId(final String id) {
this.id = id;
}

@ApiModelProperty("The name of the registry")
public String getName() {
return name;
}

public void setName(final String name) {
this.name = name;
}

@Deprecated
@ApiModelProperty("The URL for interacting with the registry")
public String getUrl() {
return url;
}

@Deprecated
public void setUrl(final String url) {
this.url = url;
}
Expand All @@ -60,4 +64,13 @@ public String getDescription() {
public void setDescription(final String description) {
this.description = description;
}

@ApiModelProperty(value = "The annotation for the reporting task. This is how the custom UI relays configuration to the reporting task.")
public String getAnnotationData() {
return annotationData;
}

public void setAnnotationData(String annotationData) {
this.annotationData = annotationData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Map;
import java.util.Set;

public class VersionedProcessGroup extends VersionedComponent {
public class VersionedProcessGroup extends VersionedComponent {

private Set<VersionedProcessGroup> processGroups = new HashSet<>();
private Set<VersionedRemoteProcessGroup> remoteProcessGroups = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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.registry.flow;

import org.apache.nifi.components.AbstractConfigurableComponent;
import org.apache.nifi.logging.ComponentLog;

import javax.net.ssl.SSLContext;
import java.util.Optional;

public abstract class AbstractFlowRegistryClient extends AbstractConfigurableComponent implements FlowRegistryClient {

private volatile String identifier;
private volatile Optional<SSLContext> systemSslContext;
private volatile ComponentLog logger;

@Override
public void initialize(final FlowRegistryClientInitializationContext context) {
this.identifier = context.getIdentifier();
this.logger = context.getLogger();
this.systemSslContext = context.getSystemSslContext();
}

@Override
public final String getIdentifier() {
return identifier;
}

protected final ComponentLog getLogger() {
return logger;
}

protected final Optional<SSLContext> getSystemSslContext() {
return systemSslContext;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.registry.flow;

public class AuthenticationException extends FlowRegistryException {

public AuthenticationException(final String message) {
super(message);
}

public AuthenticationException(final String message, final Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.registry.flow;

public class AuthorizationException extends FlowRegistryException {

public AuthorizationException(final String message) {
super(message);
}

public AuthorizationException(final String message, final Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.registry.flow;

public class FlowAlreadyExistsException extends FlowRegistryException {

public FlowAlreadyExistsException(final String message) {
super(message);
}

public FlowAlreadyExistsException(final String message, final Throwable cause) {
super(message, cause);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,53 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.web.api.dto;
package org.apache.nifi.registry.flow;

import io.swagger.annotations.ApiModelProperty;

import javax.xml.bind.annotation.XmlType;

/**
* Details about a configured registry.
*/
@XmlType(name = "registry")
public class RegistryDTO {

private String id;
public class FlowRegistryBucket {
private String identifier;
private String name;
private String description;
private String uri;

@ApiModelProperty("The registry identifier")
public String getId() {
return id;
}
private long createdTimestamp;
private FlowRegistryPermissions permissions;

public void setId(String id) {
this.id = id;
public String getIdentifier() {
return identifier;
}

@ApiModelProperty("The registry name")
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@ApiModelProperty("The registry description")
public String getDescription() {
return description;
}

public void setDescription(String description) {
public long getCreatedTimestamp() {
return createdTimestamp;
}

public FlowRegistryPermissions getPermissions() {
return permissions;
}

public void setIdentifier(final String identifier) {
this.identifier = identifier;
}

public void setName(final String name) {
this.name = name;
}

public void setDescription(final String description) {
this.description = description;
}

@ApiModelProperty("The registry URI")
public String getUri() {
return uri;
public void setCreatedTimestamp(final long createdTimestamp) {
this.createdTimestamp = createdTimestamp;
}

public void setUri(String uri) {
this.uri = uri;
public void setPermissions(final FlowRegistryPermissions permissions) {
this.permissions = permissions;
}

}
Loading

0 comments on commit 94fdc79

Please sign in to comment.