2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org
.argeo
.slc
.web
.mvc
.controllers
;
19 import java
.util
.List
;
20 import java
.util
.Vector
;
22 import org
.argeo
.slc
.dao
.runtime
.SlcAgentDescriptorDao
;
23 import org
.argeo
.slc
.msg
.ExecutionAnswer
;
24 import org
.argeo
.slc
.msg
.ObjectList
;
25 import org
.argeo
.slc
.runtime
.SlcAgentDescriptor
;
26 import org
.springframework
.stereotype
.Controller
;
27 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
30 * Controle and information about the agents.
34 public class AgentController
{
37 private SlcAgentDescriptorDao slcAgentDescriptorDao
;
39 @RequestMapping("/listAgents.service")
40 protected ObjectList
listAgents() {
41 List
<SlcAgentDescriptor
> list
= slcAgentDescriptorDao
42 .listSlcAgentDescriptors();
43 return new ObjectList(list
);
46 @RequestMapping("/cleanAgents.service")
47 protected ExecutionAnswer
cleanAgents() {
49 List
<SlcAgentDescriptor
> list
= slcAgentDescriptorDao
50 .listSlcAgentDescriptors();
51 for (SlcAgentDescriptor t
: new Vector
<SlcAgentDescriptor
>(list
)) {
52 slcAgentDescriptorDao
.delete(t
);
54 return ExecutionAnswer
.ok("Execution completed properly");
58 public void setSlcAgentDescriptorDao(
59 SlcAgentDescriptorDao slcAgentDescriptorDao
) {
60 this.slcAgentDescriptorDao
= slcAgentDescriptorDao
;