directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592082 [11/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...
Date Mon, 05 Nov 2007 16:52:07 GMT
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,798 @@
+/*
+ *  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.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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.EntryAddedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EntryDeletedEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.internal.search.LdapSearchPageScoreComputer;
+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.AttributeTypeDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Subschema;
+import org.eclipse.search.ui.ISearchPageScoreComputer;
+
+
+/**
+ * Base implementation of the {@link IEntry} interface.
+ * 
+ * The class is optimized to save memory. It doesn't hold members to 
+ * its children or attributes. Instead the {@link ChildrenInfo} and 
+ * {@link AttributeInfo} instances are stored in a map in the 
+ * {@link BrowserConnection} instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractEntry implements IEntry
+{
+
+    private static final int HAS_CHILDREN_HINT_FLAG = 1;
+
+    private static final int IS_DIRECTORY_ENTRY_FLAG = 2;
+
+    private static final int IS_ALIAS_FLAG = 4;
+
+    private static final int IS_REFERRAL_FLAG = 8;
+
+    private static final int IS_SUBENTRY_FLAG = 16;
+
+    private volatile int flags;
+
+
+    /**
+     * Creates a new instance of AbstractEntry.
+     */
+    protected AbstractEntry()
+    {
+        this.flags = HAS_CHILDREN_HINT_FLAG;
+    }
+
+
+    /**
+     * Sets the parent entry.
+     * 
+     * @param newParent the new parent entry
+     */
+    protected abstract void setParent( IEntry newParent );
+
+
+    /**
+     * Sets the RDN.
+     * 
+     * @param newRdn the new RDN
+     */
+    protected abstract void setRdn( Rdn newRdn );
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addChild( IEntry childToAdd )
+    {
+        ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+        if ( ci == null )
+        {
+            ci = new ChildrenInfo();
+            getBrowserConnectionImpl().setChildrenInfo( this, ci );
+        }
+
+        if ( ci.childrenSet == null )
+        {
+            ci.childrenSet = new LinkedHashSet<IEntry>();
+        }
+        ci.childrenSet.add( childToAdd );
+        entryModified( new EntryAddedEvent( childToAdd.getBrowserConnection(), childToAdd ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteChild( IEntry childToDelete )
+    {
+        ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+
+        if ( ci != null )
+        {
+            ci.childrenSet.remove( childToDelete );
+            if ( ci.childrenSet == null || ci.childrenSet.isEmpty() )
+            {
+                getBrowserConnectionImpl().setChildrenInfo( this, null );
+            }
+            entryModified( new EntryDeletedEvent( getBrowserConnectionImpl(), childToDelete ) );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAttribute( IAttribute attributeToAdd ) throws IllegalArgumentException
+    {
+        String oidString = attributeToAdd.getAttributeDescription().toOidString( getBrowserConnection().getSchema() );
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai == null )
+        {
+            ai = new AttributeInfo();
+            getBrowserConnectionImpl().setAttributeInfo( this, ai );
+        }
+
+        if ( !equals( attributeToAdd.getEntry() ) )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__attributes_entry_is_not_myself );
+        }
+        else if ( ai.attributeMap.containsKey( oidString.toLowerCase() ) )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__attribute_already_exists );
+        }
+        else
+        {
+            ai.attributeMap.put( oidString.toLowerCase(), attributeToAdd );
+            entryModified( new AttributeAddedEvent( getBrowserConnectionImpl(), this, attributeToAdd ) );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteAttribute( IAttribute attributeToDelete ) throws IllegalArgumentException
+    {
+        String oidString = attributeToDelete.getAttributeDescription().toOidString( getBrowserConnection().getSchema() );
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai != null && ai.attributeMap != null && ai.attributeMap.containsKey( oidString.toLowerCase() ) )
+        {
+            IAttribute attribute = ( IAttribute ) ai.attributeMap.get( oidString.toLowerCase() );
+            ai.attributeMap.remove( oidString.toLowerCase() );
+            if ( ai.attributeMap.isEmpty() )
+            {
+                getBrowserConnectionImpl().setAttributeInfo( this, null );
+            }
+            entryModified( new AttributeDeletedEvent( getBrowserConnectionImpl(), this, attribute ) );
+        }
+        else
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__attribute_does_not_exist );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isConsistent()
+    {
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai == null || ai.attributeMap == null )
+        {
+            return isDirectoryEntry();
+        }
+
+        // check empty attributes and empty values
+        Map<String, IAttribute> aiAttributeMap = new HashMap<String, IAttribute>( ai.attributeMap );
+        for ( IAttribute attribute : aiAttributeMap.values() )
+        {
+            if ( !attribute.isConsistent() )
+            {
+                return false;
+            }
+        }
+
+        if ( !isDirectoryEntry() )
+        {
+            // check objectclass attribute
+            if ( !ai.attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE_OID.toLowerCase() ) )
+            {
+                return false;
+            }
+            IAttribute ocAttribute = ( IAttribute ) ai.attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE_OID
+                .toLowerCase() );
+            String[] ocValues = ocAttribute.getStringValues();
+            boolean structuralObjectClassAvailable = false;
+            for ( int i = 0; i < ocValues.length; i++ )
+            {
+                ObjectClassDescription ocd = getBrowserConnection().getSchema().getObjectClassDescription( ocValues[i] );
+                if ( ocd.isStructural() )
+                {
+                    structuralObjectClassAvailable = true;
+                    break;
+                }
+            }
+            if ( !structuralObjectClassAvailable )
+            {
+                return false;
+            }
+
+            // check must-attributes
+            AttributeTypeDescription[] mustAtds = getSubschema().getMustAttributeTypeDescriptions();
+            for ( AttributeTypeDescription mustAtd : mustAtds )
+            {
+                if ( !ai.attributeMap.containsKey( mustAtd.getNumericOID().toLowerCase() ) )
+                {
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDirectoryEntry()
+    {
+        return ( flags & IS_DIRECTORY_ENTRY_FLAG ) != 0;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setDirectoryEntry( boolean isDirectoryEntry )
+    {
+        if ( isDirectoryEntry )
+        {
+            flags = flags | IS_DIRECTORY_ENTRY_FLAG;
+        }
+        else
+        {
+            flags = flags & ~IS_DIRECTORY_ENTRY_FLAG;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAlias()
+    {
+        if ( ( flags & IS_ALIAS_FLAG ) != 0 )
+        {
+            return true;
+        }
+
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai != null )
+        {
+            return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_ALIAS );
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAlias( boolean b )
+    {
+        if ( b )
+        {
+            flags = flags | IS_ALIAS_FLAG;
+        }
+        else
+        {
+            flags = flags & ~IS_ALIAS_FLAG;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isReferral()
+    {
+        if ( ( flags & IS_REFERRAL_FLAG ) != 0 )
+        {
+            return true;
+        }
+
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai != null )
+        {
+            return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_REFERRAL );
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setReferral( boolean b )
+    {
+        if ( b )
+        {
+            flags = flags | IS_REFERRAL_FLAG;
+        }
+        else
+        {
+            flags = flags & ~IS_REFERRAL_FLAG;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSubentry()
+    {
+        if ( ( flags & IS_SUBENTRY_FLAG ) != 0 )
+        {
+            return true;
+        }
+
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai != null )
+        {
+            return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_SUBENTRY );
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSubentry( boolean b )
+    {
+        if ( b )
+        {
+            flags = flags | IS_SUBENTRY_FLAG;
+        }
+        else
+        {
+            flags = flags & ~IS_SUBENTRY_FLAG;
+        }
+    }
+
+
+    /**
+     * Triggers firering of the modification event.
+     * 
+     * @param event
+     */
+    private void entryModified( EntryModificationEvent event )
+    {
+        EventRegistry.fireEntryUpdated( event, this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Rdn getRdn()
+    {
+        Rdn rdn = getDn().getRdn();
+        return rdn == null ? new Rdn() : rdn;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAttributesInitialized()
+    {
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        return ai != null && ai.attributesInitialized;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAttributesInitialized( boolean b )
+    {
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai == null && b )
+        {
+            ai = new AttributeInfo();
+            getBrowserConnectionImpl().setAttributeInfo( this, ai );
+        }
+
+        if ( ai != null )
+        {
+            ai.attributesInitialized = b;
+        }
+
+        if ( ai != null && !b )
+        {
+            ai.attributeMap.clear();
+            getBrowserConnectionImpl().setAttributeInfo( this, null );
+        }
+
+        entryModified( new AttributesInitializedEvent( this ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IAttribute[] getAttributes()
+    {
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai == null || ai.attributeMap == null )
+        {
+            return null;
+        }
+        else
+        {
+            return ( IAttribute[] ) ai.attributeMap.values().toArray( new IAttribute[0] );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IAttribute getAttribute( String attributeDescription )
+    {
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai == null || ai.attributeMap == null )
+        {
+            return null;
+        }
+        else
+        {
+            AttributeDescription ad = new AttributeDescription( attributeDescription );
+            String oidString = ad.toOidString( getBrowserConnection().getSchema() );
+            return ( IAttribute ) ai.attributeMap.get( oidString.toLowerCase() );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeHierarchy getAttributeWithSubtypes( String attributeDescription )
+    {
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai == null || ai.attributeMap == null )
+        {
+            return null;
+        }
+        else
+        {
+            List<IAttribute> attributeList = new ArrayList<IAttribute>();
+
+            IAttribute myAttribute = getAttribute( attributeDescription );
+            if ( myAttribute != null )
+            {
+                attributeList.add( myAttribute );
+            }
+
+            AttributeDescription ad = new AttributeDescription( attributeDescription );
+            Map<String, IAttribute> clonedAttributeMap = new HashMap<String, IAttribute>( ai.attributeMap );
+            for ( IAttribute attribute : clonedAttributeMap.values() )
+            {
+                AttributeDescription other = attribute.getAttributeDescription();
+                if ( other.isSubtypeOf( ad, getBrowserConnection().getSchema() ) )
+                {
+                    attributeList.add( attribute );
+                }
+            }
+
+            if ( attributeList.isEmpty() )
+            {
+                return null;
+            }
+            else
+            {
+                IAttribute[] attributes = attributeList.toArray( new IAttribute[attributeList.size()] );
+                AttributeHierarchy ah = new AttributeHierarchy( this, attributeDescription, attributes );
+                return ah;
+            }
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Subschema getSubschema()
+    {
+        AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+        if ( ai == null )
+        {
+            ai = new AttributeInfo();
+            getBrowserConnectionImpl().setAttributeInfo( this, ai );
+        }
+        if ( ai.subschema == null )
+        {
+            ai.subschema = new Subschema( this );
+        }
+
+        return ai.subschema;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildrenInitialized( boolean b )
+    {
+        ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+        if ( ci == null && b )
+        {
+            ci = new ChildrenInfo();
+            getBrowserConnectionImpl().setChildrenInfo( this, ci );
+        }
+
+        if ( ci != null )
+        {
+            ci.childrenInitialized = b;
+        }
+
+        if ( ci != null && !b )
+        {
+            if ( ci.childrenSet != null )
+            {
+                ci.childrenSet.clear();
+            }
+            getBrowserConnectionImpl().setChildrenInfo( this, null );
+        }
+
+        entryModified( new ChildrenInitializedEvent( this ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isChildrenInitialized()
+    {
+        ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+        return ci != null && ci.childrenInitialized;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IEntry[] getChildren()
+    {
+        int count = getChildrenCount();
+        if ( count < 0 )
+        {
+            return null;
+        }
+        else if ( count == 0 )
+        {
+            return new IEntry[0];
+        }
+        else
+        {
+            IEntry[] children = new IEntry[count];
+            ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+            int i = 0;
+            if ( ci.childrenSet != null )
+            {
+                for ( IEntry child : ci.childrenSet )
+                {
+                    children[i] = child;
+                    i++;
+                }
+            }
+            return children;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getChildrenCount()
+    {
+        if ( isSubentry() )
+        {
+            return 0;
+        }
+        ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+        if ( ci == null )
+        {
+            return -1;
+        }
+        else
+        {
+            return ci.childrenSet == null ? 0 : ci.childrenSet.size();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setHasMoreChildren( boolean b )
+    {
+        ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+        if ( ci == null )
+        {
+            ci = new ChildrenInfo();
+            getBrowserConnectionImpl().setChildrenInfo( this, ci );
+        }
+        ci.hasMoreChildren = b;
+
+        entryModified( new ChildrenInitializedEvent( this ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasMoreChildren()
+    {
+        ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+        return ci != null && ci.hasMoreChildren;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setHasChildrenHint( boolean b )
+    {
+        if ( b )
+        {
+            flags = flags | HAS_CHILDREN_HINT_FLAG;
+        }
+        else
+        {
+            flags = flags & ~HAS_CHILDREN_HINT_FLAG;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasChildren()
+    {
+        return ( flags & HAS_CHILDREN_HINT_FLAG ) != 0 || getChildrenCount() > 0;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getChildrenFilter()
+    {
+        return getBrowserConnectionImpl().getChildrenFilter( this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setChildrenFilter( String childrenFilter )
+    {
+        getBrowserConnectionImpl().setChildrenFilter( this, childrenFilter );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasParententry()
+    {
+        return getParententry() != null;
+    }
+
+
+    /**
+     * Gets the browser connection implementation.
+     * 
+     * @return the browser connection implementation
+     */
+    private BrowserConnection getBrowserConnectionImpl()
+    {
+        return ( BrowserConnection ) getBrowserConnection();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        return getDn().getUpName();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals( Object o )
+    {
+        // check argument
+        if ( o == null || !( o instanceof IEntry ) )
+        {
+            return false;
+        }
+        IEntry e = ( IEntry ) o;
+
+        // compare dn and connection
+        return getDn() == null ? e.getDn() == null : ( getDn().equals( e.getDn() ) && getBrowserConnection().equals(
+            e.getBrowserConnection() ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Object getAdapter( Class adapter )
+    {
+        Class<?> clazz = ( Class<?> ) adapter;
+        if ( clazz.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        {
+            return new LdapSearchPageScoreComputer();
+        }
+        if ( clazz.isAssignableFrom( Connection.class ) )
+        {
+            return getBrowserConnection().getConnection();
+        }
+        if ( clazz.isAssignableFrom( IBrowserConnection.class ) )
+        {
+            return getBrowserConnection();
+        }
+        if ( clazz.isAssignableFrom( IEntry.class ) )
+        {
+            return this;
+        }
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public URL getUrl()
+    {
+        return new URL( getBrowserConnection(), getDn() );
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.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 AliasBaseEntry} represents the target 
+ * (named by the aliasedObjectName attribute) of an alias entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AliasBaseEntry extends DelegateEntry
+{
+
+    private static final long serialVersionUID = -3599038109979581295L;
+
+
+    protected AliasBaseEntry()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of AliasBaseEntry.
+     * 
+     * @param connection the connection of the alias
+     * @param dn the DN of the alias target
+     */
+    public AliasBaseEntry( 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/AliasBaseEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Attribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Attribute.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Attribute.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Attribute.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,489 @@
+/*
+ *  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.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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.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.internal.search.LdapSearchPageScoreComputer;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeDescription;
+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.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
+import org.eclipse.search.ui.ISearchPageScoreComputer;
+
+
+/**
+ * Default implementation of IAttribute.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Attribute implements IAttribute
+{
+
+    /** The serialVersionUID. */
+    private static final long serialVersionUID = -5679384884002589786L;
+
+    /** The attribute description */
+    private AttributeDescription attributeDescription;
+
+    /** The entry this attribute belongs to */
+    private IEntry entry;
+
+    /** The values */
+    private List<IValue> valueList;
+
+
+    /**
+     * Creates an new instance of Attribute with the given description
+     * and no value.
+     * 
+     * @param entry
+     *                The entry of this attribute, mustn't be null
+     * @param description
+     *                The attribute descrption, mustn't be null.
+     */
+    public Attribute( IEntry entry, String description )
+    {
+        assert entry != null;
+        assert description != null;
+
+        this.entry = entry;
+        this.attributeDescription = new AttributeDescription( description );
+        this.valueList = new ArrayList<IValue>();
+
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IEntry getEntry()
+    {
+        return entry;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isConsistent()
+    {
+        if ( valueList.isEmpty() )
+        {
+            return false;
+        }
+
+        for ( IValue value : valueList )
+        {
+            if ( value.isEmpty() )
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMustAttribute()
+    {
+        if ( isObjectClassAttribute() )
+        {
+            return true;
+        }
+        else
+        {
+            String[] mustAttributeNames = getEntry().getSubschema().getMustAttributeNames();
+            for ( String must : mustAttributeNames )
+            {
+                if ( must.equalsIgnoreCase( getType() ) )
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMayAttribute()
+    {
+        return !isObjectClassAttribute() && !isMustAttribute() && !isOperationalAttribute();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isOperationalAttribute()
+    {
+        return getAttributeTypeDescription() == null || SchemaUtils.isOperational( getAttributeTypeDescription() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isObjectClassAttribute()
+    {
+        return OBJECTCLASS_ATTRIBUTE.equalsIgnoreCase( getDescription() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isString()
+    {
+        return !isBinary();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isBinary()
+    {
+        return getAttributeTypeDescription().isBinary();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addEmptyValue()
+    {
+        IValue emptyValue = new Value( this );
+        valueList.add( emptyValue );
+        attributeModified( new EmptyValueAddedEvent( getEntry().getBrowserConnection(), getEntry(), this, emptyValue ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteEmptyValue()
+    {
+        for ( Iterator<IValue> it = this.valueList.iterator(); it.hasNext(); )
+        {
+            IValue value = it.next();
+            if ( value.isEmpty() )
+            {
+                it.remove();
+                attributeModified( new EmptyValueDeletedEvent( getEntry().getBrowserConnection(), getEntry(), this,
+                    value ) );
+                return;
+            }
+        }
+    }
+
+
+    /**
+     * Fires an EntryModificationEvent.
+     *
+     * @param event the EntryModificationEvent
+     */
+    private void attributeModified( EntryModificationEvent event )
+    {
+        EventRegistry.fireEntryUpdated( event, getEntry() );
+    }
+
+
+    /**
+     * Checks if the given value is valid.
+     *
+     * @param value the value to check
+     * @throws IllegalArgumentException if the value is not valid
+     */
+    private void checkValue( IValue value ) throws IllegalArgumentException
+    {
+        if ( value == null )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__empty_value );
+        }
+        if ( !value.getAttribute().equals( this ) )
+        {
+            throw new IllegalArgumentException( BrowserCoreMessages.model__values_attribute_is_not_myself );
+        }
+    }
+
+
+    /**
+     * Deletes the given value from value list.
+     *
+     * @param valueToDelete the value to delete
+     * @return true if deleted
+     */
+    private boolean internalDeleteValue( IValue valueToDelete )
+    {
+        for ( Iterator<IValue> it = valueList.iterator(); it.hasNext(); )
+        {
+            IValue value = it.next();
+            if ( value.equals( valueToDelete ) )
+            {
+                it.remove();
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addValue( IValue valueToAdd ) throws IllegalArgumentException
+    {
+        checkValue( valueToAdd );
+        valueList.add( valueToAdd );
+        attributeModified( new ValueAddedEvent( getEntry().getBrowserConnection(), getEntry(), this, valueToAdd ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteValue( IValue valueToDelete ) throws IllegalArgumentException
+    {
+        checkValue( valueToDelete );
+
+        if ( internalDeleteValue( valueToDelete ) )
+        {
+            attributeModified( new ValueDeletedEvent( getEntry().getBrowserConnection(), getEntry(), this,
+                valueToDelete ) );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void modifyValue( IValue oldValue, IValue newValue ) throws IllegalArgumentException
+    {
+        checkValue( oldValue );
+        checkValue( newValue );
+
+        internalDeleteValue( oldValue );
+        valueList.add( newValue );
+        attributeModified( new ValueModifiedEvent( getEntry().getBrowserConnection(), getEntry(), this, oldValue,
+            newValue ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IValue[] getValues()
+    {
+        return ( IValue[] ) valueList.toArray( new IValue[0] );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getValueSize()
+    {
+        return valueList.size();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getDescription()
+    {
+        return getAttributeDescription().getDescription();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getType()
+    {
+        return getAttributeDescription().getParsedAttributeType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        return getDescription();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean equals( Object o )
+    {
+        // check argument
+        if ( o == null || !( o instanceof IAttribute ) )
+        {
+            return false;
+        }
+        IAttribute a = ( IAttribute ) o;
+
+        // compare entries
+        if ( !getEntry().equals( a.getEntry() ) )
+        {
+            return false;
+        }
+
+        // compare attribute description
+        return getDescription().equals( a.getDescription() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int hashCode()
+    {
+        return getDescription().hashCode();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[][] getBinaryValues()
+    {
+        List<byte[]> binaryValueList = new ArrayList<byte[]>();
+
+        IValue[] values = getValues();
+        for ( IValue value : values )
+        {
+            binaryValueList.add( value.getBinaryValue() );
+        }
+
+        return binaryValueList.toArray( new byte[0][] );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getStringValue()
+    {
+        if ( getValueSize() > 0 )
+        {
+            return ( ( IValue ) valueList.get( 0 ) ).getStringValue();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] getStringValues()
+    {
+        List<String> stringValueList = new ArrayList<String>();
+
+        IValue[] values = getValues();
+        for ( IValue value : values )
+        {
+            stringValueList.add( value.getStringValue() );
+        }
+
+        return stringValueList.toArray( new String[stringValueList.size()] );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeTypeDescription getAttributeTypeDescription()
+    {
+        return getEntry().getBrowserConnection().getSchema().getAttributeTypeDescription( getType() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Object getAdapter( Class adapter )
+    {
+        Class<?> clazz = ( Class<?> ) adapter;
+        if ( clazz.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        {
+            return new LdapSearchPageScoreComputer();
+        }
+        if ( clazz.isAssignableFrom( Connection.class ) )
+        {
+            return getEntry().getBrowserConnection().getConnection();
+        }
+        if ( clazz.isAssignableFrom( IBrowserConnection.class ) )
+        {
+            return getEntry().getBrowserConnection();
+        }
+        if ( clazz.isAssignableFrom( IEntry.class ) )
+        {
+            return getEntry();
+        }
+        if ( clazz.isAssignableFrom( IAttribute.class ) )
+        {
+            return this;
+        }
+
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public AttributeDescription getAttributeDescription()
+    {
+        return attributeDescription;
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,60 @@
+/*
+ *  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.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Subschema;
+
+
+/**
+ * A ChildrenInfo is used to hold the list of attributes of an entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeInfo implements Serializable
+{
+
+    private static final long serialVersionUID = -298229262461058833L;
+
+    /** The attributes initialized flag. */
+    protected volatile boolean attributesInitialized = false;
+
+    /** The attribute map. */
+    protected volatile Map<String, IAttribute> attributeMap = new LinkedHashMap<String, IAttribute>();
+
+    /** The subschema. */
+    protected volatile Subschema subschema = null;
+
+
+    /**
+     * Creates a new instance of AttributeInfo.
+     */
+    public AttributeInfo()
+    {
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BaseDNEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BaseDNEntry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BaseDNEntry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BaseDNEntry.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,112 @@
+/*
+ *  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;
+
+
+/**
+ * The BaseDNEntry class represents an entry without a logical parent entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BaseDNEntry extends AbstractEntry
+{
+
+    private static final long serialVersionUID = -5444229580355372176L;
+
+    /** The base DN. */
+    protected LdapDN baseDn;
+
+    /** The browser connection. */
+    protected IBrowserConnection browserConnection;
+
+
+    protected BaseDNEntry()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of BaseDNEntry.
+     * 
+     * @param baseDn the base DN
+     * @param browserConnection the browser connection
+     */
+    public BaseDNEntry( LdapDN baseDn, IBrowserConnection browserConnection )
+    {
+        assert baseDn != null;
+        assert browserConnection != null;
+
+        this.setDirectoryEntry( true );
+        this.baseDn = baseDn;
+        this.browserConnection = browserConnection;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IEntry#getDn()
+     */
+    public LdapDN getDn()
+    {
+        return baseDn;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IEntry#getParententry()
+     */
+    public IEntry getParententry()
+    {
+        return getBrowserConnection().getRootDSE();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.IEntry#getBrowserConnection()
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        return browserConnection;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.model.impl.AbstractEntry#setRdn(org.apache.directory.studio.ldapbrowser.core.model.RDN)
+     */
+    protected void setRdn( 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 )
+    {
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,217 @@
+/*
+ *  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.events.BookmarkUpdateEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.internal.search.LdapSearchPageScoreComputer;
+import org.apache.directory.studio.ldapbrowser.core.model.BookmarkParameter;
+import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.eclipse.search.ui.ISearchPageScoreComputer;
+
+
+/**
+ * Default implementation if IBookmark.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Bookmark implements IBookmark
+{
+
+    /** The serialVersionUID. */
+    private static final long serialVersionUID = 2914726541167255499L;
+
+    /** The connection. */
+    private IBrowserConnection connection;
+
+    /** The bookmark parameter. */
+    private BookmarkParameter bookmarkParameter;
+
+    /** The bookmark entry. */
+    private DelegateEntry bookmarkEntry;
+
+
+    /**
+     * Creates a new instance of Bookmark.
+     */
+    protected Bookmark()
+    {
+    }
+
+
+    /**
+     * Creates a new instance of Bookmark.
+     *
+     * @param connection the connection
+     * @param bookmarkParameter the bookmark parameter
+     */
+    public Bookmark( IBrowserConnection connection, BookmarkParameter bookmarkParameter )
+    {
+        this.connection = connection;
+        this.bookmarkParameter = bookmarkParameter;
+        this.bookmarkEntry = new DelegateEntry( connection, bookmarkParameter.getDn() );
+    }
+
+
+    /**
+     * Creates a new instance of Bookmark.
+     *
+     * @param connection the connection
+     * @param dn the target DN
+     * @param name the symbolic name
+     */
+    public Bookmark( IBrowserConnection connection, LdapDN dn, String name )
+    {
+        this.connection = connection;
+        this.bookmarkParameter = new BookmarkParameter( dn, name );
+        this.bookmarkEntry = new DelegateEntry( connection, dn );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapDN getDn()
+    {
+        return this.bookmarkParameter.getDn();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setDn( LdapDN dn )
+    {
+        this.bookmarkParameter.setDn( dn );
+        this.fireBookmarkUpdated( BookmarkUpdateEvent.Detail.BOOKMARK_UPDATED );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName()
+    {
+        return this.bookmarkParameter.getName();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setName( String name )
+    {
+        this.bookmarkParameter.setName( name );
+        this.fireBookmarkUpdated( BookmarkUpdateEvent.Detail.BOOKMARK_UPDATED );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Object getAdapter( Class adapter )
+    {
+        Class<?> clazz = ( Class<?> ) adapter;
+        if ( clazz.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        {
+            return new LdapSearchPageScoreComputer();
+        }
+        if ( clazz.isAssignableFrom( Connection.class ) )
+        {
+            return getBrowserConnection().getConnection();
+        }
+        if ( clazz.isAssignableFrom( IBrowserConnection.class ) )
+        {
+            return getBrowserConnection();
+        }
+        if ( clazz.isAssignableFrom( IEntry.class ) )
+        {
+            return getEntry();
+        }
+        if ( clazz.isAssignableFrom( IBookmark.class ) )
+        {
+            return this;
+        }
+
+        return null;
+    }
+
+
+    private void fireBookmarkUpdated( BookmarkUpdateEvent.Detail detail )
+    {
+        if ( this.getName() != null && !"".equals( this.getName() ) ) { //$NON-NLS-1$
+            EventRegistry.fireBookmarkUpdated( new BookmarkUpdateEvent( this, detail ), this );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public BookmarkParameter getBookmarkParameter()
+    {
+        return bookmarkParameter;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setBookmarkParameter( BookmarkParameter bookmarkParameter )
+    {
+        this.bookmarkParameter = bookmarkParameter;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        return this.connection;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IEntry getEntry()
+    {
+        return this.bookmarkEntry;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString()
+    {
+        return this.getName();
+    }
+
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,605 @@
+/*
+ *  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.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.InvalidNameException;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.ConnectionFolder;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
+import org.apache.directory.studio.ldapbrowser.core.BookmarkManager;
+import org.apache.directory.studio.ldapbrowser.core.SearchManager;
+import org.apache.directory.studio.ldapbrowser.core.events.BrowserConnectionUpdateEvent;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.internal.search.LdapSearchPageScoreComputer;
+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;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
+import org.eclipse.search.ui.ISearchPageScoreComputer;
+
+
+/**
+ * The default implementation of {@link IBrowserConnection}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserConnection implements ConnectionUpdateListener, IBrowserConnection, Serializable
+{
+
+    private static final long serialVersionUID = 2987596234755856270L;
+
+    /** The connection. */
+    private Connection connection;
+
+    /** The root DSE. */
+    private IRootDSE rootDSE;
+
+    /** The schema. */
+    private Schema schema;
+
+    /** The search manager. */
+    private SearchManager searchManager;
+
+    /** The bookmark manager. */
+    private BookmarkManager bookmarkManager;
+
+    /** The dn to entry cache. */
+    private volatile Map<String, IEntry> dnToEntryCache;
+
+    /** The entry to children filter map. */
+    private volatile Map<IEntry, String> entryToChildrenFilterMap;
+
+    /** The entry to attribute info map. */
+    private volatile Map<IEntry, AttributeInfo> entryToAttributeInfoMap;
+
+    /** The entry to children info map. */
+    private volatile Map<IEntry, ChildrenInfo> entryToChildrenInfoMap;
+
+    /** The modification logger. */
+    transient ModificationLogger modificationLogger;
+
+
+    /**
+     * Creates a new instance of BrowserConnection.
+     *
+     * @param connection the connection
+     */
+    public BrowserConnection( org.apache.directory.studio.connection.core.Connection connection )
+    {
+        this.connection = connection;
+
+        if ( connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_COUNT_LIMIT ) == null )
+        {
+            connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_COUNT_LIMIT, 0 );
+            connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_TIME_LIMIT, 0 );
+            connection.getConnectionParameter().setExtendedIntProperty(
+                CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD, AliasDereferencingMethod.NEVER.getOrdinal() );
+            connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+                ReferralHandlingMethod.IGNORE.getOrdinal() );
+            connection.getConnectionParameter().setExtendedBoolProperty( CONNECTION_PARAMETER_FETCH_BASE_DNS, true );
+            connection.getConnectionParameter().setExtendedProperty( CONNECTION_PARAMETER_BASE_DN, "" );
+        }
+
+        this.searchManager = new SearchManager( this );
+        this.bookmarkManager = new BookmarkManager( this );
+        this.modificationLogger = new ModificationLogger( this );
+
+        this.entryToChildrenFilterMap = new HashMap<IEntry, String>();
+        this.dnToEntryCache = new HashMap<String, IEntry>();
+        this.entryToAttributeInfoMap = new HashMap<IEntry, AttributeInfo>();
+        this.entryToChildrenInfoMap = new HashMap<IEntry, ChildrenInfo>();
+
+        this.schema = Schema.DEFAULT_SCHEMA;
+        this.rootDSE = new RootDSE( this );
+        cacheEntry( this.rootDSE );
+
+        this.connection.getJNDIConnectionWrapper().setModificationLogger( this.modificationLogger );
+
+        ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionCorePlugin.getDefault().getEventRunner() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public URL getUrl()
+    {
+        return new URL( this );
+    }
+
+
+    /**
+     * CClears all caches.
+     */
+    private void clearCaches()
+    {
+        for ( int i = 0; i < getSearchManager().getSearchCount(); i++ )
+        {
+            getSearchManager().getSearches()[i].setSearchResults( null );
+        }
+
+        dnToEntryCache.clear();
+        entryToAttributeInfoMap.clear();
+        entryToChildrenInfoMap.clear();
+        entryToChildrenFilterMap.clear();
+
+        schema = Schema.DEFAULT_SCHEMA;
+        rootDSE = new RootDSE( this );
+        cacheEntry( rootDSE );
+
+        System.gc();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public IEntry getEntryFromCache( LdapDN dn )
+    {
+        String oidDn = DnUtils.getNormalizedOidString( dn, getSchema() );
+        if ( dnToEntryCache != null && dnToEntryCache.containsKey( oidDn ) )
+        {
+            return dnToEntryCache.get( oidDn );
+        }
+        if ( getRootDSE().getDn().equals( dn ) )
+        {
+            return getRootDSE();
+        }
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isFetchBaseDNs()
+    {
+        return connection.getConnectionParameter().getExtendedBoolProperty( CONNECTION_PARAMETER_FETCH_BASE_DNS );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setFetchBaseDNs( boolean fetchBaseDNs )
+    {
+        connection.getConnectionParameter().setExtendedBoolProperty( CONNECTION_PARAMETER_FETCH_BASE_DNS, fetchBaseDNs );
+        ConnectionEventRegistry.fireConnectionUpdated( connection, this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public LdapDN getBaseDN()
+    {
+        try
+        {
+            return new LdapDN( connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_BASE_DN ) );
+        }
+        catch ( InvalidNameException e )
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setBaseDN( LdapDN baseDN )
+    {
+        connection.getConnectionParameter().setExtendedProperty( CONNECTION_PARAMETER_BASE_DN, baseDN.toString() );
+        ConnectionEventRegistry.fireConnectionUpdated( connection, this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getCountLimit()
+    {
+        return connection.getConnectionParameter().getExtendedIntProperty( CONNECTION_PARAMETER_COUNT_LIMIT );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCountLimit( int countLimit )
+    {
+        connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_COUNT_LIMIT, countLimit );
+        ConnectionEventRegistry.fireConnectionUpdated( connection, this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public AliasDereferencingMethod getAliasesDereferencingMethod()
+    {
+        int ordinal = connection.getConnectionParameter().getExtendedIntProperty(
+            CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD );
+        return AliasDereferencingMethod.getByOrdinal( ordinal );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAliasesDereferencingMethod( AliasDereferencingMethod aliasesDereferencingMethod )
+    {
+        connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
+            aliasesDereferencingMethod.getOrdinal() );
+        ConnectionEventRegistry.fireConnectionUpdated( connection, this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ReferralHandlingMethod getReferralsHandlingMethod()
+    {
+        int ordinal = connection.getConnectionParameter().getExtendedIntProperty(
+            CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
+        return ReferralHandlingMethod.getByOrdinal( ordinal );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setReferralsHandlingMethod( ReferralHandlingMethod referralsHandlingMethod )
+    {
+        connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+            referralsHandlingMethod.getOrdinal() );
+        ConnectionEventRegistry.fireConnectionUpdated( connection, this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getTimeLimit()
+    {
+        return connection.getConnectionParameter().getExtendedIntProperty( CONNECTION_PARAMETER_TIME_LIMIT );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setTimeLimit( int timeLimit )
+    {
+        connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_TIME_LIMIT, timeLimit );
+        ConnectionEventRegistry.fireConnectionUpdated( connection, this );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public final IRootDSE getRootDSE()
+    {
+        return rootDSE;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Schema getSchema()
+    {
+        return schema;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSchema( Schema schema )
+    {
+        this.schema = schema;
+    }
+
+
+    /**
+     * This implementation returns the connection name
+     */
+    public String toString()
+    {
+        return getConnection().getName();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public SearchManager getSearchManager()
+    {
+        return searchManager;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public BookmarkManager getBookmarkManager()
+    {
+        return bookmarkManager;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ModificationLogger getModificationLogger()
+    {
+        return modificationLogger;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Object getAdapter( Class adapter )
+    {
+        Class<?> clazz = ( Class<?> ) adapter;
+        if ( clazz.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        {
+            return new LdapSearchPageScoreComputer();
+        }
+        if ( clazz.isAssignableFrom( IBrowserConnection.class ) )
+        {
+            return this;
+        }
+
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public synchronized void cacheEntry( IEntry entry )
+    {
+        dnToEntryCache.put( DnUtils.getNormalizedOidString( entry.getDn(), getSchema() ), entry );
+    }
+
+
+    /**
+     * Removes the entry from the cache.
+     * 
+     * @param entry the entry to remove from cache
+     */
+    protected synchronized void uncacheEntry( IEntry entry )
+    {
+        dnToEntryCache.remove( DnUtils.getNormalizedOidString( entry.getDn(), getSchema() ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public synchronized void uncacheEntryRecursive( IEntry entry )
+    {
+        IEntry[] children = entry.getChildren();
+        if ( entry.getChildren() != null )
+        {
+            for ( int i = 0; i < children.length; i++ )
+            {
+                uncacheEntryRecursive( children[i] );
+            }
+        }
+        uncacheEntry( entry );
+    }
+
+
+    /**
+     * Removes the entry from the cache.
+     * 
+     * @param dn the DN of the entry to remove from cache
+     */
+    protected synchronized void uncacheEntry( LdapDN dn )
+    {
+        dnToEntryCache.remove( DnUtils.getNormalizedOidString( dn, getSchema() ) );
+    }
+
+
+    /**
+     * Gets the children filter of the entry.
+     * 
+     * @param entry the entry
+     * 
+     * @return the children filter of the entry, or null if no children filter is set
+     */
+    protected String getChildrenFilter( IEntry entry )
+    {
+        return entryToChildrenFilterMap == null ? null : entryToChildrenFilterMap.get( entry );
+    }
+
+
+    /**
+     * Sets the children filter.
+     * 
+     * @param entry the entry
+     * @param childrenFilter the children filter, null to remove the children filter
+     */
+    protected void setChildrenFilter( IEntry entry, String childrenFilter )
+    {
+        if ( childrenFilter == null || "".equals( childrenFilter ) ) //$NON-NLS-1$
+        {
+            entryToChildrenFilterMap.remove( entry );
+        }
+        else
+        {
+            entryToChildrenFilterMap.put( entry, childrenFilter );
+        }
+    }
+
+
+    /**
+     * Gets the attribute info.
+     * 
+     * @param entry the entry
+     * 
+     * @return the attribute info, null if no attribute info exists
+     */
+    protected AttributeInfo getAttributeInfo( IEntry entry )
+    {
+        return entryToAttributeInfoMap == null ? null : entryToAttributeInfoMap.get( entry );
+    }
+
+
+    /**
+     * Sets the attribute info.
+     * 
+     * @param entry the entry
+     * @param ai the attribute info, null to remove the attribute info
+     */
+    protected void setAttributeInfo( IEntry entry, AttributeInfo ai )
+    {
+        if ( ai == null )
+        {
+            entryToAttributeInfoMap.remove( entry );
+        }
+        else
+        {
+            entryToAttributeInfoMap.put( entry, ai );
+        }
+    }
+
+
+    /**
+     * Gets the children info.
+     * 
+     * @param entry the entry
+     * 
+     * @return the children info, null if no children info exists
+     */
+    protected ChildrenInfo getChildrenInfo( IEntry entry )
+    {
+        return entryToChildrenInfoMap == null ? null : entryToChildrenInfoMap.get( entry );
+    }
+
+
+    /**
+     * Sets the children info.
+     * 
+     * @param entry the entry
+     * @param ci the children info, null to remove the children info
+     */
+    protected void setChildrenInfo( IEntry entry, ChildrenInfo ci )
+    {
+        if ( ci == null )
+        {
+            entryToChildrenInfoMap.remove( entry );
+        }
+        else
+        {
+            entryToChildrenInfoMap.put( entry, ci );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Connection getConnection()
+    {
+        return connection;
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void connectionAdded( org.apache.directory.studio.connection.core.Connection connection )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void connectionRemoved( org.apache.directory.studio.connection.core.Connection connection )
+    {
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void connectionUpdated( org.apache.directory.studio.connection.core.Connection connection )
+    {
+    }
+
+
+    /**
+     * This implementation opens the browser connection when the connection was opened.
+     */
+    public void connectionOpened( Connection connection )
+    {
+        if ( this.connection == connection )
+        {
+            new OpenBrowserConnectionsJob( this ).execute();
+            BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent( this,
+                BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_OPENED );
+            EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent, this );
+        }
+    }
+
+
+    /**
+     * This implementation closes the browser connection when the connection was closed.
+     */
+    public void connectionClosed( Connection connection )
+    {
+        if ( this.connection == connection )
+        {
+            clearCaches();
+            BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent( this,
+                BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_CLOSED );
+            EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent, this );
+        }
+    }
+
+
+    /**
+     * This implementation does nothing.
+     */
+    public void connectionFolderModified( ConnectionFolder connectionFolder )
+    {
+    }
+}

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

Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java Mon Nov  5 08:51:43 2007
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.ldapbrowser.core.model.impl;
+
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * A ChildrenInfo is used to hold the list of children entries
+ * of a parent entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ChildrenInfo implements Serializable
+{
+
+    private static final long serialVersionUID = -4642987611142312896L;
+
+    /** The children initialized flag. */
+    protected volatile boolean childrenInitialized = false;
+
+    /** The children set. */
+    protected volatile Set<IEntry> childrenSet = null;
+
+    /** The has more children flag. */
+    protected volatile boolean hasMoreChildren = false;
+
+
+    /**
+     * Creates a new instance of ChildrenInfo.
+     */
+    public ChildrenInfo()
+    {
+    }
+
+}

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



Mime
View raw message