directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [directory-studio] branch master updated: Fix Studio to properly compile with teh LDAP API schema parser changes
Date Wed, 16 May 2018 12:37:39 GMT
This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-studio.git


The following commit(s) were added to refs/heads/master by this push:
     new 2e1b894  Fix Studio to properly compile with teh LDAP API schema parser changes
2e1b894 is described below

commit 2e1b89404c1309d70dc51dc781815468561f163f
Author: Emmanuel L├ęcharny <elecharny@symas.com>
AuthorDate: Wed May 16 14:37:37 2018 +0200

    Fix Studio to properly compile with teh LDAP API schema parser changes
---
 .../studio/ldapbrowser/core/model/schema/Schema.java     | 10 +++++-----
 .../schemaeditor/model/io/GenericSchemaConnector.java    |  8 ++++----
 .../model/io/OpenLdapSchemaFileImporter.java             | 16 ++++------------
 .../attributetype/AttributeTypeEditorSourceCodePage.java |  8 ++------
 .../objectclass/ObjectClassEditorSourceCodePage.java     |  7 +------
 5 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java
b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java
index 7e3c18d..56a553a 100644
--- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java
+++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/Schema.java
@@ -261,19 +261,19 @@ public class Schema
             {
                 if ( attributeName.equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT )
)
                 {
-                    ObjectClass ocd = ocdPparser.parseObjectClassDescription( value );
+                    ObjectClass ocd = ocdPparser.parse( value );
                     ocd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                     addObjectClass( ocd );
                 }
                 else if ( attributeName.equalsIgnoreCase( SchemaConstants.ATTRIBUTE_TYPES_AT
) )
                 {
-                    AttributeType atd = atdParser.parseAttributeTypeDescription( value );
+                    AttributeType atd = atdParser.parse( value );
                     atd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                     addAttributeType( atd );
                 }
                 else if ( attributeName.equalsIgnoreCase( SchemaConstants.LDAP_SYNTAXES_AT
) )
                 {
-                    LdapSyntax lsd = lsdParser.parseLdapSyntaxDescription( value );
+                    LdapSyntax lsd = lsdParser.parse( value );
                     if ( StringUtils.isEmpty( lsd.getDescription() )
                         && Utils.getOidDescription( lsd.getOid() ) != null )
                     {
@@ -284,13 +284,13 @@ public class Schema
                 }
                 else if ( attributeName.equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT
) )
                 {
-                    MatchingRule mrd = mrdParser.parseMatchingRuleDescription( value );
+                    MatchingRule mrd = mrdParser.parse( value );
                     mrd.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                     addMatchingRule( mrd );
                 }
                 else if ( attributeName.equalsIgnoreCase( SchemaConstants.MATCHING_RULE_USE_AT
) )
                 {
-                    MatchingRuleUse mrud = mrudParser.parseMatchingRuleUseDescription( value
);
+                    MatchingRuleUse mrud = mrudParser.parse( value );
                     mrud.addExtension( RAW_SCHEMA_DEFINITION_LDIF_VALUE, ldifValues );
                     addMatchingRuleUse( mrud );
                 }
diff --git a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
index 481deb1..d4e3d6a 100644
--- a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
+++ b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
@@ -205,7 +205,7 @@ public class GenericSchemaConnector extends AbstractSchemaConnector implements
S
                         AttributeTypeDescriptionSchemaParser parser = new AttributeTypeDescriptionSchemaParser();
                         parser.setQuirksMode( true );
 
-                        AttributeType atd = parser.parseAttributeTypeDescription( value );
+                        AttributeType atd = parser.parse( value );
 
                         MutableAttributeType impl = new MutableAttributeType( atd.getOid()
);
                         impl.setNames( atd.getNames().toArray( new String[0] ) );
@@ -257,7 +257,7 @@ public class GenericSchemaConnector extends AbstractSchemaConnector implements
S
                     {
                         ObjectClassDescriptionSchemaParser parser = new ObjectClassDescriptionSchemaParser();
                         parser.setQuirksMode( true );
-                        ObjectClass ocd = parser.parseObjectClassDescription( value );
+                        ObjectClass ocd = parser.parse( value );
 
                         MutableObjectClass impl = new MutableObjectClass( ocd.getOid() );
                         impl.setNames( ocd.getNames().toArray( new String[0] ) );
@@ -297,7 +297,7 @@ public class GenericSchemaConnector extends AbstractSchemaConnector implements
S
                     {
                         LdapSyntaxDescriptionSchemaParser parser = new LdapSyntaxDescriptionSchemaParser();
                         parser.setQuirksMode( true );
-                        LdapSyntax lsd = parser.parseLdapSyntaxDescription( value );
+                        LdapSyntax lsd = parser.parse( value );
 
                         LdapSyntax impl = new LdapSyntax( lsd.getOid() );
                         impl.setDescription( lsd.getDescription() );
@@ -352,7 +352,7 @@ public class GenericSchemaConnector extends AbstractSchemaConnector implements
S
                     {
                         MatchingRuleDescriptionSchemaParser parser = new MatchingRuleDescriptionSchemaParser();
                         parser.setQuirksMode( true );
-                        MatchingRule mrd = parser.parseMatchingRuleDescription( value );
+                        MatchingRule mrd = parser.parse( value );
 
                         MutableMatchingRule impl = new MutableMatchingRule( mrd.getOid()
);
                         impl.setDescription( mrd.getDescription() );
diff --git a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java
b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java
index 12fe339..554e794 100644
--- a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java
+++ b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.Scanner;
 import java.util.regex.MatchResult;
 
+import org.apache.directory.api.ldap.model.exception.LdapSchemaException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
 import org.apache.directory.api.ldap.model.schema.MutableObjectClass;
@@ -59,16 +60,7 @@ public class OpenLdapSchemaFileImporter
      */
     public static Schema getSchema( InputStream inputStream, String path ) throws OpenLdapSchemaFileImportException
     {
-        OpenLdapSchemaParser parser = null;
-        try
-        {
-            parser = new OpenLdapSchemaParser();
-        }
-        catch ( IOException e )
-        {
-            throw new OpenLdapSchemaFileImportException( NLS.bind( Messages
-                .getString( "OpenLdapSchemaFileImporter.NotReadCorrectly" ), new String[]
{ path } ), e ); //$NON-NLS-1$
-        }
+        OpenLdapSchemaParser parser = new OpenLdapSchemaParser();
 
         try
         {
@@ -79,7 +71,7 @@ public class OpenLdapSchemaFileImporter
             throw new OpenLdapSchemaFileImportException( NLS.bind( Messages
                 .getString( "OpenLdapSchemaFileImporter.NotReadCorrectly" ), new String[]
{ path } ), e ); //$NON-NLS-1$
         }
-        catch ( ParseException e )
+        catch ( ParseException | LdapSchemaException e )
         {
             ExceptionMessage exceptionMessage = parseExceptionMessage( e.getMessage() );
             throw new OpenLdapSchemaFileImportException( NLS.bind( Messages
@@ -102,7 +94,7 @@ public class OpenLdapSchemaFileImporter
             schema.addAttributeType( at );
         }
 
-        List<?> ocs = parser.getObjectClassTypes();
+        List<?> ocs = parser.getObjectClasses();
         for ( int i = 0; i < ocs.size(); i++ )
         {
             MutableObjectClass oc = convertObjectClass( ( ObjectClass ) ocs.get( i ) );
diff --git a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
index 57c6ddf..df0aba3 100644
--- a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
+++ b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
@@ -21,7 +21,6 @@
 package org.apache.directory.studio.schemaeditor.view.editors.attributetype;
 
 
-import java.io.IOException;
 import java.text.ParseException;
 import java.util.List;
 
@@ -72,6 +71,7 @@ public class AttributeTypeEditorSourceCodePage extends AbstractAttributeTypeEdit
                 OpenLdapSchemaParser parser = new OpenLdapSchemaParser();
                 parser.parse( schemaSourceViewer.getTextWidget().getText() );
                 List<?> attributeTypes = parser.getAttributeTypes();
+                
                 if ( attributeTypes.size() != 1 )
                 {
                     // Throw an exception and return
@@ -81,11 +81,7 @@ public class AttributeTypeEditorSourceCodePage extends AbstractAttributeTypeEdit
                     updateAttributeType( ( AttributeType ) attributeTypes.get( 0 ) );
                 }
             }
-            catch ( IOException e1 )
-            {
-                canLeaveThePage = false;
-            }
-            catch ( ParseException exception )
+            catch ( ParseException e1 )
             {
                 canLeaveThePage = false;
             }
diff --git a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
index a924ee6..0682667 100644
--- a/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
+++ b/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
@@ -21,7 +21,6 @@
 package org.apache.directory.studio.schemaeditor.view.editors.objectclass;
 
 
-import java.io.IOException;
 import java.text.ParseException;
 import java.util.List;
 
@@ -72,7 +71,7 @@ public class ObjectClassEditorSourceCodePage extends AbstractObjectClassEditorPa
                 OpenLdapSchemaParser parser = new OpenLdapSchemaParser();
                 parser.parse( schemaSourceViewer.getTextWidget().getText() );
 
-                List<?> objectclasses = parser.getObjectClassTypes();
+                List<?> objectclasses = parser.getObjectClasses();
                 if ( objectclasses.size() != 1 )
                 {
                     // TODO Throw an exception and return
@@ -82,10 +81,6 @@ public class ObjectClassEditorSourceCodePage extends AbstractObjectClassEditorPa
                     updateObjectClass( ( ObjectClass ) objectclasses.get( 0 ) );
                 }
             }
-            catch ( IOException e1 )
-            {
-                canLeaveThePage = false;
-            }
             catch ( ParseException exception )
             {
                 canLeaveThePage = false;

-- 
To stop receiving notification emails like this one, please contact
elecharny@apache.org.

Mime
View raw message