Fixed javadoc warnings
This commit is contained in:
parent
708b415460
commit
818d73ac2e
11 changed files with 63 additions and 35 deletions
|
|
@ -45,7 +45,7 @@ import java.util.logging.Logger;
|
||||||
/**
|
/**
|
||||||
* The class that extends this will be able to save its state to a database.
|
* 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
|
* 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.
|
* of that object.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -62,6 +62,7 @@ import java.util.logging.Logger;
|
||||||
* <li>DBBean (A Integer reference to another Bean in another table)</li>
|
* <li>DBBean (A Integer reference to another Bean in another table)</li>
|
||||||
* <li>List<DBBean> (A reference table is used to associate Beans into the list)</li>
|
* <li>List<DBBean> (A reference table is used to associate Beans into the list)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
*
|
||||||
* @author Ziver
|
* @author Ziver
|
||||||
*/
|
*/
|
||||||
public abstract class DBBean {
|
public abstract class DBBean {
|
||||||
|
|
@ -77,7 +78,7 @@ public abstract class DBBean {
|
||||||
String value();
|
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 **/
|
/** 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";
|
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;
|
boolean superBean() default false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +88,7 @@ public abstract class DBBean {
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.FIELD)
|
@Target(ElementType.FIELD)
|
||||||
public @interface DBColumn {
|
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();
|
String value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,8 +145,9 @@ public abstract class DBBean {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void save(DBConnection db, boolean recursive) throws SQLException{
|
public void save(DBConnection db, boolean recursive) throws SQLException{
|
||||||
if (saveLock.isHeldByCurrentThread()) // If the current thread already has a lock then this
|
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
|
return; // is a recursive call, and we do not need to do anything
|
||||||
else if (saveLock.tryLock()) {
|
|
||||||
|
if (saveLock.tryLock()) {
|
||||||
Class<? extends DBBean> c = this.getClass();
|
Class<? extends DBBean> c = this.getClass();
|
||||||
DBBeanConfig config = DBBeanConfig.getBeanConfig(c);
|
DBBeanConfig config = DBBeanConfig.getBeanConfig(c);
|
||||||
try {
|
try {
|
||||||
|
|
@ -164,13 +166,13 @@ public abstract class DBBean {
|
||||||
sqlValues.append(", ");
|
sqlValues.append(", ");
|
||||||
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(" (").append(sqlCols).append(")");
|
||||||
query.append(" VALUES(").append(sqlValues).append(")");
|
query.append(" VALUES(").append(sqlValues).append(")");
|
||||||
} else
|
} else
|
||||||
query.append(" DEFAULT VALUES");
|
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());
|
query.append("UPDATE ").append(config.getTableName());
|
||||||
StringBuilder sqlSets = new StringBuilder();
|
StringBuilder sqlSets = new StringBuilder();
|
||||||
for (DBBeanFieldConfig field : config.getFields()) {
|
for (DBBeanFieldConfig field : config.getFields()) {
|
||||||
|
|
@ -191,8 +193,8 @@ public abstract class DBBean {
|
||||||
// Put in the variables in the SQL
|
// Put in the variables in the SQL
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (DBBeanFieldConfig field : config.getFields()) {
|
for (DBBeanFieldConfig field : config.getFields()) {
|
||||||
// Another DBBean class
|
|
||||||
if (DBBean.class.isAssignableFrom(field.getType())) {
|
if (DBBean.class.isAssignableFrom(field.getType())) {
|
||||||
|
// Another DBBean class
|
||||||
DBBean subObj = (DBBean) field.getValue(this);
|
DBBean subObj = (DBBean) field.getValue(this);
|
||||||
if (subObj != null) {
|
if (subObj != null) {
|
||||||
if (recursive || subObj.getId() == null)
|
if (recursive || subObj.getId() == null)
|
||||||
|
|
@ -200,14 +202,13 @@ public abstract class DBBean {
|
||||||
stmt.setObject(index, subObj.getId());
|
stmt.setObject(index, subObj.getId());
|
||||||
} else
|
} else
|
||||||
stmt.setObject(index, null);
|
stmt.setObject(index, null);
|
||||||
index++;
|
} else {
|
||||||
}
|
// Normal field
|
||||||
// Normal field
|
|
||||||
else {
|
|
||||||
Object value = field.getValue(this);
|
Object value = field.getValue(this);
|
||||||
stmt.setObject(index, value);
|
stmt.setObject(index, value);
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
if (this.id != null)
|
if (this.id != null)
|
||||||
stmt.setObject(index, this.id);
|
stmt.setObject(index, this.id);
|
||||||
|
|
@ -290,6 +291,7 @@ public abstract class DBBean {
|
||||||
* @param recursive if all sub beans should be deleted also
|
* @param recursive if all sub beans should be deleted also
|
||||||
* @throws SQLException if there is any issue with the SQL query
|
* @throws SQLException if there is any issue with the SQL query
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void delete(DBConnection db, boolean recursive) throws SQLException{
|
public void delete(DBConnection db, boolean recursive) throws SQLException{
|
||||||
Class<? extends DBBean> c = this.getClass();
|
Class<? extends DBBean> c = this.getClass();
|
||||||
DBBeanConfig config = DBBeanConfig.getBeanConfig(c);
|
DBBeanConfig config = DBBeanConfig.getBeanConfig(c);
|
||||||
|
|
@ -367,8 +369,7 @@ public abstract class DBBean {
|
||||||
PreparedStatement stmt = db.getPreparedStatement(sql);
|
PreparedStatement stmt = db.getPreparedStatement(sql);
|
||||||
stmt.setObject(1, id);
|
stmt.setObject(1, id);
|
||||||
// Run query
|
// Run query
|
||||||
T obj = DBConnection.exec(stmt, DBBeanSQLResultHandler.create(c, db));
|
return DBConnection.exec(stmt, DBBeanSQLResultHandler.create(c, db));
|
||||||
return obj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -400,8 +401,8 @@ public abstract class DBBean {
|
||||||
query.delete(query.length()-2, query.length());
|
query.delete(query.length()-2, query.length());
|
||||||
query.append(")");
|
query.append(")");
|
||||||
|
|
||||||
logger.finest("Create Bean(" + c.getName() + ") query: " + db.toString());
|
logger.finest("Create Bean(" + c.getName() + ") query: " + query);
|
||||||
PreparedStatement stmt = db.getPreparedStatement(db.toString());
|
PreparedStatement stmt = db.getPreparedStatement(query.toString());
|
||||||
|
|
||||||
// Execute the SQL
|
// Execute the SQL
|
||||||
DBConnection.exec(stmt);
|
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() {
|
public final Long getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@ public class FileSearcher implements Iterable<FileSearcher.FileSearchItem>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines if the search should go into sub-folders
|
* Defines if the search should go into sub-folders
|
||||||
|
*
|
||||||
|
* @param recursive true if search should be recursive into subfolders
|
||||||
*/
|
*/
|
||||||
public void setRecursive(boolean recursive) {
|
public void setRecursive(boolean recursive) {
|
||||||
this.recursive = recursive;
|
this.recursive = recursive;
|
||||||
|
|
@ -95,19 +97,25 @@ public class FileSearcher implements Iterable<FileSearcher.FileSearchItem>{
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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) {
|
public void searchFiles(boolean searchFiles) {
|
||||||
this.searchFiles = 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) {
|
public void searchFolders(boolean searchFolders) {
|
||||||
this.searchFolders = 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) {
|
public void searchCompressedFiles(boolean searchCompressedFiles) {
|
||||||
this.searchCompressedFiles = searchCompressedFiles;
|
this.searchCompressedFiles = searchCompressedFiles;
|
||||||
|
|
@ -248,9 +256,12 @@ public class FileSearcher implements Iterable<FileSearcher.FileSearchItem>{
|
||||||
boolean isFile();
|
boolean isFile();
|
||||||
boolean isDirectory();
|
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;
|
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();
|
String[] listFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ public interface AcmeChallengeFactory {
|
||||||
/**
|
/**
|
||||||
* Create a new Challenge object and do any needed actions for the challenge to proceed.
|
* 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.
|
* @return a Challenge object that will be used to authorize a domain.
|
||||||
* @throws AcmeException in case of any issues
|
* @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.
|
* 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) {}
|
default void postChallengeAction(Challenge challenge) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,12 @@ public class AcmeClient {
|
||||||
/**
|
/**
|
||||||
* Create a new instance of the ACME Client and authenticates the user account towards
|
* 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.
|
* 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 {
|
public AcmeClient(AcmeDataStore dataStore, AcmeChallengeFactory challengeFactory, String acmeServerUrl) throws AcmeException {
|
||||||
Security.addProvider(new BouncyCastleProvider());
|
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
|
* 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.
|
* 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 {
|
public void prepareRequest() throws AcmeException {
|
||||||
order = acmeAccount.newOrder().domains(domains).create(); // Order the certificate
|
order = acmeAccount.newOrder().domains(domains).create(); // Order the certificate
|
||||||
|
|
@ -110,6 +116,9 @@ public class AcmeClient {
|
||||||
* the preparation and the actual request.
|
* the preparation and the actual request.
|
||||||
*
|
*
|
||||||
* @return a certificate for the given domains.
|
* @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 {
|
public X509Certificate requestCertificate() throws IOException, AcmeException {
|
||||||
if (order == null)
|
if (order == null)
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* @return a reference to this object so that set methods can be chained.
|
||||||
*/
|
*/
|
||||||
protected HttpURL setParameters(String query) {
|
protected HttpURL setParameters(String query) {
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* 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) {
|
public void addAdditionalArg(String... args) {
|
||||||
additionalArgs.addAll(Arrays.asList(args));
|
additionalArgs.addAll(Arrays.asList(args));
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* 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) {
|
public void addAdditionalArg(String... args) {
|
||||||
additionalArgs.addAll(Arrays.asList(args));
|
additionalArgs.addAll(Arrays.asList(args));
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ import java.io.OutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Interface defining a custom field parser and writer.
|
* An Interface defining a custom field parser and writer.
|
||||||
* <p></p>
|
* <p>
|
||||||
* One singleton instance of the serializer will be instantiated for the lifetime of the
|
* One singleton instance of the serializer will be instantiated for the lifetime of the
|
||||||
* {@link BinaryStructInputStream} and {@link BinaryStructOutputStream} objects.
|
* {@link BinaryStructInputStream} and {@link BinaryStructOutputStream} objects.
|
||||||
* <p></p>
|
* <p>
|
||||||
* NOTE: Partial octet serializing not supported.
|
* NOTE: Partial octet serializing not supported.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A stream class that parses a byte stream into binary struct objects.
|
* A stream class that parses a byte stream into binary struct objects.
|
||||||
* <p></p>
|
* <p>
|
||||||
* Limitations:<br>
|
* Limitations:<br>
|
||||||
* - Does not support sub binary objects.<br>
|
* - Does not support sub binary objects.<br>
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A stream class that generates a byte stream from a binary struct objects.
|
* A stream class that generates a byte stream from a binary struct objects.
|
||||||
* <p></p>
|
* <p>
|
||||||
* Limitations:<br>
|
* Limitations:<br>
|
||||||
* - Does not support sub binary objects.<br>
|
* - Does not support sub binary objects.<br>
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -104,21 +104,21 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a Iterator of all enabled plugins.
|
* @return an Iterator of all enabled plugins.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Iterator<PluginData> iterator() {
|
public Iterator<PluginData> iterator() {
|
||||||
return new EnabledPluginIterator(toList(plugins.values().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.
|
* has defined implementations of the given interface.
|
||||||
*/
|
*/
|
||||||
public <K> Iterator<K> getSingletonIterator(Class<K> intf) {
|
public <K> Iterator<K> getSingletonIterator(Class<K> intf) {
|
||||||
return new PluginSingletonIterator<>(iterator(), 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.
|
* implementations of the given interface.
|
||||||
*/
|
*/
|
||||||
public <K> Iterator<Class<? extends K>> getClassIterator(Class<K> intf) {
|
public <K> Iterator<Class<? extends K>> getClassIterator(Class<K> intf) {
|
||||||
|
|
@ -126,7 +126,7 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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<PluginData> iteratorAll() {
|
public Iterator<PluginData> iteratorAll() {
|
||||||
return plugins.values().iterator();
|
return plugins.values().iterator();
|
||||||
|
|
@ -172,7 +172,7 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Iterator that only returns enabled plugins.
|
* An Iterator that only returns enabled plugins.
|
||||||
*/
|
*/
|
||||||
protected static class EnabledPluginIterator implements Iterator<PluginData> {
|
protected static class EnabledPluginIterator implements Iterator<PluginData> {
|
||||||
private List<PluginData> pluginList;
|
private List<PluginData> pluginList;
|
||||||
|
|
@ -232,6 +232,7 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends T> next() {
|
public Class<? extends T> next() {
|
||||||
if (!hasNext())
|
if (!hasNext())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue