Warning: Attempt to read property "date" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Warning: Attempt to read property "msg" on null in /home/www/websvn.26th.net/html/blame.php on line 247

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/www/websvn.26th.net/html/blame.php on line 247
WebSVN – general – Blame – /PhotoAlbum/trunk/src/ak/photoalbum/logic/MetaInfo.java/ – Rev 1242

Subversion Repositories general

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1242 dev 1
package ak.photoalbum.webapp;
2
 
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.Map;
6
import java.util.Hashtable;
7
 
8
public class MetaInfo
9
{
10
  private File   dir;
11
  private String dirPath;
12
  private Map    items = new Hashtable(); // <String, MetaInfoItem>
13
 
14
  public MetaInfo()
15
  {
16
  }
17
 
18
  public File getDir()
19
  {
20
    return dir;
21
  }
22
 
23
  public void setDir(File dir)
24
    throws IOException
25
  {
26
    this.dir     = dir;
27
    this.dirPath = dir.getCanonicalPath();
28
    if(!this.dirPath.endsWith(File.separator))
29
      this.dirPath += File.separator;
30
  }
31
 
32
  public void addItem(MetaInfoItem item)
33
  {
34
    items.put(item.getId(), item);
35
  }
36
 
37
  public MetaInfoItem findItem(File file)
38
    throws IOException
39
  {
40
    String filePath = file.getCanonicalPath();
41
    String id;
42
 
43
    if(file.isDirectory() && !filePath.endsWith(File.separator))
44
      filePath += File.separator;
45
 
46
    if(filePath.length() < dirPath.length())
47
      return null;
48
    else if(filePath.length() == dirPath.length())
49
      id = ".";
50
    else
51
      id = filePath.substring(dirPath.length());
52
 
53
    return (MetaInfoItem)items.get(id);
54
  }
55
}
56