Package org.apache.directory.studio.schemaeditor.model

Examples of org.apache.directory.studio.schemaeditor.model.Schema


     * @see org.eclipse.jface.action.Action#run()
     */
    public void run()
    {
        // Getting the selection
        Schema selectedSchema = null;

        int presentation = Activator.getDefault().getPreferenceStore().getInt(
            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
        if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
        {
View Full Code Here


                for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext(); )
                {
                    Object selectedItem = iterator.next();
                    if ( selectedItem instanceof SchemaWrapper )
                    {
                        Schema schema = ( ( SchemaWrapper ) selectedItem ).getSchema();
                        schemasMap.put( schema.getName().toLowerCase(), schema );
                    }
                    else if ( selectedItem instanceof AttributeTypeWrapper )
                    {
                        AttributeTypeImpl at = ( ( AttributeTypeWrapper ) selectedItem ).getAttributeType();
                        schemaObjectsList.add( at );
View Full Code Here

    public String getSchemaValue()
    {
        StructuredSelection selection = ( StructuredSelection ) schemaComboViewer.getSelection();
        if ( !selection.isEmpty() )
        {
            Schema schema = ( Schema ) selection.getFirstElement();

            return schema.getName();
        }
        else
        {
            return null;
        }
View Full Code Here

        throws NamingException
    {
        monitor.subTask( "Reading schema '" + name + "'" );

        // Creating the schema
        Schema schema = new SchemaImpl( name );

        // Looking for the nodes of the schema
        SearchControls constraintSearch = new SearchControls();
        constraintSearch.setSearchScope( SearchControls.SUBTREE_SCOPE );

        NamingEnumeration<SearchResult> answer = wrapper.search( "cn=" + name + ", ou=schema", "(objectclass=*)",
            constraintSearch, DEREF_ALIAS_METHOD, HANDLE_REFERALS_METHOD, null, monitor, null );
        if ( answer != null )
        {
            while ( answer.hasMoreElements() )
            {
                SearchResult searchResult = ( SearchResult ) answer.nextElement();
                switch ( getNodeType( searchResult ) )
                {
                    case ATTRIBUTE_TYPE:
                        AttributeTypeImpl at = createAttributeType( searchResult );
                        at.setSchema( name );
                        schema.addAttributeType( at );
                        break;
                    case OBJECT_CLASS:
                        ObjectClassImpl oc = createObjectClass( searchResult );
                        oc.setSchema( name );
                        schema.addObjectClass( oc );
                        break;
                    case MATCHING_RULE:
                        MatchingRuleImpl mr = createMatchingRule( searchResult );
                        mr.setSchema( name );
                        schema.addMatchingRule( mr );
                        break;
                    case SYNTAX:
                        SyntaxImpl syntax = createSyntax( searchResult );
                        syntax.setSchema( name );
                        schema.addSyntax( syntax );
                        break;
                    default:
                        break;
                }
            }
View Full Code Here

    public String getSchemaValue()
    {
        StructuredSelection selection = ( StructuredSelection ) schemaComboViewer.getSelection();
        if ( !selection.isEmpty() )
        {
            Schema schema = ( Schema ) selection.getFirstElement();

            return schema.getName();
        }
        else
        {
            return null;
        }
View Full Code Here

            if ( ( selectedSchemas != null ) && ( serverType != null ) )
            {
                SchemaHandler schemaHandler = project.getSchemaHandler();
                for ( String selectedSchema : selectedSchemas )
                {
                    Schema schema = PluginUtils.loadCoreSchema( serverType, selectedSchema );
                    if ( schema != null )
                    {
                        schemaHandler.addSchema( schema );
                    }
                }
View Full Code Here

            if ( ( selectedSchemas != null ) && ( serverType != null ) )
            {
                SchemaHandler schemaHandler = project.getSchemaHandler();
                for ( String selectedSchema : selectedSchemas )
                {
                    Schema schema = PluginUtils.loadCoreSchema( serverType, selectedSchema );
                    if ( schema != null )
                    {
                        schemaHandler.addSchema( schema );
                    }
                }
View Full Code Here

     * @return
     *      the corresponding schema, or null if no schema has been found
     */
    public static Schema loadCoreSchema( ServerTypeEnum serverType, String schemaName )
    {
        Schema schema = null;

        try
        {
            URL url = Platform.getBundle( Activator.PLUGIN_ID ).getResource(
                "resources/schemas/" + getFolderName( serverType ) + "/" + schemaName + ".xml" );
View Full Code Here

     * @param at
     *      the attribute type
     */
    public void addAttributeType( AttributeTypeImpl at )
    {
        Schema schema = getSchema( at.getSchema() );

        if ( schema == null )
        {
            // TODO Throw an exception
        }

        schema.addAttributeType( at );
        addSchemaObject( at );

        // Notifying the listeners
        notifyAttributeTypeAdded( at );
    }
View Full Code Here

     * @param at
     *      the attribute type
     */
    public void removeAttributeType( AttributeTypeImpl at )
    {
        Schema schema = getSchema( at.getSchema() );

        if ( schema == null )
        {
            // TODO Throw an exception
        }

        schema.removeAttributeType( at );
        removeSchemaObject( at );

        // Notifying the listeners
        notifyAttributeTypeRemoved( at );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.schemaeditor.model.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.