directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r639664 - in /directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core: ConnectionFolderManager.java io/ConnectionIO.java
Date Fri, 21 Mar 2008 15:19:14 GMT
Author: pamarcelot
Date: Fri Mar 21 08:18:58 2008
New Revision: 639664

URL: http://svn.apache.org/viewvc?rev=639664&view=rev
Log:
Part of a fix for DIRSTUDIO-46 (Add connections import/export).

Modified:
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionIO.java

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java?rev=639664&r1=639663&r2=639664&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java
(original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionFolderManager.java
Fri Mar 21 08:18:58 2008
@@ -121,6 +121,18 @@
 
 
     /**
+     * Gets an array of connection folders.
+     *
+     * @return
+     *      an array of connection folders
+     */
+    public ConnectionFolder[] getConnectionFolders()
+    {
+        return folderList.toArray( new ConnectionFolder[0] );
+    }
+
+
+    /**
      * Gets a connection folder from its id.
      *
      * @param id
@@ -181,8 +193,8 @@
         }
         return getRootConnectionFolder();
     }
-    
-    
+
+
     /**
      * Gets the parent connection folder of the given connection folder 
      * or null if the folder doesn't have a parent folder.
@@ -216,7 +228,7 @@
     public Set<ConnectionFolder> getAllSubFolders( ConnectionFolder folder )
     {
         Set<ConnectionFolder> allSubFolders = new HashSet<ConnectionFolder>();
-        
+
         List<String> ids = new ArrayList<String>();
         ids.add( folder.getId() );
         while ( !ids.isEmpty() )
@@ -224,10 +236,10 @@
             String id = ids.remove( 0 );
             ConnectionFolder subFolder = getConnectionFolderById( id );
             allSubFolders.add( subFolder );
-            
+
             ids.addAll( subFolder.getSubFolderIds() );
         }
-        
+
         return allSubFolders;
     }
 
@@ -242,18 +254,18 @@
     public Set<ConnectionFolder> getAllParentFolders( ConnectionFolder folder )
     {
         Set<ConnectionFolder> allParentFolders = new HashSet<ConnectionFolder>();
-        
+
         do
         {
             allParentFolders.add( folder );
             folder = getParentConnectionFolder( folder );
         }
         while ( folder != null );
-        
+
         return allParentFolders;
     }
-    
-    
+
+
     /**
      * Gets the root connection folder.
      * 

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionIO.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionIO.java?rev=639664&r1=639663&r2=639664&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionIO.java
(original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/ConnectionIO.java
Fri Mar 21 08:18:58 2008
@@ -20,9 +20,9 @@
 package org.apache.directory.studio.connection.core.io;
 
 
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
@@ -82,7 +82,7 @@
      * @throws ConnectionIOException 
      *      if an error occurs when converting the document
      */
-    public static Set<ConnectionParameter> load( FileInputStream stream ) throws ConnectionIOException
+    public static Set<ConnectionParameter> load( InputStream stream ) throws ConnectionIOException
     {
         Set<ConnectionParameter> connections = new HashSet<ConnectionParameter>();
 
@@ -242,7 +242,7 @@
      * @throws IOException
      *      if an I/O error occurs
      */
-    public static void save( Set<ConnectionParameter> connections, FileOutputStream
stream ) throws IOException
+    public static void save( Set<ConnectionParameter> connections, OutputStream stream
) throws IOException
     {
         // Creating the Document
         Document document = DocumentHelper.createDocument();
@@ -330,7 +330,7 @@
      * @throws ConnectionIOException 
      *      if an error occurs when converting the document
      */
-    public static Set<ConnectionFolder> loadConnectionFolders( FileInputStream stream
) throws ConnectionIOException
+    public static Set<ConnectionFolder> loadConnectionFolders( InputStream stream )
throws ConnectionIOException
     {
         Set<ConnectionFolder> connectionFolders = new HashSet<ConnectionFolder>();
 
@@ -438,7 +438,7 @@
      * @throws IOException
      *      if an I/O error occurs
      */
-    public static void saveConnectionFolders( Set<ConnectionFolder> connectionFolders,
FileOutputStream stream ) throws IOException
+    public static void saveConnectionFolders( Set<ConnectionFolder> connectionFolders,
OutputStream stream ) throws IOException
     {
         // Creating the Document
         Document document = DocumentHelper.createDocument();



Mime
View raw message