NIFI-271 more cleanup

This commit is contained in:
joewitt 2015-04-22 23:42:19 -04:00
parent 7f9dff52b0
commit a53cc3d707
58 changed files with 1015 additions and 1118 deletions

View File

@ -372,6 +372,9 @@
<profiles>
<profile> <!-- will move this up with the always on plugins once we get all checkstyle stuff resolved-->
<id>checkstyle</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>

View File

@ -138,11 +138,6 @@ public class JettyServer implements NiFiServer {
loadWars(locateNarWorkingDirectories());
}
/**
* Locates the working directory for each NAR.
*
* @return
*/
private Set<File> locateNarWorkingDirectories() {
final File frameworkWorkingDir = props.getFrameworkWorkingDirectory();
final File extensionsWorkingDir = props.getExtensionsWorkingDirectory();
@ -168,7 +163,7 @@ public class JettyServer implements NiFiServer {
* Loads the WARs in the specified NAR working directories. A WAR file must
* have a ".war" extension.
*
* @param warDir a directory containing WARs to load
* @param narWorkingDirectories dirs
*/
private void loadWars(final Set<File> narWorkingDirectories) {
@ -348,12 +343,6 @@ public class JettyServer implements NiFiServer {
server.setHandler(handlers);
}
/**
* Finds WAR files in the specified NAR working directories.
*
* @param narWorkingDirectories
* @return
*/
private Map<File, File> findWars(final Set<File> narWorkingDirectories) {
final Map<File, File> wars = new HashMap<>();
@ -408,8 +397,8 @@ public class JettyServer implements NiFiServer {
/**
* Identifies all known UI extensions and stores them in the specified map.
*
* @param uiExtensions
* @param warFile
* @param uiExtensions extensions
* @param warFile war
*/
private void identifyUiExtensionsForComponents(final Map<UiExtensionType, List<String>> uiExtensions, final File warFile) {
try (final JarFile jarFile = new JarFile(warFile)) {
@ -424,10 +413,11 @@ public class JettyServer implements NiFiServer {
}
/**
* Extracts the component type. Trims the line and considers comments. Returns null if no type was found.
* Extracts the component type. Trims the line and considers comments.
* Returns null if no type was found.
*
* @param line
* @return
* @param line line
* @return type
*/
private String extractComponentType(final String line) {
final String trimmedLine = line.trim();
@ -441,8 +431,9 @@ public class JettyServer implements NiFiServer {
/**
* Returns the extension in the specified WAR using the specified path.
*
* @param war
* @return
* @param war war
* @param path path
* @return extensions
*/
private List<String> getWarExtensions(final File war, final String path) {
List<String> processorTypes = new ArrayList<>();
@ -660,9 +651,6 @@ public class JettyServer implements NiFiServer {
return contextFactory;
}
/**
* Starts the web server.
*/
@Override
public void start() {
try {
@ -683,7 +671,7 @@ public class JettyServer implements NiFiServer {
}
}
// ensure the appropriate wars deployed successfully before injecting the NiFi context and security filters -
// ensure the appropriate wars deployed successfully before injecting the NiFi context and security filters
// this must be done after starting the server (and ensuring there were no start up failures)
if (webApiContext != null) {
// give the web api the component ui extensions
@ -799,11 +787,6 @@ public class JettyServer implements NiFiServer {
}
}
/**
* Dump each applicable url.
*
* @throws SocketException
*/
private void dumpUrls() throws SocketException {
final List<String> urls = new ArrayList<>();
@ -853,11 +836,6 @@ public class JettyServer implements NiFiServer {
}
}
/**
* Handles when a start up failure occurs.
*
* @param t
*/
private void startUpFailure(Throwable t) {
System.err.println("Failed to start web server: " + t.getMessage());
System.err.println("Shutting down...");
@ -870,9 +848,6 @@ public class JettyServer implements NiFiServer {
this.extensionMapping = extensionMapping;
}
/**
* Stops the web server.
*/
@Override
public void stop() {
try {

View File

@ -32,18 +32,14 @@ public class UiExtension {
}
/**
* The type of this UI extension.
*
* @return
* @return type of this UI extension
*/
public UiExtensionType getExtensionType() {
return extensionType;
}
/**
* The context path of this UI extenion.
*
* @return
* @return The context path of this UI extension
*/
public String getContextPath() {
return contextPath;

View File

@ -31,19 +31,18 @@ public class UiExtensionMapping {
}
/**
* Returns whether there are any UI extensions for the specified component type.
*
* @param type
* @return
* @param type type
* @return whether there are any UI extensions for the specified component
* type
*/
public boolean hasUiExtension(final String type) {
return uiExtensions.containsKey(type);
}
/**
* Gets the listing of all discovered UI extensions for the specified component type.
* @param type
* @return
* @param type type
* @return the listing of all discovered UI extensions for the specified
* component type
*/
public List<UiExtension> getUiExtension(final String type) {
return uiExtensions.get(type);

View File

@ -464,7 +464,8 @@ public class ControllerServiceAuditor extends NiFiAuditor {
}
/**
* Returns whether the specified controller service is disabled (or disabling).
* Returns whether the specified controller service is disabled (or
* disabling).
*
* @param controllerService
* @return

View File

@ -297,7 +297,8 @@ public class ReportingTaskAuditor extends NiFiAuditor {
}
/**
* Extracts the values for the configured properties from the specified ReportingTask.
* Extracts the values for the configured properties from the specified
* ReportingTask.
*
* @param reportingTask
* @param reportingTaskDTO

View File

@ -211,7 +211,6 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
// -----------------------------------------
// Verification Operations
// -----------------------------------------
@Override
public void verifyCreateConnection(String groupId, ConnectionDTO connectionDTO) {
connectionDAO.verifyCreate(groupId, connectionDTO);
@ -365,7 +364,6 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
// -----------------------------------------
// Write Operations
// -----------------------------------------
@Override
public ConfigurationSnapshot<ConnectionDTO> updateConnection(final Revision revision, final String groupId, final ConnectionDTO connectionDTO) {
// if connection does not exist, then create new connection
@ -1488,7 +1486,6 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
// -----------------------------------------
// Read Operations
// -----------------------------------------
@Override
public RevisionDTO getRevision() {
return dtoFactory.createRevisionDTO(optimisticLockingManager.getLastModification());

View File

@ -68,8 +68,8 @@ import org.apache.nifi.web.api.entity.ReportingTaskEntity;
import org.apache.nifi.web.util.ClientResponseUtils;
/**
* Implements the NiFiWebConfigurationContext interface to support a context in both
* standalone and clustered environments.
* Implements the NiFiWebConfigurationContext interface to support a context in
* both standalone and clustered environments.
*/
public class StandardNiFiWebConfigurationContext implements NiFiWebConfigurationContext {
@ -255,6 +255,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration
* Facade over accessing different types of NiFi components.
*/
private interface ComponentFacade {
/**
* Gets the component details using the specified request context.
*
@ -277,6 +278,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration
* Interprets the request/response with the underlying Processor model.
*/
private class ProcessorFacade implements ComponentFacade {
@Override
public ComponentDetails getComponentDetails(final NiFiWebRequestContext requestContext) {
final String id = requestContext.getId();
@ -390,9 +392,11 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration
}
/**
* Interprets the request/response with the underlying ControllerService model.
* Interprets the request/response with the underlying ControllerService
* model.
*/
private class ControllerServiceFacade implements ComponentFacade {
@Override
public ComponentDetails getComponentDetails(final NiFiWebRequestContext requestContext) {
final String id = requestContext.getId();
@ -524,9 +528,11 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration
}
/**
* Interprets the request/response with the underlying ControllerService model.
* Interprets the request/response with the underlying ControllerService
* model.
*/
private class ReportingTaskFacade implements ComponentFacade {
@Override
public ComponentDetails getComponentDetails(final NiFiWebRequestContext requestContext) {
final String id = requestContext.getId();

View File

@ -288,8 +288,8 @@ public class StandardNiFiWebContext implements NiFiWebContext {
* Gets the headers for the request to replicate to each node while
* clustered.
*
* @param config
* @return
* @param config config
* @return headers
*/
private Map<String, String> getHeaders(final NiFiWebContextConfig config) {
final Map<String, String> headers = new HashMap<>();

View File

@ -121,8 +121,8 @@ public class ControllerServiceResource extends ApplicationResource {
}
/**
* Parses the availability and ensure that the specified availability makes sense for the
* given NiFi instance.
* Parses the availability and ensure that the specified availability makes
* sense for the given NiFi instance.
*
* @param availability
* @return
@ -149,8 +149,9 @@ public class ControllerServiceResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @return A controllerServicesEntity.
*/
@GET
@ -191,8 +192,9 @@ public class ControllerServiceResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param type The type of controller service to create.
* @return A controllerServiceEntity.
*/
@ -232,8 +234,9 @@ public class ControllerServiceResource extends ApplicationResource {
* Creates a new Controller Service.
*
* @param httpServletRequest
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param controllerServiceEntity A controllerServiceEntity.
* @return A controllerServiceEntity.
*/
@ -324,8 +327,9 @@ public class ControllerServiceResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param id The id of the controller service to retrieve
* @return A controllerServiceEntity.
*/
@ -414,8 +418,9 @@ public class ControllerServiceResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param id The id of the controller service to retrieve
* @return A controllerServiceEntity.
*/
@ -459,12 +464,14 @@ public class ControllerServiceResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param id The id of the controller service to retrieve
* @param state Sets the state of referencing components. A value of RUNNING or STOPPED will update
* referencing schedulable components (Processors and Reporting Tasks). A value of ENABLED or
* DISABLED will update referencing controller services.
* @param state Sets the state of referencing components. A value of RUNNING
* or STOPPED will update referencing schedulable components (Processors and
* Reporting Tasks). A value of ENABLED or DISABLED will update referencing
* controller services.
* @return A controllerServiceEntity.
*/
@PUT
@ -481,7 +488,6 @@ public class ControllerServiceResource extends ApplicationResource {
@FormParam("state") @DefaultValue(StringUtils.EMPTY) String state) {
// parse the state to determine the desired action
// need to consider controller service state first as it shares a state with
// scheduled state (disabled) which is applicable for referencing services
// but not referencing schedulable components
@ -533,8 +539,8 @@ public class ControllerServiceResource extends ApplicationResource {
}
// get the controller service
final ConfigurationSnapshot<Set<ControllerServiceReferencingComponentDTO>> response =
serviceFacade.updateControllerServiceReferencingComponents(new Revision(clientVersion, clientId.getClientId()), id, scheduledState, controllerServiceState);
final ConfigurationSnapshot<Set<ControllerServiceReferencingComponentDTO>> response
= serviceFacade.updateControllerServiceReferencingComponents(new Revision(clientVersion, clientId.getClientId()), id, scheduledState, controllerServiceState);
// create the revision
final RevisionDTO revision = new RevisionDTO();
@ -558,14 +564,17 @@ public class ControllerServiceResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param id The id of the controller service to update.
* @param name The name of the controller service
* @param annotationData The annotation data for the controller service
* @param comments The comments for the controller service
* @param state The state of this controller service. Should be ENABLED or DISABLED.
* @param markedForDeletion Array of property names whose value should be removed.
* @param state The state of this controller service. Should be ENABLED or
* DISABLED.
* @param markedForDeletion Array of property names whose value should be
* removed.
* @param formParams Additionally, the processor properties and styles are
* specified in the form parameters. Because the property names and styles
* differ from processor to processor they are specified in a map-like
@ -654,8 +663,9 @@ public class ControllerServiceResource extends ApplicationResource {
* Updates the specified a new Controller Service.
*
* @param httpServletRequest
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param id The id of the controller service to update.
* @param controllerServiceEntity A controllerServiceEntity.
* @return A controllerServiceEntity.
@ -736,8 +746,9 @@ public class ControllerServiceResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the controller service is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all services should use the node availability.
* @param availability Whether the controller service is available on the
* NCM only (ncm) or on the nodes only (node). If this instance is not
* clustered all services should use the node availability.
* @param id The id of the controller service to remove.
* @return A entity containing the client id and an updated revision.
*/
@ -788,7 +799,6 @@ public class ControllerServiceResource extends ApplicationResource {
}
// setters
public void setServiceFacade(NiFiServiceFacade serviceFacade) {
this.serviceFacade = serviceFacade;
}

View File

@ -72,6 +72,7 @@ public class FunnelResource extends ApplicationResource {
/**
* Populates the uri for the specified funnels.
*
* @param funnels
* @return
*/

View File

@ -74,6 +74,7 @@ public class InputPortResource extends ApplicationResource {
/**
* Populates the uri for the specified input ports.
*
* @param inputPorts
* @return
*/

View File

@ -74,6 +74,7 @@ public class LabelResource extends ApplicationResource {
/**
* Populates the uri for the specified labels.
*
* @param labels
* @return
*/

View File

@ -74,6 +74,7 @@ public class OutputPortResource extends ApplicationResource {
/**
* Populates the uri for the specified output ports.
*
* @param outputPorts
* @return
*/

View File

@ -117,8 +117,8 @@ public class ReportingTaskResource extends ApplicationResource {
}
/**
* Parses the availability and ensure that the specified availability makes sense for the
* given NiFi instance.
* Parses the availability and ensure that the specified availability makes
* sense for the given NiFi instance.
*
* @param availability
* @return
@ -145,8 +145,9 @@ public class ReportingTaskResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the reporting task is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all tasks should use the node availability.
* @param availability Whether the reporting task is available on the NCM
* only (ncm) or on the nodes only (node). If this instance is not clustered
* all tasks should use the node availability.
* @return A reportingTasksEntity.
*/
@GET
@ -187,8 +188,9 @@ public class ReportingTaskResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the reporting task is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all tasks should use the node availability.
* @param availability Whether the reporting task is available on the NCM
* only (ncm) or on the nodes only (node). If this instance is not clustered
* all tasks should use the node availability.
* @param type The type of reporting task to create.
* @return A reportingTaskEntity.
*/
@ -228,8 +230,9 @@ public class ReportingTaskResource extends ApplicationResource {
* Creates a new Reporting Task.
*
* @param httpServletRequest
* @param availability Whether the reporting task is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all tasks should use the node availability.
* @param availability Whether the reporting task is available on the NCM
* only (ncm) or on the nodes only (node). If this instance is not clustered
* all tasks should use the node availability.
* @param reportingTaskEntity A reportingTaskEntity.
* @return A reportingTaskEntity.
*/
@ -320,8 +323,9 @@ public class ReportingTaskResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the reporting task is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all tasks should use the node availability.
* @param availability Whether the reporting task is available on the NCM
* only (ncm) or on the nodes only (node). If this instance is not clustered
* all tasks should use the node availability.
* @param id The id of the reporting task to retrieve
* @return A reportingTaskEntity.
*/
@ -413,12 +417,14 @@ public class ReportingTaskResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the reporting task is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all tasks should use the node availability.
* @param availability Whether the reporting task is available on the NCM
* only (ncm) or on the nodes only (node). If this instance is not clustered
* all tasks should use the node availability.
* @param id The id of the reporting task to update.
* @param name The name of the reporting task
* @param annotationData The annotation data for the reporting task
* @param markedForDeletion Array of property names whose value should be removed.
* @param markedForDeletion Array of property names whose value should be
* removed.
* @param state The updated scheduled state
* @param schedulingStrategy The scheduling strategy for this reporting task
* @param schedulingPeriod The scheduling period for this reporting task
@ -514,8 +520,9 @@ public class ReportingTaskResource extends ApplicationResource {
* Updates the specified a Reporting Task.
*
* @param httpServletRequest
* @param availability Whether the reporting task is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all tasks should use the node availability.
* @param availability Whether the reporting task is available on the NCM
* only (ncm) or on the nodes only (node). If this instance is not clustered
* all tasks should use the node availability.
* @param id The id of the reporting task to update.
* @param reportingTaskEntity A reportingTaskEntity.
* @return A reportingTaskEntity.
@ -596,8 +603,9 @@ public class ReportingTaskResource extends ApplicationResource {
* @param clientId Optional client id. If the client id is not specified, a
* new one will be generated. This value (whether specified or generated) is
* included in the response.
* @param availability Whether the reporting task is available on the NCM only (ncm) or on the
* nodes only (node). If this instance is not clustered all tasks should use the node availability.
* @param availability Whether the reporting task is available on the NCM
* only (ncm) or on the nodes only (node). If this instance is not clustered
* all tasks should use the node availability.
* @param id The id of the reporting task to remove.
* @return A entity containing the client id and an updated revision.
*/
@ -648,7 +656,6 @@ public class ReportingTaskResource extends ApplicationResource {
}
// setters
public void setServiceFacade(NiFiServiceFacade serviceFacade) {
this.serviceFacade = serviceFacade;
}

View File

@ -71,6 +71,7 @@ public class TemplateResource extends ApplicationResource {
/**
* Populates the uri for the specified templates.
*
* @param templates
* @return
*/

View File

@ -1328,8 +1328,8 @@ public final class DtoFactory {
return capabilityDesc.value();
}
final org.apache.nifi.processor.annotation.CapabilityDescription deprecatedCapabilityDesc =
cls.getAnnotation(org.apache.nifi.processor.annotation.CapabilityDescription.class);
final org.apache.nifi.processor.annotation.CapabilityDescription deprecatedCapabilityDesc
= cls.getAnnotation(org.apache.nifi.processor.annotation.CapabilityDescription.class);
return (deprecatedCapabilityDesc == null) ? null : deprecatedCapabilityDesc.value();
}
@ -1883,7 +1883,6 @@ public final class DtoFactory {
return copy;
}
public ControllerServiceDTO copy(final ControllerServiceDTO original) {
final ControllerServiceDTO copy = new ControllerServiceDTO();
copy.setAnnotationData(original.getAnnotationData());
@ -2409,7 +2408,6 @@ public final class DtoFactory {
}
/* setters */
public void setControllerServiceLookup(ControllerServiceLookup lookup) {
this.controllerServiceLookup = lookup;
}

View File

@ -39,7 +39,6 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
* clustered environment. In this case, the cluster manager is created and
* managed.
*
* @author unattributed
*/
public class ApplicationStartupContextListener implements ServletContextListener {

View File

@ -413,6 +413,7 @@ public class ControllerFacade {
/**
* Resets the counter with the specified id.
*
* @param id
* @return
*/

View File

@ -20,15 +20,12 @@ import java.util.Set;
import org.apache.nifi.connectable.Connection;
import org.apache.nifi.web.api.dto.ConnectionDTO;
/**
*
*/
public interface ConnectionDAO {
/**
* Gets the specified Connection.
*
* @param groupId
* @param groupId group id
* @param id The connection id
* @return The connection
*/
@ -37,25 +34,25 @@ public interface ConnectionDAO {
/**
* Gets the connections for the specified source processor.
*
* @param groupId
* @param processorId
* @return
* @param groupId group id
* @param processorId processor id
* @return connections
*/
Set<Connection> getConnectionsForSource(String groupId, String processorId);
/**
* Determines if the specified connection exists.
*
* @param groupId
* @param id
* @return
* @param groupId group id
* @param id id
* @return true if connection exists
*/
boolean hasConnection(String groupId, String id);
/**
* Gets all of the connections.
*
* @param groupId
* @param groupId group identifier
* @return The connections
*/
Set<Connection> getConnections(String groupId);
@ -63,7 +60,7 @@ public interface ConnectionDAO {
/**
* Creates a new Connection.
*
* @param groupId
* @param groupId group id
* @param connectionDTO The connection DTO
* @return The connection
*/
@ -72,23 +69,23 @@ public interface ConnectionDAO {
/**
* Verifies the create request can be processed.
*
* @param groupId
* @param connectionDTO
* @param groupId group id
* @param connectionDTO connection
*/
void verifyCreate(String groupId, ConnectionDTO connectionDTO);
/**
* Verifies the update request can be processed.
*
* @param groupId
* @param connectionDTO
* @param groupId group id
* @param connectionDTO connection
*/
void verifyUpdate(String groupId, ConnectionDTO connectionDTO);
/**
* Updates the specified Connection.
*
* @param groupId
* @param groupId group id
* @param connectionDTO The connection DTO
* @return The connection
*/
@ -97,15 +94,15 @@ public interface ConnectionDAO {
/**
* Verifies the delete request can be processed.
*
* @param groupId
* @param id
* @param groupId group id
* @param id id
*/
void verifyDelete(String groupId, String id);
/**
* Deletes the specified Connection.
*
* @param groupId
* @param groupId group id
* @param id The id of the connection
*/
void deleteConnection(String groupId, String id);

View File

@ -24,16 +24,11 @@ import org.apache.nifi.controller.service.ControllerServiceReference;
import org.apache.nifi.controller.service.ControllerServiceState;
import org.apache.nifi.web.api.dto.ControllerServiceDTO;
/**
*
*/
public interface ControllerServiceDAO {
/**
* Determines if the specified controller service exists.
*
* @param controllerServiceId
* @return
* @param controllerServiceId service id
* @return Determines if the specified controller service exists
*/
boolean hasControllerService(String controllerServiceId);
@ -71,8 +66,8 @@ public interface ControllerServiceDAO {
/**
* Updates the referencing components for the specified controller service.
*
* @param controllerServiceId
* @param scheduledState
* @param controllerServiceId service id
* @param scheduledState scheduled state
* @param controllerServiceState the value of state
* @return the org.apache.nifi.controller.service.ControllerServiceReference
*/
@ -81,23 +76,24 @@ public interface ControllerServiceDAO {
/**
* Determines whether this controller service can be updated.
*
* @param controllerServiceDTO
* @param controllerServiceDTO service
*/
void verifyUpdate(ControllerServiceDTO controllerServiceDTO);
/**
* Determines whether the referencing component of the specified controller service can be updated.
* Determines whether the referencing component of the specified controller
* service can be updated.
*
* @param controllerServiceId
* @param scheduledState
* @param controllerServiceState
* @param controllerServiceId service id
* @param scheduledState scheduled state
* @param controllerServiceState service state
*/
void verifyUpdateReferencingComponents(String controllerServiceId, ScheduledState scheduledState, ControllerServiceState controllerServiceState);
/**
* Determines whether this controller service can be removed.
*
* @param controllerServiceId
* @param controllerServiceId service id
*/
void verifyDelete(String controllerServiceId);

View File

@ -21,24 +21,19 @@ import java.util.Set;
import org.apache.nifi.connectable.Funnel;
import org.apache.nifi.web.api.dto.FunnelDTO;
/**
*
*/
public interface FunnelDAO {
/**
* Determines if the specified funnel exists in the specified group.
*
* @param groupId
* @param funnelId
* @return
* @param groupId group id
* @param funnelId funnel id
* @return Determines if the specified funnel exists in the specified group
*/
boolean hasFunnel(String groupId, String funnelId);
/**
* Creates a funnel in the specified group.
*
* @param groupId
* @param groupId group id
* @param funnelDTO The funnel DTO
* @return The funnel
*/
@ -47,7 +42,7 @@ public interface FunnelDAO {
/**
* Gets the specified funnel in the specified group.
*
* @param groupId
* @param groupId group id
* @param funnelId The funnel id
* @return The funnel
*/
@ -56,7 +51,7 @@ public interface FunnelDAO {
/**
* Gets all of the funnels in the specified group.
*
* @param groupId
* @param groupId group id
* @return The funnels
*/
Set<Funnel> getFunnels(String groupId);
@ -64,7 +59,7 @@ public interface FunnelDAO {
/**
* Updates the specified funnel in the specified group.
*
* @param groupId
* @param groupId group id
* @param funnelDTO The funnel DTO
* @return The funnel
*/
@ -73,15 +68,15 @@ public interface FunnelDAO {
/**
* Determines whether this funnel can be removed.
*
* @param groupId
* @param funnelId
* @param groupId group id
* @param funnelId funnel id
*/
void verifyDelete(String groupId, String funnelId);
/**
* Deletes the specified Funnel in the specified group.
*
* @param groupId
* @param groupId group id
* @param funnelId The funnel id
*/
void deleteFunnel(String groupId, String funnelId);

View File

@ -20,24 +20,19 @@ import java.util.Set;
import org.apache.nifi.controller.label.Label;
import org.apache.nifi.web.api.dto.LabelDTO;
/**
*
*/
public interface LabelDAO {
/**
* Determines if the specified label exists in the specified group.
*
* @param groupId
* @param labelId
* @return
* @param groupId group id
* @param labelId label id
* @return Determines if the specified label exists in the specified group
*/
boolean hasLabel(String groupId, String labelId);
/**
* Creates a label in the specified group.
*
* @param groupId
* @param groupId group id
* @param labelDTO The label DTO
* @return The label
*/
@ -46,7 +41,7 @@ public interface LabelDAO {
/**
* Gets the specified label in the specified group.
*
* @param groupId
* @param groupId group id
* @param labelId The label id
* @return The label
*/
@ -55,7 +50,7 @@ public interface LabelDAO {
/**
* Gets all of the labels in the specified group.
*
* @param groupId
* @param groupId group id
* @return The labels
*/
Set<Label> getLabels(String groupId);
@ -63,7 +58,7 @@ public interface LabelDAO {
/**
* Updates the specified label in the specified group.
*
* @param groupId
* @param groupId group id
* @param labelDTO The label DTO
* @return The label
*/
@ -72,7 +67,7 @@ public interface LabelDAO {
/**
* Deletes the specified label in the specified group.
*
* @param groupId
* @param groupId group id
* @param labelId The label id
*/
void deleteLabel(String groupId, String labelId);

View File

@ -21,24 +21,19 @@ import java.util.Set;
import org.apache.nifi.connectable.Port;
import org.apache.nifi.web.api.dto.PortDTO;
/**
*
*/
public interface PortDAO {
/**
* Determines if the specified port exists in the specified group.
*
* @param groupId
* @param portId
* @return
* @param groupId group id
* @param portId port id
* @return Determines if the specified port exists in the specified group
*/
boolean hasPort(String groupId, String portId);
/**
* Creates a port in the specified group.
*
* @param groupId
* @param groupId group id
* @param portDTO The port DTO
* @return The port
*/
@ -47,7 +42,7 @@ public interface PortDAO {
/**
* Gets the specified port in the specified group.
*
* @param groupId
* @param groupId group id
* @param portId The port id
* @return The port
*/
@ -56,7 +51,7 @@ public interface PortDAO {
/**
* Gets all of the ports in the specified group.
*
* @param groupId
* @param groupId group id
* @return The ports
*/
Set<Port> getPorts(String groupId);
@ -64,15 +59,15 @@ public interface PortDAO {
/**
* Verifies the specified port can be updated per the specified request.
*
* @param groupId
* @param portDTO
* @param groupId group id
* @param portDTO port
*/
void verifyUpdate(String groupId, PortDTO portDTO);
/**
* Updates the specified port in the specified group.
*
* @param groupId
* @param groupId group
* @param portDTO The port DTO
* @return The port
*/
@ -81,15 +76,15 @@ public interface PortDAO {
/**
* Verifies the specified port can be removed.
*
* @param groupId
* @param portId
* @param groupId group id
* @param portId port id
*/
void verifyDelete(String groupId, String portId);
/**
* Deletes the specified label in the specified group.
*
* @param groupId
* @param groupId group id
* @param portId The port id
*/
void deletePort(String groupId, String portId);

View File

@ -20,24 +20,19 @@ import java.util.Set;
import org.apache.nifi.controller.ProcessorNode;
import org.apache.nifi.web.api.dto.ProcessorDTO;
/**
*
*/
public interface ProcessorDAO {
/**
* Determines if the specified processor is loaded.
*
* @param groupId
* @param id
* @return
* @param groupId group id
* @param id id
* @return Determines if the specified processor is loaded
*/
boolean hasProcessor(String groupId, String id);
/**
* Creates a new Processor.
*
* @param groupId
* @param groupId group id
* @param processorDTO The processor DTO
* @return The new Processor
*/
@ -46,7 +41,7 @@ public interface ProcessorDAO {
/**
* Gets the Processor transfer object for the specified id.
*
* @param groupId
* @param groupId group id
* @param id Id of the processor to return
* @return The Processor
*/
@ -55,7 +50,7 @@ public interface ProcessorDAO {
/**
* Gets all the Processor transfer objects for this controller.
*
* @param groupId
* @param groupId group id
* @return List of all the Processors
*/
Set<ProcessorNode> getProcessors(String groupId);
@ -63,8 +58,8 @@ public interface ProcessorDAO {
/**
* Verifies the specified processor can be updated.
*
* @param groupId
* @param processorDTO
* @param groupId group id
* @param processorDTO processor
*/
void verifyUpdate(String groupId, ProcessorDTO processorDTO);
@ -72,24 +67,24 @@ public interface ProcessorDAO {
* Updates the configuration for the processor using the specified
* processorDTO.
*
* @param groupId
* @param processorDTO
* @return
* @param groupId group id
* @param processorDTO processor
* @return updated processor
*/
ProcessorNode updateProcessor(String groupId, ProcessorDTO processorDTO);
/**
* Verifies the specified processor can be removed.
*
* @param groupId
* @param processorId
* @param groupId group id
* @param processorId processor id
*/
void verifyDelete(String groupId, String processorId);
/**
* Deletes the specified processor.
*
* @param groupId
* @param groupId group id
* @param processorId The processor id to delete
*/
void deleteProcessor(String groupId, String processorId);

View File

@ -22,24 +22,21 @@ import org.apache.nifi.remote.RemoteGroupPort;
import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO;
/**
*
*/
public interface RemoteProcessGroupDAO {
/**
* Determines if the specified remote process group exists.
*
* @param groupId
* @param remoteProcessGroupId
* @return
* @param groupId group id
* @param remoteProcessGroupId group id
* @return true if the specified remote process group exists
*/
boolean hasRemoteProcessGroup(String groupId, String remoteProcessGroupId);
/**
* Creates a remote process group reference.
*
* @param groupId
* @param groupId group id
* @param remoteProcessGroup The remote process group
* @return The remote process group
*/
@ -48,7 +45,7 @@ public interface RemoteProcessGroupDAO {
/**
* Gets the specified remote process group.
*
* @param groupId
* @param groupId group id
* @param remoteProcessGroupId The remote process group id
* @return The remote process group
*/
@ -57,7 +54,7 @@ public interface RemoteProcessGroupDAO {
/**
* Gets all of the remote process groups.
*
* @param groupId
* @param groupId group id
* @return The remote process groups
*/
Set<RemoteProcessGroup> getRemoteProcessGroups(String groupId);
@ -65,33 +62,33 @@ public interface RemoteProcessGroupDAO {
/**
* Verifies the specified remote process group can be updated.
*
* @param groupId
* @param remoteProcessGroup
* @param groupId group id
* @param remoteProcessGroup group
*/
void verifyUpdate(String groupId, RemoteProcessGroupDTO remoteProcessGroup);
/**
* Verifies the specified remote process group input port can be updated.
*
* @param groupId
* @param remoteProcessGroupId
* @param remoteProcessGroupPort
* @param groupId group id
* @param remoteProcessGroupId process group id
* @param remoteProcessGroupPort port
*/
void verifyUpdateInputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
/**
* Verifies the specified remote process group input port can be updated.
*
* @param groupId
* @param remoteProcessGroupId
* @param remoteProcessGroupPort
* @param groupId group id
* @param remoteProcessGroupId group id
* @param remoteProcessGroupPort group port
*/
void verifyUpdateOutputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
/**
* Updates the specified remote process group.
*
* @param groupId
* @param groupId id
* @param remoteProcessGroup The remote process group
* @return The remote process group
*/
@ -100,9 +97,9 @@ public interface RemoteProcessGroupDAO {
/**
* Updates the specified remote process group input port.
*
* @param groupId
* @param remoteProcessGroupId
* @param remoteProcessGroupPort
* @param groupId id
* @param remoteProcessGroupId id
* @param remoteProcessGroupPort port
* @return
*/
RemoteGroupPort updateRemoteProcessGroupInputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
@ -110,9 +107,9 @@ public interface RemoteProcessGroupDAO {
/**
* Updates the specified remote process group output port.
*
* @param groupId
* @param remoteProcessGroupId
* @param remoteProcessGroupPort
* @param groupId group id
* @param remoteProcessGroupId group id
* @param remoteProcessGroupPort port
* @return
*/
RemoteGroupPort updateRemoteProcessGroupOutputPort(String groupId, String remoteProcessGroupId, RemoteProcessGroupPortDTO remoteProcessGroupPort);
@ -120,15 +117,15 @@ public interface RemoteProcessGroupDAO {
/**
* Verifies the specified remote process group can be removed.
*
* @param groupId
* @param remoteProcessGroupId
* @param groupId group id
* @param remoteProcessGroupId group id
*/
void verifyDelete(String groupId, String remoteProcessGroupId);
/**
* Deletes the specified remote process group.
*
* @param groupId
* @param groupId group id
* @param remoteProcessGroupId The remote process group id
*/
void deleteRemoteProcessGroup(String groupId, String remoteProcessGroupId);

View File

@ -20,27 +20,24 @@ import org.apache.nifi.controller.Snippet;
import org.apache.nifi.web.api.dto.FlowSnippetDTO;
import org.apache.nifi.web.api.dto.SnippetDTO;
/**
*
*/
public interface SnippetDAO {
/**
* Copies the specified snippet and added the copy to the flow in the
* specified group.
*
* @param groupId
* @param snippetId
* @param originX
* @param originY
* @return
* @param groupId group id
* @param snippetId snippet id
* @param originX x
* @param originY y
* @return snippet
*/
FlowSnippetDTO copySnippet(String groupId, String snippetId, Double originX, Double originY);
/**
* Creates a snippet.
*
* @param snippetDTO
* @param snippetDTO snippet
* @return The snippet
*/
Snippet createSnippet(SnippetDTO snippetDTO);
@ -48,8 +45,8 @@ public interface SnippetDAO {
/**
* Determines if the specified snippet exists.
*
* @param snippetId
* @return
* @param snippetId snippet id
* @return true if the snippet exists
*/
boolean hasSnippet(String snippetId);
@ -64,14 +61,14 @@ public interface SnippetDAO {
/**
* Verifies the specified snippet can be updated.
*
* @param snippetDTO
* @param snippetDTO snippet
*/
void verifyUpdate(SnippetDTO snippetDTO);
/**
* Updates the specified snippet.
*
* @param snippetDTO
* @param snippetDTO snippet
* @return The snippet
*/
Snippet updateSnippet(SnippetDTO snippetDTO);
@ -79,7 +76,7 @@ public interface SnippetDAO {
/**
* Verifies the specified snippet can be removed.
*
* @param snippetId
* @param snippetId snippet id
*/
void verifyDelete(String snippetId);

View File

@ -174,7 +174,8 @@ public class StandardControllerServiceDAO extends ComponentDAO implements Contro
}
/**
* Validates the specified configuration for the specified controller service.
* Validates the specified configuration for the specified controller
* service.
*
* @param controllerService
* @param controllerServiceDTO

View File

@ -16,7 +16,6 @@
*/
package org.apache.nifi.web.dao.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

View File

@ -20,7 +20,6 @@ import org.apache.nifi.cluster.manager.impl.WebClusterManager;
import org.apache.nifi.controller.FlowController;
import org.apache.nifi.controller.reporting.ReportingTaskProvider;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.web.dao.ControllerServiceDAO;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;

View File

@ -25,7 +25,6 @@ public enum Availability {
* Service or reporting task will run only on the NiFi Cluster Manager (NCM)
*/
NCM,
/**
* Service or reporting task will run only on NiFi Nodes (or standalone
* instance, if not clustered)

View File

@ -287,7 +287,6 @@ public final class SnippetUtils {
return false;
}
public FlowSnippetDTO copy(final FlowSnippetDTO snippetContents, final ProcessGroup group) {
final FlowSnippetDTO snippetCopy = copyContentsForGroup(snippetContents, group.getIdentifier(), null, null);
resolveNameConflicts(snippetCopy, group);
@ -543,7 +542,6 @@ public final class SnippetUtils {
return snippetContentsCopy;
}
private void updateControllerServiceIdentifiers(final FlowSnippetDTO snippet, final Map<String, String> serviceIdMap) {
final Set<ProcessorDTO> processors = snippet.getProcessors();
if (processors != null) {
@ -579,7 +577,6 @@ public final class SnippetUtils {
}
}
/**
* Generates a new id for the current id that is specified. If no seed is
* found, a new random id will be created.

View File

@ -46,16 +46,9 @@ public class NiFiTestServer {
private static final Logger logger = LoggerFactory.getLogger(NiFiTestServer.class);
private Server jetty;
private NiFiProperties properties;
private final NiFiProperties properties;
private WebAppContext webappContext;
/**
* Creates the NiFi test server.
*
* @param webappRoot
* @param contextPath
* @param props
*/
public NiFiTestServer(String webappRoot, String contextPath) {
// load the configuration
properties = NiFiProperties.getInstance();
@ -64,13 +57,6 @@ public class NiFiTestServer {
createServer();
}
/**
* Creates the webapp context.
*
* @param webappRoot
* @param contextPath
* @return
*/
private WebAppContext createWebAppContext(String webappRoot, String contextPath) {
webappContext = new WebAppContext();
webappContext.setContextPath(contextPath);
@ -80,12 +66,6 @@ public class NiFiTestServer {
return webappContext;
}
/**
* Creates the server.
*
* @param webappContext
* @return
*/
private Server createServer() {
jetty = new Server(0);
@ -95,11 +75,6 @@ public class NiFiTestServer {
return jetty;
}
/**
* Creates the connector.
*
* @return
*/
private void createSecureConnector() {
org.eclipse.jetty.util.ssl.SslContextFactory contextFactory = new org.eclipse.jetty.util.ssl.SslContextFactory();
@ -155,11 +130,7 @@ public class NiFiTestServer {
jetty.addConnector(https);
}
/**
* Starts the server.
*
* @throws Exception
*/
public void startServer() throws Exception {
jetty.start();
@ -167,9 +138,6 @@ public class NiFiTestServer {
webappContext.getServletContext().setAttribute("nifi-ui-extensions", new UiExtensionMapping(Collections.EMPTY_MAP));
}
/**
* Loads the flow.
*/
public void loadFlow() throws Exception {
logger.info("Loading Flow...");
@ -180,20 +148,10 @@ public class NiFiTestServer {
logger.info("Flow loaded successfully.");
}
/**
* Stops the server.
*
* @throws Exception
*/
public void shutdownServer() throws Exception {
jetty.stop();
}
/**
* Returns the port for the server.
*
* @return
*/
public int getPort() {
if (!jetty.isStarted()) {
throw new IllegalStateException("Jetty server not started");
@ -201,20 +159,10 @@ public class NiFiTestServer {
return ((ServerConnector) jetty.getConnectors()[1]).getLocalPort();
}
/**
* Returns the url for the server.
*
* @return
*/
public String getBaseUrl() {
return "https://localhost:" + getPort();
}
/**
* Get a client for accessing the resources.
*
* @return
*/
public Client getClient() {
// create the client
return WebUtils.createClient(null, SslContextFactory.createSslContext(properties));

View File

@ -259,9 +259,8 @@ public class ContentViewerController extends HttpServlet {
}
/**
* Get the content request context based on the specified request.
* @param request
* @return
* @param request request
* @return Get the content request context based on the specified request
*/
private ContentRequestContext getContentRequest(final HttpServletRequest request) {
return new ContentRequestContext() {

View File

@ -23,18 +23,18 @@ import org.apache.nifi.distributed.cache.client.exception.DeserializationExcepti
/**
* Provides an interface for deserializing an array of bytes into an Object
*
* @param <T>
* @param <T> type
*/
public interface Deserializer<T> {
/**
* Deserializes the given byte array input an Object and returns that value.
*
* @param input
* @return
* @param input input
* @return returns deserialized value
* @throws DeserializationException if a valid object cannot be deserialized
* from the given byte array
* @throws java.io.IOException
* @throws java.io.IOException ex
*/
T deserialize(byte[] input) throws DeserializationException, IOException;

View File

@ -37,12 +37,12 @@ public interface DistributedMapCacheClient extends ControllerService {
* present, serializing the key and value with the given
* {@link Serializer}s.
*
* @param <K>
* @param <V>
* @param <K> type of key
* @param <V> type of value
* @param key the key for into the map
* @param value the value to add to the map if and only if the key is absent
* @param keySerializer
* @param valueSerializer
* @param keySerializer key serializer
* @param valueSerializer value serializer
* @return true if the value was added to the cache, false if the value
* already existed in the cache
*
@ -57,15 +57,17 @@ public interface DistributedMapCacheClient extends ControllerService {
* key, the value associated with the key is returned, after being
* deserialized with the given valueDeserializer.
*
* @param <K>
* @param <V>
* @param key
* @param value
* @param keySerializer
* @param valueSerializer
* @param valueDeserializer
* @return
* @throws IOException
* @param <K> type of key
* @param <V> type of value
* @param key key
* @param value value
* @param keySerializer key serializer
* @param valueSerializer key serializer
* @param valueDeserializer value deserializer
* @return If a value already exists in the cache for the given
* key, the value associated with the key is returned, after being
* deserialized with the given valueDeserializer
* @throws IOException ex
*/
<K, V> V getAndPutIfAbsent(K key, V value, Serializer<K> keySerializer, Serializer<V> valueSerializer, Deserializer<V> valueDeserializer) throws IOException;
@ -73,46 +75,46 @@ public interface DistributedMapCacheClient extends ControllerService {
* Determines if the given value is present in the cache and if so returns
* <code>true</code>, else returns <code>false</code>
*
* @param <K>
* @param key
* @param keySerializer
* @return
* @param <K> type of key
* @param key key
* @param keySerializer key serializer
* @return Determines if the given value is present in the cache and if so returns
* <code>true</code>, else returns <code>false</code>
*
* @throws IOException if unable to communicate with the remote instance
*/
<K> boolean containsKey(K key, Serializer<K> keySerializer) throws IOException;
/**
* Returns the value in the cache for the given key, if one exists;
* otherwise returns <code>null</code>
*
* @param <K>
* @param <V>
* @param <K> type of key
* @param <V> type of value
* @param key the key to lookup in the map
* @param keySerializer
* @param valueDeserializer
* @param keySerializer key serializer
* @param valueDeserializer value serializer
*
* @return
* @throws IOException
* @return the value in the cache for the given key, if one exists;
* otherwise returns <code>null</code>
* @throws IOException ex
*/
<K, V> V get(K key, Serializer<K> keySerializer, Deserializer<V> valueDeserializer) throws IOException;
/**
* Attempts to notify the server that we are finished communicating with it
* and cleans up resources
* @throws java.io.IOException
*
* @throws java.io.IOException ex
*/
void close() throws IOException;
/**
* Removes the entry with the given key from the cache, if it is present.
*
* @param <K>
* @param key
* @param serializer
* @param <K> type of key
* @param key key
* @param serializer serializer
* @return <code>true</code> if the entry is removed, <code>false</code> if
* the key did not exist in the cache
* @throws IOException
* @throws IOException ex
*/
<K> boolean remove(K key, Serializer<K> serializer) throws IOException;

View File

@ -35,9 +35,9 @@ public interface DistributedSetCacheClient extends ControllerService {
* Adds the specified value to the cache, serializing the value with the
* given {@link Serializer}.
*
* @param <T>
* @param value
* @param serializer
* @param <T> type
* @param value value
* @param serializer serializer
* @return true if the value was added to the cache, false if the value
* already existed in the cache
*
@ -46,14 +46,12 @@ public interface DistributedSetCacheClient extends ControllerService {
<T> boolean addIfAbsent(T value, Serializer<T> serializer) throws IOException;
/**
* Returns if the given value is present in the cache and if so returns
* @param <T> type
* @param value value
* @param serializer serializer
* @return if the given value is present in the cache and if so returns
* <code>true</code>, else returns <code>false</code>
*
* @param <T>
* @param value
* @param serializer
* @return
*
* @throws IOException if unable to communicate with the remote instance
*/
<T> boolean contains(T value, Serializer<T> serializer) throws IOException;
@ -61,19 +59,20 @@ public interface DistributedSetCacheClient extends ControllerService {
/**
* Removes the given value from the cache, if it is present.
*
* @param <T>
* @param value
* @param serializer
* @param <T> type
* @param value value
* @param serializer serializer
* @return <code>true</code> if the value is removed, <code>false</code> if
* the value did not exist in the cache
* @throws IOException
* @throws IOException ex
*/
<T> boolean remove(T value, Serializer<T> serializer) throws IOException;
/**
* Attempts to notify the server that we are finished communicating with it
* and cleans up resources
* @throws java.io.IOException
*
* @throws java.io.IOException ex
*/
void close() throws IOException;
}

View File

@ -23,17 +23,18 @@ import org.apache.nifi.distributed.cache.client.exception.SerializationException
/**
* Provides a mechanism by which a value can be serialized to a stream of bytes
* @param <T>
*
* @param <T> type to serialize
*/
public interface Serializer<T> {
/**
* Serializes the given value to the {@link OutputStream}
*
* @param value
* @param output
* @param value value
* @param output stream
* @throws SerializationException If unable to serialize the given value
* @throws java.io.IOException
* @throws java.io.IOException ex
*/
void serialize(T value, OutputStream output) throws SerializationException, IOException;