Repository: incubator-nifi Updated Branches: refs/heads/develop 7f9dff52b -> a53cc3d70
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a53cc3d7/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java index 76789c6..b0e7f3c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java @@ -189,84 +189,84 @@ public final class SnippetUtils { } addControllerServicesToSnippet(snippetDto); - + return snippetDto; } - + private void addControllerServicesToSnippet(final FlowSnippetDTO snippetDto) { final Set<ProcessorDTO> processors = snippetDto.getProcessors(); - if ( processors != null ) { - for ( final ProcessorDTO processorDto : processors ) { - addControllerServicesToSnippet(snippetDto, processorDto); - } + if (processors != null) { + for (final ProcessorDTO processorDto : processors) { + addControllerServicesToSnippet(snippetDto, processorDto); + } } - + final Set<ProcessGroupDTO> childGroups = snippetDto.getProcessGroups(); - if ( childGroups != null ) { - for ( final ProcessGroupDTO processGroupDto : childGroups ) { - final FlowSnippetDTO childGroupDto = processGroupDto.getContents(); - if ( childGroupDto != null ) { - addControllerServicesToSnippet(childGroupDto); - } - } + if (childGroups != null) { + for (final ProcessGroupDTO processGroupDto : childGroups) { + final FlowSnippetDTO childGroupDto = processGroupDto.getContents(); + if (childGroupDto != null) { + addControllerServicesToSnippet(childGroupDto); + } + } } } - + private void addControllerServicesToSnippet(final FlowSnippetDTO snippet, final ProcessorDTO processorDto) { final ProcessorConfigDTO configDto = processorDto.getConfig(); - if ( configDto == null ) { + if (configDto == null) { return; } - + final Map<String, PropertyDescriptorDTO> descriptors = configDto.getDescriptors(); final Map<String, String> properties = configDto.getProperties(); - - if ( properties != null && descriptors != null ) { - for ( final Map.Entry<String, String> entry : properties.entrySet() ) { + + if (properties != null && descriptors != null) { + for (final Map.Entry<String, String> entry : properties.entrySet()) { final String propName = entry.getKey(); final String propValue = entry.getValue(); - if ( propValue == null ) { + if (propValue == null) { continue; } - + final PropertyDescriptorDTO propertyDescriptorDto = descriptors.get(propName); - if ( propertyDescriptorDto != null && propertyDescriptorDto.getIdentifiesControllerService() != null ) { + if (propertyDescriptorDto != null && propertyDescriptorDto.getIdentifiesControllerService() != null) { final ControllerServiceNode serviceNode = flowController.getControllerServiceNode(propValue); - if ( serviceNode != null ) { + if (serviceNode != null) { addControllerServicesToSnippet(snippet, serviceNode); } } } } } - + private void addControllerServicesToSnippet(final FlowSnippetDTO snippet, final ControllerServiceNode serviceNode) { - if ( isServicePresent(serviceNode.getIdentifier(), snippet.getControllerServices()) ) { + if (isServicePresent(serviceNode.getIdentifier(), snippet.getControllerServices())) { return; } - + final ControllerServiceDTO serviceNodeDto = dtoFactory.createControllerServiceDto(serviceNode); Set<ControllerServiceDTO> existingServiceDtos = snippet.getControllerServices(); - if ( existingServiceDtos == null ) { + if (existingServiceDtos == null) { existingServiceDtos = new HashSet<>(); snippet.setControllerServices(existingServiceDtos); } existingServiceDtos.add(serviceNodeDto); - for ( final Map.Entry<PropertyDescriptor, String> entry : serviceNode.getProperties().entrySet() ) { + for (final Map.Entry<PropertyDescriptor, String> entry : serviceNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); final String propertyValue = entry.getValue(); - - if ( descriptor.getControllerServiceDefinition() != null ) { + + if (descriptor.getControllerServiceDefinition() != null) { final ControllerServiceNode referencedNode = flowController.getControllerServiceNode(propertyValue); - if ( referencedNode == null ) { + if (referencedNode == null) { throw new IllegalStateException("Controller Service with ID " + propertyValue + " is referenced in template but cannot be found"); } - + final String referencedNodeId = referencedNode.getIdentifier(); - + final boolean alreadyPresent = isServicePresent(referencedNodeId, snippet.getControllerServices()); - if ( !alreadyPresent ) { + if (!alreadyPresent) { addControllerServicesToSnippet(snippet, referencedNode); } } @@ -274,20 +274,19 @@ public final class SnippetUtils { } private boolean isServicePresent(final String serviceId, final Collection<ControllerServiceDTO> services) { - if ( services == null ) { + if (services == null) { return false; } - - for ( final ControllerServiceDTO existingService : services ) { - if ( serviceId.equals(existingService.getId()) ) { + + for (final ControllerServiceDTO existingService : services) { + if (serviceId.equals(existingService.getId())) { return true; } } - + return false; } - - + public FlowSnippetDTO copy(final FlowSnippetDTO snippetContents, final ProcessGroup group) { final FlowSnippetDTO snippetCopy = copyContentsForGroup(snippetContents, group.getIdentifier(), null, null); resolveNameConflicts(snippetCopy, group); @@ -350,33 +349,33 @@ public final class SnippetUtils { // // Copy the Controller Services // - if ( serviceIdMap == null ) { + if (serviceIdMap == null) { serviceIdMap = new HashMap<>(); final Set<ControllerServiceDTO> services = new HashSet<>(); - if ( snippetContents.getControllerServices() != null ) { - for (final ControllerServiceDTO serviceDTO : snippetContents.getControllerServices() ) { + if (snippetContents.getControllerServices() != null) { + for (final ControllerServiceDTO serviceDTO : snippetContents.getControllerServices()) { final ControllerServiceDTO service = dtoFactory.copy(serviceDTO); service.setId(generateId(serviceDTO.getId())); service.setState(ControllerServiceState.DISABLED.name()); services.add(service); - + // Map old service ID to new service ID so that we can make sure that we reference the new ones. serviceIdMap.put(serviceDTO.getId(), service.getId()); } } - + // if there is any controller service that maps to another controller service, update the id's - for ( final ControllerServiceDTO serviceDTO : services ) { + for (final ControllerServiceDTO serviceDTO : services) { final Map<String, String> properties = serviceDTO.getProperties(); final Map<String, PropertyDescriptorDTO> descriptors = serviceDTO.getDescriptors(); - if ( properties != null && descriptors != null ) { - for ( final PropertyDescriptorDTO descriptor : descriptors.values() ) { - if ( descriptor.getIdentifiesControllerService() != null ) { + if (properties != null && descriptors != null) { + for (final PropertyDescriptorDTO descriptor : descriptors.values()) { + if (descriptor.getIdentifiesControllerService() != null) { final String currentServiceId = properties.get(descriptor.getName()); - if ( currentServiceId == null ) { + if (currentServiceId == null) { continue; } - + final String newServiceId = serviceIdMap.get(currentServiceId); properties.put(descriptor.getName(), newServiceId); } @@ -385,7 +384,7 @@ public final class SnippetUtils { } snippetContentsCopy.setControllerServices(services); } - + // // Copy the labels // @@ -477,7 +476,7 @@ public final class SnippetUtils { // if there is any controller service that maps to another controller service, update the id's updateControllerServiceIdentifiers(snippetContentsCopy, serviceIdMap); - + // // Copy ProcessGroups // @@ -542,43 +541,41 @@ 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 ) { - for ( final ProcessorDTO processor : processors ) { + if (processors != null) { + for (final ProcessorDTO processor : processors) { updateControllerServiceIdentifiers(processor.getConfig(), serviceIdMap); } } - - for ( final ProcessGroupDTO processGroupDto : snippet.getProcessGroups() ) { + + for (final ProcessGroupDTO processGroupDto : snippet.getProcessGroups()) { updateControllerServiceIdentifiers(processGroupDto.getContents(), serviceIdMap); } } - + private void updateControllerServiceIdentifiers(final ProcessorConfigDTO configDto, final Map<String, String> serviceIdMap) { - if ( configDto == null ) { + if (configDto == null) { return; } - + final Map<String, String> properties = configDto.getProperties(); final Map<String, PropertyDescriptorDTO> descriptors = configDto.getDescriptors(); - if ( properties != null && descriptors != null ) { - for ( final PropertyDescriptorDTO descriptor : descriptors.values() ) { - if ( descriptor.getIdentifiesControllerService() != null ) { + if (properties != null && descriptors != null) { + for (final PropertyDescriptorDTO descriptor : descriptors.values()) { + if (descriptor.getIdentifiesControllerService() != null) { final String currentServiceId = properties.get(descriptor.getName()); - if ( currentServiceId == null ) { + if (currentServiceId == null) { continue; } - + final String newServiceId = serviceIdMap.get(currentServiceId); properties.put(descriptor.getName(), newServiceId); } } } } - /** * Generates a new id for the current id that is specified. If no seed is http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a53cc3d7/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java index 1f28609..24dd8be 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/util/NiFiTestServer.java @@ -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,21 +130,14 @@ public class NiFiTestServer { jetty.addConnector(https); } - /** - * Starts the server. - * - * @throws Exception - */ + public void startServer() throws Exception { jetty.start(); - + // ensure the ui extensions are set 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)); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a53cc3d7/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/java/org/apache/nifi/web/ContentViewerController.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/java/org/apache/nifi/web/ContentViewerController.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/java/org/apache/nifi/web/ContentViewerController.java index 4d99a69..304f85e 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/java/org/apache/nifi/web/ContentViewerController.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-content-viewer/src/main/java/org/apache/nifi/web/ContentViewerController.java @@ -42,7 +42,7 @@ import org.springframework.security.access.AccessDeniedException; /** * Controller servlet for viewing content. This is responsible for generating - * the markup for the header and footer of the page. Included in that is the + * the markup for the header and footer of the page. Included in that is the * combo that allows the user to choose how they wait to view the data * (original, formatted, hex). If a data viewer is registered for the detected * content type, it will include the markup it generates in the response. @@ -50,13 +50,13 @@ import org.springframework.security.access.AccessDeniedException; public class ContentViewerController extends HttpServlet { private static final Logger logger = LoggerFactory.getLogger(ContentViewerController.class); - + // 1.5kb - multiple of 12 (3 bytes = 4 base 64 encoded chars) private final static int BUFFER_LENGTH = 1536; - + /** * Gets the content and defers to registered viewers to generate the markup. - * + * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs @@ -67,18 +67,18 @@ public class ContentViewerController extends HttpServlet { // get the content final ServletContext servletContext = request.getServletContext(); final ContentAccess contentAccess = (ContentAccess) servletContext.getAttribute("nifi-content-access"); - + final ContentRequestContext contentRequest = getContentRequest(request); if (contentRequest.getDataUri() == null) { request.setAttribute("title", "Error"); request.setAttribute("messages", "The data reference must be specified."); - + // forward to the error page final ServletContext viewerContext = servletContext.getContext("/nifi"); viewerContext.getRequestDispatcher("/message").forward(request, response); return; } - + // get the content final DownloadableContent downloadableContent; try { @@ -86,7 +86,7 @@ public class ContentViewerController extends HttpServlet { } catch (final ResourceNotFoundException rnfe) { request.setAttribute("title", "Error"); request.setAttribute("messages", "Unable to find the specified content"); - + // forward to the error page final ServletContext viewerContext = servletContext.getContext("/nifi"); viewerContext.getRequestDispatcher("/message").forward(request, response); @@ -94,7 +94,7 @@ public class ContentViewerController extends HttpServlet { } catch (final AccessDeniedException ade) { request.setAttribute("title", "Acess Denied"); request.setAttribute("messages", "Unable to approve access to the specified content: " + ade.getMessage()); - + // forward to the error page final ServletContext viewerContext = servletContext.getContext("/nifi"); viewerContext.getRequestDispatcher("/message").forward(request, response); @@ -102,7 +102,7 @@ public class ContentViewerController extends HttpServlet { } catch (final Exception e) { request.setAttribute("title", "Error"); request.setAttribute("messages", "An unexcepted error has occurred: " + e.getMessage()); - + // forward to the error page final ServletContext viewerContext = servletContext.getContext("/nifi"); viewerContext.getRequestDispatcher("/message").forward(request, response); @@ -111,12 +111,12 @@ public class ContentViewerController extends HttpServlet { // determine how we want to view the data String mode = request.getParameter("mode"); - + // if the name isn't set, use original if (mode == null) { mode = DisplayMode.Original.name(); } - + // determine the display mode final DisplayMode displayMode; try { @@ -124,16 +124,16 @@ public class ContentViewerController extends HttpServlet { } catch (final IllegalArgumentException iae) { request.setAttribute("title", "Error"); request.setAttribute("messages", "Invalid display mode: " + mode); - + // forward to the error page final ServletContext viewerContext = servletContext.getContext("/nifi"); viewerContext.getRequestDispatcher("/message").forward(request, response); return; } - + // buffer the content to support reseting in case we need to detect the content type or char encoding final BufferedInputStream bis = new BufferedInputStream(downloadableContent.getContent()); - + // detect the content type final DefaultDetector detector = new DefaultDetector(); @@ -147,33 +147,33 @@ public class ContentViewerController extends HttpServlet { // Get mime type final MediaType mediatype = detector.detect(tikaStream, metadata); final String mimeType = mediatype.toString(); - + // add attributes needed for the header request.setAttribute("filename", downloadableContent.getFilename()); request.setAttribute("contentType", mimeType); - + // generate the header request.getRequestDispatcher("/WEB-INF/jsp/header.jsp").include(request, response); - + // remove the attributes needed for the header request.removeAttribute("filename"); request.removeAttribute("contentType"); - + // generate the markup for the content based on the display mode if (DisplayMode.Hex.equals(displayMode)) { final byte[] buffer = new byte[BUFFER_LENGTH]; final int read = StreamUtils.fillBuffer(bis, buffer, false); - + // trim the byte array if necessary byte[] bytes = buffer; if (read != buffer.length) { bytes = new byte[read]; System.arraycopy(buffer, 0, bytes, 0, read); } - + // convert bytes into the base 64 bytes final String base64 = Base64.encodeBase64String(bytes); - + // defer to the jsp request.setAttribute("content", base64); request.getRequestDispatcher("/WEB-INF/jsp/hexview.jsp").include(request, response); @@ -232,13 +232,13 @@ public class ContentViewerController extends HttpServlet { } catch (final Exception e) { String message = e.getMessage() != null ? e.getMessage() : e.toString(); message = "Unable to generate view of data: " + message; - + // log the error logger.error(message); if (logger.isDebugEnabled()) { logger.error(StringUtils.EMPTY, e); } - + // populate the request attributes request.setAttribute("title", "Error"); request.setAttribute("messages", message); @@ -248,7 +248,7 @@ public class ContentViewerController extends HttpServlet { viewerContext.getRequestDispatcher("/message").forward(request, response); return; } - + // remove the request attribute request.removeAttribute(ViewableContent.CONTENT_REQUEST_ATTRIBUTE); } @@ -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() { http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a53cc3d7/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Deserializer.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Deserializer.java b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Deserializer.java index 017119f..2c13c8b 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Deserializer.java +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Deserializer.java @@ -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; http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a53cc3d7/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java index 8283137..d816e8c 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedMapCacheClient.java @@ -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; http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a53cc3d7/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedSetCacheClient.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedSetCacheClient.java b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedSetCacheClient.java index 534285c..e4f0e5c 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedSetCacheClient.java +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/DistributedSetCacheClient.java @@ -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; } http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a53cc3d7/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Serializer.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Serializer.java b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Serializer.java index f1896be..ac4efd6 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Serializer.java +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-distributed-cache-client-service-api/src/main/java/org/apache/nifi/distributed/cache/client/Serializer.java @@ -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;
