diff --git a/api/jobs/replication.go b/api/jobs/replication.go index a9dda69b3..d62d4e4fe 100644 --- a/api/jobs/replication.go +++ b/api/jobs/replication.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 api import ( diff --git a/api/replication_job.go b/api/replication_job.go index 3edd63771..c5126bf95 100644 --- a/api/replication_job.go +++ b/api/replication_job.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 api import ( diff --git a/api/replication_policy.go b/api/replication_policy.go index 884f566c1..6eefaa087 100644 --- a/api/replication_policy.go +++ b/api/replication_policy.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 api import ( diff --git a/dao/replication_job.go b/dao/replication_job.go index f0dc7fb15..83a5b9d11 100644 --- a/dao/replication_job.go +++ b/dao/replication_job.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 dao import ( diff --git a/job/config/config.go b/job/config/config.go index 650fa1188..fb5d86fbd 100644 --- a/job/config/config.go +++ b/job/config/config.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 config import ( diff --git a/job/replication/runner.go b/job/replication/runner.go deleted file mode 100644 index 075a1ee99..000000000 --- a/job/replication/runner.go +++ /dev/null @@ -1,76 +0,0 @@ -package replication - -/* -import ( - "encoding/json" - //"github.com/vmware/harbor/dao" - "github.com/vmware/harbor/job" - "github.com/vmware/harbor/models" - "time" -) - -const ( - jobType = "transfer_img_out" -) - -type Runner struct { - job.JobSM - Logger job.Logger - parm ImgOutParm -} - -type ImgPuller struct { - job.DummyHandler - img string - logger job.Logger -} - -func (ip ImgPuller) Enter() (string, error) { - ip.logger.Infof("I'm pretending to pull img:%s, then sleep 30s", ip.img) - time.Sleep(30 * time.Second) - ip.logger.Infof("wake up from sleep....") - return "push-img", nil -} - -type ImgPusher struct { - job.DummyHandler - targetURL string - logger job.Logger -} - -func (ip ImgPusher) Enter() (string, error) { - ip.logger.Infof("I'm pretending to push img to:%s, then sleep 30s", ip.targetURL) - time.Sleep(30 * time.Second) - ip.logger.Infof("wake up from sleep....") - return job.JobContinue, nil -} - -func init() { - job.Register(jobType, Runner{}) -} - -func (r Runner) Run(je models.JobEntry) error { - err := r.init(je) - if err != nil { - return err - } - r.Start(job.JobRunning) - return nil -} - -func (r *Runner) init(je models.JobEntry) error { - r.JobID = je.ID - r.InitJobSM() - err := json.Unmarshal([]byte(je.ParmsStr), &r.parm) - if err != nil { - return err - } - r.Logger = job.Logger{je.ID} - r.AddTransition(job.JobRunning, "pull-img", ImgPuller{DummyHandler: job.DummyHandler{JobID: r.JobID}, img: r.parm.Image, logger: r.Logger}) - //only handle on target for now - url := r.parm.Targets[0].URL - r.AddTransition("pull-img", "push-img", ImgPusher{DummyHandler: job.DummyHandler{JobID: r.JobID}, targetURL: url, logger: r.Logger}) - r.AddTransition("push-img", job.JobFinished, job.StatusUpdater{job.DummyHandler{JobID: r.JobID}, job.JobFinished}) - return nil -} -*/ diff --git a/job/scheduler.go b/job/scheduler.go index 387d92942..fddfdcafe 100644 --- a/job/scheduler.go +++ b/job/scheduler.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 job var jobQueue = make(chan int64) diff --git a/job/statehandlers.go b/job/statehandlers.go index 15907396b..60e852422 100644 --- a/job/statehandlers.go +++ b/job/statehandlers.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 job import ( diff --git a/job/statemachine.go b/job/statemachine.go index 5c8233988..94c892a70 100644 --- a/job/statemachine.go +++ b/job/statemachine.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 job import ( diff --git a/job/utils/logger.go b/job/utils/logger.go index 0a245753c..47c9f72a0 100644 --- a/job/utils/logger.go +++ b/job/utils/logger.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 utils import ( diff --git a/job/workerpool.go b/job/workerpool.go index 0d6d2e352..c01273ba3 100644 --- a/job/workerpool.go +++ b/job/workerpool.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 job import ( diff --git a/jobservice/main.go b/jobservice/main.go index 10ea2ae79..6f17eb9c5 100644 --- a/jobservice/main.go +++ b/jobservice/main.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 main import ( diff --git a/jobservice/router.go b/jobservice/router.go index e917fcc90..f1705d1af 100644 --- a/jobservice/router.go +++ b/jobservice/router.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 main import ( diff --git a/models/base.go b/models/base.go index 52ac63925..a36300955 100644 --- a/models/base.go +++ b/models/base.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 models import ( diff --git a/models/replication_job.go b/models/replication_job.go index c3bf6be86..80eb1b36b 100644 --- a/models/replication_job.go +++ b/models/replication_job.go @@ -1,3 +1,18 @@ +/* + Copyright (c) 2016 VMware, Inc. All Rights Reserved. + 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 models import (