directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oer...@apache.org
Subject svn commit: r550803 [4/10] - in /directory/sandbox/oersoy/das.ldap.parent: ./ das.ldap.constants/ das.ldap.constants/.settings/ das.ldap.constants/src/ das.ldap.constants/src/main/ das.ldap.constants/src/main/java/ das.ldap.constants/src/main/java/org/...
Date Tue, 26 Jun 2007 13:29:26 GMT
Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.create;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants;
+
+/**
+ * The Class SyntaxEntryCreator.
+ */
+public class SyntaxCheckerEntryCreator 
+implements 
+AttributeTypeConstants,
+SchemaAttributeTypeConstants,
+ObjectClassConstants,
+SchemaObjectClassConstants
+{
+    /**
+     * Create.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param namespaceURI the namespace URI
+     * @param dataTypeName the name of the DataType
+     * @param syntaxesContext the directory context
+     * 
+     * @throws Exception the exception
+     */
+    public static void create(
+    		String rdn,
+    		LdapContext syntaxCheckerContext) 
+    throws Exception
+    {
+
+        Attributes attributes = 
+            prepareSyntaxCheckerAttributes();
+        
+        syntaxCheckerContext.createSubcontext(
+            rdn, 
+            attributes);
+    }
+
+    /**
+     * TODO - Move to helper
+     * Prepare SyntaxChecker attributes.
+     * 
+     * @return the attributes
+     */
+    public static Attributes prepareSyntaxCheckerAttributes()
+    {
+        Attribute objectClassAttribute = 
+        	new BasicAttribute(
+        			OBJECT_CLASS, 
+        			TOP);
+        objectClassAttribute.add( META_TOP );
+        objectClassAttribute.add( META_SYNTAX_CHECKER );
+        
+        Attribute fqcnAttribute = 
+        	new BasicAttribute(
+        			M_FQCN,
+        			M_FQCN_DEFAULT_VALUE);
+        
+        Attributes attributes = new BasicAttributes();
+        
+        attributes.put( objectClassAttribute );
+        attributes.put( fqcnAttribute );
+
+        return attributes;
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,155 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.create;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants;
+import org.apache.tuscany.das.ldap.util.ComplexTypeNamespaceQualifier;
+
+/**
+ * The Class SyntaxEntryCreator.
+ */
+public class SyntaxEntryCreator 
+implements 
+AttributeTypeConstants,
+SchemaAttributeTypeConstants,
+ObjectClassConstants,
+SchemaObjectClassConstants
+{
+    /**
+     * Create.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param namespaceURI the namespace URI
+     * @param dataTypeName the name of the DataType
+     * @param syntaxesContext the directory context
+     * 
+     * @throws Exception the exception
+     */
+    public static void create(
+        String oidPrefix,
+        String namespaceURI,
+        String dataTypeName,
+        LdapContext syntaxesContext,
+        LdapContext syntaxCheckersContext) 
+    throws Exception
+    {
+        String syntaxDescription =
+            ComplexTypeNamespaceQualifier.
+            qualify(
+            		namespaceURI, 
+            		dataTypeName);
+        
+        String rdn = 
+            ComplexTypeRDNCreator.
+            create( 
+                oidPrefix,
+                namespaceURI,
+                dataTypeName);
+
+        Attributes syntaxAttributes = 
+            prepareSyntaxAttributes( 
+                syntaxDescription );
+        
+        Attributes syntaxCheckerAttributes = 
+        	prepareSyntaxCheckerAttributes();
+        
+        //TODO Put back in when bug gets resolved.
+        //TODO Remember to apply the namespace qualifier or we could just leave because it's in the description effectively
+        //attributes.put(M_NAME, name );
+        //attributes.put("x-humandReadible", "false");
+        //attributes.put("m-obsolete, "false");
+        syntaxesContext.createSubcontext(
+            rdn, 
+            syntaxAttributes);
+        
+        syntaxCheckersContext.createSubcontext(
+        		rdn, 
+        		syntaxCheckerAttributes);
+    }
+
+    /**
+     * TODO - Move to helper
+     * TODO - Optimize - we are prepping these each time when they could be cached
+     * Prepare syntax attributes.
+     * 
+     * @param syntaxDescription the syntax description
+     * 
+     * @return the attributes
+     */
+    public static Attributes prepareSyntaxAttributes(
+        String syntaxDescription)
+    {
+        Attribute objectClassAttribute = new BasicAttribute(
+            OBJECT_CLASS, TOP);
+        objectClassAttribute.add( META_TOP );
+        objectClassAttribute.add( META_SYNTAX );
+        
+        Attribute descriptionAttribute = new BasicAttribute(
+            M_DESCRIPTION, 
+            syntaxDescription);
+        
+        Attributes attributes = new BasicAttributes();
+        
+        attributes.put( objectClassAttribute );
+        attributes.put( descriptionAttribute );
+
+        return attributes;
+    }
+    
+    /**
+     * TODO - Move to helper
+     * TODO - Optimize - we are prepping these each time when they could be cached
+     * Prepare SyntaxChecker attributes.
+     * 
+     * @return the attributes
+     */
+    public static Attributes prepareSyntaxCheckerAttributes()
+    {
+        Attribute objectClassAttribute = 
+        	new BasicAttribute(
+        			OBJECT_CLASS, 
+        			TOP);
+        objectClassAttribute.add( META_TOP );
+        objectClassAttribute.add( META_SYNTAX_CHECKER );
+        
+        Attribute fqcnAttribute = 
+        	new BasicAttribute(
+        			M_FQCN,
+        			M_FQCN_DEFAULT_VALUE);
+        
+        Attributes attributes = new BasicAttributes();
+        
+        attributes.put( objectClassAttribute );
+        attributes.put( fqcnAttribute );
+
+        return attributes;
+    }
+    
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMayAttributeTypeDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMayAttributeTypeDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMayAttributeTypeDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMayAttributeTypeDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.destroy;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+
+public class MComplexMayAttributeTypeDestroyer
+implements DASConstants
+{
+    public static void destroy(
+        DirContext attributeTypesContext,
+        String  oidPrefix) 
+    throws NamingException, Exception
+    {
+        String rdn = 
+            SimpleTypeRDNCreator.create( 
+                oidPrefix, 
+                DAS_XSD_NAMESPACE,
+                M_META_TOP_SDO_OBJECT_CLASS,
+                M_COMPLEX_MAY);
+        
+        attributeTypesContext.destroySubcontext(
+            rdn);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMustAttributeTypeDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMustAttributeTypeDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMustAttributeTypeDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MComplexMustAttributeTypeDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.destroy;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+
+public class MComplexMustAttributeTypeDestroyer
+implements DASConstants
+{
+    public static void destroy(
+        DirContext attributeTypesContext,
+        String oidPrefix) 
+    throws NamingException, Exception
+    {
+        String rdn = 
+            SimpleTypeRDNCreator.create( 
+                oidPrefix,
+                DAS_XSD_NAMESPACE,
+                M_META_TOP_SDO_OBJECT_CLASS,
+                M_COMPLEX_MUST);
+        
+        attributeTypesContext.destroySubcontext(
+            rdn);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MIDAttributeTypeDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MIDAttributeTypeDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MIDAttributeTypeDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MIDAttributeTypeDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.destroy;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+
+public class MIDAttributeTypeDestroyer
+implements DASConstants
+{
+    public static void destroy(
+        DirContext attributeTypesContext,
+        String  oidPrefix) 
+    throws NamingException, Exception
+    {
+        String rdn = 
+            SimpleTypeRDNCreator.create( 
+                oidPrefix, 
+                DAS_XSD_NAMESPACE,
+                M_META_TOP_SDO_OBJECT_CLASS,
+                ID);
+        
+        attributeTypesContext.destroySubcontext(
+            rdn);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MetaTopSDOObjectClassDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MetaTopSDOObjectClassDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MetaTopSDOObjectClassDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/MetaTopSDOObjectClassDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.destroy;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants;
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+
+public class MetaTopSDOObjectClassDestroyer
+implements 
+AttributeTypeConstants,
+SchemaAttributeTypeConstants,
+ObjectClassConstants,
+SchemaObjectClassConstants, 
+DASConstants
+{
+    public static void destroy(
+        DirContext attributeTypesContext,
+        DirContext objectClassesContext,
+        String oidPrefix) 
+    throws NamingException, Exception
+    {
+        String rdn = 
+            ComplexTypeRDNCreator.create( 
+                oidPrefix, 
+                DAS_XSD_NAMESPACE,
+                M_META_TOP_SDO_OBJECT_CLASS);
+        
+        objectClassesContext.destroySubcontext(
+            rdn);
+
+        MComplexMayAttributeTypeDestroyer.destroy( 
+            attributeTypesContext, 
+            oidPrefix );
+        
+        MComplexMustAttributeTypeDestroyer.destroy( 
+            attributeTypesContext, 
+            oidPrefix );
+        
+        MIDAttributeTypeDestroyer.destroy( 
+            attributeTypesContext, 
+            oidPrefix );
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxCheckerEntryDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxCheckerEntryDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxCheckerEntryDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxCheckerEntryDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.destroy;
+
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+
+/**
+ * The Class SyntaxEntryCreator.
+ */
+public class SyntaxCheckerEntryDestroyer 
+{
+    /**
+     * Destroy.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param namespaceURI the namespace URI
+     * @param simpleTypeName the name
+     * @param containerContext the directory context
+     * 
+     * @throws Exception the exception
+     */
+    public static void destroy(
+        String oidPrefix,
+        String namespaceURI,
+        String simpleTypeName,
+        LdapContext containerContext) 
+    throws Exception
+    {
+        String rdn = null;
+        rdn = ComplexTypeRDNCreator.create( 
+            oidPrefix, 
+            namespaceURI, 
+            simpleTypeName );
+        
+        containerContext.destroySubcontext(rdn);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxEntryDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxEntryDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxEntryDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/destroy/SyntaxEntryDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.destroy;
+
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+
+/**
+ * The Class SyntaxEntryDestroyer
+ */
+public class SyntaxEntryDestroyer 
+{
+    /**
+     * Destroy.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param namespaceURI the namespace URI
+     * @param simpleTypeName the name
+     * @param syntaxContext the directory context
+     * 
+     * @throws Exception the exception
+     */
+    public static void destroy(
+        String oidPrefix,
+        String namespaceURI,
+        String simpleTypeName,
+        LdapContext syntaxContext,
+        LdapContext syntaxCheckersContext) 
+    throws Exception
+    {
+        String rdn = null;
+        rdn = ComplexTypeRDNCreator.create( 
+            oidPrefix, 
+            namespaceURI, 
+            simpleTypeName );
+        
+        syntaxContext.destroySubcontext(rdn);
+        syntaxCheckersContext.destroySubcontext(rdn);
+
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,113 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.  
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.create;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.AbstractAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.emf.provide.SyntaxOIDProvider;
+import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer;
+import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+
+public class EAttributeTypeCreator
+extends AbstractAttributeTypeCreator
+{
+    public EAttributeTypeCreator()
+    {
+        super();
+    }
+    /**
+     * Create.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param eAttribute the e attribute
+     * @param attributeTypesContext the attribute types context
+     * 
+     * @throws Exception the exception
+     * @throws NamingException the naming exception
+     */
+    public void create(
+        DirContext attributeTypesContext,
+        EAttribute eAttribute,
+        String oidPrefix) 
+    throws NamingException, Exception
+    {
+        String eAttributeName                     = 
+            eAttribute.getName();
+        
+        EClass eContainingClass                  = 
+            eAttribute.getEContainingClass();
+        
+        String eContainingClassName          = 
+            eContainingClass.getName();
+        
+        String namespaceURI                        = 
+            eContainingClass.
+            getEPackage().getNsURI();
+
+        String qualifiedEAttributeNameURI = 
+            SimpleTypeNamespaceQualifier.qualify(
+                namespaceURI, 
+                eContainingClassName,
+                eAttributeName);
+        
+        String normalizedEAttributeName   =
+        	QualifiedNameNormalizer.
+        	normalize(qualifiedEAttributeNameURI);
+        
+        EClassifier eDataType                       = 
+            eAttribute.getEType();
+        
+        SyntaxOIDProvider dataTypeToADSSyntaxMapProvider = 
+        	new SyntaxOIDProvider();
+        
+        String syntaxOID                              =
+        	dataTypeToADSSyntaxMapProvider.
+        	getSyntaxOID(eDataType);
+        
+        basicAttributes.put( 
+            M_DESCRIPTION, 
+            eAttributeName);
+        
+        basicAttributes.put( 
+            M_SYNTAX,      
+            syntaxOID);
+        
+        basicAttributes.put( 
+            M_NAME,        
+            normalizedEAttributeName );
+
+        String rdn = 
+            SimpleTypeRDNCreator.create( 
+                oidPrefix,
+                namespaceURI,
+                eContainingClassName,
+                eAttributeName);
+        
+        attributeTypesContext.createSubcontext(
+            rdn, 
+            basicAttributes);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,202 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.create;
+
+import java.util.List;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.AbstractTypeCreator;
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+import org.apache.tuscany.das.ldap.util.ComplexTypeNamespaceQualifier;
+import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer;
+import org.eclipse.emf.ecore.EClass;
+
+public class EObjectClassCreator
+extends AbstractTypeCreator
+{
+    public EObjectClassCreator()
+    {
+        super();
+    }
+    /**
+     * Create.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param eAttribute the e attribute
+     * @param attributeTypesContext the attribute types context
+     * 
+     * @throws Exception the exception  
+     * @throws NamingException the naming exception
+     * 
+     * Note that null can passed for the processedEClassifiers list
+     * only when the EClass has not parents.
+     */
+    public void create(
+        DirContext metaContext,
+        DirContext attributeTypesContext,
+        DirContext objectClassesContext,
+        EClass eClass,
+        List<EClass> processedEClassifiers,
+        String oidPrefix)
+    throws NamingException, Exception
+    {
+        if ( processedEClassifiers != null )
+        {
+            EClass eClassParent           = 
+                EcoreTypeSystemHelper.
+                getEClassParent( eClass );
+            
+            if (eClassParent != null)
+            {
+                boolean isEClassProcessed = 
+                    EObjectClassCreatorHelper.
+                    isEClassProcessed(
+                        eClassParent, 
+                        processedEClassifiers);
+                
+                if (!isEClassProcessed)
+                {
+                    this.create(
+                        metaContext,
+                        attributeTypesContext,
+                        objectClassesContext,
+                        eClassParent,
+                        processedEClassifiers,
+                        oidPrefix);
+                }
+            }
+        }
+            
+        objectClassAttribute.add( META_OBJECT_CLASS );
+
+        EcoreTypeSystemHelper.
+        createAttributeTypes( 
+            attributeTypesContext, 
+            eClass, 
+            oidPrefix );
+        
+        String namespaceURI           = 
+            eClass.getEPackage().
+            getNsURI();
+        
+        String qualifiedEClassNameURI = 
+            ComplexTypeNamespaceQualifier.
+            qualify(
+                namespaceURI, 
+                eClass.getName());
+        
+        String normalizedEObjectName   =
+        	QualifiedNameNormalizer.
+        	normalize(qualifiedEClassNameURI);
+        
+
+        basicAttributes.put( 
+            M_NAME, 
+            normalizedEObjectName );
+
+        basicAttributes.put( 
+            M_DESCRIPTION, 
+            eClass.getName() );
+        
+        basicAttributes.put( 
+            M_OBSOLETE, 
+            LDAP_FALSE );
+
+        //TODO Remember to test with parent combination.
+        EObjectClassCreatorHelper.
+        addParentAttribute( 
+            basicAttributes, 
+            namespaceURI,
+            eClass );
+
+        if (!eClass.isAbstract())
+        {
+            basicAttributes.put( 
+                M_TYPE_OBJECT_CLASS, 
+                STRUCTURAL );
+        }
+        else
+        {
+            basicAttributes.put( 
+                M_TYPE_OBJECT_CLASS, 
+                ABSTRACT );
+        }
+
+        
+        /*
+        EObjectClassCreatorHelper.
+        addEAttributes( 
+            basicAttributes,
+            namespaceURI, 
+            eClass );
+        
+        EObjectClassCreatorHelper.
+        addEReferences( 
+            basicAttributes, 
+            namespaceURI, 
+            eClass );
+        */
+        
+        
+        EObjectClassCreatorHelper.
+        addEStructuralFeatures( 
+            basicAttributes, 
+            namespaceURI, 
+            eClass );
+        
+        String rdn = 
+            ComplexTypeRDNCreator.
+            create( 
+                oidPrefix,
+                namespaceURI,
+                eClass.getName());
+        
+        EObjectClassCreatorHelper.
+        createInheritanceMetaData( 
+            metaContext, 
+            eClass );
+        
+        /* TODO - Remove once everything is simmered down
+        NamingEnumeration namingEnumeration = 
+        	basicAttributes.getAll();
+        
+        while (namingEnumeration.hasMore())
+        {
+        	Attribute attribute = (Attribute) namingEnumeration.next();
+        	System.out.println(attribute);
+        }
+        */
+        
+
+        objectClassesContext.
+        createSubcontext(
+            rdn, 
+            basicAttributes );
+        
+        
+        if ( processedEClassifiers != null )
+        {
+            processedEClassifiers.add(eClass);
+        }
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,378 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.create;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.EnumeratedSchemaAttributeTypeValues;
+import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants;
+import org.apache.tuscany.das.ldap.util.ComplexTypeNamespaceQualifier;
+import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer;
+import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * The Class EObjectClassCreatorHelper.
+ */
+public class EObjectClassCreatorHelper
+implements 
+EnumeratedSchemaAttributeTypeValues,
+SchemaAttributeTypeConstants,
+AttributeTypeConstants,
+SchemaObjectClassConstants,
+ObjectClassConstants,
+DASConstants
+{
+    /**
+     * Adds the parent attribute.
+     * 
+     * @param namespaceURI the namespace URI
+     * @param objectClassAttributes the object class attributes
+     * @param eClass the e class
+     */
+    public static void addParentAttribute(
+        Attributes objectClassAttributes,
+        String namespaceURI,
+        EClass eClass)
+    {
+        EClass eClassParent     = 
+            EcoreTypeSystemHelper.getEClassParent( eClass );
+
+        if(eClassParent !=null)
+        {
+            String qualifiedEClassParentNameURI = 
+                ComplexTypeNamespaceQualifier.
+                qualify(
+                    namespaceURI, 
+                    eClassParent.
+                    getName());
+            
+            String normalizedEObjectName   =
+            	QualifiedNameNormalizer.
+            	normalize(qualifiedEClassParentNameURI);
+
+            objectClassAttributes.put( 
+                M_SUP_OBJECT_CLASS, 
+                normalizedEObjectName);
+        }
+        else
+        {
+            objectClassAttributes.put( 
+                M_SUP_OBJECT_CLASS, 
+                META_OBJECT_CLASS );
+        }
+    }
+    
+    /**
+     * Adds the E attributes.
+     * 
+     * @param namespaceURI the namespace URI
+     * @param objectClassAttributes the object class attributes
+     * @param eClass the e class
+     */
+    public static void addEAttributes(
+        Attributes objectClassAttributes,
+        String namespaceURI,
+        EClass eClass)
+    {
+        List<EAttribute> eAttributes =
+            eClass.getEAttributes();
+        
+        Iterator<EAttribute> eAttributeIterator  =
+            eAttributes.iterator();
+        
+        EAttribute eAttribute          = 
+            null;
+        
+        String qualifiedEAttributeName = 
+            null;
+        
+        Attribute mMayAttribute        =
+            null;
+        
+        Attribute mMustAttribute       =
+            null;
+        
+        while( eAttributeIterator.hasNext())
+        {
+            eAttribute = eAttributeIterator.next();
+
+            qualifiedEAttributeName    = 
+                SimpleTypeNamespaceQualifier.
+                qualify(
+                    namespaceURI,
+                    eClass.getName(),
+                    eAttribute.getName());
+            
+            String normalizedEAttributeName   =
+            	QualifiedNameNormalizer.
+            	normalize(qualifiedEAttributeName);
+            
+            if (!eAttribute.isRequired())
+            {
+                if (mMayAttribute == null)
+                {
+                    mMayAttribute = new BasicAttribute(M_MAY);
+                }
+                mMayAttribute.add(normalizedEAttributeName);
+            }
+            else
+            {
+                if (mMustAttribute == null)
+                {
+                    mMustAttribute = new BasicAttribute(M_MUST);
+                }
+                mMustAttribute.add(normalizedEAttributeName);
+            }
+        }
+
+        if (mMayAttribute != null)
+        {
+            objectClassAttributes.put( mMayAttribute );
+        }
+        if (mMustAttribute != null)
+        {
+            objectClassAttributes.put( mMustAttribute );
+        }
+    }
+    
+    /**
+     * Adds the E references.
+     * 
+     * @param namespaceURI the namespace URI
+     * @param objectClassAttributes the object class attributes
+     * @param eClass the e class
+     */
+    public static void addEReferences(
+        Attributes objectClassAttributes,
+        String namespaceURI,
+        EClass eClass)
+    {
+        List<EReference> eReferences            = 
+            eClass.getEReferences();
+        
+        Iterator<EReference> eReferenceIterator =
+            eReferences.iterator();
+        
+        EReference eReference          = 
+            null;
+        
+        String qualifiedEReferenceName = 
+            null;
+        
+        Attribute mMayAttribute        =
+            null;
+        
+        Attribute mMustAttribute       =
+            null;
+        
+        while ( eReferenceIterator.hasNext())
+        {
+            eReference = eReferenceIterator.next();
+
+            qualifiedEReferenceName    = 
+                SimpleTypeNamespaceQualifier.
+                qualify(
+                    namespaceURI,
+                    eClass.getName(),
+                    eReference.getName());
+
+            String normalizedEReferenceName   =
+            	QualifiedNameNormalizer.
+            	normalize(qualifiedEReferenceName);
+
+            if (!eReference.isRequired())
+            {
+                if (mMayAttribute == null)
+                {
+                    mMayAttribute = new BasicAttribute(M_MAY);
+                }
+                mMayAttribute.add( normalizedEReferenceName );
+            }
+            else
+            {
+                if (mMustAttribute == null)
+                {
+                    mMustAttribute = new BasicAttribute(M_MUST);
+                }
+                mMustAttribute.add( normalizedEReferenceName );
+            }
+        }
+        if (mMayAttribute != null)
+        {
+            objectClassAttributes.put( mMayAttribute );
+        }
+        if (mMustAttribute != null)
+        {
+            objectClassAttributes.put( mMustAttribute );
+        }
+    }
+    
+    /**
+     * Adds the E references.
+     * 
+     * @param namespaceURI the namespace URI
+     * @param objectClassAttributes the object class attributes
+     * @param eClass the e class
+     */
+    public static void addEStructuralFeatures(
+        Attributes objectClassAttributes,
+        String namespaceURI,
+        EClass eClass)
+    {
+        List<EStructuralFeature> eStructuralFeatures            = 
+            eClass.getEStructuralFeatures();
+        
+        Iterator<EStructuralFeature> eStructuralFeatureIterator =
+            eStructuralFeatures.iterator();
+        
+        EStructuralFeature eStructuralFeature                   = 
+            null;
+        
+        String qualifiedEStructuralFeatureName                  = 
+            null;
+        
+        Attribute mMayAttribute        =
+            null;
+        
+        Attribute mMustAttribute       =
+            null;
+        
+        while ( eStructuralFeatureIterator.hasNext())
+        {
+            eStructuralFeature         = 
+                eStructuralFeatureIterator.next();
+
+            qualifiedEStructuralFeatureName    = 
+                SimpleTypeNamespaceQualifier.
+                qualify(
+                    namespaceURI,
+                    eClass.getName(),
+                    eStructuralFeature.getName());
+            
+            String normalizedEStructuralFeatureName   =
+            	QualifiedNameNormalizer.
+            	normalize(qualifiedEStructuralFeatureName);
+            
+            
+            if (!eStructuralFeature.isRequired())
+            {
+                if (mMayAttribute == null)
+                {
+                    mMayAttribute = new BasicAttribute(M_MAY);
+                }
+                mMayAttribute.add( normalizedEStructuralFeatureName );
+            }
+            else
+            {
+                if (mMustAttribute == null)
+                {
+                    mMustAttribute = new BasicAttribute(M_MUST);
+                }
+                mMustAttribute.add( normalizedEStructuralFeatureName );
+            }
+        }
+        if (mMayAttribute != null)
+        {
+            objectClassAttributes.put( mMayAttribute );
+        }
+        if (mMustAttribute != null)
+        {
+            objectClassAttributes.put( mMustAttribute );
+        }
+
+    }
+
+    
+    /**
+     * Checks if is E class processed.
+     * 
+     * @param processedEClassifiers the processed E classifiers
+     * @param eClass the e class
+     * 
+     * @return true, if is E class processed
+     */
+    public static boolean isEClassProcessed(
+        EClass eClass, 
+        List<EClass> processedEClassifiers)
+    {
+        return processedEClassifiers.contains( eClass );
+    }
+   
+    /**
+     * Creates the inheritance meta data.
+     * 
+     * @param metaContext the das model meta context
+     * @param eClass the e class
+     * 
+     * @throws NamingException the naming exception
+     */
+    public static void createInheritanceMetaData(
+        DirContext metaContext,
+        EClass eClass) 
+    throws NamingException
+    {
+        EClass eClassParent = 
+            EcoreTypeSystemHelper.getEClassParent( eClass );
+        
+        String rdn = null;
+        
+        if (eClassParent != null)
+        {
+            DirContext eClassParentMetaContext     = 
+                null;
+            try
+            {
+                eClassParentMetaContext            =
+                    ( DirContext ) 
+                    metaContext.
+                    lookup(eClassParent.getName());
+            }
+            catch ( NamingException e )
+            {
+                rdn = 
+                    CN + "=" + eClassParent.getName();
+                
+                eClassParentMetaContext            = 
+                    ( DirContext ) 
+                    metaContext.
+                    createSubcontext( rdn );
+            }
+
+            rdn = CN + "=" + eClass.getName();
+            
+            eClassParentMetaContext.
+            createSubcontext( rdn );
+        }
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,95 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.create;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.constants.SyntaxOIDValues;
+import org.apache.tuscany.das.ldap.schema.create.AbstractAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer;
+import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+
+public class EReferenceTypeCreator
+extends AbstractAttributeTypeCreator
+implements SyntaxOIDValues
+{
+    public EReferenceTypeCreator()
+    {
+        super();
+    }
+    
+    public void create(
+        DirContext attributeTypesContext,
+        EReference eReference,
+        String oidPrefix) 
+    throws NamingException, Exception
+    {
+        String eReferenceName             = 
+            eReference.getName();
+        
+        EClass eContainingClass           = 
+            eReference.getEContainingClass();
+        
+        String eContainingClassName       = 
+            eContainingClass.getName();
+        
+        String namespaceURI               = 
+            eContainingClass.
+            getEPackage().
+            getNsURI();
+
+        String qualifiedEReferenceNameURI = 
+            SimpleTypeNamespaceQualifier.qualify(
+                namespaceURI, 
+                eContainingClassName,
+                eReferenceName);
+        
+        
+        String normalizedEReferenceName   =
+        	QualifiedNameNormalizer.
+        	normalize(qualifiedEReferenceNameURI);
+        
+        basicAttributes.put( 
+            M_DESCRIPTION, 
+            eReferenceName);
+        
+        basicAttributes.put( 
+            M_SYNTAX,      
+            SYNTAX_STRING_OID_VALUE);
+        
+        basicAttributes.put( 
+            M_NAME,        
+            normalizedEReferenceName );
+
+        String rdn = 
+            SimpleTypeRDNCreator.create( 
+                oidPrefix,
+                namespaceURI,
+                eContainingClassName,
+                eReferenceName);
+        
+        attributeTypesContext.createSubcontext(
+            rdn, 
+            basicAttributes);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemCreator.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemCreator.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemCreator.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,52 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.create;
+
+import java.util.List;
+
+import javax.naming.ldap.LdapContext;
+
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public class EcoreTypeSystemCreator
+{
+    private static 
+    EcorePackage ecorePackage = 
+        EcorePackage.eINSTANCE;
+    
+    public static void create(
+        LdapContext syntaxesContext,
+        LdapContext syntaxCheckersContext,
+        String oidPrefix) throws Exception
+    {
+        List<EDataType> eDataTypes            = 
+            EcoreTypeSystemHelper.
+            createEDataTypesList(
+                ecorePackage);
+        
+        EcoreTypeSystemHelper.
+        createSyntaxEntries(
+            eDataTypes, 
+            oidPrefix, 
+            syntaxesContext,
+            syntaxCheckersContext);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,388 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.create;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.schema.create.SyntaxEntryCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EStructuralFeatureTypeDestroyer;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * The Class EcoreTypeSystemCreatorHelper.
+ */
+public class EcoreTypeSystemHelper
+{
+    
+    /**
+     * Creates the E data types list.
+     * 
+     * @param ePackage the e package
+     * 
+     * @return the list< E data type>
+     */
+    public static List<EDataType> createEDataTypesList(
+        EPackage ePackage)
+    {
+        List<EObject> list         = ePackage.eContents();
+        List<EDataType> eDataTypes = new ArrayList<EDataType>();
+        Iterator<EObject> iterator = list.iterator();
+        while (iterator.hasNext())
+        {
+            Object object = iterator.next();
+            if (object instanceof EDataType )
+            {
+                eDataTypes.add( ( EDataType ) object );
+            }
+        }
+        return eDataTypes;
+    }
+    
+    public static void createSyntaxCheckerEntries(        
+    		String oidPrefix,
+            LdapContext syntaxCheckersContext) throws Exception
+
+    {
+    	
+    }
+    
+    /**
+     * Creates the syntax entries.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param eDataTypes the e data types
+     * @param syntaxesContext the syntaxes context
+     * 
+     * @throws Exception the exception
+     */
+    public static void createSyntaxEntries(
+        List<EDataType> eDataTypes,
+        String oidPrefix,
+        LdapContext syntaxesContext,
+        LdapContext syntaxCheckersContext) throws Exception
+    {
+        Iterator<EDataType> eDataTypeIterator = 
+            eDataTypes.iterator();                          
+
+        String eDataTypeName                  = 
+            null;
+        String eDataTypeNamespaceURI          = 
+            null;
+        
+        while (eDataTypeIterator.hasNext())
+        {
+            EDataType eDataType        = 
+                eDataTypeIterator.next();
+            eDataTypeName              = 
+                eDataType.getName();
+            eDataTypeNamespaceURI      = 
+                eDataType.getEPackage().getNsURI();
+            
+            SyntaxEntryCreator.create( 
+                oidPrefix,
+                eDataTypeNamespaceURI,
+                eDataTypeName, 
+                syntaxesContext,
+                syntaxCheckersContext);
+        }
+    }
+
+    /**
+     * Creates the E classifiers list.
+     * 
+     * @param ePackage the e package
+     * 
+     * @return the list< E class>
+     */
+    public static List<EClass> createEClassifiersList(
+        EPackage ePackage)
+    {
+        List<EObject> list         = ePackage.eContents();
+        List<EClass> eClassifiers  = new ArrayList<EClass>();
+        Iterator<EObject> iterator = list.iterator();
+        while (iterator.hasNext())
+        {
+            Object object = iterator.next();
+            if (object instanceof EClassifier )
+            {
+                eClassifiers.add( ( EClass ) object );
+            }
+        }
+        return eClassifiers;
+    }
+    
+    /**
+     * Creates the E classifier entries.
+     * 
+     * @param eClassifiers the e classifiers
+     */
+    public static void createEClassifierEntries(
+        List<EClass> eClassifiers)
+    {
+        
+    }
+
+    /**
+     * Load parent E classifier stack.
+     * 
+     * @param parentEClassifierStack the parent E classifier stack
+     * @param eClass the e class
+     * 
+     * @return the stack< E class>
+     * 
+     * Note that clients should pass null for the
+     * parentEClassifierStack argument.  The method
+     * creates the stack when needed, and uses
+     * it during recursion.
+     */
+    public static Stack<EClass> loadParentEClassifierStack(
+        EClass eClass, 
+        Stack<EClass> parentEClassifierStack)
+    {
+        List<EClass> eClassParents   = 
+            eClass.getESuperTypes();
+        
+        if (eClassParents.size() > 0)
+        {
+            Iterator<EClass> eClassParentIterator = 
+                eClassParents.iterator();
+            
+            while(eClassParentIterator.hasNext())
+            {
+                EClass parentEClass = 
+                    eClassParentIterator.next();
+                
+                if (!parentEClass.isInterface())
+                {
+                    if (parentEClassifierStack == null)
+                    {
+                        parentEClassifierStack = new Stack<EClass>();
+                    }
+
+                    parentEClassifierStack.push( parentEClass );
+                    
+                    eClassParents = parentEClass.getESuperTypes();
+                    
+                    if (eClassParents.size() == 0)
+                    {
+                        return parentEClassifierStack;
+                    }
+                    else
+                    {
+                        loadParentEClassifierStack( 
+                            parentEClass, 
+                            parentEClassifierStack );
+                    }
+                }
+            }
+        }
+        return parentEClassifierStack;            
+    }
+    
+    /**
+     * Creates the E object class parents.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param objectClassesContext the object classes context
+     * @param eClass the e class
+     * 
+     * @throws Exception the exception
+     * @throws NamingException the naming exception
+     */
+    public static void createEObjectClassParents(
+        DirContext dasModelMetaContext,
+        DirContext attributeTypesContext,
+        DirContext objectClassesContext,
+        EClass eClass,
+        String oidPrefix) 
+    throws NamingException, Exception
+    {
+        Stack<EClass> parentEClassifierStack = 
+            EcoreTypeSystemHelper.
+            loadParentEClassifierStack( 
+                eClass, 
+                null);
+        
+        EClass parentEClass = null;
+        
+        for (int i=0; i<parentEClassifierStack.size(); i++)            
+        {
+            parentEClass = parentEClassifierStack.pop();
+            
+            EObjectClassCreator
+            eObjectClassCreator =
+                new EObjectClassCreator();
+            
+            eObjectClassCreator.create(
+                dasModelMetaContext,
+                attributeTypesContext,
+                objectClassesContext,
+                parentEClass, 
+                null,
+                oidPrefix);
+        }
+    }
+    
+    /**
+     * Creates the attribute types.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param eClass the e class
+     * @param attributeTypesContext the attribute types context
+     * 
+     * @throws Exception the exception
+     * @throws NamingException the naming exception
+     */
+    public static void createAttributeTypes(
+        DirContext attributeTypesContext,
+        EClass eClass,
+        String oidPrefix) 
+    throws NamingException, Exception
+    {
+        List<EAttribute> eAttributes            = 
+            eClass.getEAttributes();
+
+        Iterator<EAttribute> eAttributeIterator = 
+            eAttributes.iterator();
+        
+        while (eAttributeIterator.hasNext())
+        {
+            EAttribute eAttribute = eAttributeIterator.next();
+            
+            EAttributeTypeCreator
+            eAttributeTypeCreator =
+                new EAttributeTypeCreator();
+            
+            eAttributeTypeCreator.create( 
+                attributeTypesContext, 
+                eAttribute, 
+                oidPrefix );
+        }
+        
+        List<EReference> eReferences            = 
+            eClass.getEReferences();
+
+        Iterator<EReference> eReferenceIterator = 
+            eReferences.iterator();
+        
+        while(eReferenceIterator.hasNext())
+        {
+            EReference eReference = 
+                eReferenceIterator.
+                next();
+            
+            EReferenceTypeCreator
+            eReferenceTypeCreator =
+                new EReferenceTypeCreator();
+            
+            eReferenceTypeCreator.create(
+                attributeTypesContext,
+                eReference,
+                oidPrefix);
+        }
+    }
+    
+    /**
+     * Destroy attribute types.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param eClass the e class
+     * @param attributeTypesContext the attribute types context
+     * 
+     * @throws Exception the exception
+     * @throws NamingException the naming exception
+     */
+    public static void destroyAttributeTypes(
+        DirContext attributeTypesContext,
+        EClass eClass,
+        String oidPrefix) 
+    throws NamingException, Exception
+    {
+        List<EStructuralFeature> 
+        eStructuralFeatures                = 
+            eClass.
+            getEStructuralFeatures();
+
+        Iterator<EStructuralFeature> 
+        eStructuralFeatureIterator         = 
+            eStructuralFeatures.iterator();
+        
+        while (eStructuralFeatureIterator.hasNext())
+        {  
+            EStructuralFeature 
+            eStructuralFeature             = 
+                eStructuralFeatureIterator.next();
+            
+            EStructuralFeatureTypeDestroyer.destroy( 
+                attributeTypesContext, 
+                eStructuralFeature, 
+                oidPrefix );
+        }
+    }
+    
+    /**
+     * Gets the E class parent.
+     * 
+     * @param eClass the e class
+     * 
+     * @return the e class parent
+     */
+    public static EClass getEClassParent(EClass eClass)
+    {
+        List<EClass> eClassParents   = 
+            eClass.getESuperTypes();
+        
+        if (eClassParents.size() > 0)
+        {
+            Iterator<EClass> eClassParentIterator = 
+                eClassParents.iterator();
+            
+            while(eClassParentIterator.hasNext())
+            {
+                EClass parentEClass = 
+                    eClassParentIterator.next();
+                
+                if (!parentEClass.isInterface())
+                {
+                    return parentEClass;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        return null;
+    }
+}

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.create;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.directory.DirContext; 
+import javax.naming.ldap.LdapContext;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+
+public class ModelTypeSystemCreator
+{
+    private static List<EClass> processedEClassifiers = 
+        new ArrayList<EClass>();
+    
+    public static void create(
+    	LdapContext dasModelMetaContext,
+    	LdapContext syntaxesContext,
+        LdapContext syntaxCheckersContext,
+        LdapContext attributeTypesContext,
+        LdapContext objectClassesContext,
+        EPackage ePackage,
+        String oidPrefix)
+    throws Exception
+    {
+        List<EDataType> eDataTypes              = 
+            EcoreTypeSystemHelper.
+            createEDataTypesList(ePackage);
+        
+        EcoreTypeSystemHelper.
+            createSyntaxEntries( 
+                eDataTypes, 
+                oidPrefix, 
+                syntaxesContext,
+                syntaxCheckersContext);
+        
+        List<EClass> eClassifiers               = 
+            EcoreTypeSystemHelper.
+            createEClassifiersList( ePackage );
+        
+        Iterator<EClass> eClassIterator         = 
+            eClassifiers.iterator();
+
+        
+        EObjectClassCreator eObjectClassCreator = 
+            new EObjectClassCreator();
+        
+        while (eClassIterator.hasNext())
+        {
+            EClass eClass                       = 
+                eClassIterator.next();
+
+            eObjectClassCreator.create(
+                dasModelMetaContext,
+                attributeTypesContext, 
+                objectClassesContext, 
+                eClass,
+                processedEClassifiers,
+                oidPrefix );
+        }
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,145 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.destroy;
+
+import java.util.Map;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchResult;
+
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * The Class ECascadingObjectClassDestroyer.
+ * 
+ * The purose of this class is to destroy a ObjectClass
+ * that is the parent of other ObjectClass entries.
+ * 
+ * It first checks to see whether the EClass instance
+ * is a parent of other EClassifiers by examining 
+ * whether the metaContext contains the EClass 
+ * instance's name.
+ * 
+ * If the EClass instance has an an metaContext child entry,
+ * then this instance is a parent of other EClassifiers.  
+ * Therefore we check to see whether there are EClass
+ * instances left to delete that inherit from this EClass.
+ * 
+ * If none are left we delete the parentMetaContext entry.
+ * If there are more children left, we leave the parentMetaContext
+ * entry in place and delete the children.
+ * 
+ * If there is no parentMetaEntryContext, it means that this
+ * EClass instance does not have any children.  Therefore it's
+ * safe to delete the corresponding ObjectClass.
+ */
+public class ECascadingObjectClassDestroyer
+implements AttributeTypeConstants
+{
+	
+	
+    public static void destroy(
+        Map<String, EClass> eClassNameToEClassMap,
+        DirContext metaContext,
+        DirContext attributeTypesContext,
+        DirContext objectClassesContext,
+        EClass eClass,
+        String oidPrefix)
+    throws NamingException, Exception
+    {
+        String rdn                         =
+            null;
+        DirContext eClassParentMetaContext =
+            null;
+        try
+        {
+            eClassParentMetaContext        = 
+                ( DirContext ) 
+                metaContext.
+                lookup( CN + "=" + eClass.getName() );
+        }
+        catch (Exception e)
+        {
+            //This eClass can be deleted, because it is not used a super class.
+        }
+
+        if (eClassParentMetaContext == null)
+        {
+            EObjectClassDestroyer.destroy(
+                metaContext,
+                attributeTypesContext, 
+                objectClassesContext, 
+                eClass, 
+                oidPrefix );
+        }
+        else
+        {
+    		Attributes searchAttributes = 
+    			new BasicAttributes(true); 
+    		
+    		searchAttributes.put(new BasicAttribute(CN));
+    		
+            NamingEnumeration<SearchResult> childEntries =
+            	eClassParentMetaContext.search("", searchAttributes);
+            
+            if (childEntries.hasMore())
+            {
+                while (childEntries.hasMore()) 
+                {
+                	SearchResult childEntry                   =
+                		childEntries.next();
+                
+	                Attributes childEntryAttributes      = 
+	                	childEntry.getAttributes();
+	                
+	                String eClassName                           =
+	                    ( String ) 
+	                    childEntryAttributes.get( CN ).get();
+	              
+	                EClass childEClass                           =
+	                    eClassNameToEClassMap.get( eClassName );
+	                
+	                destroy(
+	                    eClassNameToEClassMap,
+	                    metaContext, 
+	                    attributeTypesContext, 
+	                    objectClassesContext,
+	                    childEClass,
+	                    oidPrefix );
+	                
+	                EObjectClassDestroyer.destroy(
+	                    metaContext,
+	                    attributeTypesContext, 
+	                    objectClassesContext, 
+	                    eClass, 
+	                    oidPrefix );
+	                
+	                rdn = CN + "=" + eClass.getName();
+	                metaContext.destroySubcontext( rdn );
+                } 
+            }
+        }
+  }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.destroy;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper;
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * The Class EObjectClassDestroyer.
+ */
+public class EObjectClassDestroyer
+implements AttributeTypeConstants
+{
+    public static void destroy(
+        DirContext metaContext,
+        DirContext attributeTypesContext,
+        DirContext objectClassesContext,
+        EClass eClass,
+        String oidPrefix)
+    throws NamingException, Exception
+    {
+        String namespaceURI          = 
+            eClass.getEPackage().
+            getNsURI();
+
+        String rdn = 
+            ComplexTypeRDNCreator.
+            create( 
+                oidPrefix,
+                namespaceURI,
+                eClass.getName());
+        
+        objectClassesContext.
+        destroySubcontext(
+            rdn);
+
+        EcoreTypeSystemHelper.
+        destroyAttributeTypes( 
+            attributeTypesContext, 
+            eClass, 
+            oidPrefix ); 
+
+        DirContext parentMetaContext = 
+            null;
+        
+        EClass eClassParent          =
+            EcoreTypeSystemHelper.
+            getEClassParent( eClass );
+        
+        if (eClassParent != null)
+        {
+            rdn = CN + "=" + eClassParent.getName();
+            
+            parentMetaContext = 
+                ( DirContext ) 
+                metaContext.lookup( rdn );
+            
+            rdn = CN + "=" + eClass.getName();
+            
+            parentMetaContext.destroySubcontext( rdn );
+        }
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,61 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.destroy;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.AbstractAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+public class EStructuralFeatureTypeDestroyer
+extends AbstractAttributeTypeCreator
+{
+    public static void destroy(
+        DirContext attributeTypesContext,
+        EStructuralFeature eStructuralFeature,
+        String oidPrefix)
+    throws NamingException, Exception
+    {
+        EClass eContainingClass     =
+            eStructuralFeature.
+            getEContainingClass();
+        
+        String eContainingClassName = 
+            eContainingClass.
+            getName();
+        
+        String namespaceURI         = 
+            eContainingClass.
+            getEPackage().
+            getNsURI();
+
+        String rdn = 
+            SimpleTypeRDNCreator.create( 
+                oidPrefix,
+                namespaceURI,
+                eContainingClassName,
+                eStructuralFeature.getName());
+        
+        attributeTypesContext.destroySubcontext(
+            rdn);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EcoreTypeSystemDestroyer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EcoreTypeSystemDestroyer.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EcoreTypeSystemDestroyer.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EcoreTypeSystemDestroyer.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.emf.destroy;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.schema.destroy.SyntaxEntryDestroyer;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public class EcoreTypeSystemDestroyer
+{
+
+    private static EcorePackage ecorePackage = 
+        EcorePackage.eINSTANCE;
+
+    /**
+     * Destroy.
+     * 
+     * @param oidPrefix the oid prefix
+     * @param syntaxesContext the syntaxes context
+     * 
+     * @throws Exception the exception
+     */
+    public static void destroy(
+        LdapContext syntaxesContext,
+        LdapContext syntaxCheckersContext,
+        String oidPrefix) throws Exception
+    {
+        List<EDataType> eDataTypes   = 
+            EcoreTypeSystemHelper.
+            createEDataTypesList(ecorePackage);
+        
+        Iterator<EDataType> eDataTypeIterator = eDataTypes.iterator();                          
+
+        EDataType eDataType          = null;
+        String eDataTypeName         = null;
+        String eDataTypeNamespaceURI = null;
+        
+        while (eDataTypeIterator.hasNext())
+        {
+            eDataType             = 
+                eDataTypeIterator.next();
+            
+            eDataTypeName         = 
+                eDataType.getName();
+            
+            eDataTypeNamespaceURI = 
+                eDataType.getEPackage().getNsURI();
+            
+            SyntaxEntryDestroyer.destroy(
+                oidPrefix,
+                eDataTypeNamespaceURI,
+                eDataTypeName, 
+                syntaxesContext,
+                syntaxCheckersContext);
+        }
+        
+    }
+}
\ No newline at end of file



Mime
View raw message