This commit is contained in:
crusader 2018-04-17 23:11:13 +09:00
parent 3387ffcfd9
commit 92d7926d3f
24 changed files with 602 additions and 112 deletions

4
auth.json Normal file
View File

@ -0,0 +1,4 @@
{
"tempKey": "cb8ef3c8424511e8b0460242ac120002",
"acceptedDate": "2018-04-17T22:45:11.147531244+09:00"
}

View File

@ -0,0 +1,17 @@
package annotation
import (
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
)
var AuthRPCServiceAnnotationType = reflect.TypeOf((*AuthRPCServiceAnnotation)(nil))
func init() {
cda.RegisterAnnotation(AuthRPCServiceAnnotationType)
}
type AuthRPCServiceAnnotation struct {
cda.TypeAnnotation `@annotation:"@overflow:AuthRPCService"`
}

View File

@ -9,10 +9,10 @@ import (
"git.loafle.net/commons/configuration-go"
cdr "git.loafle.net/commons/di-go/registry"
logging "git.loafle.net/commons/logging-go"
occa "git.loafle.net/overflow/commons-go/core/annotation"
occi "git.loafle.net/overflow/commons-go/core/interfaces"
ocnc "git.loafle.net/overflow/commons-go/noauthprobe/config"
"git.loafle.net/overflow/probe/auth/annotation"
"git.loafle.net/overflow/probe/auth/service"
)
@ -23,13 +23,14 @@ type Authenticator struct {
services []interface{}
endChan chan error
stopChan chan struct{}
stopWg sync.WaitGroup
}
func (a *Authenticator) EndableStart() (<-chan error, error) {
if a.stopChan != nil {
return nil, fmt.Errorf("authenticator already running. Stop it before starting it again")
return nil, fmt.Errorf("already running. Stop it before starting it again")
}
authConfigPath := path.Join(a.ConfigDir, ocnc.ConfigFileName)
@ -50,7 +51,7 @@ func (a *Authenticator) EndableStart() (<-chan error, error) {
authDoneChan := make(chan error)
cdr.RegisterResource("AuthDoneChan", authDoneChan)
services, err := cdr.GetInstancesByAnnotationType(occa.RPCServiceAnnotationType)
services, err := cdr.GetInstancesByAnnotationType(annotation.AuthRPCServiceAnnotationType)
if nil != err {
return nil, err
}
@ -60,40 +61,36 @@ func (a *Authenticator) EndableStart() (<-chan error, error) {
return nil, err
}
endChan := make(chan error)
a.endChan = make(chan error)
a.stopChan = make(chan struct{})
a.stopWg.Add(1)
go a.handleAuthenticator(authDoneChan, endChan)
go a.handleAuthenticator(authDoneChan)
return endChan, nil
return a.endChan, nil
}
func (a *Authenticator) Stop(ctx context.Context) error {
if a.stopChan == nil {
return fmt.Errorf("Authenticator: must be started before stopping it")
return nil
}
close(a.stopChan)
a.stopWg.Wait()
if err := occi.ExecServices(a.services, occi.ServiceMethodDestroy, service.OrderedServices, true); nil != err {
return err
}
occi.ExecServices(a.services, occi.ServiceMethodDestroy, service.OrderedServices, true)
a.stopChan = nil
close(a.endChan)
return nil
}
func (a *Authenticator) logHeader() string {
return "Authenticator:"
}
func (a *Authenticator) handleAuthenticator(authDoneChan chan error, endChan chan<- error) {
func (a *Authenticator) handleAuthenticator(authDoneChan chan error) {
var err error
defer func() {
a.stopWg.Done()
endChan <- err
a.endChan <- err
}()
err = occi.ExecServices(a.services, occi.ServiceMethodStart, service.OrderedServices, false)
@ -111,5 +108,5 @@ LOOP:
}
}
err = occi.ExecServices(a.services, occi.ServiceMethodStop, service.OrderedServices, true)
occi.ExecServices(a.services, occi.ServiceMethodStop, service.OrderedServices, true)
}

View File

@ -17,7 +17,7 @@ import (
"git.loafle.net/overflow/probe/config"
// For annotation
_ "git.loafle.net/overflow/commons-go/core/annotation"
_ "git.loafle.net/overflow/probe/auth/annotation"
)
var NoAuthProbeServiceType = reflect.TypeOf((*NoAuthProbeService)(nil))
@ -27,7 +27,7 @@ func init() {
}
type NoAuthProbeService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
cda.TypeAnnotation `annotation:"@overflow:AuthRPCService()"`
ConfigDir string `annotation:"@Resource(name='ConfigDir')"`
Config *config.Config `annotation:"@Resource(name='Config')"`
@ -37,7 +37,7 @@ type NoAuthProbeService struct {
client *crc.Client
}
func (s *NoAuthProbeService) Init() error {
func (s *NoAuthProbeService) InitService() error {
client, err := central.NewAuth(s.HandleTempKey, s)
if nil != err {
return err
@ -47,7 +47,7 @@ func (s *NoAuthProbeService) Init() error {
return nil
}
func (s *NoAuthProbeService) Start() error {
func (s *NoAuthProbeService) StartService() error {
if err := s.client.Start(); nil != err {
return err
}
@ -55,13 +55,13 @@ func (s *NoAuthProbeService) Start() error {
return nil
}
func (s *NoAuthProbeService) Stop() {
func (s *NoAuthProbeService) StopService() {
if err := s.client.Stop(context.Background()); nil != err {
logging.Logger().Error(err)
}
}
func (s *NoAuthProbeService) Destroy() {
func (s *NoAuthProbeService) DestroyService() {
s.client = nil
}

View File

@ -1,10 +1,12 @@
package service
import "reflect"
import (
"reflect"
)
var (
OrderedServices = []reflect.Type{
reflect.TypeOf((*NoAuthProbeService)(nil)),
NoAuthProbeServiceType,
}
)

View File

@ -5,7 +5,7 @@ import (
"net/http"
crc "git.loafle.net/commons/rpc-go/client"
ocnpc "git.loafle.net/overflow/commons-go/probe/constants"
ocpc "git.loafle.net/overflow/commons-go/probe/constants"
"git.loafle.net/overflow/probe/config"
)
@ -15,15 +15,15 @@ func NewData() (*crc.Client, error) {
return nil, fmt.Errorf("Config is not available")
}
connector, err := newConnector("Data", ocnpc.HTTPEntry_Data)
connector, err := newConnector("Data", ocpc.HTTPEntry_Data)
if nil != err {
return nil, err
}
connector.RequestHeader = func() http.Header {
header := make(map[string][]string)
header[ocnpc.HTTPRequestHeaderKey_Probe_Method] = []string{ocnpc.HTTPRequestHeaderValue_Probe_Method_Connect}
header[ocnpc.HTTPRequestHeaderKey_Probe_ProbeKey] = []string{*config.Probe.Key}
header[ocpc.HTTPRequestHeaderKey_Probe_Method] = []string{ocpc.HTTPRequestHeaderValue_Probe_Method_Connect}
header[ocpc.HTTPRequestHeaderKey_Probe_ProbeKey] = []string{*config.Probe.Key}
return header
}
connector.ResponseHandler = func(res *http.Response) {

View File

@ -5,29 +5,29 @@ import (
"net/http"
crc "git.loafle.net/commons/rpc-go/client"
ocnpc "git.loafle.net/overflow/commons-go/probe/constants"
ocpc "git.loafle.net/overflow/commons-go/probe/constants"
"git.loafle.net/overflow/probe/config"
)
func NewProbe(encryptionKeyHandler func(encryptionKey string), services []interface{}) (*crc.Client, error) {
func NewProbe(encryptionKeyHandler func(encryptionKey string), services ...interface{}) (*crc.Client, error) {
config := config.GetConfig()
if nil == config {
return nil, fmt.Errorf("Config is not available")
}
connector, err := newConnector("Probe", ocnpc.HTTPEntry_Probe)
connector, err := newConnector("Probe", ocpc.HTTPEntry_Probe)
if nil != err {
return nil, err
}
connector.RequestHeader = func() http.Header {
header := make(map[string][]string)
header[ocnpc.HTTPRequestHeaderKey_Probe_Method] = []string{ocnpc.HTTPRequestHeaderValue_Probe_Method_Connect}
header[ocnpc.HTTPRequestHeaderKey_Probe_ProbeKey] = []string{*config.Probe.Key}
header[ocpc.HTTPRequestHeaderKey_Probe_Method] = []string{ocpc.HTTPRequestHeaderValue_Probe_Method_Connect}
header[ocpc.HTTPRequestHeaderKey_Probe_ProbeKey] = []string{*config.Probe.Key}
return header
}
connector.ResponseHandler = func(res *http.Response) {
encryptionKey := res.Header.Get(ocnpc.HTTPResponseHeaderKey_Probe_SetEncryptionKey)
encryptionKey := res.Header.Get(ocpc.HTTPResponseHeaderKey_Probe_SetEncryptionKey)
if nil != encryptionKeyHandler {
encryptionKeyHandler(encryptionKey)
}

View File

@ -0,0 +1,45 @@
package container
import (
crc "git.loafle.net/commons/rpc-go/client"
crpj "git.loafle.net/commons/rpc-go/protocol/json"
crr "git.loafle.net/commons/rpc-go/registry"
csc "git.loafle.net/commons/server-go/client"
cssnc "git.loafle.net/commons/server-go/socket/net/client"
)
func newConnector(name string) (*cssnc.Connectors, error) {
connector := &cssnc.Connectors{
Network: "tcp4",
Address: "",
}
connector.ReconnectInterval = 5
connector.ReconnectTryTime = 10
connector.MaxMessageSize = 4096
connector.ReadBufferSize = 4096
connector.WriteBufferSize = 4096
connector.PongTimeout = 60
connector.PingTimeout = 10
connector.PingPeriod = 9
connector.Name = name
return connector, nil
}
func newClient(name string, connector csc.Connector, services []interface{}) *crc.Client {
codec := crpj.NewClientCodec()
var rpcRegistry crr.RPCRegistry
if nil != services && 0 < len(services) {
rpcRegistry = crr.NewRPCRegistry()
rpcRegistry.RegisterServices(services...)
}
return &crc.Client{
Connector: connector,
Codec: codec,
RPCInvoker: rpcRegistry,
Name: name,
}
}

View File

@ -0,0 +1,22 @@
package container
import (
"fmt"
crc "git.loafle.net/commons/rpc-go/client"
"git.loafle.net/overflow/probe/config"
)
func NewDiscovery(services ...interface{}) (*crc.Client, error) {
config := config.GetConfig()
if nil == config {
return nil, fmt.Errorf("Config is not available")
}
connector, err := newConnector("Probe")
if nil != err {
return nil, err
}
return newClient("Probe", connector, services), nil
}

View File

@ -17,6 +17,7 @@
}
},
"probe": {
"key": "d3eb9b99424511e8b0460242ac120002"
},
"paths": {
"root": "/project/overFlow/probe"

35
main.go
View File

@ -15,6 +15,7 @@ import (
ocpc "git.loafle.net/overflow/commons-go/probe/config"
"git.loafle.net/overflow/probe/auth"
"git.loafle.net/overflow/probe/config"
"git.loafle.net/overflow/probe/probe"
)
var (
@ -48,23 +49,41 @@ func main() {
}
doneChan, err := instance.(occi.EndableStarter).EndableStart()
if nil != err {
logging.Logger().Panic(err)
logging.Logger().Error(err)
os.Exit(1)
}
var ok bool
err, ok = <-doneChan
if !ok {
return
}
err = <-doneChan
if nil != err {
logging.Logger().Panic(err)
logging.Logger().Error(err)
os.Exit(1)
}
if err := instance.(occi.Stopper).Stop(context.Background()); err != nil {
logging.Logger().Errorf("error: %v", err)
}
}
// err := s.ListenAndServe()
// if nil != err {
// log.Printf("err: %v", err)
// }
instance = &probe.Probe{}
doneChan, err := instance.(occi.EndableStarter).EndableStart()
if nil != err {
logging.Logger().Error(err)
os.Exit(1)
}
var ok bool
err, ok = <-doneChan
if !ok {
return
}
if nil != err {
logging.Logger().Error(err)
os.Exit(1)
}
if err := instance.(occi.Stopper).Stop(context.Background()); err != nil {
logging.Logger().Errorf("error: %v", err)
}
}()
interrupt := make(chan os.Signal, 1)

View File

@ -5,80 +5,79 @@ import (
"fmt"
"sync"
// For service
_ "git.loafle.net/overflow/probe/service"
cdr "git.loafle.net/commons/di-go/registry"
occa "git.loafle.net/overflow/commons-go/core/annotation"
occi "git.loafle.net/overflow/commons-go/core/interfaces"
"git.loafle.net/overflow/probe/service"
)
type Probe struct {
services []interface{}
endChan chan error
stopChan chan struct{}
stopWg sync.WaitGroup
}
func (p *Probe) Start() error {
func (p *Probe) EndableStart() (<-chan error, error) {
if p.stopChan != nil {
return fmt.Errorf("already running. Stop it before starting it again")
return nil, fmt.Errorf("already running. Stop it before starting it again")
}
// services, err := cdr.GetInstancesByAnnotationType(occa.RPCServiceAnnotationType)
// if nil != err {
// return err
// }
services, err := cdr.GetInstancesByAnnotationType(occa.RPCServiceAnnotationType)
if nil != err {
return nil, err
}
p.services = services
// client, err := central.NewProbe(p.HandleEncryptionKey, services)
// if nil != err {
// return err
// }
if err := occi.ExecServices(p.services, occi.ServiceMethodInit, service.OrderedServices, false); nil != err {
return nil, err
}
p.endChan = make(chan error)
p.stopChan = make(chan struct{})
p.stopWg.Add(1)
go p.handleProbe()
return nil
return p.endChan, nil
}
func (p *Probe) Stop(ctx context.Context) error {
if p.stopChan == nil {
return fmt.Errorf("must be started before stopping it")
return nil
}
close(p.stopChan)
p.stopWg.Wait()
occi.ExecServices(p.services, occi.ServiceMethodDestroy, service.OrderedServices, true)
p.stopChan = nil
close(p.endChan)
return nil
}
func (p *Probe) logHeader() string {
return "Probe:"
}
func (p *Probe) HandleEncryptionKey(encryptionKey string) {
}
func (p *Probe) handleProbe() {
// var err error
// defer func() {
// if nil != client {
// err = client.Stop(context.Background())
// }
var err error
defer func() {
p.stopWg.Done()
p.endChan <- err
}()
// a.stopWg.Done()
// endChan <- err
// }()
// if err = client.Start(); nil != err {
// logging.Logger().Error(err)
// return
// }
// for {
// select {
// case err = <-authDoneChan:
// return
// case <-a.stopChan:
// return
// }
// }
err = occi.ExecServices(p.services, occi.ServiceMethodStart, service.OrderedServices, false)
if nil != err {
return
}
LOOP:
for {
select {
case <-p.stopChan:
break LOOP
}
}
occi.ExecServices(p.services, occi.ServiceMethodStop, service.OrderedServices, true)
}

View File

@ -0,0 +1,38 @@
package service
import (
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
_ "git.loafle.net/overflow/commons-go/core/annotation"
)
var CollectorServiceType = reflect.TypeOf((*CollectorService)(nil))
func init() {
cdr.RegisterType(CollectorServiceType)
}
type CollectorService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
DataClientService *DataClientService `annotation:"@Inject()"`
}
func (s *CollectorService) InitService() error {
return nil
}
func (s *CollectorService) StartService() error {
return nil
}
func (s *CollectorService) StopService() {
}
func (s *CollectorService) DestroyService() {
}

View File

@ -18,7 +18,24 @@ type ContainerService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
}
func (cs *ContainerService) Accept() error {
func (s *ContainerService) InitService() error {
return nil
}
func (s *ContainerService) StartService() error {
return nil
}
func (s *ContainerService) StopService() {
}
func (s *ContainerService) DestroyService() {
}
func (s *ContainerService) Accept() error {
return nil
}

View File

@ -18,7 +18,24 @@ type CrawlerService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
}
func (cs *CrawlerService) Accept() error {
func (s *CrawlerService) InitService() error {
return nil
}
func (s *CrawlerService) StartService() error {
return nil
}
func (s *CrawlerService) StopService() {
}
func (s *CrawlerService) DestroyService() {
}
func (s *CrawlerService) Accept() error {
return nil
}

View File

@ -0,0 +1,53 @@
package service
import (
"context"
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
logging "git.loafle.net/commons/logging-go"
crc "git.loafle.net/commons/rpc-go/client"
_ "git.loafle.net/overflow/commons-go/core/annotation"
"git.loafle.net/overflow/probe/client/central"
)
var DataClientServiceType = reflect.TypeOf((*DataClientService)(nil))
func init() {
cdr.RegisterType(DataClientServiceType)
}
type DataClientService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
client *crc.Client
}
func (s *DataClientService) InitService() error {
client, err := central.NewData()
if nil != err {
return err
}
s.client = client
return nil
}
func (s *DataClientService) StartService() error {
if err := s.client.Start(); nil != err {
return err
}
return nil
}
func (s *DataClientService) StopService() {
if err := s.client.Stop(context.Background()); nil != err {
logging.Logger().Error(err)
}
}
func (s *DataClientService) DestroyService() {
s.client = nil
}

View File

@ -0,0 +1,52 @@
package service
import (
"context"
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
logging "git.loafle.net/commons/logging-go"
crc "git.loafle.net/commons/rpc-go/client"
// For annotation
_ "git.loafle.net/overflow/commons-go/core/annotation"
)
var DiscoveryClientServiceType = reflect.TypeOf((*DiscoveryClientService)(nil))
func init() {
cdr.RegisterType(DiscoveryClientServiceType)
}
type DiscoveryClientService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
DiscoveryService *DiscoveryService `annotation:"@Inject()"`
EncryptionKey string
client *crc.Client
}
func (s *DiscoveryClientService) InitService() error {
return nil
}
func (s *DiscoveryClientService) StartService() error {
return nil
}
func (s *DiscoveryClientService) StopService() {
if nil != s.client {
if err := s.client.Stop(context.Background()); nil != err {
logging.Logger().Error(err)
}
}
}
func (s *DiscoveryClientService) DestroyService() {
s.client = nil
}

View File

@ -18,7 +18,24 @@ type DiscoveryService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
}
func (cs *DiscoveryService) Accept() error {
func (s *DiscoveryService) InitService() error {
return nil
}
func (s *DiscoveryService) StartService() error {
return nil
}
func (s *DiscoveryService) StopService() {
}
func (s *DiscoveryService) DestroyService() {
}
func (s *DiscoveryService) Accept() error {
return nil
}

View File

@ -0,0 +1,48 @@
package service
import (
"context"
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
logging "git.loafle.net/commons/logging-go"
crc "git.loafle.net/commons/rpc-go/client"
// For annotation
_ "git.loafle.net/overflow/commons-go/core/annotation"
)
var GeneralClientServiceType = reflect.TypeOf((*GeneralClientService)(nil))
func init() {
cdr.RegisterType(GeneralClientServiceType)
}
type GeneralClientService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
EncryptionKey string
client *crc.Client
}
func (s *GeneralClientService) InitService() error {
return nil
}
func (s *GeneralClientService) StartService() error {
return nil
}
func (s *GeneralClientService) StopService() {
if nil != s.client {
if err := s.client.Stop(context.Background()); nil != err {
logging.Logger().Error(err)
}
}
}
func (s *GeneralClientService) DestroyService() {
s.client = nil
}

View File

@ -0,0 +1,48 @@
package service
import (
"context"
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
logging "git.loafle.net/commons/logging-go"
crc "git.loafle.net/commons/rpc-go/client"
// For annotation
_ "git.loafle.net/overflow/commons-go/core/annotation"
)
var NetworkClientServiceType = reflect.TypeOf((*NetworkClientService)(nil))
func init() {
cdr.RegisterType(NetworkClientServiceType)
}
type NetworkClientService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
EncryptionKey string
client *crc.Client
}
func (s *NetworkClientService) InitService() error {
return nil
}
func (s *NetworkClientService) StartService() error {
return nil
}
func (s *NetworkClientService) StopService() {
if nil != s.client {
if err := s.client.Stop(context.Background()); nil != err {
logging.Logger().Error(err)
}
}
}
func (s *NetworkClientService) DestroyService() {
s.client = nil
}

View File

@ -0,0 +1,65 @@
package service
import (
"context"
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
logging "git.loafle.net/commons/logging-go"
crc "git.loafle.net/commons/rpc-go/client"
// For annotation
_ "git.loafle.net/overflow/commons-go/core/annotation"
"git.loafle.net/overflow/probe/client/central"
)
var ProbeClientServiceType = reflect.TypeOf((*ProbeClientService)(nil))
func init() {
cdr.RegisterType(ProbeClientServiceType)
}
type ProbeClientService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
DiscoveryService *DiscoveryService `annotation:"@Inject()"`
EncryptionKey string
client *crc.Client
}
func (s *ProbeClientService) InitService() error {
client, err := central.NewProbe(s.HandleEncryptionKey, s.DiscoveryService)
if nil != err {
return err
}
s.client = client
return nil
}
func (s *ProbeClientService) StartService() error {
if err := s.client.Start(); nil != err {
return err
}
return nil
}
func (s *ProbeClientService) StopService() {
if err := s.client.Stop(context.Background()); nil != err {
logging.Logger().Error(err)
}
}
func (s *ProbeClientService) DestroyService() {
s.client = nil
}
func (s *ProbeClientService) HandleEncryptionKey(encryptionKey string) {
logging.Logger().Debugf("encryptionKey arrived %s", encryptionKey)
s.EncryptionKey = encryptionKey
}

View File

@ -1,24 +0,0 @@
package service
import (
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
_ "git.loafle.net/overflow/commons-go/core/annotation"
)
var ProbeServiceType = reflect.TypeOf((*ProbeService)(nil))
func init() {
cdr.RegisterType(ProbeServiceType)
}
type ProbeService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
}
func (cs *ProbeService) Accept() error {
return nil
}

View File

@ -0,0 +1,36 @@
package service
import (
"reflect"
cda "git.loafle.net/commons/di-go/annotation"
cdr "git.loafle.net/commons/di-go/registry"
_ "git.loafle.net/overflow/commons-go/core/annotation"
)
var SensorConfigServiceType = reflect.TypeOf((*SensorConfigService)(nil))
func init() {
cdr.RegisterType(SensorConfigServiceType)
}
type SensorConfigService struct {
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
}
func (s *SensorConfigService) InitService() error {
return nil
}
func (s *SensorConfigService) StartService() error {
return nil
}
func (s *SensorConfigService) StopService() {
}
func (s *SensorConfigService) DestroyService() {
}

View File

@ -1,5 +1,22 @@
package service
import "reflect"
var (
OrderedServices = []reflect.Type{
ProbeClientServiceType,
DataClientServiceType,
DiscoveryClientServiceType,
GeneralClientServiceType,
NetworkClientServiceType,
SensorConfigServiceType,
ContainerServiceType,
CrawlerServiceType,
CollectorServiceType,
DiscoveryServiceType,
}
)
func InitPackage() {
}