@@ -0,0 +1,1335 @@
+package fi.nls.oskari.control.layer;%0A%0Aimport org.json.JSONObject;%0Aimport org.oskari.service.util.ServiceFactory;%0A%0Aimport fi.nls.oskari.annotation.OskariActionRoute;%0Aimport fi.nls.oskari.control.ActionException;%0Aimport fi.nls.oskari.control.ActionHandler;%0Aimport fi.nls.oskari.control.ActionParameters;%0Aimport fi.nls.oskari.domain.map.DataProvider;%0Aimport fi.nls.oskari.map.layer.DataProviderService;%0Aimport fi.nls.oskari.util.JSONHelper;%0Aimport fi.nls.oskari.util.ResponseHelper;%0A%0A/**%0A * Get single data provider registered in Oskari database%0A */%0A@OskariActionRoute(%22GetDataProvider%22)%0Apublic class GetDataProviderHandler extends ActionHandler %7B%0A%0A%09private static final String PARAM_ID = %22id%22;%0A%0A%09private DataProviderService service = ServiceFactory.getDataProviderService();%0A%0A%09@Override%0A%09public void handleAction(ActionParameters params) throws ActionException %7B%0A%09%09try %7B%0A%09%09%09final int id = Integer.valueOf(params.getHttpParam(PARAM_ID));%0A%09%09%09DataProvider d = service.find(id);%0A%09%09%09final JSONObject result = new JSONObject();%0A%09%09%09JSONHelper.putValue(result, %22dataprovider%22, d.getAsJSON());%0A%09%09%09ResponseHelper.writeResponse(params, result);%0A%09%09%7D catch (NumberFormatException nfe) %7B%0A%09%09%09throw new ActionException(%22Invalid id query parameter%22, nfe);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09throw new ActionException(%22Data provider query failed%22, e);%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add action route handler