Package org.apache.directory.studio.ldapbrowser.core.model.schema

Examples of org.apache.directory.studio.ldapbrowser.core.model.schema.Schema


        // check if a required objectClass is selected
        if ( values.size() > 0 && !selectedObjectClasses.isEmpty() )
        {
            IEntry entry = values.iterator().next().getAttribute().getEntry();
            Schema schema = entry.getBrowserConnection().getSchema();
            // get remaining attributes
            Collection<ObjectClassDescription> remainingObjectClasses = entry.getObjectClassDescriptions();
            remainingObjectClasses.removeAll( selectedObjectClasses );
            Set<AttributeTypeDescription> remainingAttributeSet = new HashSet<AttributeTypeDescription>();
            for ( ObjectClassDescription ocd : remainingObjectClasses )
View Full Code Here


        attributeOid2AtdMap = new TreeMap<String, AttributeTypeDescription>();
        BrowserConnectionManager cm = BrowserCorePlugin.getDefault().getConnectionManager();
        IBrowserConnection[] connections = cm.getBrowserConnections();
        for ( IBrowserConnection browserConnection : connections )
        {
            Schema schema = browserConnection.getSchema();
            createAttributeMaps( schema );
        }
        createAttributeMaps( Schema.DEFAULT_SCHEMA );
        attributeNamesAndOids = new String[attributeNames2AtdMap.size() + attributeOid2AtdMap.size()];
        System.arraycopy( attributeNames2AtdMap.keySet().toArray(), 0, attributeNamesAndOids, 0, attributeNames2AtdMap
            .size() );
        System.arraycopy( attributeOid2AtdMap.keySet().toArray(), 0, attributeNamesAndOids, attributeNames2AtdMap
            .size(), attributeOid2AtdMap.size() );

        // init available syntaxes
        syntaxOid2LsdMap = new TreeMap<String, LdapSyntaxDescription>();
        syntaxDesc2LsdMap = new TreeMap<String, LdapSyntaxDescription>();
        for ( IBrowserConnection browserConnection : connections )
        {
            Schema schema = browserConnection.getSchema();
            createSyntaxMaps( schema );
        }
        createSyntaxMaps( Schema.DEFAULT_SCHEMA );
        syntaxOids = new String[syntaxOid2LsdMap.size()];
        System.arraycopy( syntaxOid2LsdMap.keySet().toArray(), 0, syntaxOids, 0, syntaxOid2LsdMap.size() );
View Full Code Here

        Collection<ObjectClassDescription> ocds = new ArrayList<ObjectClassDescription>();
        IAttribute ocAttribute = getAttribute( SchemaConstants.OBJECT_CLASS_AT );
        if ( ocAttribute != null )
        {
            String[] ocNames = ocAttribute.getStringValues();
            Schema schema = getBrowserConnection().getSchema();
            for ( String ocName : ocNames )
            {
                ObjectClassDescription ocd = schema.getObjectClassDescription( ocName );
                ocds.add( ocd );
            }
        }
        return ocds;
    }
View Full Code Here

            try
            {
                String schemaFilename = getSchemaCacheFileName( connection.getId() );
                FileReader reader = new FileReader( schemaFilename );
                Schema schema = new Schema();
                schema.loadFromLdif( reader );
                browserConnection.setSchema( schema );
            }
            catch ( Exception e )
            {
            }
View Full Code Here

        // check all the attributes
        for ( String attributeDescription : attributeDescriptions )
        {
            // get attribute type schema information
            Schema schema = oldEntry.getBrowserConnection().getSchema();
            AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeDescription );
            boolean hasEMR = SchemaUtils.getEqualityMatchingRuleNameOrNumericOidTransitive( atd, schema ) != null;
            boolean isReplaceForced = ( hasEMR && modifyMode == ModifyMode.REPLACE )
                || ( !hasEMR && modifyModeNoEMR == ModifyMode.REPLACE );
            boolean isAddDelForced = ( hasEMR && modifyMode == ModifyMode.ADD_DELETE )
                || ( !hasEMR && modifyModeNoEMR == ModifyMode.ADD_DELETE );
View Full Code Here

        attributeOid2AtdMap = new TreeMap<String, AttributeTypeDescription>();
        BrowserConnectionManager cm = BrowserCorePlugin.getDefault().getConnectionManager();
        IBrowserConnection[] connections = cm.getBrowserConnections();
        for ( IBrowserConnection browserConnection : connections )
        {
            Schema schema = browserConnection.getSchema();
            createAttributeMaps( schema );
        }
        createAttributeMaps( Schema.DEFAULT_SCHEMA );
        attributeTypesAndOids = new String[attributeNames2AtdMap.size() + attributeOid2AtdMap.size()];
        System.arraycopy( attributeNames2AtdMap.keySet().toArray(), 0, attributeTypesAndOids, 0, attributeNames2AtdMap
            .size() );
        System.arraycopy( attributeOid2AtdMap.keySet().toArray(), 0, attributeTypesAndOids, attributeNames2AtdMap
            .size(), attributeOid2AtdMap.size() );

        // init available syntaxes
        syntaxOid2LsdMap = new TreeMap<String, LdapSyntaxDescription>();
        syntaxDesc2LsdMap = new TreeMap<String, LdapSyntaxDescription>();
        for ( IBrowserConnection browserConnection : connections )
        {
            Schema schema = browserConnection.getSchema();
            createSyntaxMaps( schema );
        }
        createSyntaxMaps( Schema.DEFAULT_SCHEMA );
        syntaxDescsAndOids = new String[syntaxOid2LsdMap.size()];
        System.arraycopy( syntaxOid2LsdMap.keySet().toArray(), 0, syntaxDescsAndOids, 0, syntaxOid2LsdMap.size() );
View Full Code Here

        // set syntax content
        String lsdOid = null;
        LdapSyntaxDescription lsd = null;
        if ( mrd != null )
        {
            Schema schema = getSchema();
            lsdOid = mrd.getSyntax();
            if ( lsdOid != null && schema.hasLdapSyntaxDescription( lsdOid ) )
            {
                lsd = schema.getLdapSyntaxDescription( lsdOid );
            }
        }
        syntaxLink.setText( getNonNullString( lsd != null ? lsd.getNumericOid() : lsdOid ) );
        syntaxLink.setHref( lsd );
        syntaxLink.setUnderlined( lsd != null );
View Full Code Here

            try
            {
                monitor.reportProgress( BrowserCoreMessages.model__loading_schema );

                // check if schema is cached
                Schema schema = browserConnection.getSchema();
                if ( schema == Schema.DEFAULT_SCHEMA )
                {
                    ReloadSchemasJob.reloadSchema( browserConnection, monitor );
                }
                else if ( rootDSE.getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY ) != null )
                {
                    // check if schema is up-to-date
                    SearchParameter sp = new SearchParameter();
                    sp.setSearchBase( new LdapDN( rootDSE.getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY )
                        .getStringValue() ) );
                    sp.setFilter( Schema.SCHEMA_FILTER );
                    sp.setScope( SearchScope.OBJECT );
                    sp.setReturningAttributes( new String[]
                        { IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP,
                            IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP, } );
                    ISearch search = new Search( browserConnection, sp );

                    SearchJob.searchAndUpdateModel( browserConnection, search, monitor );
                    ISearchResult[] results = search.getSearchResults();

                    if ( results != null && results.length == 1 )
                    {
                        String schemaTimestamp = results[0]
                            .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP ) != null ? results[0]
                            .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_MODIFY_TIMESTAMP ).getStringValue() : null;
                        if ( schemaTimestamp == null )
                        {
                            schemaTimestamp = results[0]
                                .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP ) != null ? results[0]
                                .getAttribute( IAttribute.OPERATIONAL_ATTRIBUTE_CREATE_TIMESTAMP ).getStringValue()
                                : null;
                        }
                        String cacheTimestamp = schema.getModifyTimestamp() != null ? schema.getModifyTimestamp()
                            : schema.getCreateTimestamp();
                        if ( cacheTimestamp == null
                            || ( cacheTimestamp != null && schemaTimestamp != null && schemaTimestamp
                                .compareTo( cacheTimestamp ) > 0 ) )
                        {
                            ReloadSchemasJob.reloadSchema( browserConnection, monitor );
View Full Code Here

     */
    private static void setBinaryAttributes( IBrowserConnection browserConnection, StudioProgressMonitor monitor )
    {
        List<String> binaryAttributeNames = new ArrayList<String>();

        Schema schema = browserConnection.getSchema();
        AttributeTypeDescription[] attributeTypeDescriptions = schema.getAttributeTypeDescriptions();
        for ( AttributeTypeDescription atd : attributeTypeDescriptions )
        {
            if ( atd.isBinary() )
            {
                String name = atd.getNames() == null || atd.getNames().length == 0 ? atd.getNumericOID() : atd
View Full Code Here

    }


    private Object getRawValue( IBrowserConnection connection, Object value )
    {
        Schema schema = null;
        if ( connection != null )
        {
            schema = connection.getSchema();
        }
        if ( schema == null || value == null || !( value instanceof String ) )
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.schema.Schema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.