001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 */
012package org.nuxeo.ecm.automation.client.jaxrs.spi;
013
014import java.io.IOException;
015
016public class ConnectorHandler implements Connector {
017
018    protected final Connector connector;
019
020    protected final RequestInterceptor interceptor;
021
022    public ConnectorHandler(Connector connector, RequestInterceptor interceptor) {
023        this.connector = connector;
024        this.interceptor = interceptor;
025    }
026
027    @Override
028    public Object execute(Request request) throws IOException {
029        interceptor.processRequest(request, connector);
030        return connector.execute(request);
031    }
032
033}