directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r523504 - in /directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd: ConnectionTransfer.java EntryTransfer.java SearchTransfer.java ValuesTransfer.java
Date Wed, 28 Mar 2007 23:21:24 GMT
Author: seelmann
Date: Wed Mar 28 16:21:23 2007
New Revision: 523504

URL: http://svn.apache.org/viewvc?view=rev&rev=523504
Log:
Code cleaning, Javadocs.

Modified:
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ConnectionTransfer.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/EntryTransfer.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/SearchTransfer.java
    directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ValuesTransfer.java

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ConnectionTransfer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ConnectionTransfer.java?view=diff&rev=523504&r1=523503&r2=523504
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ConnectionTransfer.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ConnectionTransfer.java
Wed Mar 28 16:21:23 2007
@@ -30,37 +30,67 @@
 import java.util.List;
 
 import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.ConnectionManager;
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
-
 import org.eclipse.swt.dnd.ByteArrayTransfer;
+import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.dnd.TransferData;
 
 
+/**
+ * A {@link Transfer} that could be used to transfer {@link IConnection} objects.
+ * Note that only the connection name is converted to a platform specific 
+ * representation, not the complete object. To convert it back to an {@link IConnection}

+ * object the {@link ConnectionManager#getConnection(String)} method is invoked.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class ConnectionTransfer extends ByteArrayTransfer
 {
 
+    /** The Constant TYPENAME. */
     private static final String TYPENAME = "org.apache.directory.ldapstudio.browser.connection";
 
+    /** The Constant TYPEID. */
     private static final int TYPEID = registerType( TYPENAME );
 
+    /** The instance. */
     private static ConnectionTransfer instance = new ConnectionTransfer();
 
 
+    /**
+     * Creates a new instance of ConnectionTransfer.
+     */
     private ConnectionTransfer()
     {
     }
 
 
+    /**
+     * Gets the instance.
+     * 
+     * @return the instance
+     */
     public static ConnectionTransfer getInstance()
     {
         return instance;
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation only accepts {@link IConnection} objects. 
+     * It just converts the name of the connection to the platform 
+     * specific representation.
+     */
     public void javaToNative( Object object, TransferData transferData )
     {
         if ( object == null || !( object instanceof IConnection[] ) )
+        {
             return;
+        }
 
         if ( isSupportedType( transferData ) )
         {
@@ -90,17 +120,25 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation just converts the platform specific representation
+     * to the connection name and invokes 
+     * {@link ConnectionManager#getConnection(String)} to get the
+     * {@link IConnection} object.
+     */
     public Object nativeToJava( TransferData transferData )
     {
-
         if ( isSupportedType( transferData ) )
         {
-
             byte[] buffer = ( byte[] ) super.nativeToJava( transferData );
             if ( buffer == null )
+            {
                 return null;
+            }
 
-            List connectionList = new ArrayList();
+            List<IConnection> connectionList = new ArrayList<IConnection>();
             try
             {
                 ByteArrayInputStream in = new ByteArrayInputStream( buffer );
@@ -134,6 +172,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected String[] getTypeNames()
     {
         return new String[]
@@ -141,6 +182,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected int[] getTypeIds()
     {
         return new int[]

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/EntryTransfer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/EntryTransfer.java?view=diff&rev=523504&r1=523503&r2=523504
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/EntryTransfer.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/EntryTransfer.java
Wed Mar 28 16:21:23 2007
@@ -30,39 +30,69 @@
 import java.util.List;
 
 import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.ConnectionManager;
 import org.apache.directory.ldapstudio.browser.core.model.DN;
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 
 import org.eclipse.swt.dnd.ByteArrayTransfer;
+import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.dnd.TransferData;
 
 
+/**
+ * A {@link Transfer} that could be used to transfer {@link IEntry} objects.
+ * Note that only the connection name and entry's DN is converted to a platform specific

+ * representation, not the complete object.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class EntryTransfer extends ByteArrayTransfer
 {
 
+    /** The Constant TYPENAME. */
     private static final String TYPENAME = "org.apache.directory.ldapstudio.browser.entry";
 
+    /** The Constant TYPEID. */
     private static final int TYPEID = registerType( TYPENAME );
 
+    /** The instance. */
     private static EntryTransfer instance = new EntryTransfer();
 
 
+    /**
+     * Gets the instance.
+     * 
+     * @return the instance
+     */
     public static EntryTransfer getInstance()
     {
         return instance;
     }
 
 
+    /**
+     * Creates a new instance of EntryTransfer.
+     */
     private EntryTransfer()
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation only accepts {@link IEntry} objects. 
+     * It just converts the name of the connection and the entry's DN
+     * to the platform specific representation.
+     */
     public void javaToNative( Object object, TransferData transferData )
     {
         if ( object == null || !( object instanceof IEntry[] ) )
+        {
             return;
+        }
 
         if ( isSupportedType( transferData ) )
         {
@@ -95,20 +125,28 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation just converts the platform specific representation
+     * to the connection name and entry DN and invokes 
+     * {@link ConnectionManager#getConnection(String)} to get the
+     * {@link IConnection} object and {@link IConnection#getEntryFromCache(DN)}
+     * to get the {@link IEntry} object.
+     */
     public Object nativeToJava( TransferData transferData )
     {
-
         try
         {
-
             if ( isSupportedType( transferData ) )
             {
-
                 byte[] buffer = ( byte[] ) super.nativeToJava( transferData );
                 if ( buffer == null )
+                {
                     return null;
+                }
 
-                List entryList = new ArrayList();
+                List<IEntry> entryList = new ArrayList<IEntry>();
                 try
                 {
                     IConnection connection = null;
@@ -133,7 +171,6 @@
                             byte[] dn = new byte[size];
                             readIn.read( dn );
                             entry = connection.getEntryFromCache( new DN( new String( dn
) ) );
-
                         }
                         else
                         {
@@ -168,6 +205,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected String[] getTypeNames()
     {
         return new String[]
@@ -175,6 +215,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected int[] getTypeIds()
     {
         return new int[]

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/SearchTransfer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/SearchTransfer.java?view=diff&rev=523504&r1=523503&r2=523504
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/SearchTransfer.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/SearchTransfer.java
Wed Mar 28 16:21:23 2007
@@ -30,38 +30,67 @@
 import java.util.List;
 
 import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
+import org.apache.directory.ldapstudio.browser.core.ConnectionManager;
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 import org.apache.directory.ldapstudio.browser.core.model.ISearch;
-
 import org.eclipse.swt.dnd.ByteArrayTransfer;
+import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.dnd.TransferData;
 
 
+/**
+ * A {@link Transfer} that could be used to transfer {@link ISearch} objects.
+ * Note that only the connection name and search name is converted to a platform specific

+ * representation, not the complete object.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class SearchTransfer extends ByteArrayTransfer
 {
 
+    /** The Constant TYPENAME. */
     private static final String TYPENAME = "org.apache.directory.ldapstudio.browser.search";
 
+    /** The Constant TYPEID. */
     private static final int TYPEID = registerType( TYPENAME );
 
+    /** The instance. */
     private static SearchTransfer instance = new SearchTransfer();
 
 
+    /**
+     * Creates a new instance of SearchTransfer.
+     */
     private SearchTransfer()
     {
     }
 
 
+    /**
+     * Gets the instance.
+     * 
+     * @return the instance
+     */
     public static SearchTransfer getInstance()
     {
         return instance;
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation only accepts {@link ISearch} objects. 
+     * It just converts the name of the connection and the name of the search
+     * to the platform specific representation.
+     */
     public void javaToNative( Object object, TransferData transferData )
     {
         if ( object == null || !( object instanceof ISearch[] ) )
+        {
             return;
+        }
 
         if ( isSupportedType( transferData ) )
         {
@@ -94,20 +123,28 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation just converts the platform specific representation
+     * to the connection name and search name and invokes 
+     * {@link ConnectionManager#getConnection(String)} to get the
+     * {@link IConnection} object and {@link IConnection#getSearchManager()}
+     * to get the {@link ISearch} object.
+     */
     public Object nativeToJava( TransferData transferData )
     {
-
         try
         {
-
             if ( isSupportedType( transferData ) )
             {
-
                 byte[] buffer = ( byte[] ) super.nativeToJava( transferData );
                 if ( buffer == null )
+                {
                     return null;
+                }
 
-                List searchList = new ArrayList();
+                List<ISearch> searchList = new ArrayList<ISearch>();
                 try
                 {
                     IConnection connection = null;
@@ -166,6 +203,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected String[] getTypeNames()
     {
         return new String[]
@@ -173,6 +213,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected int[] getTypeIds()
     {
         return new int[]

Modified: directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ValuesTransfer.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ValuesTransfer.java?view=diff&rev=523504&r1=523503&r2=523504
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ValuesTransfer.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/dnd/ValuesTransfer.java
Wed Mar 28 16:21:23 2007
@@ -35,36 +35,63 @@
 import org.apache.directory.ldapstudio.browser.core.model.IConnection;
 import org.apache.directory.ldapstudio.browser.core.model.IEntry;
 import org.apache.directory.ldapstudio.browser.core.model.IValue;
-
 import org.eclipse.swt.dnd.ByteArrayTransfer;
+import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.dnd.TransferData;
 
 
+/**
+ * A {@link Transfer} that could be used to transfer {@link IValue} objects.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class ValuesTransfer extends ByteArrayTransfer
 {
 
+    /** The Constant TYPENAME. */
     private static final String TYPENAME = "org.apache.directory.ldapstudio.browser.value";
 
+    /** The Constant TYPEID. */
     private static final int TYPEID = registerType( TYPENAME );
 
+    /** The instance. */
     private static ValuesTransfer instance = new ValuesTransfer();
 
 
+    /**
+     * Gets the instance.
+     * 
+     * @return the instance
+     */
     public static ValuesTransfer getInstance()
     {
         return instance;
     }
 
 
+    /**
+     * Creates a new instance of ValuesTransfer.
+     */
     private ValuesTransfer()
     {
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation only accepts {@link IValue} objects. 
+     * It converts the name of the connection, the entry's DN, the 
+     * attribute description and the value to the platform specific 
+     * representation.
+     */
     public void javaToNative( Object object, TransferData transferData )
     {
         if ( object == null || !( object instanceof IValue[] ) )
+        {
             return;
+        }
 
         if ( isSupportedType( transferData ) )
         {
@@ -114,23 +141,28 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation converts the platform specific representation
+     * to the connection name, entry DN, attribute description and value and
+     * restores the {@link IValue} object. 
+     */
     public Object nativeToJava( TransferData transferData )
     {
-
         try
         {
-
             if ( isSupportedType( transferData ) )
             {
-
                 byte[] buffer = ( byte[] ) super.nativeToJava( transferData );
                 if ( buffer == null )
+                {
                     return null;
+                }
 
-                List valueList = new ArrayList();
+                List<IValue> valueList = new ArrayList<IValue>();
                 try
                 {
-
                     ByteArrayInputStream in = new ByteArrayInputStream( buffer );
                     DataInputStream readIn = new DataInputStream( in );
 
@@ -230,6 +262,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected String[] getTypeNames()
     {
         return new String[]
@@ -237,6 +272,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     protected int[] getTypeIds()
     {
         return new int[]



Mime
View raw message