Skip to content

Commit

Permalink
563-remove-functions-and-procedures-from-jqa-plugin-xml-descriptor (#564
Browse files Browse the repository at this point in the history
)
  • Loading branch information
DirkMahler authored Jul 31, 2024
1 parent 0839e5a commit d9c32d6
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
*/
public interface PluginConfigurationReader {

String NAMESPACE = "http://schema.jqassistant.org/plugin/v2.2";
String NAMESPACE = "http://schema.jqassistant.org/plugin/v2.4";
String PLUGIN_RESOURCE = "META-INF/jqassistant-plugin.xml";
String PLUGIN_SCHEMA_RESOURCE = "/META-INF/schema/jqassistant-plugin-v2.2.xsd";
String PLUGIN_SCHEMA_RESOURCE = "/META-INF/schema/jqassistant-plugin-v2.4.xsd";

/**
* Return the class loader used to resolve plugins.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@ public class StorePluginRepositoryImpl extends AbstractPluginRepository implemen

private final List<Class<?>> descriptorTypes;

private final List<Class<?>> procedureTypes;

private final List<Class<?>> functionTypes;

/**
* Constructor.
*/
public StorePluginRepositoryImpl(PluginConfigurationReader pluginConfigurationReader) {
super(pluginConfigurationReader);
this.descriptorTypes = getTypes(plugins, plugin -> plugin.getModel());
this.procedureTypes = getTypes(plugins, plugin -> plugin.getProcedure());
this.functionTypes = getTypes(plugins, plugin -> plugin.getFunction());
this.descriptorTypes = getTypes(plugins, JqassistantPlugin::getModel);
}

@Override
Expand All @@ -41,16 +35,6 @@ public List<Class<?>> getDescriptorTypes() {
return descriptorTypes;
}

@Override
public List<Class<?>> getProcedureTypes() {
return procedureTypes;
}

@Override
public List<Class<?>> getFunctionTypes() {
return functionTypes;
}

private List<Class<?>> getTypes(List<JqassistantPlugin> plugins, Function<JqassistantPlugin, ClassListType> classListSupplier) {
List<Class<?>> types = new ArrayList<>();
for (JqassistantPlugin plugin : plugins) {
Expand Down
2 changes: 1 addition & 1 deletion core/schemata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<fileset>
<directory>${project.basedir}/src/main/resources/META-INF/schema</directory>
<includes>
<include>jqassistant-plugin-v2.2.xsd</include>
<include>jqassistant-plugin-v2.4.xsd</include>
<include>jqassistant-report-v2.3.xsd</include>
<include>jqassistant-rule-v2.2.xsd</include>
<include>jqassistant-baseline-v2.4.xsd</include>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://schema.jqassistant.org/plugin/v2.4"
targetNamespace="http://schema.jqassistant.org/plugin/v2.4"
elementFormDefault="qualified">

<xs:element name="jqassistant-plugin">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="xs:string"/>
<xs:element name="model" type="tns:ClassListType" minOccurs="0"/>
<xs:element name="scope" type="tns:ClassListType" minOccurs="0"/>
<!-- deprecated: the scanner element will no longer support the id attribute -->
<xs:element name="scanner" type="tns:IdClassListType" minOccurs="0"/>
<xs:element name="rules" type="tns:RulesType" minOccurs="0"/>
<xs:element name="ruleParser" type="tns:IdClassListType" minOccurs="0"/>
<xs:element name="ruleInterpreter" type="tns:IdClassListType" minOccurs="0"/>
<xs:element name="report" type="tns:IdClassListType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string"/>

<!--
! In a later version of jQAssistant, the id attribute will
! be mandatory.
! Oliver B. Fischer, 2021-04-22
!-->
<xs:attribute name="id" use="optional">
<xs:annotation>
<xs:documentation>
The id attribute of a plugin contains the unique identifier
of the plugin, which is used by jQAssistant
to refer to the plugin during the configuration of jQAssistant.

The id of a plugin must be unique among all plugins jQAssistant
loads during the startup. Therefore it is recommended
to use the first characters of the id for a namespace
similar prefix followed by a dot.

For example, all plugins provided by jQAssitant
itself, will use the prefix "jqa.".
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-z][a-z0-9\.]+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>

<xs:complexType name="ClassListType">
<xs:sequence>
<xs:element name="class" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="IdClassListType">
<xs:sequence>
<xs:element name="class" type="tns:IdClassType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="RulesType">
<xs:sequence>
<xs:element name="resource" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="IdClassType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

</xs:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Defines the interface for the scanner plugin repository.
*/
public interface StorePluginRepository extends LifecycleAware {
public interface StorePluginRepository extends LifecycleAware {

ClassLoader getClassLoader();

Expand All @@ -18,10 +18,6 @@ public interface StorePluginRepository extends LifecycleAware {
*/
List<Class<?>> getDescriptorTypes();

List<Class<?>> getProcedureTypes();

List<Class<?>> getFunctionTypes();

@Override
default void initialize() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.common"
name="jQAssistant Common Plugin"
version="${project.version}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.java"
name="jQAssistant Java Plugin"
version="${project.version}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.json"
name="jQAssistant JSON Plugin"
version="${project.version}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.json.it"
name="jQAssistant JSON Plugin IT"
version="${project.version}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.junit"
name="jQAssistant JUnit Plugin"
version="${project.version}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.maven3"
name="jQAssistant Maven 3 Plugin"
version="${project.version}">
Expand Down
4 changes: 2 additions & 2 deletions plugin/xml/src/main/resources/META-INF/jqassistant-plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.xml"
name="jQAssistant XML Plugin"
version="${project.version}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.2"
<jqassistant-plugin xmlns="http://schema.jqassistant.org/plugin/v2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.2 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.2.xsd"
xsi:schemaLocation="http://schema.jqassistant.org/plugin/v2.4 https://schema.jqassistant.org/plugin/jqassistant-plugin-v2.4.xsd"
id="jqa.plugin.yaml2"
name="jQAssistant YAML 2 Plugin"
version="${project.version}">
Expand Down

0 comments on commit d9c32d6

Please sign in to comment.