91 public AbstractFile
addLocalFile(File fileOnDisk, String name, String parentPath,
92 Long ctime, Long crtime, Long atime, Long mtime,
93 DataSource dataSource)
throws TskCoreException {
98 SleuthkitCase.CaseDbTransaction trans =
null;
100 if (useSingleTransaction) {
103 trans = sleuthkitCase.beginTransaction();
108 if (fileOnDisk.exists()) {
109 size = fileOnDisk.length();
113 AbstractFile file = sleuthkitCase.addLocalFile(name, fileOnDisk.getAbsolutePath(), size,
114 ctime, crtime, atime, mtime,
115 true, TskData.EncodingType.NONE, parentDir, trans);
117 if (! useSingleTransaction) {
121 }
catch (TskCoreException ex) {
122 if ((!useSingleTransaction) && (
null != trans)) {
125 }
catch (TskCoreException ex2) {
126 logger.log(Level.SEVERE, String.format(
"Failed to rollback transaction after exception: %s", ex.getMessage()), ex2);
145 if ((directory ==
null) || directory.getPath().isEmpty()) {
146 throw new TskCoreException(
"Can not create directory from null path");
154 File parent = directory.getParentFile();
155 if (parent ==
null) {
181 SleuthkitCase.CaseDbTransaction trans =
null;
184 if (useSingleTransaction) {
187 trans = sleuthkitCase.beginTransaction();
189 SpecialDirectory dir;
191 dir = sleuthkitCase.addLocalDirectory(parentId, name, trans);
193 if (! useSingleTransaction) {
197 }
catch (TskCoreException ex) {
198 if (( !useSingleTransaction) && (
null != trans)) {
201 }
catch (TskCoreException ex2) {
202 logger.log(Level.SEVERE, String.format(
"Failed to rollback transaction after exception: %s", ex.getMessage()), ex2);