mirror of https://github.com/apache/nifi.git
NIFI-1811 Removed ProcessorLog and updated dependent interfaces
This closes #403. Signed-off-by: Aldrin Piri <aldrin@apache.org>
This commit is contained in:
parent
2d03489ec5
commit
372ffb8aa0
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.nifi.logging;
|
||||
|
||||
/**
|
||||
* The ProcessorLog is an extension of ComponentLog but provides no additional
|
||||
* functionality. It exists because ProcessorLog was created first, but when
|
||||
* Controller Services and Reporting Tasks began to be used more heavily loggers
|
||||
* were needed for them as well. We did not want to return a ProcessorLog to a
|
||||
* ControllerService or a ReportingTask, so all of the methods were moved to a
|
||||
* higher interface named ComponentLog. However, we kept the ProcessorLog
|
||||
* interface around in order to maintain backward compatibility.
|
||||
*/
|
||||
public interface ProcessorLog extends ComponentLog {
|
||||
|
||||
}
|
|
@ -24,7 +24,7 @@ import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
|||
import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
|
||||
import org.apache.nifi.components.AbstractConfigurableComponent;
|
||||
import org.apache.nifi.controller.ControllerServiceLookup;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -46,7 +46,7 @@ import org.apache.nifi.logging.ProcessorLog;
|
|||
public abstract class AbstractSessionFactoryProcessor extends AbstractConfigurableComponent implements Processor {
|
||||
|
||||
private String identifier;
|
||||
private ProcessorLog logger;
|
||||
private ComponentLog logger;
|
||||
private volatile boolean scheduled = false;
|
||||
private volatile boolean configurationRestored = false;
|
||||
private ControllerServiceLookup serviceLookup;
|
||||
|
@ -75,7 +75,7 @@ public abstract class AbstractSessionFactoryProcessor extends AbstractConfigurab
|
|||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
protected final ProcessorLog getLogger() {
|
||||
protected final ComponentLog getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.nifi.processor;
|
||||
|
||||
import org.apache.nifi.controller.ControllerServiceLookup;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -34,10 +34,10 @@ public interface ProcessorInitializationContext {
|
|||
String getIdentifier();
|
||||
|
||||
/**
|
||||
* @return a {@link ProcessorLog} that is tied to this processor that can be
|
||||
* @return a {@link ComponentLog} that is tied to this processor that can be
|
||||
* used to log events
|
||||
*/
|
||||
ProcessorLog getLogger();
|
||||
ComponentLog getLogger();
|
||||
|
||||
/**
|
||||
* @return the {@link ControllerServiceLookup} which can be used to obtain
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -223,7 +223,7 @@ public abstract class BinFiles extends AbstractSessionFactoryProcessor {
|
|||
final List<Bin> bins = new ArrayList<>();
|
||||
bins.add(bin);
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final ProcessSession session = sessionFactory.createSession();
|
||||
|
||||
final List<FlowFileSessionWrapper> binCopy = new ArrayList<>(bin.getContents());
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.nifi.processor.util.listen.dispatcher;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
import org.apache.nifi.processor.util.listen.event.EventFactory;
|
||||
import org.apache.nifi.processor.util.listen.event.EventFactoryUtil;
|
||||
|
@ -45,7 +45,7 @@ public class DatagramChannelDispatcher<E extends Event<DatagramChannel>> impleme
|
|||
private final EventFactory<E> eventFactory;
|
||||
private final BlockingQueue<ByteBuffer> bufferPool;
|
||||
private final EventQueue<E> events;
|
||||
private final ProcessorLog logger;
|
||||
private final ComponentLog logger;
|
||||
private final String sendingHost;
|
||||
private final Integer sendingPort;
|
||||
|
||||
|
@ -56,14 +56,14 @@ public class DatagramChannelDispatcher<E extends Event<DatagramChannel>> impleme
|
|||
public DatagramChannelDispatcher(final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<ByteBuffer> bufferPool,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
this(eventFactory, bufferPool, events, logger, null, null);
|
||||
}
|
||||
|
||||
public DatagramChannelDispatcher(final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<ByteBuffer> bufferPool,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger,
|
||||
final ComponentLog logger,
|
||||
final String sendingHost,
|
||||
final Integer sendingPort) {
|
||||
this.eventFactory = eventFactory;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.nifi.processor.util.listen.dispatcher;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
import org.apache.nifi.processor.util.listen.event.EventFactory;
|
||||
import org.apache.nifi.processor.util.listen.handler.ChannelHandlerFactory;
|
||||
|
@ -55,7 +55,7 @@ public class SocketChannelDispatcher<E extends Event<SocketChannel>> implements
|
|||
private final ChannelHandlerFactory<E, AsyncChannelDispatcher> handlerFactory;
|
||||
private final BlockingQueue<ByteBuffer> bufferPool;
|
||||
private final BlockingQueue<E> events;
|
||||
private final ProcessorLog logger;
|
||||
private final ComponentLog logger;
|
||||
private final int maxConnections;
|
||||
private final SSLContext sslContext;
|
||||
private final SslContextFactory.ClientAuth clientAuth;
|
||||
|
@ -71,7 +71,7 @@ public class SocketChannelDispatcher<E extends Event<SocketChannel>> implements
|
|||
final ChannelHandlerFactory<E, AsyncChannelDispatcher> handlerFactory,
|
||||
final BlockingQueue<ByteBuffer> bufferPool,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger,
|
||||
final ComponentLog logger,
|
||||
final int maxConnections,
|
||||
final SSLContext sslContext,
|
||||
final Charset charset) {
|
||||
|
@ -82,7 +82,7 @@ public class SocketChannelDispatcher<E extends Event<SocketChannel>> implements
|
|||
final ChannelHandlerFactory<E, AsyncChannelDispatcher> handlerFactory,
|
||||
final BlockingQueue<ByteBuffer> bufferPool,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger,
|
||||
final ComponentLog logger,
|
||||
final int maxConnections,
|
||||
final SSLContext sslContext,
|
||||
final SslContextFactory.ClientAuth clientAuth,
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
package org.apache.nifi.processor.util.listen.event;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -36,13 +35,13 @@ public class EventQueue<E extends Event> {
|
|||
|
||||
private final long offerWaitMs;
|
||||
private final BlockingQueue<E> events;
|
||||
private final ProcessorLog logger;
|
||||
private final ComponentLog logger;
|
||||
|
||||
public EventQueue(final BlockingQueue<E> events, final ProcessorLog logger) {
|
||||
public EventQueue(final BlockingQueue<E> events, final ComponentLog logger) {
|
||||
this(events, DEFAULT_OFFER_WAIT_MS, logger);
|
||||
}
|
||||
|
||||
public EventQueue(final BlockingQueue<E> events, final long offerWaitMs, final ProcessorLog logger) {
|
||||
public EventQueue(final BlockingQueue<E> events, final long offerWaitMs, final ComponentLog logger) {
|
||||
this.events = events;
|
||||
this.offerWaitMs = offerWaitMs;
|
||||
this.logger = logger;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processor.util.listen.handler;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.ChannelDispatcher;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
import org.apache.nifi.processor.util.listen.event.EventFactory;
|
||||
|
@ -36,15 +36,14 @@ public abstract class ChannelHandler<E extends Event, D extends ChannelDispatche
|
|||
protected final Charset charset;
|
||||
protected final EventFactory<E> eventFactory;
|
||||
protected final EventQueue<E> events;
|
||||
protected final ProcessorLog logger;
|
||||
|
||||
protected final ComponentLog logger;
|
||||
|
||||
public ChannelHandler(final SelectionKey key,
|
||||
final D dispatcher,
|
||||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
this.key = key;
|
||||
this.dispatcher = dispatcher;
|
||||
this.charset = charset;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processor.util.listen.handler;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.ChannelDispatcher;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
import org.apache.nifi.processor.util.listen.event.EventFactory;
|
||||
|
@ -35,12 +35,12 @@ public interface ChannelHandlerFactory<E extends Event, D extends ChannelDispatc
|
|||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger);
|
||||
final ComponentLog logger);
|
||||
|
||||
ChannelHandler<E, D> createSSLHandler(final SelectionKey key,
|
||||
final D dispatcher,
|
||||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger);
|
||||
final ComponentLog logger);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.nifi.processor.util.listen.handler.socket;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.AsyncChannelDispatcher;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.SocketChannelAttachment;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
|
@ -51,7 +51,7 @@ public class SSLSocketChannelHandler<E extends Event<SocketChannel>> extends Soc
|
|||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
super(key, dispatcher, charset, eventFactory, events, logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processor.util.listen.handler.socket;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.AsyncChannelDispatcher;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
import org.apache.nifi.processor.util.listen.event.EventFactory;
|
||||
|
@ -39,7 +39,7 @@ public abstract class SocketChannelHandler<E extends Event<SocketChannel>> exten
|
|||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
super(key, dispatcher, charset, eventFactory, events, logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processor.util.listen.handler.socket;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.AsyncChannelDispatcher;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
import org.apache.nifi.processor.util.listen.event.EventFactory;
|
||||
|
@ -39,7 +39,7 @@ public class SocketChannelHandlerFactory<E extends Event<SocketChannel>> impleme
|
|||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
return new StandardSocketChannelHandler<>(key, dispatcher, charset, eventFactory, events, logger);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class SocketChannelHandlerFactory<E extends Event<SocketChannel>> impleme
|
|||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
return new SSLSocketChannelHandler<>(key, dispatcher, charset, eventFactory, events, logger);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.nifi.processor.util.listen.handler.socket;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.AsyncChannelDispatcher;
|
||||
import org.apache.nifi.processor.util.listen.dispatcher.SocketChannelAttachment;
|
||||
import org.apache.nifi.processor.util.listen.event.Event;
|
||||
|
@ -50,7 +50,7 @@ public class StandardSocketChannelHandler<E extends Event<SocketChannel>> extend
|
|||
final Charset charset,
|
||||
final EventFactory<E> eventFactory,
|
||||
final BlockingQueue<E> events,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
super(key, dispatcher, charset, eventFactory, events, logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processor.util.put.sender;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
|
@ -29,12 +28,12 @@ public abstract class ChannelSender {
|
|||
protected final int port;
|
||||
protected final String host;
|
||||
protected final int maxSendBufferSize;
|
||||
protected final ProcessorLog logger;
|
||||
protected final ComponentLog logger;
|
||||
|
||||
protected volatile int timeout = 10000;
|
||||
protected volatile long lastUsed;
|
||||
|
||||
public ChannelSender(final String host, final int port, final int maxSendBufferSize, final ProcessorLog logger) {
|
||||
public ChannelSender(final String host, final int port, final int maxSendBufferSize, final ComponentLog logger) {
|
||||
this.port = port;
|
||||
this.host = host;
|
||||
this.maxSendBufferSize = maxSendBufferSize;
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
package org.apache.nifi.processor.util.put.sender;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
|
@ -33,7 +32,7 @@ public class DatagramChannelSender extends ChannelSender {
|
|||
|
||||
private DatagramChannel channel;
|
||||
|
||||
public DatagramChannelSender(final String host, final int port, final int maxSendBufferSize, final ProcessorLog logger) {
|
||||
public DatagramChannelSender(final String host, final int port, final int maxSendBufferSize, final ComponentLog logger) {
|
||||
super(host, port, maxSendBufferSize, logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.nifi.processor.util.put.sender;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.remote.io.socket.ssl.SSLSocketChannel;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
@ -35,7 +35,7 @@ public class SSLSocketChannelSender extends SocketChannelSender {
|
|||
final int port,
|
||||
final int maxSendBufferSize,
|
||||
final SSLContext sslContext,
|
||||
final ProcessorLog logger) {
|
||||
final ComponentLog logger) {
|
||||
super(host, port, maxSendBufferSize, logger);
|
||||
this.sslContext = sslContext;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/package org.apache.nifi.processor.util.put.sender;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.remote.io.socket.SocketChannelOutputStream;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -34,7 +34,7 @@ public class SocketChannelSender extends ChannelSender {
|
|||
protected SocketChannel channel;
|
||||
protected SocketChannelOutputStream socketChannelOutput;
|
||||
|
||||
public SocketChannelSender(final String host, final int port, final int maxSendBufferSize, final ProcessorLog logger) {
|
||||
public SocketChannelSender(final String host, final int port, final int maxSendBufferSize, final ComponentLog logger) {
|
||||
super(host, port, maxSendBufferSize, logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -232,13 +232,13 @@ This object exposes configuration to the Processor that will not
|
|||
change throughout the life of the Processor,
|
||||
such as the unique identifier of the Processor.
|
||||
|
||||
[[ProcessorLog]]
|
||||
==== ProcessorLog
|
||||
[[ComponentLog]]
|
||||
==== ComponentLog
|
||||
Processors are encouraged to perform their logging via the
|
||||
`ProcessorLog` interface, rather than obtaining
|
||||
`ComponentLog` interface, rather than obtaining
|
||||
a direct instance of a third-party logger. This is because logging via
|
||||
the ProcessorLog allows the framework
|
||||
to render log messages that exceed s a configurable severity level to
|
||||
the ComponentLog allows the framework
|
||||
to render log messages that exceeds a configurable severity level to
|
||||
the User Interface, allowing those who
|
||||
monitor the dataflow to be notified when important events occur.
|
||||
Additionally, it provides a consistent logging
|
||||
|
@ -267,7 +267,7 @@ When a Processor is created, before any other methods are invoked, the
|
|||
AbstractProcessor will be invoked. The method takes a single argument,
|
||||
which is of type
|
||||
`ProcessorInitializationContext`. The context object supplies the
|
||||
Processor with a ProcessorLog,
|
||||
Processor with a ComponentLog,
|
||||
the Processor's unique identifier, and a ControllerServiceLookup that
|
||||
can be used to interact with the
|
||||
configured ControllerServices. Each of these objects is stored by the
|
||||
|
@ -632,7 +632,7 @@ The `MockStateManager` also provides the ability to indicate that the unit test
|
|||
|
||||
Processors are responsible for reporting their activity so that users
|
||||
are able to understand what happens
|
||||
to their data. Processors should log events via the ProcessorLog,
|
||||
to their data. Processors should log events via the ComponentLog,
|
||||
which is accessible via the InitializationContext
|
||||
or by calling the `getLogger` method of `AbstractProcessor`.
|
||||
|
||||
|
|
|
@ -18,17 +18,17 @@ package org.apache.nifi.util;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.logging.LogLevel;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MockProcessorLog implements ProcessorLog {
|
||||
public class MockComponentLog implements ComponentLog {
|
||||
|
||||
private final CapturingLogger logger;
|
||||
private final Object component;
|
||||
|
||||
public MockProcessorLog(final String componentId, final Object component) {
|
||||
public MockComponentLog(final String componentId, final Object component) {
|
||||
this.logger = new CapturingLogger(LoggerFactory.getLogger(component.getClass()));
|
||||
this.component = component;
|
||||
}
|
|
@ -34,7 +34,7 @@ public class MockControllerServiceInitializationContext extends MockControllerSe
|
|||
}
|
||||
|
||||
public MockControllerServiceInitializationContext(final ControllerService controllerService, final String identifier, final StateManager stateManager) {
|
||||
this(controllerService, identifier, new MockProcessorLog(identifier, controllerService), stateManager);
|
||||
this(controllerService, identifier, new MockComponentLog(identifier, controllerService), stateManager);
|
||||
}
|
||||
|
||||
public MockControllerServiceInitializationContext(final ControllerService controllerService, final String identifier, final ComponentLog logger, final StateManager stateManager) {
|
||||
|
|
|
@ -26,13 +26,13 @@ import org.apache.nifi.processor.ProcessorInitializationContext;
|
|||
|
||||
public class MockProcessorInitializationContext implements ProcessorInitializationContext, ControllerServiceLookup {
|
||||
|
||||
private final MockProcessorLog logger;
|
||||
private final MockComponentLog logger;
|
||||
private final String processorId;
|
||||
private final MockProcessContext context;
|
||||
|
||||
public MockProcessorInitializationContext(final Processor processor, final MockProcessContext context) {
|
||||
processorId = UUID.randomUUID().toString();
|
||||
logger = new MockProcessorLog(processorId, processor);
|
||||
logger = new MockComponentLog(processorId, processor);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class MockProcessorInitializationContext implements ProcessorInitializati
|
|||
}
|
||||
|
||||
@Override
|
||||
public MockProcessorLog getLogger() {
|
||||
public MockComponentLog getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ public class StandardProcessorTestRunner implements TestRunner {
|
|||
|
||||
private static final Set<Class<? extends Annotation>> deprecatedTypeAnnotations = new HashSet<>();
|
||||
private static final Set<Class<? extends Annotation>> deprecatedMethodAnnotations = new HashSet<>();
|
||||
private final Map<String, MockProcessorLog> controllerServiceLoggers = new HashMap<>();
|
||||
private final MockProcessorLog logger;
|
||||
private final Map<String, MockComponentLog> controllerServiceLoggers = new HashMap<>();
|
||||
private final MockComponentLog logger;
|
||||
|
||||
static {
|
||||
// do this in a separate method, just so that we can add a @SuppressWarnings annotation
|
||||
|
@ -640,7 +640,7 @@ public class StandardProcessorTestRunner implements TestRunner {
|
|||
// }
|
||||
// }
|
||||
|
||||
final MockProcessorLog logger = new MockProcessorLog(identifier, service);
|
||||
final MockComponentLog logger = new MockComponentLog(identifier, service);
|
||||
controllerServiceLoggers.put(identifier, logger);
|
||||
final MockStateManager serviceStateManager = new MockStateManager(service);
|
||||
final MockControllerServiceInitializationContext initContext = new MockControllerServiceInitializationContext(requireNonNull(service), requireNonNull(identifier), logger, serviceStateManager);
|
||||
|
@ -869,12 +869,12 @@ public class StandardProcessorTestRunner implements TestRunner {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MockProcessorLog getLogger() {
|
||||
public MockComponentLog getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MockProcessorLog getControllerServiceLogger(final String identifier) {
|
||||
public MockComponentLog getControllerServiceLogger(final String identifier) {
|
||||
return controllerServiceLoggers.get(identifier);
|
||||
}
|
||||
|
||||
|
|
|
@ -875,18 +875,18 @@ public interface TestRunner {
|
|||
void clearProvenanceEvents();
|
||||
|
||||
/**
|
||||
* Returns the {@link MockProcessorLog} that is used by the Processor under test.
|
||||
* Returns the {@link MockComponentLog} that is used by the Processor under test.
|
||||
* @return the logger
|
||||
*/
|
||||
public MockProcessorLog getLogger();
|
||||
public MockComponentLog getLogger();
|
||||
|
||||
/**
|
||||
* Returns the {@link MockProcessorLog} that is used by the specified controller service.
|
||||
* Returns the {@link MockComponentLog} that is used by the specified controller service.
|
||||
*
|
||||
* @param identifier a controller service identifier
|
||||
* @return the logger
|
||||
*/
|
||||
public MockProcessorLog getControllerServiceLogger(final String identifier);
|
||||
public MockComponentLog getControllerServiceLogger(final String identifier);
|
||||
|
||||
/**
|
||||
* @return the State Manager that is used to stored and retrieve state
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.nifi.amqp.processors;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -38,7 +38,7 @@ final class AMQPPublisher extends AMQPWorker {
|
|||
|
||||
private final String routingKey;
|
||||
|
||||
private final ProcessorLog processLog;
|
||||
private final ComponentLog processLog;
|
||||
|
||||
/**
|
||||
* Creates an instance of this publisher
|
||||
|
@ -52,7 +52,7 @@ final class AMQPPublisher extends AMQPWorker {
|
|||
* (required) the name of the routingKey to be used by AMQP-based
|
||||
* system to route messages to its final destination (queue).
|
||||
*/
|
||||
AMQPPublisher(Connection connection, String exchangeName, String routingKey, ProcessorLog processLog) {
|
||||
AMQPPublisher(Connection connection, String exchangeName, String routingKey, ComponentLog processLog) {
|
||||
super(connection);
|
||||
this.processLog = processLog;
|
||||
this.validateStringProperty("routingKey", routingKey);
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.nifi.util.MockProcessorLog;
|
||||
import org.apache.nifi.util.MockComponentLog;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class AMQPPublisherTest {
|
|||
connection.createChannel().addReturnListener(retListener);
|
||||
|
||||
try (AMQPPublisher sender = new AMQPPublisher(connection, "myExchange", "key2",
|
||||
new MockProcessorLog("foo", ""))) {
|
||||
new MockComponentLog("foo", ""))) {
|
||||
sender.publish("hello".getBytes());
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.nifi.components.PropertyValue;
|
|||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.util.StandardValidators;
|
||||
|
@ -183,7 +183,7 @@ public abstract class AbstractCassandraProcessor extends AbstractProcessor {
|
|||
|
||||
protected void connectToCassandra(ProcessContext context) {
|
||||
if (cluster.get() == null) {
|
||||
ProcessorLog log = getLogger();
|
||||
ComponentLog log = getLogger();
|
||||
final String contactPointList = context.getProperty(CONTACT_POINTS).getValue();
|
||||
final String consistencyLevel = context.getProperty(CONSISTENCY_LEVEL).getValue();
|
||||
List<InetSocketAddress> contactPoints = getContactPoints(contactPointList);
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.apache.nifi.annotation.lifecycle.OnShutdown;
|
|||
import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -150,7 +150,7 @@ public class PutCassandraQL extends AbstractCassandraProcessor {
|
|||
|
||||
@OnScheduled
|
||||
public void onScheduled(final ProcessContext context) {
|
||||
ProcessorLog log = getLogger();
|
||||
ComponentLog log = getLogger();
|
||||
try {
|
||||
connectToCassandra(context);
|
||||
} catch (final NoHostAvailableException nhae) {
|
||||
|
@ -169,7 +169,7 @@ public class PutCassandraQL extends AbstractCassandraProcessor {
|
|||
|
||||
@Override
|
||||
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
|
||||
ProcessorLog logger = getLogger();
|
||||
ComponentLog logger = getLogger();
|
||||
FlowFile flowFile = session.get();
|
||||
if (flowFile == null) {
|
||||
return;
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.nifi.annotation.behavior.WritesAttributes;
|
|||
import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -175,7 +175,7 @@ public class QueryCassandra extends AbstractCassandraProcessor {
|
|||
|
||||
@OnScheduled
|
||||
public void onScheduled(final ProcessContext context) {
|
||||
ProcessorLog log = getLogger();
|
||||
ComponentLog log = getLogger();
|
||||
try {
|
||||
connectToCassandra(context);
|
||||
final int fetchSize = context.getProperty(FETCH_SIZE).asInteger();
|
||||
|
@ -212,7 +212,7 @@ public class QueryCassandra extends AbstractCassandraProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String selectQuery = context.getProperty(CQL_SELECT_QUERY).evaluateAttributeExpressions(fileToProcess).getValue();
|
||||
final long queryTimeout = context.getProperty(QUERY_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS);
|
||||
final String outputFormat = context.getProperty(OUTPUT_FORMAT).getValue();
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.couchbase.CouchbaseAttributes;
|
||||
import org.apache.nifi.couchbase.CouchbaseClusterControllerService;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -178,7 +178,7 @@ public abstract class AbstractCouchbaseProcessor extends AbstractProcessor {
|
|||
* @param errMsg a message to be logged
|
||||
*/
|
||||
protected void handleCouchbaseException(final ProcessContext context, final ProcessSession session,
|
||||
final ProcessorLog logger, FlowFile inFile, CouchbaseException e,
|
||||
final ComponentLog logger, FlowFile inFile, CouchbaseException e,
|
||||
String errMsg) {
|
||||
logger.error(errMsg, e);
|
||||
if (inFile != null) {
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.couchbase.CouchbaseAttributes;
|
||||
import org.apache.nifi.couchbase.CouchbaseClusterControllerService;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -92,7 +92,7 @@ public class GetCouchbaseKey extends AbstractCouchbaseProcessor {
|
|||
}
|
||||
|
||||
final long startNanos = System.nanoTime();
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
String docId = null;
|
||||
if (!StringUtils.isEmpty(context.getProperty(DOC_ID).getValue())) {
|
||||
docId = context.getProperty(DOC_ID).evaluateAttributeExpressions(inFile).getValue();
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.nifi.couchbase.CouchbaseAttributes;
|
|||
import org.apache.nifi.couchbase.CouchbaseClusterControllerService;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -105,7 +105,7 @@ public class PutCouchbaseKey extends AbstractCouchbaseProcessor {
|
|||
|
||||
@Override
|
||||
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
FlowFile flowFile = session.get();
|
||||
if (flowFile == null) {
|
||||
return;
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
|
@ -182,7 +182,7 @@ public abstract class AbstractElasticsearchProcessor extends AbstractProcessor {
|
|||
*/
|
||||
protected void createElasticsearchClient(ProcessContext context) throws ProcessException {
|
||||
|
||||
ProcessorLog log = getLogger();
|
||||
ComponentLog log = getLogger();
|
||||
if (esClient.get() != null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
|||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -153,7 +153,7 @@ public class FetchElasticsearch extends AbstractElasticsearchProcessor {
|
|||
final String docType = context.getProperty(TYPE).evaluateAttributeExpressions(flowFile).getValue();
|
||||
final Charset charset = Charset.forName(context.getProperty(CHARSET).getValue());
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
try {
|
||||
|
||||
logger.debug("Fetching {}/{}/{} from Elasticsearch", new Object[]{index, docType, docId});
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.nifi.annotation.lifecycle.OnStopped;
|
|||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.expression.AttributeExpression;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -154,7 +154,7 @@ public class PutElasticsearch extends AbstractElasticsearchProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
// Keep track of the list of flow files that need to be transferred. As they are transferred, remove them from the list.
|
||||
List<FlowFile> flowFilesToTransfer = new LinkedList<>(flowFiles);
|
||||
try {
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.nifi.documentation.mock.MockConfigurationContext;
|
|||
import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext;
|
||||
import org.apache.nifi.documentation.mock.MockProcessorLogger;
|
||||
import org.apache.nifi.documentation.util.ReflectionUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class ControllerServiceInitializer implements ConfigurableComponentInitia
|
|||
try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||
ControllerService controllerService = (ControllerService) component;
|
||||
|
||||
final ProcessorLog logger = new MockProcessorLogger();
|
||||
final ComponentLog logger = new MockProcessorLogger();
|
||||
final MockConfigurationContext context = new MockConfigurationContext();
|
||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, controllerService, logger, context);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.nifi.documentation.mock.MockProcessContext;
|
|||
import org.apache.nifi.documentation.mock.MockProcessorInitializationContext;
|
||||
import org.apache.nifi.documentation.mock.MockProcessorLogger;
|
||||
import org.apache.nifi.documentation.util.ReflectionUtils;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
import org.apache.nifi.processor.Processor;
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class ProcessorInitializer implements ConfigurableComponentInitializer {
|
|||
Processor processor = (Processor) component;
|
||||
try (NarCloseable narCloseable = NarCloseable.withNarLoader()) {
|
||||
|
||||
final ProcessorLog logger = new MockProcessorLogger();
|
||||
final ComponentLog logger = new MockProcessorLogger();
|
||||
final MockProcessContext context = new MockProcessContext();
|
||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, processor, logger, context);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.nifi.documentation.mock;
|
||||
|
||||
import org.apache.nifi.controller.ControllerServiceLookup;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessorInitializationContext;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ public class MockProcessorInitializationContext implements ProcessorInitializati
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProcessorLog getLogger() {
|
||||
public ComponentLog getLogger() {
|
||||
return new MockProcessorLogger();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.apache.nifi.documentation.mock;
|
||||
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.logging.LogLevel;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
* be used during initialization of a component.
|
||||
*
|
||||
*/
|
||||
public class MockProcessorLogger implements ProcessorLog {
|
||||
public class MockProcessorLogger implements ComponentLog {
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(MockProcessorLogger.class);
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -43,13 +43,13 @@ public class ReflectionUtils {
|
|||
* @param preferredAnnotation preferred
|
||||
* @param alternateAnnotation alternate
|
||||
* @param instance instance
|
||||
* @param logger the ProcessorLog to use for logging any errors. If null, will use own logger, but that will not generate bulletins or easily tie to the Processor's log messages.
|
||||
* @param logger the ComponentLog to use for logging any errors. If null, will use own logger, but that will not generate bulletins or easily tie to the Processor's log messages.
|
||||
* @param args args
|
||||
* @return <code>true</code> if all appropriate methods were invoked and returned without throwing an Exception, <code>false</code> if one of the methods threw an Exception or could not be
|
||||
* invoked; if <code>false</code> is returned, an error will have been logged.
|
||||
*/
|
||||
public static boolean quietlyInvokeMethodsWithAnnotations(
|
||||
final Class<? extends Annotation> preferredAnnotation, final Class<? extends Annotation> alternateAnnotation, final Object instance, final ProcessorLog logger, final Object... args) {
|
||||
final Class<? extends Annotation> preferredAnnotation, final Class<? extends Annotation> alternateAnnotation, final Object instance, final ComponentLog logger, final Object... args) {
|
||||
final List<Class<? extends Annotation>> annotationClasses = new ArrayList<>(alternateAnnotation == null ? 1 : 2);
|
||||
annotationClasses.add(preferredAnnotation);
|
||||
if (alternateAnnotation != null) {
|
||||
|
|
|
@ -169,7 +169,6 @@ import org.apache.nifi.logging.ControllerServiceLogObserver;
|
|||
import org.apache.nifi.logging.LogLevel;
|
||||
import org.apache.nifi.logging.LogRepository;
|
||||
import org.apache.nifi.logging.LogRepositoryFactory;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ProcessorLogObserver;
|
||||
import org.apache.nifi.logging.ReportingTaskLogObserver;
|
||||
import org.apache.nifi.nar.ExtensionManager;
|
||||
|
@ -991,7 +990,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, R
|
|||
Thread.currentThread().setContextClassLoader(detectedClassLoaderForType);
|
||||
final Class<? extends Processor> processorClass = rawClass.asSubclass(Processor.class);
|
||||
processor = processorClass.newInstance();
|
||||
final ProcessorLog processorLogger = new SimpleProcessLogger(identifier, processor);
|
||||
final ComponentLog processorLogger = new SimpleProcessLogger(identifier, processor);
|
||||
final ProcessorInitializationContext ctx = new StandardProcessorInitializationContext(identifier, processorLogger, this);
|
||||
processor.initialize(ctx);
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ import org.apache.nifi.connectable.Position;
|
|||
import org.apache.nifi.controller.service.ControllerServiceNode;
|
||||
import org.apache.nifi.controller.service.ControllerServiceProvider;
|
||||
import org.apache.nifi.groups.ProcessGroup;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.logging.LogLevel;
|
||||
import org.apache.nifi.logging.LogRepositoryFactory;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSessionFactory;
|
||||
|
@ -1247,7 +1247,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
|
|||
if (!this.isValid()) {
|
||||
throw new IllegalStateException( "Processor " + this.getName() + " is not in a valid state due to " + this.getValidationErrors());
|
||||
}
|
||||
final ProcessorLog procLog = new SimpleProcessLogger(StandardProcessorNode.this.getIdentifier(), processor);
|
||||
final ComponentLog procLog = new SimpleProcessLogger(StandardProcessorNode.this.getIdentifier(), processor);
|
||||
if (this.scheduledState.compareAndSet(ScheduledState.STOPPED, ScheduledState.STARTING)) { // will ensure that the Processor represented by this node can only be started once
|
||||
final Runnable startProcRunnable = new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.nifi.controller.repository.StandardProcessSessionFactory;
|
|||
import org.apache.nifi.controller.service.ControllerServiceProvider;
|
||||
import org.apache.nifi.encrypt.StringEncryptor;
|
||||
import org.apache.nifi.engine.FlowEngine;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
import org.apache.nifi.processor.ProcessSessionFactory;
|
||||
import org.apache.nifi.processor.SimpleProcessLogger;
|
||||
|
@ -328,11 +328,11 @@ public class EventDrivenSchedulingAgent extends AbstractSchedulingAgent {
|
|||
try (final AutoCloseable ncl = NarCloseable.withNarLoader()) {
|
||||
worker.onTrigger(processContext, sessionFactory);
|
||||
} catch (final ProcessException pe) {
|
||||
final ProcessorLog procLog = new SimpleProcessLogger(worker.getIdentifier(), worker.getProcessor());
|
||||
final ComponentLog procLog = new SimpleProcessLogger(worker.getIdentifier(), worker.getProcessor());
|
||||
procLog.error("Failed to process session due to {}", new Object[]{pe});
|
||||
} catch (final Throwable t) {
|
||||
// Use ProcessorLog to log the event so that a bulletin will be created for this processor
|
||||
final ProcessorLog procLog = new SimpleProcessLogger(worker.getIdentifier(), worker.getProcessor());
|
||||
// Use ComponentLog to log the event so that a bulletin will be created for this processor
|
||||
final ComponentLog procLog = new SimpleProcessLogger(worker.getIdentifier(), worker.getProcessor());
|
||||
procLog.error("{} failed to process session due to {}", new Object[]{worker.getProcessor(), t});
|
||||
procLog.warn("Processor Administratively Yielded for {} due to processing failure", new Object[]{adminYieldDuration});
|
||||
logger.warn("Administratively Yielding {} due to uncaught Exception: ", worker.getProcessor());
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.nifi.controller.repository.StandardProcessSessionFactory;
|
|||
import org.apache.nifi.controller.scheduling.ProcessContextFactory;
|
||||
import org.apache.nifi.controller.scheduling.ScheduleState;
|
||||
import org.apache.nifi.controller.scheduling.SchedulingAgent;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.nar.NarCloseable;
|
||||
import org.apache.nifi.processor.ProcessSessionFactory;
|
||||
import org.apache.nifi.processor.SimpleProcessLogger;
|
||||
|
@ -157,11 +157,11 @@ public class ContinuallyRunProcessorTask implements Callable<Boolean> {
|
|||
}
|
||||
}
|
||||
} catch (final ProcessException pe) {
|
||||
final ProcessorLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor());
|
||||
final ComponentLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor());
|
||||
procLog.error("Failed to process session due to {}", new Object[]{pe});
|
||||
} catch (final Throwable t) {
|
||||
// Use ProcessorLog to log the event so that a bulletin will be created for this processor
|
||||
final ProcessorLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor());
|
||||
// Use ComponentLog to log the event so that a bulletin will be created for this processor
|
||||
final ComponentLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor());
|
||||
procLog.error("{} failed to process session due to {}", new Object[]{procNode.getProcessor(), t});
|
||||
procLog.warn("Processor Administratively Yielded for {} due to processing failure", new Object[]{schedulingAgent.getAdministrativeYieldDuration()});
|
||||
logger.warn("Administratively Yielding {} due to uncaught Exception: {}", procNode.getProcessor(), t.toString());
|
||||
|
@ -175,7 +175,7 @@ public class ContinuallyRunProcessorTask implements Callable<Boolean> {
|
|||
try {
|
||||
rawSession.commit();
|
||||
} catch (final Exception e) {
|
||||
final ProcessorLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor());
|
||||
final ComponentLog procLog = new SimpleProcessLogger(procNode.getIdentifier(), procNode.getProcessor());
|
||||
procLog.error("Failed to commit session {} due to {}; rolling back", new Object[] { rawSession, e.toString() }, e);
|
||||
|
||||
try {
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
*/
|
||||
package org.apache.nifi.processor;
|
||||
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.logging.LogLevel;
|
||||
import org.apache.nifi.logging.LogRepository;
|
||||
import org.apache.nifi.logging.LogRepositoryFactory;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SimpleProcessLogger implements ProcessorLog {
|
||||
public class SimpleProcessLogger implements ComponentLog {
|
||||
|
||||
private final Logger logger;
|
||||
private final LogRepository logRepository;
|
||||
|
|
|
@ -18,15 +18,15 @@ package org.apache.nifi.processor;
|
|||
|
||||
import org.apache.nifi.controller.ControllerServiceLookup;
|
||||
import org.apache.nifi.controller.service.ControllerServiceProvider;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
|
||||
public class StandardProcessorInitializationContext implements ProcessorInitializationContext {
|
||||
|
||||
private final String identifier;
|
||||
private final ProcessorLog logger;
|
||||
private final ComponentLog logger;
|
||||
private final ControllerServiceProvider serviceProvider;
|
||||
|
||||
public StandardProcessorInitializationContext(final String identifier, final ProcessorLog processorLog, final ControllerServiceProvider serviceProvider) {
|
||||
public StandardProcessorInitializationContext(final String identifier, final ComponentLog processorLog, final ControllerServiceProvider serviceProvider) {
|
||||
this.identifier = identifier;
|
||||
this.logger = processorLog;
|
||||
this.serviceProvider = serviceProvider;
|
||||
|
@ -38,7 +38,7 @@ public class StandardProcessorInitializationContext implements ProcessorInitiali
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProcessorLog getLogger() {
|
||||
public ComponentLog getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
|
@ -98,7 +98,7 @@ public class ReflectionUtils {
|
|||
* invoked; if <code>false</code> is returned, an error will have been logged.
|
||||
*/
|
||||
public static boolean quietlyInvokeMethodsWithAnnotation(final Class<? extends Annotation> annotation,
|
||||
final Object instance, final ProcessorLog logger, final Object... args) {
|
||||
final Object instance, final ComponentLog logger, final Object... args) {
|
||||
return quietlyInvokeMethodsWithAnnotations(annotation, null, instance, logger, args);
|
||||
}
|
||||
|
||||
|
@ -119,13 +119,13 @@ public class ReflectionUtils {
|
|||
return quietlyInvokeMethodsWithAnnotations(preferredAnnotation, alternateAnnotation, instance, null, args);
|
||||
}
|
||||
|
||||
private static boolean invokeMethodsWithAnnotations(boolean quietly, ProcessorLog logger, Object instance,
|
||||
private static boolean invokeMethodsWithAnnotations(boolean quietly, ComponentLog logger, Object instance,
|
||||
Class<? extends Annotation>[] annotations, Object... args)
|
||||
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||
return invokeMethodsWithAnnotations(quietly, logger, instance, instance.getClass(), annotations, args);
|
||||
}
|
||||
|
||||
private static boolean invokeMethodsWithAnnotations(boolean quietly, ProcessorLog logger, Object instance,
|
||||
private static boolean invokeMethodsWithAnnotations(boolean quietly, ComponentLog logger, Object instance,
|
||||
Class<?> clazz, Class<? extends Annotation>[] annotations, Object... args)
|
||||
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
|
||||
boolean isSuccess = true;
|
||||
|
@ -159,7 +159,7 @@ public class ReflectionUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static Object[] buildUpdatedArgumentsList(boolean quietly, Method method, Class<?>[] annotations, ProcessorLog processLogger, Object... args) {
|
||||
private static Object[] buildUpdatedArgumentsList(boolean quietly, Method method, Class<?>[] annotations, ComponentLog processLogger, Object... args) {
|
||||
boolean parametersCompatible = true;
|
||||
int argsCount = 0;
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class ReflectionUtils {
|
|||
return updatedArguments;
|
||||
}
|
||||
|
||||
private static void logErrorMessage(String message, ProcessorLog processLogger, Exception e) {
|
||||
private static void logErrorMessage(String message, ComponentLog processLogger, Exception e) {
|
||||
if (processLogger != null) {
|
||||
if (e != null) {
|
||||
processLogger.error(message, e);
|
||||
|
@ -214,7 +214,7 @@ public class ReflectionUtils {
|
|||
* @param preferredAnnotation preferred
|
||||
* @param alternateAnnotation alternate
|
||||
* @param instance instance
|
||||
* @param logger the ProcessorLog to use for logging any errors. If null, will
|
||||
* @param logger the ComponentLog to use for logging any errors. If null, will
|
||||
* use own logger, but that will not generate bulletins or easily
|
||||
* tie to the Processor's log messages.
|
||||
* @param args args
|
||||
|
@ -225,7 +225,7 @@ public class ReflectionUtils {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static boolean quietlyInvokeMethodsWithAnnotations(final Class<? extends Annotation> preferredAnnotation,
|
||||
final Class<? extends Annotation> alternateAnnotation, final Object instance, final ProcessorLog logger,
|
||||
final Class<? extends Annotation> alternateAnnotation, final Object instance, final ComponentLog logger,
|
||||
final Object... args) {
|
||||
Class<? extends Annotation>[] annotationArray = (Class<? extends Annotation>[]) (alternateAnnotation != null
|
||||
? new Class<?>[] { preferredAnnotation, alternateAnnotation } : new Class<?>[] { preferredAnnotation });
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
@ -93,7 +93,7 @@ public class ReflectionUtilsTest {
|
|||
|
||||
@Test
|
||||
public void validateNoFailureIfQuiatelyIfOneOfArgumentsWrongTypeAndProcessLog() throws Exception {
|
||||
ProcessorLog pl = mock(ProcessorLog.class);
|
||||
ComponentLog pl = mock(ComponentLog.class);
|
||||
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnStopped.class, new E(), pl, 3, "hjk", "hjk");
|
||||
verify(pl, Mockito.atMost(1)).error(Mockito.anyString());
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.nifi.annotation.documentation.SeeAlso;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -82,7 +82,7 @@ public class GetHDFSSequenceFile extends GetHDFS {
|
|||
int bufferSize = bufferSizeProp.intValue();
|
||||
conf.setInt(BUFFER_SIZE_KEY, bufferSize);
|
||||
}
|
||||
ProcessorLog logger = getLogger();
|
||||
ComponentLog logger = getLogger();
|
||||
final SequenceFileReader<Set<FlowFile>> reader;
|
||||
if (flowFileContentValue.equalsIgnoreCase(VALUE_ONLY)) {
|
||||
reader = new ValueReader(session);
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -115,7 +115,7 @@ public class ExtractImageMetadata extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = this.getLogger();
|
||||
final ComponentLog logger = this.getLogger();
|
||||
final ObjectHolder<Metadata> value = new ObjectHolder<>(null);
|
||||
final Integer max = context.getProperty(MAX_NUMBER_OF_ATTRIBUTES).asInteger();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import javax.jms.Queue;
|
|||
import javax.jms.TextMessage;
|
||||
import javax.jms.Topic;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
|
@ -48,9 +48,9 @@ final class JMSConsumer extends JMSWorker {
|
|||
* @param jmsTemplate
|
||||
* instance of {@link JmsTemplate}
|
||||
* @param processLog
|
||||
* instance of {@link ProcessorLog}
|
||||
* instance of {@link ComponentLog}
|
||||
*/
|
||||
JMSConsumer(JmsTemplate jmsTemplate, ProcessorLog processLog) {
|
||||
JMSConsumer(JmsTemplate jmsTemplate, ComponentLog processLog) {
|
||||
super(jmsTemplate, processLog);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Created Message Consumer for '" + jmsTemplate.toString() + "'.");
|
||||
|
|
|
@ -28,7 +28,7 @@ import javax.jms.Session;
|
|||
import javax.jms.Topic;
|
||||
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
|
@ -50,9 +50,9 @@ final class JMSPublisher extends JMSWorker {
|
|||
* @param jmsTemplate
|
||||
* instance of {@link JmsTemplate}
|
||||
* @param processLog
|
||||
* instance of {@link ProcessorLog}
|
||||
* instance of {@link ComponentLog}
|
||||
*/
|
||||
JMSPublisher(JmsTemplate jmsTemplate, ProcessorLog processLog) {
|
||||
JMSPublisher(JmsTemplate jmsTemplate, ComponentLog processLog) {
|
||||
super(jmsTemplate, processLog);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Created Message Publisher for '" + jmsTemplate.toString() + "'.");
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.nio.channels.Channel;
|
|||
|
||||
import javax.jms.Connection;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ abstract class JMSWorker {
|
|||
|
||||
protected final JmsTemplate jmsTemplate;
|
||||
|
||||
protected final ProcessorLog processLog;
|
||||
protected final ComponentLog processLog;
|
||||
|
||||
/**
|
||||
* Creates an instance of this worker initializing it with JMS
|
||||
|
@ -42,9 +42,9 @@ abstract class JMSWorker {
|
|||
* sub-classes to interact with JMS systems
|
||||
*
|
||||
* @param jmsTemplate the instance of {@link JmsTemplate}
|
||||
* @param processLog the instance of {@link ProcessorLog}
|
||||
* @param processLog the instance of {@link ComponentLog}
|
||||
*/
|
||||
public JMSWorker(JmsTemplate jmsTemplate, ProcessorLog processLog) {
|
||||
public JMSWorker(JmsTemplate jmsTemplate, ComponentLog processLog) {
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
this.processLog = processLog;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.apache.nifi.jms.cf.JMSConnectionFactoryProviderDefinition;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.util.MockFlowFile;
|
||||
import org.apache.nifi.util.TestRunner;
|
||||
import org.apache.nifi.util.TestRunners;
|
||||
|
@ -36,7 +36,7 @@ public class ConsumeJMSTest {
|
|||
@Test
|
||||
public void validateSuccessfulConsumeAndTransferToSuccess() throws Exception {
|
||||
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination("cooQueue", false);
|
||||
JMSPublisher sender = new JMSPublisher(jmsTemplate, mock(ProcessorLog.class));
|
||||
JMSPublisher sender = new JMSPublisher(jmsTemplate, mock(ComponentLog.class));
|
||||
sender.publish("Hey dude!".getBytes());
|
||||
TestRunner runner = TestRunners.newTestRunner(new ConsumeJMS());
|
||||
JMSConnectionFactoryProviderDefinition cs = mock(JMSConnectionFactoryProviderDefinition.class);
|
||||
|
|
|
@ -31,7 +31,7 @@ import javax.jms.TextMessage;
|
|||
import javax.jms.Topic;
|
||||
|
||||
import org.apache.nifi.jms.processors.JMSConsumer.JMSResponse;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.junit.Test;
|
||||
import org.springframework.jms.connection.CachingConnectionFactory;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
|
@ -44,7 +44,7 @@ public class JMSPublisherConsumerTest {
|
|||
public void validateByesConvertedToBytesMessageOnSend() throws Exception {
|
||||
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination("testQueue", false);
|
||||
|
||||
JMSPublisher publisher = new JMSPublisher(jmsTemplate, mock(ProcessorLog.class));
|
||||
JMSPublisher publisher = new JMSPublisher(jmsTemplate, mock(ComponentLog.class));
|
||||
publisher.publish("hellomq".getBytes());
|
||||
|
||||
Message receivedMessage = jmsTemplate.receive();
|
||||
|
@ -60,7 +60,7 @@ public class JMSPublisherConsumerTest {
|
|||
public void validateJmsHeadersAndPropertiesAreTransferredFromFFAttributes() throws Exception {
|
||||
JmsTemplate jmsTemplate = CommonTest.buildJmsTemplateForDestination("testQueue", false);
|
||||
|
||||
JMSPublisher publisher = new JMSPublisher(jmsTemplate, mock(ProcessorLog.class));
|
||||
JMSPublisher publisher = new JMSPublisher(jmsTemplate, mock(ComponentLog.class));
|
||||
Map<String, String> flowFileAttributes = new HashMap<>();
|
||||
flowFileAttributes.put("foo", "foo");
|
||||
flowFileAttributes.put(JmsHeaders.REPLY_TO, "myTopic");
|
||||
|
@ -92,7 +92,7 @@ public class JMSPublisherConsumerTest {
|
|||
}
|
||||
});
|
||||
|
||||
JMSConsumer consumer = new JMSConsumer(jmsTemplate, mock(ProcessorLog.class));
|
||||
JMSConsumer consumer = new JMSConsumer(jmsTemplate, mock(ComponentLog.class));
|
||||
try {
|
||||
consumer.consume();
|
||||
} finally {
|
||||
|
@ -115,7 +115,7 @@ public class JMSPublisherConsumerTest {
|
|||
}
|
||||
});
|
||||
|
||||
JMSConsumer consumer = new JMSConsumer(jmsTemplate, mock(ProcessorLog.class));
|
||||
JMSConsumer consumer = new JMSConsumer(jmsTemplate, mock(ComponentLog.class));
|
||||
assertEquals("JMSConsumer[destination:testQueue; pub-sub:false;]", consumer.toString());
|
||||
|
||||
JMSResponse response = consumer.consume();
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.kafka.clients.producer.ProducerRecord;
|
|||
import org.apache.kafka.clients.producer.RecordMetadata;
|
||||
import org.apache.kafka.common.serialization.ByteArraySerializer;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.stream.io.util.StreamDemarcator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -52,7 +52,7 @@ class KafkaPublisher implements Closeable {
|
|||
|
||||
private long ackWaitTime = 30000;
|
||||
|
||||
private ProcessorLog processLog;
|
||||
private ComponentLog processLog;
|
||||
|
||||
private final Partitioner partitioner;
|
||||
|
||||
|
@ -110,7 +110,7 @@ class KafkaPublisher implements Closeable {
|
|||
*/
|
||||
KafkaPublisherResult publish(PublishingContext publishingContext) {
|
||||
StreamDemarcator streamTokenizer = new StreamDemarcator(publishingContext.getContentStream(),
|
||||
publishingContext.getDelimiterBytes(), publishingContext.getMaxRequestSize());
|
||||
publishingContext.getDelimiterBytes(), publishingContext.getMaxRequestSize());
|
||||
|
||||
int prevLastAckedMessageIndex = publishingContext.getLastAckedMessageIndex();
|
||||
List<Future<RecordMetadata>> resultFutures = new ArrayList<>();
|
||||
|
@ -124,7 +124,7 @@ class KafkaPublisher implements Closeable {
|
|||
partitionId = this.getPartition(publishingContext.getKeyBytes(), publishingContext.getTopic());
|
||||
}
|
||||
ProducerRecord<byte[], byte[]> message =
|
||||
new ProducerRecord<>(publishingContext.getTopic(), publishingContext.getPartitionId(), publishingContext.getKeyBytes(), messageBytes);
|
||||
new ProducerRecord<>(publishingContext.getTopic(), publishingContext.getPartitionId(), publishingContext.getKeyBytes(), messageBytes);
|
||||
resultFutures.add(this.kafkaProducer.send(message));
|
||||
}
|
||||
}
|
||||
|
@ -198,10 +198,10 @@ class KafkaPublisher implements Closeable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Will set {@link ProcessorLog} as an additional logger to forward log
|
||||
* Will set {@link ComponentLog} as an additional logger to forward log
|
||||
* messages to NiFi bulletin
|
||||
*/
|
||||
void setProcessLog(ProcessorLog processLog) {
|
||||
void setProcessLog(ComponentLog processLog) {
|
||||
this.processLog = processLog;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -132,7 +132,7 @@ public class GetMongo extends AbstractMongoProcessor {
|
|||
|
||||
@Override
|
||||
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final Document query = context.getProperty(QUERY).isSet() ? Document.parse(context.getProperty(QUERY).getValue()) : null;
|
||||
final Document projection = context.getProperty(PROJECTION).isSet() ? Document.parse(context.getProperty(PROJECTION).getValue()) : null;
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
|
@ -142,7 +142,7 @@ public class PutMongo extends AbstractMongoProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final Charset charset = Charset.forName(context.getProperty(CHARACTER_SET).getValue());
|
||||
final String mode = context.getProperty(MODE).getValue();
|
||||
|
|
|
@ -16,6 +16,21 @@
|
|||
*/
|
||||
package org.apache.nifi.processors.script;
|
||||
|
||||
import org.apache.nifi.components.AllowableValue;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.util.StandardValidators;
|
||||
import org.apache.nifi.util.StringUtils;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineFactory;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.ScriptException;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
@ -47,7 +62,6 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
|
||||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.processor.util.StandardValidators;
|
||||
|
@ -223,7 +237,7 @@ public abstract class AbstractScriptProcessor extends AbstractSessionFactoryProc
|
|||
engineQ = new LinkedBlockingQueue<>(numberOfScriptEngines);
|
||||
ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
try {
|
||||
ProcessorLog log = getLogger();
|
||||
ComponentLog log = getLogger();
|
||||
|
||||
if (StringUtils.isBlank(scriptEngineName)) {
|
||||
throw new IllegalArgumentException("The script engine name cannot be null");
|
||||
|
|
|
@ -30,11 +30,13 @@ import javax.script.ScriptException;
|
|||
import javax.script.SimpleBindings;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.nifi.annotation.behavior.DynamicProperty;
|
||||
import org.apache.nifi.annotation.behavior.TriggerSerially;
|
||||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.ProcessSessionFactory;
|
||||
|
@ -161,7 +163,7 @@ public class ExecuteScript extends AbstractScriptProcessor {
|
|||
}
|
||||
}
|
||||
ScriptEngine scriptEngine = engineQ.poll();
|
||||
ProcessorLog log = getLogger();
|
||||
ComponentLog log = getLogger();
|
||||
if (scriptEngine == null) {
|
||||
// No engine available so nothing more to do here
|
||||
return;
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.controller.ControllerServiceLookup;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSessionFactory;
|
||||
import org.apache.nifi.processor.Processor;
|
||||
|
@ -84,7 +84,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
try {
|
||||
relationships.addAll(instance.getRelationships());
|
||||
} catch (final Throwable t) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String message = "Unable to get relationships from scripted Processor: " + t;
|
||||
|
||||
logger.error(message);
|
||||
|
@ -126,7 +126,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
supportedPropertyDescriptors.addAll(instanceDescriptors);
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String message = "Unable to get property descriptors from Processor: " + t;
|
||||
|
||||
logger.error(message);
|
||||
|
@ -206,7 +206,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
*/
|
||||
@Override
|
||||
public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final Processor instance = processor.get();
|
||||
|
||||
if (SCRIPT_FILE.equals(descriptor)
|
||||
|
@ -240,7 +240,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
return reloadScript(IOUtils.toString(scriptStream));
|
||||
|
||||
} catch (final Exception e) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String message = "Unable to load script: " + e;
|
||||
|
||||
logger.error(message, e);
|
||||
|
@ -271,7 +271,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
return reloadScript(scriptBody);
|
||||
|
||||
} catch (final Exception e) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String message = "Unable to load script: " + e;
|
||||
|
||||
logger.error(message, e);
|
||||
|
@ -319,7 +319,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
// get configured processor from the script (if it exists)
|
||||
final Object obj = scriptEngine.get("processor");
|
||||
if (obj != null) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
try {
|
||||
// set the logger if the processor wants it
|
||||
|
@ -343,7 +343,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProcessorLog getLogger() {
|
||||
public ComponentLog getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
}
|
||||
|
||||
} catch (final Exception ex) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String message = "Unable to load script: " + ex.getLocalizedMessage();
|
||||
|
||||
logger.error(message, ex);
|
||||
|
@ -423,7 +423,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
return instanceResults;
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String message = "Unable to validate the script Processor: " + e;
|
||||
logger.error(message, e);
|
||||
|
||||
|
@ -465,7 +465,7 @@ public class InvokeScriptedProcessor extends AbstractScriptProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
ProcessorLog log = getLogger();
|
||||
ComponentLog log = getLogger();
|
||||
|
||||
// ensure the processor (if it exists) is loaded
|
||||
final Processor instance = processor.get();
|
||||
|
|
|
@ -29,7 +29,7 @@ public class GroovyScriptEngineConfigurator extends AbstractModuleClassloaderCon
|
|||
+ "import org.apache.nifi.processor.io.*\n"
|
||||
+ "import org.apache.nifi.processor.util.*\n"
|
||||
+ "import org.apache.nifi.processors.script.*\n"
|
||||
+ "import org.apache.nifi.logging.ProcessorLog\n";
|
||||
+ "import org.apache.nifi.logging.ComponentLog\n";
|
||||
|
||||
|
||||
private ScriptEngine scriptEngine;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
class testInvokeScriptCausesException implements Processor {
|
||||
|
||||
|
||||
def ProcessorLog log
|
||||
def ComponentLog log
|
||||
|
||||
@Override
|
||||
void initialize(ProcessorInitializationContext context) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
class testScriptRoutesToFailure implements Processor {
|
||||
|
||||
def ProcessorLog log
|
||||
def ComponentLog log
|
||||
|
||||
@Override
|
||||
void initialize(ProcessorInitializationContext context) {
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.apache.nifi.annotation.lifecycle.OnRemoved;
|
|||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.ProcessorInitializationContext;
|
||||
|
@ -182,7 +182,7 @@ public class GetSolr extends SolrProcessor {
|
|||
|
||||
@Override
|
||||
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
readLastEndDate();
|
||||
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(LAST_END_DATE_PATTERN, Locale.US);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.processors.splunk;
|
||||
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.util.put.sender.ChannelSender;
|
||||
import org.apache.nifi.util.MockFlowFile;
|
||||
import org.apache.nifi.util.TestRunner;
|
||||
|
@ -43,7 +43,7 @@ public class TestPutSplunk {
|
|||
|
||||
@Before
|
||||
public void init() {
|
||||
ProcessorLog logger = Mockito.mock(ProcessorLog.class);
|
||||
ComponentLog logger = Mockito.mock(ComponentLog.class);
|
||||
sender = new CapturingChannelSender("localhost", 12345, 0, logger);
|
||||
proc = new TestablePutSplunk(sender);
|
||||
|
||||
|
@ -356,7 +356,7 @@ public class TestPutSplunk {
|
|||
private int errorStart = -1;
|
||||
private int errorEnd = -1;
|
||||
|
||||
public CapturingChannelSender(String host, int port, int maxSendBufferSize, ProcessorLog logger) {
|
||||
public CapturingChannelSender(String host, int port, int maxSendBufferSize, ComponentLog logger) {
|
||||
super(host, port, maxSendBufferSize, logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -107,7 +107,7 @@ public class Base64EncodeContent extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
boolean encode = context.getProperty(MODE).getValue().equalsIgnoreCase(ENCODE_MODE);
|
||||
try {
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -218,7 +218,7 @@ public abstract class BinFiles extends AbstractSessionFactoryProcessor {
|
|||
final List<Bin> bins = new ArrayList<>();
|
||||
bins.add(bin);
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final ProcessSession session = sessionFactory.createSession();
|
||||
|
||||
final List<FlowFileSessionWrapper> binCopy = new ArrayList<>(bin.getContents());
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.nifi.annotation.documentation.Tags;
|
|||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -180,7 +180,7 @@ public class CompressContent extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final long sizeBeforeCompression = flowFile.getSize();
|
||||
final String compressionMode = context.getProperty(MODE).getValue();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.FlowFileFilter;
|
||||
|
@ -261,7 +261,7 @@ public class ControlRate extends AbstractProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
for (FlowFile flowFile : flowFiles) {
|
||||
// call this to capture potential error
|
||||
final long accrualAmount = getFlowFileAccrual(flowFile);
|
||||
|
@ -311,13 +311,13 @@ public class ControlRate extends AbstractProcessor {
|
|||
private final AtomicLong maxRate = new AtomicLong(1L);
|
||||
private final long timePeriodMillis;
|
||||
private final TimedBuffer<TimestampedLong> timedBuffer;
|
||||
private final ProcessorLog logger;
|
||||
private final ComponentLog logger;
|
||||
|
||||
private volatile long penalizationPeriod = 0;
|
||||
private volatile long penalizationExpired = 0;
|
||||
private volatile long lastUpdateTime;
|
||||
|
||||
public Throttle(final int timePeriod, final TimeUnit unit, final ProcessorLog logger) {
|
||||
public Throttle(final int timePeriod, final TimeUnit unit, final ComponentLog logger) {
|
||||
this.timePeriodMillis = TimeUnit.MILLISECONDS.convert(timePeriod, unit);
|
||||
this.timedBuffer = new TimedBuffer<>(unit, timePeriod, new LongEntityAccess());
|
||||
this.logger = logger;
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.nifi.processor.ProcessSession;
|
|||
import org.apache.nifi.processor.Relationship;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
import org.apache.nifi.annotation.behavior.EventDriven;
|
||||
import org.apache.nifi.annotation.behavior.InputRequirement;
|
||||
|
@ -136,7 +136,7 @@ public class ConvertCharacterSet extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final Charset inputCharset = Charset.forName(context.getProperty(INPUT_CHARSET).evaluateAttributeExpressions(flowFile).getValue());
|
||||
final Charset outputCharset = Charset.forName(context.getProperty(OUTPUT_CHARSET).evaluateAttributeExpressions(flowFile).getValue());
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.nifi.distributed.cache.client.exception.DeserializationExcepti
|
|||
import org.apache.nifi.distributed.cache.client.exception.SerializationException;
|
||||
import org.apache.nifi.expression.AttributeExpression.ResultType;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -160,7 +160,7 @@ public class DetectDuplicate extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String cacheKey = context.getProperty(CACHE_ENTRY_IDENTIFIER).evaluateAttributeExpressions(flowFile).getValue();
|
||||
if (StringUtils.isBlank(cacheKey)) {
|
||||
logger.error("FlowFile {} has no attribute for given Cache Entry Identifier", new Object[]{flowFile});
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -128,7 +128,7 @@ public class EncodeContent extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
boolean encode = context.getProperty(MODE).getValue().equalsIgnoreCase(ENCODE_MODE);
|
||||
String encoding = context.getProperty(ENCODING).getValue();
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -454,7 +454,7 @@ public class EncryptContent extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String method = context.getProperty(ENCRYPTION_ALGORITHM).getValue();
|
||||
final EncryptionMethod encryptionMethod = EncryptionMethod.valueOf(method);
|
||||
final String providerName = encryptionMethod.getProvider();
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.nifi.components.PropertyDescriptor;
|
|||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.ProcessorInitializationContext;
|
||||
|
@ -238,7 +238,7 @@ public class EvaluateJsonPath extends AbstractJsonPathProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
String representationOption = processContext.getProperty(NULL_VALUE_DEFAULT_REPRESENTATION).getValue();
|
||||
final String nullDefaultValue = NULL_REPRESENTATION_MAP.get(representationOption);
|
||||
|
|
|
@ -64,7 +64,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -219,7 +219,7 @@ public class EvaluateXPath extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final XPathFactory factory = factoryRef.get();
|
||||
final XPathEvaluator xpathEvaluator = (XPathEvaluator) factory.newXPath();
|
||||
final Map<String, XPathExpression> attributeToXPathMap = new HashMap<>();
|
||||
|
@ -400,7 +400,7 @@ public class EvaluateXPath extends AbstractProcessor {
|
|||
props.setProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
|
||||
transformer.setOutputProperties(props);
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final ObjectHolder<TransformerException> error = new ObjectHolder<>(null);
|
||||
transformer.setErrorListener(new ErrorListener() {
|
||||
|
|
|
@ -54,7 +54,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -227,7 +227,7 @@ public class EvaluateXQuery extends AbstractProcessor {
|
|||
if (flowFileBatch.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final Map<String, XQueryExecutable> attributeToXQueryMap = new HashMap<>();
|
||||
|
||||
final Processor proc = new Processor(false);
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
|
|||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -389,12 +389,12 @@ public class ExecuteProcess extends AbstractProcessor {
|
|||
*/
|
||||
private static class ProxyOutputStream extends OutputStream {
|
||||
|
||||
private final ProcessorLog logger;
|
||||
private final ComponentLog logger;
|
||||
|
||||
private final Lock lock = new ReentrantLock();
|
||||
private OutputStream delegate;
|
||||
|
||||
public ProxyOutputStream(final ProcessorLog logger) {
|
||||
public ProxyOutputStream(final ComponentLog logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.nifi.annotation.documentation.Tags;
|
|||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.dbcp.DBCPService;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -136,7 +136,7 @@ public class ExecuteSQL extends AbstractProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final DBCPService dbcpService = context.getProperty(DBCP_SERVICE).asControllerService(DBCPService.class);
|
||||
final String selectQuery = context.getProperty(SQL_SELECT_QUERY).evaluateAttributeExpressions(fileToProcess).getValue();
|
||||
final Integer queryTimeout = context.getProperty(QUERY_TIMEOUT).asTimePeriod(TimeUnit.SECONDS).intValue();
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.nifi.components.ValidationResult;
|
|||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.expression.AttributeExpression.ResultType;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -245,7 +245,7 @@ public class ExecuteStreamCommand extends AbstractProcessor {
|
|||
ATTRIBUTE_RELATIONSHIP_SET = Collections.unmodifiableSet(attributeRelationships);
|
||||
}
|
||||
|
||||
private ProcessorLog logger;
|
||||
private ComponentLog logger;
|
||||
|
||||
@Override
|
||||
public Set<Relationship> getRelationships() {
|
||||
|
@ -408,7 +408,7 @@ public class ExecuteStreamCommand extends AbstractProcessor {
|
|||
final boolean ignoreStdin;
|
||||
final OutputStream stdinWritable;
|
||||
final InputStream stdoutReadable;
|
||||
final ProcessorLog logger;
|
||||
final ComponentLog logger;
|
||||
final ProcessSession session;
|
||||
final Process process;
|
||||
FlowFile outputFlowFile;
|
||||
|
@ -420,7 +420,7 @@ public class ExecuteStreamCommand extends AbstractProcessor {
|
|||
byte[] outputBuffer;
|
||||
int size;
|
||||
|
||||
public ProcessStreamWriterCallback(boolean ignoreStdin, OutputStream stdinWritable, InputStream stdoutReadable,ProcessorLog logger, String attributeName,
|
||||
public ProcessStreamWriterCallback(boolean ignoreStdin, OutputStream stdinWritable, InputStream stdoutReadable,ComponentLog logger, String attributeName,
|
||||
ProcessSession session, FlowFile outputFlowFile, Process process, boolean putToAttribute, int attributeSize) {
|
||||
this.ignoreStdin = ignoreStdin;
|
||||
this.stdinWritable = stdinWritable;
|
||||
|
@ -477,7 +477,7 @@ public class ExecuteStreamCommand extends AbstractProcessor {
|
|||
}
|
||||
|
||||
private static void readStdoutReadable(final boolean ignoreStdin, final OutputStream stdinWritable,
|
||||
final ProcessorLog logger, final InputStream incomingFlowFileIS) throws IOException {
|
||||
final ComponentLog logger, final InputStream incomingFlowFileIS) throws IOException {
|
||||
Thread writerThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
|||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -285,7 +285,7 @@ public class ExtractText extends AbstractProcessor {
|
|||
if (flowFile == null) {
|
||||
return;
|
||||
}
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final Charset charset = Charset.forName(context.getProperty(CHARACTER_SET).getValue());
|
||||
final int maxCaptureGroupLength = context.getProperty(MAX_CAPTURE_GROUP_LENGTH).asInteger();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.nifi.distributed.cache.client.exception.SerializationException
|
|||
import org.apache.nifi.expression.AttributeExpression;
|
||||
import org.apache.nifi.expression.AttributeExpression.ResultType;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -157,7 +157,7 @@ public class FetchDistributedMapCache extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String cacheKey = context.getProperty(PROP_CACHE_ENTRY_IDENTIFIER).evaluateAttributeExpressions(flowFile).getValue();
|
||||
if (StringUtils.isBlank(cacheKey)) {
|
||||
logger.error("FlowFile {} has no attribute for given Cache Entry Identifier", new Object[]{flowFile});
|
||||
|
|
|
@ -61,7 +61,7 @@ import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
|||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -363,7 +363,7 @@ public class GetFile extends AbstractProcessor {
|
|||
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
|
||||
final File directory = new File(context.getProperty(DIRECTORY).evaluateAttributeExpressions().getValue());
|
||||
final boolean keepingSourceFile = context.getProperty(KEEP_SOURCE_FILE).asBoolean();
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
if (fileQueue.size() < 100) {
|
||||
final long pollingMillis = context.getProperty(POLLING_INTERVAL).asTimePeriod(TimeUnit.MILLISECONDS);
|
||||
|
|
|
@ -43,7 +43,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -115,7 +115,7 @@ public abstract class GetFileTransfer extends AbstractProcessor {
|
|||
final long pollingIntervalMillis = context.getProperty(FileTransfer.POLLING_INTERVAL).asTimePeriod(TimeUnit.MILLISECONDS);
|
||||
final long nextPollTime = lastPollTime.get() + pollingIntervalMillis;
|
||||
BlockingQueue<FileInfo> fileQueue = fileQueueRef.get();
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
// dont do the listing if there are already 100 or more items in our queue
|
||||
// 100 is really just a magic number that seems to work out well in practice
|
||||
|
|
|
@ -81,7 +81,7 @@ import org.apache.nifi.components.state.StateMap;
|
|||
import org.apache.nifi.expression.AttributeExpression;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -307,7 +307,7 @@ public class GetHTTP extends AbstractSessionFactoryProcessor {
|
|||
|
||||
@Override
|
||||
public void onTrigger(final ProcessContext context, final ProcessSessionFactory sessionFactory) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final ProcessSession session = sessionFactory.createSession();
|
||||
final FlowFile incomingFlowFile = session.get();
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.SeeAlso;
|
||||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
|
@ -55,7 +55,7 @@ public class GetJMSQueue extends JmsConsumer {
|
|||
|
||||
@Override
|
||||
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
WrappedMessageConsumer wrappedConsumer = consumerQueue.poll();
|
||||
if (wrappedConsumer == null) {
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.apache.nifi.annotation.lifecycle.OnRemoved;
|
|||
import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
||||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
|
@ -323,7 +323,7 @@ public class GetJMSTopic extends JmsConsumer {
|
|||
|
||||
@Override
|
||||
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
WrappedMessageConsumer consumer = this.wrappedConsumer;
|
||||
if (consumer == null || consumer.isClosed()) {
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -191,7 +191,7 @@ public class HashAttribute extends AbstractProcessor {
|
|||
}
|
||||
|
||||
final Map<String, Pattern> patterns = regexMapRef.get();
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final SortedMap<String, String> attributes = getRelevantAttributes(flowFile, patterns);
|
||||
if (attributes.size() != patterns.size()) {
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -118,7 +118,7 @@ public class HashContent extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String algorithm = context.getProperty(HASH_ALGORITHM).getValue();
|
||||
final MessageDigest digest;
|
||||
try {
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -116,7 +116,7 @@ public class IdentifyMimeType extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final ObjectHolder<String> mimeTypeRef = new ObjectHolder<>(null);
|
||||
final String filename = flowFile.getAttribute(CoreAttributes.FILENAME.key());
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ import org.apache.nifi.components.ValidationResult;
|
|||
import org.apache.nifi.expression.AttributeExpression;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -543,7 +543,7 @@ public final class InvokeHTTP extends AbstractProcessor {
|
|||
|
||||
// Setting some initial variables
|
||||
final int maxAttributeSize = context.getProperty(PROP_PUT_ATTRIBUTE_MAX_LENGTH).asInteger();
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
// Every request/response cycle has a unique transaction id which will be stored as a flowfile attribute.
|
||||
final UUID txId = UUID.randomUUID();
|
||||
|
@ -866,12 +866,12 @@ public final class InvokeHTTP extends AbstractProcessor {
|
|||
return statusCode / 100 == 2;
|
||||
}
|
||||
|
||||
private void logRequest(ProcessorLog logger, Request request) {
|
||||
private void logRequest(ComponentLog logger, Request request) {
|
||||
logger.debug("\nRequest to remote service:\n\t{}\n{}",
|
||||
new Object[]{request.url().toExternalForm(), getLogString(request.headers().toMultimap())});
|
||||
}
|
||||
|
||||
private void logResponse(ProcessorLog logger, URL url, Response response) {
|
||||
private void logResponse(ComponentLog logger, URL url, Response response) {
|
||||
logger.debug("\nResponse from remote service:\n\t{}\n{}",
|
||||
new Object[]{url.toExternalForm(), getLogString(response.headers().toMultimap())});
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ import javax.jms.MessageConsumer;
|
|||
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -107,7 +107,7 @@ public abstract class JmsConsumer extends AbstractProcessor {
|
|||
}
|
||||
|
||||
public void consume(final ProcessContext context, final ProcessSession session, final WrappedMessageConsumer wrappedConsumer) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final MessageConsumer consumer = wrappedConsumer.getConsumer();
|
||||
final boolean clientAcknowledge = context.getProperty(ACKNOWLEDGEMENT_MODE).getValue().equalsIgnoreCase(ACK_MODE_CLIENT);
|
||||
|
@ -177,7 +177,7 @@ public abstract class JmsConsumer extends AbstractProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
public static JmsProcessingSummary map2FlowFile(final ProcessContext context, final ProcessSession session, final Message message, final boolean addAttributes, ProcessorLog logger)
|
||||
public static JmsProcessingSummary map2FlowFile(final ProcessContext context, final ProcessSession session, final Message message, final boolean addAttributes, ComponentLog logger)
|
||||
throws Exception {
|
||||
|
||||
// Currently not very useful, because always one Message == one FlowFile
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.nifi.annotation.behavior.SupportsBatching;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -132,9 +132,9 @@ public class LogAttribute extends AbstractProcessor {
|
|||
return supportedDescriptors;
|
||||
}
|
||||
|
||||
protected String processFlowFile(final ProcessorLog logger, final DebugLevels logLevel, final FlowFile flowFile, final ProcessSession session, final ProcessContext context) {
|
||||
protected String processFlowFile(final ComponentLog logger, final DebugLevels logLevel, final FlowFile flowFile, final ProcessSession session, final ProcessContext context) {
|
||||
final Set<String> attributeKeys = getAttributesToLog(flowFile.getAttributes().keySet(), context);
|
||||
final ProcessorLog LOG = getLogger();
|
||||
final ComponentLog LOG = getLogger();
|
||||
final String dashedLine;
|
||||
|
||||
String logPrefix = context.getProperty(LOG_PREFIX).evaluateAttributeExpressions(flowFile).getValue();
|
||||
|
@ -240,7 +240,7 @@ public class LogAttribute extends AbstractProcessor {
|
|||
throw new ProcessException(e);
|
||||
}
|
||||
|
||||
final ProcessorLog LOG = getLogger();
|
||||
final ComponentLog LOG = getLogger();
|
||||
boolean isLogLevelEnabled = false;
|
||||
switch (logLevel) {
|
||||
case trace:
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
|||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -104,7 +104,7 @@ public class ModifyBytes extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final int startOffset = context.getProperty(START_OFFSET).asDataSize(DataUnit.B).intValue();
|
||||
final int endOffset = context.getProperty(END_OFFSET).asDataSize(DataUnit.B).intValue();
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.nifi.annotation.lifecycle.OnScheduled;
|
|||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -167,7 +167,7 @@ public class MonitorActivity extends AbstractProcessor {
|
|||
final long thresholdMillis = context.getProperty(THRESHOLD).asTimePeriod(TimeUnit.MILLISECONDS);
|
||||
final long now = System.currentTimeMillis();
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final List<FlowFile> flowFiles = session.get(50);
|
||||
if (flowFiles.isEmpty()) {
|
||||
final long previousSuccessMillis = latestSuccessTransfer.get();
|
||||
|
|
|
@ -94,7 +94,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -455,7 +455,7 @@ public class PostHTTP extends AbstractProcessor {
|
|||
final RequestConfig requestConfig = requestConfigBuilder.build();
|
||||
|
||||
final StreamThrottler throttler = throttlerRef.get();
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final Double maxBatchBytes = context.getProperty(MAX_BATCH_SIZE).asDataSize(DataUnit.B);
|
||||
String lastUrl = null;
|
||||
|
@ -877,7 +877,7 @@ public class PostHTTP extends AbstractProcessor {
|
|||
}
|
||||
|
||||
private DestinationAccepts getDestinationAcceptance(final boolean sendAsFlowFile, final HttpClient client, final String uri,
|
||||
final ProcessorLog logger, final String transactionId) throws IOException {
|
||||
final ComponentLog logger, final String transactionId) throws IOException {
|
||||
final HttpHead head = new HttpHead(uri);
|
||||
if (sendAsFlowFile) {
|
||||
head.addHeader(TRANSACTION_ID_HEADER, transactionId);
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.nifi.distributed.cache.client.exception.DeserializationExcepti
|
|||
import org.apache.nifi.distributed.cache.client.exception.SerializationException;
|
||||
import org.apache.nifi.expression.AttributeExpression.ResultType;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -155,7 +155,7 @@ public class PutDistributedMapCache extends AbstractProcessor {
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
// cache key is computed from attribute 'CACHE_ENTRY_IDENTIFIER' with expression language support
|
||||
final String cacheKey = context.getProperty(CACHE_ENTRY_IDENTIFIER).evaluateAttributeExpressions(flowFile).getValue();
|
||||
|
|
|
@ -57,7 +57,7 @@ import org.apache.nifi.components.ValidationContext;
|
|||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -295,7 +295,7 @@ public class PutEmail extends AbstractProcessor {
|
|||
final Session mailSession = this.createMailSession(properties);
|
||||
|
||||
final Message message = new MimeMessage(mailSession);
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
try {
|
||||
message.addFrom(toInetAddresses(context, flowFile, FROM));
|
||||
|
@ -384,7 +384,7 @@ public class PutEmail extends AbstractProcessor {
|
|||
|
||||
final Properties properties = new Properties();
|
||||
|
||||
final ProcessorLog logger = this.getLogger();
|
||||
final ComponentLog logger = this.getLogger();
|
||||
|
||||
for (Entry<String, PropertyDescriptor> entry : propertyToContext.entrySet()) {
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.nifi.annotation.documentation.Tags;
|
|||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -183,7 +183,7 @@ public class PutFile extends AbstractProcessor {
|
|||
final Path configuredRootDirPath = Paths.get(context.getProperty(DIRECTORY).evaluateAttributeExpressions(flowFile).getValue());
|
||||
final String conflictResponse = context.getProperty(CONFLICT_RESOLUTION).getValue();
|
||||
final Integer maxDestinationFiles = context.getProperty(MAX_DESTINATION_FILES).asInteger();
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
Path tempDotCopyFile = null;
|
||||
try {
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.nifi.processors.standard;
|
|||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||
import org.apache.nifi.stream.io.BufferedInputStream;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
|
@ -94,7 +94,7 @@ public abstract class PutFileTransfer<T extends FileTransfer> extends AbstractPr
|
|||
return;
|
||||
}
|
||||
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final String hostname = context.getProperty(FileTransfer.HOSTNAME).evaluateAttributeExpressions(flowFile).getValue();
|
||||
|
||||
final int maxNumberOfFiles = context.getProperty(FileTransfer.BATCH_SIZE).asInteger();
|
||||
|
@ -187,7 +187,7 @@ public abstract class PutFileTransfer<T extends FileTransfer> extends AbstractPr
|
|||
final String path,
|
||||
final FlowFile flowFile,
|
||||
final boolean rejectZeroByteFiles,
|
||||
final ProcessorLog logger)
|
||||
final ComponentLog logger)
|
||||
throws IOException {
|
||||
Relationship destinationRelationship = REL_SUCCESS;
|
||||
String fileName = flowFile.getAttribute(CoreAttributes.FILENAME.key());
|
||||
|
|
|
@ -79,7 +79,7 @@ import org.apache.nifi.annotation.documentation.Tags;
|
|||
import org.apache.nifi.annotation.lifecycle.OnStopped;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.flowfile.FlowFile;
|
||||
import org.apache.nifi.logging.ProcessorLog;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.DataUnit;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
|
@ -160,7 +160,7 @@ public class PutJMS extends AbstractProcessor {
|
|||
|
||||
@Override
|
||||
public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
final List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).asInteger().intValue());
|
||||
if (flowFiles.isEmpty()) {
|
||||
return;
|
||||
|
@ -335,7 +335,7 @@ public class PutJMS extends AbstractProcessor {
|
|||
* @throws JMSException ex
|
||||
*/
|
||||
private void copyAttributesToJmsProps(final FlowFile flowFile, final Message message) throws JMSException {
|
||||
final ProcessorLog logger = getLogger();
|
||||
final ComponentLog logger = getLogger();
|
||||
|
||||
final Map<String, String> attributes = flowFile.getAttributes();
|
||||
for (final Entry<String, String> entry : attributes.entrySet()) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue