[GitHub] nifi-minifi pull request #80: MINIFI-277: Write variable registry property t...

2017-05-01 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/nifi-minifi/pull/80


---
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-minifi pull request #80: MINIFI-277: Write variable registry property t...

2017-04-28 Thread brosander
Github user brosander commented on a diff in the pull request:

https://github.com/apache/nifi-minifi/pull/80#discussion_r113939300
  
--- Diff: 
minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/v2/CorePropertiesSchemaV2.java
 ---
@@ -0,0 +1,95 @@
+/*
+ * 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.minifi.commons.schema.v2;
+
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.CORE_PROPS_KEY;
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.MAX_CONCURRENT_THREADS_KEY;
+
+import java.util.Map;
+
+import org.apache.nifi.minifi.commons.schema.common.BaseSchema;
+import org.apache.nifi.minifi.commons.schema.common.WritableSchema;
+
+/**
+ *
+ */
+public class CorePropertiesSchemaV2 extends BaseSchema implements 
WritableSchema {
+
+public static final String FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY = "flow 
controller graceful shutdown period";
+public static final String FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY = 
"flow service write delay interval";
+public static final String ADMINISTRATIVE_YIELD_DURATION_KEY = 
"administrative yield duration";
+public static final String BORED_YIELD_DURATION_KEY = "bored yield 
duration";
+
+public static final String 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD = "10 sec";
+public static final String DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL = 
"500 ms";
+public static final String DEFAULT_ADMINISTRATIVE_YIELD_DURATION = "30 
sec";
+public static final String DEFAULT_BORED_YIELD_DURATION = "10 millis";
+public static final int DEFAULT_MAX_CONCURRENT_THREADS = 1;
+
+private String flowControllerGracefulShutdownPeriod = 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD;
+private String flowServiceWriteDelayInterval = 
DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL;
+private String administrativeYieldDuration = 
DEFAULT_ADMINISTRATIVE_YIELD_DURATION;
+private String boredYieldDuration = DEFAULT_BORED_YIELD_DURATION;
+private Number maxConcurrentThreads = DEFAULT_MAX_CONCURRENT_THREADS;
+
+public CorePropertiesSchemaV2() {
+}
+
+public CorePropertiesSchemaV2(Map map) {
+flowControllerGracefulShutdownPeriod = getOptionalKeyAsType(map, 
FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY, String.class,
+CORE_PROPS_KEY, 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD);
+flowServiceWriteDelayInterval = getOptionalKeyAsType(map, 
FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY, String.class,
+CORE_PROPS_KEY, DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL);
+administrativeYieldDuration = getOptionalKeyAsType(map, 
ADMINISTRATIVE_YIELD_DURATION_KEY, String.class,
+CORE_PROPS_KEY, DEFAULT_ADMINISTRATIVE_YIELD_DURATION);
+boredYieldDuration = getOptionalKeyAsType(map, 
BORED_YIELD_DURATION_KEY, String.class, CORE_PROPS_KEY, 
DEFAULT_BORED_YIELD_DURATION);
+maxConcurrentThreads = getOptionalKeyAsType(map, 
MAX_CONCURRENT_THREADS_KEY, Number.class,
+CORE_PROPS_KEY, DEFAULT_MAX_CONCURRENT_THREADS);
+}
+
+@Override
+public Map toMap() {
--- End diff --

Then in ConfigSchemaV2, you'd want something like 
```
putIfNotNull(result, CORE_PROPS_KEY, coreProperties.convert());
```


---
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-minifi pull request #80: MINIFI-277: Write variable registry property t...

2017-04-28 Thread brosander
Github user brosander commented on a diff in the pull request:

https://github.com/apache/nifi-minifi/pull/80#discussion_r113938266
  
--- Diff: 
minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/v2/CorePropertiesSchemaV2.java
 ---
@@ -0,0 +1,95 @@
+/*
+ * 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.minifi.commons.schema.v2;
+
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.CORE_PROPS_KEY;
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.MAX_CONCURRENT_THREADS_KEY;
+
+import java.util.Map;
+
+import org.apache.nifi.minifi.commons.schema.common.BaseSchema;
+import org.apache.nifi.minifi.commons.schema.common.WritableSchema;
+
+/**
+ *
+ */
+public class CorePropertiesSchemaV2 extends BaseSchema implements 
WritableSchema {
+
+public static final String FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY = "flow 
controller graceful shutdown period";
+public static final String FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY = 
"flow service write delay interval";
+public static final String ADMINISTRATIVE_YIELD_DURATION_KEY = 
"administrative yield duration";
+public static final String BORED_YIELD_DURATION_KEY = "bored yield 
duration";
+
+public static final String 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD = "10 sec";
+public static final String DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL = 
"500 ms";
+public static final String DEFAULT_ADMINISTRATIVE_YIELD_DURATION = "30 
sec";
+public static final String DEFAULT_BORED_YIELD_DURATION = "10 millis";
+public static final int DEFAULT_MAX_CONCURRENT_THREADS = 1;
+
+private String flowControllerGracefulShutdownPeriod = 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD;
+private String flowServiceWriteDelayInterval = 
DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL;
+private String administrativeYieldDuration = 
DEFAULT_ADMINISTRATIVE_YIELD_DURATION;
+private String boredYieldDuration = DEFAULT_BORED_YIELD_DURATION;
+private Number maxConcurrentThreads = DEFAULT_MAX_CONCURRENT_THREADS;
+
+public CorePropertiesSchemaV2() {
+}
+
+public CorePropertiesSchemaV2(Map map) {
+flowControllerGracefulShutdownPeriod = getOptionalKeyAsType(map, 
FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY, String.class,
+CORE_PROPS_KEY, 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD);
+flowServiceWriteDelayInterval = getOptionalKeyAsType(map, 
FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY, String.class,
+CORE_PROPS_KEY, DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL);
+administrativeYieldDuration = getOptionalKeyAsType(map, 
ADMINISTRATIVE_YIELD_DURATION_KEY, String.class,
+CORE_PROPS_KEY, DEFAULT_ADMINISTRATIVE_YIELD_DURATION);
+boredYieldDuration = getOptionalKeyAsType(map, 
BORED_YIELD_DURATION_KEY, String.class, CORE_PROPS_KEY, 
DEFAULT_BORED_YIELD_DURATION);
+maxConcurrentThreads = getOptionalKeyAsType(map, 
MAX_CONCURRENT_THREADS_KEY, Number.class,
+CORE_PROPS_KEY, DEFAULT_MAX_CONCURRENT_THREADS);
+}
+
+@Override
+public Map toMap() {
--- End diff --

When changing WritableSchema -> ConvertableSchema, this method should be 
able to be turned into the convert() method (much like 
[RemoteProcessGroupSchemaV2](https://github.com/apache/nifi-minifi/blob/master/minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/v2/RemoteProcessGroupSchemaV2.java#L75))


---
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-minifi pull request #80: MINIFI-277: Write variable registry property t...

2017-04-28 Thread brosander
Github user brosander commented on a diff in the pull request:

https://github.com/apache/nifi-minifi/pull/80#discussion_r113937684
  
--- Diff: 
minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/v2/CorePropertiesSchemaV2.java
 ---
@@ -0,0 +1,95 @@
+/*
+ * 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.minifi.commons.schema.v2;
+
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.CORE_PROPS_KEY;
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.MAX_CONCURRENT_THREADS_KEY;
+
+import java.util.Map;
+
+import org.apache.nifi.minifi.commons.schema.common.BaseSchema;
+import org.apache.nifi.minifi.commons.schema.common.WritableSchema;
+
+/**
+ *
+ */
+public class CorePropertiesSchemaV2 extends BaseSchema implements 
WritableSchema {
+
+public static final String FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY = "flow 
controller graceful shutdown period";
+public static final String FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY = 
"flow service write delay interval";
+public static final String ADMINISTRATIVE_YIELD_DURATION_KEY = 
"administrative yield duration";
+public static final String BORED_YIELD_DURATION_KEY = "bored yield 
duration";
+
+public static final String 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD = "10 sec";
+public static final String DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL = 
"500 ms";
+public static final String DEFAULT_ADMINISTRATIVE_YIELD_DURATION = "30 
sec";
+public static final String DEFAULT_BORED_YIELD_DURATION = "10 millis";
+public static final int DEFAULT_MAX_CONCURRENT_THREADS = 1;
+
+private String flowControllerGracefulShutdownPeriod = 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD;
+private String flowServiceWriteDelayInterval = 
DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL;
+private String administrativeYieldDuration = 
DEFAULT_ADMINISTRATIVE_YIELD_DURATION;
+private String boredYieldDuration = DEFAULT_BORED_YIELD_DURATION;
+private Number maxConcurrentThreads = DEFAULT_MAX_CONCURRENT_THREADS;
+
+public CorePropertiesSchemaV2() {
+}
+
+public CorePropertiesSchemaV2(Map map) {
+flowControllerGracefulShutdownPeriod = getOptionalKeyAsType(map, 
FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY, String.class,
+CORE_PROPS_KEY, 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD);
+flowServiceWriteDelayInterval = getOptionalKeyAsType(map, 
FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY, String.class,
+CORE_PROPS_KEY, DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL);
+administrativeYieldDuration = getOptionalKeyAsType(map, 
ADMINISTRATIVE_YIELD_DURATION_KEY, String.class,
+CORE_PROPS_KEY, DEFAULT_ADMINISTRATIVE_YIELD_DURATION);
+boredYieldDuration = getOptionalKeyAsType(map, 
BORED_YIELD_DURATION_KEY, String.class, CORE_PROPS_KEY, 
DEFAULT_BORED_YIELD_DURATION);
+maxConcurrentThreads = getOptionalKeyAsType(map, 
MAX_CONCURRENT_THREADS_KEY, Number.class,
+CORE_PROPS_KEY, DEFAULT_MAX_CONCURRENT_THREADS);
+}
+
+@Override
+public Map toMap() {
+Map result = mapSupplier.get();
+result.put(FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY, 
flowControllerGracefulShutdownPeriod);
+result.put(FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY, 
flowServiceWriteDelayInterval);
+result.put(ADMINISTRATIVE_YIELD_DURATION_KEY, 
administrativeYieldDuration);
+result.put(BORED_YIELD_DURATION_KEY, boredYieldDuration);
+result.put(MAX_CONCURRENT_THREADS_KEY, maxConcurrentThreads);
+return result;
+}
+
+public String getFlowControllerGracefulShutdownPeriod() {
--- End diff --

The getters should be able to be safely deleted as this V2 class will just 
be used as an intermediary during conversion



[GitHub] nifi-minifi pull request #80: MINIFI-277: Write variable registry property t...

2017-04-28 Thread brosander
Github user brosander commented on a diff in the pull request:

https://github.com/apache/nifi-minifi/pull/80#discussion_r113937508
  
--- Diff: 
minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/v2/CorePropertiesSchemaV2.java
 ---
@@ -0,0 +1,95 @@
+/*
+ * 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.minifi.commons.schema.v2;
+
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.CORE_PROPS_KEY;
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.MAX_CONCURRENT_THREADS_KEY;
+
+import java.util.Map;
+
+import org.apache.nifi.minifi.commons.schema.common.BaseSchema;
+import org.apache.nifi.minifi.commons.schema.common.WritableSchema;
+
+/**
+ *
+ */
+public class CorePropertiesSchemaV2 extends BaseSchema implements 
WritableSchema {
+
+public static final String FLOW_CONTROLLER_SHUTDOWN_PERIOD_KEY = "flow 
controller graceful shutdown period";
+public static final String FLOW_SERVICE_WRITE_DELAY_INTERVAL_KEY = 
"flow service write delay interval";
+public static final String ADMINISTRATIVE_YIELD_DURATION_KEY = 
"administrative yield duration";
+public static final String BORED_YIELD_DURATION_KEY = "bored yield 
duration";
+
+public static final String 
DEFAULT_FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD = "10 sec";
+public static final String DEFAULT_FLOW_SERVICE_WRITE_DELAY_INTERVAL = 
"500 ms";
+public static final String DEFAULT_ADMINISTRATIVE_YIELD_DURATION = "30 
sec";
+public static final String DEFAULT_BORED_YIELD_DURATION = "10 millis";
+public static final int DEFAULT_MAX_CONCURRENT_THREADS = 1;
--- End diff --

The above constants can probably be deleted and statically imported from 
CorePropertiesSchema


---
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-minifi pull request #80: MINIFI-277: Write variable registry property t...

2017-04-28 Thread brosander
Github user brosander commented on a diff in the pull request:

https://github.com/apache/nifi-minifi/pull/80#discussion_r113937276
  
--- Diff: 
minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/v2/CorePropertiesSchemaV2.java
 ---
@@ -0,0 +1,95 @@
+/*
+ * 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.minifi.commons.schema.v2;
+
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.CORE_PROPS_KEY;
+import static 
org.apache.nifi.minifi.commons.schema.common.CommonPropertyKeys.MAX_CONCURRENT_THREADS_KEY;
+
+import java.util.Map;
+
+import org.apache.nifi.minifi.commons.schema.common.BaseSchema;
+import org.apache.nifi.minifi.commons.schema.common.WritableSchema;
+
+/**
+ *
+ */
+public class CorePropertiesSchemaV2 extends BaseSchema implements 
WritableSchema {
--- End diff --

Can this implement ConvertableSchema instead of 
WritableSchema?


---
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-minifi pull request #80: MINIFI-277: Write variable registry property t...

2017-04-26 Thread jzonthemtn
GitHub user jzonthemtn opened a pull request:

https://github.com/apache/nifi-minifi/pull/80

MINIFI-277: Write variable registry property to nifi.properties.

Thank you for submitting a contribution to Apache NiFi - MiNiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [X] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

- [X] Does your PR title start with MINIFI- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.

- [X] Has your PR been rebased against the latest commit within the target 
branch (typically master)?

- [X] Is your initial contribution a single, squashed commit?

### For code changes:
- [X] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi-minifi folder?
- [X] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under minifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under minifi-assembly?

### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


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

$ git pull https://github.com/jzonthemtn/nifi-minifi MINIFI-277

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

https://github.com/apache/nifi-minifi/pull/80.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 #80






---
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.
---