[Yanel-commits] rev 23296 -
public/yanel/trunk/src/core/java/org/wyona/yanel/core
michi at wyona.com
michi at wyona.com
Mon Mar 19 10:19:08 CET 2007
Author: michi
Date: 2007-03-19 10:19:06 +0100 (Mon, 19 Mar 2007)
New Revision: 23296
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java
public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceTypeIdentifier.java
Log:
getProperties implemented
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java 2007-03-17 15:01:31 UTC (rev 23295)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfiguration.java 2007-03-19 09:19:06 UTC (rev 23296)
@@ -17,6 +17,7 @@
package org.wyona.yanel.core;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@@ -119,6 +120,24 @@
}
/**
+ * @param key
+ * @return value for this key or null if no value exists for this key.
+ */
+ public String[] getProperties(String key) throws Exception {
+ ArrayList properties = new ArrayList();
+ if (config != null) {
+ Configuration[] props = config.getChildren("property");
+ for (int i = 0; i < props.length; i++) {
+ if (props[i].getAttribute("name") != null && props[i].getAttribute("name").equals(key)) {
+ properties.add(props[i].getAttribute("value"));
+ }
+ }
+ return (String[]) properties.toArray(new String[0]);
+ }
+ return null;
+ }
+
+ /**
* Check if property exists
*/
public boolean containsKey(String key) throws Exception {
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceTypeIdentifier.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceTypeIdentifier.java 2007-03-17 15:01:31 UTC (rev 23295)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceTypeIdentifier.java 2007-03-19 09:19:06 UTC (rev 23296)
@@ -85,10 +85,23 @@
* @return value for this key or null if no value exists for this key.
*/
public String getProperty(String key) {
- return (String)properties.get(key);
+ return (String)properties.get(key);
}
/**
+ * @param key
+ * @return value for this key or null if no value exists for this key.
+ */
+ public String[] getProperties(String key) {
+ String property = (String)properties.get(key);
+ if (property != null) {
+ return property.split(",");
+ } else {
+ return null;
+ }
+ }
+
+ /**
* Check if property exists
*/
public boolean containsKey(String key) {
More information about the Yanel-commits
mailing list