Search in sources :

Example 1 with IHttpResponse

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);
}
Also used : IRequester(de.janrufmonitor.service.commons.http.IRequester) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse) CallerListRemoveHandler(de.janrufmonitor.service.client.request.handler.CallerListRemoveHandler)

Example 2 with IHttpResponse

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();
}
Also used : CallerListGetHandler(de.janrufmonitor.service.client.request.handler.CallerListGetHandler) ICallerList(de.janrufmonitor.framework.ICallerList) IRequester(de.janrufmonitor.service.commons.http.IRequester) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 3 with IHttpResponse

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.");
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) IRequester(de.janrufmonitor.service.commons.http.IRequester) CallerGetHandler(de.janrufmonitor.service.client.request.handler.CallerGetHandler) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 4 with IHttpResponse

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);
}
Also used : CallListSetHandler(de.janrufmonitor.service.client.request.handler.CallListSetHandler) IRequester(de.janrufmonitor.service.commons.http.IRequester) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Example 5 with IHttpResponse

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();
}
Also used : CallListGetHandler(de.janrufmonitor.service.client.request.handler.CallListGetHandler) Message(de.janrufmonitor.exception.Message) ICallList(de.janrufmonitor.framework.ICallList) IRequester(de.janrufmonitor.service.commons.http.IRequester) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) IHttpResponse(de.janrufmonitor.service.commons.http.IHttpResponse)

Aggregations

IHttpResponse (de.janrufmonitor.service.commons.http.IHttpResponse)15 IRequester (de.janrufmonitor.service.commons.http.IRequester)14 ICallerList (de.janrufmonitor.framework.ICallerList)3 GetDialExtensions (de.janrufmonitor.service.client.request.handler.GetDialExtensions)3 CallerListGetHandler (de.janrufmonitor.service.client.request.handler.CallerListGetHandler)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Message (de.janrufmonitor.exception.Message)1 ICallList (de.janrufmonitor.framework.ICallList)1 ICaller (de.janrufmonitor.framework.ICaller)1 CallListCountGetHandler (de.janrufmonitor.service.client.request.handler.CallListCountGetHandler)1 CallListGetHandler (de.janrufmonitor.service.client.request.handler.CallListGetHandler)1 CallListRemoveHandler (de.janrufmonitor.service.client.request.handler.CallListRemoveHandler)1 CallListSetHandler (de.janrufmonitor.service.client.request.handler.CallListSetHandler)1 CallerGetHandler (de.janrufmonitor.service.client.request.handler.CallerGetHandler)1 CallerListRemoveHandler (de.janrufmonitor.service.client.request.handler.CallerListRemoveHandler)1 CallerListSetHandler (de.janrufmonitor.service.client.request.handler.CallerListSetHandler)1 CallerListUpdateHandler (de.janrufmonitor.service.client.request.handler.CallerListUpdateHandler)1 Dial (de.janrufmonitor.service.client.request.handler.Dial)1 IHttpRequest (de.janrufmonitor.service.commons.http.IHttpRequest)1