Repository: incubator-eagle
Updated Branches:
  refs/heads/master 2306c43a5 -> a0005997c


[EAGLE-549] Add required field for application configuration

Support `required`:`boolean` in configuration property.

~~~
<configuration>
    <property>
        <name>service.host</name>
        <value>localhost</value>
        <displayName>Eagle Service Host</displayName>
        <description>Eagle Service Host, default: localhost</description>
       <required>true</required>
    </property>
</configuration>
~~~

Author: Hao Chen <h...@apache.org>

Closes #440 from haoch/EAGLE-549.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/a0005997
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/a0005997
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/a0005997

Branch: refs/heads/master
Commit: a0005997cce58aa6a4095f0de740393e84d751d6
Parents: 2306c43
Author: Hao Chen <h...@apache.org>
Authored: Sun Sep 18 15:47:03 2016 +0800
Committer: Hao Chen <h...@apache.org>
Committed: Sun Sep 18 15:47:03 2016 +0800

----------------------------------------------------------------------
 .../apache/eagle/metadata/model/Configuration.java | 17 +++++++++--------
 .../org/apache/eagle/metadata/model/Property.java  |  9 +++++++++
 ...che.eagle.app.jpm.JPMWebApplicationProvider.xml |  2 ++
 3 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0005997/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
 
b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
index 345c935..272e9bd 100644
--- 
a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
+++ 
b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
@@ -36,18 +36,18 @@ public class Configuration {
         return properties;
     }
 
-    public Property getProperty(String name){
-        for(Property property :properties){
-            if(property.getName().equals(name)){
+    public Property getProperty(String name) {
+        for (Property property : properties) {
+            if (property.getName().equals(name)) {
                 return property;
             }
         }
         return null;
     }
 
-    public boolean hasProperty(String name){
-        for(Property property :properties){
-            if(property.getName().equals(name)){
+    public boolean hasProperty(String name) {
+        for (Property property : properties) {
+            if (property.getName().equals(name)) {
                 return true;
             }
         }
@@ -61,12 +61,13 @@ public class Configuration {
     public static Configuration fromResource(String resourceName) throws 
JAXBException {
         return ConfigTemplateHelper.unmarshallFromResource(resourceName);
     }
+
     public static Configuration fromString(String xmlContent) throws 
JAXBException {
         return ConfigTemplateHelper.unmarshallFromXMLString(xmlContent);
     }
 
-    public int size(){
-        if(this.properties == null){
+    public int size() {
+        if (this.properties == null) {
             return 0;
         }
         return this.properties.size();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0005997/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
 
b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
index 642f760..558d3aa 100644
--- 
a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
+++ 
b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
@@ -21,6 +21,7 @@ public class Property {
     private String displayName;
     private String value;
     private String description;
+    private boolean required;
 
     public String getDescription() {
         return description;
@@ -53,4 +54,12 @@ public class Property {
     public void setDisplayName(String displayName) {
         this.displayName = displayName;
     }
+
+    public boolean isRequired() {
+        return required;
+    }
+
+    public void setRequired(boolean required) {
+        this.required = required;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a0005997/eagle-jpm/eagle-jpm-web/src/main/resources/META-INF/providers/org.apache.eagle.app.jpm.JPMWebApplicationProvider.xml
----------------------------------------------------------------------
diff --git 
a/eagle-jpm/eagle-jpm-web/src/main/resources/META-INF/providers/org.apache.eagle.app.jpm.JPMWebApplicationProvider.xml
 
b/eagle-jpm/eagle-jpm-web/src/main/resources/META-INF/providers/org.apache.eagle.app.jpm.JPMWebApplicationProvider.xml
index 6620b21..7a1b3b9 100644
--- 
a/eagle-jpm/eagle-jpm-web/src/main/resources/META-INF/providers/org.apache.eagle.app.jpm.JPMWebApplicationProvider.xml
+++ 
b/eagle-jpm/eagle-jpm-web/src/main/resources/META-INF/providers/org.apache.eagle.app.jpm.JPMWebApplicationProvider.xml
@@ -46,12 +46,14 @@
             <value>localhost</value>
             <displayName>Eagle Service Host</displayName>
             <description>Eagle Service Host, default: localhost</description>
+            <required>true</required>
         </property>
         <property>
             <name>service.port</name>
             <value>8080</value>
             <displayName>Eagle Service Port</displayName>
             <description>Eagle Service Port, default: 8080</description>
+            <required>true</required>
         </property>
     </configuration>
 </application>
\ No newline at end of file

Reply via email to