Refactoring, Bugfix & Updates

+ Refactored all imports
+ Fixed a bug for the logging regarding removing \n \t \r
+ Updated to current MGO release
+ Changed the name of ICCC
This commit is contained in:
Thorsten Sommer committed 2014-10-19 19:19:11 +02:00
1 parent b50066ef5d
commit f33f7b5c29
91 files changed
+496 -316

No files matched your search

+5 -3
View File
@@ -1,8 +1,10 @@
package ICCC
import "fmt"
import "reflect"
import "strconv"
import (
"fmt"
"reflect"
"strconv"
)
func Data2Message(target interface{}, data map[string][]string) (channel, command string, obj interface{}) {
if data == nil || len(data) == 0 {
+1 -1
View File
@@ -1,4 +1,4 @@
/*
This is the "[I]nter Data [C]enter and Appli[c]ation [C]ommunication"
This is the "[I]nter-[C]omponent [C]ommunication [C]hannel"
*/
package ICCC
+7 -5
View File
@@ -1,10 +1,12 @@
package ICCC
import "fmt"
import "net/http"
import "github.com/SommerEngineering/Ocean/Tools"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"fmt"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Tools"
"net/http"
)
func ICCCHandler(response http.ResponseWriter, request *http.Request) {
if errParse := request.ParseForm(); errParse != nil {
+6 -4
View File
@@ -1,9 +1,11 @@
package ICCC
import "container/list"
import "github.com/SommerEngineering/Ocean/Tools"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"container/list"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Tools"
)
func init() {
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Start init of ICCC.`)
+6 -4
View File
@@ -1,9 +1,11 @@
package ICCC
import "labix.org/v2/mgo"
import "github.com/SommerEngineering/Ocean/CustomerDB"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"github.com/SommerEngineering/Ocean/CustomerDB"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"gopkg.in/mgo.v2"
)
func initDB() {
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Start init of the ICCC collections.`)
+9 -7
View File
@@ -1,12 +1,14 @@
package ICCC
import "fmt"
import "time"
import "labix.org/v2/mgo/bson"
import "github.com/SommerEngineering/Ocean/Shutdown"
import "github.com/SommerEngineering/Ocean/ICCC/Scheme"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"fmt"
"github.com/SommerEngineering/Ocean/ICCC/Scheme"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Shutdown"
"gopkg.in/mgo.v2/bson"
"time"
)
func InitCacheNow() {
startCacheTimerLock.Lock()
+5 -3
View File
@@ -1,8 +1,10 @@
package ICCC
import "fmt"
import "reflect"
import "strconv"
import (
"fmt"
"reflect"
"strconv"
)
func message2Data(channel, command string, message interface{}) (data map[string][]string) {
data = make(map[string][]string)
+6 -4
View File
@@ -1,9 +1,11 @@
package ICCC
import "labix.org/v2/mgo/bson"
import "github.com/SommerEngineering/Ocean/ICCC/Scheme"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"github.com/SommerEngineering/Ocean/ICCC/Scheme"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"gopkg.in/mgo.v2/bson"
)
func register2Database(channel, command string) {
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Register this ICCC command in to the database.`, `channel=`+channel, `command=`+command)
+7 -5
View File
@@ -1,10 +1,12 @@
package ICCC
import "labix.org/v2/mgo/bson"
import "github.com/SommerEngineering/Ocean/ICCC/Scheme"
import "github.com/SommerEngineering/Ocean/Tools"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"github.com/SommerEngineering/Ocean/ICCC/Scheme"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Tools"
"gopkg.in/mgo.v2/bson"
)
func registerHost2Database() {
host := Scheme.Host{}
+5 -3
View File
@@ -1,8 +1,10 @@
package ICCC
import "fmt"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"fmt"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
)
func Registrar(channel, command string, callback func(data map[string][]string)) {
listenersLock.Lock()
+8 -6
View File
@@ -1,11 +1,13 @@
package ICCC
import "net/http"
import "net/url"
import "github.com/SommerEngineering/Ocean/Tools"
import "github.com/SommerEngineering/Ocean/ICCC/Scheme"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"github.com/SommerEngineering/Ocean/ICCC/Scheme"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Tools"
"net/http"
"net/url"
)
func sendMessage(listener Scheme.Listener, data map[string][]string) {
+6 -4
View File
@@ -1,9 +1,11 @@
package ICCC
import "labix.org/v2/mgo/bson"
import "github.com/SommerEngineering/Ocean/ICCC/Scheme"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"github.com/SommerEngineering/Ocean/ICCC/Scheme"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"gopkg.in/mgo.v2/bson"
)
/*
Please do not use this type. It is an internal type of Ocean to provide a shutdown function!
+6 -4
View File
@@ -1,9 +1,11 @@
package ICCC
import "sync"
import "container/list"
import "labix.org/v2/mgo"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"container/list"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"gopkg.in/mgo.v2"
"sync"
)
const (
ChannelSYSTEM string = `System`
+5 -3
View File
@@ -1,8 +1,10 @@
package ICCC
import "github.com/SommerEngineering/Ocean/ICCC/Scheme"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"github.com/SommerEngineering/Ocean/ICCC/Scheme"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
)
func WriteMessage2All(channel, command string, message interface{}) {
cacheListenerDatabaseLock.RLock()
+6 -4
View File
@@ -1,9 +1,11 @@
package ICCC
import "github.com/SommerEngineering/Ocean/Tools"
import "github.com/SommerEngineering/Ocean/ICCC/Scheme"
import "github.com/SommerEngineering/Ocean/Log"
import LM "github.com/SommerEngineering/Ocean/Log/Meta"
import (
"github.com/SommerEngineering/Ocean/ICCC/Scheme"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Tools"
)
func WriteMessage2Any(channel, command string, message interface{}) {
cacheListenerDatabaseLock.RLock()