1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.crypto.store

File FileStoreReference.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
6
4
1
76
25
5
0.83
1.5
4
1.25

Classes

Class Line # Actions
FileStoreReference 31 6 0% 5 1
0.916666791.7%
 

Contributing tests

This file is covered by 13 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software 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 software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20   
21    package org.xwiki.crypto.store;
22   
23    import java.io.File;
24   
25    /**
26    * Reference to a cryptographic store on the filesystem.
27    *
28    * @version $Id: 4896fa350d4f8aa924a564ae08a1e816fe83a944 $
29    * @since 6.1M2
30    */
 
31    public class FileStoreReference implements StoreReference
32    {
33    private File file;
34   
35    private boolean isMulti = true;
36   
37    /**
38    * Wrap a file or folder as a store reference.
39    *
40    * @param file a file or folder.
41    */
 
42  1 toggle public FileStoreReference(File file)
43    {
44  1 this.file = file;
45  1 this.isMulti = file.isDirectory();
46    }
47   
48    /**
49    * Wrap a file or folder as a store reference.
50    *
51    * @param file a file or folder (that may not exists).
52    * @param isMulti true to force a multi key store when the file does not exists yet.
53    * Actually, Multi key store are always directory.
54    */
 
55  1 toggle public FileStoreReference(File file, boolean isMulti)
56    {
57  1 this.file = file;
58  1 this.isMulti = file.exists() ? file.isDirectory() : isMulti;
59    }
60   
61    /**
62    * @return the wrapped file reference.
63    */
 
64  13 toggle public File getFile()
65    {
66  13 return this.file;
67    }
68   
69    /**
70    * @return true if this store is a directory.
71    */
 
72  13 toggle public boolean isMulti()
73    {
74  13 return this.isMulti;
75    }
76    }