http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation.viewer/pom.xml ---------------------------------------------------------------------- diff --git a/platform.documentation.viewer/pom.xml b/platform.documentation.viewer/pom.xml deleted file mode 100644 index 1d9be7c..0000000 --- a/platform.documentation.viewer/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?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</version> - <relativePath>../parent</relativePath> - </parent> - <groupId>org.apache.clerezza</groupId> - <artifactId>platform.documentation.viewer</artifactId> - <version>1.0.0-SNAPSHOT</version> - <packaging>bundle</packaging> - - <name>Clerezza - Platform Documentation Viewer</name> - <description>Presents the documentation of the Clerezza Platform - </description> - <dependencies> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.clerezza</groupId> - <artifactId>rdf.utils</artifactId> - <version>0.14</version> - </dependency> - <dependency> - <groupId>org.apache.clerezza</groupId> - <artifactId>platform.documentation</artifactId> - <version>0.4</version> - </dependency> - <dependency> - <groupId>org.apache.clerezza</groupId> - <artifactId>jaxrs.utils</artifactId> - <version>0.9</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation.viewer/src/main/java/org/apache/clerezza/platform/documentation/viewer/DocumentationViewer.java ---------------------------------------------------------------------- diff --git a/platform.documentation.viewer/src/main/java/org/apache/clerezza/platform/documentation/viewer/DocumentationViewer.java b/platform.documentation.viewer/src/main/java/org/apache/clerezza/platform/documentation/viewer/DocumentationViewer.java deleted file mode 100644 index 32ad8d7..0000000 --- a/platform.documentation.viewer/src/main/java/org/apache/clerezza/platform/documentation/viewer/DocumentationViewer.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * 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.platform.documentation.viewer; - -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Stack; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; -import org.apache.clerezza.jaxrs.utils.TrailingSlash; -import org.apache.clerezza.platform.documentation.DocumentationProvider; -import org.apache.clerezza.rdf.core.BNode; -import org.apache.clerezza.rdf.core.Graph; -import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.access.TcManager; -import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; -import org.apache.clerezza.rdf.core.impl.SimpleMGraph; -import org.apache.clerezza.rdf.core.impl.TripleImpl; -import org.apache.clerezza.rdf.ontologies.DISCOBITS; -import org.apache.clerezza.rdf.ontologies.RDF; -import org.apache.clerezza.rdf.ontologies.DOCUMENTATION; -import org.apache.clerezza.rdf.utils.GraphNode; -import org.apache.clerezza.rdf.utils.UnionMGraph; - -/** - * - * The documentation viewer provides a webpage that shows the available - * documentation. - * - * @scr.component - * @scr.service interface="java.lang.Object" - * @scr.property name="javax.ws.rs" type="Boolean" value="true" - * - * @author mir - */ -@Path("/documentation") -public class DocumentationViewer { - - /** - * @scr.reference - */ - private TcManager tcManager; - - /** - * Redirects to the overview page - * - * @return {@link Response} - * - */ - @GET - public GraphNode documentationPage(@Context UriInfo uriInfo) { - TrailingSlash.enforcePresent(uriInfo); - Graph documentations = tcManager.getGraph( - DocumentationProvider.DOCUMENTATION_GRAPH_URI); - Collection<DocumentationItem> docItems = getDocItems(documentations); - List<DocumentationItem> sortedDocItems = sortDocItems(docItems); - MGraph mGraph = new SimpleMGraph(); - BNode orderedContent = createOrderedContent(sortedDocItems, mGraph); - BNode titledContent = createTitledContent(orderedContent, mGraph); - MGraph resultGraph = new UnionMGraph(mGraph, documentations); - GraphNode resultNode = new GraphNode(titledContent, resultGraph); - return resultNode; - } - - private Collection<DocumentationItem> getDocItems(Graph documentations) { - Iterator<Triple> docs = documentations.filter(null, - DOCUMENTATION.documentation, null); - - Map<UriRef,DocumentationItem> uri2docItemObj = - new HashMap<UriRef,DocumentationItem>(); - - while (docs.hasNext()) { - Triple docc = docs.next(); - UriRef docItem = (UriRef) docc.getObject(); - Iterator<Triple> afterDocItemsIter = documentations.filter(docItem, - DOCUMENTATION.after, null); - Set<UriRef> afterDocItems = new HashSet<UriRef>(); - while (afterDocItemsIter.hasNext()) { - afterDocItems.add((UriRef) afterDocItemsIter.next().getObject()); - } - DocumentationItem docItemObj = new DocumentationItem( - docItem, afterDocItems, uri2docItemObj); - uri2docItemObj.put(docItem, docItemObj); - } - return uri2docItemObj.values(); - } - - protected List<DocumentationItem> sortDocItems( - Collection<DocumentationItem> docItems) { - List<DocumentationItem> result = - new ArrayList<DocumentationItem>(); - Iterator<DocumentationItem> items = docItems.iterator(); - - OUTER: while (items.hasNext()) { - DocumentationItem item = items.next(); - for (int i = 0; i < result.size(); i++ ) { - if (result.get(i).isAfer(item.documentationItem)) { - result.add(i, item); - continue OUTER; - } - } - result.add(item); - } - return result; - } - - private BNode createOrderedContent(List<DocumentationItem> sortedDocItems, - MGraph mGraph) { - BNode orderedContent = new BNode(); - mGraph.add(new TripleImpl(orderedContent, RDF.type, DISCOBITS.OrderedContent)); - Integer pos = 0; - Iterator<DocumentationItem> docItemObjsIter = sortedDocItems.iterator(); - while (docItemObjsIter.hasNext()) { - DocumentationItem docItemObj = docItemObjsIter.next(); - BNode containedDoc = new BNode(); - mGraph.add(new TripleImpl(orderedContent, DISCOBITS.contains, - containedDoc)); - mGraph.add(new TripleImpl(containedDoc, DISCOBITS.pos, - new PlainLiteralImpl(pos.toString()))); - mGraph.add(new TripleImpl(containedDoc, DISCOBITS.holds, - docItemObj.documentationItem)); - pos++; - } - return orderedContent; - } - - private BNode createTitledContent(BNode orderedContent, MGraph mGraph) { - BNode titledContent = new BNode(); - mGraph.add(new TripleImpl(titledContent, RDF.type, DISCOBITS.TitledContent)); - BNode title = new BNode(); - mGraph.add(new TripleImpl(title, DISCOBITS.pos, new PlainLiteralImpl("0"))); - BNode titleXml = new BNode(); - mGraph.add(new TripleImpl(titleXml, RDF.type, DISCOBITS.XHTMLInfoDiscoBit)); - mGraph.add(new TripleImpl(titleXml, DISCOBITS.infoBit, - LiteralFactory.getInstance().createTypedLiteral("Documentation"))); - mGraph.add(new TripleImpl(title, DISCOBITS.holds, titleXml)); - mGraph.add(new TripleImpl(title, RDF.type, DISCOBITS.Entry)); - mGraph.add(new TripleImpl(titledContent, DISCOBITS.contains, title)); - BNode content = new BNode(); - mGraph.add(new TripleImpl(content, DISCOBITS.pos, new PlainLiteralImpl("1"))); - mGraph.add(new TripleImpl(content, DISCOBITS.holds, orderedContent)); - mGraph.add(new TripleImpl(content, RDF.type, DISCOBITS.Entry)); - mGraph.add(new TripleImpl(titledContent, DISCOBITS.contains, content)); - return titledContent; - } - - protected static class DocumentationItem { - - private UriRef documentationItem; - private Set<UriRef> afterDocItems; - - private boolean transitiveAfterDocItemsAdded = false; - private Map<UriRef, DocumentationItem> uri2docItemObj; - - DocumentationItem(UriRef doumentationItem, Set<UriRef> explicitAfterDocItems, - Map<UriRef, DocumentationItem> uri2docItemObj) { - this.documentationItem = doumentationItem; - this.afterDocItems = explicitAfterDocItems; - this.uri2docItemObj = uri2docItemObj; - } - - public boolean isAfer(UriRef docItem) { - return getAfterDocItems().contains(docItem); - } - - private Set<UriRef> getAfterDocItems() { - Stack<DocumentationItem> stack = new Stack<DocumentationItem>(); - stack.add(this); - return getAfterDocItems(stack); - } - - private Set<UriRef> getAfterDocItems(Stack<DocumentationItem> stack) { - if (!transitiveAfterDocItemsAdded) { - Iterator<UriRef> afterDocUrisIter = afterDocItems.iterator(); - while (afterDocUrisIter.hasNext()) { - UriRef uriRef = afterDocUrisIter.next(); - DocumentationItem docItem = uri2docItemObj.get(uriRef); - if (stack.contains(docItem)) { - throw new RuntimeException("Documentation: cycle detected!\n" - + stack.toString()); - } - stack.add(docItem); - afterDocItems.addAll(docItem.getAfterDocItems(stack)); - - } - transitiveAfterDocItemsAdded = true; - } - return afterDocItems; - } - - @Override - public String toString() { - StringWriter writer = new StringWriter(); - writer.append("["); - writer.append(documentationItem.getUnicodeString()); - writer.append(" is after ("); - Iterator<UriRef> afterDocs = afterDocItems.iterator(); - while (afterDocs.hasNext()) { - UriRef uriRef = afterDocs.next(); - writer.append(uriRef.getUnicodeString()); - if (afterDocs.hasNext()) { - writer.append(","); - } - } - writer.append(")]"); - return writer.toString(); - } - } -} http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation.viewer/src/main/resources/META-INF/documentation.nt ---------------------------------------------------------------------- diff --git a/platform.documentation.viewer/src/main/resources/META-INF/documentation.nt b/platform.documentation.viewer/src/main/resources/META-INF/documentation.nt deleted file mode 100644 index 1a3a6f4..0000000 --- a/platform.documentation.viewer/src/main/resources/META-INF/documentation.nt +++ /dev/null @@ -1,26 +0,0 @@ -<bundle:///intro-content-el/0> <http://discobits.org/ontology#infoBit> "The documentation viewer provides access to the documentation (provided by the different modules) at <a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"/documentation\">/documentation</a>."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro-content-el/1> <http://discobits.org/ontology#infoBit> "The documentation is ordered so that the after properties http://clerezza.org/2009/08/documentation#after are satisfied. When the documentation is written with the discobits editor such a property is typically set by adding something like the folleowing in the RDF editing mode to the xml element representing the resource: <after xmlns=\"http://clerezza.org/2009/08/documentation#\" rdf:resource=\"bundle://org.apache.clerezza.platform.content/discobits-editor\"/ />"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro-content> <http://discobits.org/ontology#contains> _:1e27a3b4f21eada7ec61fd7c55f2bd221 . -<bundle:///intro-content> <http://discobits.org/ontology#contains> _:86e4309edd82a6d415338546caff2d551 . -<bundle:///intro-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> . -<bundle:///intro-title> <http://discobits.org/ontology#infoBit> "Documentation Viewer"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro> <http://clerezza.org/2009/08/documentation#after> <bundle://org.apache.clerezza.platform.content/discobits-editor> . -<bundle:///intro> <http://clerezza.org/2009/08/documentation#after> <bundle://org.apache.clerezza.platform.documentation/intro> . -<bundle:///intro> <http://discobits.org/ontology#contains> _:cc06f094ff0d735a332291b856b0d4ae1 . -<bundle:///intro> <http://discobits.org/ontology#contains> _:ccd6d577f99d82c53d5323fdbe4b6ba31 . -<bundle:///intro> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> . -_:1e27a3b4f21eada7ec61fd7c55f2bd221 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/0> . -_:1e27a3b4f21eada7ec61fd7c55f2bd221 <http://discobits.org/ontology#pos> "0" . -_:1e27a3b4f21eada7ec61fd7c55f2bd221 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:86e4309edd82a6d415338546caff2d551 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/1> . -_:86e4309edd82a6d415338546caff2d551 <http://discobits.org/ontology#pos> "1" . -_:86e4309edd82a6d415338546caff2d551 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:cc06f094ff0d735a332291b856b0d4ae1 <http://discobits.org/ontology#holds> <bundle:///intro-content> . -_:cc06f094ff0d735a332291b856b0d4ae1 <http://discobits.org/ontology#pos> "1" . -_:cc06f094ff0d735a332291b856b0d4ae1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:ccd6d577f99d82c53d5323fdbe4b6ba31 <http://discobits.org/ontology#holds> <bundle:///intro-title> . -_:ccd6d577f99d82c53d5323fdbe4b6ba31 <http://discobits.org/ontology#pos> "0" . -_:ccd6d577f99d82c53d5323fdbe4b6ba31 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation.viewer/src/test/java/org/apache/clerezza/platform/documentation/viewer/SortTest.java ---------------------------------------------------------------------- diff --git a/platform.documentation.viewer/src/test/java/org/apache/clerezza/platform/documentation/viewer/SortTest.java b/platform.documentation.viewer/src/test/java/org/apache/clerezza/platform/documentation/viewer/SortTest.java deleted file mode 100644 index a980223..0000000 --- a/platform.documentation.viewer/src/test/java/org/apache/clerezza/platform/documentation/viewer/SortTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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.platform.documentation.viewer; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.junit.Assert; -import org.junit.Test; -import org.apache.clerezza.rdf.core.UriRef; - -/** - * - * @author mir - */ -public class SortTest { - - @Test - public void sortTest() { - DocumentationViewer docViewer = new DocumentationViewer(); - - Map<UriRef,DocumentationViewer.DocumentationItem> uri2docItemObj = - new HashMap<UriRef,DocumentationViewer.DocumentationItem>(); - UriRef ref1 = new UriRef("ref1"); - UriRef ref2 = new UriRef("ref2"); - UriRef ref3 = new UriRef("ref3"); - UriRef ref4 = new UriRef("ref4"); - UriRef ref5 = new UriRef("ref5"); - - Set<UriRef> set1 = new HashSet<UriRef>(); - DocumentationViewer.DocumentationItem a = - new DocumentationViewer.DocumentationItem(ref1, set1, uri2docItemObj); - - Set<UriRef> set2 = new HashSet<UriRef>(); - set2.add(ref1); - DocumentationViewer.DocumentationItem b = - new DocumentationViewer.DocumentationItem(ref2, set2, uri2docItemObj); - - Set<UriRef> set3 = new HashSet<UriRef>(); - set3.add(ref2); - DocumentationViewer.DocumentationItem c = - new DocumentationViewer.DocumentationItem(ref3, set3, uri2docItemObj); - - Set<UriRef> set4 = new HashSet<UriRef>(); - set4.add(ref3); - DocumentationViewer.DocumentationItem d = - new DocumentationViewer.DocumentationItem(ref4, set4, uri2docItemObj); - - Set<UriRef> set5 = new HashSet<UriRef>(); - set5.add(ref4); - DocumentationViewer.DocumentationItem e = - new DocumentationViewer.DocumentationItem(ref5, set5, uri2docItemObj); - - uri2docItemObj.put(ref2, b); - uri2docItemObj.put(ref4, d); - uri2docItemObj.put(ref1, a); - uri2docItemObj.put(ref3, c); - uri2docItemObj.put(ref5, e); - - List<DocumentationViewer.DocumentationItem> orderedList = - docViewer.sortDocItems(uri2docItemObj.values()); - - Iterator<DocumentationViewer.DocumentationItem> iter = - orderedList.iterator(); - - Object[] expecteds = - new DocumentationViewer.DocumentationItem[5]; - - expecteds[0] = a; - expecteds[1] = b; - expecteds[2] = c; - expecteds[3] = d; - expecteds[4] = e; - - Assert.assertArrayEquals(expecteds, orderedList.toArray()); - } - - @Test(expected=RuntimeException.class) - public void cycleTest() { - DocumentationViewer docViewer = new DocumentationViewer(); - - Map<UriRef,DocumentationViewer.DocumentationItem> uri2docItemObj = - new HashMap<UriRef,DocumentationViewer.DocumentationItem>(); - UriRef ref1 = new UriRef("ref1"); - UriRef ref2 = new UriRef("ref2"); - UriRef ref3 = new UriRef("ref3"); - UriRef ref4 = new UriRef("ref4"); - UriRef ref5 = new UriRef("ref5"); - - Set<UriRef> set1 = new HashSet<UriRef>(); - set1.add(ref5); - DocumentationViewer.DocumentationItem a = - new DocumentationViewer.DocumentationItem(ref1, set1, uri2docItemObj); - - Set<UriRef> set2 = new HashSet<UriRef>(); - set2.add(ref1); - DocumentationViewer.DocumentationItem b = - new DocumentationViewer.DocumentationItem(ref2, set2, uri2docItemObj); - - Set<UriRef> set3 = new HashSet<UriRef>(); - set3.add(ref2); - DocumentationViewer.DocumentationItem c = - new DocumentationViewer.DocumentationItem(ref3, set3, uri2docItemObj); - - Set<UriRef> set4 = new HashSet<UriRef>(); - set4.add(ref3); - DocumentationViewer.DocumentationItem d = - new DocumentationViewer.DocumentationItem(ref4, set4, uri2docItemObj); - - Set<UriRef> set5 = new HashSet<UriRef>(); - set5.add(ref4); - DocumentationViewer.DocumentationItem e = - new DocumentationViewer.DocumentationItem(ref5, set5, uri2docItemObj); - - uri2docItemObj.put(ref2, b); - uri2docItemObj.put(ref4, d); - uri2docItemObj.put(ref1, a); - uri2docItemObj.put(ref3, c); - uri2docItemObj.put(ref5, e); - - List<DocumentationViewer.DocumentationItem> orderedList = - docViewer.sortDocItems(uri2docItemObj.values()); - } -} http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation/LICENSE ---------------------------------------------------------------------- diff --git a/platform.documentation/LICENSE b/platform.documentation/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/platform.documentation/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/af0d99b2/platform.documentation/pom.xml ---------------------------------------------------------------------- diff --git a/platform.documentation/pom.xml b/platform.documentation/pom.xml deleted file mode 100644 index cd4b989..0000000 --- a/platform.documentation/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?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>clerezza</artifactId> - <groupId>org.apache.clerezza</groupId> - <version>0.5</version> - <relativePath>../parent</relativePath> - </parent> - <groupId>org.apache.clerezza</groupId> - <artifactId>platform.documentation</artifactId> - <version>1.0.0-SNAPSHOT</version> - <packaging>bundle</packaging> - <name>Clerezza - Platform Documentation</name> - <description>Manages the documentation of the Clerezza Platform - </description> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - </dependency> - <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.clerezza</groupId> - <artifactId>rdf.utils</artifactId> - <version>0.14</version> - </dependency> - <dependency> - <groupId>org.apache.clerezza</groupId> - <artifactId>platform.graphprovider.content</artifactId> - <version>0.7</version> - </dependency> - <dependency> - <groupId>org.apache.clerezza</groupId> - <artifactId>platform.config</artifactId> - <version>0.4</version> - </dependency> - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.scr.annotations</artifactId> - </dependency> - </dependencies> -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationInContentGraph.java ---------------------------------------------------------------------- diff --git a/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationInContentGraph.java b/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationInContentGraph.java deleted file mode 100644 index ad0ad8a..0000000 --- a/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationInContentGraph.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.platform.documentation; - -import org.osgi.service.component.ComponentContext; -import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider; - -/** - * Registers the documentation graph as addition to the content graph - * - * @scr.component - * - * @author rbn, hasan - */ -public class DocumentationInContentGraph { - - - /** - * we have this dependency to make sure we get started after the documentatinProvider - * - * @scr.reference - */ - private DocumentationProvider documentationProvider; - - /** - * @scr.reference - */ - private ContentGraphProvider cgProvider; - - protected void activate(final ComponentContext componentContext) { - cgProvider.addTemporaryAdditionGraph(DocumentationProvider.DOCUMENTATION_GRAPH_URI); - } - - protected void deactivate(final ComponentContext componentContext) { - cgProvider.removeTemporaryAdditionGraph(DocumentationProvider.DOCUMENTATION_GRAPH_URI); - } - -} http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationProvider.java ---------------------------------------------------------------------- diff --git a/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationProvider.java b/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationProvider.java deleted file mode 100644 index 3923a8b..0000000 --- a/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/DocumentationProvider.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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.platform.documentation; - -import java.io.IOException; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.Service; -import org.apache.felix.scr.annotations.Services; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.BundleListener; -import org.osgi.service.component.ComponentContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.clerezza.platform.config.PlatformConfig; -import org.apache.clerezza.rdf.core.Graph; -import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.NonLiteral; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.TripleCollection; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException; -import org.apache.clerezza.rdf.core.access.EntityUndeletableException; -import org.apache.clerezza.rdf.core.access.NoSuchEntityException; -import org.apache.clerezza.rdf.core.access.WeightedTcProvider; -import org.apache.clerezza.rdf.core.impl.SimpleGraph; -import org.apache.clerezza.rdf.core.impl.SimpleMGraph; -import org.apache.clerezza.rdf.core.impl.TripleImpl; -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.DOCUMENTATION; -import org.apache.clerezza.rdf.ontologies.OSGI; -import org.apache.clerezza.rdf.ontologies.RDF; -import org.apache.clerezza.rdf.utils.UnionMGraph; - -/** - * The DocumentationProvider gathers the documentations of bundles and provides - * a graph containing all documentations. - * It is an implementation of <code>WeightedTcProvider</code> with the default - * weight 30. - * @author mir, hasan - */ -@Component -@Services({ - @Service(WeightedTcProvider.class), - @Service(DocumentationProvider.class)}) -@Property(name="weight", intValue=30) - -public class DocumentationProvider implements WeightedTcProvider, BundleListener { - - private final Logger logger = LoggerFactory.getLogger(getClass()); - - /** - * File path to the file containing the documentation of the bundle - */ - private static final String DOCUMENTATION_FILE = "/META-INF/documentation.nt"; - - @Reference - private PlatformConfig config; - - @Reference - private Parser parser; - - /** - * Contains the map between bundles and their documentation-graph - */ - private Map<Bundle, MGraph> bundle2DocGraphMap = new HashMap<Bundle, MGraph>(); - - /** - * UnionGraph which contains all documenation-graphs of the registered - * bundles - */ - private Graph unitedDocumentations; - - /** - * The URI of the graph containing the documentations - */ - public static final UriRef DOCUMENTATION_GRAPH_URI = - new UriRef("urn:x-localinstance:/documentation.graph"); - - private int weight = 30; - - @Override - public int getWeight() { - return weight; - } - - @Override - public Graph getGraph(UriRef name) throws NoSuchEntityException { - if (name.equals(DOCUMENTATION_GRAPH_URI)) { - return unitedDocumentations; - } - throw new NoSuchEntityException(name); - } - - @Override - public MGraph getMGraph(UriRef name) throws NoSuchEntityException { - throw new NoSuchEntityException(name); - } - - @Override - public TripleCollection getTriples(UriRef name) throws NoSuchEntityException { - return getGraph(name); - } - - @Override - public Set<UriRef> listGraphs() { - return Collections.singleton(DOCUMENTATION_GRAPH_URI); - } - - @Override - public Set<UriRef> listMGraphs() { - return new HashSet<UriRef>(); - } - - @Override - public Set<UriRef> listTripleCollections() { - return Collections.singleton(DOCUMENTATION_GRAPH_URI); - } - - @Override - public MGraph createMGraph(UriRef name) - throws UnsupportedOperationException, EntityAlreadyExistsException { - throw new UnsupportedOperationException("Not supported."); - } - - @Override - public Graph createGraph(UriRef name, TripleCollection triples) - throws UnsupportedOperationException, EntityAlreadyExistsException { - throw new UnsupportedOperationException("Not supported."); - } - - @Override - public void deleteTripleCollection(UriRef name) - throws UnsupportedOperationException, NoSuchEntityException, - EntityUndeletableException { - throw new UnsupportedOperationException("Not supported."); - } - - @Override - public Set<UriRef> getNames(Graph graph) { - final HashSet<UriRef> result = new HashSet<UriRef>(); - if (unitedDocumentations.equals(graph)) { - result.add(DOCUMENTATION_GRAPH_URI); - } - return result; - } - - @Override - public void bundleChanged(BundleEvent event) { - Bundle bundle = event.getBundle(); - switch (event.getType()) { - case BundleEvent.STARTED: - registerDocumentation(bundle); - break; - case BundleEvent.STOPPED: - unregisterDocumentation(bundle); - break; - } - createUnionGraph(); - } - - protected void activate(final ComponentContext componentContext) { - componentContext.getBundleContext().addBundleListener(this); - weight = (Integer) componentContext.getProperties().get("weight"); - registerExistingDocumentations(componentContext); - createUnionGraph(); - } - - protected void deactivate(final ComponentContext componentContext) { - componentContext.getBundleContext().removeBundleListener(this); - } - - private void registerExistingDocumentations(ComponentContext componentContext) { - Bundle[] bundles = componentContext.getBundleContext().getBundles(); - for (Bundle bundle : bundles) { - if (bundle.getState() == Bundle.ACTIVE) { - registerDocumentation(bundle); - } - } - } - - private void registerDocumentation(Bundle bundle) { - URL entry = bundle.getEntry(DOCUMENTATION_FILE); - if (entry == null) { - return; - } - MGraph docMGraph = getDocumentationMGraph(entry, bundle.getSymbolicName()); - addAdditionalTriples(bundle, docMGraph); - bundle2DocGraphMap.put(bundle, docMGraph); - logger.info("Registered documentation of bundle: {}", - bundle.getSymbolicName()); - } - - private MGraph getDocumentationMGraph(URL docUrl, String symbolicName) { - try { - Graph parsedGraph = parser.parse(docUrl.openStream(), - SupportedFormat.N_TRIPLE); - UriRef baseUri = config.getDefaultBaseUri(); - return new SimpleMGraph(new UriMutatorIterator( - parsedGraph.iterator(), baseUri.getUnicodeString(), symbolicName)); - } catch (IOException ex) { - logger.warn("Cannot parse documentation at URL: {}", docUrl); - throw new RuntimeException(ex); - } - } - - /** - * Adds triples that point from the bundle resource to its documentations. - * - * @param bundle - * @param docMGraph - */ - private void addAdditionalTriples(Bundle bundle, MGraph docMGraph) { - UriRef bundleUri = new UriRef(bundle.getLocation()); - Triple triple = new TripleImpl(bundleUri, RDF.type, OSGI.Bundle); - docMGraph.add(triple); - Iterator<Triple> titledContents = docMGraph.filter(null, RDF.type, - DISCOBITS.TitledContent); - Set<Triple> newTriples = new HashSet<Triple>(); - for (Iterator<Triple> it = titledContents; it.hasNext();) { - NonLiteral titledContent = it.next().getSubject(); - if (docMGraph.filter(null, DISCOBITS.holds, titledContent).hasNext()) { - continue; - } - triple = new TripleImpl(bundleUri, DOCUMENTATION.documentation, - titledContent); - newTriples.add(triple); - } - docMGraph.addAll(newTriples); - } - - private void unregisterDocumentation(Bundle bundle) { - bundle2DocGraphMap.remove(bundle); - logger.info("Unregistered documentation of bundle: {}", - bundle.getSymbolicName()); - } - - private void createUnionGraph() { - MGraph[] docGraphs = bundle2DocGraphMap.values(). - toArray(new MGraph[bundle2DocGraphMap.size()]); - if (docGraphs.length > 0) { - unitedDocumentations = new SimpleGraph(new UnionMGraph(docGraphs), true); - } else { - unitedDocumentations = new SimpleGraph(new SimpleMGraph(), true); - } - } -} http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/UriMutatorIterator.java ---------------------------------------------------------------------- diff --git a/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/UriMutatorIterator.java b/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/UriMutatorIterator.java deleted file mode 100644 index c728a76..0000000 --- a/platform.documentation/src/main/java/org/apache/clerezza/platform/documentation/UriMutatorIterator.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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.platform.documentation; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.Iterator; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.clerezza.rdf.core.NonLiteral; -import org.apache.clerezza.rdf.core.Resource; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.TypedLiteral; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.TripleImpl; -import org.apache.clerezza.rdf.core.impl.TypedLiteralImpl; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -/** - * Replaces the <code>BASE_URI_PLACEHOLDER</code> in the <code>UriRef</code>s - * as well as in the XML Literal of the <code>Triple</code>s provided by the - * specified <code>Iterator</code>s with the specified base URI. - * - * @author mir, hasan - */ -public class UriMutatorIterator implements Iterator<Triple> { - - public static final Logger logger = LoggerFactory.getLogger(UriMutatorIterator.class); - - private DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - - public static final UriRef XML_LITERAL = - new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"); - - public static final String BASE_URI_PLACEHOLDER = "bundle://"; - private Iterator<Triple> wrapped; - private String baseUri; - /* - * The symbolic name of the bundle from which the documentation origins. - */ - private String originBundleSymbName; - - UriMutatorIterator(Iterator<Triple> wrapped, String baseUri, - String bundleSymbolicName) { - this.wrapped = wrapped; - this.baseUri = baseUri; - this.originBundleSymbName = bundleSymbolicName; - } - - @Override - public boolean hasNext() { - return wrapped.hasNext(); - } - - @Override - public Triple next() { - Triple triple = wrapped.next(); - - NonLiteral subject = triple.getSubject(); - if (subject instanceof UriRef) { - subject = replacePlaceHolder((UriRef) subject); - } - UriRef predicate = replacePlaceHolder(triple.getPredicate()); - - Resource object = triple.getObject(); - if (object instanceof UriRef) { - object = replacePlaceHolder((UriRef) object); - } else if (object instanceof TypedLiteral) { - TypedLiteral literal = (TypedLiteral) object; - if (literal.getDataType().equals(XML_LITERAL)) { - object = replacePlaceHolderInUrl(literal); - } - } - return new TripleImpl(subject, predicate, object); - } - - @Override - public void remove() { - throw new UnsupportedOperationException("Not supported."); - } - - private UriRef replacePlaceHolder(UriRef uriRef) { - String orig = uriRef.getUnicodeString(); - if (orig.startsWith(BASE_URI_PLACEHOLDER)) { - int nextSlash = orig.indexOf("/", BASE_URI_PLACEHOLDER.length()); - String bundleSymbolicName; - if (nextSlash != BASE_URI_PLACEHOLDER.length()) { - bundleSymbolicName = orig.subSequence( - BASE_URI_PLACEHOLDER.length(), nextSlash).toString(); - } else { - bundleSymbolicName = originBundleSymbName; - } - return new UriRef(baseUri + "bundle-doc/" + bundleSymbolicName + - orig.substring(nextSlash)); - } - return uriRef; - } - - private TypedLiteral replacePlaceHolderInUrl(TypedLiteral xmlLiteral) { - final String tagName = "infoBit"; - final String openingTag = "<" + tagName + ">"; - final String closingTag = "</" + tagName + ">"; - String text = openingTag + xmlLiteral.getLexicalForm() + closingTag; - - InputStream styleSheet = getClass().getResourceAsStream("baseUriTransformation.xsl"); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - StreamSource styleSource = new StreamSource(styleSheet); - try { - Transformer transformer = transformerFactory.newTransformer(styleSource); - - DocumentBuilder builder = factory.newDocumentBuilder(); - Document document = builder.parse(new ByteArrayInputStream(text.getBytes("UTF-8"))); - Source source = new DOMSource(document); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(text.length()); - Result result = new StreamResult(baos); - - transformer.setParameter("baseUri", baseUri); - transformer.setParameter("originBundleSymbolicName", originBundleSymbName); - transformer.transform(source, result); - - String resultedText = baos.toString("UTF-8"); - int startIdx = resultedText.indexOf(openingTag) + openingTag.length(); - int endIdx = resultedText.lastIndexOf(closingTag); - return new TypedLiteralImpl(resultedText.substring(startIdx, endIdx), - XML_LITERAL); - } catch (SAXException se) { - logger.warn("SAXException {} while transforming xml literal: {}", - se.getMessage(), text); - } catch (ParserConfigurationException pce) { - logger.warn("ParserConfigurationException {} while transforming xml literal: {}", - pce.getMessage(), text); - } catch (TransformerException te) { - logger.warn("TransformerException {} while transforming xml literal: {}", - te.getMessage(), text); - } catch (UnsupportedEncodingException uee) { - logger.warn("UnsupportedEncodingException {} while transforming xml literal: {}", - uee.getMessage(), text); - } catch (IOException ioe) { - logger.warn("IOException {} while transforming xml literal: {}", - ioe.getMessage(), text); - } - return xmlLiteral; - } -} http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation/src/main/resources/META-INF/documentation.nt ---------------------------------------------------------------------- diff --git a/platform.documentation/src/main/resources/META-INF/documentation.nt b/platform.documentation/src/main/resources/META-INF/documentation.nt deleted file mode 100644 index 3f473b5..0000000 --- a/platform.documentation/src/main/resources/META-INF/documentation.nt +++ /dev/null @@ -1,47 +0,0 @@ -<bundle:///intro-content-el/0> <http://discobits.org/ontology#infoBit> "Any bundle may provide some user documentation. This documentation is provided by a file named \"documentation.nt\" in the META-INF directory of the bundle-jar. This file can provide multiple documentation resources described using the discobits ontology. The resources have UriRefs starting with \"bundle:///\", this will be replaced with http://<hostname>/bundle-doc/<Bundle-SymbolicName> by the documentation aggregator which provides the graph urn:x-localinstance:/documentation.graph containing the documentation of all installed bundles. To reference a documentation entry from another bundle the bundle-uri can contain a Borundle-SymbolicName after the second slash, e.g. bundle://org.apache.clerezza.platform.content/intro."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro-content-el/1> <http://discobits.org/ontology#infoBit> "By convention any bundle documentation provides a resource named bundle:///intro introducing the functionality of the bundle."^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro-content-el/2-content-el/0> <http://discobits.org/ontology#infoBit> "The recommended way to create and edit the documentation of a bundle is as follows:<ul xmlns=\"http://www.w3.org/1999/xhtml\"><li>Launch clerezza (in the following we assume its running on localhost:8080)</li><li>Install and start the stable n-triples serialization provider (to make the stored files more suitable for version control) by entering on the commmand line: <code>start(\"mvn:org.apache.clerezza/rdf.stable.serializer\")</code></li>\n<li>Install and start the file storage provider(to access local rdf files as named graphs) by entering on the commmand line: <code>start(\"mvn:org.apache.clerezza/rdf.file.storage\")</code><code></code></li><li>If it doesn't exist yet create an empty file src/main/resources/META-INF/documentation.nt in the project to be documented and </li><li>Open http://localhost:8080/tools/editor/, enter the file-uri of the previously created file as Graph and a bundle-uri ( such as bundle:///intro) as resource</li><li>edit, save, ship your bundle</li></ul>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-content-el/2-content-el/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro-content-el/2-content> <http://discobits.org/ontology#contains> _:dca98a68e3413be1e9bb3f4e56f5cc561 . -<bundle:///intro-content-el/2-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> . -<bundle:///intro-content-el/2-title> <http://discobits.org/ontology#infoBit> "Writing Documentation"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-content-el/2-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro-content-el/2> <http://discobits.org/ontology#contains> _:005cab2e8f532d75dbe6021467d5f7191 . -<bundle:///intro-content-el/2> <http://discobits.org/ontology#contains> _:3682407f1c90d02dcf9dbf4e83d964f51 . -<bundle:///intro-content-el/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> . -<bundle:///intro-content> <http://discobits.org/ontology#contains> _:0c33aa960ad81e72549c579dd55074231 . -<bundle:///intro-content> <http://discobits.org/ontology#contains> _:16fd3882eda078006a6b02abb28816da1 . -<bundle:///intro-content> <http://discobits.org/ontology#contains> _:da78c47eff7d6e6f75a17d01572cb4d81 . -<bundle:///intro-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#OrderedContent> . -<bundle:///intro-title> <http://discobits.org/ontology#infoBit> "Platform Documentation Aggregator"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . -<bundle:///intro-title> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> . -<bundle:///intro> <bundle:///nullafter> <bundle://org.apache.clerezza.platform.content/discobits-editor> . -<bundle:///intro> <http://discobits.org/ontology#contains> _:2d0db51a9a2a40d89460edf6544edbad1 . -<bundle:///intro> <http://discobits.org/ontology#contains> _:566a75916142ac411441d067f09a49f71 . -<bundle:///intro> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> . -_:005cab2e8f532d75dbe6021467d5f7191 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/2-content> . -_:005cab2e8f532d75dbe6021467d5f7191 <http://discobits.org/ontology#pos> "1" . -_:005cab2e8f532d75dbe6021467d5f7191 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:0c33aa960ad81e72549c579dd55074231 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/2> . -_:0c33aa960ad81e72549c579dd55074231 <http://discobits.org/ontology#pos> "2" . -_:0c33aa960ad81e72549c579dd55074231 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:16fd3882eda078006a6b02abb28816da1 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/0> . -_:16fd3882eda078006a6b02abb28816da1 <http://discobits.org/ontology#pos> "0" . -_:16fd3882eda078006a6b02abb28816da1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:2d0db51a9a2a40d89460edf6544edbad1 <http://discobits.org/ontology#holds> <bundle:///intro-title> . -_:2d0db51a9a2a40d89460edf6544edbad1 <http://discobits.org/ontology#pos> "0" . -_:2d0db51a9a2a40d89460edf6544edbad1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:3682407f1c90d02dcf9dbf4e83d964f51 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/2-title> . -_:3682407f1c90d02dcf9dbf4e83d964f51 <http://discobits.org/ontology#pos> "0" . -_:3682407f1c90d02dcf9dbf4e83d964f51 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:566a75916142ac411441d067f09a49f71 <http://discobits.org/ontology#holds> <bundle:///intro-content> . -_:566a75916142ac411441d067f09a49f71 <http://discobits.org/ontology#pos> "1" . -_:566a75916142ac411441d067f09a49f71 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:da78c47eff7d6e6f75a17d01572cb4d81 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/1> . -_:da78c47eff7d6e6f75a17d01572cb4d81 <http://discobits.org/ontology#pos> "1" . -_:da78c47eff7d6e6f75a17d01572cb4d81 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . -_:dca98a68e3413be1e9bb3f4e56f5cc561 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/2-content-el/0> . -_:dca98a68e3413be1e9bb3f4e56f5cc561 <http://discobits.org/ontology#pos> "0" . -_:dca98a68e3413be1e9bb3f4e56f5cc561 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> . http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation/src/main/resources/org/apache/clerezza/platform/documentation/baseUriTransformation.xsl ---------------------------------------------------------------------- diff --git a/platform.documentation/src/main/resources/org/apache/clerezza/platform/documentation/baseUriTransformation.xsl b/platform.documentation/src/main/resources/org/apache/clerezza/platform/documentation/baseUriTransformation.xsl deleted file mode 100644 index 9767343..0000000 --- a/platform.documentation/src/main/resources/org/apache/clerezza/platform/documentation/baseUriTransformation.xsl +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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. - ---> - -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> - <xsl:param name="baseUri"/> - <xsl:param name="originBundleSymbolicName"/> - <xsl:template match="@*|node()"> - <xsl:copy> - <xsl:apply-templates select="@*|node()"/> - </xsl:copy> - </xsl:template> - - <xsl:template match="@href[parent::a]"> - <xsl:attribute name="href"> - <xsl:choose> - <xsl:when test="starts-with(.,'bundle:///')"> - <xsl:value-of select="concat($baseUri,'bundle-doc/',$originBundleSymbolicName,substring-after(.,'bundle://'))"/> - </xsl:when> - <xsl:when test="starts-with(.,'bundle://')"> - <xsl:value-of select="concat($baseUri,'bundle-doc/',substring-after(.,'bundle://'))"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="."/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - </xsl:template> -</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.documentation/src/test/java/org/apache/clerezza/platform/documentation/UriMutatorIteratorTest.java ---------------------------------------------------------------------- diff --git a/platform.documentation/src/test/java/org/apache/clerezza/platform/documentation/UriMutatorIteratorTest.java b/platform.documentation/src/test/java/org/apache/clerezza/platform/documentation/UriMutatorIteratorTest.java deleted file mode 100644 index 652dd1c..0000000 --- a/platform.documentation/src/test/java/org/apache/clerezza/platform/documentation/UriMutatorIteratorTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.platform.documentation; - -import java.util.Iterator; -import org.junit.Assert; -import org.junit.Test; -import org.apache.clerezza.rdf.core.Literal; -import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.SimpleMGraph; -import org.apache.clerezza.rdf.core.impl.TripleImpl; -import org.apache.clerezza.rdf.core.impl.TypedLiteralImpl; - -/** - * - * @author mir - */ -public class UriMutatorIteratorTest { - - private static final String HOST = "http://localhost:8282/"; - - private static String ORIGIN_BUNDLE_NAME = "my.symbolic.name"; - - private static String REFERENCED_BUNDLE_NAME = "your.symbolic.name"; - - @Test - public void testMutator() { - MGraph mGraph = new SimpleMGraph(); - UriRef uriRef = new UriRef(UriMutatorIterator.BASE_URI_PLACEHOLDER + - REFERENCED_BUNDLE_NAME + "/bla#Test"); - UriRef expectedUriRef = new UriRef(HOST + - "bundle-doc/"+ REFERENCED_BUNDLE_NAME +"/bla#Test"); - mGraph.add(new TripleImpl(uriRef, uriRef, uriRef)); - Iterator<Triple> it = new UriMutatorIterator(mGraph.iterator(), HOST, - ORIGIN_BUNDLE_NAME); - Triple expectedTriple = new TripleImpl(expectedUriRef, expectedUriRef, - expectedUriRef); - Assert.assertEquals(expectedTriple, it.next()); - } - - @Test - public void testMutatorNoSymbolicName() { - MGraph mGraph = new SimpleMGraph(); - UriRef uriRef = new UriRef(UriMutatorIterator.BASE_URI_PLACEHOLDER + - "/bla#Test"); - UriRef expectedUriRef = new UriRef(HOST + - "bundle-doc/"+ ORIGIN_BUNDLE_NAME +"/bla#Test"); - mGraph.add(new TripleImpl(uriRef, uriRef, uriRef)); - Iterator<Triple> it = new UriMutatorIterator(mGraph.iterator(), HOST, - ORIGIN_BUNDLE_NAME); - Triple expectedTriple = new TripleImpl(expectedUriRef, expectedUriRef, - expectedUriRef); - Assert.assertEquals(expectedTriple, it.next()); - } - - @Test - public void baseUriTransformation() { - MGraph mGraph = new SimpleMGraph(); - String xml = "<a href=\"" + UriMutatorIterator.BASE_URI_PLACEHOLDER + - REFERENCED_BUNDLE_NAME + "/bla\"/>"; - Literal literal = new TypedLiteralImpl(xml, - UriMutatorIterator.XML_LITERAL); - String expectedXml = "<a href=\"" + HOST + - "bundle-doc/"+ REFERENCED_BUNDLE_NAME +"/bla\"/>"; - Literal expectedLiteral = new TypedLiteralImpl(expectedXml, - UriMutatorIterator.XML_LITERAL); - UriRef uriRef = new UriRef("bla"); - mGraph.add(new TripleImpl(uriRef, uriRef, literal)); - Iterator<Triple> it = new UriMutatorIterator(mGraph.iterator(), HOST, - ORIGIN_BUNDLE_NAME); - Triple expectedTriple = new TripleImpl(uriRef, uriRef, - expectedLiteral); - Assert.assertEquals(expectedTriple, it.next()); - } - - @Test - public void baseUriTransformationNoSymbolicName() { - MGraph mGraph = new SimpleMGraph(); - String xml = "<a href=\"" + UriMutatorIterator.BASE_URI_PLACEHOLDER + - "/bla\"/>"; - Literal literal = new TypedLiteralImpl(xml, - UriMutatorIterator.XML_LITERAL); - String expectedXml = "<a href=\"" + HOST + - "bundle-doc/"+ ORIGIN_BUNDLE_NAME +"/bla\"/>"; - Literal expectedLiteral = new TypedLiteralImpl(expectedXml, - UriMutatorIterator.XML_LITERAL); - UriRef uriRef = new UriRef("bla"); - mGraph.add(new TripleImpl(uriRef, uriRef, literal)); - Iterator<Triple> it = new UriMutatorIterator(mGraph.iterator(), HOST, - ORIGIN_BUNDLE_NAME); - Triple expectedTriple = new TripleImpl(uriRef, uriRef, - expectedLiteral); - Assert.assertEquals(expectedTriple, it.next()); - } -} http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.editor/LICENSE ---------------------------------------------------------------------- diff --git a/platform.editor/LICENSE b/platform.editor/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/platform.editor/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/af0d99b2/platform.editor/nbactions.xml ---------------------------------------------------------------------- diff --git a/platform.editor/nbactions.xml b/platform.editor/nbactions.xml deleted file mode 100644 index 9690e1a..0000000 --- a/platform.editor/nbactions.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>CUSTOM-deploy to localhost:8080</actionName> - <displayName>deploy to localhost:8080</displayName> - <goals> - <goal>install</goal> - <goal>org.apache.sling:maven-sling-plugin:install</goal> - </goals> - </action> -</actions>