directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r656560 - in /directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration: ./ editor/ model/ model/v150/ model/v151/ model/v152/
Date Thu, 15 May 2008 09:09:24 GMT
Author: pamarcelot
Date: Thu May 15 02:09:24 2008
New Revision: 656560

URL: http://svn.apache.org/viewvc?rev=656560&view=rev
Log:
o Fixed the ContentDescriber class.
o Added a 'public boolean valid( Reader reader)' method to the ServerXmlIO interface and its
implementations (this method is used in the ContentDescriber class to determine if the given
file is valid or not for the editor).

Removed:
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationContentTypeChecker.java
Modified:
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerXmlIO.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v150/ServerXmlIOV150.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v151/ServerXmlIOV151.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java?rev=656560&r1=656559&r2=656560&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java
Thu May 15 02:09:24 2008
@@ -24,7 +24,7 @@
 import java.io.InputStream;
 import java.io.Reader;
 
-import org.apache.directory.studio.apacheds.configuration.model.ServerConfigurationContentTypeChecker;
+import org.apache.directory.studio.apacheds.configuration.model.ServerXmlIO;
 import org.eclipse.core.runtime.QualifiedName;
 import org.eclipse.core.runtime.content.IContentDescription;
 import org.eclipse.core.runtime.content.ITextContentDescriber;
@@ -48,7 +48,7 @@
      */
     public int describe( Reader contents, IContentDescription description ) throws IOException
     {
-        if ( ServerConfigurationContentTypeChecker.isValid( contents ) )
+        if ( isValid( contents ) )
         {
             return ITextContentDescriber.VALID;
         }
@@ -64,7 +64,7 @@
      */
     public int describe( InputStream contents, IContentDescription description ) throws IOException
     {
-        if ( ServerConfigurationContentTypeChecker.isValid( contents ) )
+        if ( isValid( contents ) )
         {
             return ITextContentDescriber.VALID;
         }
@@ -82,4 +82,56 @@
     {
         return SUPPORTED_OPTIONS;
     }
+
+
+    /**
+     * Indicates if the given {@link Reader} is a valid server configuration.
+     *
+     * @param contents
+     *      the contents reader
+     * @return
+     *      <code>true</code> if the given reader is a valid server 
+     *      configuration, <code>false</code> if not
+     */
+    private boolean isValid( Reader contents )
+    {
+        // Looping on the ServerXmlIO classes to find a corresponding one
+        ServerXmlIO[] serverXmlIOs = ApacheDSConfigurationPlugin.getDefault().getServerXmlIOs();
+        for ( ServerXmlIO validationServerXmlIO : serverXmlIOs )
+        {
+            // Checking if the ServerXmlIO is valid
+            if ( validationServerXmlIO.isValid( contents ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+
+    /**
+     * Indicates if the given {@link InputStream} is a valid server configuration.
+     *
+     * @param contents
+     *      the contents input stream
+     * @return
+     *      <code>true</code> if the given input stream is a valid server 
+     *      configuration, <code>false</code> if not
+     */
+    private boolean isValid( InputStream contents )
+    {
+        // Looping on the ServerXmlIO classes to find a corresponding one
+        ServerXmlIO[] serverXmlIOs = ApacheDSConfigurationPlugin.getDefault().getServerXmlIOs();
+        for ( ServerXmlIO validationServerXmlIO : serverXmlIOs )
+        {
+            // Checking if the ServerXmlIO is valid
+            if ( validationServerXmlIO.isValid( contents ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
 }

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java?rev=656560&r1=656559&r2=656560&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
Thu May 15 02:09:24 2008
@@ -158,7 +158,7 @@
         ServerXmlIO[] serverXmlIOs = ApacheDSConfigurationPlugin.getDefault().getServerXmlIOs();
         for ( ServerXmlIO validationServerXmlIO : serverXmlIOs )
         {
-            // Checking if the ServerXmlIO
+            // Checking if the ServerXmlIO is valid
             if ( validationServerXmlIO.isValid( getInputStream( input ) ) )
             {
                 serverXmlIO = validationServerXmlIO;

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerXmlIO.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerXmlIO.java?rev=656560&r1=656559&r2=656560&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerXmlIO.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerXmlIO.java
Thu May 15 02:09:24 2008
@@ -21,6 +21,7 @@
 
 
 import java.io.InputStream;
+import java.io.Reader;
 
 
 /**
@@ -46,6 +47,19 @@
 
 
     /**
+     * Indicates whether or not the given reader is a valid 'server.xml' 
+     * file.
+     *
+     * @param reader
+     *      the reader to use
+     * @return
+     *      <code>true</code> if the given reader is a valid 
+     *      'server.xml' file, <code>false</code> if not
+     */
+    public boolean isValid( Reader reader );
+
+
+    /**
      * Parses the given input and returns the corresponding server configuration.
      *
      * @param is

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v150/ServerXmlIOV150.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v150/ServerXmlIOV150.java?rev=656560&r1=656559&r2=656560&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v150/ServerXmlIOV150.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v150/ServerXmlIOV150.java
Thu May 15 02:09:24 2008
@@ -70,13 +70,8 @@
     }
 
 
-    /**
-     * Checks if the InputStream is valid.
-     *
-     * @param inputStream
-     *      the InputStream
-     * @return
-     *      true if the InputStream is valid, false if not
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.configuration.model.ServerXmlIO#isValid(java.io.Reader)
      */
     public boolean isValid( Reader reader )
     {

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v151/ServerXmlIOV151.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v151/ServerXmlIOV151.java?rev=656560&r1=656559&r2=656560&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v151/ServerXmlIOV151.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v151/ServerXmlIOV151.java
Thu May 15 02:09:24 2008
@@ -73,13 +73,8 @@
     }
 
 
-    /**
-     * Checks if the InputStream is valid.
-     *
-     * @param inputStream
-     *      the InputStream
-     * @return
-     *      true if the InputStream is valid, false if not
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.configuration.model.ServerXmlIO#isValid(java.io.Reader)
      */
     public boolean isValid( Reader reader )
     {

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java?rev=656560&r1=656559&r2=656560&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
Thu May 15 02:09:24 2008
@@ -21,6 +21,7 @@
 
 
 import java.io.InputStream;
+import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -70,6 +71,16 @@
 
 
     /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.configuration.model.ServerXmlIO#isValid(java.io.Reader)
+     */
+    public boolean isValid( Reader reader )
+    {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+
+    /* (non-Javadoc)
      * @see org.apache.directory.studio.apacheds.configuration.model.ServerXmlIO#parse(java.io.InputStream)
      */
     public ServerConfiguration parse( InputStream is ) throws ServerXmlIOException
@@ -1025,8 +1036,8 @@
         // OptimizerEnabled
         jdbmPartitionElement.addAttribute( "optimizerEnabled", "" + partition.isEnableOptimizer()
);
 
-        // SynchOnWrite
-        jdbmPartitionElement.addAttribute( "synchOnWrite", "" + partition.isSynchronizationOnWrite()
);
+        // SyncOnWrite
+        jdbmPartitionElement.addAttribute( "syncOnWrite", "" + partition.isSynchronizationOnWrite()
);
 
         // IndexedAttributes
         createIndexedAttributes( jdbmPartitionElement, partition.getIndexedAttributes() );



Mime
View raw message