<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BlackBox &#187; yaml</title>
	<atom:link href="http://www.warneronstine.com/tag/yaml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.warneronstine.com</link>
	<description>Where technology and art disappear</description>
	<lastBuildDate>Tue, 17 Nov 2009 00:05:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Yaml with JYaml</title>
		<link>http://www.warneronstine.com/2006/12/18/yaml-with-jyaml/</link>
		<comments>http://www.warneronstine.com/2006/12/18/yaml-with-jyaml/#comments</comments>
		<pubDate>Tue, 19 Dec 2006 03:25:41 +0000</pubDate>
		<dc:creator>Warner Onstine</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">urn:uuid:{a.guid}</guid>
		<description><![CDATA[So, I decided to use Yaml for all of my configuration needs, in order to use this I needed a library to interface with it, I found JYaml which seems to fit the bill nicely. Here’s a short example of what I’ve used it for in Chama.
--- !org.chama.db.DBConfiguration
dev: !org.chama.db.DBConnection
  dbName: chama_dev
  driver: org.hsqldb.jdbcDriver
 [...]]]></description>
			<content:encoded><![CDATA[<p>So, I decided to use <a href="http://yaml.org">Yaml</a> for all of my configuration needs, in order to use this I needed a library to interface with it, I found <a href="http://jyaml.sf.net">JYaml</a> which seems to fit the bill nicely. Here’s a short example of what I’ve used it for in <a href="http://www.warneronstine.com/cgi-bin/trac.cgi">Chama</a>.</p>
<pre><code>--- !org.chama.db.DBConfiguration
dev: !org.chama.db.DBConnection
  dbName: chama_dev
  driver: org.hsqldb.jdbcDriver
  url: "jdbc:hsqldb:mem:"
  username: sa
production: !org.chama.db.DBConnection
  dbName: chama_production
  driver: org.hsqldb.jdbcDriver
  url: "jdbc:hsqldb:mem:"
  username: sa
test: !org.chama.db.DBConnection
  dbName: chama_test
  driver: org.hsqldb.jdbcDriver
  url: "jdbc:hsqldb:mem:"
  username: sa

DBConfigurationTest.groovy
class DBConfigurationTest extends GroovyTestCase {

    void testReadConfigFile() {
        DBConfiguration config = Yaml.load(new File("src/test/conf/db.yml"))
            assert config.test.dbName == "chama_test"
            assert config.dev.dbName == "chama_dev"
            assert config.production.dbName = "chama_production"
    }

}
</code></pre>
<p>I also found another package when I was having some difficulty with JYaml called <a href="https://jvyaml.dev.java.net/">JvYaml</a>, but when I tried to save my configuration class it gave me a nested object exception telling me that I couldn’t save nested objects into my Yaml file. That seemed kinda stupid to me so perhaps I was doing something wrong, but I didn’t have time to try and figure out what it was and went back to JYaml.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F&amp;partner=sociable" title="Print"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F&amp;title=Yaml%20with%20JYaml&amp;bodytext=So%2C%20I%20decided%20to%20use%20Yaml%20for%20all%20of%20my%20configuration%20needs%2C%20in%20order%20to%20use%20this%20I%20needed%20a%20library%20to%20interface%20with%20it%2C%20I%20found%20JYaml%20which%20seems%20to%20fit%20the%20bill%20nicely.%20Here%E2%80%99s%20a%20short%20example%20of%20what%20I%E2%80%99ve%20used%20it%20for%20in%20Chama.%0D%0A---%20%21org.chama" title="Digg"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F&amp;title=Yaml%20with%20JYaml" title="Reddit"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F&amp;title=Yaml%20with%20JYaml&amp;notes=So%2C%20I%20decided%20to%20use%20Yaml%20for%20all%20of%20my%20configuration%20needs%2C%20in%20order%20to%20use%20this%20I%20needed%20a%20library%20to%20interface%20with%20it%2C%20I%20found%20JYaml%20which%20seems%20to%20fit%20the%20bill%20nicely.%20Here%E2%80%99s%20a%20short%20example%20of%20what%20I%E2%80%99ve%20used%20it%20for%20in%20Chama.%0D%0A---%20%21org.chama" title="del.icio.us"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=Yaml%20with%20JYaml%20-%20http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F" title="Twitter"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F&amp;t=Yaml%20with%20JYaml" title="Facebook"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F&amp;title=Yaml%20with%20JYaml&amp;annotation=So%2C%20I%20decided%20to%20use%20Yaml%20for%20all%20of%20my%20configuration%20needs%2C%20in%20order%20to%20use%20this%20I%20needed%20a%20library%20to%20interface%20with%20it%2C%20I%20found%20JYaml%20which%20seems%20to%20fit%20the%20bill%20nicely.%20Here%E2%80%99s%20a%20short%20example%20of%20what%20I%E2%80%99ve%20used%20it%20for%20in%20Chama.%0D%0A---%20%21org.chama" title="Google Bookmarks"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.warneronstine.com%2F2006%2F12%2F18%2Fyaml-with-jyaml%2F&amp;title=Yaml%20with%20JYaml" title="DZone"><img src="http://www.warneronstine.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.warneronstine.com/2006/12/18/yaml-with-jyaml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
