From: Roland Haeder Date: Wed, 19 Aug 2015 09:18:46 +0000 (+0200) Subject: Moved class/interface in proper package as they are only "helper" classes and no... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=20f0765221106e042d4a954a5cf2d56019669d91;p=jcore.git Moved class/interface in proper package as they are only "helper" classes and no useable backend. Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jcore/database/backend/base64/Base64CsvDatabaseBackend.java b/src/org/mxchange/jcore/database/backend/base64/Base64CsvDatabaseBackend.java index 60511d8..885710e 100644 --- a/src/org/mxchange/jcore/database/backend/base64/Base64CsvDatabaseBackend.java +++ b/src/org/mxchange/jcore/database/backend/base64/Base64CsvDatabaseBackend.java @@ -29,8 +29,8 @@ import org.apache.commons.codec.binary.Base64; import org.mxchange.jcore.criteria.searchable.SearchableCriteria; import org.mxchange.jcore.database.backend.BaseDatabaseBackend; import org.mxchange.jcore.database.backend.DatabaseBackend; -import org.mxchange.jcore.database.backend.file.DatabaseFile; -import org.mxchange.jcore.database.backend.file.SynchronizeableFile; +import org.mxchange.jcore.database.file.DatabaseFile; +import org.mxchange.jcore.database.file.SynchronizeableFile; import org.mxchange.jcore.database.frontend.DatabaseFrontend; import org.mxchange.jcore.database.result.DatabaseResult; import org.mxchange.jcore.database.result.Result; diff --git a/src/org/mxchange/jcore/database/backend/file/DatabaseFile.java b/src/org/mxchange/jcore/database/backend/file/DatabaseFile.java deleted file mode 100644 index 40b4434..0000000 --- a/src/org/mxchange/jcore/database/backend/file/DatabaseFile.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jcore.database.backend.file; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import org.mxchange.jcore.BaseFrameworkSystem; - -/** - * This implementation of SynchronizeableFile provides synchronized access on the RandomAccessFile - instance. This implementation is thread-safe, therefor. - * - * @author Roland Haeder - */ -public class DatabaseFile extends BaseFrameworkSystem implements SynchronizeableFile { - /** - * The actual file instance - */ - private final RandomAccessFile file; - - /** - * A constructor accepting a full-qualified file name (FQFN). - * @param fqfn Full-qualified file name - * @throws FileNotFoundException - */ - public DatabaseFile (final String fqfn) throws FileNotFoundException { - // Init it here - this.file = new RandomAccessFile(fqfn, "rw"); //NOI18N - } - - @Override - public void close () throws IOException{ - synchronized (this.file) { - this.file.close(); - } - } - - @Override - public long getFilePointer () throws IOException { - synchronized (this.file) { - return this.file.getFilePointer(); - } - } - - @Override - public long length () throws IOException { - synchronized (this.file) { - return this.file.length(); - } - } - - @Override - public String readLine () throws IOException { - synchronized (this.file) { - return this.file.readLine(); - } - } - - @Override - public void seek (final long i) throws IOException { - synchronized (this.file) { - this.file.seek(i); - } - } - - @Override - public void writeBytes (final String string) throws IOException { - synchronized (this.file) { - this.file.writeBytes(string); - } - } -} diff --git a/src/org/mxchange/jcore/database/backend/file/SynchronizeableFile.java b/src/org/mxchange/jcore/database/backend/file/SynchronizeableFile.java deleted file mode 100644 index 13425f4..0000000 --- a/src/org/mxchange/jcore/database/backend/file/SynchronizeableFile.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jcore.database.backend.file; - -import java.io.IOException; -import org.mxchange.jcore.FrameworkInterface; - -/** - * An interface for sy nchronized access on files, with auto-close support. - * - * @author Roland Haeder - */ -public interface SynchronizeableFile extends FrameworkInterface, AutoCloseable{ - - public void close () throws IOException; - - public long getFilePointer () throws IOException; - - public long length () throws IOException; - - public String readLine () throws IOException; - - public void seek (final long i) throws IOException; - - public void writeBytes (final String string) throws IOException; -} diff --git a/src/org/mxchange/jcore/database/file/DatabaseFile.java b/src/org/mxchange/jcore/database/file/DatabaseFile.java new file mode 100644 index 0000000..153a167 --- /dev/null +++ b/src/org/mxchange/jcore/database/file/DatabaseFile.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcore.database.file; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.RandomAccessFile; +import org.mxchange.jcore.BaseFrameworkSystem; + +/** + * This implementation of SynchronizeableFile provides synchronized access on the RandomAccessFile + instance. This implementation is thread-safe, therefor. + * + * @author Roland Haeder + */ +public class DatabaseFile extends BaseFrameworkSystem implements SynchronizeableFile { + /** + * The actual file instance + */ + private final RandomAccessFile file; + + /** + * A constructor accepting a full-qualified file name (FQFN). + * @param fqfn Full-qualified file name + * @throws FileNotFoundException + */ + public DatabaseFile (final String fqfn) throws FileNotFoundException { + // Init it here + this.file = new RandomAccessFile(fqfn, "rw"); //NOI18N + } + + @Override + public void close () throws IOException{ + synchronized (this.file) { + this.file.close(); + } + } + + @Override + public long getFilePointer () throws IOException { + synchronized (this.file) { + return this.file.getFilePointer(); + } + } + + @Override + public long length () throws IOException { + synchronized (this.file) { + return this.file.length(); + } + } + + @Override + public String readLine () throws IOException { + synchronized (this.file) { + return this.file.readLine(); + } + } + + @Override + public void seek (final long i) throws IOException { + synchronized (this.file) { + this.file.seek(i); + } + } + + @Override + public void writeBytes (final String string) throws IOException { + synchronized (this.file) { + this.file.writeBytes(string); + } + } +} diff --git a/src/org/mxchange/jcore/database/file/SynchronizeableFile.java b/src/org/mxchange/jcore/database/file/SynchronizeableFile.java new file mode 100644 index 0000000..98996d5 --- /dev/null +++ b/src/org/mxchange/jcore/database/file/SynchronizeableFile.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcore.database.file; + +import java.io.IOException; +import org.mxchange.jcore.FrameworkInterface; + +/** + * An interface for sy nchronized access on files, with auto-close support. + * + * @author Roland Haeder + */ +public interface SynchronizeableFile extends FrameworkInterface, AutoCloseable{ + + public void close () throws IOException; + + public long getFilePointer () throws IOException; + + public long length () throws IOException; + + public String readLine () throws IOException; + + public void seek (final long i) throws IOException; + + public void writeBytes (final String string) throws IOException; +}