Skip to content
Snippets Groups Projects
Commit fe2e5ba5 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

Fix compilation

parent 30f03309
Branches
Tags
No related merge requests found
Showing
with 1 addition and 947 deletions
package org.duniter.elasticsearch.action;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.core.exception.BusinessException;
import org.duniter.elasticsearch.rest.XContentThrowableRestResponse;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.exception.DuniterElasticsearchException;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.*;
import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestStatus.OK;
public abstract class AbstractRestPostIndexAction extends BaseRestHandler {
private static ESLogger log = null;
private final JsonIndexer indexer;
public AbstractRestPostIndexAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
String indexName,
String typeName,
JsonIndexer indexer) {
super(settings, controller, client);
controller.registerHandler(POST,
String.format("/%s/%s", indexName, typeName),
this);
securityController.allowIndexType(POST, indexName, typeName);
securityController.allowIndexType(GET, indexName, typeName);
log = ESLoggerFactory.getLogger(String.format("[%s]", indexName));
this.indexer = indexer;
}
@Override
protected void handleRequest(final RestRequest request, RestChannel restChannel, Client client) throws Exception {
try {
String id = indexer.handleJson(request.content().toUtf8());
restChannel.sendResponse(new BytesRestResponse(OK, id));
}
catch(DuniterElasticsearchException | BusinessException e) {
log.error(e.getMessage(), e);
restChannel.sendResponse(new XContentThrowableRestResponse(request, e));
}
catch(Exception e) {
log.error(e.getMessage(), e);
}
}
public interface JsonIndexer {
String handleJson(String json) throws DuniterElasticsearchException, BusinessException;
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.core.exception.BusinessException;
import org.duniter.elasticsearch.rest.XContentThrowableRestResponse;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.exception.DuniterElasticsearchException;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.*;
import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestStatus.OK;
public abstract class AbstractRestPostUpdateAction extends BaseRestHandler {
private static ESLogger log = null;
private final JsonUpdater updater;
public AbstractRestPostUpdateAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
String indexName,
String typeName,
JsonUpdater updater) {
super(settings, controller, client);
controller.registerHandler(POST,
String.format("/%s/%s/{id}/_update", indexName, typeName),
this);
securityController.allowIndexType(POST, indexName, typeName);
log = ESLoggerFactory.getLogger(String.format("[%s]", indexName));
this.updater = updater;
}
@Override
protected void handleRequest(final RestRequest request, RestChannel restChannel, Client client) throws Exception {
String id = request.param("id");
try {
updater.handleJson(request.content().toUtf8(), id);
restChannel.sendResponse(new BytesRestResponse(OK, id));
}
catch(DuniterElasticsearchException | BusinessException e) {
log.error(e.getMessage(), e);
restChannel.sendResponse(new XContentThrowableRestResponse(request, e));
}
catch(Exception e) {
log.error(e.getMessage(), e);
}
}
public interface JsonUpdater {
void handleJson(String json, String id) throws DuniterElasticsearchException, BusinessException;
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.currency.RestCurrencyIndexAction;
import org.duniter.elasticsearch.rest.history.RestHistoryDeleteIndexAction;
import org.duniter.elasticsearch.action.market.*;
import org.duniter.elasticsearch.action.message.RestMessageInboxIndexAction;
import org.duniter.elasticsearch.action.message.RestMessageOutboxIndexAction;
import org.duniter.elasticsearch.action.registry.*;
import org.duniter.elasticsearch.rest.security.RestSecurityAuthAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.rest.security.RestSecurityFilter;
import org.duniter.elasticsearch.rest.security.RestSecurityGetChallengeAction;
import org.duniter.elasticsearch.action.user.RestUserProfileIndexAction;
import org.duniter.elasticsearch.action.user.RestUserProfileUpdateAction;
import org.duniter.elasticsearch.action.user.RestUserSettingsIndexAction;
import org.duniter.elasticsearch.action.user.RestUserSettingsUpdateAction;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.inject.Module;
public class RestModule extends AbstractModule implements Module {
@Override protected void configure() {
// Currency
bind(RestCurrencyIndexAction.class).asEagerSingleton();
// Market
bind(RestMarketRecordIndexAction.class).asEagerSingleton();
bind(RestMarketRecordUpdateAction.class).asEagerSingleton();
bind(RestMarketCommentIndexAction.class).asEagerSingleton();
bind(RestMarketCommentUpdateAction.class).asEagerSingleton();
bind(RestMarketCategoryAction.class).asEagerSingleton();
// Registry
bind(RestRegistryRecordIndexAction.class).asEagerSingleton();
bind(RestRegistryRecordUpdateAction.class).asEagerSingleton();
bind(RestRegistryCommentIndexAction.class).asEagerSingleton();
bind(RestregistryCommentUpdateAction.class).asEagerSingleton();
bind(RestRegistryCategoryAction.class).asEagerSingleton();
// User
bind(RestUserProfileIndexAction.class).asEagerSingleton();
bind(RestUserProfileUpdateAction.class).asEagerSingleton();
bind(RestUserSettingsIndexAction.class).asEagerSingleton();
bind(RestUserSettingsUpdateAction.class).asEagerSingleton();
// Authentication & Security
bind(RestSecurityGetChallengeAction.class).asEagerSingleton();
bind(RestSecurityAuthAction.class).asEagerSingleton();
bind(RestSecurityFilter.class).asEagerSingleton();
bind(RestSecurityController.class).asEagerSingleton();
// History
bind(RestHistoryDeleteIndexAction.class).asEagerSingleton();
// Message
bind(RestMessageInboxIndexAction.class).asEagerSingleton();
bind(RestMessageOutboxIndexAction.class).asEagerSingleton();
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.history;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.HistoryService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestHistoryDeleteIndexAction extends AbstractRestPostIndexAction {
private static final ESLogger log = ESLoggerFactory.getLogger(org.duniter.elasticsearch.rest.history.RestHistoryDeleteIndexAction.class.getName());
@Inject
public RestHistoryDeleteIndexAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController, HistoryService service) {
super(settings, controller, client, securityController,
HistoryService.INDEX,
HistoryService.DELETE_TYPE,
json -> service.indexDeleteFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.market;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.MarketService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.rest.RestRequest;
public class RestMarketCategoryAction {
@Inject
public RestMarketCategoryAction(RestSecurityController securityController) {
// Add security rule for category
securityController.allowIndexType(RestRequest.Method.GET, MarketService.INDEX, MarketService.RECORD_CATEGORY_TYPE);
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.market;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.MarketService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestMarketCommentIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestMarketCommentIndexAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
MarketService service) {
super(settings, controller, client, securityController,
MarketService.INDEX, MarketService.RECORD_COMMENT_TYPE,
json -> service.indexCommentFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.market;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostUpdateAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.MarketService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestMarketCommentUpdateAction extends AbstractRestPostUpdateAction {
@Inject
public RestMarketCommentUpdateAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
MarketService service) {
super(settings, controller, client, securityController,
MarketService.INDEX, MarketService.RECORD_COMMENT_TYPE,
(json, id) -> service.updateCommentFromJson(json, id));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.market;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.MarketService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestMarketRecordIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestMarketRecordIndexAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
MarketService service) {
super(settings, controller, client, securityController,
MarketService.INDEX, MarketService.RECORD_TYPE,
json -> service.indexRecordFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.market;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostUpdateAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.MarketService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestMarketRecordUpdateAction extends AbstractRestPostUpdateAction {
@Inject
public RestMarketRecordUpdateAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
MarketService service) {
super(settings, controller, client, securityController,
MarketService.INDEX, MarketService.RECORD_TYPE,
(json, id) -> service.updateRecordFromJson(json, id));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.message;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.MessageService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestMessageInboxIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestMessageInboxIndexAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
final MessageService service) {
super(settings, controller, client, securityController,
MessageService.INDEX,
MessageService.RECORD_TYPE,
json -> service.indexRecordFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.message;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.MessageService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestMessageOutboxIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestMessageOutboxIndexAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
final MessageService service) {
super(settings, controller, client, securityController,
MessageService.INDEX,
MessageService.OUTBOX_TYPE,
json -> service.indexRecordFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.registry;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.RegistryService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestRegistryCommentIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestRegistryCommentIndexAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
RegistryService service) {
super(settings, controller, client, securityController,
RegistryService.INDEX, RegistryService.RECORD_COMMENT_TYPE,
json -> service.indexCommentFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.registry;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.RegistryService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestRegistryRecordIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestRegistryRecordIndexAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
RegistryService service) {
super(settings, controller, client, securityController,
RegistryService.INDEX, RegistryService.RECORD_TYPE,
json -> service.indexRecordFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.registry;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostUpdateAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.RegistryService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestRegistryRecordUpdateAction extends AbstractRestPostUpdateAction {
@Inject
public RestRegistryRecordUpdateAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
RegistryService service) {
super(settings, controller, client, securityController,
RegistryService.INDEX, RegistryService.RECORD_TYPE,
(json, id) -> service.updateRecordFromJson(json, id));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.registry;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostUpdateAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.RegistryService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestregistryCommentUpdateAction extends AbstractRestPostUpdateAction {
@Inject
public RestregistryCommentUpdateAction(Settings settings, RestController controller, Client client, RestSecurityController securityController,
RegistryService service) {
super(settings, controller, client, securityController,
RegistryService.INDEX, RegistryService.RECORD_COMMENT_TYPE,
(json, id) -> service.updateCommentFromJson(json, id));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.user;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.UserService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestUserProfileIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestUserProfileIndexAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
UserService service) {
super(settings, controller, client, securityController,
UserService.INDEX,
UserService.PROFILE_TYPE,
json -> service.indexProfileFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.user;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostUpdateAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.UserService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestUserProfileUpdateAction extends AbstractRestPostUpdateAction {
@Inject
public RestUserProfileUpdateAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
UserService service) {
super(settings, controller, client, securityController,
UserService.INDEX,
UserService.PROFILE_TYPE,
(json, id) -> service.updateProfileFromJson(json, id));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.user;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.UserService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestUserSettingsIndexAction extends AbstractRestPostIndexAction {
@Inject
public RestUserSettingsIndexAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
final UserService service) {
super(settings, controller, client, securityController,
UserService.INDEX,
UserService.SETTINGS_TYPE,
json -> service.indexSettingsFromJson(json));
}
}
\ No newline at end of file
package org.duniter.elasticsearch.action.user;
/*
* #%L
* duniter4j-elasticsearch-plugin
* %%
* Copyright (C) 2014 - 2016 EIS
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import org.duniter.elasticsearch.rest.AbstractRestPostUpdateAction;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.service.UserService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
public class RestUserSettingsUpdateAction extends AbstractRestPostUpdateAction {
@Inject
public RestUserSettingsUpdateAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController,
final UserService service) {
super(settings, controller, client, securityController,
UserService.INDEX,
UserService.SETTINGS_TYPE,
(json, id) -> service.updateSettingsFromJson(json, id));
}
}
\ No newline at end of file
...@@ -49,7 +49,7 @@ public class Plugin extends org.elasticsearch.plugins.Plugin { ...@@ -49,7 +49,7 @@ public class Plugin extends org.elasticsearch.plugins.Plugin {
@Override @Override
public String name() { public String name() {
return "duniter"; return "duniter4j-es-core";
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment