Skip to content

Commit

Permalink
adding config to all services missing config (#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick authored Feb 6, 2024
1 parent a0457c0 commit ad05d26
Show file tree
Hide file tree
Showing 35 changed files with 119 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.myrobotlab.document.Document;
import org.myrobotlab.document.transformer.ConnectorConfig;
import org.myrobotlab.framework.Service;
import org.myrobotlab.service.config.ServiceConfig;
import org.myrobotlab.service.config.AbstractConnectorConfig;
import org.myrobotlab.service.interfaces.DocumentConnector;
import org.myrobotlab.service.interfaces.DocumentPublisher;

Expand All @@ -17,7 +17,7 @@
* service.
*
*/
public abstract class AbstractConnector extends Service<ServiceConfig> implements DocumentPublisher, DocumentConnector {
public abstract class AbstractConnector <C extends AbstractConnectorConfig> extends Service<C> implements DocumentPublisher, DocumentConnector {

private static final long serialVersionUID = 1L;
protected ConnectorState state = ConnectorState.STOPPED;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/CsvConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
import org.myrobotlab.document.connector.AbstractConnector;
import org.myrobotlab.document.connector.ConnectorState;
import org.myrobotlab.document.transformer.ConnectorConfig;
import org.myrobotlab.service.config.CsvConnectorConfig;
import org.myrobotlab.string.StringUtil;

import au.com.bytecode.opencsv.CSVReader;

public class CsvConnector extends AbstractConnector {
public class CsvConnector extends AbstractConnector<CsvConnectorConfig> {

private static final long serialVersionUID = 1L;
private String filename;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/DatabaseConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import org.myrobotlab.document.connector.AbstractConnector;
import org.myrobotlab.document.connector.ConnectorState;
import org.myrobotlab.document.transformer.ConnectorConfig;
import org.myrobotlab.service.config.DatabaseConnectorConfig;

public class DatabaseConnector extends AbstractConnector {
public class DatabaseConnector extends AbstractConnector<DatabaseConnectorConfig> {

/**
*
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/ImapEmailConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.myrobotlab.document.Document;
import org.myrobotlab.document.connector.AbstractConnector;
import org.myrobotlab.document.transformer.ConnectorConfig;
import org.myrobotlab.service.config.ImapEmailConnectorConfig;

import com.sun.mail.imap.IMAPFolder;

Expand All @@ -36,7 +37,7 @@
* documents that represents the emails messages that were crawled.
*
*/
public class ImapEmailConnector extends AbstractConnector {
public class ImapEmailConnector extends AbstractConnector<ImapEmailConnectorConfig> {

private static final long serialVersionUID = 1L;
private static final String MESSAGE_ID_HEADER = "message_id";
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/RSSConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import org.myrobotlab.document.connector.AbstractConnector;
import org.myrobotlab.document.connector.ConnectorState;
import org.myrobotlab.document.transformer.ConnectorConfig;
import org.myrobotlab.service.config.RSSConnectorConfig;

import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

public class RSSConnector extends AbstractConnector {
public class RSSConnector extends AbstractConnector<RSSConnectorConfig> {

private static final long serialVersionUID = 1L;

Expand Down
59 changes: 0 additions & 59 deletions src/main/java/org/myrobotlab/service/Tensorflow.java

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/TesseractOcr.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.logging.Logging;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.config.TesseractOcrConfig;
import org.slf4j.Logger;

/**
Expand All @@ -37,7 +38,7 @@
* thai vie - vietnamese
*
*/
public class TesseractOcr extends Service {
public class TesseractOcr extends Service<TesseractOcrConfig> {

private static final long serialVersionUID = 1L;
transient private TessBaseAPI api = null;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/TestThrower.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
import org.myrobotlab.framework.Service;
import org.myrobotlab.framework.interfaces.Attachable;
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.service.config.TestThrowerConfig;
import org.slf4j.Logger;

/**
*
* TestThrower - used for testing.
*
*/
public class TestThrower extends Service {
public class TestThrower extends Service<TestThrowerConfig> {

private static final long serialVersionUID = 1L;
public final static Logger log = LoggerFactory.getLogger(TestThrower.class);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/ThingSpeak.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.myrobotlab.logging.Logging;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.net.HttpRequest;
import org.myrobotlab.service.config.ThingSpeakConfig;
import org.myrobotlab.service.data.Pin;
import org.slf4j.Logger;

Expand All @@ -20,7 +21,7 @@
*
*/

public class ThingSpeak extends Service {
public class ThingSpeak extends Service<ThingSpeakConfig> {

private static final long serialVersionUID = 1L;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/TopCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.logging.Logging;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.config.TopCodesConfig;
import org.slf4j.Logger;

import topcodes.Scanner;
Expand All @@ -28,7 +29,7 @@
* SHOULD BE AS PERPENDICULAR AS POSSIBLE TO THE CODE, IN ORDER TO WORK WELL.
*
*/
public class TopCodes extends Service {
public class TopCodes extends Service<TopCodesConfig> {

private static final long serialVersionUID = 1L;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/Twitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.logging.Logging;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.config.TwitterConfig;
import org.slf4j.Logger;

import twitter4j.Status;
Expand All @@ -26,7 +27,7 @@
* have a consumerKey and accessToken from a twitter account.
*
*/
public class Twitter extends Service {
public class Twitter extends Service<TwitterConfig> {

private static final long serialVersionUID = 1L;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/WatchDogTimer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import org.myrobotlab.logging.Level;
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.config.WatchDogTimerConfig;
import org.slf4j.Logger;

public class WatchDogTimer extends Service {
public class WatchDogTimer extends Service<WatchDogTimerConfig> {

List<Message> globalActions = new ArrayList<Message>();

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/WebGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,8 @@ public static void main(String[] args) {

try {

Runtime.main(new String[] { "--log-level", "info", "-s", "webgui", "WebGui", "intro", "Intro", "python", "Python" });
// Runtime.main(new String[] { "--log-level", "info", "-s", "webgui", "WebGui", "intro", "Intro", "python", "Python" });
Runtime.main(new String[] { "--install" });

boolean done = true;
if (done) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/WiiDar.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
import org.myrobotlab.logging.Logging;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.Wii.IRData;
import org.myrobotlab.service.config.WiiDarConfig;
import org.myrobotlab.service.data.Pin;
import org.slf4j.Logger;

// TODO - BlockingQueue - + reference !

public class WiiDar extends Service {
public class WiiDar extends Service<WiiDarConfig> {

public final static class Point implements Serializable {
private static final long serialVersionUID = 1L;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/myrobotlab/service/WikiDataFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import org.myrobotlab.logging.Level;
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.config.WikiDataFetcherConfig;
import org.slf4j.Logger;
import org.wikidata.wdtk.datamodel.interfaces.EntityDocument;
import org.wikidata.wdtk.datamodel.interfaces.GlobeCoordinatesValue;
import org.wikidata.wdtk.datamodel.interfaces.ItemDocument;
import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue;
import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;
import org.wikidata.wdtk.datamodel.interfaces.QuantityValue;
import org.wikidata.wdtk.datamodel.interfaces.Statement;
Expand All @@ -23,7 +23,7 @@
import org.wikidata.wdtk.wikibaseapi.WikibaseDataFetcher;
import org.wikidata.wdtk.wikibaseapi.apierrors.MediaWikiApiErrorException;

public class WikiDataFetcher extends Service {
public class WikiDataFetcher extends Service<WikiDataFetcherConfig> {

private static final long serialVersionUID = 1L;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/myrobotlab/service/WolframAlpha.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.myrobotlab.framework.Service;
import org.myrobotlab.logging.Level;
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.logging.Logging;
import org.myrobotlab.logging.LoggingFactory;
import org.myrobotlab.service.config.WolframAlphaConfig;
import org.myrobotlab.service.data.SearchResults;
import org.slf4j.Logger;

Expand All @@ -23,7 +23,7 @@
* get the result.
*
*/
public class WolframAlpha extends Service {
public class WolframAlpha extends Service<WolframAlphaConfig> {

private static final long serialVersionUID = 1L;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/service/XMLConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.myrobotlab.document.transformer.ConnectorConfig;
import org.myrobotlab.document.xml.MRLChunkingXMLHandler;
import org.myrobotlab.document.xml.RecordingInputStream;
import org.myrobotlab.service.config.XMLConnectorConfig;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
Expand All @@ -24,7 +25,7 @@
* document that can be published to the doc pipeline, or other
* DocumentListener.
*/
public class XMLConnector extends AbstractConnector {
public class XMLConnector extends AbstractConnector<XMLConnectorConfig> {

private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.service.config.YahooFinanceStockQuoteConfig;
import org.slf4j.Logger;

/**
* A service to query into Yahoo's api with a query to the current price for a
* given ticker symbol. This requires
*/
public class YahooFinanceStockQuote extends HttpClient {
public class YahooFinanceStockQuote extends HttpClient<YahooFinanceStockQuoteConfig> {

private static final long serialVersionUID = 1L;
private String apiBase = "https://query.yahooapis.com/v1/public/yql?format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=&q=";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class AbstractConnectorConfig extends ServiceConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class CsvConnectorConfig extends AbstractConnectorConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class DatabaseConnectorConfig extends AbstractConnectorConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class HttpClientConfig extends ServiceConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class ImapEmailConnectorConfig extends AbstractConnectorConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class RSSConnectorConfig extends AbstractConnectorConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class TesseractOcrConfig extends ServiceConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class TestThrowerConfig extends ServiceConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class ThingSpeakConfig extends ServiceConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class TopCodesConfig extends ServiceConfig {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.myrobotlab.service.config;

public class TwitterConfig extends ServiceConfig {

}
Loading

0 comments on commit ad05d26

Please sign in to comment.