diff --git a/src/zutil/db/bean/DBBean.java b/src/zutil/db/bean/DBBean.java index ff2eba5..61be821 100755 --- a/src/zutil/db/bean/DBBean.java +++ b/src/zutil/db/bean/DBBean.java @@ -45,7 +45,7 @@ import java.util.logging.Logger; /** * The class that extends this will be able to save its state to a database. * Fields that are transient will be ignored, and fields that extend - * DBBean will be replaced with the an id which corresponds to the field + * DBBean will be replaced with the id which corresponds to the field * of that object. * *

@@ -62,6 +62,7 @@ import java.util.logging.Logger; *

  • DBBean (A Integer reference to another Bean in another table)
  • *
  • List<DBBean> (A reference table is used to associate Beans into the list)
  • * + * * @author Ziver */ public abstract class DBBean { @@ -77,7 +78,7 @@ public abstract class DBBean { String value(); /** Change the id column name of the bean, default column name is "id", SQL rules apply should not contain any strange characters or spaces **/ String idColumn() default "id"; - /** Sets if the fields in the super classes is also part of the bean **/ + /** Indicates if the fields in the super classes should also be part of the bean **/ boolean superBean() default false; } @@ -87,7 +88,7 @@ public abstract class DBBean { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface DBColumn { - /** This is the name of the column in the database for the specified field. SQL rules apply, should not contain any strange characters or spaces **/ + /** The name of the column in the database for the specified field. SQL rules apply, should not contain any strange characters or spaces **/ String value(); } @@ -144,8 +145,9 @@ public abstract class DBBean { @SuppressWarnings("unchecked") public void save(DBConnection db, boolean recursive) throws SQLException{ if (saveLock.isHeldByCurrentThread()) // If the current thread already has a lock then this - return; // is a recursive call and we do not need to do anything - else if (saveLock.tryLock()) { + return; // is a recursive call, and we do not need to do anything + + if (saveLock.tryLock()) { Class c = this.getClass(); DBBeanConfig config = DBBeanConfig.getBeanConfig(c); try { @@ -164,13 +166,13 @@ public abstract class DBBean { sqlValues.append(", "); sqlValues.append("?"); } - if (config.getFields().size() > 0) { // is there any fields? + if (config.getFields().size() > 0) { // are there any fields in the class? query.append(" (").append(sqlCols).append(")"); query.append(" VALUES(").append(sqlValues).append(")"); } else query.append(" DEFAULT VALUES"); } - else if (config.getFields().size() > 0) { // Is there any fields to update? + else if (config.getFields().size() > 0) { // are there any fields to update? query.append("UPDATE ").append(config.getTableName()); StringBuilder sqlSets = new StringBuilder(); for (DBBeanFieldConfig field : config.getFields()) { @@ -191,8 +193,8 @@ public abstract class DBBean { // Put in the variables in the SQL int index = 1; for (DBBeanFieldConfig field : config.getFields()) { - // Another DBBean class if (DBBean.class.isAssignableFrom(field.getType())) { + // Another DBBean class DBBean subObj = (DBBean) field.getValue(this); if (subObj != null) { if (recursive || subObj.getId() == null) @@ -200,14 +202,13 @@ public abstract class DBBean { stmt.setObject(index, subObj.getId()); } else stmt.setObject(index, null); - index++; - } - // Normal field - else { + } else { + // Normal field Object value = field.getValue(this); stmt.setObject(index, value); - index++; } + + index++; } if (this.id != null) stmt.setObject(index, this.id); @@ -290,6 +291,7 @@ public abstract class DBBean { * @param recursive if all sub beans should be deleted also * @throws SQLException if there is any issue with the SQL query */ + @SuppressWarnings("unchecked") public void delete(DBConnection db, boolean recursive) throws SQLException{ Class c = this.getClass(); DBBeanConfig config = DBBeanConfig.getBeanConfig(c); @@ -367,8 +369,7 @@ public abstract class DBBean { PreparedStatement stmt = db.getPreparedStatement(sql); stmt.setObject(1, id); // Run query - T obj = DBConnection.exec(stmt, DBBeanSQLResultHandler.create(c, db)); - return obj; + return DBConnection.exec(stmt, DBBeanSQLResultHandler.create(c, db)); } /** @@ -400,8 +401,8 @@ public abstract class DBBean { query.delete(query.length()-2, query.length()); query.append(")"); - logger.finest("Create Bean(" + c.getName() + ") query: " + db.toString()); - PreparedStatement stmt = db.getPreparedStatement(db.toString()); + logger.finest("Create Bean(" + c.getName() + ") query: " + query); + PreparedStatement stmt = db.getPreparedStatement(query.toString()); // Execute the SQL DBConnection.exec(stmt); @@ -432,7 +433,7 @@ public abstract class DBBean { } /** - * @return the bean id or null if the bean has not bean saved yet + * @return the bean id or null if the bean has not been saved yet */ public final Long getId() { return id; diff --git a/src/zutil/io/file/FileSearcher.java b/src/zutil/io/file/FileSearcher.java index 636543b..73ddb47 100755 --- a/src/zutil/io/file/FileSearcher.java +++ b/src/zutil/io/file/FileSearcher.java @@ -81,6 +81,8 @@ public class FileSearcher implements Iterable{ /** * Defines if the search should go into sub-folders + * + * @param recursive true if search should be recursive into subfolders */ public void setRecursive(boolean recursive) { this.recursive = recursive; @@ -95,19 +97,25 @@ public class FileSearcher implements Iterable{ //} /** - * Sets if the searcher should match to files. + * Sets if the search should include files. + * + * @param searchFiles true if files should be included in the search results. */ public void searchFiles(boolean searchFiles) { this.searchFiles = searchFiles; } /** - * Sets if the searcher should match to folders. + * Sets if the search should include folders. + * + * @param searchFolders true if folders should be included in search. */ public void searchFolders(boolean searchFolders) { this.searchFolders = searchFolders; } /** - * Sets if the searcher should go into compressed files. + * Sets if the searcher should traverse into compressed files. Currently, only zip files are supported. + * + * @param searchCompressedFiles true if compressed files should be traversed. */ public void searchCompressedFiles(boolean searchCompressedFiles) { this.searchCompressedFiles = searchCompressedFiles; @@ -248,9 +256,12 @@ public class FileSearcher implements Iterable{ boolean isFile(); boolean isDirectory(); - /** @return an InputStream if this is a file otherwise null **/ + /** + * @return an InputStream if this is a file otherwise null + * @throws IOException if there is any IO issue with retrieving the stream object. + */ InputStream getInputStream() throws IOException; - /** @return an String array with all files if this is a folder otherwise null **/ + /** @return a String array with all files if this is a folder otherwise null **/ String[] listFiles(); } diff --git a/src/zutil/net/acme/AcmeChallengeFactory.java b/src/zutil/net/acme/AcmeChallengeFactory.java index f2d99c5..da0ebf2 100644 --- a/src/zutil/net/acme/AcmeChallengeFactory.java +++ b/src/zutil/net/acme/AcmeChallengeFactory.java @@ -9,7 +9,7 @@ public interface AcmeChallengeFactory { /** * Create a new Challenge object and do any needed actions for the challenge to proceed. * - * @param authorization + * @param authorization the authorization object t o use for the challenge. * @return a Challenge object that will be used to authorize a domain. * @throws AcmeException in case of any issues */ @@ -17,6 +17,8 @@ public interface AcmeChallengeFactory { /** * Do any needed cleanup after challenge has completed successfully or failed. + * + * @param challenge the Challenge object that was used for the challenge. */ default void postChallengeAction(Challenge challenge) {} } diff --git a/src/zutil/net/acme/AcmeClient.java b/src/zutil/net/acme/AcmeClient.java index 7aff6e4..aa50266 100644 --- a/src/zutil/net/acme/AcmeClient.java +++ b/src/zutil/net/acme/AcmeClient.java @@ -56,6 +56,12 @@ public class AcmeClient { /** * Create a new instance of the ACME Client and authenticates the user account towards * the AMCE service, if no account exists then a new one will be created. + * + * @param dataStore the AcmeDataStore that should be used to store persistent data. + * @param challengeFactory the challenge type to be used. + * @param acmeServerUrl the URL to the ACME server. + * + * @throws AcmeException in case there is an issue retrieving the ACME account information. */ public AcmeClient(AcmeDataStore dataStore, AcmeChallengeFactory challengeFactory, String acmeServerUrl) throws AcmeException { Security.addProvider(new BouncyCastleProvider()); @@ -88,7 +94,7 @@ public class AcmeClient { * This method will prepare the request for the ACME service. Any manual action must be taken after this * method has been called and before the {@link #requestCertificate()} method is called. * - * @throws AcmeException + * @throws AcmeException if there is a issue preparing the ACME challenge before doing the request to the server. */ public void prepareRequest() throws AcmeException { order = acmeAccount.newOrder().domains(domains).create(); // Order the certificate @@ -110,6 +116,9 @@ public class AcmeClient { * the preparation and the actual request. * * @return a certificate for the given domains. + * + * @throws IOException if there is a network issue connecting to the ACME server. + * @throws AcmeException if there is an issue with the executing the ACME challenge towards the ACME server. */ public X509Certificate requestCertificate() throws IOException, AcmeException { if (order == null) diff --git a/src/zutil/net/http/HttpURL.java b/src/zutil/net/http/HttpURL.java index bc2cb31..77c99ef 100755 --- a/src/zutil/net/http/HttpURL.java +++ b/src/zutil/net/http/HttpURL.java @@ -165,7 +165,7 @@ public class HttpURL { } /** - * @param query the string representing the key value pair separated by & that will be parsed and set as the parameters of the URL + * @param query the string representing the key value pair separated by & that will be parsed and set as the parameters of the URL * @return a reference to this object so that set methods can be chained. */ protected HttpURL setParameters(String query) { diff --git a/src/zutil/osal/app/ffmpeg/FFmpegInput.java b/src/zutil/osal/app/ffmpeg/FFmpegInput.java index f25d0a8..c65a5f3 100644 --- a/src/zutil/osal/app/ffmpeg/FFmpegInput.java +++ b/src/zutil/osal/app/ffmpeg/FFmpegInput.java @@ -86,6 +86,8 @@ public class FFmpegInput { /** * Add additional args that may not be supported by the API, these values will be inserted to the command line as is. + * + * @param args a list of additional commands */ public void addAdditionalArg(String... args) { additionalArgs.addAll(Arrays.asList(args)); diff --git a/src/zutil/osal/app/ffmpeg/FFmpegOutput.java b/src/zutil/osal/app/ffmpeg/FFmpegOutput.java index 8c86378..27d2cd5 100644 --- a/src/zutil/osal/app/ffmpeg/FFmpegOutput.java +++ b/src/zutil/osal/app/ffmpeg/FFmpegOutput.java @@ -123,6 +123,8 @@ public class FFmpegOutput { /** * Add additional args that may not be supported by the API, these values will be inserted to the command line as is. + * + * @param args a list of FFmpeg arguments */ public void addAdditionalArg(String... args) { additionalArgs.addAll(Arrays.asList(args)); diff --git a/src/zutil/parser/binary/BinaryFieldSerializer.java b/src/zutil/parser/binary/BinaryFieldSerializer.java index 53a1e81..09373cc 100755 --- a/src/zutil/parser/binary/BinaryFieldSerializer.java +++ b/src/zutil/parser/binary/BinaryFieldSerializer.java @@ -30,10 +30,10 @@ import java.io.OutputStream; /** * An Interface defining a custom field parser and writer. - *

    + *

    * One singleton instance of the serializer will be instantiated for the lifetime of the * {@link BinaryStructInputStream} and {@link BinaryStructOutputStream} objects. - *

    + *

    * NOTE: Partial octet serializing not supported. * */ diff --git a/src/zutil/parser/binary/BinaryStructInputStream.java b/src/zutil/parser/binary/BinaryStructInputStream.java index 00a8cf2..3f68205 100755 --- a/src/zutil/parser/binary/BinaryStructInputStream.java +++ b/src/zutil/parser/binary/BinaryStructInputStream.java @@ -35,7 +35,7 @@ import java.util.Map; /** * A stream class that parses a byte stream into binary struct objects. - *

    + *

    * Limitations:
    * - Does not support sub binary objects.
    * diff --git a/src/zutil/parser/binary/BinaryStructOutputStream.java b/src/zutil/parser/binary/BinaryStructOutputStream.java index ba64d10..ad2a8b7 100755 --- a/src/zutil/parser/binary/BinaryStructOutputStream.java +++ b/src/zutil/parser/binary/BinaryStructOutputStream.java @@ -36,7 +36,7 @@ import java.util.Map; /** * A stream class that generates a byte stream from a binary struct objects. - *

    + *

    * Limitations:
    * - Does not support sub binary objects.
    * diff --git a/src/zutil/plugin/PluginManager.java b/src/zutil/plugin/PluginManager.java index 8e967bb..c9481d2 100755 --- a/src/zutil/plugin/PluginManager.java +++ b/src/zutil/plugin/PluginManager.java @@ -104,21 +104,21 @@ public class PluginManager implements Iterable{ } /** - * @return a Iterator of all enabled plugins. + * @return an Iterator of all enabled plugins. */ @Override public Iterator iterator() { return new EnabledPluginIterator(toList(plugins.values().iterator())); } /** - * @return a Iterator for singleton Objects from all plugins that are enabled and + * @return an Iterator for singleton Objects from all plugins that are enabled and * has defined implementations of the given interface. */ public Iterator getSingletonIterator(Class intf) { return new PluginSingletonIterator<>(iterator(), intf); } /** - * @return a Iterator for classes from all plugins that are enabled and has defined + * @return an Iterator for classes from all plugins that are enabled and has defined * implementations of the given interface. */ public Iterator> getClassIterator(Class intf) { @@ -126,7 +126,7 @@ public class PluginManager implements Iterable{ } /** - * @return a Iterator of all plugins, independently on if they are enabled or disabled. + * @return an Iterator of all plugins, independently on if they are enabled or disabled. */ public Iterator iteratorAll() { return plugins.values().iterator(); @@ -172,7 +172,7 @@ public class PluginManager implements Iterable{ /** - * A Iterator that only returns enabled plugins. + * An Iterator that only returns enabled plugins. */ protected static class EnabledPluginIterator implements Iterator { private List pluginList; @@ -232,6 +232,7 @@ public class PluginManager implements Iterable{ return false; } + @SuppressWarnings("unchecked") @Override public Class next() { if (!hasNext())