View Javadoc

1   /*
2   Wotonomy: OpenStep design patterns for pure Java applications.
3   Copyright (C) 2000 Michael Powers
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  Lesser General Public License for more details.
14  
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, see http://www.gnu.org
17  */
18  
19  package net.wotonomy.datastore;
20  
21  import java.io.File;
22  import java.io.Serializable;
23  import java.util.Iterator;
24  
25  public class DataStore implements Serializable
26  {
27      protected File homeDirectory;
28      
29      public DataStore( String aPath )
30      {
31      	homeDirectory = new File( aPath );
32      	
33          // if specified directory does not exist
34          if ( ! homeDirectory.exists() )
35          {
36              homeDirectory.mkdirs();
37          }
38          
39  	// if existing path is a file, exit with error
40  	if ( homeDirectory.isDirectory() )
41  	{
42  	    new RuntimeException( "DataStore: Specified directory is a file." );
43  	}
44      }
45      
46      public File getHomeDirectory()
47      {
48      	return homeDirectory;
49      }
50      
51      
52      public DataSoup getSoupForName( String aName ) 
53      {
54      	return null; 
55      }
56      public void removeSoup( DataSoup aSoup ) 
57      {
58      	// FIXME
59      }
60      public Iterator getAllSoups()
61      {
62      	return null; 
63      }
64      
65      public static void main( String[] argv ) 
66      {
67      	new DataStore( "/Local/Users/michael/Projects/test/data" );
68      }
69      
70  }
71  
72  /*
73   * $Log$
74   * Revision 1.2  2006/02/19 16:26:19  cgruber
75   * Move non-unit-test code to tests project
76   * Fix up code to work with proper imports
77   * Fix maven dependencies.
78   *
79   * Revision 1.1  2006/02/16 13:18:56  cgruber
80   * Check in all sources in eclipse-friendly maven-enabled packages.
81   *
82   * Revision 1.2  2001/03/05 22:12:11  mpowers
83   * Created the control package for a datastore-specific implementation
84   * of EOObjectStore.
85   *
86   * Revision 1.1.1.1  2000/12/21 15:47:05  mpowers
87   * Contributing wotonomy.
88   *
89   * Revision 1.2  2000/12/20 16:25:36  michael
90   * Added log to all files.
91   *
92   *
93   */
94