http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/LICENSE ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/LICENSE b/maven-pladoc-plugin/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/maven-pladoc-plugin/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.api/LICENSE ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.api/LICENSE b/maven-pladoc-plugin/maven-pladoc-plugin.api/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.api/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.api/pom.xml ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.api/pom.xml b/maven-pladoc-plugin/maven-pladoc-plugin.api/pom.xml new file mode 100644 index 0000000..1835205 --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.api/pom.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?><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/maven-v4_0_0.xsd"> +<!-- + + 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. + +--> + + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>maven-pladoc-plugin</artifactId> + <groupId>org.apache.clerezza</groupId> + <version>0.4-SNAPSHOT</version> + </parent> + <groupId>org.apache.clerezza</groupId> + <artifactId>maven-pladoc-plugin.api</artifactId> + <packaging>jar</packaging> + <version>0.4-SNAPSHOT</version> + <name>Clerezza - Maven PlaDoc Plugin API</name> + <description>API exposed from the service to the host application</description> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>platform.content</artifactId> + <!-- <scope>provided</scope> --> + <version>0.14-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>rdf.simple.storage</artifactId> + <!-- <scope>provided</scope> --> + <version>0.8-SNAPSHOT</version> + </dependency> + </dependencies> + <reporting> + <excludeDefaults>true</excludeDefaults> + <plugins/> + </reporting> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.api/src/main/java/org/apache/clerezza/pladocplugin/api/GeneratorService.java ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.api/src/main/java/org/apache/clerezza/pladocplugin/api/GeneratorService.java b/maven-pladoc-plugin/maven-pladoc-plugin.api/src/main/java/org/apache/clerezza/pladocplugin/api/GeneratorService.java new file mode 100644 index 0000000..307d3b9 --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.api/src/main/java/org/apache/clerezza/pladocplugin/api/GeneratorService.java @@ -0,0 +1,31 @@ +/* + * 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. + */ +package org.apache.clerezza.pladocplugin.api; + +import java.io.File; + +/** + * + * @author reto + */ + +public interface GeneratorService { + public void process(File ntFile, File outputDir); + +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.core/LICENSE ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.core/LICENSE b/maven-pladoc-plugin/maven-pladoc-plugin.core/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.core/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.core/pom.xml ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.core/pom.xml b/maven-pladoc-plugin/maven-pladoc-plugin.core/pom.xml new file mode 100644 index 0000000..ba57106 --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.core/pom.xml @@ -0,0 +1,152 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?><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/maven-v4_0_0.xsd"> +<!-- + + 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. + +--> + + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>maven-pladoc-plugin</artifactId> + <groupId>org.apache.clerezza</groupId> + <version>0.4-SNAPSHOT</version> + </parent> + <groupId>org.apache.clerezza</groupId> + <artifactId>maven-pladoc-plugin.core</artifactId> + <packaging>maven-plugin</packaging> + <version>0.4-SNAPSHOT</version> + <name>Clerezza - Maven PlaDoc Plugin Core</name> + <dependencies> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.framework</artifactId> + <version>2.0.1</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>maven-pladoc-plugin.api</artifactId> + <version>0.4-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>maven-pladoc-plugin.service</artifactId> + <version>0.4-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.reporting</groupId> + <artifactId>maven-reporting-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.reporting</groupId> + <artifactId>maven-reporting-impl</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.scr</artifactId> + <version>1.0.8</version> + <exclusions> + <exclusion> + <artifactId>org.osgi.core</artifactId> + <groupId>org.apache.felix</groupId> + </exclusion> + <exclusion> + <artifactId>org.osgi.foundation</artifactId> + <groupId>org.apache.felix</groupId> + </exclusion> + <exclusion> + <artifactId>org.osgi.compendium</artifactId> + <groupId>org.apache.felix</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>platform.content</artifactId> + <!--<scope>provided</scope> --> + <version>0.14-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>rdf.simple.storage</artifactId> + <!-- <scope>provided</scope> --> + <version>0.8-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>rdf.jena.parser</artifactId> + <!-- <scope>provided</scope> --> + <version>0.12-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza.ext</groupId> + <artifactId>org.apache.jena</artifactId> + <!-- <scope>provided</scope> --> + <exclusions> + <exclusion> + <artifactId>xercesImpl</artifactId> + <groupId>xerces</groupId> + </exclusion> + </exclusions> + <version>0.7-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.clerezza.ext</groupId> + <artifactId>com.ibm.icu</artifactId> + <!-- <scope>provided</scope> --> + <version>0.6-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.ops4j.pax.logging</groupId> + <artifactId>pax-logging-api</artifactId> + <version>1.4</version> + </dependency> + <dependency> + <groupId>org.ops4j.pax.logging</groupId> + <artifactId>pax-logging-service</artifactId> + <version>1.4</version> + <exclusions> + <exclusion> + <artifactId>jmxri</artifactId> + <groupId>com.sun.jmx</groupId> + </exclusion> + <exclusion> + <artifactId>jmxtools</artifactId> + <groupId>com.sun.jdmk</groupId> + </exclusion> + </exclusions> + </dependency> + </dependencies> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.core/src/main/java/org/apache/clerezza/pladocplugin/PladocReportMojo.java ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.core/src/main/java/org/apache/clerezza/pladocplugin/PladocReportMojo.java b/maven-pladoc-plugin/maven-pladoc-plugin.core/src/main/java/org/apache/clerezza/pladocplugin/PladocReportMojo.java new file mode 100644 index 0000000..65e9a2c --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.core/src/main/java/org/apache/clerezza/pladocplugin/PladocReportMojo.java @@ -0,0 +1,268 @@ +/* + * 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. + */ +package org.apache.clerezza.pladocplugin; + +import java.util.Locale; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.reporting.AbstractMavenReport; +import org.apache.maven.reporting.MavenReportException; +import org.codehaus.doxia.sink.Sink; +import org.codehaus.doxia.site.renderer.SiteRenderer; +import java.io.File; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import java.util.Set; +import java.util.logging.Handler; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.felix.framework.Felix; +import org.apache.felix.framework.util.StringMap; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.logging.Log; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.apache.clerezza.pladocplugin.api.*; + +import org.apache.maven.plugin.MojoExecution; +import org.codehaus.plexus.component.repository.ComponentDependency; +import org.osgi.util.tracker.ServiceTracker; + +/** + * Generates java source code out of an ontology described in various RDF + * formats. The generated java file contains constants for rdf classes and + * properties described by the ontology. + * + * + * @goal pladoc-report + * + * @phase site + */ +public class PladocReportMojo extends AbstractMavenReport { + + + /** + * Location where generated html will be created. + * + * @parameter expression="${project.reporting.outputDirectory}" + */ + private String outputDirectory; + /** + * Doxia Site Renderer + * + * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}" + * @required @readonly + */ + private SiteRenderer siteRenderer; + /** + * Maven Project + * + * @parameter expression="${project}" + * @required @readonly + */ + private MavenProject project; + + /** + * Path to the root directory + * + * @parameter expression="${basedir}" + */ + private String baseDirName; + /** + * Path to the root directory + * + * @parameter expression="${mojoExecution}" + */ + private MojoExecution mojoExecution; + private Log log; + private String RELATIVE_PLADOC_DIR = "pladoc/"; + + @Override + protected void executeReport(Locale arg0) throws MavenReportException { + try { + Map configMap = new StringMap(false); + // Configure the Felix instance to be embedded. + configMap.put("org.osgi.framework.system.packages.extra", + "org.apache.clerezza.pladocplugin.api"); + File tempFile = File.createTempFile("felix", "cache"); + tempFile.delete(); + tempFile.mkdir(); + tempFile.deleteOnExit(); + configMap.put("org.osgi.framework.storage", + tempFile.getAbsolutePath()); + Felix felix = new Felix(configMap); + + felix.start(); + final BundleContext bundleContext = felix.getBundleContext(); + + Set<Bundle> installedBundles = new HashSet<Bundle>(); + for (Object dep : mojoExecution.getMojoDescriptor().getPluginDescriptor().getIntroducedDependencyArtifacts()) { + Artifact artifact = (Artifact) dep; + log.info("Dep-artifact " + artifact + " scope " + artifact.getScope()); + } + for (Object dep : mojoExecution.getMojoDescriptor().getPluginDescriptor().getDependencies()) { + log.info("Dependency " + dep + " class " + dep.getClass()); + ComponentDependency dependency = (ComponentDependency) dep; + log.info("type " + dependency.getType()); + } + log.info("components"); + for (Object dep : mojoExecution.getMojoDescriptor().getPluginDescriptor().getArtifacts()) { + Artifact artifact = (Artifact) dep; + log.info("Articatf " + artifact + " scope " + artifact.getScope()); + if (artifact.getType().equals("jar")) { + try { + String fileUriBase = "file://"; + if (File.separator.equals("\\")) { + fileUriBase = "file:///"; + } + Bundle bundle = bundleContext.installBundle(fileUriBase + artifact.getFile().getAbsolutePath()); + installedBundles.add(bundle); + if (artifact.getFile().getAbsolutePath().indexOf("triax") > 0) { + bundle.start(); + } + log.debug("Installed: " + bundle); + } catch (Exception e) { + log.debug("Exception installing " + artifact.getFile().getAbsolutePath()); + } + } + } + for (Bundle bundle : installedBundles) { + try { + log.debug("Trying to activate: " + bundle); + bundle.start(); + } catch (Exception e) { + log.warn("Exception activating " + bundle + ": " + e); + } + } + + log.info("Framework activates with following bundles:"); + for (Bundle bundle : bundleContext.getBundles()) { + log.info(bundle.getLocation() + ": " + getBundleStateDescription(bundle.getState())); + } + ServiceTracker tracker1 = new ServiceTracker(bundleContext, + Handler.class.getName(), null); + tracker1.open(); + System.out.println("Handler: " + tracker1.waitForService(15000)); + ServiceTracker tracker = new ServiceTracker(bundleContext, + GeneratorService.class.getName(), null); + tracker.open(); + Object rendererFactoryObj = tracker.waitForService(15000); + + log.debug(GeneratorService.class + " service : " + rendererFactoryObj); + log.debug(GeneratorService.class + " service : " + rendererFactoryObj.getClass()); + GeneratorService generatorService = (GeneratorService) rendererFactoryObj; + final File baseDir = new File(baseDirName); + File documentationFile = new File(baseDir, + "src/main/resources/META-INF/documentation.nt"); + log.debug("using documentation file: " + documentationFile); + File targetDir; + if (documentationFile.exists()) { + targetDir = new File(baseDir, "target/site/" + RELATIVE_PLADOC_DIR); + targetDir.mkdirs(); + generatorService.process(documentationFile, targetDir); + } else { + log.warn("IMPORTANT: No documentation found in this module!"); + return; + } + + Sink sink = getSink(); + sink.head(); + sink.title(); + sink.text("Pladoc Documentation"); + sink.title_(); + sink.head_(); + sink.body(); + sink.section1(); + sink.sectionTitle1(); + sink.text("Pladoc Documentation"); + sink.sectionTitle1_(); + sink.lineBreak(); + sink.lineBreak(); + sink.text("The Pladoc documentation comprises: "); + sink.lineBreak(); + for (String fileName : targetDir.list()) { + sink.link(RELATIVE_PLADOC_DIR + fileName); + sink.text(fileName); + sink.link_(); + sink.lineBreak(); + } + + sink.section1_(); + sink.body_(); + sink.flush(); + sink.close(); + } catch (Exception ex) { + throw new MavenReportException("Exception creating PlaDoc ", ex); + } + } + + @Override + public void setLog(Log log) { + this.log = log; + super.setLog(log); + } + + private String getBundleStateDescription(int state) { + switch (state) { + case 2: + return "Installed"; + case 4: + return "Resolved"; + case 8: + return "Starting"; + case 16: + return "Stopping"; + case 32: + return "Active"; + } + return "Unkown"; + } + + @Override + protected SiteRenderer getSiteRenderer() { + return siteRenderer; + } + + @Override + protected String getOutputDirectory() { + return outputDirectory; + + } + + @Override + protected MavenProject getProject() { + return project; + } + + @Override + public String getOutputName() { + return "pladoc-report"; + } + + @Override + public String getName(Locale locale) { + return "PlaDoc Report"; + } + + @Override + public String getDescription(Locale locale) { + return "Platform documentation"; + } +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.service/LICENSE ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.service/LICENSE b/maven-pladoc-plugin/maven-pladoc-plugin.service/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.service/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.service/pom.xml ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.service/pom.xml b/maven-pladoc-plugin/maven-pladoc-plugin.service/pom.xml new file mode 100644 index 0000000..ea19817 --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.service/pom.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?><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/maven-v4_0_0.xsd"> +<!-- + + 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. + +--> + + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>maven-pladoc-plugin</artifactId> + <groupId>org.apache.clerezza</groupId> + <version>0.4-SNAPSHOT</version> + </parent> + <groupId>org.apache.clerezza</groupId> + <artifactId>maven-pladoc-plugin.service</artifactId> + <packaging>bundle</packaging> + <version>0.4-SNAPSHOT</version> + <name>Clerezza - Maven PlaDoc Plugin Service</name> + <dependencies> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>maven-pladoc-plugin.api</artifactId> + <version>0.4-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>rdf.utils</artifactId> + <!-- <scope>provided</scope> --> + <version>0.14-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>jsr311-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.clerezza</groupId> + <artifactId>platform.typerendering.core</artifactId> + <version>0.3-SNAPSHOT</version> + </dependency> + </dependencies> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/maven-pladoc-plugin.service/src/main/java/org/apache/clerezza/pladocplugin/service/GeneratorServiceImpl.java ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/maven-pladoc-plugin.service/src/main/java/org/apache/clerezza/pladocplugin/service/GeneratorServiceImpl.java b/maven-pladoc-plugin/maven-pladoc-plugin.service/src/main/java/org/apache/clerezza/pladocplugin/service/GeneratorServiceImpl.java new file mode 100644 index 0000000..1b0f17d --- /dev/null +++ b/maven-pladoc-plugin/maven-pladoc-plugin.service/src/main/java/org/apache/clerezza/pladocplugin/service/GeneratorServiceImpl.java @@ -0,0 +1,139 @@ +/* + * 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. + */ +package org.apache.clerezza.pladocplugin.service; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import javax.ws.rs.core.MediaType; +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Reference; +import org.apache.felix.scr.annotations.Service; +import org.osgi.service.component.ComponentContext; +import org.apache.clerezza.pladocplugin.api.GeneratorService; +import org.apache.clerezza.platform.typerendering.Renderer; +import org.apache.clerezza.platform.typerendering.RendererFactory; +import org.apache.clerezza.rdf.core.Graph; +import org.apache.clerezza.rdf.core.NonLiteral; +import org.apache.clerezza.rdf.core.Triple; +import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.rdf.core.serializedform.Parser; +import org.apache.clerezza.rdf.core.serializedform.SupportedFormat; +import org.apache.clerezza.rdf.ontologies.DISCOBITS; +import org.apache.clerezza.rdf.ontologies.RDF; +import org.apache.clerezza.rdf.utils.GraphNode; + + +/** + * + * @author reto + */ +@Component(immediate = true) +@Service(GeneratorService.class) +public class GeneratorServiceImpl implements GeneratorService { + + @Reference + Parser parser; + @Reference + RendererFactory rendererFactory; + /** + * this is just to activate Triaxrs in order for MediaType to work + */ + //TODO find the wink way to ensure this + /*@Reference + Handler triaxrs;*/ + + protected void activate(ComponentContext componentContext) { + System.out.println("activating generator service"); + } + + @Override + public void process(File ntFile, File outputDir) { + + try { + System.out.println("attempt to load"); + Class clazz = Class.forName("javax.ws.rs.core.MediaType"); + System.out.println("clazz : " + clazz); + System.out.println("clazz.getMethods().length : " + clazz.getMethods().length); + //System.out.println("clazz : "+clazz.n); + System.out.println("processing " + ntFile); + InputStream in = null; + Graph documentationGraph = null; + try { + in = new FileInputStream(ntFile); + documentationGraph = parser.parse(in, SupportedFormat.N_TRIPLE); + } finally { + in.close(); + } + process(documentationGraph, outputDir); + } catch (Exception ex) { + ex.printStackTrace(System.out); + throw new RuntimeException(ex); + } + + } + + private String generateFileNameFromUri(UriRef uriRef) { + String uriString = uriRef.getUnicodeString(); + if (uriString.endsWith("/")) { + return "index"; + } + String lastSection = uriString.substring(uriString.lastIndexOf('/')); + return lastSection; + } + + private void process(Graph documentationGraph, File outputDir) throws IOException { + Set<NonLiteral> docRoots = new HashSet<NonLiteral>(); + Iterator<Triple> titledContentTypeTriples = + documentationGraph.filter(null, RDF.type, DISCOBITS.TitledContent); + while (titledContentTypeTriples.hasNext()) { + NonLiteral titleContent = titledContentTypeTriples.next().getSubject(); + if (!documentationGraph.filter(null, DISCOBITS.holds, titleContent).hasNext()) { + docRoots.add(titleContent); + System.out.println("doc root: " + titleContent); + } + } + for (NonLiteral docRoot : docRoots) { + String fileName = generateFileNameFromUri((UriRef) docRoot) + ".html"; + File outFile = new File(outputDir, fileName); + createFile(docRoot, documentationGraph, outFile); + } + } + + private void createFile(NonLiteral docRoot, Graph documentationGraph, + File outFile) throws IOException { + GraphNode docRootNode = new GraphNode(docRoot, documentationGraph); + Renderer renderer = rendererFactory.createRenderer(docRootNode, null, + Collections.singletonList(MediaType.APPLICATION_XHTML_XML_TYPE)); + FileOutputStream out = new FileOutputStream(outFile); + try { + System.out.println("writing " + outFile); + renderer.render(docRootNode, docRootNode, null, null, null, null, new HashMap<String, Object>(), out); + } finally { + out.close(); + } + } +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/maven-pladoc-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/maven-pladoc-plugin/pom.xml b/maven-pladoc-plugin/pom.xml new file mode 100644 index 0000000..8502019 --- /dev/null +++ b/maven-pladoc-plugin/pom.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?><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/maven-v4_0_0.xsd"> +<!-- + + 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. + +--> + + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.clerezza</groupId> + <artifactId>clerezza</artifactId> + <version>0.5-SNAPSHOT</version> + <relativePath>../parent</relativePath> + </parent> + <groupId>org.apache.clerezza</groupId> + <artifactId>maven-pladoc-plugin</artifactId> + <packaging>pom</packaging> + <version>0.4-SNAPSHOT</version> + <name>Clerezza - Maven PlaDoc Plugin</name> + <description>The maven plugin starts an OSGi container and access a service provided by the OSGi BUndle in Service</description> + <modules> + <module>maven-pladoc-plugin.api</module> + <module>maven-pladoc-plugin.service</module> + <module>maven-pladoc-plugin.core</module> + </modules> +</project> \ No newline at end of file
