Skip to content

Commit

Permalink
XWIKI-18604: Expose the Icon Theme through the REST API
Browse files Browse the repository at this point in the history
- Introduces the icon extension rest api and default implementation modules
- Introduces the icon extension docker tests module
  • Loading branch information
manuelleduc committed Apr 30, 2021
1 parent 2ea2ec2 commit 2b82f75
Show file tree
Hide file tree
Showing 15 changed files with 1,112 additions and 0 deletions.
9 changes: 9 additions & 0 deletions xwiki-platform-core/xwiki-platform-icon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@
<module>xwiki-platform-icon-default</module>
<module>xwiki-platform-icon-script</module>
<module>xwiki-platform-icon-ui</module>
<module>xwiki-platform-icon-rest</module>
<!-- Icon Themes -->
<module>xwiki-platform-icon-fontawesome</module>
</modules>
<profiles>
<profile>
<id>integration-tests</id>
<modules>
<module>xwiki-platform-icon-test</module>
</modules>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-icon</artifactId>
<version>13.4-SNAPSHOT</version>
</parent>
<artifactId>xwiki-platform-icon-rest</artifactId>
<name>XWiki Platform - Icon - REST - Parent POM</name>
<packaging>pom</packaging>
<description>Services to access XWiki Icons through a RESTful API.</description>
<properties>
<!-- Name to display by the Extension Manager -->
<xwiki.extension.name>Icon REST Services</xwiki.extension.name>
</properties>
<modules>
<module>xwiki-platform-icon-rest-api</module>
<module>xwiki-platform-icon-rest-default</module>
</modules>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-icon-rest</artifactId>
<version>13.4-SNAPSHOT</version>
</parent>
<artifactId>xwiki-platform-icon-rest-api</artifactId>
<name>XWiki Platform - Icon - REST - API</name>
<packaging>jar</packaging>
<description>The API of the Icon REST services.</description>
<properties>
<xwiki.extension.name>Icon REST Services API</xwiki.extension.name>
</properties>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</dependency>
<dependency>
<groupId>org.xwiki.commons</groupId>
<artifactId>xwiki-commons-stability</artifactId>
<version>${commons.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<configuration>
<generatePackage>org.xwiki.icon.rest.model.jaxb</generatePackage>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- Apply the Checkstyle configurations defined in the top level pom.xml file -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<!-- Specify the "default" execution id so that the "blocker" one is always executed -->
<id>default</id>
<configuration>
<excludes>org/xwiki/icon/rest/model/jaxb/*.java</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.icon.rest;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;

import org.xwiki.icon.rest.model.jaxb.Icons;
import org.xwiki.stability.Unstable;

/**
* Exposes the wiki icon themes and their icons through REST.
*
* @version $Id$
* @since 13.4RC1
*/
@Path("/wikis/{wikiName}/iconThemes")
@Unstable
public interface IconThemesResource
{
/**
* Returns the icons metadata of the requested icons list, for a given icon theme.
*
* @param wikiName the name of the wiki holding the icons
* @param iconTheme the name of the icon theme holding the icons
* @param names a list of icon names to return
* @return the list of resolved icons metadata
*/
@GET
@Path("/{iconTheme}/icons")
Icons getIconsByTheme(@PathParam("wikiName") String wikiName, @PathParam("iconTheme") String iconTheme,
@QueryParam("name") List<String> names);

/**
* Returns the icons metadata of the requested icons list, for the default icon theme.
*
* @param wikiName the name of the wiki holding the icons
* @param names a list of icon names to return
* @return the list of resolved icons metadata
*/
@GET
@Path("/icons")
Icons getIcons(@PathParam("wikiName") String wikiName, @QueryParam("name") List<String> names);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*
-->

<!--
This enables the simple binding mode in JAXB.
See https://javaee.github.io/jaxb-v2/doc/user-guide/ch05.html#simple
-->
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc">
<jaxb:globalBindings>
<xjc:simple/>
</jaxb:globalBindings>
</jaxb:bindings>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.xwiki.org/icon"
xmlns:icon="http://www.xwiki.org/icon" elementFormDefault="qualified">

<!--
*
* Types
*
-->

<complexType name="Icon">
<annotation>
<documentation>Stores an icon metatada.</documentation>
</annotation>
<sequence>
<element name="name" type="string"/>
<element name="iconSetType" type="string"/>
<element name="iconSetName" type="string"/>
<element name="cssClass" type="string" minOccurs="0"/>
<element name="url" type="string" minOccurs="0"/>
</sequence>
</complexType>

<complexType name="Icons">
<annotation>
<documentation>Stores a collection of icons metadatas.</documentation>
</annotation>
<sequence>
<!-- A collection of resolved translations. -->
<element name="icon" type="icon:Icon" minOccurs="0" maxOccurs="unbounded"/>
<element name="missingIcons" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>

<!--
*
* Elements
*
-->

<element name="icons" type="icon:Icons"/>
</schema>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-icon-rest</artifactId>
<version>13.4-SNAPSHOT</version>
</parent>
<artifactId>xwiki-platform-icon-rest-default</artifactId>
<name>XWiki Platform - Icon - REST - Default</name>
<packaging>jar</packaging>
<description>Default implementation of the Icon REST API.</description>
<properties>
<xwiki.jacoco.instructionRatio>1.00</xwiki.jacoco.instructionRatio>
<!-- Name to display by the Extension Manager -->
<xwiki.extension.name>Icon REST Services - Default Implementation</xwiki.extension.name>
</properties>
<dependencies>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-icon-rest-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.xwiki.commons</groupId>
<artifactId>xwiki-commons-component-api</artifactId>
<version>${commons.version}</version>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-rest-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-model-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-icon-api</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test dependencies. -->
<dependency>
<groupId>org.xwiki.commons</groupId>
<artifactId>xwiki-commons-tool-test-component</artifactId>
<version>${commons.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

0 comments on commit 2b82f75

Please sign in to comment.