forked from hyperic/hq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added binary dependencies previously pulled from svn externals
- Loading branch information
Jennifer Hickey
committed
Sep 21, 2009
1 parent
6285368
commit dcddbcd
Showing
53 changed files
with
4,146 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import org.hyperic.hq.hqu.rendit.HQUPlugin | ||
|
||
// Import controllers for deployment time syntax checking. | ||
import UserController | ||
|
||
class Plugin extends HQUPlugin { | ||
|
||
void initialize(File pluginDir) { | ||
super.initialize(pluginDir) | ||
addAdminView(true, '/api/index.hqu', 'HQ Web Services Api') | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
import org.hyperic.hq.hqapi1.ErrorCode; | ||
|
||
class AgentController extends ApiController { | ||
|
||
private Closure getAgentXML(a) { | ||
{ doc -> | ||
Agent(id : a.id, | ||
address : a.address, | ||
port : a.port, | ||
version : a.version, | ||
unidirectional : a.unidirectional) | ||
} | ||
} | ||
|
||
private Closure getUpXML(boolean up) { | ||
{ doc -> | ||
Up(up) | ||
} | ||
} | ||
|
||
def get(params) { | ||
def id = params.getOne("id")?.toInteger() | ||
def address = params.getOne("address") | ||
def port = params.getOne("port")?.toInteger() | ||
|
||
def failureXml | ||
def agent = getAgent(id, address, port) | ||
|
||
if (!agent) { | ||
failureXml = getFailureXML(ErrorCode.OBJECT_NOT_FOUND, | ||
"Unable to find agent with id=" + id + | ||
" address=" + address + " port=" + port) | ||
} | ||
|
||
renderXml() { | ||
out << AgentResponse() { | ||
if (failureXml) { | ||
out << failureXml | ||
} else { | ||
out << getSuccessXML() | ||
out << getAgentXML(agent) | ||
} | ||
} | ||
} | ||
} | ||
|
||
def list(params) { | ||
renderXml() { | ||
out << AgentsResponse() { | ||
out << getSuccessXML() | ||
for (agent in agentHelper.allAgents.sort {a, b -> a.address <=> b.address}) { | ||
out << getAgentXML(agent) | ||
} | ||
} | ||
} | ||
} | ||
|
||
def ping(params) { | ||
def id = params.getOne('id')?.toInteger() | ||
|
||
def failureXml | ||
boolean up | ||
if (!id) { | ||
failureXml = getFailureXML(ErrorCode.INVALID_PARAMETERS) | ||
} else { | ||
try { | ||
def agent = getAgent(id, null, null) | ||
if (!agent) { | ||
failureXml = getFailureXML(ErrorCode.OBJECT_NOT_FOUND, | ||
"Agent with id=" + id + " not found") | ||
|
||
} else { | ||
up = agent.ping(user) | ||
} | ||
} catch (Exception e) { | ||
log.error("UnexpectedError: " + e.getMessage(), e); | ||
failureXml = getFailureXML(ErrorCode.UNEXPECTED_ERROR) | ||
} | ||
} | ||
|
||
renderXml() { | ||
out << PingAgentResponse() { | ||
if (failureXml) { | ||
out << failureXml | ||
} else { | ||
out << getSuccessXML() | ||
out << getUpXML(up) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.