X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fxds%2Fxds-agent.git;a=blobdiff_plain;f=lib%2Fagent%2Fproject-pathmap.go;h=5d8b87bcfda88a8492d973bf347c97e8994199fc;hp=3c87770ebb259c1f0cda9ad3b3c8a7c7c00e8af9;hb=247bb7c2db5f0d48178398599348249bf886ebbc;hpb=4d843d2bde236ec23810d0904dfb8aebbc53a37b diff --git a/lib/agent/project-pathmap.go b/lib/agent/project-pathmap.go index 3c87770..5d8b87b 100644 --- a/lib/agent/project-pathmap.go +++ b/lib/agent/project-pathmap.go @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017-2018 "IoT.bzh" + * Author Sebastien Douheret + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package agent import ( @@ -6,8 +23,9 @@ import ( "os" "strings" - "github.com/iotbzh/xds-agent/lib/apiv1" - common "github.com/iotbzh/xds-common/golib" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent.git/lib/xaapiv1" + common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-server.git/lib/xsapiv1" ) // IPROJECT interface implementation for native/path mapping projects @@ -16,7 +34,7 @@ import ( type PathMap struct { *Context server *XdsServer - folder *XdsFolderConfig + folder *xsapiv1.FolderConfig } // NewProjectPathMap Create a new instance of PathMap @@ -24,13 +42,13 @@ func NewProjectPathMap(ctx *Context, svr *XdsServer) *PathMap { p := PathMap{ Context: ctx, server: svr, - folder: &XdsFolderConfig{}, + folder: &xsapiv1.FolderConfig{}, } return &p } // Add a new project -func (p *PathMap) Add(cfg apiv1.ProjectConfig) (*apiv1.ProjectConfig, error) { +func (p *PathMap) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) { var err error var file *os.File errMsg := "ClientPath sanity check error (%d): %v" @@ -92,24 +110,24 @@ func (p *PathMap) Delete() error { } // GetProject Get public part of project config -func (p *PathMap) GetProject() *apiv1.ProjectConfig { +func (p *PathMap) GetProject() *xaapiv1.ProjectConfig { prj := p.server.FolderToProject(*p.folder) prj.ServerID = p.server.ID return &prj } // Setup Setup local project config -func (p *PathMap) Setup(prj apiv1.ProjectConfig) (*apiv1.ProjectConfig, error) { +func (p *PathMap) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) { p.folder = p.server.ProjectToFolder(prj) np := p.GetProject() - if err := p.events.Emit(apiv1.EVTProjectChange, np, ""); err != nil { + if err := p.events.Emit(xaapiv1.EVTProjectChange, np, ""); err != nil { return np, err } return np, nil } // Update Update some field of a project -func (p *PathMap) Update(prj apiv1.ProjectConfig) (*apiv1.ProjectConfig, error) { +func (p *PathMap) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) { if p.folder.ID != prj.ID { return nil, fmt.Errorf("Invalid id") }