You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/02/14 15:19:20 UTC
svn commit: r1243935 - in
/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io:
ApacheDsSchemaConnector.java GenericSchemaConnector.java
Author: elecharny
Date: Tue Feb 14 14:19:20 2012
New Revision: 1243935
URL: http://svn.apache.org/viewvc?rev=1243935&view=rev
Log:
Fixed a potential pb with the handling of HumanReadable attributes
Modified:
directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java
directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java?rev=1243935&r1=1243934&r2=1243935&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java Tue Feb 14 14:19:20 2012
@@ -6,16 +6,16 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.studio.schemaeditor.model.io;
@@ -94,14 +94,14 @@ public class ApacheDsSchemaConnector ext
NamingEnumeration<SearchResult> answer = wrapper
.search( "ou=schema", "(objectclass=metaSchema)", constraintSearch, DEREF_ALIAS_METHOD,
- HANDLE_REFERALS_METHOD, null, ( StudioProgressMonitor ) monitor, null );
+ HANDLE_REFERALS_METHOD, null, monitor, null );
if ( answer != null )
{
try
{
while ( answer.hasMore() )
{
- SearchResult searchResult = ( SearchResult ) answer.next();
+ SearchResult searchResult = answer.next();
// Getting the 'cn' Attribute
Attribute cnAttribute = searchResult.getAttributes().get( "cn" );
@@ -151,7 +151,7 @@ public class ApacheDsSchemaConnector ext
{
if ( answer.hasMore() )
{
- SearchResult searchResult = ( SearchResult ) answer.next();
+ SearchResult searchResult = answer.next();
Attribute vendorNameAttribute = searchResult.getAttributes().get( "vendorName" );
if ( vendorNameAttribute == null )
@@ -190,7 +190,7 @@ public class ApacheDsSchemaConnector ext
private static Schema getSchema( ConnectionWrapper wrapper, String name, StudioProgressMonitor monitor )
throws NamingException
{
- monitor.subTask( name ); //$NON-NLS-1$
+ monitor.subTask( name );
// Creating the schema
Schema schema = new Schema( name );
@@ -207,7 +207,7 @@ public class ApacheDsSchemaConnector ext
{
while ( answer.hasMore() )
{
- SearchResult searchResult = ( SearchResult ) answer.next();
+ SearchResult searchResult = answer.next();
switch ( getNodeType( searchResult ) )
{
case ATTRIBUTE_TYPE:
@@ -293,9 +293,9 @@ public class ApacheDsSchemaConnector ext
* @param sr
* the SearchResult
* @return
- * the AttributeTypeImpl associated with the SearchResult, or null if no
+ * the AttributeTypeImpl associated with the SearchResult, or null if no
* AttributeTypeImpl could be created
- * @throws NamingException
+ * @throws NamingException
*/
private static AttributeType createAttributeType( SearchResult sr ) throws NamingException
{
@@ -323,9 +323,9 @@ public class ApacheDsSchemaConnector ext
* @param sr
* the SearchResult
* @return
- * the ObjectClassImpl associated with the SearchResult, or null if no
+ * the ObjectClassImpl associated with the SearchResult, or null if no
* ObjectClassImpl could be created
- * @throws NamingException
+ * @throws NamingException
*/
private static ObjectClass createObjectClass( SearchResult sr ) throws NamingException
{
@@ -347,9 +347,9 @@ public class ApacheDsSchemaConnector ext
* @param sr
* the SearchResult
* @return
- * the MatchingRule associated with the SearchResult, or null if no
+ * the MatchingRule associated with the SearchResult, or null if no
* ObjectClass could be created
- * @throws NamingException
+ * @throws NamingException
*/
private static MatchingRule createMatchingRule( SearchResult sr ) throws NamingException
{
@@ -368,9 +368,9 @@ public class ApacheDsSchemaConnector ext
* @param sr
* the SearchResult
* @return
- * the MatchingRule associated with the SearchResult, or null if no
+ * the MatchingRule associated with the SearchResult, or null if no
* ObjectClass could be created
- * @throws NamingException
+ * @throws NamingException
*/
private static LdapSyntax createSyntax( SearchResult sr ) throws NamingException
{
@@ -885,7 +885,7 @@ public class ApacheDsSchemaConnector ext
*/
private static boolean isHumanReadable( SearchResult sr ) throws NamingException
{
- Attribute at = sr.getAttributes().get( "x-humanReadable" );
+ Attribute at = sr.getAttributes().get( "x-not-human-readable" );
if ( at == null )
{
@@ -893,7 +893,7 @@ public class ApacheDsSchemaConnector ext
}
else
{
- return Boolean.parseBoolean( ( String ) at.get() );
+ return !Boolean.parseBoolean( ( String ) at.get() );
}
}
Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java?rev=1243935&r1=1243934&r2=1243935&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java (original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java Tue Feb 14 14:19:20 2012
@@ -6,16 +6,16 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.studio.schemaeditor.model.io;
@@ -30,6 +30,7 @@ import javax.naming.directory.Attribute;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.LdapSyntax;
import org.apache.directory.shared.ldap.model.schema.MatchingRule;
@@ -75,10 +76,22 @@ public class GenericSchemaConnector exte
SearchControls constraintSearch = new SearchControls();
constraintSearch.setSearchScope( SearchControls.OBJECT_SCOPE );
constraintSearch.setReturningAttributes( new String[]
- { "attributeTypes", "objectClasses", "ldapSyntaxes", "matchingRules" } );
+ {
+ SchemaConstants.ATTRIBUTE_TYPES_AT,
+ SchemaConstants.COMPARATORS_AT,
+ SchemaConstants.DIT_CONTENT_RULES_AT,
+ SchemaConstants.DIT_STRUCTURE_RULES_AT,
+ SchemaConstants.LDAP_SYNTAXES_AT,
+ SchemaConstants.MATCHING_RULES_AT,
+ SchemaConstants.MATCHING_RULE_USE_AT,
+ SchemaConstants.NAME_FORMS_AT,
+ SchemaConstants.NORMALIZERS_AT,
+ SchemaConstants.OBJECT_CLASSES_AT,
+ SchemaConstants.SYNTAX_CHECKERS_AT
+ } );
String schemaDn = getSubschemaSubentry( wrapper, monitor );
NamingEnumeration<SearchResult> answer = wrapper.search( schemaDn, "(objectclass=subschema)", constraintSearch,
- DEREF_ALIAS_METHOD, HANDLE_REFERALS_METHOD, null, ( StudioProgressMonitor ) monitor, null );
+ DEREF_ALIAS_METHOD, HANDLE_REFERALS_METHOD, null, monitor, null );
if ( answer != null )
{
try
@@ -91,7 +104,7 @@ public class GenericSchemaConnector exte
schema.setProject( project );
schemas.add( schema );
- getSchema( schema, wrapper, ( SearchResult ) answer.next(), monitor );
+ getSchema( schema, wrapper, answer.next(), monitor );
}
}
@@ -134,7 +147,7 @@ public class GenericSchemaConnector exte
{
if ( answer.hasMore() )
{
- SearchResult searchResult = ( SearchResult ) answer.next();
+ SearchResult searchResult = answer.next();
Attribute subschemaSubentryAttribute = searchResult.getAttributes().get( "subschemaSubentry" );
if ( subschemaSubentryAttribute == null )