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 [3/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/ sr...
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,92 @@
+/*
+ * 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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+
+
+/**
+ * An BrowserConnectionUpdateEvent indicates that an {@link IBrowserConnection} was modified.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserConnectionUpdateEvent
+{
+
+ /**
+ * Contains constants to specify the event detail.
+ */
+ public enum Detail
+ {
+ /** Indicates that the browser connection was opened. */
+ BROWSER_CONNECTION_OPENED,
+
+ /** Indicates that the browser connection was closed. */
+ BROWSER_CONNECTION_CLOSED,
+
+ /** Indicates that the schema was updated. */
+ SCHEMA_UPDATED
+ }
+
+ /** The event detail. */
+ private Detail detail;
+
+ /** The updated browser connection. */
+ private IBrowserConnection browserConnection;
+
+
+ /**
+ * Creates a new instance of BrowserConnectionUpdateEvent.
+ *
+ * @param browserConnection the updated browser connection
+ * @param detail the event detail
+ */
+ public BrowserConnectionUpdateEvent( IBrowserConnection browserConnection, Detail detail )
+ {
+ this.browserConnection = browserConnection;
+ this.detail = detail;
+ }
+
+
+ /**
+ * Gets the updated browser connection.
+ *
+ * @return the updated browser connection
+ */
+ public IBrowserConnection getBrowserConnection()
+ {
+ return browserConnection;
+ }
+
+
+ /**
+ * Gets the event detail.
+ *
+ * @return the event detail
+ */
+ public Detail getDetail()
+ {
+ return detail;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.events;
+
+
+import java.util.EventListener;
+
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+
+
+/**
+ * A listener for {@link BrowserConnectionUpdateEvent}s
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface BrowserConnectionUpdateListener extends EventListener
+{
+
+ /**
+ * Called when an {@link IBrowserConnection} was updated.
+ *
+ * @param browserConnectionUpdateEvent the browser connection update event
+ */
+ public void browserConnectionUpdated( BrowserConnectionUpdateEvent browserConnectionUpdateEvent );
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BulkModificationEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BulkModificationEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BulkModificationEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BulkModificationEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.core.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+
+
+/**
+ * An BulkModificationEvent indicates that a bulk modification has occured.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BulkModificationEvent extends EntryModificationEvent
+{
+
+ /**
+ * Creates a new instance of BulkModificationEvent.
+ *
+ * @param connection the connection
+ */
+ public BulkModificationEvent( IBrowserConnection connection )
+ {
+ super( connection, connection.getRootDSE() );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.event__bulk_modification;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BulkModificationEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * A ChildrenInitializedEvent indicates that the children
+ * of an {@link IEntry} were newly initialized from the underlying
+ * directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ChildrenInitializedEvent extends EntryModificationEvent
+{
+
+ /**
+ * Creates a new instance of ChildrenInitializedEvent.
+ *
+ * @param initializedEntry the initialized entry
+ */
+ public ChildrenInitializedEvent( IEntry initializedEntry )
+ {
+ super( initializedEntry.getBrowserConnection(), initializedEntry );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__dn_children_initialized, new String[]
+ { getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/CoreEventRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/CoreEventRunner.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/CoreEventRunner.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/CoreEventRunner.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.events;
+
+
+/**
+ * Default implementation of {@link EventRunner} that executes an {@link EventRunnable}
+ * withing the current thread.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CoreEventRunner implements EventRunner
+{
+
+ /**
+ * {@inheritDoc}
+ *
+ * This implementation executes the given {@link EventRunnable} within
+ * the current thread.
+ */
+ public void execute( EventRunnable runnable )
+ {
+ runnable.run();
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/CoreEventRunner.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.core.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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;
+
+
+/**
+ * An EmptyValueAddedEvent indicates that an empty {@link IValue} was added to an {@link IEntry}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EmptyValueAddedEvent extends EntryModificationEvent
+{
+
+ /** The modified attribute. */
+ private IAttribute modifiedAttribute;
+
+ /** The added value. */
+ private IValue addedValue;
+
+
+ /**
+ * Creates a new instance of EmptyValueAddedEvent.
+ *
+ * @param connection the connection
+ * @param modifiedEntry the modified entry
+ * @param modifiedAttribute the modified attribute
+ * @param addedValue the added value
+ */
+ public EmptyValueAddedEvent( IBrowserConnection connection, IEntry modifiedEntry, IAttribute modifiedAttribute,
+ IValue addedValue )
+ {
+ super( connection, modifiedEntry );
+ this.modifiedAttribute = modifiedAttribute;
+ this.addedValue = addedValue;
+ }
+
+
+ /**
+ * Gets the modified attribute.
+ *
+ * @return the modified attribute
+ */
+ public IAttribute getModifiedAttribute()
+ {
+ return this.modifiedAttribute;
+ }
+
+
+ /**
+ * Gets the added value.
+ *
+ * @return the added value
+ */
+ public IValue getAddedValue()
+ {
+ return this.addedValue;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__empty_value_added_to_att_at_dn, new String[]
+ { getModifiedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.core.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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;
+
+
+/**
+ * An EmptyValueDeletedEvent indicates that an empty {@link IValue} was deleted from an {@link IEntry}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EmptyValueDeletedEvent extends EntryModificationEvent
+{
+
+ /** The modified attribute. */
+ private IAttribute modifiedAttribute;
+
+ /** The deleted value. */
+ private IValue deletedValue;
+
+
+ /**
+ * Creates a new instance of EmptyValueDeletedEvent.
+ *
+ * @param connection the connection
+ * @param modifiedEntry the modified entry
+ * @param modifiedAttribute the modified attribute
+ * @param deletedValue the deleted value
+ */
+ public EmptyValueDeletedEvent( IBrowserConnection connection, IEntry modifiedEntry, IAttribute modifiedAttribute,
+ IValue deletedValue )
+ {
+ super( connection, modifiedEntry );
+ this.modifiedAttribute = modifiedAttribute;
+ this.deletedValue = deletedValue;
+ }
+
+
+ /**
+ * Gets the modified attribute.
+ *
+ * @return the modified attribute
+ */
+ public IAttribute getModifiedAttribute()
+ {
+ return this.modifiedAttribute;
+ }
+
+
+ /**
+ * Gets the deleted value.
+ *
+ * @return the deleted value
+ */
+ public IValue getDeletedValue()
+ {
+ return this.deletedValue;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__empty_value_deleted_from_att_at_dn, new String[]
+ { getModifiedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * An EntryAddedEvent indicates that an {@link IEntry} was added to the underlying directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryAddedEvent extends EntryModificationEvent
+{
+
+ /**
+ * Creates a new instance of EntryAddedEvent.
+ *
+ * @param connection the connection
+ * @param addedEntry the added entry
+ */
+ public EntryAddedEvent( IBrowserConnection connection, IEntry addedEntry )
+ {
+ super( connection, addedEntry );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__added_dn, new String[]
+ { getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * An EntryDeletedEvent indicates that an {@link IEntry} was deleted from the underlying directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryDeletedEvent extends EntryModificationEvent
+{
+
+ /**
+ * Creates a new instance of EntryDeletedEvent.
+ *
+ * @param connection the connection
+ * @param deletedEntry the deleted entry
+ */
+ public EntryDeletedEvent( IBrowserConnection connection, IEntry deletedEntry )
+ {
+ super( connection, deletedEntry );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__deleted_dn, new String[]
+ { getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryModificationEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryModificationEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryModificationEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryModificationEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,78 @@
+/*
+ * 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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * The root of all events that indecate an {@link IEntry} modification.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class EntryModificationEvent
+{
+
+ /** The connection. */
+ protected IBrowserConnection connection;
+
+ /** The entry. */
+ protected IEntry modifiedEntry;
+
+
+ /**
+ * Creates a new instance of EntryModificationEvent.
+ *
+ * @param modifiedEntry the modified entry
+ * @param connection the connection
+ */
+ public EntryModificationEvent( IBrowserConnection connection, IEntry modifiedEntry )
+ {
+ this.connection = connection;
+ this.modifiedEntry = modifiedEntry;
+ }
+
+
+ /**
+ * Gets the connection.
+ *
+ * @return the connection
+ */
+ public IBrowserConnection getConnection()
+ {
+ return connection;
+ }
+
+
+ /**
+ * Gets the modified entry.
+ *
+ * @return the modified entry
+ */
+ public IEntry getModifiedEntry()
+ {
+ return modifiedEntry;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryModificationEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,91 @@
+/*
+ * 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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * An EntryMovedEvent indicates that an {@link IEntry} was moved in the underlying directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryMovedEvent extends EntryModificationEvent
+{
+
+ /** The old entry. */
+ private IEntry oldEntry;
+
+ /** The new entry. */
+ private IEntry newEntry;
+
+
+ /**
+ * Creates a new instance of EntryMovedEvent.
+ *
+ * @param oldEntry the old entry
+ * @param newEntry the new entry
+ */
+ public EntryMovedEvent( IEntry oldEntry, IEntry newEntry )
+ {
+ super( newEntry.getBrowserConnection(), newEntry.getParententry() );
+ this.oldEntry = oldEntry;
+ this.newEntry = newEntry;
+ }
+
+
+ /**
+ * Gets the new entry with the new DN.
+ *
+ * @return the new entry
+ */
+ public IEntry getNewEntry()
+ {
+ return newEntry;
+ }
+
+
+ /**
+ * Gets the old entry with the old DN.
+ *
+ * @return the old entry
+ */
+ public IEntry getOldEntry()
+ {
+ return oldEntry;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__moved_oldrdn_from_oldparent_to_newparent,
+ new String[]
+ { getOldEntry().getDn().getRdn().getUpName(), getOldEntry().getParententry().getDn().getUpName(),
+ getNewEntry().getParententry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,89 @@
+/*
+ * 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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * An EntryRenamedEvent indicates that an {@link IEntry} was renamed in the underlying directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryRenamedEvent extends EntryModificationEvent
+{
+
+ /** The old entry. */
+ private IEntry oldEntry;
+
+ /** The new entry. */
+ private IEntry newEntry;
+
+
+ /**
+ * Creates a new instance of EntryRenamedEvent.
+ *
+ * @param oldEntry the old entry
+ * @param newEntry the new entry
+ */
+ public EntryRenamedEvent( IEntry oldEntry, IEntry newEntry )
+ {
+ super( newEntry.getBrowserConnection(), newEntry.getParententry() );
+ this.oldEntry = oldEntry;
+ this.newEntry = newEntry;
+ }
+
+
+ /**
+ * Gets the new entry with the new DN.
+ *
+ * @return the new entry
+ */
+ public IEntry getNewEntry()
+ {
+ return newEntry;
+ }
+
+
+ /**
+ * Gets the old entry with the old DN.
+ *
+ * @return the old entry
+ */
+ public IEntry getOldEntry()
+ {
+ return oldEntry;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__renamed_olddn_to_newdn, new String[]
+ { getOldEntry().getDn().getUpName(), getNewEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryUpdateListener.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryUpdateListener.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryUpdateListener.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.events;
+
+
+import java.util.EventListener;
+
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * A listener for {@link EntryModificationEvent}s
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface EntryUpdateListener extends EventListener
+{
+
+ /**
+ * Called when an {@link IEntry} was updated.
+ *
+ * @param event the event
+ */
+ public void entryUpdated( EntryModificationEvent event );
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryUpdateListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,363 @@
+/*
+ * 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.events;
+
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * The EventRegistry is a central point to register for Apache Directory Studio specific
+ * events and to fire events to registered listeners.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EventRegistry
+{
+
+ /** The list of threads with suspended event fireing. */
+ private static Set<Thread> suspendedEventFireringThreads = new HashSet<Thread>();;
+
+ /** The lock used to synchronize event fireings */
+ private static Object lock = new Object();
+
+
+ /**
+ * Checks if event fireing is suspended in the current thread.
+ *
+ * @return true, if event fireing is suspended in the current thread
+ */
+ public static boolean isEventFireingSuspendedInCurrentThread()
+ {
+ return suspendedEventFireringThreads.contains( Thread.currentThread() );
+ }
+
+
+ /**
+ * Resumes event fireing in the current thread.
+ */
+ public static void resumeEventFireingInCurrentThread()
+ {
+ suspendedEventFireringThreads.remove( Thread.currentThread() );
+ }
+
+
+ /**
+ * Suspends event fireing in the current thread.
+ */
+ public static void suspendEventFireingInCurrentThread()
+ {
+ suspendedEventFireringThreads.add( Thread.currentThread() );
+ }
+
+
+
+ /** The map with search update listeners and their runners */
+ private static Map<SearchUpdateListener, EventRunner> searchUpdateListeners = new HashMap<SearchUpdateListener, EventRunner>();
+
+
+ /**
+ * Adds the search update listener.
+ *
+ * @param listener the listener
+ * @param runner the runner
+ */
+ public static void addSearchUpdateListener( SearchUpdateListener listener, EventRunner runner )
+ {
+ assert listener != null;
+ assert runner != null;
+
+ if ( !searchUpdateListeners.containsKey( listener ) )
+ {
+ searchUpdateListeners.put( listener, runner );
+ }
+ }
+
+
+ /**
+ * Removes the search update listener.
+ *
+ * @param listener the listener
+ */
+ public static void removeSearchUpdateListener( SearchUpdateListener listener )
+ {
+ if ( searchUpdateListeners.containsKey( listener ) )
+ {
+ searchUpdateListeners.remove( listener );
+ }
+ }
+
+
+ /**
+ * Notifies each {@link SearchUpdateListener} about the the given {@link SearchUpdateEvent}.
+ * Uses the {@link EventRunner}s.
+ *
+ * @param searchUpdateEvent the search update event
+ * @param source the source
+ */
+ public static void fireSearchUpdated( final SearchUpdateEvent searchUpdateEvent, final Object source )
+ {
+ if( isEventFireingSuspendedInCurrentThread() )
+ {
+ return;
+ }
+
+ Iterator<SearchUpdateListener> it = searchUpdateListeners.keySet().iterator();
+ while( it.hasNext() )
+ {
+ final SearchUpdateListener listener = it.next();
+ EventRunnable runnable = new EventRunnable()
+ {
+ public void run()
+ {
+ listener.searchUpdated( searchUpdateEvent );
+ }
+ };
+
+ EventRunner runner = searchUpdateListeners.get( listener );
+
+ synchronized( lock )
+ {
+ runner.execute( runnable );
+ }
+ }
+ }
+
+
+ /** The map with bookmark update listeners and their runners */
+ private static Map<BookmarkUpdateListener, EventRunner> bookmarkUpdateListeners = new HashMap<BookmarkUpdateListener, EventRunner>();
+
+
+ /**
+ * Adds the bookmark update listener.
+ *
+ * @param listener the listener
+ * @param runner the runner
+ */
+ public static void addBookmarkUpdateListener( BookmarkUpdateListener listener, EventRunner runner )
+ {
+ assert listener != null;
+ assert runner != null;
+
+ if ( !bookmarkUpdateListeners.containsKey( listener ) )
+ {
+ bookmarkUpdateListeners.put( listener, runner );
+ }
+ }
+
+
+ /**
+ * Removes the bookmark update listener.
+ *
+ * @param listener the listener
+ */
+ public static void removeBookmarkUpdateListener( BookmarkUpdateListener listener )
+ {
+ if ( bookmarkUpdateListeners.containsKey( listener ) )
+ {
+ bookmarkUpdateListeners.remove( listener );
+ }
+ }
+
+
+ /**
+ * Notifies each {@link BookmarkUpdateListener} about the the given {@link BookmarkUpdateEvent}.
+ * Uses the {@link EventRunner}s.
+ *
+ * @param bookmarkUpdateEvent the bookmark update event
+ * @param source the source
+ */
+ public static void fireBookmarkUpdated( final BookmarkUpdateEvent bookmarkUpdateEvent, final Object source )
+ {
+ if( isEventFireingSuspendedInCurrentThread() )
+ {
+ return;
+ }
+
+ Iterator<BookmarkUpdateListener> it = bookmarkUpdateListeners.keySet().iterator();
+ while( it.hasNext() )
+ {
+ final BookmarkUpdateListener listener = it.next();
+ EventRunnable runnable = new EventRunnable()
+ {
+ public void run()
+ {
+ listener.bookmarkUpdated( bookmarkUpdateEvent );
+ }
+ };
+
+ EventRunner runner = bookmarkUpdateListeners.get( listener );
+ synchronized( lock )
+ {
+ runner.execute( runnable );
+ }
+ }
+ }
+
+ /** The map with entry update listeners and their runners */
+ private static Map<BrowserConnectionUpdateListener, EventRunner> browserConnectionUpdateListeners = new HashMap<BrowserConnectionUpdateListener, EventRunner>();
+
+
+ /**
+ * Adds the browser connection update listener.
+ *
+ * @param listener the listener
+ * @param runner the runner
+ */
+ public static void addBrowserConnectionUpdateListener( BrowserConnectionUpdateListener listener, EventRunner runner )
+ {
+ assert listener != null;
+ assert runner != null;
+
+ if ( !browserConnectionUpdateListeners.containsKey( listener ) )
+ {
+ browserConnectionUpdateListeners.put( listener, runner );
+ }
+ }
+
+
+ /**
+ * Removes the browser connection update listener.
+ *
+ * @param listener the listener
+ */
+ public static void removeBrowserConnectionpdateListener( BrowserConnectionUpdateListener listener )
+ {
+ if ( browserConnectionUpdateListeners.containsKey( listener ) )
+ {
+ browserConnectionUpdateListeners.remove( listener );
+ }
+ }
+
+
+ /**
+ * Notifies each {@link BrowserConnectionUpdateListener} about the the given {@link BrowserConnectionUpdateEvent}.
+ * Uses the {@link EventRunner}s.
+ *
+ * @param browserConnectionUpdateEvent the browser connection update event
+ * @param source the source
+ */
+ public static void fireBrowserConnectionUpdated( final BrowserConnectionUpdateEvent browserConnectionUpdateEvent,
+ final Object source )
+ {
+ if( isEventFireingSuspendedInCurrentThread() )
+ {
+ return;
+ }
+
+ Iterator<BrowserConnectionUpdateListener> it = browserConnectionUpdateListeners.keySet().iterator();
+ while( it.hasNext() )
+ {
+ final BrowserConnectionUpdateListener listener = it.next();
+ EventRunnable runnable = new EventRunnable()
+ {
+ public void run()
+ {
+ listener.browserConnectionUpdated( browserConnectionUpdateEvent );
+ }
+ };
+
+ EventRunner runner = browserConnectionUpdateListeners.get( listener );
+ synchronized( lock )
+ {
+ runner.execute( runnable );
+ }
+ }
+ }
+
+
+ /** The map with entry update listeners and their runners */
+ private static Map<EntryUpdateListener, EventRunner> entryUpdateListeners = new HashMap<EntryUpdateListener, EventRunner>();
+
+
+ /**
+ * Adds the entry update listener.
+ *
+ * @param listener the listener
+ * @param runner the runner
+ */
+ public static void addEntryUpdateListener( EntryUpdateListener listener, EventRunner runner )
+ {
+ assert listener != null;
+ assert runner != null;
+
+ if ( !entryUpdateListeners.containsKey( listener ) )
+ {
+ entryUpdateListeners.put( listener, runner );
+ }
+ }
+
+
+ /**
+ * Removes the entry update listener.
+ *
+ * @param listener the listener
+ */
+ public static void removeEntryUpdateListener( EntryUpdateListener listener )
+ {
+ if ( entryUpdateListeners.containsKey( listener ) )
+ {
+ entryUpdateListeners.remove( listener );
+ }
+ }
+
+
+ /**
+ * Notifies each {@link EntryUpdateListener} about the the given {@link EntryModificationEvent}.
+ * Uses the {@link EventRunner}s.
+ *
+ * @param entryUpdateEvent the entry update event
+ * @param source the source
+ */
+ public static void fireEntryUpdated( final EntryModificationEvent entryUpdateEvent, final Object source )
+ {
+ if( isEventFireingSuspendedInCurrentThread() )
+ {
+ return;
+ }
+
+ Iterator<EntryUpdateListener> it = entryUpdateListeners.keySet().iterator();
+ while( it.hasNext() )
+ {
+ final EntryUpdateListener listener = it.next();
+ EventRunnable runnable = new EventRunnable()
+ {
+ public void run()
+ {
+ listener.entryUpdated( entryUpdateEvent );
+ }
+ };
+
+ EventRunner runner = entryUpdateListeners.get( listener );
+ synchronized( lock )
+ {
+ runner.execute( runnable );
+ }
+ }
+ }
+
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunnable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunnable.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunnable.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunnable.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.events;
+
+
+/**
+ * The <code>EventRunnable</code> interface should be implemented by any
+ * class whose instances are intended to be executed by an {@link EventRunner}.
+ * The class must define a method of no arguments called <code>run</code>.
+ * <p>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface EventRunnable extends Runnable
+{
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunnable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunner.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunner.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunner.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.events;
+
+
+/**
+ * An EventRunner is used to execute an {@link EventRunnable}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface EventRunner
+{
+
+ /**
+ * Executes the given {@link EventRunnable}.
+ *
+ * @param runnable the event runnable to run
+ */
+ public void execute( EventRunnable runnable );
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRunner.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,102 @@
+/*
+ * 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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+
+
+/**
+ * An SearchUpdateEvent indicates that an {@link ISearch} was updated.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchUpdateEvent
+{
+
+ /**
+ * Contains constants to specify the event detail.
+ */
+ public enum EventDetail
+ {
+
+ /** Indicates that the search was added. */
+ SEARCH_ADDED,
+
+ /** Indicates that the search was removed. */
+ SEARCH_REMOVED,
+
+ /** Indicates that the search was performed. */
+ SEARCH_PERFORMED,
+
+ /**
+ * Indicates that the search parameters were updated.
+ * Note: This event detail doesn't include the renaming of a search!
+ */
+ SEARCH_PARAMETER_UPDATED,
+
+ /** Indicates that the search was renamed. */
+ SEARCH_RENAMED
+ }
+
+ /** The event detail. */
+ private EventDetail detail;
+
+ /** The updated search. */
+ private ISearch search;
+
+
+ /**
+ * Creates a new instance of SearchUpdateEvent.
+ *
+ * @param search the updated search
+ * @param detail the event detail
+ */
+ public SearchUpdateEvent( ISearch search, EventDetail detail )
+ {
+ this.search = search;
+ this.detail = detail;
+ }
+
+
+ /**
+ * Gets the updated search.
+ *
+ * @return the updated search
+ */
+ public ISearch getSearch()
+ {
+ return search;
+ }
+
+
+ /**
+ * Gets the event detail.
+ *
+ * @return the event detail
+ */
+ public EventDetail getDetail()
+ {
+ return detail;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateListener.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateListener.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateListener.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.events;
+
+
+import java.util.EventListener;
+
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
+
+
+/**
+ * A listener for {@link SearchUpdateEvent}s
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface SearchUpdateListener extends EventListener
+{
+
+ /**
+ * Called when an {@link ISearch} was updated.
+ *
+ * @param searchUpdateEvent the search update event
+ */
+ public void searchUpdated( SearchUpdateEvent searchUpdateEvent );
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/SearchUpdateListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,96 @@
+/*
+ * 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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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;
+
+
+/**
+ * An ValueAddedEvent indicates that an {@link IValue} was added to an {@link IEntry}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueAddedEvent extends EntryModificationEvent
+{
+
+ /** The modified attribute. */
+ private IAttribute modifiedAttribute;
+
+ /** The added value. */
+ private IValue addedValue;
+
+
+ /**
+ * Creates a new instance of ValueAddedEvent.
+ *
+ * @param connection the connection
+ * @param modifiedEntry the modified entry
+ * @param modifiedAttribute the modified attribute
+ * @param addedValue the added value
+ */
+ public ValueAddedEvent( IBrowserConnection connection, IEntry modifiedEntry, IAttribute modifiedAttribute,
+ IValue addedValue )
+ {
+ super( connection, modifiedEntry );
+ this.modifiedAttribute = modifiedAttribute;
+ this.addedValue = addedValue;
+ }
+
+
+ /**
+ * Gets the modified attribute.
+ *
+ * @return the modified attribute
+ */
+ public IAttribute getModifiedAttribute()
+ {
+ return modifiedAttribute;
+ }
+
+
+ /**
+ * Gets the added value.
+ *
+ * @return the added value
+ */
+ public IValue getAddedValue()
+ {
+ return addedValue;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__added_val_to_att_at_dn, new String[]
+ { getAddedValue().getStringValue(), getModifiedAttribute().getDescription(),
+ getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,96 @@
+/*
+ * 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.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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;
+
+
+/**
+ * An ValueDeletedEvent indicates that an {@link IValue} was deleted from an {@link IEntry}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueDeletedEvent extends EntryModificationEvent
+{
+
+ /** The modified attribute. */
+ private IAttribute modifiedAttribute;
+
+ /** The deleted value. */
+ private IValue deletedValue;
+
+
+ /**
+ * Creates a new instance of ValueDeletedEvent.
+ *
+ * @param connection the connection
+ * @param modifiedEntry the modified entry
+ * @param modifiedAttribute the modified attribute
+ * @param deletedValue the deleted value
+ */
+ public ValueDeletedEvent( IBrowserConnection connection, IEntry modifiedEntry, IAttribute modifiedAttribute,
+ IValue deletedValue )
+ {
+ super( connection, modifiedEntry );
+ this.modifiedAttribute = modifiedAttribute;
+ this.deletedValue = deletedValue;
+ }
+
+
+ /**
+ * Gets the modified attribute.
+ *
+ * @return the modified attribute
+ */
+ public IAttribute getModifiedAttribute()
+ {
+ return modifiedAttribute;
+ }
+
+
+ /**
+ * Gets the deleted value.
+ *
+ * @return the deleted value
+ */
+ public IValue getDeletedValue()
+ {
+ return deletedValue;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__deleted_val_from_att_at_dn, new String[]
+ { getDeletedValue().getStringValue(), getModifiedAttribute().getDescription(),
+ getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.core.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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;
+
+
+/**
+ * An ValueModifiedEvent indicates that an {@link IValue} was modified.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueModifiedEvent extends EntryModificationEvent
+{
+
+ /** The modified attribute. */
+ private IAttribute modifiedAttribute;
+
+ /** The old value. */
+ private IValue oldValue;
+
+ /** The new value. */
+ private IValue newValue;
+
+
+ /**
+ * Creates a new instance of ValueModifiedEvent.
+ *
+ * @param connection the connection
+ * @param modifiedEntry the modified entry
+ * @param modifiedAttribute the modified attribute
+ * @param oldValue the old value
+ * @param newValue the new value
+ */
+ public ValueModifiedEvent( IBrowserConnection connection, IEntry modifiedEntry, IAttribute modifiedAttribute,
+ IValue oldValue, IValue newValue )
+ {
+ super( connection, modifiedEntry );
+ this.modifiedAttribute = modifiedAttribute;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+
+ /**
+ * Gets the modified attribute.
+ *
+ * @return the modified attribute
+ */
+ public IAttribute getModifiedAttribute()
+ {
+ return modifiedAttribute;
+ }
+
+
+ /**
+ * Gets the old value.
+ *
+ * @return the old value
+ */
+ public IValue getOldValue()
+ {
+ return oldValue;
+ }
+
+
+ /**
+ * Gets the new value.
+ *
+ * @return the new value
+ */
+ public IValue getNewValue()
+ {
+ return newValue;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__replaced_oldval_by_newval_at_att_at_dn,
+ new String[]
+ { getOldValue().getStringValue(), getNewValue().getStringValue(),
+ getModifiedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.ldapbrowser.core.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+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;
+
+
+/**
+ * An ValueRenamedEvent indicates that an {@link IValue} was renamed. This
+ * means that the attribute type was modified.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueRenamedEvent extends EntryModificationEvent
+{
+
+ /** The old value with the old attribute type. */
+ private IValue oldValue;
+
+ /** The new value with the new attribute type. */
+ private IValue newValue;
+
+
+ /**
+ * Creates a new instance of ValueRenamedEvent.
+ *
+ * @param connection the connection
+ * @param modifiedEntry the modified entry
+ * @param oldValue the old value with the old attribute type
+ * @param newValue the new value with the new attribute type
+ */
+ public ValueRenamedEvent( IBrowserConnection connection, IEntry modifiedEntry, IValue oldValue, IValue newValue )
+ {
+ super( connection, modifiedEntry );
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+
+ /**
+ * Gets the new value with the new attribute type.
+ *
+ * @return the new value with the new attribute type
+ */
+ public IValue getNewValue()
+ {
+ return newValue;
+ }
+
+
+ /**
+ * Gets the old value with the old attribute type.
+ *
+ * @return the old value with the old attribute type
+ */
+ public IValue getOldValue()
+ {
+ return oldValue;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return BrowserCoreMessages.bind( BrowserCoreMessages.event__renamed_oldval_by_newval_at_dn, new String[]
+ { getOldValue().toString(), getNewValue().toString(), getModifiedEntry().getDn().getUpName() } );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/search/LdapSearchPageScoreComputer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/search/LdapSearchPageScoreComputer.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/search/LdapSearchPageScoreComputer.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/search/LdapSearchPageScoreComputer.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.internal.search;
+
+
+import org.eclipse.search.ui.ISearchPageScoreComputer;
+
+
+public class LdapSearchPageScoreComputer implements ISearchPageScoreComputer
+{
+
+ public static final String LDAP_SEARCH_PAGE_ID = "org.apache.directory.studio.ldapbrowser.ui.search.SearchPage"; //$NON-NLS-1$
+
+
+ public int computeScore( String pageId, Object input )
+ {
+ if ( pageId.equals( LDAP_SEARCH_PAGE_ID ) )
+ {
+ return 90;
+ }
+ return 0;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/search/LdapSearchPageScoreComputer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java?rev=592082&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java Mon Nov 5 08:51:43 2007
@@ -0,0 +1,102 @@
+/*
+ * 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.jobs;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.StudioProgressMonitor;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+
+
+/**
+ * Base class for jobs that modify attributes of a single entry.
+ * Reloads the modified attributes after modification.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractAttributeModificationJob extends AbstractNotificationJob
+{
+
+ /**
+ * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractNotificationJob#executeNotificationJob(org.apache.directory.studio.connection.core.StudioProgressMonitor)
+ */
+ protected void executeNotificationJob( StudioProgressMonitor monitor )
+ {
+ try
+ {
+ executeAttributeModificationJob( monitor );
+ }
+ finally
+ {
+ // reload affected attributes
+ String[] attributeDescriptions = getAffectedAttributeDescriptions();
+ InitializeAttributesJob.initializeAttributes( getModifiedEntry(), attributeDescriptions, monitor );
+ }
+ }
+
+
+ /**
+ * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getConnections()
+ */
+ protected Connection[] getConnections()
+ {
+ return new Connection[]
+ { getModifiedEntry().getBrowserConnection().getConnection() };
+ }
+
+
+ /**
+ * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getLockedObjects()
+ */
+ protected Object[] getLockedObjects()
+ {
+ return new Object[]
+ { getModifiedEntry() };
+ }
+
+
+ /**
+ * Execute the attribute modification job.
+ *
+ * @param monitor the progress monitor
+ */
+ protected abstract void executeAttributeModificationJob( StudioProgressMonitor monitor );
+
+
+ /**
+ * Gets the modified entry.
+ *
+ * @return the modified entry
+ */
+ protected abstract IEntry getModifiedEntry();
+
+
+ /**
+ * Gets the affected attribute descriptions.
+ * Implementations must return all attribute descriptions of
+ * added, modified or removed attributes.
+ *
+ * @return the affected attribute descriptions
+ */
+ protected abstract String[] getAffectedAttributeDescriptions();
+
+}
Propchange: directory/sandbox/felixk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractAttributeModificationJob.java
------------------------------------------------------------------------------
svn:eol-style = native