Modified: 
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtils.java
URL: 
http://svn.apache.org/viewvc/portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtils.java?rev=1647444&r1=1647443&r2=1647444&view=diff
==============================================================================
--- 
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtils.java
 (original)
+++ 
portals/applications/webcontent/trunk/reverse-proxy/src/main/java/org/apache/portals/applications/webcontent2/proxy/util/YamlConfigUtils.java
 Mon Dec 22 23:23:15 2014
@@ -38,11 +38,37 @@ import org.yaml.snakeyaml.Yaml;
 import org.yaml.snakeyaml.constructor.BaseConstructor;
 import org.yaml.snakeyaml.constructor.Constructor;
 
+/**
+ * Utility to load reverse proxy mapping configurations in YAML format.
+ * This utility uses <a 
href="https://code.google.com/p/snakeyaml/";>snakeyaml</a> library internally
+ * to parse YAML configurations.
+ */
 public class YamlConfigUtils
 {
 
     private static Logger log = LoggerFactory.getLogger(YamlConfigUtils.class);
 
+    /**
+     * Loads YAML objects from the <code>yamlConfig</code>.
+     * <p>
+     * The <code>yamlConfig</code> can represent any of the following:
+     * <ul>
+     * <li>a file resource URI starting with "file:",</li>
+     * <li>a classpath resource starting with "classpath:",</li>
+     * <li>a servlet context relative path resource starting with "/",</li>
+     * <li>otherwise, <code>yamlConfig</code> is regarded as a whole YAML 
configuration string.</li>
+     * </ul>
+     * </p>
+     * <p>
+     * <em>Note:</em> if <code>yamlConfig</code> represents an external 
resource (file resource URI, classpath resource or
+     * or servlet context relative path resource), then the resource must be 
encoded in UTF-8.
+     * </p>
+     * 
+     * @param constructor snakeyaml base constructor to be used when 
constructing a {@link Yaml}
+     * @param yamlConfig YAML configuration resource or string
+     * @param servletContextOrPortletContext either a {@link 
javax.servlet.ServletContext} or {@link javax.portlet.PortletContext} instance.
+     * @return an iterable of the parsed YAML objects from the 
<code>yamlConfig</code>.
+     */
     public static Iterable<Object> loadYaml(BaseConstructor constructor, 
String yamlConfig, Object servletContextOrPortletContext)
     {
         Iterable<Object> allObjects = null;
@@ -98,6 +124,12 @@ public class YamlConfigUtils
         return allObjects;
     }
 
+    /**
+     * Loads list of {@link ProxyMapping} objects from the 
<code>yamlConfig</code>.
+     * @param yamlConfig YAML configuration resource or string
+     * @param servletContextOrPortletContext either a {@link 
javax.servlet.ServletContext} or {@link javax.portlet.PortletContext} instance.
+     * @return a list of {@link ProxyMapping} objects from the 
<code>yamlConfig</code>.
+     */
     public static List<ProxyMapping> loadProxyMappings(String yamlConfig, 
Object servletContextOrPortletContext)
     {
         List<ProxyMapping> proxyMappings = new ArrayList<ProxyMapping>();


Reply via email to