Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 88 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
<distribution>repo</distribution>
</license>
</licenses>
<url>http://elasticsearch.org</url>
<scm>
<connection>scm:git:git@github.com:elasticsearch/elasticsearch.git</connection>
<developerConnection>scm:git:git@github.com:elasticsearch/elasticsearch.git</developerConnection>
<url>http://github.com/elasticsearch/elasticsearch</url>
<connection>scm:git:git@github.com:jprante/elasticsearch.git</connection>
<developerConnection>scm:git:git@github.com:jprante/elasticsearch.git</developerConnection>
<url>http://github.com/jprante/elasticsearch</url>
</scm>

<!--
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>

-->
<properties>
<lucene.version>3.6.0</lucene.version>
<github.global.server>github</github.global.server>
</properties>

<repositories>
Expand Down Expand Up @@ -520,6 +523,87 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<locale>en</locale>
<nohelp>true</nohelp>
<show>public</show>
<splitindex>true</splitindex>
</configuration>
<executions>
<execution>
<goals>
<goal>javadoc</goal>
</goals>
<phase>site</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<locales>en</locales>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.6</version>
<configuration>
<message>Building site for ${project.version}</message>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>site</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<locale>en</locale>
<nohelp>true</nohelp>
<show>public</show>
<splitindex>true</splitindex>
</configuration>
<reportSets>
<reportSet>
<id>default</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.9</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.elasticsearch.rest.action.get.RestMultiGetAction;
import org.elasticsearch.rest.action.index.RestIndexAction;
import org.elasticsearch.rest.action.main.RestMainAction;
import org.elasticsearch.rest.action.main.RestPluginAction;
import org.elasticsearch.rest.action.mlt.RestMoreLikeThisAction;
import org.elasticsearch.rest.action.percolate.RestPercolateAction;
import org.elasticsearch.rest.action.search.RestMultiSearchAction;
Expand All @@ -93,6 +94,7 @@ protected void configure() {
}

bind(RestMainAction.class).asEagerSingleton();
bind(RestPluginAction.class).asEagerSingleton();

bind(RestNodesInfoAction.class).asEagerSingleton();
bind(RestNodesStatsAction.class).asEagerSingleton();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.rest.action.main;

import com.google.common.collect.ImmutableMap;
import java.io.IOException;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.env.Environment;
import org.elasticsearch.node.internal.InternalSettingsPerparer;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.plugins.PluginsService;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.XContentRestResponse;
import org.elasticsearch.rest.XContentThrowableRestResponse;
import org.elasticsearch.rest.action.support.RestXContentBuilder;

public class RestPluginAction extends BaseRestHandler {

@Inject
public RestPluginAction(Settings settings, Client client, RestController controller) {
super(settings, client);

controller.registerHandler(RestRequest.Method.GET, "/_plugins", this);
}

@Override
public void handleRequest(final RestRequest request, final RestChannel channel) {
Tuple<Settings, Environment> tuple = InternalSettingsPerparer.prepareSettings(settings, true);
final PluginsService pluginsService = new PluginsService(tuple.v1(), tuple.v2());
try {
RestStatus status = RestStatus.OK;
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request).prettyPrint();
builder.startObject().field("ok", true).startObject("plugins");
ImmutableMap<String,Plugin> plugins = pluginsService.plugins();
for (String name : plugins.keySet()) {
builder.field(name, plugins.get(name).description());
}
builder.endObject().endObject();
channel.sendResponse(new XContentRestResponse(request, status, builder));
} catch (Exception e) {
try {
channel.sendResponse(new XContentThrowableRestResponse(request, e));
} catch (IOException e1) {
logger.warn("Failed to send response", e);
}
}
}
}
30 changes: 30 additions & 0 deletions src/site/site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="${project.name}">
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.2.1</version>
</skin>
<custom>
<fluidoSkin>
<topBarEnabled>true</topBarEnabled>
<sourceLineNumbersEnabled>true</sourceLineNumbersEnabled>
<gitHub>
<projectId>jprante/elasticsearch</projectId>
<ribbonOrientation>right</ribbonOrientation>
<ribbonColor>black</ribbonColor>
</gitHub>
<twitter>
<user>xbib</user>
<showUser>true</showUser>
<showFollowers>true</showFollowers>
</twitter>
</fluidoSkin>
</custom>
<body>
<links>
<item name="${project.name}" href="${project.url}"/>
</links>
<menu ref="reports" />
</body>
</project>