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

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


    }


    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


        // check if a required objectClass is selected
        if ( getSelectedValues().length > 0 && !selectedObjectClasses.isEmpty() )
        {
            IEntry entry = getSelectedValues()[0].getAttribute().getEntry();
            Schema schema = entry.getBrowserConnection().getSchema();
            // get remaining attributes
            String[] ocValues = entry.getSubschema().getObjectClassNames();
            Set<String> remainingObjectClassesSet = new HashSet<String>( Arrays.asList( ocValues ) );
            remainingObjectClassesSet.removeAll( selectedObjectClasses );
            Set<AttributeTypeDescription> remainingAttributeSet = new HashSet<AttributeTypeDescription>();
            for ( String oc : remainingObjectClassesSet )
            {
                ObjectClassDescription ocd = schema.getObjectClassDescription( oc );
                if ( ocd != null )
                {
                    Collection<String> mustAttrs = SchemaUtils.getMustAttributeTypeDescriptionNamesTransitive( ocd,
                        schema );
                    for ( String mustAttr : mustAttrs )
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

    /**
     * Refreshes this schema page.
     */
    public void refresh()
    {
        Schema schema = null;
        if ( showDefaultSchemaAction.isChecked() )
        {
            schema = Schema.DEFAULT_SCHEMA;
        }
        else if ( getConnection() != null )
View Full Code Here

    private void connectionUpdated( IBrowserConnection connection )
    {

        if ( !this.dnText.isDisposed() )
        {
            Schema schema = null;
            if ( connection != null )
            {
                schema = connection.getSchema();
            }

            if ( schema != null && schema.getDn() != null )
            {
                dnText.setText( schema.getDn().toString() );
            }
            else
            {
                dnText.setText( "-" );
            }

            if ( schema != null && schema.getCreateTimestamp() != null )
            {
                ctText.setText( schema.getCreateTimestamp() );
            }
            else
            {
                ctText.setText( "-" );
            }

            if ( schema != null && schema.getModifyTimestamp() != null )
            {
                mtText.setText( schema.getModifyTimestamp() );
            }
            else
            {
                mtText.setText( "-" );
            }
View Full Code Here

                    rawValueType = line.getRawValueType();
                }

                if ( offset <= part.getOffset() + rawAttributeDescription.length() )
                {
                    Schema schema = editor.getConnection() != null ? editor.getConnection().getSchema()
                        : Schema.DEFAULT_SCHEMA;
                    String[] attributeNames = schema.getAttributeTypeDescriptionNames();
                    Arrays.sort( attributeNames );
                    for ( int a = 0; a < attributeNames.length; a++ )
                    {
                        if ( rawAttributeDescription.length() == 0
                            || attributeNames[a].toLowerCase().startsWith( rawAttributeDescription.toLowerCase() ) )
                        {

                            String proposal = attributeNames[a];

                            if ( rawValueType.length() == 0 )
                            {
                                if ( schema.getAttributeTypeDescription( proposal ).isBinary() )
                                {
                                    proposal += ":: ";
                                }
                                else
                                {
View Full Code Here

               
                LdifEnumeration le = ExportLdifJob.search( browserConnection, sp, monitor );
                if ( le.hasNext() )
                {
                    LdifContentRecord schemaRecord = ( LdifContentRecord ) le.next();
                    Schema schema = new Schema();
                    schema.loadFromRecord( schemaRecord );
                    browserConnection.setSchema( schema );
                    // TODO: Schema update event
//                    EventRegistry.fireConnectionUpdated( new ConnectionUpdateEvent( this,
//                        ConnectionUpdateEvent.EventDetail.SCHEMA_LOADED ), this );
                }
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

        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

            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

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.