You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 17:52:07 UTC

svn commit: r592082 [12/20] - in /directory/sandbox/felixk/studio-ldapbrowser-core: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ s...

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,781 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.events.AttributeAddedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.AttributeDeletedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.AttributesInitializedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ChildrenInitializedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EmptyValueAddedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EmptyValueDeletedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EntryUpdateListener;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueAddedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueDeletedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueModifiedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.ValueRenamedEvent;
+import org.apache.directory.studio.ldapbrowser.core.internal.search.LdapSearchPageScoreComputer;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.URL;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Subschema;
+import org.eclipse.search.ui.ISearchPageScoreComputer;
+
+
+/**
+ * An implementation of {@link IEntry} that just holds another instance
+ * of {@link IEntry} and delegates all method calls to this instance.
+ * It is used for bookmarks, alias and referral entries.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DelegateEntry implements IEntry, EntryUpdateListener
+{
+
+    private static final long serialVersionUID = -4488685394817691963L;
+
+    /** The connection id. */
+    private String connectionId;
+
+    /** The DN. */
+    private LdapDN dn;
+
+    /** The entry does not exist flag. */
+    private boolean entryDoesNotExist;
+
+    /** The delegate. */
+    private IEntry delegate;
+
+
+    protected DelegateEntry()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of DelegateEntry.
+     * 
+     * @param connection the connection of the delegate
+     * @param dn the DN of the delegate
+     */
+    public DelegateEntry( IBrowserConnection connection, LdapDN dn )
+    {
+        this.connectionId = connection.getConnection().getId();
+        this.dn = dn;
+        this.entryDoesNotExist = false;
+        this.delegate = null;
+        EventRegistry.addEntryUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner() );
+    }
+
+
+    /**
+     * Gets the delegate.
+     * 
+     * @return the delegate, may be null if the delegate doesn't exist.
+     */
+    protected IEntry getDelegate()
+    {
+        if ( delegate != null
+            && !delegate.getBrowserConnection().getConnection().getJNDIConnectionWrapper().isConnected() )
+        {
+            entryDoesNotExist = false;
+            delegate = null;
+        }
+        return delegate;
+    }
+
+
+    /**
+     * Sets the delegate.
+     * 
+     * @param delegate the new delegate
+     */
+    protected void setDelegate( IEntry delegate )
+    {
+        this.delegate = delegate;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getBrowserConnection();
+        }
+        else
+        {
+            return BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById( connectionId );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapDN getDn()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getDn();
+        }
+        else
+        {
+            return dn;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public URL getUrl()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getUrl();
+        }
+        else
+        {
+            return new URL( getBrowserConnection(), getDn() );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAttributesInitialized()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().isAttributesInitialized();
+        }
+        else if ( entryDoesNotExist )
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isChildrenInitialized()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().isChildrenInitialized();
+        }
+        else if ( entryDoesNotExist )
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDirectoryEntry()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().isDirectoryEntry();
+        }
+        else
+        {
+            return true;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAttribute( IAttribute attributeToAdd )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().addAttribute( attributeToAdd );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addChild( IEntry childrenToAdd )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().addChild( childrenToAdd );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteAttribute( IAttribute attributeToDelete )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().deleteAttribute( attributeToDelete );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteChild( IEntry childrenToDelete )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().deleteChild( childrenToDelete );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IAttribute getAttribute( String attributeDescription )
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getAttribute( attributeDescription );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeHierarchy getAttributeWithSubtypes( String attributeDescription )
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getAttributeWithSubtypes( attributeDescription );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IAttribute[] getAttributes()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getAttributes();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IEntry getParententry()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getParententry();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Rdn getRdn()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getRdn();
+        }
+        else
+        {
+            Rdn rdn = dn.getRdn();
+            return rdn == null ? new Rdn() : rdn;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IEntry[] getChildren()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getChildren();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getChildrenCount()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getChildrenCount();
+        }
+        else
+        {
+            return -1;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getChildrenFilter()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getChildrenFilter();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Subschema getSubschema()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().getSubschema();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasMoreChildren()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().hasMoreChildren();
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasParententry()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().hasParententry();
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasChildren()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().hasChildren();
+        }
+        else
+        {
+            return true;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isConsistent()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().isConsistent();
+        }
+        else
+        {
+            return true;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAttributesInitialized( boolean b )
+    {
+        if ( !b )
+        {
+            if ( getDelegate() != null )
+            {
+                getDelegate().setAttributesInitialized( b );
+            }
+            setDelegate( null );
+            entryDoesNotExist = false;
+        }
+        else
+        {
+            if ( getDelegate() == null )
+            {
+                setDelegate( getBrowserConnection().getEntryFromCache( dn ) );
+                if ( getDelegate() == null )
+                {
+                    // entry doesn't exist!
+                    entryDoesNotExist = true;
+                }
+            }
+            if ( getDelegate() != null )
+            {
+                getDelegate().setAttributesInitialized( b );
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setDirectoryEntry( boolean b )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().setDirectoryEntry( b );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setHasMoreChildren( boolean b )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().setHasMoreChildren( b );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setHasChildrenHint( boolean b )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().setHasChildrenHint( b );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildrenFilter( String filter )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().setChildrenFilter( filter );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildrenInitialized( boolean b )
+    {
+        if ( !b )
+        {
+            if ( getDelegate() != null )
+            {
+                getDelegate().setChildrenInitialized( b );
+            }
+            entryDoesNotExist = false;
+        }
+        else
+        {
+            if ( this.getDelegate() == null )
+            {
+                setDelegate( getBrowserConnection().getEntryFromCache( dn ) );
+                if ( this.getDelegate() == null )
+                {
+                    // entry doesn't exist!
+                    entryDoesNotExist = true;
+                }
+            }
+            if ( getDelegate() != null )
+            {
+                getDelegate().setChildrenInitialized( b );
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAlias()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().isAlias();
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAlias( boolean b )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().setAlias( b );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isReferral()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().isReferral();
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setReferral( boolean b )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().setReferral( b );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSubentry()
+    {
+        if ( getDelegate() != null )
+        {
+            return getDelegate().isSubentry();
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSubentry( boolean b )
+    {
+        if ( getDelegate() != null )
+        {
+            getDelegate().setSubentry( b );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void entryUpdated( EntryModificationEvent event )
+    {
+        if ( event.getModifiedEntry() == getDelegate() )
+        {
+            if ( event instanceof AttributeAddedEvent )
+            {
+                AttributeAddedEvent e = ( AttributeAddedEvent ) event;
+                AttributeAddedEvent delegateEvent = new AttributeAddedEvent( e.getConnection(), this, e
+                    .getAddedAttribute() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof AttributeDeletedEvent )
+            {
+                AttributeDeletedEvent e = ( AttributeDeletedEvent ) event;
+                AttributeDeletedEvent delegateEvent = new AttributeDeletedEvent( e.getConnection(), this, e
+                    .getDeletedAttribute() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof AttributesInitializedEvent )
+            {
+                AttributesInitializedEvent delegateEvent = new AttributesInitializedEvent( this );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof EmptyValueAddedEvent )
+            {
+                EmptyValueAddedEvent e = ( EmptyValueAddedEvent ) event;
+                EmptyValueAddedEvent delegateEvent = new EmptyValueAddedEvent( e.getConnection(), this, e
+                    .getModifiedAttribute(), e.getAddedValue() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof EmptyValueDeletedEvent )
+            {
+                EmptyValueDeletedEvent e = ( EmptyValueDeletedEvent ) event;
+                EmptyValueDeletedEvent delegateEvent = new EmptyValueDeletedEvent( e.getConnection(), this, e
+                    .getModifiedAttribute(), e.getDeletedValue() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof ChildrenInitializedEvent )
+            {
+                ChildrenInitializedEvent delegateEvent = new ChildrenInitializedEvent( this );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof ValueAddedEvent )
+            {
+                ValueAddedEvent e = ( ValueAddedEvent ) event;
+                ValueAddedEvent delegateEvent = new ValueAddedEvent( e.getConnection(), this, e.getModifiedAttribute(),
+                    e.getAddedValue() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof ValueDeletedEvent )
+            {
+                ValueDeletedEvent e = ( ValueDeletedEvent ) event;
+                ValueDeletedEvent delegateEvent = new ValueDeletedEvent( e.getConnection(), this, e
+                    .getModifiedAttribute(), e.getDeletedValue() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof ValueModifiedEvent )
+            {
+                ValueModifiedEvent e = ( ValueModifiedEvent ) event;
+                ValueModifiedEvent delegateEvent = new ValueModifiedEvent( e.getConnection(), this, e
+                    .getModifiedAttribute(), e.getOldValue(), e.getNewValue() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+            else if ( event instanceof ValueRenamedEvent )
+            {
+                ValueRenamedEvent e = ( ValueRenamedEvent ) event;
+                ValueRenamedEvent delegateEvent = new ValueRenamedEvent( e.getConnection(), this, e.getOldValue(), e
+                    .getNewValue() );
+                EventRegistry.fireEntryUpdated( delegateEvent, this );
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Object getAdapter( Class adapter )
+    {
+        if ( adapter.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        {
+            return new LdapSearchPageScoreComputer();
+        }
+        if ( adapter == IBrowserConnection.class )
+        {
+            return this.getBrowserConnection();
+        }
+        if ( adapter == IEntry.class )
+        {
+            return this;
+        }
+        return null;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DirectoryMetadataEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DirectoryMetadataEntry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DirectoryMetadataEntry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DirectoryMetadataEntry.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,101 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+
+
+/**
+ * The DirectoryMetadataEntry class represents entries that are listed in the root DSE.
+ * Examples are the schema sub-entry, the monitorContext or the configContext entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DirectoryMetadataEntry extends BaseDNEntry
+{
+
+    private static final long serialVersionUID = 1340597532850853276L;
+
+    /** The schema entry flag. */
+    private boolean schemaEntry;
+
+
+    protected DirectoryMetadataEntry()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of DirectoryMetadataEntry.
+     * 
+     * @param dn the DN
+     * @param browserConnection the browser connection
+     */
+    public DirectoryMetadataEntry( LdapDN dn, IBrowserConnection browserConnection )
+    {
+        super();
+        this.baseDn = dn;
+        this.browserConnection = browserConnection;
+        this.schemaEntry = false;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.impl.AbstractEntry#hasChildren()
+     */
+    public boolean hasChildren()
+    {
+        if ( getDn().equals( getBrowserConnection().getSchema().getDn() ) )
+        {
+            return false;
+        }
+        else
+        {
+            return super.hasChildren();
+        }
+    }
+
+
+    /**
+     * Checks if is schema entry.
+     * 
+     * @return true, if is schema entry
+     */
+    public boolean isSchemaEntry()
+    {
+        return schemaEntry;
+    }
+
+
+    /**
+     * Sets the schema entry flag.
+     * 
+     * @param schemaEntry the schema entry flag
+     */
+    public void setSchemaEntry( boolean schemaEntry )
+    {
+        this.schemaEntry = schemaEntry;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DirectoryMetadataEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyConnection.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyConnection.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyConnection.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyConnection.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,278 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.ldapbrowser.core.BookmarkManager;
+import org.apache.directory.studio.ldapbrowser.core.SearchManager;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
+import org.apache.directory.studio.ldapbrowser.core.model.URL;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+
+
+/**
+ * Connection without any operation. It could be used to make model modifications
+ * without committing these modifications to the directory.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DummyConnection implements IBrowserConnection
+{
+
+    private static final long serialVersionUID = 3671686808330691741L;
+
+    /** The schema. */
+    private Schema schema;
+
+
+    /**
+     * Creates a new instance of DummyConnection.
+     * 
+     * @param schema the schema
+     */
+    public DummyConnection( Schema schema )
+    {
+        this.schema = schema;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public LdapDN getBaseDN()
+    {
+        return LdapDN.EMPTY_LDAPDN;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public BookmarkManager getBookmarkManager()
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public int getCountLimit()
+    {
+        return 0;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public AliasDereferencingMethod getAliasesDereferencingMethod()
+    {
+        return AliasDereferencingMethod.NEVER;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public IEntry getEntryFromCache( LdapDN dn )
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public IRootDSE getRootDSE()
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public Schema getSchema()
+    {
+        return schema;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public SearchManager getSearchManager()
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public int getTimeLimit()
+    {
+        return 0;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean isFetchBaseDNs()
+    {
+        return false;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setBaseDN( LdapDN baseDN )
+    {
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setCountLimit( int countLimit )
+    {
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setAliasesDereferencingMethod( AliasDereferencingMethod aliasesDereferencingMethod )
+    {
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setFetchBaseDNs( boolean fetchBaseDNs )
+    {
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setSchema( Schema schema )
+    {
+        this.schema = schema;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setTimeLimit( int timeLimit )
+    {
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Object getAdapter( Class adapter )
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public Object clone()
+    {
+        return this;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public ModificationLogger getModificationLogger()
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public ReferralHandlingMethod getReferralsHandlingMethod()
+    {
+        return ReferralHandlingMethod.IGNORE;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setReferralsHandlingMethod( ReferralHandlingMethod referralsHandlingMethod )
+    {
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public URL getUrl()
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public Connection getConnection()
+    {
+        return null;
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void cacheEntry( IEntry entry )
+    {
+    }
+
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void uncacheEntryRecursive( IEntry entry )
+    {
+    }
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,495 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.events.AttributeAddedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.AttributeDeletedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.URL;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Subschema;
+
+
+/**
+ * An {@link DummyEntry} is an implementation if {@link IEntry} that doesn't 
+ * represent a directory entry. 
+ * 
+ * Most methods do nothing. It isn't possible to add child entries.
+ * It only contains a map for attributes and a connection to retrieve
+ * schema information. 
+ * 
+ * It is used for temporary {@link IEntry} objects, e.g. in the new entry wizard. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DummyEntry implements IEntry
+{
+
+    private static final long serialVersionUID = 4833907766031149971L;
+
+    /** The DN. */
+    private LdapDN dn;
+
+    /** The dummy connection. */
+    private DummyConnection dummyConnection;
+
+    /** The connection id. */
+    private String connectionId;
+
+    /** The attribute map. */
+    private Map<String, IAttribute> attributeMap;
+
+
+    protected DummyEntry()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of DummyEntry.
+     * 
+     * @param dn the DN
+     * @param browserConnection the browser connection
+     */
+    public DummyEntry( LdapDN dn, IBrowserConnection browserConnection )
+    {
+        if ( browserConnection instanceof DummyConnection )
+        {
+            this.dummyConnection = ( DummyConnection ) browserConnection;
+        }
+        else
+        {
+            this.connectionId = browserConnection.getConnection().getId();
+        }
+
+        this.dn = dn;
+        attributeMap = new LinkedHashMap<String, IAttribute>();
+    }
+
+
+    /**
+     * Sets the DN.
+     * 
+     * @param dn the new DN
+     */
+    public void setDn( LdapDN dn )
+    {
+        this.dn = dn;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAttribute( IAttribute attributeToAdd )
+    {
+        attributeMap.put( attributeToAdd.getDescription().toLowerCase(), attributeToAdd );
+        EventRegistry.fireEntryUpdated( new AttributeAddedEvent( attributeToAdd.getEntry().getBrowserConnection(),
+            this, attributeToAdd ), this );
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void addChild( IEntry childrenToAdd )
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteAttribute( IAttribute attributeToDelete )
+    {
+        attributeMap.remove( attributeToDelete.getDescription().toLowerCase() );
+        EventRegistry.fireEntryUpdated( new AttributeDeletedEvent( attributeToDelete.getEntry().getBrowserConnection(),
+            this, attributeToDelete ), this );
+    }
+
+
+    public void deleteChild( IEntry childrenToDelete )
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IAttribute getAttribute( String attributeDescription )
+    {
+        return attributeMap.get( attributeDescription.toLowerCase() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeHierarchy getAttributeWithSubtypes( String attributeDescription )
+    {
+        AttributeDescription ad = new AttributeDescription( attributeDescription );
+
+        List<IAttribute> attributeList = new ArrayList<IAttribute>();
+        for ( IAttribute attribute : attributeList )
+        {
+            AttributeDescription other = new AttributeDescription( attributeDescription );
+            if ( other.isSubtypeOf( ad, getBrowserConnection().getSchema() ) )
+            {
+                attributeList.add( attribute );
+            }
+        }
+
+        if ( attributeList.isEmpty() )
+        {
+            return null;
+        }
+        else
+        {
+            AttributeHierarchy ah = new AttributeHierarchy( this, attributeDescription, attributeList
+                .toArray( new IAttribute[attributeList.size()] ) );
+            return ah;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IAttribute[] getAttributes()
+    {
+        return attributeMap.values().toArray( new IAttribute[attributeMap.size()] );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        return dummyConnection != null ? dummyConnection : BrowserCorePlugin.getDefault().getConnectionManager()
+            .getBrowserConnectionById( this.connectionId );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapDN getDn()
+    {
+        return dn;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public URL getUrl()
+    {
+        return new URL( getBrowserConnection(), getDn() );
+    }
+
+
+    /**
+     * This implementation always returns null.
+     */
+    public IEntry getParententry()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Rdn getRdn()
+    {
+        Rdn rdn = dn.getRdn();
+        return rdn == null ? new Rdn() : rdn;
+    }
+
+
+    /**
+     * This implementation always returns null.
+     */
+    public IEntry[] getChildren()
+    {
+        return null;
+    }
+
+
+    /**
+     * This implementation always returns -1.
+     */
+    public int getChildrenCount()
+    {
+        return -1;
+    }
+
+
+    /**
+     * This implementation always returns the empty string.
+     */
+    public String getChildrenFilter()
+    {
+        return ""; //$NON-NLS-1$
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Subschema getSubschema()
+    {
+        return new Subschema( this );
+    }
+
+
+    /**
+     * This implementation always returns false.
+     */
+    public boolean hasMoreChildren()
+    {
+        return false;
+    }
+
+
+    /**
+     * This implementation always returns false.
+     */
+    public boolean hasParententry()
+    {
+        return false;
+    }
+
+
+    /**
+     * This implementation always returns false.
+     */
+    public boolean hasChildren()
+    {
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAlias()
+    {
+        return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_ALIAS );
+    }
+
+
+    /**
+     * This implementation always returns true.
+     */
+    public boolean isAttributesInitialized()
+    {
+        return true;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isConsistent()
+    {
+        // check empty attributes and empty values
+        Iterator<IAttribute> attributeIterator = attributeMap.values().iterator();
+        while ( attributeIterator.hasNext() )
+        {
+            IAttribute attribute = attributeIterator.next();
+            if ( !attribute.isConsistent() )
+                return false;
+        }
+
+        // check objectClass attribute
+        if ( !attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() ) )
+        {
+            return false;
+        }
+        IAttribute ocAttribute = attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() );
+        String[] ocValues = ocAttribute.getStringValues();
+        boolean structuralObjectClassAvailable = false;
+        for ( int i = 0; i < ocValues.length; i++ )
+        {
+            ObjectClassDescription ocd = this.getBrowserConnection().getSchema()
+                .getObjectClassDescription( ocValues[i] );
+            if ( ocd.isStructural() )
+            {
+                structuralObjectClassAvailable = true;
+                break;
+            }
+        }
+        if ( !structuralObjectClassAvailable )
+        {
+            return false;
+        }
+
+        // check must-attributes
+        String[] mustAttributeNames = getSubschema().getMustAttributeNames();
+        for ( int i = 0; i < mustAttributeNames.length; i++ )
+        {
+            if ( !attributeMap.containsKey( mustAttributeNames[i].toLowerCase() ) )
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+
+    /**
+     * This implementation always returns false.
+     */
+    public boolean isDirectoryEntry()
+    {
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isReferral()
+    {
+        return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_REFERRAL );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSubentry()
+    {
+        return Arrays.asList( this.getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_SUBENTRY );
+    }
+
+
+    /**
+     * This implementation always returns false.
+     */
+    public boolean isChildrenInitialized()
+    {
+        return false;
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setAlias( boolean b )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setAttributesInitialized( boolean b )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setDirectoryEntry( boolean isDirectoryEntry )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setHasMoreChildren( boolean b )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setHasChildrenHint( boolean b )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setReferral( boolean b )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setSubentry( boolean b )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setChildrenFilter( String filter )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void setChildrenInitialized( boolean b )
+    {
+    }
+
+
+    /**
+     * This implementation always returns null.
+     */
+    @SuppressWarnings("unchecked")
+    public Object getAdapter( Class adapter )
+    {
+        return null;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,126 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
+
+
+/**
+ * The Entry class represents an entry with a logical parent entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Entry extends AbstractEntry
+{
+
+    private static final long serialVersionUID = -4718107307581983276L;
+
+    /** The RDN. */
+    protected Rdn rdn;
+
+    /** The parent entry. */
+    protected IEntry parent;
+
+
+    protected Entry()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of Entry.
+     * 
+     * @param parent the parent entry
+     * @param rdn the RDN
+     */
+    public Entry( IEntry parent, Rdn rdn )
+    {
+        assert parent != null;
+        assert rdn != null;
+        assert !"".equals( rdn.toString() );
+
+        this.parent = parent;
+        this.rdn = rdn;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.impl.AbstractEntry#getRdn()
+     */
+    public Rdn getRdn()
+    {
+        // performance opt.
+        return rdn;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IEntry#getDn()
+     */
+    public LdapDN getDn()
+    {
+        LdapDN dn = DnUtils.composeDn( rdn, parent.getDn() );
+        return dn;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IEntry#getParententry()
+     */
+    public IEntry getParententry()
+    {
+        return parent;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IEntry#getBrowserConnection()
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        return getParententry().getBrowserConnection();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.impl.AbstractEntry#setRdn(org.apache.directory.studio.ldapbrowser.core.model.RDN)
+     */
+    protected void setRdn( Rdn newRdn )
+    {
+        this.rdn = newRdn;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.impl.AbstractEntry#setParent(org.apache.directory.studio.ldapbrowser.core.model.IEntry)
+     */
+    protected void setParent( IEntry newParent )
+    {
+        this.parent = newParent;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Entry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ModificationLogger.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ModificationLogger.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ModificationLogger.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ModificationLogger.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,407 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.logging.FileHandler;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import javax.naming.InvalidNameException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.ldap.Control;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.studio.connection.core.IModificationLogger;
+import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeAddRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeDeleteRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeModDnRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeModifyRecord;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifModSpec;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifAttrValLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifCommentLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifDeloldrdnLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifModSpecSepLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifNewrdnLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifNewsuperiorLine;
+import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifSepLine;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
+
+
+/**
+ * The ModificationLogger is used to log modifications into a file.
+ *
+ * TODO: LDIF of DSML logging
+ * TODO: switch off logging
+ * TODO: log controls
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ModificationLogger implements IModificationLogger
+{
+
+    /** The browser connection. */
+    private BrowserConnection browserConnection;
+
+    /** The file handler. */
+    private FileHandler fileHandler;
+
+    /** The logger. */
+    private Logger logger;
+
+
+    /**
+     * Creates a new instance of ModificationLogger.
+     * 
+     * @param browserConnection the browser connection
+     */
+    public ModificationLogger( BrowserConnection browserConnection )
+    {
+        this.browserConnection = browserConnection;
+    }
+
+
+    /**
+     * Inits the modification logger.
+     */
+    private void initModificationLogger()
+    {
+        this.logger = Logger.getAnonymousLogger();
+        this.logger.setLevel( Level.ALL );
+
+        String logfileName = BrowserConnectionManager.getModificationLogFileName( browserConnection );
+        try
+        {
+            fileHandler = new FileHandler( logfileName, 100000, 10, true );
+            fileHandler.setFormatter( new Formatter()
+            {
+                public String format( LogRecord record )
+                {
+                    return record.getMessage();
+                }
+            } );
+            this.logger.addHandler( fileHandler );
+        }
+        catch ( SecurityException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( IOException e )
+        {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * Disposes the modification logger.
+     */
+    public void dispose()
+    {
+        if ( this.logger != null )
+        {
+            Handler[] handlers = this.logger.getHandlers();
+            for ( int i = 0; i < handlers.length; i++ )
+            {
+                handlers[i].close();
+            }
+
+            this.logger = null;
+        }
+    }
+
+
+    /**
+     * Logs the given text.
+     * 
+     * @param text the text to log
+     * @param ex the naming exception if an error occurred, null otherwise
+     */
+    private void log( String text, NamingException ex )
+    {
+        if ( logger == null )
+        {
+            if ( browserConnection.getConnection().getName() != null )
+            {
+                initModificationLogger();
+            }
+        }
+
+        if ( logger != null )
+        {
+            DateFormat df = new SimpleDateFormat( BrowserCoreConstants.DATEFORMAT );
+
+            if ( ex != null )
+            {
+                logger.log( Level.ALL, LdifCommentLine.create( "#!RESULT ERROR" ).toFormattedString() ); //$NON-NLS-1$
+            }
+            else
+            {
+                logger.log( Level.ALL, LdifCommentLine.create( "#!RESULT OK" ).toFormattedString() ); //$NON-NLS-1$
+            }
+
+            logger
+                .log(
+                    Level.ALL,
+                    LdifCommentLine
+                        .create(
+                            "#!CONNECTION ldap://" + browserConnection.getConnection().getHost() + ":" + browserConnection.getConnection().getPort() ).toFormattedString() ); //$NON-NLS-1$ //$NON-NLS-2$
+            logger.log( Level.ALL, LdifCommentLine.create( "#!DATE " + df.format( new Date() ) ).toFormattedString() ); //$NON-NLS-1$
+
+            if ( ex != null )
+            {
+                String errorComment = "#!ERROR " + ex.getMessage(); //$NON-NLS-1$
+                errorComment = errorComment.replaceAll( "\r", " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                errorComment = errorComment.replaceAll( "\n", " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                LdifCommentLine errorCommentLine = LdifCommentLine.create( errorComment );
+                logger.log( Level.ALL, errorCommentLine.toFormattedString() );
+            }
+
+            logger.log( Level.ALL, text );
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeAdd(java.lang.String, javax.naming.directory.Attributes, javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeAdd( final String dn, final Attributes attributes, final Control[] controls,
+        NamingException ex )
+    {
+        try
+        {
+            LdifChangeAddRecord record = LdifChangeAddRecord.create( dn );
+            //record.addControl( controlLine );
+            NamingEnumeration<? extends Attribute> attributeEnumeration = attributes.getAll();
+            while ( attributeEnumeration.hasMore() )
+            {
+                Attribute attribute = attributeEnumeration.next();
+                String attributeName = attribute.getID();
+                NamingEnumeration<?> valueEnumeration = attribute.getAll();
+                while ( valueEnumeration.hasMore() )
+                {
+                    Object o = valueEnumeration.next();
+                    if ( o instanceof String )
+                    {
+                        record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) );
+                    }
+                    if ( o instanceof byte[] )
+                    {
+                        record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) );
+                    }
+                }
+            }
+            record.finish( LdifSepLine.create() );
+
+            String formattedString = record.toFormattedString();
+            log( formattedString, ex );
+        }
+        catch ( NamingException e )
+        {
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeDelete(java.lang.String, javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeDelete( final String dn, final Control[] controls, NamingException ex )
+    {
+        LdifChangeDeleteRecord record = LdifChangeDeleteRecord.create( dn );
+        //record.addControl( controlLine );
+        record.finish( LdifSepLine.create() );
+
+        String formattedString = record.toFormattedString();
+        log( formattedString, ex );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeModify(java.lang.String, javax.naming.directory.ModificationItem[], javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeModify( final String dn, final ModificationItem[] modificationItems,
+        final Control[] controls, NamingException ex )
+    {
+        try
+        {
+            LdifChangeModifyRecord record = LdifChangeModifyRecord.create( dn );
+            //record.addControl( controlLine );
+            for ( ModificationItem item : modificationItems )
+            {
+                Attribute attribute = item.getAttribute();
+                String attributeDescription = attribute.getID();
+                LdifModSpec modSpec;
+                switch ( item.getModificationOp() )
+                {
+                    case DirContext.ADD_ATTRIBUTE:
+                        modSpec = LdifModSpec.createAdd( attributeDescription );
+                        break;
+                    case DirContext.REMOVE_ATTRIBUTE:
+                        modSpec = LdifModSpec.createDelete( attributeDescription );
+                        break;
+                    case DirContext.REPLACE_ATTRIBUTE:
+                        modSpec = LdifModSpec.createReplace( attributeDescription );
+                        break;
+                    default:
+                        continue;
+                }
+                NamingEnumeration<?> valueEnumeration = attribute.getAll();
+                while ( valueEnumeration.hasMore() )
+                {
+                    Object o = valueEnumeration.next();
+                    if ( o instanceof String )
+                    {
+                        modSpec.addAttrVal( LdifAttrValLine.create( attributeDescription, ( String ) o ) );
+                    }
+                    if ( o instanceof byte[] )
+                    {
+                        modSpec.addAttrVal( LdifAttrValLine.create( attributeDescription, ( byte[] ) o ) );
+                    }
+                }
+                modSpec.finish( LdifModSpecSepLine.create() );
+
+                record.addModSpec( modSpec );
+            }
+            record.finish( LdifSepLine.create() );
+
+            String formattedString = record.toFormattedString();
+            log( formattedString, ex );
+        }
+        catch ( NamingException e )
+        {
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.core.IModificationLogger#logChangetypeModDn(java.lang.String, java.lang.String, boolean, javax.naming.ldap.Control[], javax.naming.NamingException)
+     */
+    public void logChangetypeModDn( final String oldDn, final String newDn, final boolean deleteOldRdn,
+        final Control[] controls, NamingException ex )
+    {
+        try
+        {
+            LdapDN dn = new LdapDN( newDn );
+            Rdn newrdn = dn.getRdn();
+            LdapDN newsuperior = DnUtils.getParent( dn );
+
+            LdifChangeModDnRecord record = LdifChangeModDnRecord.create( oldDn );
+            //record.addControl( controlLine );
+            record.setNewrdn( LdifNewrdnLine.create( newrdn.getUpName() ) );
+            record.setDeloldrdn( deleteOldRdn ? LdifDeloldrdnLine.create1() : LdifDeloldrdnLine.create0() );
+            record.setNewsuperior( LdifNewsuperiorLine.create( newsuperior.getUpName() ) );
+            record.finish( LdifSepLine.create() );
+
+            String formattedString = record.toFormattedString();
+            log( formattedString, ex );
+        }
+        catch ( InvalidNameException e )
+        {
+        }
+    }
+
+
+    /**
+     * Gets the files.
+     * 
+     * @return the files
+     */
+    public File[] getFiles()
+    {
+        if ( this.logger == null )
+        {
+            if ( browserConnection.getConnection().getName() != null )
+            {
+                this.initModificationLogger();
+            }
+        }
+
+        try
+        {
+            return getLogFiles( this.fileHandler );
+        }
+        catch ( Exception e )
+        {
+            return new File[0];
+        }
+    }
+
+
+    /**
+     * Gets the log files.
+     * 
+     * @param fileHandler the file handler
+     * 
+     * @return the log files
+     * 
+     * @throws Exception the exception
+     */
+    private static File[] getLogFiles( FileHandler fileHandler ) throws Exception
+    {
+        Field field = getFieldFromClass( "java.util.logging.FileHandler", "files" ); //$NON-NLS-1$ //$NON-NLS-2$
+        field.setAccessible( true );
+        File[] files = ( File[] ) field.get( fileHandler );
+        return files;
+    }
+
+
+    /**
+     * Gets the field from class.
+     * 
+     * @param className the class name
+     * @param fieldName the field name
+     * 
+     * @return the field from class
+     * 
+     * @throws Exception the exception
+     */
+    private static Field getFieldFromClass( String className, String fieldName ) throws Exception
+    {
+        Class<?> clazz = Class.forName( className );
+        Field[] fields = clazz.getDeclaredFields();
+
+        for ( int i = 0; i < fields.length; i++ )
+        {
+            if ( fields[i].getName().equals( fieldName ) )
+                return fields[i];
+        }
+        return null;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ModificationLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/OpenBrowserConnectionsJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/OpenBrowserConnectionsJob.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/OpenBrowserConnectionsJob.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/OpenBrowserConnectionsJob.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,201 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.StudioProgressMonitor;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.jobs.AbstractNotificationJob;
+import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesJob;
+import org.apache.directory.studio.ldapbrowser.core.jobs.ReloadSchemasJob;
+import org.apache.directory.studio.ldapbrowser.core.jobs.SearchJob;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.core.model.SearchParameter;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch.SearchScope;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+
+
+/**
+ * Job to open the browser connection.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenBrowserConnectionsJob extends AbstractNotificationJob
+{
+
+    /** The browser connection. */
+    private BrowserConnection browserConnection;
+
+
+    /**
+     * Creates a new instance of OpenBrowserConnectionsJob.
+     * 
+     * @param browserConnection the browser connection
+     */
+    public OpenBrowserConnectionsJob( BrowserConnection browserConnection )
+    {
+        this.browserConnection = browserConnection;
+        setName( BrowserCoreMessages.jobs__open_connections_name_1 );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getConnections()
+     */
+    protected Connection[] getConnections()
+    {
+        return new Connection[0];
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getLockedObjects()
+     */
+    protected Object[] getLockedObjects()
+    {
+        return new Object[]
+            { browserConnection };
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getErrorMessage()
+     */
+    protected String getErrorMessage()
+    {
+        return BrowserCoreMessages.jobs__open_connections_error_1;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractNotificationJob#executeNotificationJob(org.apache.directory.studio.connection.core.StudioProgressMonitor)
+     */
+    protected void executeNotificationJob( StudioProgressMonitor monitor )
+    {
+        monitor.beginTask( " ", 1 * 6 + 1 ); //$NON-NLS-1$
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+
+        monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__open_connections_task, new String[]
+            { this.browserConnection.getConnection().getName() } ) );
+        monitor.worked( 1 );
+
+        openBrowserConnection( browserConnection, monitor );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractNotificationJob#runNotification()
+     */
+    protected void runNotification()
+    {
+    }
+
+
+    /**
+     * Opens the browser connection.
+     * 
+     * @param browserConnection the browser connection
+     * @param monitor the progress monitor
+     */
+    static void openBrowserConnection( IBrowserConnection browserConnection, StudioProgressMonitor monitor )
+    {
+        IRootDSE rootDSE = browserConnection.getRootDSE();
+        InitializeAttributesJob.initializeAttributes( rootDSE, true, monitor );
+
+        // check schema reload
+        if ( rootDSE != null )
+        {
+            try
+            {
+                monitor.reportProgress( BrowserCoreMessages.model__loading_schema );
+
+                // check if schema is cached
+                Schema schema = browserConnection.getSchema();
+                if ( schema == Schema.DEFAULT_SCHEMA )
+                {
+                    ReloadSchemasJob.reloadSchema( browserConnection, monitor );
+                }
+                else if ( rootDSE.getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY ) != null )
+                {
+                    // check if schema is up-to-date
+                    SearchParameter sp = new SearchParameter();
+                    sp.setSearchBase( new LdapDN( rootDSE.getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY )
+                        .getStringValue() ) );
+                    sp.setFilter( Schema.SCHEMA_FILTER );
+                    sp.setScope( SearchScope.OBJECT );
+                    sp.setReturningAttributes( new String[]
+                        { IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP,
+                            IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP, } );
+                    ISearch search = new Search( browserConnection, sp );
+
+                    SearchJob.searchAndUpdateModel( browserConnection, search, monitor );
+                    ISearchResult[] results = search.getSearchResults();
+
+                    if ( results != null && results.length == 1 )
+                    {
+                        String schemaTimestamp = results[0]
+                            .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP ) != null ? results[0]
+                            .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP ).getStringValue() : null;
+                        if ( schemaTimestamp == null )
+                        {
+                            schemaTimestamp = results[0]
+                                .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP ) != null ? results[0]
+                                .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP ).getStringValue()
+                                : null;
+                        }
+                        String cacheTimestamp = schema.getModifyTimestamp() != null ? schema.getModifyTimestamp()
+                            : schema.getCreateTimestamp();
+                        if ( cacheTimestamp == null
+                            || ( cacheTimestamp != null && schemaTimestamp != null && schemaTimestamp
+                                .compareTo( cacheTimestamp ) > 0 ) )
+                        {
+                            ReloadSchemasJob.reloadSchema( browserConnection, monitor );
+                        }
+                    }
+                    else
+                    {
+                        browserConnection.setSchema( Schema.DEFAULT_SCHEMA );
+                        monitor.reportError( BrowserCoreMessages.model__no_schema_information );
+                    }
+                }
+                else
+                {
+                    browserConnection.setSchema( Schema.DEFAULT_SCHEMA );
+                    monitor.reportError( BrowserCoreMessages.model__missing_schema_location );
+                }
+            }
+            catch ( Exception e )
+            {
+                browserConnection.setSchema( Schema.DEFAULT_SCHEMA );
+                monitor.reportError( BrowserCoreMessages.model__error_loading_schema, e );
+                e.printStackTrace();
+                return;
+            }
+        }
+    }
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/OpenBrowserConnectionsJob.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,57 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+
+
+/**
+ * An {@link ReferralBaseEntry} represents the target 
+ * (named by the ref attribute) of an referral entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ReferralBaseEntry extends DelegateEntry
+{
+
+    private static final long serialVersionUID = -6351277968774226912L;
+
+
+    protected ReferralBaseEntry()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of ReferralBaseEntry.
+     * 
+     * @param connection the connection of the referral target
+     * @param dn the DN of the referral target
+     */
+    public ReferralBaseEntry( IBrowserConnection connection, LdapDN dn )
+    {
+        super( connection, dn );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/RootDSE.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/RootDSE.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/RootDSE.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/RootDSE.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,128 @@
+/*
+ *  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.ldapbrowser.core.model.impl;
+
+
+import java.util.Arrays;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
+
+
+/**
+ * The RootDSE class represents a root DSE entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public final class RootDSE extends BaseDNEntry implements IRootDSE
+{
+
+    private static final long serialVersionUID = -8445018787232919754L;
+
+
+    protected RootDSE()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of RootDSE.
+     * 
+     * @param browserConnection the browser connection
+     */
+    public RootDSE( IBrowserConnection browserConnection )
+    {
+        super( LdapDN.EMPTY_LDAPDN, browserConnection );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.impl.BaseDNEntry#getParententry()
+     */
+    public IEntry getParententry()
+    {
+        return null;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IRootDSE#getSupportedExtensions()
+     */
+    public String[] getSupportedExtensions()
+    {
+        return getAttributeValues( IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDEXTENSION );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IRootDSE#getSupportedControls()
+     */
+    public String[] getSupportedControls()
+    {
+        return getAttributeValues( IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDCONTROL );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IRootDSE#getSupportedFeatures()
+     */
+    public String[] getSupportedFeatures()
+    {
+        return getAttributeValues( IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDFEATURES );
+    }
+
+
+    /**
+     * Gets the attribute values.
+     * 
+     * @param attributeDescription the attribute description
+     * 
+     * @return the attribute values
+     */
+    private String[] getAttributeValues( String attributeDescription )
+    {
+        IAttribute supportedFeaturesAttr = getAttribute( attributeDescription );
+        if ( supportedFeaturesAttr != null )
+        {
+            String[] stringValues = supportedFeaturesAttr.getStringValues();
+            Arrays.sort( stringValues );
+            return stringValues;
+        }
+        else
+        {
+            return new String[0];
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.impl.AbstractEntry#isSubentry()
+     */
+    public boolean isSubentry()
+    {
+        return false;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/RootDSE.java
------------------------------------------------------------------------------
    svn:eol-style = native