directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oer...@apache.org
Subject svn commit: r526990 [2/2] - in /directory/sandbox/oersoy/guides/das.ldap.design.documentation: ./ META-INF/ source/ source/concepts/ source/concepts/0/ src/ src/main/ src/main/resources/ src/main/resources/css/ src/main/resources/images/ target/ target...
Date Tue, 10 Apr 2007 01:36:00 GMT
Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe20.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe20.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe20.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe20.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,63 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating Metadata OID Values</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating Metadata OID Values</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use the model package namespace.</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+    			TODO - Alex's checksum idea
+    			<br/>
+    			<br/>
+    			
+    			TODO - Add Emmanuel's Ascii charachter idea.
+    			<br/>
+    			<br/>
+    			The DAS will come with ApacheDS's PEN as the default
+    			PEN for creating new OID values.  Users will
+    			be able to change this value to their own PEN.
+    			Branch OIDs for LDAP Metadata categories (ObjectClasses,
+    			AttributeTypes, Syntaxes, etc.) will be automatically
+    			generated, if they have not been initialized by users.
+    			<br/>
+    			<br/>
+    			When enterprises wish to share LDAP metadata they
+    			must either configure the DAS with their own PEN
+    			or use their internet domain to qualify their 
+    			package namespace.  
+    			<br/>
+    			<br/>
+    			When users choose to use their internet
+    			domain namespace the DAS will either generate a checksum
+    			of it and add it to the
+    			corresponding OID branch or turn each character
+    			in the namespace into an ascii value.
+    			<br/>
+    			<br/>
+    			ApacheDS uses a trigger to create new OID values, which
+    			results in better performance and smaller OID values.
+  				
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe21.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe21.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe21.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe21.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,75 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating an LDAP Syntax Entry</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating an LDAP Syntax Entry</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use JNDI</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+  				The <i>name</i> attribute of an LDAP
+  				Syntax entry corresponds
+  				to the <i>instanceClass</i> member of the SDO Type interface and
+  				EMF EDataType interface.
+  				<br/>
+  				<br/>
+  				The <i>description</i> attribute of an LDAP Syntax
+  				entry corresponds to the <i>name</i> member the SDO Type or 
+  				EMF EDataType interface.
+  				<br/>
+  				<br/>
+				A syntax entry also requires an OID. 
+  				A Private Enterprise Number (PEN), which can be
+  				obtained from IANA, is used to create such an ID.  
+  				The PEN is prefixed to a branch integer for Syntax entries,
+  				and combined with yet another integer forming a unique id
+  				for the Syntax entry.
+  				<br/>
+  				<br/>
+  				The following example shows how to define a 
+  				syntax entry for "java.lang.String" in ApacheDS:
+  				<br/>
+  				<br/>
+	            <pre class="codeblock">
+Attributes ldapAttributes = new AttributesImpl();
+Attribute objectClass = new AttributeImpl(
+	SystemSchemaConstants.OBJECT_CLASS_AT, 
+	"top" );
+objectClass.add( MetaSchemaConstants.META_TOP_OC );
+objectClass.add( MetaSchemaConstants.META_SYNTAX_OC );
+ldapAttributes.put( objectClass );
+ldapAttributes.put( MetaSchemaConstants.M_OID_AT, SOME_GLOBAL_OID );
+ldapAttributes.put( MetaSchemaConstants.M_NAME_AT,  "java.lang.String");
+ldapAttributes.put( MetaSchemaConstants.M_DESCRIPTION_AT, "EString" );
+
+String EStringSyntaxRDN = "MetaSchemaConstants.M_OID_AT + "=" + SOME_GLOBAL_OID;
+			    
+//With the current context being "ou=syntaxes,ou=schema"
+ctx.createSubcontext(EStringSyntaxRDN, ldapAttributes);
+	            </pre>
+    	        <br/>
+        	    <br/>
+    			
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe22.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe22.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe22.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe22.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,65 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating an LDAP AttributeType Metadata Entry</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating an LDAP AttributeType Metadata Entry</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use JNDI</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+    			An LDAP AttributeType entry corresponds to a named and typed 
+    			property of an SDO Type or EMF EClass.  It is equivalent
+    			to an EMF EAttribute instance that has its name and 
+    			eType properties set.
+    			<br/>
+  				<br/>
+  				Here's an example of how to create LDAP AttributeType
+  				for the baseDN member of org.tuscany.das.ldap.config.DASConfig:
+  				<br/>
+  				<br/>
+	            <pre class="codeblock">
+ Attributes ldapAttributes = new AttributesImpl();
+ Attribute objectClass = new AttributeImpl(
+	SystemSchemaConstants.OBJECT_CLASS_AT, 
+	"top" );
+ objectClass.add( MetaSchemaConstants.META_TOP_OC );
+ objectClass.add( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC );
+ ldapAttributes.put( objectClass );
+ ldapAttributes.put( MetaSchemaConstants.M_NAME_AT, "org.tuscany.das.ldap.config.DASConfig.baseDN");
+ ldapAttributes.put( MetaSchemaConstants.M_OID_AT, SOME_GLOBAL_OID );//A trigger in ApacheDS will add this.
+ ldapAttributes.put( MetaSchemaConstants.M_DESCRIPTION_AT, "baseDN" );
+ ldapAttributes.put( MetaSchemaConstants.M_EQUALITY_AT, "caseIgnoreMatch" );
+ ldapAttributes.put( MetaSchemaConstants.M_SINGLE_VALUE_AT, "FALSE" );
+ ldapAttributes.put( MetaSchemaConstants.M_USAGE_AT, "directoryOperation" );
+
+ String EStringSyntaxRDN = "MetaSchemaConstants.M_OID_AT + "=" + SOME_GLOBAL_OID;
+			    
+ //With the current context being "ou=attributeTypes,ou=schema"
+ ctx.createSubcontext(EStringSyntaxRDN, ldapAttributes);
+	            </pre>
+    	        <br/>
+        	    <br/>
+    			
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe23.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe23.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe23.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe23.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,185 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating an LDAP Metadata ObjectClass Entry</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating an LDAP Metadata ObjectClass Entry</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use JNDI</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+    			An LDAP ObjectClass entry corresponds 
+    			to an SDO Type or EMF EClass instance.
+    			<br/>
+  				<br/>
+  				Here's an example of how to create an LDAP ObjectClass
+  				for the org.tuscany.das.ldap.config.DASConfig EClass, which
+  				assumes two simple properties called <i>baseDN</i> and 
+  				<i>optionalOPP</i>:
+	            <pre class="codeblock">
+Attributes ldapAttributes = new AttributesImpl();
+Attribute objectClass = new AttributeImpl(
+	SystemSchemaConstants.OBJECT_CLASS_AT, 
+	"top" );
+objectClass.add( MetaSchemaConstants.META_TOP_OC );
+objectClass.add( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC );
+ldapAttributes.put( objectClass );
+ldapAttributes.put( MetaSchemaConstants.M_NAME_AT, "org.tuscany.das.ldap.config.DASConfig");
+ldapAttributes.put( MetaSchemaConstants.M_DESCRIPTION_AT, "DASConfig");
+ldapAttributes.put( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT, "STRUCTURAL" );
+ldapAttributes.put( MetaSchemaConstants.M_MUST_AT, "baseDN" );
+ldapAttributes.put( MetaSchemaConstants.M_MAY_AT, "optionalOPP" );
+
+String EStringSyntaxRDN = "MetaSchemaConstants.M_OID_AT + "=" + SOME_GLOBAL_OID;
+			    
+//With the current context being "ou=attributeTypes,ou=schema"
+ctx.createSubcontext(EStringSyntaxRDN, ldapAttributes);
+	            </pre>
+    	        <br/>
+        	    That was just a simple example to illustrate the process.
+        	    We need to perform a few more steps in order to have
+        	    a valid process.
+        	    <br/>
+        	    <br/>
+	            First we create a new ObjectClass and give it the name of the EClassifier
+	            instance and add it to a new instance of LDAP attributes.
+	            <pre class="codeblock">
+  Attributes ldapAttributes = new AttributesImpl();
+  Attribute objectClass = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, eClass.getName() );
+  objectClass.add( MetaSchemaConstants.META_TOP_OC );
+  objectClass.add( MetaSchemaConstants.META_OBJECT_CLASS_OC );
+  ldapAttributes.put( objectClass ); 
+	            </pre>
+	            <br/>
+
+            Then we need to add the EAttributes of the EClass to the LDAP attributes list.
+
+            <pre class="codeblock">
+  EList eAttributes = eClass.getEAllAttributes();
+  Iterator<EAttribute> eAttributeIterator = eAttributes.iterator();
+  while(eAttributeIterator.hasNext() )
+  {
+  	EAttribute eAttribute = eAttributeIterator.next();
+  	if ( eAttribute.isRequired() )
+  	{
+   	ldapAttributes.put( MetaSchemaConstants.M_MUST_AT, eAttribute.getName() ); 
+  	}
+  	else
+  	{
+  		ldapAttributes.put( MetaSchemaConstants.M_MAY_AT, eAttribute.getName() );
+  	}
+  }
+            </pre>
+
+            <br/>
+            Note the use of M_MUST_AT and M_MAY_AT.
+            When the eAttribute.isRequired() returns
+            true M_MUST_AT is used, otherwise 
+            M_MAY_AT is used.
+            <br/>
+			<br/>
+            For each EReference on the EClass, that is 
+            not a multiplicity many EReference,
+            another ldap attribute is created
+            using the following naming convention:
+
+            <pre class="codeblock">  EReference.getName() + "EReference"</pre>
+            <br/>
+            <br/>
+            
+            Note that when writing a DataGraph instance, 
+            the attribute value for a non multiplicity many
+            EReference AttributeType stores a boolean indicating 
+            whether the reference was set or not.  The DAS
+            only attempts to retrieve the reference if 
+            the value is true.
+            
+            <br/>
+            <br/>
+            
+            If the EReference is a multiplicity many
+            reference then the naming convention used
+            is:
+            
+            <pre class="codeblock">  EReference.getName() + "EReferenceMany"</pre>
+            <br/>
+            Note that when writing a DataGraph instance, 
+            the attribute value for a multiplicity
+            many EReference AttributeType stores
+            the size of the EList containing
+            the references.
+
+            <br/>
+            <br/>
+
+            The EReference AttributeType members of the 
+            ObjectClass are set
+            by iterating through all the 
+            EReferences of the EClass and adding them like
+            this:
+            
+            <pre class="codeblock">
+  EList eReferences = eClass.getEAllReferences();
+  Iterator<EReference> eReferenceIterator = references.iterator();
+  while(eReferenceIterator.hasNext() )
+  {
+  	EReference eReference = eReferenceIterator.next();
+  	if ( eReference.isRequired() )
+  	{
+  		if ( eReference.isMany() )
+  		{
+  			ldapAttributes.put( MetaSchemaConstants.M_MUST_AT, eReference.getName() +  "EReferenceMany");
+  		}
+  		else
+  		{
+  			ldapAttributes.put( MetaSchemaConstants.M_MUST_AT, eReference.getName() +  "EReference");
+  		}
+  	}
+  	else
+  	{
+  		if ( eReference.isMany() )
+  		{
+  			ldapAttributes.put( MetaSchemaConstants.M_MAY_AT, eReference.getName() +  "EReferenceMany");
+  		}
+  		else
+  		{
+  			ldapAttributes.put( MetaSchemaConstants.M_MAY_AT, eReference.getName() +  "EReference");
+  		}
+  	}
+  }
+            </pre>
+            <br/>
+            Note that M_MUST_AT is used when eReference.isRequired returns true,
+            and M_MAY_AT is used otherwise.
+
+            <br/>
+            <br/>
+            
+            For information on where the EReference instance
+            subcontext's are written see the Related Challenges
+            section.
+            
+            TODO - Add the "Creating an EReferenceSubcontext" Recipe.
+    			
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe24.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe24.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe24.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/2/recipe24.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,66 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Writing EPackage Metadata</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Writing EPackage Metadata</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>See Related Challenges</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+				First create a subcontext for the EPackage instance.
+				For this example we'll just assume that the subcontext's
+				RDN is <i>Accounts</i>. 
+				<br/>
+				<br/>
+				See the Related Challenges section for the 
+				process of obtaining a DN for an EPackage.  TODO - Point to the 
+				"Creating a Subcontext for the Model's EPackage"
+				recipe.
+				<br/>
+				<br/>
+	
+	            <pre class="codeblock">
+ //I just made the below ctx method stuff up..
+ //will correct when coding :-) 
+ DirContext rootContext = DirContext.createContexts("cn=ePackage, cn=Accounts, cn=users, cn=example, cn=com, ou=ecore");
+	            </pre>
+	            <br/>
+				
+				The ldap attributes storing the ObjectClass for the EPackage,
+				along with the values for the EPackage's EAttributes are then added 
+				like this:
+				<pre class="codeblock">
+  Attributes ldapAttributes = new AttributesImpl();
+  ldapAttributes.put(SystemSchemaConstants.OBJECT_CLASS_NAME, ePackageEClass.getFullyQualifiedName() );
+  ldapAttributes.put("org.eclipse.emf.ecore.EPackage.nsPrefix", ePackage.getNsPrefix() );            
+  ldapAttributes.put("org.eclipse.emf.ecore.EPackage.nsURI", ePackage.getNsURI() );    
+  ldapAttributes.put("org.eclipse.emf.ecore.EPackage.name", ePackage.getName() ); 
+  //I'm making this up too
+  ctx.addAttributes(ldapAttributes);
+  				</pre>
+	            <br/>
+	            <br/>
+				
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe30.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe30.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe30.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe30.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,38 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating the Model's EPackage</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating the Model's EPackage</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use EcoreFactory.eINSTANCE.createEPackage()</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+	            <br/>
+	            <br/>
+	            <pre class="codeblock"> EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage()</pre>
+	            <br/>
+	            <br/>
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe31.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe31.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe31.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe31.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,44 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Restoring EPackage State</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Restoring EPackage State</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Restore from Configuration File</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+				Since the model instance's base DN is derived from the 
+				model root package's namespace, at the 
+				namespace must exist in the DAS's configuration file.
+				
+				<br/>
+            	<br/>
+            	The existance of an EPackage entry in the server
+            	is used to indicate to the DAS whether it needs to 
+            	write model metadata, hence the EPackage instance
+            	attribute values can also be retrieved from the
+            	server.
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe32.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe32.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe32.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe32.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,39 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Setting the EPackage Namespace Prefix</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Setting the EPackage Namespace Prefix</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Retrieve it from the DAS configuration file</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+				TODO - Also consider just creating the EPackage
+				directly from the configuration file.
+	            <pre class="codeblock"> ePackage.setNsPrefix(nsPrefix)</pre>
+	            <br/>
+				
+				TODO - Fragment path for retrieving from resource.
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe33.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe33.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe33.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe33.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,38 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Setting the EPackage Namespace</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Setting the EPackage Namespace</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Retrieve it from the DAS configuration file</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+				TODO - Also consider just creating the EPackage
+				directly from the configuration file.
+	            <pre class="codeblock"> ePackage.setNsURI(nsURI)</pre>
+	            <br/>
+				TODO - Fragment path for retrieving from resource.
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe34.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe34.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe34.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe34.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,54 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Obtaining the Name of the DataObject's EClassifier</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Obtaining the Name of the DataObject's EClassifier</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use the RDN</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+		            By convention the name of the DataObject's EClassifier corresponds
+		            to the RDN of its entry, with the exception multiplicity many EReferences
+		            which are stored using the name of the EReference's EClass postfixed with their
+		            EList index number.  So for the RDN:
+		            
+		            <pre class="codeblock"> cn=PurchaseOrder</pre>
+		            <br/>
+		            
+		            stored in the variable poRDN, we would get our 
+		            EClass or Type name like this this:
+		
+		            <pre class="codeblock"> String eClassName = JNDIUtils.getClassName( poRDN );</pre>
+		            <br/>
+		            Note that the getClassName() method will need to capitalize the 
+		            first letter if the poRDN is the RDN of the base RDN.
+
+		            If the RDN has an index number on it like this:
+		
+		            <pre class="codeblock"> cn=PurchaseOrder1</pre>
+		            <br/>
+		            the index number 1 would also need to be stripped.
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe35.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe35.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe35.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe35.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,39 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating a Named Instance of the DataObject's EClassifier</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating a Named Instance of the DataObject's EClassifier</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use EcoreFactory.eINSTANCE.createEClass()</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+		            <pre class="codeblock">
+ EClass eClass = EcoreFactory.eINSTANCE.createEClass();
+ eClass.setName(name)
+		            </pre>
+		            <br/>
+		            <br/>
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe36.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe36.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe36.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe36.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,123 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating the EClassifier's EAttributes</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating the EClassifier's EAttributes</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Retrieve them from the DataObject's ObjectClass</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+					First obtain the DN of the EClassifiers ObjectClass entry:
+					<pre class="codeblock"> String objectClassDN = "objectClass = " + rdn + ", ou=objectClasses, ou=schema";</pre>
+		            <br/>
+		        
+		            Then get a list of all the attributes contained in the DataObject's ObjectClass
+		            entry:
+
+		            <pre class="codeblock"> Attributes ldapAttributes = directoryContext.getAttributes(objectClassDN);</pre>
+		            <br/>
+		            
+		            Then clone it, because we need to create two 
+		            separate attribute lists.  One for complex type metadata (EReferences), and
+		            another for simple type metadata (EAttributes):
+
+		            <pre class="codeblock">Attributes ldapAttributesClone = ldapAttributes.clone();</pre>
+		            <br/>
+		            
+		            Then delete the objectClass attribute from the ldapAttributes map:
+		            
+		            <pre class="codeblock">ldapAttributes.remove(SystemSchemaConstants.OBJECT_CLASS_AT);</pre>
+		            <br/>
+		            <br/>
+		            
+		            Then remove all the attributes whose name contains the word EReference.
+		            
+		            <pre class="codeblock">TODO Code</pre>
+		            <br/>
+		            
+		            We now have a map whose values consist of the simple property names
+		            of each EAttribute with one exception.  These names
+		            are fully namespaced to avoid collisions when storing them
+		            in the directory server.  Therefore the namespace part of 
+		            the name, which includes the name of the EClassifier that 
+		            the EAttribute belongs to, must be removed
+		            and the resulting String used to set the name property of the
+		            corresponding EAttribute.  (TODO - Scratch the chopping part
+		            if we use the Description attribute on the Syntax entry).  In 
+		            addition the key for each name indicates whether the feature
+		            is required or not, so it is used to set the required property
+		            of the EAttribute.
+		            <br/>
+		            <br/>
+		            In order to set the EAttribute's eType member, the AttributeType Schema
+		            entry for each simple property name on the ObjectClass's attribute map is retrieved.
+		            The Description attribute contains the name of the EAttribute feature 
+		            (Since the AttributeType entry's name is fully namespaced).  This is used
+		            to check the model's EPackage to see whether the DataType for the EAttribute
+		            instance has been created already.  If it has it is used to set the EAttribute 
+		            instance's eType property.  Otherwise it needs to be created.
+
+		            <pre class="codeblock">
+    eAttribute  = EcoreFactory.eINSTANCE.createEAttribute();
+    if ( objectClassAttributes.getKey() == M_MUST)
+    {
+    	eAttribute.setRequired(true);
+    }
+   	//Get the AttributeType entry for the attribute
+   	attributeTypeDN         = getAttributeDN(objectClassAttribute.getValue());
+   	attributeTypeAttributes = ctx.getAttributes( attributeTypeDN );
+   	
+   	eAttribute.setName( attributeTypeAttributes.get(NAME_KEY) );
+   	
+   	//First check whether the datatype for the EAttribute exists on the 
+   	//EPackage
+   	
+   	
+   	DataType dataType = ModelPackage.eINSTANCE.getEClassifier(dataTypeName);
+   	
+   	if ( attributeDataType == null)
+   	{
+   		dataType = EcoreFactory.eINSTANCE.createDataType();
+   		String syntaxDN             = attributeTypeAttributes.get(SYNTAX_OID);
+   		Attributes syntaxAttributes = ctx.getAttributes(syntaxDN);
+   		String instanceType         = syntaxAttributes.get(DESCRIPTION);
+   		String name                 = syntaxAttributes.get(NAME);
+   		
+   		dataType.setName(name);
+   		dataType.setInstanceType(instanceType);
+   		ModelPackage.eINSTANCE.eClassifiers.add(dataType);
+   	}
+   	eAttribute.setEType(attributeDataType);
+		            </pre>
+		            <br/>
+		            <br/>
+		            
+		            <br/>
+		            <br/>
+		            
+		            
+		            
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe37.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe37.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe37.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe37.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,61 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Getting the DataObject's Complex Properties's Metadata</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Getting the DataObject's Complex Properties's Metadata</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use DirContext.getAttributes()</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+            First get a list of all the attributes contained in the entry:
+            <br/>
+            <br/>
+            <pre class="codeblock">Attributes ldapAttributes = directoryContext.getAttributes(dataObjectDN);</pre>
+            <br/>
+            <br/>
+
+            Then delete the objectClass(es) attribute(s) from the ldapAttributes map:
+            
+            <br/>
+            <br/>
+            <pre class="codeblock">ldapAttributes.remove(SystemSchemaConstants.OBJECT_CLASS_AT);</pre>
+            <br/>
+            <br/>
+            
+            Then if the attribute's name does not contain the String "EReference", 
+            we remove it.
+            
+            <br/>
+            <br/>
+            <pre class="codeblock">TODO Code</pre>
+            <br/>
+            <br/>
+            
+            We now have a map of the complex property names and their corresponding
+            meta data values.
+            <br/>
+            <br/>
+            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe38.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe38.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe38.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe38.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,64 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Adding the SDO Type's EAttributes</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Adding the SDO Type's EAttributes</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use the EAttributes Attributes Map</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+		            For each ldapAttribute in an ObjectClass entry, the DAS first creates 
+		            an EAttribute instance, if one has not already been created 
+		            and added to the model's EPackage.
+					<pre class="codeblock"> EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute(); </pre>
+		            <br/>
+		            <br/>
+		            The EAttribute requires a DataType instance in order 
+		            to set the EAttribute's eType property, so the DAS
+		            uses the attributeType's Description attribute
+		            to lookup the DataType on the EPackage.  If the
+		            DataType returned is null, the DAS creates 
+		            the DataType and adds it to the EPackage.
+		            <br/>
+		            <br/>
+		            The EAttribute instance's name is set to the 
+		            value of the description attribute of the AttributeType.
+		            <br/>
+		            <br/>
+		            If the EAttribute instance is a multiplicity
+		            many EAttribute, indicated by MetaSchemaConstants.M_SINGLE_VALUE_AT
+		            property of the attributeType being set to false, the
+		            EAttribute's upperBound property is set to "-1".
+		            <br/>
+		            <br/>
+		            Lastly if the attributeType is a  
+		            MetaSchemaConstants.M_MUST_AT attribute,
+		            indicated by the key used to set it on the SDO Type's
+		            ObjectClass,
+		            then the EAttribute required property is set to true.
+		            <br/>
+		            <br/>
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe39.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe39.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe39.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/3/recipe39.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,64 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Adding the SDO Type's EReferences</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Adding the SDO Type's EReferences</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use the EReferences Attributes Map</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+		            For each ldapAttribute in an ObjectClass entry, the DAS first creates 
+		            an EAttribute instance, if one has not already been created 
+		            and added to the model's EPackage.
+					<pre class="codeblock"> EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute(); </pre>
+		            <br/>
+		            <br/>
+		            The EAttribute requires a DataType instance in order 
+		            to set the EAttribute's eType property, so the DAS
+		            uses the attributeType's Description attribute
+		            to lookup the DataType on the EPackage.  If the
+		            DataType returned is null, the DAS creates 
+		            the DataType and adds it to the EPackage.
+		            <br/>
+		            <br/>
+		            The EAttribute instance's name is set to the 
+		            value of the description attribute of the AttributeType.
+		            <br/>
+		            <br/>
+		            If the EAttribute instance is a multiplicity
+		            many EAttribute, indicated by MetaSchemaConstants.M_SINGLE_VALUE_AT
+		            property of the attributeType being set to false, the
+		            EAttribute's upperBound property is set to "-1".
+		            <br/>
+		            <br/>
+		            Lastly if the attributeType is a  
+		            MetaSchemaConstants.M_MUST_AT attribute,
+		            indicated by the key used to set it on the SDO Type's
+		            ObjectClass,
+		            then the EAttribute required property is set to true.
+		            <br/>
+		            <br/>
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe40.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe40.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe40.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe40.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,164 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Writing a DataGraph to ADS</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Writing a DataGraph to ADS</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>
+				Use DAS.LDAP.write(eObject) [Just made it up]
+			</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+	            Writing a DataGraph to ADS means writing all the 
+	            DataObjects contained in the graph.  If this is 
+	            first time an instance of the model is written,
+	            the model's EClassifiers must also be written
+	            in the form of LDAP ObjectClasses.
+	            
+	            <br/>
+	            <br/>
+	            
+	            To do this we first get the root DataObject
+	            in the DataGraph.
+	            
+	            <br/>
+	            <br/>
+	            <pre class="codeblock">  EObject eObjectRoot = resource.getEObject("//@accounts");</pre>
+	            <br/>
+	            <br/>
+	            
+	            We also create the Directory Context
+	            where this object will be stored
+	            (using the convention discussed in the 
+	            recipe TODO LINK RECIPE like this:
+	
+	            <pre class="codeblock">
+	  //I just made the below ctx method stuff up..
+	  //will correct when coding :-) 
+	  DirContext rootContext = DirContext.createContexts("cn=accounts, cn=users, cn=org, cn=example, cn=com");
+	            </pre>
+	            <br/>
+	            
+	            Then, if this is the first time a model instance is written, indicated
+	            by an non-existing entry for the model's EPackage, 
+	            we write the EPackage entry (TODO - Add recipe to challenges section)
+	            and then get the root object's type (EClass):
+	            
+	            <pre class="codeblock">  EClass eClass = eObjectRoot.eClass();</pre>
+	            <br/>
+	            
+	            Then we write the ObjectClass corresponding
+	            to this EClass to ADS (See Related Recipes - TODO ADD).
+	
+	            <br/>
+	            <br/>
+	            
+				Once the EClass's corresponding ObjectClass 
+				is added to ADS's schema we create a directory attributes list and 
+				add the EClass's ObjectClass name like this:
+				
+				<br/>
+	            <br/>
+	            <pre class="codeblock">
+	  Attributes ldapAttributes = new AttributesImpl();
+	  ldapAttributes.put(SystemSchemaConstants.OBJECT_CLASS_NAME, eClass.getFullyQualifiedName() );            
+				</pre>
+	            <br/>
+	            <br/>
+	            
+	            Then all the simple
+	            properties contained in the DataObject
+	            are added to the list of ldap attributes as follows:
+	            
+	            <pre class="codeblock">
+	EList<EAttribute> eAttributes = eClass.getEAllAttributes();
+	Iterator<EAttribute> attributeIterator = eAttributes.iterator();
+	while ( attributeIterator.hasNext() )
+	  {
+		  EAttribute eAttribute    = attributeIterator.next();
+		  if ( !eAttribute.isTransient() )
+		  {
+		  	EObject eAttributeObject = eObjectRoot.eGet(eAttribute);
+		  	ldapAttributes.put(eAttribute.getName(), eAttributeObject.toString() );
+		  }
+	  }
+	          </pre>
+	            <br/>
+	            <br/>
+	            
+	            We must also add the directory attributes that contain
+	            metadata (size() for multiplicity many EReferences and isSet() otherwise)
+	            for the EReferences (Complex properties) on the
+	            root object like this.
+	            
+	            <br/>
+	            <br/>
+	            <pre class="codeblock">
+	  EList<EReference> eReferences = eClass.getEAllReferences();
+	  Iterator<EReference> eReferenceIterator = eReferences.iterator();
+	  while ( eReferenceIterator.hasNext() )
+	  {
+		  EReference eReference    = eReferenceIterator.next();
+		  if (eReference.isMany())
+		  {
+			  if ( eObjectRoot.isSet(eReference) )
+			  {
+				  EList eReferenceList = eObjectRoot.eGet(eReference);
+	 		  ldapAttributes.put(eReference.getName() + "EReferenceMany", eReferenceList.size() );
+			  }
+			  else
+			  {
+				  ldapAttributes.put(eReference.getName() + "EReferenceMany", 0 );
+			  }
+		  }
+		  else
+		  {
+			  ldapAttributes.put(eReference.getName() + "EReference", eObjectRoot.isSet(eReference);
+		  }
+	  }
+	            </pre>
+	            <br/>
+	            <br/>
+	            
+	            Then we add the list of ldap attributes, effectively adding the 
+	            root DataGraph object, to the server:
+	            
+	            <br/>
+	            <br/>
+	            <pre class="codeblock">
+	  //I'm making this up too
+	  ctx.addAttributes(ldapAttributes);
+	            </pre>
+	            <br/>
+	            <br/>
+	            Finally we need to write the DataObject instances EReferences
+	            by first creating a subcontext for each EReference instance, then
+	            retrieving the DataObject the EReference points to, and then
+	            repeating the process we just did for the root DataObject until
+	            we get to the bottom of the DataGraph for all branches.
+	            <br/>
+	            <br/>
+	            
+				</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe41.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe41.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe41.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/4/recipe41.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,93 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating an EReference Subcontext</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating an EReference Subcontext</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>
+					Use the JNDI InitialContext bind Operation
+				</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+					
+		            We need to establish a subcontext for each EReference.
+		            <br/>
+		            <br/>
+		            The subcontext naming convention used
+		            is 
+		            <br/>
+		            <br/>
+		            EReference.getName()
+		            <br/>
+		            <br/>
+		            if the EReference is not a multiplicity many
+		            EReference.
+		            <br/>
+		            <br/>
+		            If the EReference is a multiplicity many EReference,
+		            the convention used is: 
+		            <br/>
+		            <br/>
+		            EReference.getName() + index
+		            <br/>
+		            <br/>
+		            where index is an integer indicating 
+		            where the EReference is stored on the EList of its
+		            container.
+		            <br/>
+		            <br/>
+		            Thus if our root object is getEObject("//account");
+		            and it is stored here:
+		            <br/>
+		            <br/>
+		            DN: cn=accounts, cn=users, cn=org, cn=example, cn=com
+		            <br/>
+		            and it has an non multiplicity many EReference
+		            of type User named user, then user would be stored
+		            here:
+		            <br/>
+		            <br/>
+		            DN: cn=user, cn=accounts, cn=users, cn=org, cn=example, cn=com
+		            <br/>
+		            <br/>
+		            If User was a multiplicity many EReference, and its index was 0,
+		            it would be stored here:
+		            <br/>
+		            <br/>
+		            DN: cn=user0, cn=accounts, cn=users, cn=org, cn=example, cn=com
+		            <br/>
+		            <br/>
+		            So if there were 3 User EReferences stored on the multiplicity
+		            many User EReference, then they would be stored under the following
+		            contexts:
+		            <br/>
+		            <br/>
+		            DN: cn=user0, cn=accounts, cn=users, cn=org, cn=example, cn=com
+		            <br/>
+		            DN: cn=user1, cn=accounts, cn=users, cn=org, cn=example, cn=com
+		            <br/>
+		            DN: cn=user2, cn=accounts, cn=users, cn=org, cn=example, cn=com
+		            <br/>
+					
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe50.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe50.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe50.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe50.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,52 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating a DataObject Instance</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating a DataObject Instance</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use the RDN from the current directory context</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+				First get the model's Factory from the EPackage.
+	            <br/>
+	            <br/>
+	            <pre class="codeblock">EFactory eFactory = modelEPackage.getFactory()</pre>
+	            <br/>
+	            <br/>
+	            Then create an instance of the 
+	
+	            Therefore we can get our model root object like this:
+	
+	            <br/>
+	            <br/>
+	            <pre class="codeblock">  EObject eObject = eFactory.create("FileUtils.capitalize(rdnValue);</pre>
+	            <br/>
+	            <br/>
+	            
+	            Note that if the rdnValue corresponds to a multiplicity many
+	            EReference then the integer at the end of the rdnValue must
+	            be removed.
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe51.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe51.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe51.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe51.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,68 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Setting the DataObject's Simple Properties</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Setting the DataObject's Simple Properties</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>Use DirContext.getAttributes()</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+		            First get a list of all the attributes contained in the DataObject's entry:
+		            <pre class="codeblock">Attributes ldapAttributes = directoryContext.getAttributes(dataObjectDN);</pre>
+		            <br/>
+		            
+		            Then clone it, because we need both the complex type metadata, for 
+		            retrieving DataObject references, and the
+		            simple properties:
+		
+		            <br/>
+		            <br/>
+		            <pre class="codeblock">Attributes ldapAttributesClone = ldapAttributes.clone();</pre>
+		            <br/>
+		            <br/>
+		            
+		            Then delete the objectClass attribute from the ldapAttributes map:
+		            
+		            <br/>
+		            <br/>
+		            <pre class="codeblock">ldapAttributes.remove(SystemSchemaConstants.OBJECT_CLASS_AT);</pre>
+		            <br/>
+		            <br/>
+		            
+		            Then remove all the attributes whose name contains the word EReference.
+		            
+		            <br/>
+		            <br/>
+		            <pre class="codeblock">TODO Code</pre>
+		            <br/>
+		            <br/>
+		            
+		            We now have a map of the simple property names and their corresponding
+		            values.
+		            
+		            <br/>
+		            <br/>
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe52.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe52.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe52.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/5/recipe52.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,33 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Setting the DataObject's Complex Properties</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Setting the DataObject's Complex Properties</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p></p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>
+				
+	            
+			</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex0.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex0.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex0.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex0.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,32 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Creating the Prototype Project</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Creating the Prototype Project</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>
+				Run mvn archetype:create -DartifactId=das.ldap.prototype -DgroupId=org.apache.tuscany
+			</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p>null</p>
+
+</body>
+</html>
\ No newline at end of file

Added: directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex1.html
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex1.html?view=auto&rev=526990
==============================================================================
--- directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex1.html (added)
+++ directory/sandbox/oersoy/guides/das.ldap.design.documentation/target/html/recipes/x/recipex1.html Mon Apr  9 18:35:54 2007
@@ -0,0 +1,30 @@
+ 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+  <head>
+  <title>Adding the EMF Dependencies to the Build</title>
+   	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+	<link href="../../../../src/main/resources/css/book.css" rel="stylesheet" type="text/css">
+	<link href="../../../../src/main/resources/css/recipes.css" rel="stylesheet" type="text/css">
+  </head>
+<body>
+
+<h2>Challenge</h2>
+
+<div class="content">
+	<p>Adding the EMF Dependencies to the Build</p>
+</div>
+
+<h2>Solution</h2>
+
+<div class="content">
+	<p>See Discussion</p>
+</div>
+
+<h2>Discussion</h2>
+
+<div class="content">
+<p></p>
+
+</body>
+</html>
\ No newline at end of file



Mime
View raw message