Skip to content

Commit

Permalink
add javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
marevol committed Dec 26, 2024
1 parent 29a1c2f commit 6e3e51a
Show file tree
Hide file tree
Showing 26 changed files with 923 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,33 @@
import org.codelibs.fess.crawler.entity.ResponseData;

/**
* @author shinsuke
*
* Interface representing a client for a web crawler.
* This client is responsible for executing requests and handling responses.
* It extends {@link AutoCloseable} to allow for resource management.
*/
public interface CrawlerClient extends AutoCloseable {

/**
* Sets the initialization parameters for the crawler client.
*
* @param params a map containing the initialization parameters
*/
void setInitParameterMap(Map<String, Object> params);

/**
* Executes a request and returns the response data.
*
* @param data the request data to be executed
* @return the response data from the executed request
*/
ResponseData execute(RequestData data);

/**
* Closes the crawler client and releases any resources associated with it.
* This default implementation does nothing.
*
* @throws Exception if an error occurs during closing
*/
@Override
default void close() throws Exception {
// nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,30 @@
import org.apache.http.auth.Credentials;

/**
*
*
* @author shinsuke
*
* The Authentication interface provides methods to retrieve authentication details
* required for HTTP client authentication.
*/
public interface Authentication {

/**
* Retrieves the authentication scope associated with this authentication.
*
* @return the {@link AuthScope} object representing the authentication scope.
*/
AuthScope getAuthScope();

/**
* Retrieves the credentials associated with the current authentication.
*
* @return the credentials object containing authentication details.
*/
Credentials getCredentials();

/**
* Retrieves the authentication scheme to be used for HTTP requests.
*
* @return the authentication scheme
*/
AuthScheme getAuthScheme();

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,43 @@
import org.codelibs.core.lang.StringUtil;

/**
* @author shinsuke
* The CrawlerContainer interface provides methods for managing components
* within a crawler container. It includes methods to retrieve components,
* check availability, and destroy the container. Additionally, it provides
* a default method to initialize the container with specific protocol handlers.
*
*/
public interface CrawlerContainer {

/**
* Retrieves a component by its name.
*
* @param <T> the type of the component
* @param name the name of the component to retrieve
* @return the component instance of the specified type
*/
<T> T getComponent(String name);

/**
* Checks if the crawler container is available.
*
* @return true if the crawler container is available, false otherwise.
*/
boolean available();

/**
* Cleans up resources and performs any necessary finalization tasks
* before the object is destroyed. This method should be called to
* ensure that all resources are properly released.
*/
void destroy();

/**
* Initializes the CrawlerContainer by setting the system property
* "java.protocol.handler.pkgs" to include the package "org.codelibs.fess.net.protocol".
* If the property is not already set, it will be initialized with this package.
* If the property is set but does not contain this package, the package will be appended.
*/
default void initialize() {
final StringBuilder buf = new StringBuilder(100);
final String value = System.getProperty("java.protocol.handler.pkgs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,213 @@
package org.codelibs.fess.crawler.entity;

/**
* @author shinsuke
* Represents the result of accessing a resource.
*
* @param <IDTYPE> the type of the identifier for the access result
*/
public interface AccessResult<IDTYPE> {

/**
* Initializes the access result with the given response and result data.
*
* @param responseData the response data
* @param resultData the result data
*/
void init(ResponseData responseData, ResultData resultData);

/**
* Returns the identifier of the access result.
*
* @return the identifier
*/
IDTYPE getId();

/**
* Sets the identifier of the access result.
*
* @param id the identifier
*/
void setId(IDTYPE id);

/**
* Returns the session identifier.
*
* @return the session identifier
*/
String getSessionId();

/**
* Sets the session identifier.
*
* @param sessionId the session identifier
*/
void setSessionId(String sessionId);

/**
* Returns the rule identifier.
*
* @return the rule identifier
*/
String getRuleId();

/**
* Sets the rule identifier.
*
* @param ruleId the rule identifier
*/
void setRuleId(String ruleId);

/**
* Returns the URL of the accessed resource.
*
* @return the URL
*/
String getUrl();

/**
* Sets the URL of the accessed resource.
*
* @param url the URL
*/
void setUrl(String url);

/**
* Returns the parent URL of the accessed resource.
*
* @return the parent URL
*/
String getParentUrl();

/**
* Sets the parent URL of the accessed resource.
*
* @param parentUrl the parent URL
*/
void setParentUrl(String parentUrl);

/**
* Returns the status of the access result.
*
* @return the status
*/
Integer getStatus();

/**
* Sets the status of the access result.
*
* @param status the status
*/
void setStatus(Integer status);

/**
* Returns the HTTP status code of the access result.
*
* @return the HTTP status code
*/
Integer getHttpStatusCode();

/**
* Sets the HTTP status code of the access result.
*
* @param httpStatusCode the HTTP status code
*/
void setHttpStatusCode(Integer httpStatusCode);

/**
* Returns the HTTP method used for the access.
*
* @return the HTTP method
*/
String getMethod();

/**
* Sets the HTTP method used for the access.
*
* @param method the HTTP method
*/
void setMethod(String method);

/**
* Returns the MIME type of the accessed resource.
*
* @return the MIME type
*/
String getMimeType();

/**
* Sets the MIME type of the accessed resource.
*
* @param mimeType the MIME type
*/
void setMimeType(String mimeType);

/**
* Returns the creation time of the access result.
*
* @return the creation time
*/
Long getCreateTime();

/**
* Sets the creation time of the access result.
*
* @param createTime the creation time
*/
void setCreateTime(Long createTime);

/**
* Returns the execution time of the access.
*
* @return the execution time
*/
Integer getExecutionTime();

/**
* Sets the execution time of the access.
*
* @param executionTime the execution time
*/
void setExecutionTime(Integer executionTime);

/**
* Returns the data associated with the access result.
*
* @return the access result data
*/
AccessResultData<IDTYPE> getAccessResultData();

/**
* Sets the data associated with the access result.
*
* @param accessResultData the access result data
*/
void setAccessResultData(AccessResultData<IDTYPE> accessResultData);

/**
* Returns the content length of the accessed resource.
*
* @return the content length
*/
Long getContentLength();

/**
* Sets the content length of the accessed resource.
*
* @param contentLength the content length
*/
void setContentLength(Long contentLength);

/**
* Returns the last modified time of the accessed resource.
*
* @return the last modified time
*/
Long getLastModified();

/**
* Sets the last modified time of the accessed resource.
*
* @param lastModified the last modified time
*/
void setLastModified(Long lastModified);
}
Loading

0 comments on commit 6e3e51a

Please sign in to comment.