blob: a4b81dc043b1821e28e4b15d35ce693c04dd1066 [file] [log] [blame]
/*
* Copyright (c) 2020 Kentyou.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Kentyou - initial API and implementation
*/
package org.eclipse.sensinact.gateway.core.method;
import org.eclipse.sensinact.gateway.common.bundle.Mediator;
import org.json.JSONObject;
/**
* Extended {@link AccessMethodResponseBuilder} dedicated to {@link ActMethod}
* execution
*
* @author <a href="mailto:christophe.munilla@cea.fr">Christophe Munilla</a>
*/
@SuppressWarnings("serial")
public class ActResponseBuilder extends AccessMethodResponseBuilder<JSONObject, ActResponse> {
/**
* @param uri
* @param parameters
*/
protected ActResponseBuilder(Mediator mediator, String uri, Object[] parameters) {
super(mediator, uri, parameters);
}
/**
* @inheritDoc
*
* @see AccessMethodResponseBuilder#
* createAccessMethodResponse(org.eclipse.sensinact.gateway.core.model.message.SnaMessage.Status)
*/
@Override
public ActResponse createAccessMethodResponse(AccessMethodResponse.Status status) {
ActResponse response = new ActResponse(super.mediator, super.getPath(), status);
while (!super.isEmpty()) {
response.addTriggered(super.pop().toString());
}
return response;
}
/**
* @inheritDoc
*
* @see org.eclipse.sensinact.gateway.core.method.AccessMethodResponseBuilder#getComponentType()
*/
@Override
public Class<JSONObject> getComponentType() {
return JSONObject.class;
}
}