Skip to content
Permalink
Browse files

Removed all TODOs from framework and API. Open problems and enhanceme…

…nts are now stored in the github issues of the main project.
  • Loading branch information...
sebinside committed Jun 17, 2019
1 parent 2cde2f9 commit d5914edc0661b30e3706dd26e67bf1f4fc9c3b38
Showing with 4 additions and 47 deletions.
  1. +0 −1 bootstrap/src/main/scala/Bootstrap.scala
  2. +0 −1 deployment-files/README.html
  3. +0 −4 project/BuildUtility.scala
  4. +0 −4 src/main/scala/org/codeoverflow/chatoverflow/Launcher.scala
  5. +0 −2 src/main/scala/org/codeoverflow/chatoverflow/configuration/ConfigurationService.scala
  6. +0 −2 src/main/scala/org/codeoverflow/chatoverflow/configuration/CryptoUtil.scala
  7. +0 −3 src/main/scala/org/codeoverflow/chatoverflow/connector/actor/JsonActor.scala
  8. +0 −1 src/main/scala/org/codeoverflow/chatoverflow/framework/manager/PluginManagerImpl.scala
  9. +0 −3 src/main/scala/org/codeoverflow/chatoverflow/instance/PluginInstance.scala
  10. +0 −1 src/main/scala/org/codeoverflow/chatoverflow/registry/TypeRegistry.scala
  11. +2 −8 src/main/scala/org/codeoverflow/chatoverflow/requirement/service/mockup/MockUpChatConnector.scala
  12. +1 −3 ...ain/scala/org/codeoverflow/chatoverflow/requirement/service/mockup/impl/MockUpChatInputImpl.scala
  13. +1 −2 src/main/scala/org/codeoverflow/chatoverflow/requirement/service/serial/SerialConnector.scala
  14. +0 −3 src/main/scala/org/codeoverflow/chatoverflow/requirement/service/twitch/api/TwitchAPIConnector.scala
  15. +0 −3 ...main/scala/org/codeoverflow/chatoverflow/requirement/service/twitch/api/impl/TwitchStatImpl.scala
  16. +0 −2 ...ain/scala/org/codeoverflow/chatoverflow/requirement/service/twitch/chat/TwitchChatConnector.scala
  17. +0 −3 src/main/scala/org/codeoverflow/chatoverflow/ui/CLI.scala
  18. +0 −1 src/main/scala/org/codeoverflow/chatoverflow/ui/web/Server.scala
@@ -115,7 +115,6 @@ object Bootstrap {
val dependencies = getDependencies

// Download all libraries
// TODO: Check validity if everything is downloaded
// try downloading libs and only if it succeeded (returned true) then try to delete older libs
downloadMissingLibraries(dependencies) && deleteUndesiredLibraries(dependencies)
}
@@ -7,6 +7,5 @@
<body>
<p>Thank you for downloading Chat Overflow! For more information, please visit <a href="http://codeoverflow.org">codeoverflow.org</a>!
</p>
<!-- TODO: Write proper readme with the most important information and version infos about the deployed framework, api, client, gui -->
</body>
</html>
@@ -118,7 +118,6 @@ class BuildUtility(logger: ManagedLogger) {
}

// Clean first
// TODO: Should not be cleaned. Existent files should be overwritten.
for (jarFile <- pluginTargetFolder.listFiles().filter(_.getName.endsWith(".jar"))) {
try {
jarFile.delete()
@@ -150,9 +149,6 @@ class BuildUtility(logger: ManagedLogger) {
def createPluginTask(pluginFolderNames: List[String]): Unit = {
withTaskInfo("CREATE PLUGIN") {

// TODO: Generated plugin structure should contain ready-to-implement files
// TODO: BuildUtility / Build Environment should be refactored to enable separate plugin dev environments with a subset of sbt functionality

// Plugin folders have to be defined in the build.sbt file first
if (pluginFolderNames.isEmpty) {
println("Before creating a new plugin, please define at least one plugin source folder in the build.sbt file.")
@@ -36,7 +36,6 @@ object Launcher extends WithLogger {
}

// Start plugins if specified
// TODO: Move this down after server start when the REPL is history
if (chatOverflow.isLoaded && config.startupPlugins.nonEmpty) {
for (instanceName <- config.startupPlugins) {
val instance = chatOverflow.pluginInstanceRegistry.getPluginInstance(instanceName)
@@ -49,8 +48,6 @@ object Launcher extends WithLogger {
}
}

// TODO: Delete REPL, update CLI, update wiki

// Launch UI
config.ui match {
case UI.GUI =>
@@ -80,7 +77,6 @@ object Launcher extends WithLogger {
*/
def exit(): Unit = {
logger info "Shutting down Chat Overflow."
// TODO: Deal with running plugins, connectors, ...
System.exit(0)
}
}
@@ -107,7 +107,6 @@ class ConfigurationService(val configFilePath: String) extends WithLogger {
* Loads the config xml file and return its content.
*/
private def loadXML(): Node = {
// TODO: Add some XML caching here
if (!new File(configFilePath).exists()) {
logger debug s"Config file '$configFilePath' not found. Initialising with default values."
saveXML(defaultContent)
@@ -247,7 +246,6 @@ object ConfigurationService extends WithLogger {
targetType: String, content: String,
pluginInstanceRegistry: PluginInstanceRegistry,
typeRegistry: TypeRegistry): Boolean = {
// FIXME: Better handling of empty content (not set in the first place, then read from XML)

logger info s"Loading requirement '$requirementId' of type '$targetType'."
val instance = pluginInstanceRegistry.getPluginInstance(instanceName)
@@ -17,8 +17,6 @@ import javax.crypto.{Cipher, SecretKeyFactory}
*/
object CryptoUtil {

// TODO: This code should be reviewed by an expert to find potential security issues.

// Used for the run-unique auth key
private val runSpecificRandom = generateIV

@@ -10,9 +10,6 @@ import org.json4s.jackson.JsonMethods._
*/
class JsonActor extends Actor {

// TODO: Implement proper functionality with json4s. This is not more than a proof of concept
// TODO: Test, when reflection kicks in to allow the most functionality without an actor call

/**
* Receives a ParseJSON Object to start parsing.
*
@@ -15,7 +15,6 @@ import scala.collection.mutable.ListBuffer
*/
class PluginManagerImpl(pluginInstanceName: String, logOutputOnConsole: Boolean) extends PluginManager with WithLogger {

// TODO: Add log datetime
private val logMessages = new ListBuffer[String]

/**
@@ -164,13 +164,10 @@ class PluginInstance(val instanceName: String, pluginType: PluginType) extends W
if (plugin.get.getLoopInterval > 0) {
while (!threadStopAfterNextIteration) {
plugin.get.loop()
// FIXME: This is not a loop interval. Should be responsive to the loop runtime
Thread.sleep(plugin.get.getLoopInterval)
}
}

// TODO: Also connectors & input/output should be shutdown somewhere (if the plugin ends OR is ended)

// After the loop (or setup) the plugin should end
plugin.get.shutdown()

@@ -53,7 +53,6 @@ class TypeRegistry(requirementPackage: String) extends WithLogger {
connectorTypes.clear()

// Use reflection magic to get all impl-annotated classes
// FIXME: Does also find definitions not in the exact package - not intended should be filtered afterwards
val reflections: Reflections = new Reflections(new ConfigurationBuilder()
.setUrls(ClasspathHelper.forPackage(requirementPackage))
.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner()))
@@ -9,6 +9,7 @@ import org.codeoverflow.chatoverflow.connector.Connector
import scala.collection.mutable.ListBuffer
import scala.io.Source

@Deprecated
class MockUpChatConnector(sourceIdentifier: String) extends Connector(sourceIdentifier) with WithLogger {

private val mockUpFolder = "src/main/resources/mockup"
@@ -25,11 +26,9 @@ class MockUpChatConnector(sourceIdentifier: String) extends Connector(sourceIden
}

def addPrivateMessageEventListener(listener: ChatMessage[ChatMessageAuthor, Channel, ChatEmoticon] => Unit): Unit = {
// FIXME: Support private messages
}

def simulateChat(): Unit = {
// FIXME: Should be invoked every x milliseconds using actors not using sleep
val step = 100
while (running) {
val currentTime = Calendar.getInstance.getTimeInMillis
@@ -43,7 +42,6 @@ class MockUpChatConnector(sourceIdentifier: String) extends Connector(sourceIden
}

def loadMockUpFile(): Boolean = {
// TODO: Handle exceptions
val input = Source.fromFile(s"$mockUpFolder/$sourceIdentifier.chat")
val lines = input.getLines()

@@ -52,7 +50,6 @@ class MockUpChatConnector(sourceIdentifier: String) extends Connector(sourceIden
messages = createMessageList(elements)
input.close()
true
// TODO: Do not always return true
}

/**
@@ -63,7 +60,6 @@ class MockUpChatConnector(sourceIdentifier: String) extends Connector(sourceIden
*/
private def createMessageList(elements: List[MockupElement]): List[ChatMessage[ChatMessageAuthor, Channel, ChatEmoticon]] = {

// FIXME: WHY (don't use a static offset you dumb brick)
time = Calendar.getInstance().getTimeInMillis + 5000L
logger.info(s"Started MockupChat Construction with timestamp: $time")

@@ -82,7 +78,6 @@ class MockUpChatConnector(sourceIdentifier: String) extends Connector(sourceIden
currentIndex = returnValue._2
messageList ++= newElements

// FIXME: There might be cases where this ends up in while(true). Should be tested!
} while (currentIndex < elements.size)

logger.info("Finally returning %d messages.".format(messageList.size))
@@ -113,8 +108,7 @@ class MockUpChatConnector(sourceIdentifier: String) extends Connector(sourceIden
allElements(index) match {
case ChatElement(user, msg, isPremium) =>
logger.info(s"Read ChatElement($user,$msg,$isPremium).")
//FIXME isTrubo is not supported by the new api implementation.
// Remove it or create MockupChatMessageAuthor that has field isTrubo

messageList += new ChatMessage(new ChatMessageAuthor(user), msg, time, new Channel("default"))
time += defaultDelay
case DelayElement(delay) =>
@@ -13,11 +13,10 @@ import org.codeoverflow.chatoverflow.requirement.service.mockup.MockUpChatConnec
import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer

@Deprecated
@Impl(impl = classOf[MockUpChatInput], connector = classOf[MockUpChatConnector])
class MockUpChatInputImpl extends Connection[MockUpChatConnector] with MockUpChatInput with WithLogger {

// TODO: Rewrite code to fit to the new framework style using actors, a new parser, extend InputImpl etc.

private val messages: ListBuffer[ChatMessage[ChatMessageAuthor, Channel, ChatEmoticon]] = ListBuffer[ChatMessage[ChatMessageAuthor, Channel, ChatEmoticon]]()
private val privateMessages: ListBuffer[ChatMessage[ChatMessageAuthor, Channel, ChatEmoticon]] = ListBuffer[ChatMessage[ChatMessageAuthor, Channel, ChatEmoticon]]()

@@ -44,7 +43,6 @@ class MockUpChatInputImpl extends Connection[MockUpChatConnector] with MockUpCha
override def init(): Boolean = {
if (sourceConnector.isDefined) {
sourceConnector.get.addMessageEventListener(onMessage)
// FIXME: Work with private messages
sourceConnector.get.init()
} else {
logger warn "Source connector not set."
@@ -51,7 +51,7 @@ class SerialConnector(override val sourceIdentifier: String) extends Connector(s
if (serialPort.isEmpty) throw new IllegalStateException("Serial port is not available yet")
serialPortInputListener.addDataAvailableListener(_ => {
val buffer = new Array[Byte](serialPort.get.bytesAvailable())
serialPort.get.readBytes(buffer, buffer.length) //FIXME DOES IT CRASH?
serialPort.get.readBytes(buffer, buffer.length)
listener(buffer)
})
}
@@ -60,7 +60,6 @@ class SerialConnector(override val sourceIdentifier: String) extends Connector(s
* Opens a connection with the serial port
*/
override def start(): Boolean = {
//TODO Test if connector is working this way or if it requires an actor
try {
serialPort = Some(SerialPort.getCommPort(credentials.get.getValue("port").get))
credentials.get.getValue("baudRate") match {
@@ -14,8 +14,6 @@ import org.codeoverflow.chatoverflow.framework.actors.HttpClientActor
import scala.concurrent.Await
import scala.concurrent.duration._

// FIXME: Chery picked from Class Library Rework, should be reworked, lol

/**
* The twitch api connector
*
@@ -89,7 +87,6 @@ class TwitchAPIConnector(override val sourceIdentifier: String) extends Connecto
* This stops the activity of the connector, e.g. by closing the platform connection.
*/
override def stop(): Boolean = {
// TODO: Implement STOP
false
}

@@ -13,8 +13,6 @@ import org.codeoverflow.chatoverflow.requirement.service.twitch.api.TwitchAPICon
import scala.concurrent.Await
import scala.concurrent.duration._

// FIXME: Chery picked from Class Library Rework, should be reworked, lol

case class UserResult(data: Seq[UserEntity])

case class UserEntity(id: String, login: String, display_name: String, `type`: String, broadcaster_type: String, description: String, profile_image_url: String, offline_image_url: String, view_count: Int)
@@ -47,7 +45,6 @@ class TwitchStatInputImpl extends Connection[TwitchAPIConnector] with TwitchStat
else null
}

// FIXME: Kicked jackson mapping (deprecated?!), different way needed
def map[T: Manifest](content: String): Any = {
//val mapper = new ObjectMapper() with ScalaObjectMapper
// mapper.registerModule(DefaultScalaModule)
@@ -103,8 +103,6 @@ class TwitchChatConnector(override val sourceIdentifier: String) extends Connect
errorCount += 1
}

// TODO: Enable detection for wrong credentials / bot disconnect

if (errorCount >= 30) {
logger error "Fatal. Unable to start bot."
}
@@ -30,7 +30,6 @@ object CLI {
opt[String]('r', "requirementPackage").action((x, c) =>
c.copy(requirementPackage = x)).text("path to the package where all requirements are defined")

// TODO: Update
// Subject of change. After GUI will be -l (for login)
opt[Unit]('n', "noPassword").action((_, c) =>
c.copy(requirePasswordOnStartup = false)).text("set this flag to disable password checking on framework startup")
@@ -84,8 +83,6 @@ object CLI {
loginPassword: Array[Char] = Array[Char](),
startupPlugins: Seq[String] = Seq[String]())

// TODO: Fix path layout

object UI extends Enumeration {
type UI = Value
val GUI, REPL, BOTH = Value
@@ -26,7 +26,6 @@ class Server(val chatOverflow: ChatOverflow, val port: Int) extends WithLogger {
* Starts the server in a new thread.
*/
def startAsync(): Unit = {
// TODO: Enable shutting down the server
new Thread(() => startServer()).start()

println(s"You may open now: http://petstore.swagger.io/?url=http://localhost:$port/api-docs/swagger.json")

0 comments on commit d5914ed

Please sign in to comment.
You can’t perform that action at this time.