> On Sept. 16, 2015, 6:46 a.m., Sowmya Ramesh wrote:
> > common/src/main/java/org/apache/falcon/entity/parser/ProcessEntityParser.java,
> > line 293
> > <https://reviews.apache.org/r/38391/diff/2/?file=1073950#file1073950line293>
> >
> > I see same logic in mutiple places. Can we add a generic api say
> > validateProperties in Entity util and reuse it?
>
> Balu Vellanki wrote:
> Properties is sub-class specific to each entity. So code does not look
> clean or efficient when attempting to write a generic API.
>
> Sowmya Ramesh wrote:
> Can you call EntityUtil.getEntityProperties and then validate
> java.util.properties returned? It will be more maintainable that way.
EntityUtil.getEntityProperties does the following
java.util.Properties properties = new Properties();
org.apache.falcon.entity.v0.cluster.Properties clusterProps = ((Cluster)
myEntity).getProperties();
if (clusterProps != null) {
for (Property prop : clusterProps.getProperties()) {
properties.put(prop.getName(), prop.getValue());
}
}
java.util.Properties put method makes sure that the key is not already in the
hashtable. This causes the second entry for a duplicate property to be ignored.
The validation should happen before this step. So we cannot use
EntityUtil.getEntityProperties
- Balu
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38391/#review99187
-----------------------------------------------------------
On Sept. 16, 2015, 2:41 p.m., Balu Vellanki wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38391/
> -----------------------------------------------------------
>
> (Updated Sept. 16, 2015, 2:41 p.m.)
>
>
> Review request for Falcon, Pallavi Rao, Sowmya Ramesh, and Venkat Ranganathan.
>
>
> Bugs: FALCON-1342
> https://issues.apache.org/jira/browse/FALCON-1342
>
>
> Repository: falcon-git
>
>
> Description
> -------
>
> When specifying properties for a cluster, this is currently allowed,
>
> {code}
> <properties>
> <property name="test" value="value1"/>
> <property name="test" value="value2"/>
> </properties>
> {code}
>
> The propeties are stored as an array of
> org.apache.falcon.entity.v0.cluster.Property, and cluster.getProperty("test")
> will return either "value1" or "value2" but not both. If falcon does not
> support multiple values for same property key, parsing such an entity should
> throw an error.
>
>
> Diffs
> -----
>
>
> common/src/main/java/org/apache/falcon/entity/parser/ClusterEntityParser.java
> 5756f84
> common/src/main/java/org/apache/falcon/entity/parser/FeedEntityParser.java
> f22a343
>
> common/src/main/java/org/apache/falcon/entity/parser/ProcessEntityParser.java
> 56cc4ca
>
> common/src/test/java/org/apache/falcon/entity/parser/ClusterEntityParserTest.java
> 638cef9
>
> common/src/test/java/org/apache/falcon/entity/parser/FeedEntityParserTest.java
> 754fb06
>
> common/src/test/java/org/apache/falcon/entity/parser/ProcessEntityParserTest.java
> 6612b74
> common/src/test/resources/config/feed/feed-0.1.xml 6448803
>
> Diff: https://reviews.apache.org/r/38391/diff/
>
>
> Testing
> -------
>
> Added unit test. Tested end2end
>
>
> Thanks,
>
> Balu Vellanki
>
>