You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/08/28 22:04:26 UTC

svn commit: r990428 [3/3] - in /directory/sandbox/studio-persistence-tooling: ./ persistence-core/ persistence-core/src/ persistence-core/src/main/ persistence-core/src/main/java/ persistence-core/src/main/java/org/ persistence-core/src/main/java/org/a...

Added: directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/dao/InetOrgPersonDao.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/dao/InetOrgPersonDao.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/dao/InetOrgPersonDao.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/dao/InetOrgPersonDao.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,54 @@
+package com.example.dao;
+
+
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.entry.Entry;
+
+import com.example.domain.InetOrgPerson;
+
+
+public class InetOrgPersonDao extends GenericLdapDao<InetOrgPerson>
+{
+    public InetOrgPersonDao()
+    {
+        super.server = "localhost";
+        super.port = 12345;
+        super.name = "uid=admin,ou=system";
+        super.credentials = "secret";
+        super.rdnAttribute = "uid";
+        super.parentDn = "ou=users,dc=example,dc=com";
+        super.attributes = new String[]
+            { "objectClass", "uid", "cn", "sn", "givenName", "mail", "telephoneNumber", "userPassword" };
+        super.objectClasses = new String[]
+            { "inetOrgPerson", "organizationalPerson", "person", "top" };
+    }
+
+
+    protected InetOrgPerson mapFromEntry( Entry entry )
+    {
+        InetOrgPerson person = new InetOrgPerson();
+        person.setUid( getString( entry, "uid" ) );
+        person.setFullName( getString( entry, "cn" ) );
+        person.setLastName( getString( entry, "sn" ) );
+        person.setFirstName( getString( entry, "givenName" ) );
+        person.setPassword( getBytes( entry, "userPassword" ) );
+        person.setTelephoneNumbers( getStringSet( entry, "telephoneNumber" ) );
+        return person;
+    }
+
+
+    protected void mapToEntry( InetOrgPerson person, Entry entry ) throws NamingException
+    {
+        setString( entry, "uid", person.getUid() );
+        setString( entry, "cn", person.getFullName() );
+        setString( entry, "sn", person.getLastName() );
+        setString( entry, "givenName", person.getFirstName() );
+        setBytes( entry, "userPassword", person.getPassword() );
+        for ( String telephoneNumber : person.getTelephoneNumbers() )
+        {
+            setString( entry, "telephoneNumber", telephoneNumber );
+        }
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/domain/InetOrgPerson.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/domain/InetOrgPerson.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/domain/InetOrgPerson.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-example/src/main/java/com/example/domain/InetOrgPerson.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,80 @@
+package com.example.domain;
+
+import java.util.HashSet; // TODO
+import java.util.Set; // TODO
+
+public class InetOrgPerson 
+{
+
+    private String uid; // uid
+    private byte[] password; // userPassword
+    private String lastName; // sn
+    private String fullName; // cn
+    private Set<String> telephoneNumbers = new HashSet<String>(); // telephoneNumber
+    private String firstName; // givenName
+
+    public InetOrgPerson()
+    {
+    }
+
+    public String getUid()
+    {
+        return uid;
+    }
+
+    public void setUid(String uid)
+    {
+        this.uid = uid;
+    }
+
+    public byte[] getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword(byte[] password)
+    {
+        this.password = password;
+    }
+
+    public String getLastName()
+    {
+        return lastName;
+    }
+
+    public void setLastName(String lastName)
+    {
+        this.lastName = lastName;
+    }
+
+    public String getFullName()
+    {
+        return fullName;
+    }
+
+    public void setFullName(String fullName)
+    {
+        this.fullName = fullName;
+    }
+
+    public Set<String> getTelephoneNumbers()
+    {
+        return telephoneNumbers;
+    }
+
+    public void setTelephoneNumbers(Set<String> telephoneNumbers)
+    {
+        this.telephoneNumbers = telephoneNumbers;
+    }
+
+    public String getFirstName()
+    {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName)
+    {
+        this.firstName = firstName;
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-example/src/test/java/com/example/dao/InetOrgPersonDaoTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-example/src/test/java/com/example/dao/InetOrgPersonDaoTest.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-example/src/test/java/com/example/dao/InetOrgPersonDaoTest.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-example/src/test/java/com/example/dao/InetOrgPersonDaoTest.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,280 @@
+
+package com.example.dao;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.directory.server.annotations.CreateLdapServer;
+import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+import org.apache.directory.server.core.annotations.ContextEntry;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
+import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.example.domain.InetOrgPerson;
+
+@RunWith(FrameworkRunner.class)
+@CreateDS( 
+    name = "InetOrgPersonDaoTestDS",
+    partitions =
+    {
+        @CreatePartition(
+            name = "example",
+            suffix = "dc=example,dc=com",
+            contextEntry = @ContextEntry( 
+                entryLdif =
+                    "dn: dc=example,dc=com\n" +
+                    "dc: example\n" +
+                    "objectClass: top\n" +
+                    "objectClass: domain\n\n" ),
+            indexes = 
+            {
+                @CreateIndex( attribute = "objectClass" ),
+                @CreateIndex( attribute = "dc" ),
+                @CreateIndex( attribute = "ou" )
+            } )
+    } )
+@CreateLdapServer ( 
+    transports = 
+    {
+        @CreateTransport( protocol = "LDAP", port=12345 )
+    })
+@ApplyLdifs({
+    "dn: ou=users,dc=example,dc=com",
+    "objectClass: organizationalUnit",
+    "objectClass: top",
+    "ou: users",
+
+    // 1st user
+    "dn: uid=test1,ou=users,dc=example,dc=com",
+    "objectClass: inetOrgPerson",
+    "objectClass: organizationalPerson",
+    "objectClass: person",
+    "objectClass: top",
+    "uid: test1",
+    "cn: test1.cn",
+    "sn: test1.sn",
+    "givenName: test1.givenName",
+    "telephoneNumber: 12345",
+    "telephoneNumber: 23456",
+    "userPassword:: dGVzdDEuc2VjcmV0",
+    
+    // 2nd user
+    "dn: uid=test2,ou=users,dc=example,dc=com",
+    "objectClass: inetOrgPerson",
+    "objectClass: organizationalPerson",
+    "objectClass: person",
+    "objectClass: top",
+    "uid: test2",
+    "cn: test2.cn",
+    "sn: test2.sn",
+    "description: test2 description"
+    // no givenName
+    // no telephoneNumber
+    // no userPassword
+
+    })
+public class InetOrgPersonDaoTest extends AbstractLdapTestUnit
+{
+    private InetOrgPersonDao dao;
+
+
+    @Before
+    public void setup()
+    {
+        dao = new InetOrgPersonDao();
+    }
+
+
+    @Test
+    public void testGetById_Ok() throws Exception
+    {
+        InetOrgPerson user1 = dao.getById( "test1" );
+        assertNotNull( user1 );
+        assertEquals( "test1", user1.getUid() );
+        assertEquals( "test1.cn", user1.getFullName() );
+        assertEquals( "test1.sn", user1.getLastName() );
+        assertEquals( "test1.givenName", user1.getFirstName() );
+        assertNotNull( user1.getTelephoneNumbers() );
+        assertEquals( 2, user1.getTelephoneNumbers().size() );
+        assertTrue( user1.getTelephoneNumbers().contains( "12345" ) );
+        assertTrue( user1.getTelephoneNumbers().contains( "23456" ) );
+        assertEquals( "test1.secret", new String( user1.getPassword(), "UTF-8" ) );
+
+        InetOrgPerson user2 = dao.getById( "test2" );
+        assertNotNull( user2 );
+        assertEquals( "test2", user2.getUid() );
+        assertEquals( "test2.cn", user2.getFullName() );
+        assertEquals( "test2.sn", user2.getLastName() );
+        assertNull( user2.getFirstName() );
+        assertNotNull( user2.getTelephoneNumbers() );
+        assertEquals( 0, user2.getTelephoneNumbers().size() );
+        assertNull( user2.getPassword() );
+    }
+
+
+    @Test
+    public void testGetById_NonExisting()
+    {
+        InetOrgPerson person = dao.getById( "test3" );
+        assertNull( person );
+    }
+
+
+    @Test
+    public void testGetAll()
+    {
+        Collection<InetOrgPerson> all = dao.getAll();
+        assertNotNull( all );
+        assertEquals( 2, all.size() );
+    }
+
+
+    @Test
+    public void testAdd() throws Exception
+    {
+        InetOrgPerson user = new InetOrgPerson();
+        user.setUid( "test99" );
+        user.setFullName( "test99.cn" );
+        user.setFirstName( "test99.givenName" );
+        user.setLastName( "test99.sn" );
+        user.setPassword( "secret".getBytes( "UTF-8" ) );
+        Set<String> telephoneNumbers = new HashSet<String>();
+        telephoneNumbers.add( "11111" );
+        telephoneNumbers.add( "22222" );
+        user.setTelephoneNumbers( telephoneNumbers );
+        dao.create( user );
+
+        DN dn = new DN( "uid=test99,ou=users,dc=example,dc=com" );
+        assertTrue( service.getAdminSession().exists( dn ) );
+        Entry entry = service.getAdminSession().lookup( dn );
+        assertNotNull( entry );
+
+        assertAttribute( entry, "objectClass", "inetOrgPerson", "organizationalPerson", "person", "top" );
+        assertAttribute( entry, "uid", "test99" );
+        assertAttribute( entry, "cn", "test99.cn" );
+        assertAttribute( entry, "sn", "test99.sn" );
+        assertAttribute( entry, "givenName", "test99.givenName" );
+        assertAttribute( entry, "userPassword", "secret" );
+        assertAttribute( entry, "telephoneNumber", "11111", "22222" );
+    }
+
+
+    @Test
+    public void testUpdate_addFields() throws Exception
+    {
+        InetOrgPerson user = dao.getById( "test2" );
+        user.getTelephoneNumbers().add( "33333" );
+        user.setFirstName( "test2.givenName" );
+        user.setPassword( "test2.secret".getBytes( "UTF-8" ) );
+        dao.update( user );
+
+        DN dn = new DN( "uid=test2,ou=users,dc=example,dc=com" );
+        assertTrue( service.getAdminSession().exists( dn ) );
+        Entry entry = service.getAdminSession().lookup( dn );
+        assertNotNull( entry );
+
+        assertAttribute( entry, "objectClass", "inetOrgPerson", "organizationalPerson", "person", "top" );
+        assertAttribute( entry, "uid", "test2" );
+        assertAttribute( entry, "cn", "test2.cn" );
+        assertAttribute( entry, "sn", "test2.sn" );
+        assertAttribute( entry, "givenName", "test2.givenName" );
+        assertAttribute( entry, "telephoneNumber", "33333" );
+        assertAttribute( entry, "userPassword", "test2.secret" );
+    }
+
+
+    @Test
+    public void testUpdate_deleteFields() throws Exception
+    {
+        InetOrgPerson user = dao.getById( "test1" );
+        user.getTelephoneNumbers().clear();
+        user.setFirstName( null );
+        user.setPassword( null );
+        dao.update( user );
+
+        DN dn = new DN( "uid=test1,ou=users,dc=example,dc=com" );
+        assertTrue( service.getAdminSession().exists( dn ) );
+        Entry entry = service.getAdminSession().lookup( dn );
+        assertNotNull( entry );
+
+        assertAttribute( entry, "objectClass", "inetOrgPerson", "organizationalPerson", "person", "top" );
+        assertAttribute( entry, "uid", "test1" );
+        assertAttribute( entry, "cn", "test1.cn" );
+        assertAttribute( entry, "sn", "test1.sn" );
+        assertAttribute( entry, "givenName" );
+        assertAttribute( entry, "telephoneNumber" );
+        assertAttribute( entry, "userPassword" );
+    }
+
+
+    @Test
+    public void testUpdate_setFields() throws Exception
+    {
+        InetOrgPerson user = dao.getById( "test1" );
+        user.getTelephoneNumbers().clear();
+        user.getTelephoneNumbers().add( "44444" );
+        user.getTelephoneNumbers().add( "55555" );
+        user.setFirstName( "user1.anotherGivenName" );
+        user.setPassword( "simple".getBytes( "UTF-8" ) );
+        dao.update( user );
+
+        DN dn = new DN( "uid=test1,ou=users,dc=example,dc=com" );
+        assertTrue( service.getAdminSession().exists( dn ) );
+        Entry entry = service.getAdminSession().lookup( dn );
+        assertNotNull( entry );
+
+        assertAttribute( entry, "objectClass", "inetOrgPerson", "organizationalPerson", "person", "top" );
+        assertAttribute( entry, "uid", "test1" );
+        assertAttribute( entry, "cn", "test1.cn" );
+        assertAttribute( entry, "sn", "test1.sn" );
+        assertAttribute( entry, "givenName", "user1.anotherGivenName" );
+        assertAttribute( entry, "telephoneNumber", "44444", "55555" );
+        assertAttribute( entry, "userPassword", "simple" );
+    }
+
+
+    @Test
+    public void testDelete() throws Exception
+    {
+        InetOrgPerson user = dao.getById( "test2" );
+        dao.delete( user );
+
+        DN dn = new DN( "uid=test2,ou=users,dc=example,dc=com" );
+        assertFalse( service.getAdminSession().exists( dn ) );
+    }
+
+
+    private void assertAttribute( Entry entry, String attribute, String... values ) throws Exception
+    {
+        if ( values.length == 0 )
+        {
+            assertNull( entry.get( attribute ) );
+        }
+        else
+        {
+            assertNotNull( entry.get( attribute ) );
+            assertEquals( values.length, entry.get( attribute ).size() );
+            for ( String value : values )
+            {
+                assertTrue( entry.get( attribute ).contains( value )
+                    || entry.get( attribute ).contains( value.getBytes( "UTF-8" ) ) );
+            }
+        }
+    }
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-example/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-example/src/test/resources/log4j.properties?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-example/src/test/resources/log4j.properties (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-example/src/test/resources/log4j.properties Sat Aug 28 20:04:24 2010
@@ -0,0 +1,21 @@
+#############################################################################
+#    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.
+#############################################################################
+log4j.rootCategory=OFF, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/plugin.xml?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/plugin.xml (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/plugin.xml Sat Aug 28 20:04:24 2010
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+   <extension
+         point="org.eclipse.ui.popupMenus">
+      <objectContribution
+            objectClass="org.apache.directory.studio.ldapbrowser.core.model.IEntry"
+            id="org.apache.directory.studio.ldapbrowser.core.model.IEntry.">
+         <action
+               label="Generate Persistence Code"
+               class="org.apache.directory.studio.persistence.ui.actions.NewAction"
+               enablesFor="1"
+               id="org.apache.directory.studio.persistence.ui.actions.newAction">
+         </action>
+      </objectContribution>
+   </extension>
+
+</plugin>

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/pom.xml?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/pom.xml (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/pom.xml Sat Aug 28 20:04:24 2010
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="UTF-8"?>
+	<!--
+		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.
+	-->
+	<!--
+		@author <a href="mailto:dev@directory.apache.org">Apache Directory
+		Project</a>
+	-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.directory.studio</groupId>
+		<artifactId>persistence-parent</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>persistence.ui</artifactId>
+	<name>Apache Directory Studio LDAP Persistence Tooling UI</name>
+
+	<description />
+
+	<build>
+		<resources>
+			<resource>
+				<directory>.</directory>
+				<includes>
+					<include>plugin*.properties</include>
+					<include>plugin.xml</include>
+					<include>about.ini</include>
+					<include>studio.png</include>
+				</includes>
+			</resource>
+			<resource>
+				<directory>resources</directory>
+				<targetPath>resources</targetPath>
+			</resource>
+			<resource>
+				<directory>src/main/java</directory>
+				<includes>
+					<include>**/*.properties</include>
+				</includes>
+			</resource>
+		</resources>
+
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<configuration>
+					<skip>false</skip>
+					<pde>true</pde>
+					<buildcommands>
+						<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
+						<buildcommand>org.eclipse.pde.ManifestBuilder</buildcommand>
+						<buildcommand>org.eclipse.pde.SchemaBuilder</buildcommand>
+					</buildcommands>
+					<projectnatures>
+						<projectnature>org.eclipse.jem.workbench.JavaEMFNature</projectnature>
+						<projectnature>org.eclipse.pde.PluginNature</projectnature>
+						<projectnature>org.eclipse.jdt.core.javanature</projectnature>
+						<projectnature>org.eclipse.jem.beaninfo.BeanInfoNature</projectnature>
+					</projectnatures>
+					<classpathContainers>
+						<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+						<classpathContainer>org.eclipse.pde.core.requiredPlugins</classpathContainer>
+					</classpathContainers>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.directory.studio</groupId>
+				<artifactId>studio-maven-plugin</artifactId>
+				<configuration>
+					<skip>false</skip>
+					<createManifest>true</createManifest>
+				</configuration>
+				<executions>
+					<execution>
+						<goals>
+							<goal>prepare-jar-package</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<configuration>
+					<archive>
+						<manifestFile>META-INF/MANIFEST.MF</manifestFile>
+						<addMavenDescriptor>false</addMavenDescriptor>
+					</archive>
+				</configuration>
+			</plugin>
+			<!-- MANIFEST.MF Generation -->
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<extensions>true</extensions>
+				<configuration>
+					<manifestLocation>META-INF</manifestLocation>
+					<instructions>
+						<Bundle-SymbolicName>${project.groupId}.${project.artifactId};singleton:=true</Bundle-SymbolicName>
+						<Bundle-Localization>plugin</Bundle-Localization>
+						<Eclipse-LazyStart>true</Eclipse-LazyStart>
+						<Bundle-Activator>org.apache.directory.studio.persistence.ui.Activator</Bundle-Activator>
+						<Require-Bundle>org.eclipse.core.runtime,
+							org.eclipse.core.expressions,
+							org.eclipse.core.filesystem,
+							org.eclipse.core.resources,
+							org.eclipse.search,
+							org.eclipse.ui,
+							org.eclipse.ui.editors,
+							org.eclipse.ui.workbench.texteditor,
+							org.eclipse.ui.views,
+							org.eclipse.ui.forms,
+							org.eclipse.jface.text,
+							org.apache.directory.studio.jars,
+							org.apache.directory.studio.ldifparser,
+							org.apache.directory.studio.connection.core,
+							org.apache.directory.studio.connection.ui,
+							org.apache.directory.studio.ldapbrowser.core,
+							org.apache.directory.studio.ldapbrowser.common,
+							org.apache.directory.studio.ldifeditor,
+							org.apache.directory.studio.persistence.core
+            </Require-Bundle>
+						<Export-Package>org.apache.directory.studio.persitence.ui.*</Export-Package>
+						<Import-Package>!</Import-Package>
+						<Private-Package>!</Private-Package>
+					</instructions>
+				</configuration>
+				<executions>
+					<execution>
+						<id>generate-manifest</id>
+						<phase>process-classes</phase>
+						<goals>
+							<goal>manifest</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<!-- No tests to run -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<skip>true</skip>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+	<dependencies>
+		<!-- LDAP Persistence Tooling plugins dependencies -->
+		<dependency>
+			<groupId>org.apache.directory.studio</groupId>
+			<artifactId>persistence.core</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+		<!-- Apache Directory Studio plugins dependencies -->
+		<dependency>
+			<groupId>org.apache.directory.studio</groupId>
+			<artifactId>ldapbrowser.core</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.directory.studio</groupId>
+			<artifactId>jars</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.directory.studio</groupId>
+			<artifactId>ldifparser</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.directory.studio</groupId>
+			<artifactId>connection.core</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+		<!-- Eclipse plugins dependencies -->
+		<dependency>
+			<groupId>org.eclipse.core</groupId>
+			<artifactId>commands</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse</groupId>
+			<artifactId>osgi</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.core</groupId>
+			<artifactId>jobs</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.equinox</groupId>
+			<artifactId>preferences</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.equinox</groupId>
+			<artifactId>common</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.core</groupId>
+			<artifactId>runtime</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.core</groupId>
+			<artifactId>expressions</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.equinox</groupId>
+			<artifactId>registry</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse</groupId>
+			<artifactId>jface</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.jface</groupId>
+			<artifactId>text</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse</groupId>
+			<artifactId>text</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.ui</groupId>
+			<artifactId>editors</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.ui</groupId>
+			<artifactId>ide</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.ui</groupId>
+			<artifactId>forms</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.ui</groupId>
+			<artifactId>views</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.ui</groupId>
+			<artifactId>workbench</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.ui.workbench</groupId>
+			<artifactId>texteditor</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.swt.gtk.linux</groupId>
+			<artifactId>x86</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.eclipse.core</groupId>
+			<artifactId>resources</artifactId>
+			<scope>provided</scope>
+		</dependency>
+	</dependencies>
+
+</project>

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/Activator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/Activator.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/Activator.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/Activator.java Sat Aug 28 20:04:24 2010
@@ -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.directory.studio.persistence.ui;
+
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Activator extends AbstractUIPlugin
+{
+
+    /** The plug-in ID */
+    public static final String PLUGIN_ID = "org.apache.directory.studio.persistence.ui";
+
+    /** The shared instance */
+    private static Activator plugin;
+
+
+    /**
+     * The constructor
+     */
+    public Activator()
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+        plugin = this;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault()
+    {
+        return plugin;
+    }
+
+
+    /**
+     * Returns an image descriptor for the image file at the given
+     * plug-in relative path
+     *
+     * @param path the path
+     * @return the image descriptor
+     */
+    public static ImageDescriptor getImageDescriptor( String path )
+    {
+        return imageDescriptorFromPlugin( PLUGIN_ID, path );
+    }
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/actions/NewAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/actions/NewAction.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/actions/NewAction.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/ui/actions/NewAction.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,87 @@
+/*
+ *  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.directory.studio.persistence.ui.actions;
+
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.persistence.view.wizards.NewPersistenceCodeWizard;
+
+
+public class NewAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    private Shell shell;
+    private ISelection selection;
+    IWorkbenchPart part;
+
+    public NewAction()
+    {
+        super( "NewSchemaAction" );
+        setEnabled( false );
+    }
+
+
+    public void run( IAction action )
+    {
+        IStructuredSelection structuredSelection = ( IStructuredSelection ) selection;
+        IEntry entry = ( IEntry ) structuredSelection.getFirstElement();
+        
+        // Instantiates and initializes the wizard
+        NewPersistenceCodeWizard wizard = new NewPersistenceCodeWizard();
+        wizard.setEntry( entry );
+        wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+        // Instantiates the wizard container with the wizard and opens it
+        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+        dialog.create();
+        dialog.open();
+
+    }
+
+
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        this.selection = selection;
+    }
+
+
+    public void dispose()
+    {
+
+    }
+
+
+    public void init( IWorkbenchWindow window )
+    {
+
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AddMembersWizardPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AddMembersWizardPage.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AddMembersWizardPage.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AddMembersWizardPage.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,260 @@
+/*
+ *   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.directory.studio.persistence.view.wizards;
+
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.directory.studio.persistence.core.CodeGeneratorContext;
+import org.apache.directory.studio.persistence.core.EntryProperties;
+import org.apache.directory.studio.persistence.core.JavaUtils;
+
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+
+
+/**
+ * TODO AddMembersWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AddMembersWizardPage extends WizardPage
+{
+
+    private CheckboxTableViewer checkboxTableViewer;
+    private CodeGeneratorContext codeGeneratorContext;
+    private TableColumnSorter tableColumnSorter;
+
+
+    /**
+     * Creates a new instance of AddMembersWizardPage.
+     *
+     * @param pageName
+     */
+    protected AddMembersWizardPage()
+    {
+        super( "AddMembersWizardPage" );
+        setTitle( "Attributes" );
+        setDescription( "Select LDAP attributes and Java members" );
+        // setImageDescriptor( //Image to be added );
+        setPageComplete( false );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createControl( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NULL );
+        GridLayout layout = new GridLayout( 1, false );
+        composite.setLayout( layout );
+
+        createViewer( composite );
+        checkboxTableViewer.setContentProvider( new EntryContentProvider() );
+        checkboxTableViewer.setLabelProvider( new EntryLabelProvider() );
+        checkboxTableViewer.setInput( codeGeneratorContext.getEntryProperties() );
+        // Set the sorter for the table
+        tableColumnSorter = new TableColumnSorter();
+        checkboxTableViewer.setSorter( tableColumnSorter );
+        setControl( composite );
+    }
+
+
+    public void setFocus()
+    {
+        checkboxTableViewer.getControl().setFocus();
+    }
+
+
+    private void createViewer( Composite parent )
+    {
+        Table table = new Table( parent, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION );
+        table.setHeaderVisible( true );
+        table.setLinesVisible( true );
+        TableLayout tableLayout = new TableLayout();
+        tableLayout.addColumnData( new ColumnWeightData( 90 ) );
+        tableLayout.addColumnData( new ColumnWeightData( 120 ) );
+        tableLayout.addColumnData( new ColumnWeightData( 90 ) );
+        tableLayout.addColumnData( new ColumnWeightData( 120 ) );
+        table.setLayout( tableLayout );
+        GridData pViewerData = new GridData( GridData.FILL_BOTH );
+        table.setLayoutData( pViewerData );
+        checkboxTableViewer = new CheckboxTableViewer( table );
+        final TableViewerColumn col0viewer = new TableViewerColumn( checkboxTableViewer, 0 );
+        // set default sorting direction to ascending
+        checkboxTableViewer.addOpenListener( new IOpenListener()
+        {
+            public void open( OpenEvent event )
+            {
+                checkboxTableViewer.getTable().setSortColumn( col0viewer.getColumn() );
+                checkboxTableViewer.refresh();
+            }
+        } );
+
+        col0viewer.getColumn().setText( "LDAP Attribute" );
+        col0viewer.getColumn().addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                tableColumnSorter.setColumn( 0 );
+                int dir = checkboxTableViewer.getTable().getSortDirection();
+                if ( checkboxTableViewer.getTable().getSortColumn() == col0viewer.getColumn() )
+                {
+                    dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
+                }
+                else
+                {
+                    dir = SWT.DOWN;
+                }
+                checkboxTableViewer.getTable().setSortDirection( dir );
+                checkboxTableViewer.getTable().setSortColumn( col0viewer.getColumn() );
+                checkboxTableViewer.refresh();
+            }
+        } );
+        final TableViewerColumn col1viewer = new TableViewerColumn( checkboxTableViewer, 1 );
+        col1viewer.getColumn().setText( "Java Attribute" );
+        col1viewer.setEditingSupport( new AttributeEditingSupport( col1viewer.getViewer(), 1, this ) );
+        col1viewer.getColumn().addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                tableColumnSorter.setColumn( 1 );
+                int dir = checkboxTableViewer.getTable().getSortDirection();
+                if ( checkboxTableViewer.getTable().getSortColumn() == col1viewer.getColumn() )
+                {
+                    dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
+                }
+                else
+                {
+                    dir = SWT.DOWN;
+                }
+                checkboxTableViewer.getTable().setSortDirection( dir );
+                checkboxTableViewer.getTable().setSortColumn( col1viewer.getColumn() );
+                checkboxTableViewer.refresh();
+            }
+        } );
+        TableViewerColumn col2viewer = new TableViewerColumn( checkboxTableViewer, 2 );
+        col2viewer.getColumn().setText( "Java Type" );
+        col2viewer.setEditingSupport( new AttributeEditingSupport( col2viewer.getViewer(), 2, this ) );
+        TableViewerColumn col3viewer = new TableViewerColumn( checkboxTableViewer, 3 );
+        col3viewer.getColumn().setText( "Cardinality" );
+        col3viewer.setEditingSupport( new AttributeEditingSupport( col3viewer.getViewer(), 3, this ) );
+        //get checked elements of the viewer
+        checkboxTableViewer.addCheckStateListener( new ICheckStateListener()
+        {
+            public void checkStateChanged( CheckStateChangedEvent event )
+            {
+                EntryProperties properties = ( EntryProperties ) event.getElement();
+                properties.setGen( event.getChecked() );
+
+                dialogChanged();
+            }
+        } );
+
+        checkboxTableViewer.setCheckStateProvider( new ICheckStateProvider()
+        {
+            public boolean isGrayed( Object element )
+            {
+                return false;
+            }
+
+
+            public boolean isChecked( Object element )
+            {
+                dialogChanged();
+                EntryProperties properties = ( EntryProperties ) element;
+                return properties.isGen();
+            }
+        } );
+        dialogChanged();
+    }
+
+
+    public void showErrorMessage( String message )
+    {
+        setMessage( null, DialogPage.NONE );
+        setErrorMessage( message );
+        setPageComplete( message == null );
+    }
+
+
+    public void setEntryInformation( CodeGeneratorContext entryInformation )
+    {
+        this.codeGeneratorContext = entryInformation;
+    }
+
+
+    public void dialogChanged()
+    {
+        // at least one element must be checked
+        if ( checkboxTableViewer.getCheckedElements().length == 0 )
+        {
+            showErrorMessage( "No elements selected" );
+            return;
+        }
+        // check for valid java identifiers
+        for ( EntryProperties properties : codeGeneratorContext.getEntryProperties() )
+        {
+            if ( properties.isGen() && !JavaUtils.isValid( properties.getJavaMemberName() ) )
+            {
+                showErrorMessage( properties.getJavaMemberName() + " is not a valid Java identifier." );
+                return;
+            }
+        }
+
+        // check for colliding java member names
+        Set<String> javaMemberNames = new HashSet<String>();
+        for ( EntryProperties properties : codeGeneratorContext.getEntryProperties() )
+        {
+            if ( properties.isGen() )
+            {
+                if ( javaMemberNames.contains( properties.getJavaMemberName() ) )
+                {
+                    showErrorMessage( properties.getJavaMemberName() + " is used more than once." );
+                    return;
+                }
+                javaMemberNames.add( properties.getJavaMemberName() );
+
+            }
+        }
+
+        showErrorMessage( null );
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AttributeEditingSupport.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AttributeEditingSupport.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AttributeEditingSupport.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/AttributeEditingSupport.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,166 @@
+/*
+ *   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.directory.studio.persistence.view.wizards;
+
+
+import org.apache.directory.studio.persistence.core.EntryProperties;
+import org.apache.directory.studio.persistence.core.JavaType;
+import org.apache.directory.studio.persistence.core.Cardinality;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * TODO AttributeEditingSupport.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AttributeEditingSupport extends EditingSupport
+{
+    private Composite parent;
+    private CellEditor editor;
+    private int column;
+    private AddMembersWizardPage addMembersWizardPage;
+
+
+    /**
+     * Creates a new instance of AttributeEditingSupport.
+     *
+     * @param viewer
+     */
+    public AttributeEditingSupport( ColumnViewer viewer, int column, AddMembersWizardPage wizardPage )
+    {
+        super( viewer );
+        this.column = column;
+        this.addMembersWizardPage = wizardPage;
+        this.parent = ( ( TableViewer ) viewer ).getTable();
+
+        switch ( column )
+        {
+            case 1:
+                editor = new TextCellEditor( parent );
+                break;
+            case 2:
+                editor = new ComboBoxCellEditor( parent, JavaType.getStrings() );
+                break;
+            case 3:
+                editor = new ComboBoxCellEditor( parent, Cardinality.getStrings() );
+                break;
+            default:
+                editor = new TextCellEditor( parent );
+                break;
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.EditingSupport#canEdit(java.lang.Object)
+     */
+    @Override
+    protected boolean canEdit( Object element )
+    {
+        return true;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
+     */
+    @Override
+    protected CellEditor getCellEditor( Object element )
+    {
+        return editor;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
+     */
+    @Override
+    protected Object getValue( Object element )
+    {
+        EntryProperties info = ( EntryProperties ) element;
+        switch ( this.column )
+        {
+            case 0:
+                return info.getLdapAttributeName();
+            case 1:
+                return info.getJavaMemberName();
+            case 2:
+                return info.getJavaType().ordinal();
+            case 3:
+                return info.getCardinality().ordinal();
+            default:
+                break;
+        }
+        return null;
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
+     */
+    @Override
+    protected void setValue( Object element, Object value )
+    {
+        // TODO: Some code should be put here to verify that
+        // the input of the user does not collide with an existing
+        // java class member identifier.
+
+        // TODO: Refuse the input from the user and do not update the properties
+        // if the identifier is already used. 
+
+        EntryProperties entryProperties = ( EntryProperties ) element;
+        //entryProperties.setGen( isGen );
+        switch ( this.column )
+        {
+            case 0:
+                entryProperties.setLdapAttributeName( String.valueOf( value ) );
+                //entryProperties.setGen( isGen );
+                break;
+            case 1:
+                entryProperties.setJavaMemberName( String.valueOf( value ) );
+                addMembersWizardPage.dialogChanged();
+                break;
+            case 2:
+                Integer i = ( Integer ) value;
+                JavaType javaType = JavaType.values()[i];
+                entryProperties.setJavaType( javaType );
+                break;
+            case 3:
+                Integer j = ( Integer ) value;
+                Cardinality cardinality = Cardinality.values()[j];
+                entryProperties.setCardinality( cardinality );
+                break;
+            default:
+                break;
+        }
+
+        getViewer().update( element, null );
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/DaoRequiredParametersWizardPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/DaoRequiredParametersWizardPage.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/DaoRequiredParametersWizardPage.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/DaoRequiredParametersWizardPage.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,165 @@
+package org.apache.directory.studio.persistence.view.wizards;
+
+
+import org.apache.directory.studio.persistence.core.CodeGeneratorContext;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+
+public class DaoRequiredParametersWizardPage extends WizardPage
+{
+    private Text serverNameText;
+    private Text portNumberText;
+    private Text bindDnText;
+    private Text bindPasswordText;
+    private Text rdnAttributeText;
+    private Text parentDnText;
+    private Text objectClassesText;
+
+    private CodeGeneratorContext codeGenContext;
+
+
+    protected DaoRequiredParametersWizardPage()
+    {
+        super( "DaoRequiredParametersWizardPage" );
+        setTitle( "LDAP Parameters" );
+        setDescription( "LDAP parameters for DAO creation." );
+        // setImageDescriptor( //Image to be added );
+    }
+
+
+    public void createControl( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NULL );
+        GridLayout layout = new GridLayout( 2, false );
+        composite.setLayout( layout );
+        Label serverNameLabel = new Label( composite, SWT.NONE );
+        serverNameLabel.setText( "Server Name:" );
+        serverNameText = new Text( composite, SWT.BORDER );
+        serverNameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Label portNumberLabel = new Label( composite, SWT.NONE );
+        portNumberLabel.setText( "Port Number:" );
+        portNumberText = new Text( composite, SWT.BORDER );
+        portNumberText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Label nameLabel = new Label( composite, SWT.NONE );
+        nameLabel.setText( "Bind DN:" );
+        bindDnText = new Text( composite, SWT.BORDER );
+        bindDnText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Label credentialsLabel = new Label( composite, SWT.NONE );
+        credentialsLabel.setText( "Bind Password:" );
+        bindPasswordText = new Text( composite, SWT.BORDER );
+        bindPasswordText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Label rdnAttributeLabel = new Label( composite, SWT.NONE );
+        rdnAttributeLabel.setText( "RDN Attribute:" );
+        rdnAttributeText = new Text( composite, SWT.BORDER );
+        rdnAttributeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Label parentDnLabel = new Label( composite, SWT.NONE );
+        parentDnLabel.setText( "Parent DN:" );
+        parentDnText = new Text( composite, SWT.BORDER );
+        parentDnText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Label objectClassesLabel = new Label( composite, SWT.NONE );
+        objectClassesLabel.setText( "Object Classes:" );
+        objectClassesText = new Text( composite, SWT.BORDER );
+        objectClassesText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        initFields();
+
+        serverNameText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        portNumberText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        bindDnText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        bindPasswordText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        rdnAttributeText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        parentDnText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+        objectClassesText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        setControl( composite );
+
+    }
+
+
+    private void initFields()
+    {
+        serverNameText.setText( codeGenContext.getServer() );
+        portNumberText.setText( String.valueOf( codeGenContext.getPort() ) );
+        bindDnText.setText( codeGenContext.getBindDn() );
+        bindPasswordText.setText( codeGenContext.getBindPassword() );
+        rdnAttributeText.setText( codeGenContext.getRdnAttribute() );
+        parentDnText.setText( codeGenContext.getParentDn() );
+        for ( String objectClass : codeGenContext.getObjectClasses() )
+        {
+            objectClassesText.append( objectClass + "," );
+        }
+    }
+
+
+    private void dialogChanged()
+    {
+        codeGenContext.setServer( serverNameText.getText() );
+        codeGenContext.setPort( Integer.parseInt( portNumberText.getText() ) );
+        codeGenContext.setBindDn( bindDnText.getText() );
+        codeGenContext.setBindPassword( bindPasswordText.getText() );
+        codeGenContext.setRdnAttribute( rdnAttributeText.getText() );
+        codeGenContext.setParentDn( parentDnText.getText() );
+        String[] objClassOut = objectClassesText.getText().split( "," );
+        codeGenContext.setObjectClasses( objClassOut );
+    }
+
+
+    public void setCodeGenContext( CodeGeneratorContext codeGenContext )
+    {
+        this.codeGenContext = codeGenContext;
+    }
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryContentProvider.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryContentProvider.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryContentProvider.java Sat Aug 28 20:04:24 2010
@@ -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.directory.studio.persistence.view.wizards;
+
+
+import java.util.List;
+
+import org.apache.directory.studio.persistence.core.EntryProperties;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+public class EntryContentProvider implements IStructuredContentProvider
+{
+
+    @SuppressWarnings("unchecked")
+    public Object[] getElements( Object inputElement )
+    {
+        return ( ( List<EntryProperties> ) inputElement ).toArray();
+    }
+
+
+    public void dispose()
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+        
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryLabelProvider.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryLabelProvider.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/EntryLabelProvider.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,86 @@
+/*
+ *  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.directory.studio.persistence.view.wizards;
+
+
+import org.apache.directory.studio.persistence.core.EntryProperties;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+
+public class EntryLabelProvider implements ITableLabelProvider
+{
+
+    public Image getColumnImage( Object element, int columnIndex )
+    {
+        return null;
+    }
+
+
+    public String getColumnText( Object element, int columnIndex )
+    {
+        EntryProperties entryProperty = ( EntryProperties ) element;
+        switch ( columnIndex )
+        {
+            case 0:
+                return entryProperty.getLdapAttributeName();
+
+            case 1:
+                return entryProperty.getJavaMemberName();
+            case 2:
+                return entryProperty.getJavaType().toString();
+            case 3:
+                return entryProperty.getCardinality().toString();
+            default:
+                throw new RuntimeException( "Should not happen" );
+        }
+
+    }
+
+
+    public void addListener( ILabelProviderListener listener )
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    public void dispose()
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    public boolean isLabelProperty( Object element, String property )
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    public void removeListener( ILabelProviderListener listener )
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java Sat Aug 28 20:04:24 2010
@@ -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.directory.studio.persistence.view.wizards;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.persistence.core.CodeGeneratorContext;
+import org.apache.directory.studio.persistence.core.LdapEntryAnalyzer;
+import org.apache.directory.studio.persistence.core.CodeGenerator;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+public class NewPersistenceCodeWizard extends Wizard implements INewWizard
+{
+
+    private NewPersistenceCodeWizardPage codeWizardPage;
+    private AddMembersWizardPage membersWizardPage;
+    private IEntry entry;
+    private CodeGeneratorContext codeGeneratorContext;
+    private DaoRequiredParametersWizardPage requiredParametersWizardPage;
+
+
+    /**
+     * @return the entry
+     */
+    public IEntry getEntry()
+    {
+        return entry;
+    }
+
+
+    /**
+     * @param entry the entry to set
+     */
+    public void setEntry( IEntry entry )
+    {
+        this.entry = entry;
+    }
+
+
+    @Override
+    public boolean performFinish()
+    {
+        CodeGenerator codeGenerator = new CodeGenerator();
+        codeGenerator.generateCode( codeGeneratorContext, "java_template.vm" );
+        codeGenerator.generateGenericDaoCode( codeGeneratorContext, "genericLdapDao_template.vm" );
+        codeGenerator.generateDaoCode( codeGeneratorContext, "dao_template.vm" );
+        return true;
+    }
+
+
+    public void init( IWorkbench workbench, IStructuredSelection selection )
+    {
+        LdapEntryAnalyzer analyzer = new LdapEntryAnalyzer();
+        codeGeneratorContext = analyzer.analyze( getEntry() );
+        // Creating pages
+        codeWizardPage = new NewPersistenceCodeWizardPage();
+        membersWizardPage = new AddMembersWizardPage();
+        requiredParametersWizardPage = new DaoRequiredParametersWizardPage();
+        codeWizardPage.setEntryInformation( codeGeneratorContext );
+        membersWizardPage.setEntryInformation( codeGeneratorContext );
+        requiredParametersWizardPage.setCodeGenContext( codeGeneratorContext );
+    }
+
+
+    public void addPages()
+    {
+        // Adding pages
+        addPage( codeWizardPage );
+        addPage( membersWizardPage );
+        addPage( requiredParametersWizardPage );
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java Sat Aug 28 20:04:24 2010
@@ -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.directory.studio.persistence.view.wizards;
+
+
+import org.apache.directory.studio.persistence.core.CodeGeneratorContext;
+import org.apache.directory.studio.persistence.ui.Activator;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+
+public class NewPersistenceCodeWizardPage extends WizardPage
+{
+    private Text classNameText;
+    private Text packageNameText;
+    private Text projectFolderText;
+    private Button projectFolderButton;
+
+    private CodeGeneratorContext codeGenContext;
+
+
+    protected NewPersistenceCodeWizardPage()
+    {
+        super( "NewPersistenceCodeWizardPage" );
+        setTitle( "Java Class" );
+        setDescription( "Create a new Java Class from an existing LDAP entry." );
+        // setImageDescriptor( //Image to be added );
+        setPageComplete( false );
+    }
+
+
+    public void createControl( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NULL );
+        GridLayout layout = new GridLayout();
+        composite.setLayout( layout );
+
+        // Set Class name and package name
+        Group classPackageGroup = new Group( composite, SWT.NONE );
+        classPackageGroup.setText( "Set class name and package" );
+        classPackageGroup.setLayout( new GridLayout( 2, false ) );
+        classPackageGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        //name of the package
+        Label packageNameLabel = new Label( classPackageGroup, SWT.NONE );
+        packageNameLabel.setText( "Package Name:" );
+        packageNameText = new Text( classPackageGroup, SWT.BORDER );
+        packageNameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        //name of the class
+        Label classNameLabel = new Label( classPackageGroup, SWT.NONE );
+        classNameLabel.setText( "Class Name:" );
+        classNameText = new Text( classPackageGroup, SWT.BORDER );
+        classNameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        initFields();
+
+        packageNameText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        classNameText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+
+        setControl( composite );
+
+        // Select Project Folder Group
+        Group projectFolderGroup = new Group( composite, SWT.NONE );
+        projectFolderGroup.setText( "Select project Folder" );
+        projectFolderGroup.setLayout( new GridLayout( 3, false ) );
+        projectFolderGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Project Folder
+        Label fromDirectoryLabel = new Label( projectFolderGroup, SWT.NONE );
+        fromDirectoryLabel.setText( "To Project Folder:" );
+        projectFolderText = new Text( projectFolderGroup, SWT.BORDER );
+        projectFolderText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        projectFolderText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                dialogChanged();
+            }
+        } );
+        projectFolderButton = new Button( projectFolderGroup, SWT.PUSH );
+        projectFolderButton.setText( "Browse" );
+        projectFolderButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                setProjectFolder();
+            }
+        } );
+        dialogChanged();
+    }
+
+
+    private void initFields()
+    {
+        packageNameText.setText( codeGenContext.getPackageName() );
+        classNameText.setText( codeGenContext.getClassName() );
+    }
+
+
+    public void showErrorMessage( String message )
+    {
+        setMessage( null, DialogPage.NONE );
+        setErrorMessage( message );
+        setPageComplete( message == null );
+    }
+
+
+    private void dialogChanged()
+    {
+        if ( projectFolderText.getText().isEmpty() )
+        {
+            showErrorMessage( "No Project Folder is Selected." );
+            return;
+        }
+        else
+        {
+            setPageComplete( true );
+        }
+        codeGenContext.setClassName( classNameText.getText() );
+        codeGenContext.setPackageName( packageNameText.getText() );
+        //set the path is changed
+        codeGenContext.setProjectFolderPath( projectFolderText.getText() );
+        
+        showErrorMessage( null );
+    }
+
+
+    /**
+     * @param entryInformation the entryInformation to set
+     */
+    public void setEntryInformation( CodeGeneratorContext codeGenContext )
+    {
+        this.codeGenContext = codeGenContext;
+    }
+
+
+    public void setProjectFolder()
+    {
+        DirectoryDialog dialog = new DirectoryDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        dialog.setText( "Set Project Folder" );
+        dialog.setMessage( "Select Project Folder for generating code" );
+        if ( "".equals( projectFolderText.getText() ) )
+        {
+            dialog.setFilterPath( Activator.getDefault().getPreferenceStore().getString( "/home/kasun/eclipse" ) );
+        }
+        else
+        {
+            dialog.setFilterPath( projectFolderText.getText() );
+        }
+
+        String selectedDirectory = dialog.open();
+        if ( selectedDirectory != null )
+        {
+            projectFolderText.setText( selectedDirectory );
+            codeGenContext.setProjectFolderPath( selectedDirectory + "/src/main/java" );
+        }
+    }
+
+}

Added: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/TableColumnSorter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/TableColumnSorter.java?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/TableColumnSorter.java (added)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/TableColumnSorter.java Sat Aug 28 20:04:24 2010
@@ -0,0 +1,65 @@
+package org.apache.directory.studio.persistence.view.wizards;
+
+
+import org.apache.directory.studio.persistence.core.EntryProperties;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+
+public class TableColumnSorter extends ViewerSorter
+{
+    private int propertyIndex;
+    private static final int DESCENDING = 1;
+
+    private int direction = DESCENDING;
+
+
+    public TableColumnSorter()
+    {
+        this.propertyIndex = 0;
+        direction = DESCENDING - 1;
+    }
+
+
+    public void setColumn( int column )
+    {
+        if ( column == this.propertyIndex )
+        {
+            // Same column as last sort; toggle the direction
+            direction = 1 - direction;
+        }
+        else
+        {
+            // New column; do an ascending sort
+            this.propertyIndex = column;
+            direction = DESCENDING;
+        }
+    }
+
+
+    @Override
+    public int compare( Viewer viewer, Object e1, Object e2 )
+    {
+        EntryProperties ep1 = ( EntryProperties ) e1;
+        EntryProperties ep2 = ( EntryProperties ) e2;
+        int rc = 0;
+        switch ( propertyIndex )
+        {
+            case 0:
+                rc = ep1.getLdapAttributeName().compareTo( ep2.getLdapAttributeName() );
+                break;
+
+            case 1:
+                rc = ep1.getJavaMemberName().compareTo( ep2.getJavaMemberName() );
+                break;
+            default:
+                rc = 0;
+        }
+        // If descending order, flip the direction
+        if ( direction == DESCENDING )
+        {
+            rc = -rc;
+        }
+        return rc;
+    }
+}

Added: directory/sandbox/studio-persistence-tooling/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/pom.xml?rev=990428&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/pom.xml (added)
+++ directory/sandbox/studio-persistence-tooling/pom.xml Sat Aug 28 20:04:24 2010
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<!--
+  @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.studio</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.5.3.v20100330</version>
+  </parent>
+
+  <groupId>org.apache.directory.studio</groupId>
+  <artifactId>persistence-parent</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <name>Apache Directory Studio LDAP Persistence Tooling</name>
+  <packaging>pom</packaging>
+
+  <url>http://code.google.com/p/dirstudio-ldap-tooling/</url>
+
+  <organization>
+    <name>Apache Software Foundation</name>
+    <url>http://www.apache.org</url>
+  </organization>
+
+  <modules>
+    <module>persistence-core</module>
+    <module>persistence-ui</module>
+    <module>persistence-example</module>
+  </modules>
+  
+  <properties>
+    <apache.directory.studio.version>1.5.3.v20100330</apache.directory.studio.version>
+  </properties>
+  
+  <dependencyManagement>
+    <dependencies>
+      <!-- Modules dependencies -->
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>persistence.core</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>persistence.ui</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <!-- Apache Directory Studio dependencies -->
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>aciitemeditor</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>apacheds</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>apacheds.configuration</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>common.ui</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>connection.core</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>connection.ui</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>jars</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>ldapbrowser.common</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>ldapbrowser.core</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>ldapbrowser.ui</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>ldifparser</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>ldifeditor</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>schemaeditor</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>valueeditors</artifactId>
+        <version>${apache.directory.studio.version}</version>
+      </dependency>
+      <!-- External dependencies -->
+      <dependency>
+        <groupId>org.apache.velocity</groupId>
+        <artifactId>velocity</artifactId>
+        <version>1.6.4</version>
+      </dependency>
+      <dependency>
+        <groupId>org.mockito</groupId>
+        <artifactId>mockito-core</artifactId>
+        <version>1.8.5</version>
+      </dependency>
+      <dependency>
+        <groupId>org.powermock.modules</groupId>
+        <artifactId>powermock-module-junit4</artifactId>
+        <version>1.4</version>
+      </dependency>
+      <dependency>
+        <groupId>org.powermock.api</groupId>
+        <artifactId>powermock-api-mockito</artifactId>
+        <version>1.4</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <repositories>
+    <repository>
+      <id>powermock-repo</id>
+      <url>http://powermock.googlecode.com/svn/repo/</url>
+    </repository>
+  </repositories>
+
+</project>