<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Keksrolle.de</title>
	
	<link>http://blog.keksrolle.de</link>
	<description>Christoph's thoughts on software development, noteblog and travelling diary.</description>
	<lastBuildDate>Wed, 28 Jul 2010 05:35:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Keksrolle" /><feedburner:info uri="keksrolle" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How to create a valid SAML 2.0 Assertion with OpenSAML for JAVA</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/9181mxAzPsU/how-to-create-a-valid-saml-2-0-assertion-with-opensaml-for-java.html</link>
		<comments>http://blog.keksrolle.de/2010/07/27/how-to-create-a-valid-saml-2-0-assertion-with-opensaml-for-java.html#comments</comments>
		<pubDate>Tue, 27 Jul 2010 15:12:37 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[Assertion]]></category>
		<category><![CDATA[OpenSAML]]></category>
		<category><![CDATA[SAML]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SSO]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=487</guid>
		<description><![CDATA[Recently I had to implement SAML 2.0 for a client project for a Single Sign On (SSO) process.
For this purpose our system needed to create a SAML Assertion containing all the information of the user who is currently logging in.
I was using the OpenSAML classes for JAVA.
Initially I had some issues because I couldn&#8217;t find [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to implement SAML 2.0 for a client project for a Single Sign On (SSO) process.<br />
For this purpose our system needed to create a SAML Assertion containing all the information of the user who is currently logging in.</p>
<p>I was using the <a href="http://shibboleth.internet2.edu/downloads/opensaml/java/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/shibboleth.internet2.edu/downloads/opensaml/java/?referer=');">OpenSAML</a> classes for JAVA.<br />
Initially I had some issues because I couldn&#8217;t find good documentation / examples about what how such an Assertion is to be created using OpenSAML.</p>
<p>I had to do lots of googling and trial &amp; error and finally I got it working.<br />
The following sites were useful and led to my solution.<br />
- <a href="http://blogs.sun.com/JoachimAndres/entry/creating_a_saml_assertion_with1" onclick="pageTracker._trackPageview('/outgoing/blogs.sun.com/JoachimAndres/entry/creating_a_saml_assertion_with1?referer=');">http://blogs.sun.com/JoachimAndres/entry/creating_a_saml_assertion_with1</a><br />
- <a href="http://www.capcourse.com/Library/OpenSAML/index.html" onclick="pageTracker._trackPageview('/outgoing/www.capcourse.com/Library/OpenSAML/index.html?referer=');">http://www.capcourse.com/Library/OpenSAML/index.html</a><br />
- <a href="http://ekschi.com/technology/2009/09/01/creating-a-saml-assertion-with-opensaml-part-2/" onclick="pageTracker._trackPageview('/outgoing/ekschi.com/technology/2009/09/01/creating-a-saml-assertion-with-opensaml-part-2/?referer=');">http://ekschi.com/technology/2009/09/01/creating-a-saml-assertion-with-opensaml-part-2/</a></p>
<p>Though I had to make modifications to some of the solutions above.</p>
<p>To save you this pain, I am posting my final example here. The class below is only for demonstration purposes of this blog entry, and I have stripped out lots of other stuff (e.g. error handling, client specific stuff, encryption via EncryptedAssertion). The only purpose is to give you some kind of template and idea how to start.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.HashMap</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Map</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Set</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.joda.time.DateTime</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.Configuration</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.DefaultBootstrap</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.common.SAMLObjectBuilder</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.common.SAMLVersion</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.Assertion</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.Attribute</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.AttributeStatement</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.AttributeValue</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.AuthnContext</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.AuthnContextClassRef</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.AuthnStatement</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.Condition</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.Conditions</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.Issuer</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.NameID</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.OneTimeUse</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.Subject</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.SubjectConfirmation</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.SubjectConfirmationData</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.saml2.core.impl.AssertionMarshaller</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.xml.ConfigurationException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.xml.XMLObjectBuilder</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.xml.XMLObjectBuilderFactory</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.xml.io.MarshallingException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.xml.schema.XSString</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.opensaml.xml.util.XMLHelper</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.w3c.dom.Element</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * This is a demo class which creates a valid SAML 2.0 Assertion.
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SAMLWriter
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #006600; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			SAMLInputContainer input = <span style="color: #000000; font-weight: bold;">new</span> SAMLInputContainer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			input.<span style="color: #006633;">strIssuer</span> = <span style="color: #0000ff;">&quot;http://synesty.com&quot;</span><span style="color: #339933;">;</span>
			input.<span style="color: #006633;">strNameID</span> = <span style="color: #0000ff;">&quot;UserJohnSmith&quot;</span><span style="color: #339933;">;</span>
			input.<span style="color: #006633;">strNameQualifier</span> = <span style="color: #0000ff;">&quot;My Website&quot;</span><span style="color: #339933;">;</span>
			input.<span style="color: #006633;">sessionId</span> = <span style="color: #0000ff;">&quot;abcdedf1234567&quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #003399; font-weight: bold;">Map</span> customAttributes = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">HashMap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			customAttributes.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FirstName&quot;</span>, <span style="color: #0000ff;">&quot;John&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			customAttributes.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;LastName&quot;</span>, <span style="color: #0000ff;">&quot;Smith&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			input.<span style="color: #006633;">attributes</span> = customAttributes<span style="color: #339933;">;</span>
&nbsp;
			Assertion assertion = SAMLWriter.<span style="color: #006633;">buildDefaultAssertion</span><span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			AssertionMarshaller marshaller = <span style="color: #000000; font-weight: bold;">new</span> AssertionMarshaller<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399; font-weight: bold;">Element</span> plaintextElement = marshaller.<span style="color: #006633;">marshall</span><span style="color: #009900;">&#40;</span>assertion<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399; font-weight: bold;">String</span> originalAssertionString = XMLHelper.<span style="color: #006633;">nodeToString</span><span style="color: #009900;">&#40;</span>plaintextElement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #003399; font-weight: bold;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Assertion String: &quot;</span> + originalAssertionString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// TODO: now you can also add encryption....</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>MarshallingException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span>
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> XMLObjectBuilderFactory builderFactory<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> XMLObjectBuilderFactory getSAMLBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399; font-weight: bold;">ConfigurationException</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000;  font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>builderFactory == <span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// OpenSAML 2.3</span>
			 DefaultBootstrap.<span style="color: #006633;">bootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         builderFactory = <span style="color: #003399; font-weight: bold;">Configuration</span>.<span style="color: #006633;">getBuilderFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> builderFactory<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Builds a SAML Attribute of type String
	 * @param name
	 * @param value
	 * @param builderFactory
	 * @return
	 * @throws ConfigurationException
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399; font-weight: bold;">Attribute</span> buildStringAttribute<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> name, <span style="color: #003399; font-weight: bold;">String</span> value, XMLObjectBuilderFactory builderFactory<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399; font-weight: bold;">ConfigurationException</span>
	<span style="color: #009900;">&#123;</span>
		SAMLObjectBuilder attrBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> getSAMLBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Attribute</span>.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		 <span style="color: #003399; font-weight: bold;">Attribute</span> attrFirstName = <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Attribute</span><span style="color: #009900;">&#41;</span> attrBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		 attrFirstName.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		 <span style="color: #666666; font-style: italic;">// Set custom Attributes</span>
		 XMLObjectBuilder stringBuilder = getSAMLBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>XSString.<span style="color: #006633;">TYPE_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		 XSString attrValueFirstName = <span style="color: #009900;">&#40;</span>XSString<span style="color: #009900;">&#41;</span> stringBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span>AttributeValue.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span>, XSString.<span style="color: #006633;">TYPE_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		 attrValueFirstName.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		 attrFirstName.<span style="color: #006633;">getAttributeValues</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>attrValueFirstName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> attrFirstName<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Helper method which includes some basic SAML fields which are part of almost every SAML Assertion.
	 *
	 * @param input
	 * @return
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Assertion buildDefaultAssertion<span style="color: #009900;">&#40;</span>SAMLInputContainer input<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span>
		<span style="color: #009900;">&#123;</span>
	         <span style="color: #666666; font-style: italic;">// Create the NameIdentifier</span>
	         SAMLObjectBuilder nameIdBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>NameID.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         NameID nameId = <span style="color: #009900;">&#40;</span>NameID<span style="color: #009900;">&#41;</span> nameIdBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         nameId.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>input.<span style="color: #006633;">getStrNameID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         nameId.<span style="color: #006633;">setNameQualifier</span><span style="color: #009900;">&#40;</span>input.<span style="color: #006633;">getStrNameQualifier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         nameId.<span style="color: #006633;">setFormat</span><span style="color: #009900;">&#40;</span>NameID.<span style="color: #006633;">UNSPECIFIED</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         <span style="color: #666666; font-style: italic;">// Create the SubjectConfirmation</span>
&nbsp;
	         SAMLObjectBuilder confirmationMethodBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span>  SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>SubjectConfirmationData.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         SubjectConfirmationData confirmationMethod = <span style="color: #009900;">&#40;</span>SubjectConfirmationData<span style="color: #009900;">&#41;</span> confirmationMethodBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         DateTime now = <span style="color: #000000; font-weight: bold;">new</span> DateTime<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         confirmationMethod.<span style="color: #006633;">setNotBefore</span><span style="color: #009900;">&#40;</span>now<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         confirmationMethod.<span style="color: #006633;">setNotOnOrAfter</span><span style="color: #009900;">&#40;</span>now.<span style="color: #006633;">plusMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         SAMLObjectBuilder subjectConfirmationBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>SubjectConfirmation.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         SubjectConfirmation subjectConfirmation = <span style="color: #009900;">&#40;</span>SubjectConfirmation<span style="color: #009900;">&#41;</span> subjectConfirmationBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         subjectConfirmation.<span style="color: #006633;">setSubjectConfirmationData</span><span style="color: #009900;">&#40;</span>confirmationMethod<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         <span style="color: #666666; font-style: italic;">// Create the Subject</span>
	         SAMLObjectBuilder subjectBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Subject</span>.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         <span style="color: #003399; font-weight: bold;">Subject</span> subject = <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Subject</span><span style="color: #009900;">&#41;</span> subjectBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         subject.<span style="color: #006633;">setNameID</span><span style="color: #009900;">&#40;</span>nameId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         subject.<span style="color: #006633;">getSubjectConfirmations</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>subjectConfirmation<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         <span style="color: #666666; font-style: italic;">// Create Authentication Statement</span>
	         SAMLObjectBuilder authStatementBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>AuthnStatement.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         AuthnStatement authnStatement = <span style="color: #009900;">&#40;</span>AuthnStatement<span style="color: #009900;">&#41;</span> authStatementBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         <span style="color: #666666; font-style: italic;">//authnStatement.setSubject(subject);</span>
	         <span style="color: #666666; font-style: italic;">//authnStatement.setAuthenticationMethod(strAuthMethod);</span>
	         DateTime now2 = <span style="color: #000000; font-weight: bold;">new</span> DateTime<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         authnStatement.<span style="color: #006633;">setAuthnInstant</span><span style="color: #009900;">&#40;</span>now2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         authnStatement.<span style="color: #006633;">setSessionIndex</span><span style="color: #009900;">&#40;</span>input.<span style="color: #006633;">getSessionId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         authnStatement.<span style="color: #006633;">setSessionNotOnOrAfter</span><span style="color: #009900;">&#40;</span>now2.<span style="color: #006633;">plus</span><span style="color: #009900;">&#40;</span>input.<span style="color: #006633;">getMaxSessionTimeoutInMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         SAMLObjectBuilder authContextBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>AuthnContext.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         AuthnContext authnContext = <span style="color: #009900;">&#40;</span>AuthnContext<span style="color: #009900;">&#41;</span> authContextBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         SAMLObjectBuilder authContextClassRefBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>AuthnContextClassRef.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         AuthnContextClassRef authnContextClassRef = <span style="color: #009900;">&#40;</span>AuthnContextClassRef<span style="color: #009900;">&#41;</span> authContextClassRefBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         authnContextClassRef.<span style="color: #006633;">setAuthnContextClassRef</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;urn:oasis:names:tc:SAML:2.0:ac:classes:Password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// TODO not sure exactly about this</span>
&nbsp;
			authnContext.<span style="color: #006633;">setAuthnContextClassRef</span><span style="color: #009900;">&#40;</span>authnContextClassRef<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        authnStatement.<span style="color: #006633;">setAuthnContext</span><span style="color: #009900;">&#40;</span>authnContext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	        <span style="color: #666666; font-style: italic;">// Builder Attributes</span>
	         SAMLObjectBuilder attrStatementBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>AttributeStatement.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         AttributeStatement attrStatement = <span style="color: #009900;">&#40;</span>AttributeStatement<span style="color: #009900;">&#41;</span> attrStatementBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	      <span style="color: #666666; font-style: italic;">// Create the attribute statement</span>
	         <span style="color: #003399; font-weight: bold;">Map</span> attributes = input.<span style="color: #006633;">getAttributes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         <span style="color: #000000;  font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>attributes <span style="color: #339933;">!</span>= <span style="color: #006600; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	        	 <span style="color: #003399; font-weight: bold;">Set</span> keySet = attributes.<span style="color: #006633;">keySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        	 <span style="color: #000000;  font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> key : keySet<span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
	        		 <span style="color: #003399; font-weight: bold;">Attribute</span> attrFirstName = buildStringAttribute<span style="color: #009900;">&#40;</span>key, attributes.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span>, getSAMLBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        		 attrStatement.<span style="color: #006633;">getAttributes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>attrFirstName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
	         <span style="color: #009900;">&#125;</span>
&nbsp;
	         <span style="color: #666666; font-style: italic;">// Create the do-not-cache condition</span>
	         SAMLObjectBuilder doNotCacheConditionBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>OneTimeUse.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         <span style="color: #003399; font-weight: bold;">Condition</span> condition = <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Condition</span><span style="color: #009900;">&#41;</span> doNotCacheConditionBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         SAMLObjectBuilder conditionsBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>Conditions.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         Conditions conditions = <span style="color: #009900;">&#40;</span>Conditions<span style="color: #009900;">&#41;</span> conditionsBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         conditions.<span style="color: #006633;">getConditions</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         <span style="color: #666666; font-style: italic;">// Create Issuer</span>
	         SAMLObjectBuilder issuerBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>Issuer.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         Issuer issuer = <span style="color: #009900;">&#40;</span>Issuer<span style="color: #009900;">&#41;</span> issuerBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         issuer.<span style="color: #006633;">setValue</span><span style="color: #009900;">&#40;</span>input.<span style="color: #006633;">getStrIssuer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         <span style="color: #666666; font-style: italic;">// Create the assertion</span>
	         SAMLObjectBuilder assertionBuilder = <span style="color: #009900;">&#40;</span>SAMLObjectBuilder<span style="color: #009900;">&#41;</span> SAMLWriter.<span style="color: #006633;">getSAMLBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBuilder</span><span style="color: #009900;">&#40;</span>Assertion.<span style="color: #006633;">DEFAULT_ELEMENT_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         Assertion assertion = <span style="color: #009900;">&#40;</span>Assertion<span style="color: #009900;">&#41;</span> assertionBuilder.<span style="color: #006633;">buildObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         assertion.<span style="color: #006633;">setIssuer</span><span style="color: #009900;">&#40;</span>issuer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         assertion.<span style="color: #006633;">setIssueInstant</span><span style="color: #009900;">&#40;</span>now<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         assertion.<span style="color: #006633;">setVersion</span><span style="color: #009900;">&#40;</span>SAMLVersion.<span style="color: #006633;">VERSION_20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	         assertion.<span style="color: #006633;">getAuthnStatements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>authnStatement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         assertion.<span style="color: #006633;">getAttributeStatements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>attrStatement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	         assertion.<span style="color: #006633;">setConditions</span><span style="color: #009900;">&#40;</span>conditions<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">return</span> assertion<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Exception</span> e<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #006600; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> SAMLInputContainer
	<span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399; font-weight: bold;">String</span> strIssuer<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399; font-weight: bold;">String</span> strNameID<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399; font-weight: bold;">String</span> strNameQualifier<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399; font-weight: bold;">String</span> sessionId<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #006600; font-weight: bold;">int</span> maxSessionTimeoutInMinutes = <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// default is 15 minutes</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399; font-weight: bold;">Map</span> attributes<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns the strIssuer.
		 *
		 * @return the strIssuer
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getStrIssuer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> strIssuer<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Sets the strIssuer.
		 *
		 * @param strIssuer
		 *            the strIssuer to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setStrIssuer<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> strIssuer<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">strIssuer</span> = strIssuer<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns the strNameID.
		 *
		 * @return the strNameID
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getStrNameID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> strNameID<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Sets the strNameID.
		 *
		 * @param strNameID
		 *            the strNameID to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setStrNameID<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> strNameID<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">strNameID</span> = strNameID<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns the strNameQualifier.
		 *
		 * @return the strNameQualifier
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getStrNameQualifier<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> strNameQualifier<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Sets the strNameQualifier.
		 *
		 * @param strNameQualifier
		 *            the strNameQualifier to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setStrNameQualifier<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> strNameQualifier<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">strNameQualifier</span> = strNameQualifier<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Sets the attributes.
		 *
		 * @param attributes
		 *            the attributes to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setAttributes<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Map</span> attributes<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">attributes</span> = attributes<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns the attributes.
		 *
		 * @return the attributes
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">Map</span> getAttributes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> attributes<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Sets the sessionId.
		 * @param sessionId the sessionId to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setSessionId<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> sessionId<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">sessionId</span> = sessionId<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns the sessionId.
		 * @return the sessionId
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399; font-weight: bold;">String</span> getSessionId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> sessionId<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Sets the maxSessionTimeoutInMinutes.
		 * @param maxSessionTimeoutInMinutes the maxSessionTimeoutInMinutes to set
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> setMaxSessionTimeoutInMinutes<span style="color: #009900;">&#40;</span><span style="color: #006600; font-weight: bold;">int</span> maxSessionTimeoutInMinutes<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">maxSessionTimeoutInMinutes</span> = maxSessionTimeoutInMinutes<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #008000; font-style: italic; font-weight: bold;">/**
		 * Returns the maxSessionTimeoutInMinutes.
		 * @return the maxSessionTimeoutInMinutes
		 */</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">int</span> getMaxSessionTimeoutInMinutes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> maxSessionTimeoutInMinutes<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>


<p><a href="http://feedads.g.doubleclick.net/~a/hyDpCJvIDuxJIel-jd0B-4CouQQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/hyDpCJvIDuxJIel-jd0B-4CouQQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hyDpCJvIDuxJIel-jd0B-4CouQQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/hyDpCJvIDuxJIel-jd0B-4CouQQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/9181mxAzPsU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/07/27/how-to-create-a-valid-saml-2-0-assertion-with-opensaml-for-java.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/07/27/how-to-create-a-valid-saml-2-0-assertion-with-opensaml-for-java.html</feedburner:origLink></item>
		<item>
		<title>HTML Snippet: IE specific CSS classes for body tag</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/vKwAwsv1AH8/html-snippet-ie-specific-css-classes-for-body-tag.html</link>
		<comments>http://blog.keksrolle.de/2010/07/20/html-snippet-ie-specific-css-classes-for-body-tag.html#comments</comments>
		<pubDate>Tue, 20 Jul 2010 09:37:48 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=483</guid>
		<description><![CDATA[A colleque just showed me today how you can give the body tag a specific CSS class depending on the versions of Internet Explorer. With this you can avoid special css files for IE specific styling and handle it inside a single CSS file.
A colleque just showed me today how you can give the body [...]]]></description>
			<content:encoded><![CDATA[<p>A colleque just showed me today how you can give the body tag a specific CSS class depending on the versions of Internet Explorer. With this you can avoid special css files for IE specific styling and handle it inside a single CSS file.<br />
A colleque just showed me today how you can give the body tag a specific CSS class depending on the versions of Internet Explorer. With this you can avoid special css files for IE specific styling and handle it inside a single CSS file.<br />
<textarea cols=50 rows=10><br />
<!--[if lt IE 7]><body class="ie7 ie6"><![endif]--><br />
<!--[if IE 7]><body class="ie7"><![endif]--><br />
<!--[if gt IE 7]><body class="ie"><![endif]--><br />
<!--[if !IE]><!--><body><!-- <![endif]--><br />
</textarea></p>

<p><a href="http://feedads.g.doubleclick.net/~a/fuoAN-4X-17rmFoVBCnqE24Fn2E/0/da"><img src="http://feedads.g.doubleclick.net/~a/fuoAN-4X-17rmFoVBCnqE24Fn2E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/fuoAN-4X-17rmFoVBCnqE24Fn2E/1/da"><img src="http://feedads.g.doubleclick.net/~a/fuoAN-4X-17rmFoVBCnqE24Fn2E/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/vKwAwsv1AH8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/07/20/html-snippet-ie-specific-css-classes-for-body-tag.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/07/20/html-snippet-ie-specific-css-classes-for-body-tag.html</feedburner:origLink></item>
		<item>
		<title>My Notes taken at Berlin Buzzwords</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/zuBb0A0EQYY/my-notes-taken-at-berlin-buzzwords.html</link>
		<comments>http://blog.keksrolle.de/2010/06/30/my-notes-taken-at-berlin-buzzwords.html#comments</comments>
		<pubDate>Wed, 30 Jun 2010 04:56:16 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[berlinbuzzwords]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[nosql]]></category>
		<category><![CDATA[salability]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=479</guid>
		<description><![CDATA[BerlinBuzzwords
http://berlinbuzzwords.de
Keynote &#8211; Grant Ingersoll &#8211; Lucid Imagination about Lucene

@gsingers
grant@lucidimagination.com
http://www.manning.com/ingersoll
SolrCloud == ZooKeeper + Solr
http://wiki.apache.org/solr/SolrCloud
http://en.wikipedia.org/wiki/Sentiment_analysis
Map/Reduce Ready recommenders available
Identify Topics
Latent Dirichlet Allocation ==&#62; http://de.wikipedia.org/wiki/Latent_Dirichlet_Allocation
Frequent Pattern Mining
Clustering
K-Means, Dirichlet, Canopy, etc
Carrot^2 Document and Search Result Clustering =&#62; http://project.carrot2.org/
Eigent Cuts (spectral Clustering) =&#62; http://www.google.de/search?hl=de&#38;q=eigen+cuts+clustering&#38;aq=f&#38;aqi=&#38;aql=&#38;oq=&#38;gs_rfai=
http://cwiki.apache.org/MAHOUT/algorithms.html
Location Aware Search results
Query Parsing
Filtering
Boosting
Sorting
Singular Value Decomposition (SVD) =&#62; http://en.wikipedia.org/wiki/Singular_value_decomposition
technique for reducing the dimensionaltity of large matrices while [...]]]></description>
			<content:encoded><![CDATA[<h1 id="berlinbuzzwords">BerlinBuzzwords</h1>
<p><a href="http://berlinbuzzwords.de" onclick="pageTracker._trackPageview('/outgoing/berlinbuzzwords.de?referer=');">http://berlinbuzzwords.de</a></p>
<h2 id="keynote-grantingersoll-lucidimaginationaboutlucene">Keynote &#8211; Grant Ingersoll &#8211; Lucid Imagination about Lucene</h2>
<ul>
<li>@gsingers</li>
<li>grant@lucidimagination.com</li>
<li>http://www.manning.com/ingersoll</li>
<li>SolrCloud == ZooKeeper + Solr</li>
<li>http://wiki.apache.org/solr/SolrCloud</li>
<li>http://en.wikipedia.org/wiki/Sentiment_analysis</li>
<li>Map/Reduce Ready recommenders available</li>
<li>Identify Topics</li>
<li>Latent Dirichlet Allocation ==&gt; http://de.wikipedia.org/wiki/Latent_Dirichlet_Allocation</li>
<li>Frequent Pattern Mining</li>
<li>Clustering</li>
<li>K-Means, Dirichlet, Canopy, etc</li>
<li>Carrot^2 Document and Search Result Clustering =&gt; http://project.carrot2.org/</li>
<li>Eigent Cuts (spectral Clustering) =&gt; http://www.google.de/search?hl=de&amp;q=eigen+cuts+clustering&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=</li>
<li>http://cwiki.apache.org/MAHOUT/algorithms.html</li>
<li>Location Aware Search results</li>
<li>Query Parsing</li>
<li>Filtering</li>
<li>Boosting</li>
<li>Sorting</li>
<li>Singular Value Decomposition (SVD) =&gt; http://en.wikipedia.org/wiki/Singular_value_decomposition</li>
<li>technique for reducing the dimensionaltity of large matrices while retaining the core features of the larger space</li>
<li>Latent Semantic Analysis uses SVD to provide search over the reduced space =&gt; http://github.com/algoriffic/lsa4solr</li>
<li>Named Entity Recognition =&gt; http://en.wikipedia.org/wiki/Named_entity_recognition<br />
*</li>
<li>Finite-State Queries in Lucene http://lingpipe-blog.com/2010/03/25/finite-state-queries-in-lucene/</li>
</ul>
<h2 id="luceneforecast-versionunicodeflexmodulesbysimonwillnauer">Lucene Forecast &#8211; Version, Unicode, Flex, Modules by Simon Willnauer</h2>
<ul>
<li>switched to Kino 10</li>
</ul>
<h2 id="makingsoftwareforhumans:couchdb">Making Software for Humans: CouchDB</h2>
<ul>
<li>Jan Lehnardt</li>
<li>a one-size-fits-all solution for scaling out is not really possible at all @janl #berlinbuzzwords</li>
</ul>
<h2 id="textandmetadataextractionwithapachetika">“Text and Metadata extraction with Apache Tika</h2>
<ul>
<li>http://tika.apache.org/</li>
<li>switched to Riak Talk</li>
</ul>
<h2 id="metacartageosearchtoolkitforsolr">METACARTA GEOSEARCH TOOLKIT FOR SOLR</h2>
<ul>
<li>http://berlinbuzzwords.de/content/metacarta-geosearch-toolkit-solr</li>
</ul>
<h2 id="learninglessons:buildingacmsontopofnosqltechnologies">LEARNING LESSONS: BUILDING A CMS ON TOP OF NOSQL TECHNOLOGIES</h2>
<ul>
<li>http://berlinbuzzwords.de/content/learning-lessons-building-cms-top-nosql-technologies</li>
<li>best talk so far</li>
</ul>
<h2 id="elasticsearch">Elastic Search</h2>
<ul>
<li>http://berlinbuzzwords.de/content/elasticsearch-you-know-search</li>
<li>distributed</li>
<li>completly HTTP based</li>
<li>range queries possible</li>
<li>json based</li>
<li>lucene based</li>
<li>filters: faster than queries (cachable)</li>
<li>Near Realtime Search available<br />
*</p>
<h1 id="neoj-peterneubauer">NeoJ &#8211; Peter Neubauer</h1>
</li>
<li>Nodes</li>
<li>Relationsships between nodes</li>
<li>properties on Nodes and props</li>
<li>Traversal Framework</li>
<li>Lucene integrated (indexing done on commit)</li>
<li>http://www.google.de/search?hl=de&amp;q=rdf+reasoning&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=</li>
</ul>
<h2 id="riaksearch">Riak Search</h2>
<ul>
<li>http://berlinbuzzwords.de/content/basho-search</li>
<li>different query type patterns &#8211; keybased</li>
<li>Consistent Hashing and Partitions</li>
<li>Optimizations (to avoid “Obama Problem = Hotspots in the ring e.g. many documents containing the word Obama all going to the same node”)</li>
<li>Bloom Filters &amp; Caching</li>
<li>Batching to sae query-time &amp; index-time bandwith<br />
*</li>
</ul>
<h1 id="day2">Day2</h1>
<h2 id="keynote">Keynote</h2>
<ul>
<li>ZeroMQ &#8211; 0MQ &#8211; http://www.zeromq.org/</li>
<li>http://www.zeromq.org/blog:multithreading-magic</li>
<li>“the fewest possible moving pieces” -&gt; no service discovery.</li>
<li>No Broker</li>
</ul>
<h2 id="hypertable-http:berlinbuzzwords.decontenthypertable-ultimate-scaling-machine">Hypertable &#8211; http://berlinbuzzwords.de/content/hypertable-ultimate-scaling-machine</h2>
<ul>
<li>used by Baidu  search engine</li>
<li>Dynamo &#8211; used by Amazon for Shopping Cart (uses Read-Repair and Consistent Hashing)</li>
<li>during periods of failure there can be latency spikes, because of single machine handling the ranges / machines</li>
<li>LSM &#8211; Log Structured Merge Tre</li>
<li>eleminates random I/O =&gt; holding a log tree strucutre in memory which will be written to disk asynchronously (compaction)</li>
<li>uses Bloom Filters =&gt; helps to avoid disk seeks by running every key through bloom filter to determine in which file the k/v is in</li>
<li>Dynamic Memeory Adjustment based on Workload</li>
<li>Hypertable vs. HBase</li>
<li>70% faster than hBase (seq. write / seq. read)</li>
<li>one of the reasons: Dynamic Memory Adjustment</li>
<li>You can run Map/Reduce (Hadoop) and it is Data Locality Aware</li>
<li>Query types: timestamp ranges, versions of the cell possible, but mainly primary key access</li>
<li>No delete operation currenlty  (but each column family has a TTL)</li>
</ul>
<h2 id="hdfsdeepdive">HDFS Deep Dive</h2>
<ul>
<li>http://berlinbuzzwords.de/content/hdfs-deep-dive</li>
<li>one name node, multiple data nodes</li>
<li>use 0.20.2-append branch</li>
<li>NameNode SPOF in theory, but not in practise</li>
</ul>
<h2 id="cassandratalk-ericevans">Cassandra Talk &#8211; Eric Evans</h2>
<ul>
<li>http://www.slideshare.net/jericevans/cassandra-explained</li>
<li>Vectorclocks =&gt; http://en.wikipedia.org/wiki/Vector_clock</li>
</ul>
<h2 id="massivlyparallelanalyticsbeyondmapreduce">Massivly Parallel Analytics beyond Map/Reduce</h2>
<ul>
<li>Context: StratoSphere Project</li>
</ul>
<h2 id="colaborativefilteringmahout-frankscholten">Colaborative Filtering Mahout &#8211; Frank Scholten</h2>
<ul>
<li>is a machine learning lib for java</li>
<li>run on hadoop</li>
<li>Similarity Algorithms</li>
<li>TanimotoCoefficintSimilarity</li>
<li>LoglikelihoodSimilarity</li>
</ul>
<h2 id="sqoopdatabaseimportexportforhadoop">Sqoop Database import/export for hadoop</h2>
<ul>
<li>wish every speaker would have had logically structured their talks as Aaron Kimball did with his Hadoop talks</li>
</ul>
<h2 id="hive">Hive</h2>
<ul>
<li>parser/optimizer/compiler that translates HiveQL into MapReduce code</li>
<li>metastore that stores “schema” information (e.g. table name, column names, data types)</li>
<li>schema on read, not write</li>
<li>unbedingt anschauen!!!</li>
<li>WHERE =&gt; map</li>
<li>GROUP BY/ORDER BY =&gt; reduce</li>
<li>JOIN =&gt; map or reduce depending on optimizer</li>
<li>there is an HiveQL EXPLAIN  command</li>
<li>python lernen</li>
</ul>

<p><a href="http://feedads.g.doubleclick.net/~a/NykAqLmZdW63lRNZzHrsTKoAjNA/0/da"><img src="http://feedads.g.doubleclick.net/~a/NykAqLmZdW63lRNZzHrsTKoAjNA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/NykAqLmZdW63lRNZzHrsTKoAjNA/1/da"><img src="http://feedads.g.doubleclick.net/~a/NykAqLmZdW63lRNZzHrsTKoAjNA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/zuBb0A0EQYY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/06/30/my-notes-taken-at-berlin-buzzwords.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/06/30/my-notes-taken-at-berlin-buzzwords.html</feedburner:origLink></item>
		<item>
		<title>Gefüllte Paprikaschoten und geiler Wein</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/ayLEiLf6mUU/gefuellte-paprikaschoten-und-geiler-wein.html</link>
		<comments>http://blog.keksrolle.de/2010/05/31/gefuellte-paprikaschoten-und-geiler-wein.html#comments</comments>
		<pubDate>Mon, 31 May 2010 06:15:56 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Kochen]]></category>
		<category><![CDATA[Rezepte]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=461</guid>
		<description><![CDATA[Am Wochenende stand ein unter Freunden lang erwartetes Kochevent ins Haus, was gleich mal Anlass fuer eine neue Kategorie auf der Keksrolle ist.
Nach einigen Ueberlegungen fiel die Wahl auf folgendes Rezept: &#8220;Gefüllte Paprika nach Uroma Susanne&#8221;.  Das ganze ist vor allem zu empfehlen, da man eben die Paprikaschoten sehr exakt portionieren kann. Eine grosse Paprikaschote [...]]]></description>
			<content:encoded><![CDATA[<p>Am Wochenende stand ein unter Freunden lang erwartetes Kochevent ins Haus, was gleich mal Anlass fuer eine neue Kategorie auf der Keksrolle ist.</p>
<p>Nach einigen Ueberlegungen fiel die Wahl auf folgendes <a title="Gefüllte Paprika nach Uroma Susanne" href="-Uroma-Susanne.html?PHPSESSID=79938d8f246b4b0944bf0d808d25f15a" target="_blank">Rezept</a>: <strong>&#8220;Gefüllte Paprika nach Uroma Susanne&#8221;. </strong> Das ganze ist vor allem zu empfehlen, da man eben die Paprikaschoten sehr exakt portionieren kann. Eine grosse Paprikaschote pro Person reicht absolut aus. Dazu noch etwas Wildreis gekocht und fertig war die Mahlzeit fuer 8 Personen.</p>
<p><a href="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6685.jpg" onclick="pageTracker._trackPageview('/outgoing/blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6685.jpg?referer=');"><img class="aligncenter size-medium wp-image-462" title="Gefüllte Paprika nach Uroma Susanne" src="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6685-273x300.jpg" alt="" width="273" height="300" /></a></p>
<p>Als Vorspeise gab es <a href="http://www.chefkoch.de/rezepte/136251058877746/Tortilla-Schnecken.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.chefkoch.de/rezepte/136251058877746/Tortilla-Schnecken.html?referer=');">&#8220;Tortilla Schnecken&#8221;</a>, welche aber nicht von mir zubereitet wurden und wir auch leicht abgewandelt haben.</p>
<p><a href="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6702.jpg" onclick="pageTracker._trackPageview('/outgoing/blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6702.jpg?referer=');"><img class="aligncenter size-medium wp-image-464" title="IMG_6702" src="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6702-300x200.jpg" alt="" width="300" height="200" /></a><br />
Und ein Dessert darf natürlich auch nicht fehlen. Es gab handgemachte Erdbeer- und Heidelbeertörtchen.</p>
<p><a href="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6701.jpg" onclick="pageTracker._trackPageview('/outgoing/blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6701.jpg?referer=');"><img class="aligncenter size-medium wp-image-465" title="IMG_6701" src="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6701-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p>Abgerundet wurde unsere Feierlichkeit von diversen Flaschen &#8220;geilem&#8221; Wein, vom <a title="Weingut Geil Eimsheim" href="http://weingutgeil.de" target="_blank" onclick="pageTracker._trackPageview('/outgoing/weingutgeil.de?referer=');">Weingut Geil</a>, von denen ich mir neulich eine Kiste des 2009er Jahrgangs bestellt hatte. Wir hatten zwar noch viele weitere Weine im Haus, allerdings wollten wir nach der ersten Flasche <a title="Grauburgunder - Weingut Geil Eimsheim" href="http://www.weingutgeil-shop.de/products/8-Grauburgunder-QbA-trocken" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.weingutgeil-shop.de/products/8-Grauburgunder-QbA-trocken?referer=');">Grauburgunder</a> sowie einer Flasche <a title="Spaetburgunder - Weingut Geil Eimsheim" href="http://www.weingutgeil-shop.de/categories/6-Wei-herbst" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.weingutgeil-shop.de/categories/6-Wei-herbst?referer=');">Spätburgunder Rosé </a>nicht mehr wechseln. Es folgten darauf noch ein <a title="Gewürztraminer" href="http://www.weingutgeil-shop.de/products/20-Gew-rztraminer-Kabinett-M-Michelsberg" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.weingutgeil-shop.de/products/20-Gew-rztraminer-Kabinett-M-Michelsberg?referer=');">Gewürztraminer</a> sowie ein <a title="Riesling Selection - Weingut Geil Eimsheim" href="http://www.weingutgeil-shop.de/products/14-Selection-Schlo-berg-Riesing-QbA-trocken" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.weingutgeil-shop.de/products/14-Selection-Schlo-berg-Riesing-QbA-trocken?referer=');">Riesling</a> aus der Selection Reihe.</p>
<p style="text-align: center;"><a title="Weingut Geil Eimsheim" href="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6722.jpg" target="_blank" onclick="pageTracker._trackPageview('/outgoing/blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6722.jpg?referer=');"><img class="aligncenter size-medium wp-image-463" title="Weingut Geil Eimsheim - Grauburgunder, Spaetburgunder, Silvaner, Gewuerztraminer, Riesling trocken" src="http://blog.keksrolle.de/wp-content/uploads/2010/05/IMG_6722.jpg" alt="Weingut Geil Eimsheim - Grauburgunder, Spaetburgunder, Silvaner, Gewuerztraminer, Riesling trocken" width="600" /></a></p>
<p>Fazit: Ein toller Abend mit Freunden, leckerem Essen, viel Wein und spielen <img src='http://blog.keksrolle.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong> </strong></p>
<p><strong><br />
</strong></p>

<p><a href="http://feedads.g.doubleclick.net/~a/RieqpaPYtr8bUqW4570Yi0MQde0/0/da"><img src="http://feedads.g.doubleclick.net/~a/RieqpaPYtr8bUqW4570Yi0MQde0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/RieqpaPYtr8bUqW4570Yi0MQde0/1/da"><img src="http://feedads.g.doubleclick.net/~a/RieqpaPYtr8bUqW4570Yi0MQde0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/ayLEiLf6mUU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/05/31/gefuellte-paprikaschoten-und-geiler-wein.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/05/31/gefuellte-paprikaschoten-und-geiler-wein.html</feedburner:origLink></item>
		<item>
		<title>I’m going to Berlin Buzzwords</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/3_D_kgac-uE/im-going-to-berlin-buzzwords.html</link>
		<comments>http://blog.keksrolle.de/2010/05/21/im-going-to-berlin-buzzwords.html#comments</comments>
		<pubDate>Fri, 21 May 2010 13:09:10 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=457</guid>
		<description><![CDATA[On June 7th and 8th, I am going to Berlin to attend the Berlin Buzzwords conference.
This is what they write about themselves:
Berlin Buzzwords 2010 is a conference for developers and users of open source software projects, focussing on the issues of scalable search, data-analysis in the cloud and NoSQL-databases. Berlin Buzzwords presents more than 30 [...]]]></description>
			<content:encoded><![CDATA[<p>On June 7th and 8th, I am going to Berlin to attend the Berlin Buzzwords conference.</p>
<p>This is what they write about themselves:</p>
<blockquote><p><strong>Berlin Buzzwords 2010</strong> is a conference for developers and users of open source software projects, focussing on the issues of scalable search, data-analysis in the cloud and NoSQL-databases. Berlin Buzzwords presents more than 30 talks and presentations of international speakers specific to the three tags &#8220;search&#8221;, &#8220;store&#8221; and &#8220;scale&#8221;.</p>
</blockquote>
<p><a href="http://berlinbuzzwords.de" onclick="pageTracker._trackPageview('/outgoing/berlinbuzzwords.de?referer=');"><img src="http://berlinbuzzwords.de/sites/berlinbuzzwords.de/files/buzzwords_banner.jpg" alt="I'm going to Berlin Buzzwords - the conference on searching, processing and storing data." /></a></p>
<p><img class="alignnone" title="Berlin Buzz" src="http://berlinbuzzwords.de/sites/berlinbuzzwords.de/files/buzzwords_small.jpg" alt="" width="600" height="111" /></p>

<p><a href="http://feedads.g.doubleclick.net/~a/Ix0pYMPFDN6pHxFM8hPQE6ofMkE/0/da"><img src="http://feedads.g.doubleclick.net/~a/Ix0pYMPFDN6pHxFM8hPQE6ofMkE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Ix0pYMPFDN6pHxFM8hPQE6ofMkE/1/da"><img src="http://feedads.g.doubleclick.net/~a/Ix0pYMPFDN6pHxFM8hPQE6ofMkE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/3_D_kgac-uE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/05/21/im-going-to-berlin-buzzwords.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/05/21/im-going-to-berlin-buzzwords.html</feedburner:origLink></item>
		<item>
		<title>“real time” still hasn’t made it into corporate IT</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/hlYoqM0nI2M/real-time-still-hasnt-made-it-into-corporate-it.html</link>
		<comments>http://blog.keksrolle.de/2010/05/10/real-time-still-hasnt-made-it-into-corporate-it.html#comments</comments>
		<pubDate>Mon, 10 May 2010 13:58:15 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[corporate]]></category>
		<category><![CDATA[it]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=455</guid>
		<description><![CDATA[today, when I requested a password reset for my account (I forgot the password)
oh you want this to work immediately ???&#8230;:) sorry [name removed] you have to wait 45 min for the account to propogate through the network&#8230;.not my fault there&#8230;.just the way things work here at [name removed] &#8230;:)
and sorry I can&#8217;t make it [...]]]></description>
			<content:encoded><![CDATA[<p>today, when I requested a password reset for my account (I forgot the password)</p>
<blockquote><p>oh you want this to work immediately ???&#8230;:) sorry [name removed] you have to wait 45 min for the account to propogate through the network&#8230;.not my fault there&#8230;.just the way things work here at [name removed] &#8230;:)<br />
and sorry I can&#8217;t make it work any faster just the way the network is setup</p></blockquote>
<p>this proves that &#8220;real time&#8221; still hasn&#8217;t made it into corporate IT&#8230;.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/dDeyaKpYodQdKbzjJnlSZ8HUSFI/0/da"><img src="http://feedads.g.doubleclick.net/~a/dDeyaKpYodQdKbzjJnlSZ8HUSFI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dDeyaKpYodQdKbzjJnlSZ8HUSFI/1/da"><img src="http://feedads.g.doubleclick.net/~a/dDeyaKpYodQdKbzjJnlSZ8HUSFI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/hlYoqM0nI2M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/05/10/real-time-still-hasnt-made-it-into-corporate-it.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/05/10/real-time-still-hasnt-made-it-into-corporate-it.html</feedburner:origLink></item>
		<item>
		<title>Eclipse PDE Build: Unable to find plugin XYZ</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/BrjmmWjOkSA/eclipse-pde-build-unable-to-find-plugin-xyz.html</link>
		<comments>http://blog.keksrolle.de/2010/04/22/eclipse-pde-build-unable-to-find-plugin-xyz.html#comments</comments>
		<pubDate>Thu, 22 Apr 2010 05:21:03 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[pde]]></category>
		<category><![CDATA[pde-build]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=447</guid>
		<description><![CDATA[Today I had the problem that suddenly my headless Eclipse PDE Build process wasn&#8217;t working anymore as soon as I added a new Bundle project to my feature.xml.
[java] /Applications/eclipse_3.5RC3/plugins/org.eclipse.pde.build_3.5.0.v20090527-1800/scripts/genericTargets.xml:106: Unable to find plug-in: bundlexyz
I first thought there is something wrong with the plugins MANIFEST.MF, but everything was ok.
It turned out that the new project I [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had the problem that suddenly my headless Eclipse PDE Build process wasn&#8217;t working anymore as soon as I added a new Bundle project to my feature.xml.</p>
<blockquote><p>[java] /Applications/eclipse_3.5RC3/plugins/org.eclipse.pde.build_3.5.0.v20090527-1800/scripts/genericTargets.xml:106: Unable to find plug-in: bundlexyz</p></blockquote>
<p>I first thought there is something wrong with the plugins MANIFEST.MF, but everything was ok.<br />
It turned out that the new project I have created was in the wrong folder.</p>
<p>All my other bundle projects are inside a folder locally under <em>/development/repo/myproject/plugins/bundle123 <span style="font-style: normal;">there is also my main ant build.xml. </span><br />
<span style="font-style: normal;">and my Eclipse is under </span>/development/workspace/<span style="font-style: normal;"> and </span> </em>links to the <em>repo</em> folder.<br />
Now, when I had created my new bundle project (which PDE Build complains about now) by accident I had forgotton to change the the <em>location. </em>I should have unchecked the checkbox <em>&#8220;Use default location&#8221; </em>put the new plugin into <em>/development/repo/myproject/plugins/bundle</em>xyz instead of under my workspace folder.</p>
<p><strong>Solution:<br />
<span style="font-weight: normal;">1. Right click on your project and choose &#8220;Refactor &gt; Move&#8221;<br />
2. Choose the folder <em> /development/repo/myproject/plugins/bundle</em></span></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em><span style="font-style: normal;">After that change PDE Build stoppped complaining. </span> </em></strong></p>
<p><em> </em> <em>Remember</em>: When using headless PDE Build, you have to put new plugins into the same location as all your other plugins. In Eclipse UI it will work, but in headless mode on the command line it will not work.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/bVfVKkHCIDPIVJ1KwaPGZoB9fE4/0/da"><img src="http://feedads.g.doubleclick.net/~a/bVfVKkHCIDPIVJ1KwaPGZoB9fE4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/bVfVKkHCIDPIVJ1KwaPGZoB9fE4/1/da"><img src="http://feedads.g.doubleclick.net/~a/bVfVKkHCIDPIVJ1KwaPGZoB9fE4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/BrjmmWjOkSA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/04/22/eclipse-pde-build-unable-to-find-plugin-xyz.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/04/22/eclipse-pde-build-unable-to-find-plugin-xyz.html</feedburner:origLink></item>
		<item>
		<title>“Ask the shortest question you can”</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/CQe_pzJ3gGM/ask-the-shortest-question-you-can.html</link>
		<comments>http://blog.keksrolle.de/2010/04/21/ask-the-shortest-question-you-can.html#comments</comments>
		<pubDate>Wed, 21 Apr 2010 17:18:16 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[teaching]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=444</guid>
		<description><![CDATA[I found a really nice video by Dan Meyer who gives a presentation basically about what is wrong with the usual way we get taught math in school these days. And better than that he also gives advices on how to do it better.
Here are the 5 most important bullet points to me from his [...]]]></description>
			<content:encoded><![CDATA[<p>I found a really nice <a href="http://blog.mrmeyer.com/?p=6548" target="_blank" onclick="pageTracker._trackPageview('/outgoing/blog.mrmeyer.com/?p=6548&amp;referer=');">video by Dan Meyer</a> who gives a presentation basically about what is wrong with the usual way we get taught math in school these days. And better than that he also gives advices on how to do it better.</p>
<p>Here are the 5 most important bullet points to me from his video:</p>
<ol>
<li>Use Multimedia</li>
<li>Encourage Students intuition</li>
<li>Ask the shortest question you can</li>
<li>Let students build the problem</li>
<li>Be less helpful.</li>
</ol>
<p>To me this is the &#8220;less is more&#8221; philosophy applied to teaching in general.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/JAg_qoUP7u06F94AaANg2SLazlc/0/da"><img src="http://feedads.g.doubleclick.net/~a/JAg_qoUP7u06F94AaANg2SLazlc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/JAg_qoUP7u06F94AaANg2SLazlc/1/da"><img src="http://feedads.g.doubleclick.net/~a/JAg_qoUP7u06F94AaANg2SLazlc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/CQe_pzJ3gGM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/04/21/ask-the-shortest-question-you-can.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/04/21/ask-the-shortest-question-you-can.html</feedburner:origLink></item>
		<item>
		<title>Rails-like configuration of different environments in JAVA – YAML instead of properties file</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/TgDjaQ5Tb5M/rails-like-configuration-of-different-environments-in-java-yaml-instead-of-properties-file.html</link>
		<comments>http://blog.keksrolle.de/2010/04/21/rails-like-configuration-of-different-environments-in-java-yaml-instead-of-properties-file.html#comments</comments>
		<pubDate>Wed, 21 Apr 2010 15:34:40 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[properties]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=434</guid>
		<description><![CDATA[This article shows a simple code example how you can replace a standard JAVA properties file (.ini) with a more flexible .yml (YAML) file using the JYAML library.
I used this to store configuration parameters for an application for different environments (e.g. development vs. production) in one central file. This is how the RubyOnRails guys are [...]]]></description>
			<content:encoded><![CDATA[<p>This article shows a simple code example how you can replace a standard JAVA properties file (.ini) with a more flexible .yml (YAML) file using the <a href="http://jyaml.sourceforge.net/tutorial.html" onclick="pageTracker._trackPageview('/outgoing/jyaml.sourceforge.net/tutorial.html?referer=');">JYAML library</a>.<br />
I used this to store configuration parameters for an application for different environments (e.g. development vs. production) in one central file. This is how the RubyOnRails guys are doing this e.g. in the <a href="http://dev.rubyonrails.org/browser/tools/cia/trunk/config/database.yml" onclick="pageTracker._trackPageview('/outgoing/dev.rubyonrails.org/browser/tools/cia/trunk/config/database.yml?referer=');">database.yml</a>.</p>
<p>1. See how the usual standard config files look like.</p>
<pre># config.ini file
# Database
dbconnectionurl=jdbc:mysql://localhost:3306/mydb
dbuser=dbuser
dbpass=dbpasswd</pre>
<p>As you see it just has key/value pairs. There is also no notion of an &#8220;environement&#8221; which means I could use a separate file to store information for different environments. But I want everything centralized.</p>
<p>And here the new yaml file:</p>
<pre># config.yml
development:
    # Database
    dbconnectionurl: jdbc:mysql://localhost:3306/mydevelopmentdb
    dbuser: dbuserdevelopment
    dbpass: dbpasswddevelopment

production:
    # Database
    dbconnectionurl: jdbc:mysql://localhost:3306/myproductiondb
    dbuser: dbuserproduction
    dbpass: dbpasswdproduction</pre>
<p>As you can see the config.yml contains two sections. The first section is the configuration for the development environment, which is the default per my convention. The second section contains the configuration for the production environment.</p>
<p>2. Now here is the JAVA code which first loads the config.ini file using the standard approach and second loads the config.yml using the JYAML library and puts them into properties as well. Using that approach we almost don&#8217;t have to change any application code, because our application still uses a Java Properties object.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #006600; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">/***
		 * 1. Load Properties using traditional approach
		 * from config.ini
		 */</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399; font-weight: bold;">Properties</span> props = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Properties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			props.<span style="color: #006633;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">FileReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;config.ini&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399; font-weight: bold;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>props.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">FileNotFoundException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">/***
		 * 2. Try to do the same based on
		 */</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399; font-weight: bold;">Properties</span> props = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Properties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #003399; font-weight: bold;">HashMap</span> yamlConfig = <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">HashMap</span><span style="color: #009900;">&#41;</span> Yaml.<span style="color: #006633;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;config.yml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// now check which environment to load (production or development)</span>
			<span style="color: #666666; font-style: italic;">// development is default</span>
			<span style="color: #003399; font-weight: bold;">String</span> environment = <span style="color: #003399; font-weight: bold;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MYENVIRONMENT&quot;</span>,<span style="color: #0000ff;">&quot;development&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399; font-weight: bold;">HashMap</span> propertiesFromYamlForEnvironment = yamlConfig.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>environment<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			props.<span style="color: #006633;">putAll</span><span style="color: #009900;">&#40;</span>propertiesFromYamlForEnvironment<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399; font-weight: bold;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>props.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">FileNotFoundException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As you can see the line<br />
<code>String environment = System.getProperty("MYENVIRONMENT","development");</code><br />
is responsible to read the environment from a system property. you can set this by setting the usual -DMYENVIRONMENT=&#8221;production&#8221; when you start you java program.</p>
<p>That&#8217;s it. Pretty simple but powerful.<br />
You can read more about JYAML in their <a href="http://jyaml.sourceforge.net/tutorial.html" onclick="pageTracker._trackPageview('/outgoing/jyaml.sourceforge.net/tutorial.html?referer=');">tutorial</a>.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/SKgu9e_OLKrsFVb26dXjw5IpxhY/0/da"><img src="http://feedads.g.doubleclick.net/~a/SKgu9e_OLKrsFVb26dXjw5IpxhY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/SKgu9e_OLKrsFVb26dXjw5IpxhY/1/da"><img src="http://feedads.g.doubleclick.net/~a/SKgu9e_OLKrsFVb26dXjw5IpxhY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/TgDjaQ5Tb5M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/04/21/rails-like-configuration-of-different-environments-in-java-yaml-instead-of-properties-file.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/04/21/rails-like-configuration-of-different-environments-in-java-yaml-instead-of-properties-file.html</feedburner:origLink></item>
		<item>
		<title>Initializing Hibernate without XML</title>
		<link>http://feedproxy.google.com/~r/Keksrolle/~3/1zl4d1QHmFQ/initializing-hibernate-without-xml.html</link>
		<comments>http://blog.keksrolle.de/2010/04/13/initializing-hibernate-without-xml.html#comments</comments>
		<pubDate>Tue, 13 Apr 2010 13:48:17 +0000</pubDate>
		<dc:creator>Christoph</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.keksrolle.de/?p=412</guid>
		<description><![CDATA[This article just shows a code snippet I have used for initializing Hibernate in pure JAVA code without the hibernate.xml which you would normally use.

public void start&#40;BundleContext context&#41; throws Exception &#123;
      initHibernate&#40;context&#41;;
&#125;
&#160;
private void initHibernate&#40;BundleContext context&#41; &#123;
	try &#123;
		final AnnotationConfiguration cfg = new AnnotationConfiguration&#40;&#41;;
		cfg.setProperty&#40;&#34;hibernate.dialect&#34;, &#34;org.hibernate.dialect.MySQLDialect&#34;&#41;;
    cfg.setProperty&#40;&#34;hibernate.connection.driver_class&#34;, &#34;com.mysql.jdbc.Driver&#34;&#41;;
   [...]]]></description>
			<content:encoded><![CDATA[<p>This article just shows a code snippet I have used for initializing Hibernate in pure JAVA code without the hibernate.xml which you would normally use.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #006600; font-weight: bold;">void</span> start<span style="color: #009900;">&#40;</span>BundleContext context<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399; font-weight: bold;">Exception</span> <span style="color: #009900;">&#123;</span>
      initHibernate<span style="color: #009900;">&#40;</span>context<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #006600; font-weight: bold;">void</span> initHibernate<span style="color: #009900;">&#40;</span>BundleContext context<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">final</span> AnnotationConfiguration cfg = <span style="color: #000000; font-weight: bold;">new</span> AnnotationConfiguration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.dialect&quot;</span>, <span style="color: #0000ff;">&quot;org.hibernate.dialect.MySQLDialect&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.connection.driver_class&quot;</span>, <span style="color: #0000ff;">&quot;com.mysql.jdbc.Driver&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.connection.url&quot;</span>, applicationRegistry.<span style="color: #006633;">getAppProperties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getDbConnectionUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// e.g. &quot;jdbc:mysql://localhost:3306/mydatabase&quot;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.connection.username&quot;</span>, applicationRegistry.<span style="color: #006633;">getAppProperties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getDbUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.connection.password&quot;</span>, applicationRegistry.<span style="color: #006633;">getAppProperties</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getDbPassword</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.connection.pool_size&quot;</span>, <span style="color: #0000ff;">&quot;5&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.connection.autocommit&quot;</span>, <span style="color: #0000ff;">&quot;false&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.cache.provider_class&quot;</span>, <span style="color: #0000ff;">&quot;org.hibernate.cache.NoCacheProvider&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">//cfg.setProperty(&quot;hibernate.hbm2ddl.auto&quot;, &quot;create-drop&quot;);</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.show_sql&quot;</span>, <span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.format_sql&quot;</span>,<span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.use_sql_comments&quot;</span>,<span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.transaction.factory_class&quot;</span>, <span style="color: #0000ff;">&quot;org.hibernate.transaction.JDBCTransactionFactory&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.current_session_context_class&quot;</span>, <span style="color: #0000ff;">&quot;thread&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;org.hibernate.flushMode&quot;</span>, <span style="color: #0000ff;">&quot;COMMIT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hibernate.generate_statistics&quot;</span>, <span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Hibernate entities</span>
    cfg.<span style="color: #006633;">addAnnotatedClass</span><span style="color: #009900;">&#40;</span>com.<span style="color: #006633;">myproject</span>.<span style="color: #006633;">model</span>.<span style="color: #006633;">entities</span>.<span style="color: #006633;">Project</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    cfg.<span style="color: #006633;">addAnnotatedClass</span><span style="color: #009900;">&#40;</span>com.<span style="color: #006633;">myproject</span>.<span style="color: #006633;">model</span>.<span style="color: #006633;">entities</span>.<span style="color: #006633;">Customer</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// ... and so on...</span>
&nbsp;
		sessionFactory = cfg.<span style="color: #006633;">buildSessionFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		org.<span style="color: #006633;">springframework</span>.<span style="color: #006633;">orm</span>.<span style="color: #006633;">hibernate3</span>.<span style="color: #006633;">HibernateTransactionManager</span> transactionManager = <span style="color: #000000; font-weight: bold;">new</span> HibernateTransactionManager<span style="color: #009900;">&#40;</span>sessionFactory<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		applicationRegistry.<span style="color: #006633;">setTransactionHelper</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TransactionHelper<span style="color: #009900;">&#40;</span>transactionManager<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		LOGGER.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error&quot;</span>, e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That&#8217;s it. I am using this code with Hibernate 3 using Annotations and so far it does what I want and it is not more ugly than the hibernate.xml (although that is in the eye of the observer <img src='http://blog.keksrolle.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>

<p><a href="http://feedads.g.doubleclick.net/~a/xKT8RDdWgjnDt9__67pXdg_A8ZU/0/da"><img src="http://feedads.g.doubleclick.net/~a/xKT8RDdWgjnDt9__67pXdg_A8ZU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/xKT8RDdWgjnDt9__67pXdg_A8ZU/1/da"><img src="http://feedads.g.doubleclick.net/~a/xKT8RDdWgjnDt9__67pXdg_A8ZU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Keksrolle/~4/1zl4d1QHmFQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.keksrolle.de/2010/04/13/initializing-hibernate-without-xml.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.keksrolle.de/2010/04/13/initializing-hibernate-without-xml.html</feedburner:origLink></item>
	</channel>
</rss>
