tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [1/2] incubator-tamaya git commit: Added rule to ensure that the naming of the service provider configuration files is correct.
Date Sun, 19 Apr 2015 00:24:12 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master dcd20f6f2 -> 93ff8752d


Added rule to ensure that the naming of the service provider configuration files is correct.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/bf402299
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/bf402299
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/bf402299

Branch: refs/heads/master
Commit: bf40229957561c9141a74505d6a4bd680ab3d972
Parents: dcd20f6
Author: Oliver B. Fischer <plexus@apache.org>
Authored: Sun Apr 19 02:17:55 2015 +0200
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Sun Apr 19 02:17:55 2015 +0200

----------------------------------------------------------------------
 jqassistant/default.xml             |  1 +
 jqassistant/module-concepts.xml     | 55 ++++++++++++++++++++++++++++++++
 jqassistant/serviceloader-rules.xml | 53 ++++++++++++++++++++++++++++++
 3 files changed, 109 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/bf402299/jqassistant/default.xml
----------------------------------------------------------------------
diff --git a/jqassistant/default.xml b/jqassistant/default.xml
index c332fe6..222a685 100644
--- a/jqassistant/default.xml
+++ b/jqassistant/default.xml
@@ -55,5 +55,6 @@ under the License.
     <group id="default">
         <includeConstraint refId="naming:namingOfPropertyConverters"/>
         <includeConstraint refId="naming:namingOfPropertyFilters"/>
+        <includeConstraint refId="serviceLoader:correctServiceLoaderNaming"/>
     </group>
 </jqa:jqassistant-rules>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/bf402299/jqassistant/module-concepts.xml
----------------------------------------------------------------------
diff --git a/jqassistant/module-concepts.xml b/jqassistant/module-concepts.xml
new file mode 100644
index 0000000..29369ed
--- /dev/null
+++ b/jqassistant/module-concepts.xml
@@ -0,0 +1,55 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF 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.
+-->
+<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">
+
+    <concept id="module:SPI">
+        <description>Labels all .spi packages as "SPI".</description>
+        <cypher><![CDATA[
+			MATCH
+				(package:Package)
+
+			WHERE
+				package.name = "spi"
+
+			SET
+			    package:SPI
+
+			RETURN
+				package
+        ]]></cypher>
+    </concept>
+
+    <concept id="module:API">
+        <description>Labels all .api packages as "API".</description>
+        <cypher><![CDATA[
+			MATCH
+				(package:Package)
+
+			WHERE
+				package.name = "api"
+
+			SET
+			    package:API
+
+			RETURN
+				package
+        ]]></cypher>
+    </concept>
+
+</jqa:jqassistant-rules>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/bf402299/jqassistant/serviceloader-rules.xml
----------------------------------------------------------------------
diff --git a/jqassistant/serviceloader-rules.xml b/jqassistant/serviceloader-rules.xml
new file mode 100644
index 0000000..808b7b2
--- /dev/null
+++ b/jqassistant/serviceloader-rules.xml
@@ -0,0 +1,53 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF 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.
+-->
+<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">
+
+    <concept id="serviceLoader:SPI">
+        <description>Labels all .spi packages as "SPI".</description>
+        <cypher><![CDATA[
+			MATCH
+				(package:Package)-->(type:Type:Java)
+
+			WHERE
+				package.name = "spi"
+
+			SET
+				type:SPI
+
+			RETURN
+				type
+        ]]></cypher>
+    </concept>
+
+	<constraint id="serviceLoader:correctServiceLoaderNaming">
+		<requiresConcept refId="serviceLoader:SPI"/>
+		<description>A service provider must be contained in a service provider configuration
file with the full qualified binary name of the service's type.</description>
+		<cypher><![CDATA[
+			MATCH
+				(sl:ServiceLoader)-[:CONTAINS]->(impl:Type)-[:IMPLEMENTS]->(spi:SPI)
+
+			WHERE
+				NOT split(sl.fileName, '/')[-1] = spi.fqn
+
+			RETURN
+				impl.fqn AS impl, spi.fqn as spi, sl.fileName AS spiConfig
+        ]]></cypher>
+	</constraint>
+
+</jqa:jqassistant-rules>
\ No newline at end of file


Mime
View raw message