Coverage Report - org.jtheque.core.managers.file.impl.JTDBackuper
 
Classes in this File Line Coverage Branch Coverage Complexity
JTDBackuper
0 %
0/8
0 %
0/2
1
 
 1  
 package org.jtheque.core.managers.file.impl;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque 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
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 import org.jtheque.core.managers.file.IFileManager.JTDVersion;
 21  
 import org.jtheque.core.managers.file.able.BackupWriter;
 22  
 import org.jtheque.core.managers.file.able.Backuper;
 23  
 import org.jtheque.core.managers.file.able.BasicDataSource;
 24  
 import org.jtheque.core.managers.file.able.FileType;
 25  
 import org.jtheque.core.utils.file.jt.JTFileWriter;
 26  
 import org.jtheque.core.utils.file.jt.impl.JTDFileWriter;
 27  
 import org.jtheque.utils.io.FileException;
 28  
 
 29  
 import java.io.File;
 30  
 import java.util.Collection;
 31  
 
 32  
 /**
 33  
  * A Backuper for the JTD format.
 34  
  *
 35  
  * @author Baptiste Wicht
 36  
  */
 37  0
 public final class JTDBackuper implements Backuper {
 38  
     @Override
 39  
     public void backup(File file, Collection<BackupWriter> writers) throws FileException {
 40  0
         JTFileWriter writer = new JTDFileWriter(writers);
 41  
 
 42  0
         BasicDataSource dataSource = new BasicDataSource();
 43  0
         dataSource.setFileVersion(JTDVersion.FIRST.ordinal());
 44  0
         dataSource.setVersion(Managers.getCore().getApplication().getVersion());
 45  
 
 46  0
         writer.writeFile(file, dataSource);
 47  0
     }
 48  
 
 49  
     @Override
 50  
     public boolean canExportTo(FileType fileType) {
 51  0
         return fileType == FileType.JTD;
 52  
     }
 53  
 }