use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.
the class HttpCallerManager method removeCaller.
public void removeCaller(ICallerList callerList) {
if (!this.isConnected()) {
this.m_logger.warning("Client is not yet connected with the server.");
return;
}
IRequester r = null;
IHttpResponse resp = null;
r = this.getRequester(new CallerListRemoveHandler(callerList, this.getCallerManager()));
resp = r.request();
this.handleRequester(resp, r);
}
use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.
the class HttpCallerManager method getCallers.
public ICallerList getCallers(IFilter filter) {
if (!this.isConnected()) {
this.m_logger.warning("Client is not yet connected with the server.");
return this.getRuntime().getCallerFactory().createCallerList();
}
if (filter != null) {
return this.getCallers(new IFilter[] { filter });
}
this.m_logger.info("No filter is applied.");
IRequester r = this.getRequester(new CallerListGetHandler(this.getCallerManager()));
IHttpResponse resp = r.request();
String xml = this.getXmlContent(resp);
this.handleRequester(resp, r);
ICallerList l = XMLSerializer.toCallerList(xml);
if (l != null) {
this.addCallerManagerAttribute(l);
return l;
}
this.m_logger.warning("Callerlist from remote host was empty.");
return this.getRuntime().getCallerFactory().createCallerList();
}
use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.
the class HttpCallerManager method getCaller.
public ICaller getCaller(IPhonenumber number) throws CallerNotFoundException {
if (!this.isConnected()) {
this.m_logger.warning("Client is not yet connected with the server.");
throw new CallerNotFoundException("No caller found. Client is not yet connected with the server.");
}
IRequester r = this.getRequester(new CallerGetHandler(number, this.getCallerManager()));
IHttpResponse resp = r.request();
String xml = this.getXmlContent(resp);
this.handleRequester(resp, r);
ICaller c = XMLSerializer.toCaller(xml);
if (c != null) {
return c;
}
throw new CallerNotFoundException("no caller found.");
}
use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.
the class HttpCallManager method setCalls.
public void setCalls(ICallList calllist) {
if (!this.isConnected()) {
this.m_logger.warning("Client is not yet connected with the server.");
return;
}
IRequester r = this.getRequester(new CallListSetHandler(calllist, this.getCallManager()));
IHttpResponse resp = r.request();
this.handleRequester(resp, r);
}
use of de.janrufmonitor.service.commons.http.IHttpResponse in project janrufmonitor by tbrandt77.
the class HttpCallManager method getCalls.
public synchronized ICallList getCalls(IFilter[] filters, int count, int offset, ISearchTerm[] searchTerms) {
if (!this.isConnected()) {
this.m_logger.warning("Client is not yet connected with the server.");
return this.getRuntime().getCallFactory().createCallList();
}
IRequester r = this.getRequester(new CallListGetHandler(this.getCallManager(), filters, searchTerms));
IHttpResponse resp = r.request();
String xml = this.getXmlContent(resp);
this.handleRequester(resp, r);
if (xml != null && xml.length() > 0) {
ICallList l = XMLSerializer.toCallList(xml);
if (l != null)
return l;
this.m_logger.warning("Calllist from remote host was empty.");
PropagationFactory.getInstance().fire(new Message(Message.ERROR, getNamespace(), "empty", new Exception("CallList from server has either a wrong format, contains forbidden characters or was empty.")));
}
return this.getRuntime().getCallFactory().createCallList();
}
Aggregations