directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1005047 - in /directory/studio/branches/shared-trunk-merge/plugins/connection.core: ./ src/main/java/org/apache/directory/studio/connection/core/ src/main/java/org/apache/directory/studio/connection/core/io/jndi/
Date Wed, 06 Oct 2010 14:09:51 GMT
Author: pamarcelot
Date: Wed Oct  6 14:09:51 2010
New Revision: 1005047

URL: http://svn.apache.org/viewvc?rev=1005047&view=rev
Log:
Fixed 'connection.core' module.

Modified:
    directory/studio/branches/shared-trunk-merge/plugins/connection.core/pom.xml
    directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
    directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
    directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
    directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java
    directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java
    directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java

Modified: directory/studio/branches/shared-trunk-merge/plugins/connection.core/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/branches/shared-trunk-merge/plugins/connection.core/pom.xml?rev=1005047&r1=1005046&r2=1005047&view=diff
==============================================================================
--- directory/studio/branches/shared-trunk-merge/plugins/connection.core/pom.xml (original)
+++ directory/studio/branches/shared-trunk-merge/plugins/connection.core/pom.xml Wed Oct 
6 14:09:51 2010
@@ -109,8 +109,7 @@
  org.apache.commons.codec;bundle-version="${org.apache.commons.codec.version}",
  org.apache.commons.io;bundle-version="${org.apache.commons.io.version}",
  org.apache.commons.lang;bundle-version="${org.apache.commons.lang.version}",
- org.apache.directory.shared.asn1;bundle-version="${org.apache.directory.shared.version}",
- org.apache.directory.shared.ldap;bundle-version="${org.apache.directory.shared.version}",
+ org.apache.directory.shared.ldap;bundle-version="${org.apache.directory.shared.validversion}",
  org.apache.directory.studio.common.core,
  org.apache.directory.studio.ldifparser,
  org.apache.httpcomponents.httpclient;bundle-version="${org.apache.httpcomponents.version}",

Modified: directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java?rev=1005047&r1=1005046&r2=1005047&view=diff
==============================================================================
--- directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
(original)
+++ directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/DnUtils.java
Wed Oct  6 14:09:51 2010
@@ -22,12 +22,13 @@ package org.apache.directory.studio.conn
 
 import javax.naming.InvalidNameException;
 
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.name.RDN;
 
 
 /**
- * Utility class for LdapDN specific stuff.
+ * Utility class for DN specific stuff.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -42,11 +43,9 @@ public class DnUtils
      * 
      * @return the composed DN
      */
-    public static LdapDN composeDn( Rdn rdn, LdapDN parent )
+    public static DN composeDn( RDN rdn, DN parent )
     {
-        LdapDN ldapDn = ( LdapDN ) parent.clone();
-        ldapDn.add( ( Rdn ) rdn.clone() );
-        return ldapDn;
+        return parent.add( rdn );
     }
 
 
@@ -58,7 +57,7 @@ public class DnUtils
      * 
      * @return the parent DN, null if the given DN hasn't a parent
      */
-    public static LdapDN getParent( LdapDN dn )
+    public static DN getParent( DN dn )
     {
         if ( dn.size() < 1 )
         {
@@ -66,7 +65,7 @@ public class DnUtils
         }
         else
         {
-            LdapDN parent = ( LdapDN ) dn.getPrefix( dn.size() - 1 );
+            DN parent = ( DN ) dn.getPrefix( dn.size() - 1 );
             return parent;
         }
     }
@@ -82,9 +81,16 @@ public class DnUtils
      * 
      * @throws InvalidNameException the invalid name exception
      */
-    public static LdapDN composeDn( String rdn, String parent ) throws InvalidNameException
+    public static DN composeDn( String rdn, String parent ) throws InvalidNameException
     {
-        return composeDn( new Rdn( rdn ), new LdapDN( parent ) );
+        try
+        {
+            return composeDn( new RDN( rdn ), new DN( parent ) );
+        }
+        catch ( LdapInvalidDnException e )
+        {
+            throw new InvalidNameException( e.getMessage() );
+        }
     }
 
 
@@ -96,13 +102,13 @@ public class DnUtils
      * 
      * @return the composed DN
      */
-    public static LdapDN composeDn( LdapDN prefix, LdapDN suffix )
+    public static DN composeDn( DN prefix, DN suffix )
     {
-        LdapDN ldapDn = ( LdapDN ) suffix.clone();
+        DN ldapDn = suffix;
 
         for ( int i = 0; i < prefix.size(); i++ )
         {
-            ldapDn.add( ( Rdn ) prefix.getRdn( i ).clone() );
+            ldapDn = ldapDn.add( ( RDN ) prefix.getRdn( i ).clone() );
         }
 
         return ldapDn;
@@ -117,7 +123,7 @@ public class DnUtils
      * 
      * @return the prefix
      */
-    public static LdapDN getPrefixName( LdapDN dn, LdapDN suffix )
+    public static DN getPrefixName( DN dn, DN suffix )
     {
         if ( suffix.size() < 1 )
         {
@@ -125,7 +131,7 @@ public class DnUtils
         }
         else
         {
-            LdapDN prefix = ( LdapDN ) dn.getSuffix( suffix.size() );
+            DN prefix = ( DN ) dn.getSuffix( suffix.size() );
             return prefix;
         }
     }
@@ -141,7 +147,7 @@ public class DnUtils
      * 
      * @throws InvalidNameException the invalid name exception
      */
-    public static Rdn composeRdn( String[] rdnTypes, String[] rdnValues ) throws InvalidNameException
+    public static RDN composeRDN( String[] rdnTypes, String[] rdnValues ) throws InvalidNameException
     {
         StringBuffer sb = new StringBuffer();
         for ( int i = 0; i < rdnTypes.length; i++ )
@@ -153,15 +159,15 @@ public class DnUtils
 
             sb.append( rdnTypes[i] );
             sb.append( '=' );
-            sb.append( Rdn.escapeValue( rdnValues[i] ) );
+            sb.append( RDN.escapeValue( rdnValues[i] ) );
         }
 
         String s = sb.toString();
         try
         {
-            if ( LdapDN.isValid( s ) )
+            if ( DN.isValid( s ) )
             {
-                Rdn rdn = new Rdn( sb.toString() );
+                RDN rdn = new RDN( sb.toString() );
                 return rdn;
             }
         }

Modified: directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Utils.java?rev=1005047&r1=1005046&r2=1005047&view=diff
==============================================================================
--- directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
(original)
+++ directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/Utils.java
Wed Oct  6 14:09:51 2010
@@ -25,10 +25,10 @@ import java.util.Arrays;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
-import javax.naming.InvalidNameException;
 import javax.naming.directory.SearchControls;
 
-import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
@@ -193,9 +193,9 @@ public class Utils
         url.setPort( connection.getPort() );
         try
         {
-            url.setDn( new LdapDN( searchBase ) );
+            url.setDn( new DN( searchBase ) );
         }
-        catch ( InvalidNameException e )
+        catch ( LdapInvalidDnException e )
         {
         }
         if ( attributes != null )
@@ -321,7 +321,7 @@ public class Utils
      * 
      * @return the DN as LdapDN
      */
-    public static LdapDN getLdapDn( String dn )
+    public static DN getLdapDn( String dn )
     {
         if ( dn == null )
         {
@@ -329,12 +329,11 @@ public class Utils
         }
         try
         {
-            return new LdapDN( dn );
+            return new DN( dn );
         }
-        catch ( InvalidNameException e )
+        catch ( LdapInvalidDnException e )
         {
             return null;
         }
     }
-
 }

Modified: directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java?rev=1005047&r1=1005046&r2=1005047&view=diff
==============================================================================
--- directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
(original)
+++ directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
Wed Oct  6 14:09:51 2010
@@ -66,7 +66,8 @@ import javax.security.auth.login.LoginEx
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
-import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.Connection;
@@ -464,7 +465,7 @@ public class JNDIConnectionWrapper imple
                             Connection referralConnection = getReferralConnection( referral,
monitor, this );
                             if ( referralConnection != null )
                             {
-                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getUpName();
+                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getName();
                                 referralConnection.getJNDIConnectionWrapper().modifyEntry(
referralDn,
                                     modificationItems, controls, monitor, newReferralsInfo
);
                             }
@@ -668,7 +669,7 @@ public class JNDIConnectionWrapper imple
                             Connection referralConnection = getReferralConnection( referral,
monitor, this );
                             if ( referralConnection != null )
                             {
-                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getUpName();
+                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getName();
                                 referralConnection.getJNDIConnectionWrapper().createEntry(
referralDn, attributes,
                                     controls, monitor, newReferralsInfo );
                             }
@@ -763,7 +764,7 @@ public class JNDIConnectionWrapper imple
                             Connection referralConnection = getReferralConnection( referral,
monitor, this );
                             if ( referralConnection != null )
                             {
-                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getUpName();
+                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getName();
                                 referralConnection.getJNDIConnectionWrapper().deleteEntry(
referralDn, controls,
                                     monitor, newReferralsInfo );
                             }
@@ -1586,7 +1587,7 @@ public class JNDIConnectionWrapper imple
             String info = ( String ) referralException.getReferralInfo();
             String name = referralException.getRemainingName().toString();
             LdapURL url = new LdapURL( info );
-            LdapDN dn = new LdapDN( name );
+            DN dn = new DN( name );
 
             if ( referral == null )
             {
@@ -1598,6 +1599,9 @@ public class JNDIConnectionWrapper imple
         catch ( LdapURLEncodingException e )
         {
         }
+        catch ( LdapInvalidDnException e )
+        {
+        }
 
         return referral;
     }

Modified: directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java?rev=1005047&r1=1005046&r2=1005047&view=diff
==============================================================================
--- directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java
(original)
+++ directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java
Wed Oct  6 14:09:51 2010
@@ -38,7 +38,6 @@ import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import java.util.logging.Logger;
 
-import javax.naming.InvalidNameException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -48,15 +47,16 @@ import javax.naming.directory.Modificati
 import javax.naming.directory.SearchControls;
 import javax.naming.ldap.Control;
 
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.name.Rdn;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.connection.core.ConnectionManager;
 import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.core.IJndiLogger;
-import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.ldifparser.LdifFormatParameters;
 import org.apache.directory.studio.ldifparser.model.container.LdifChangeAddRecord;
 import org.apache.directory.studio.ldifparser.model.container.LdifChangeDeleteRecord;
@@ -420,22 +420,22 @@ public class LdifModificationLogger impl
 
         try
         {
-            LdapDN dn = new LdapDN( newDn );
-            Rdn newrdn = dn.getRdn();
-            LdapDN newsuperior = DnUtils.getParent( dn );
+            DN dn = new DN( newDn );
+            RDN newrdn = dn.getRdn();
+            DN newsuperior = DnUtils.getParent( dn );
 
             LdifChangeModDnRecord record = new LdifChangeModDnRecord( LdifDnLine.create(
oldDn ) );
             addControlLines( record, controls );
             record.setChangeType( LdifChangeTypeLine.createModDn() );
-            record.setNewrdn( LdifNewrdnLine.create( newrdn.getUpName() ) );
+            record.setNewrdn( LdifNewrdnLine.create( newrdn.getName() ) );
             record.setDeloldrdn( deleteOldRdn ? LdifDeloldrdnLine.create1() : LdifDeloldrdnLine.create0()
);
-            record.setNewsuperior( LdifNewsuperiorLine.create( newsuperior.getUpName() )
);
+            record.setNewsuperior( LdifNewsuperiorLine.create( newsuperior.getName() ) );
             record.finish( LdifSepLine.create() );
 
             String formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT
);
             log( formattedString, ex, connection );
         }
-        catch ( InvalidNameException e )
+        catch ( LdapInvalidDnException e )
         {
         }
     }

Modified: directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java?rev=1005047&r1=1005046&r2=1005047&view=diff
==============================================================================
--- directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java
(original)
+++ directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java
Wed Oct  6 14:09:51 2010
@@ -28,7 +28,7 @@ import java.util.Set;
 
 import javax.naming.LinkLoopException;
 
-import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.studio.connection.core.Messages;
 import org.eclipse.osgi.util.NLS;
@@ -99,10 +99,10 @@ public class ReferralsInfo
     public class Referral
     {
         private List<LdapURL> urls = new ArrayList<LdapURL>();
-        private LdapDN dn;
+        private DN dn;
 
 
-        public Referral( LdapDN dn )
+        public Referral( DN dn )
         {
             this.dn = dn;
         }
@@ -124,7 +124,7 @@ public class ReferralsInfo
          * 
          * @return the DN
          */
-        public LdapDN getDn()
+        public DN getDn()
         {
             return dn;
         }

Modified: directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java?rev=1005047&r1=1005046&r2=1005047&view=diff
==============================================================================
--- directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java
(original)
+++ directory/studio/branches/shared-trunk-merge/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java
Wed Oct  6 14:09:51 2010
@@ -327,9 +327,9 @@ public class StudioNamingEnumeration imp
                 public SearchResult next() throws NamingException
                 {
                     LdapURL url = urls.remove( 0 );
-                    SearchResult searchResult = new SearchResult( url.getDn().getUpName(),
null, new BasicAttributes(),
+                    SearchResult searchResult = new SearchResult( url.getDn().getName(),
null, new BasicAttributes(),
                         false );
-                    searchResult.setNameInNamespace( url.getDn().getUpName() );
+                    searchResult.setNameInNamespace( url.getDn().getName() );
                     StudioSearchResult ssr = new StudioSearchResult( searchResult, null,
false, url );
                     return ssr;
                 }
@@ -361,13 +361,14 @@ public class StudioNamingEnumeration imp
             if ( referralConnection != null )
             {
                 done = false;
-                String referralSearchBase = url.getDn() != null && !url.getDn().isEmpty()
? url.getDn().getUpName()
+                String referralSearchBase = url.getDn() != null && !url.getDn().isEmpty()
? url.getDn().getName()
                     : searchBase;
                 String referralFilter = url.getFilter() != null && url.getFilter().length()
== 0 ? url.getFilter()
                     : filter;
                 SearchControls referralSearchControls = new SearchControls();
-                referralSearchControls.setSearchScope( url.getScope() > -1 ? url.getScope()
: searchControls
-                    .getSearchScope() );
+                referralSearchControls.setSearchScope( url.getScope().getScope() > -1
? url.getScope().getScope()
+                    : searchControls
+                        .getSearchScope() );
                 referralSearchControls.setReturningAttributes( url.getAttributes() != null
                     && url.getAttributes().size() > 0 ? url.getAttributes().toArray(
                     new String[url.getAttributes().size()] ) : searchControls.getReturningAttributes()
);



Mime
View raw message