[GitHub] nifi pull request #1107: origin/NIFI-1526

2016-11-14 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/nifi/pull/1107


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1107: origin/NIFI-1526

2016-10-13 Thread markap14
Github user markap14 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1107#discussion_r83271823
  
--- Diff: 
nifi-api/src/main/java/org/apache/nifi/annotation/configuration/DefaultSettings.java
 ---
@@ -0,0 +1,42 @@
+/*
+ * 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.annotation.configuration;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Inherited;
+import org.apache.nifi.logging.LogLevel;
+
+/**
+ * 
+ * Marker interface that a Processor can use to configure the yield 
duration, the  penalty duration and the bulletin log level.
+ * Note that the number of Concurrent tasks will be ignored if the 
annotion @TriggerSerialy is used
+ * 
+ */
+@Documented
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface DefaultSettings {
+String yieldDuration() default "1 sec";
+String penaltyDuration() default "30 sec";
+LogLevel logLevel() default LogLevel.WARN;
--- End diff --

This should probably be called bulletinLevel, rather than logLevel. The 
processor can log at any level it wants - this controls which level is shown as 
a bulletin.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1107: origin/NIFI-1526

2016-10-07 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1107#discussion_r82437230
  
--- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/TestFlowController.java
 ---
@@ -71,7 +74,7 @@
 
 @Before
 public void setup() {
-System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, 
TestFlowController.class.getResource("/nifi.properties").getFile());
+System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, 
FlowController.class.getResource("/nifi.properties").getFile());
--- End diff --

Is it really needed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1107: origin/NIFI-1526

2016-10-05 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1107#discussion_r82070839
  
--- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
 ---
@@ -187,6 +187,50 @@ public StandardProcessorNode(final Processor 
processor, final String uuid,
 }
 
 schedulingStrategy = SchedulingStrategy.TIMER_DRIVEN;
+try
+{
+
+if(procClass.isAnnotationPresent(DefaultSchedule.class))
+{
+DefaultSchedule dsc = 
procClass.getAnnotation(DefaultSchedule.class);
+try
+{
+this.setSchedulingStrategy(dsc.Strategy());
+}
+catch (Throwable ex)
+{
+LOG.error(String.format("Error while setting 
scheduling strategy from DefaultSchedule annotation: %s",ex.getMessage()));
--- End diff --

When logging exceptions, you could add the exception as second argument of 
the logging method, this will display the full stacktrace in the logs and that 
can be quite useful.
java
LOG.error(String.format("Error while setting scheduling strategy from 
DefaultSchedule annotation: %s",ex.getMessage()), ex);



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] nifi pull request #1107: origin/NIFI-1526

2016-10-05 Thread pvillard31
Github user pvillard31 commented on a diff in the pull request:

https://github.com/apache/nifi/pull/1107#discussion_r8207
  
--- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java
 ---
@@ -1059,6 +1060,42 @@ public ProcessorNode createProcessor(final String 
type, String id, final boolean
 final LogRepository logRepository = 
LogRepositoryFactory.getRepository(id);
 
logRepository.addObserver(StandardProcessorNode.BULLETIN_OBSERVER_ID, 
LogLevel.WARN, new ProcessorLogObserver(getBulletinRepository(), procNode));
 
+try {
+
+final Class procClass = processor.getClass();
+if(procClass.isAnnotationPresent(DefaultSettings.class))
+{
--- End diff --

There are checkstyle violations to fix:

[WARNING] 
src/main/java/org/apache/nifi/annotation/configuration/DefaultSchedule.java[5] 
(imports) AvoidStarImport: Using the '.*' form of import should be avoided - 
java.lang.annotation.*.
[WARNING] 
src/main/java/org/apache/nifi/annotation/configuration/DefaultSettings.java[5] 
(imports) AvoidStarImport: Using the '.*' form of import should be avoided - 
java.lang.annotation.*.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1067:13] (blocks) 
LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1071:17] (blocks) 
RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1073:17] (blocks) 
LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1079:17] (blocks) 
RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1081:17] (blocks) 
LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1086:17] (blocks) 
RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1088:17] (blocks) 
LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1093:9] (blocks) 
RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/FlowController.java[1095:9] (blocks) 
LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[191:9] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[194:13] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[197:17] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[199:17] 
(blocks) RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[201:17] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[205:17] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[207:17] 
(blocks) RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[209:17] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[214:17] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[216:21] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[218:21] 
(blocks) RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[220:21] 
(blocks) LeftCurly: '{' should be on the previous line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[226:9] 
(blocks) RightCurly: '}' should be on the same line.
[WARNING] 
src/main/java/org/apache/nifi/controller/StandardProcessorNode.java[228:9] 
(blocks) LeftCurly: '{' should be on the previous line.


You can check it by yourself by running:

mvn clean install -Pcontrib-check



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact 

[GitHub] nifi pull request #1107: origin/NIFI-1526

2016-10-05 Thread mathiastiberghien
GitHub user mathiastiberghien opened a pull request:

https://github.com/apache/nifi/pull/1107

origin/NIFI-1526

This commit solves the issue 1526 adding DefaultSchedule and 
DefaultSettings annotation to the nifi-api
This annotations are then use on Custom Processor classes and allows the 
developer to configure the default
schedule (scheduling strategy, scheduling period, max concurrent tasks) and 
settings (yield duration, penalty period, bulletin log level)
for the processor.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mathiastiberghien/nifi origin/NIFI-1526

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/1107.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1107


commit df223a71afd34b75ca2d0e8cfaabc045de6c09dd
Author: Mathias Tiberghien 
Date:   2016-10-05T15:50:08Z

1 first commit for feature NIFI-1526
DefaultSchedule annotation should be use on Custom Processor to set the 
default scheduling strategy, scheduling period or max number of concurrent task 
for each instance of the processor
DefaultSettings annotation should be use on Custom Processor to set the 
default penalty period, the yield duration or the bulletin log level for each 
instance of the processor




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---