You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2016/10/03 15:49:35 UTC
[09/51] [partial] clerezza git commit: CLEREZZA-1012: reduced
clerezza to core components, the rest stays in legacy-branch
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/language/LICENSE
----------------------------------------------------------------------
diff --git a/platform/language/LICENSE b/platform/language/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/platform/language/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/14575ea3/platform/language/platform.language.core/LICENSE
----------------------------------------------------------------------
diff --git a/platform/language/platform.language.core/LICENSE b/platform/language/platform.language.core/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/platform/language/platform.language.core/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/14575ea3/platform/language/platform.language.core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/language/platform.language.core/pom.xml b/platform/language/platform.language.core/pom.xml
deleted file mode 100644
index b1733f9..0000000
--- a/platform/language/platform.language.core/pom.xml
+++ /dev/null
@@ -1,87 +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>platform.language</artifactId>
- <groupId>org.apache.clerezza</groupId>
- <version>0.3</version>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.language.core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza - Platform Language Core</name>
- <description>This bundles provides methods to manage languages in the Clerezza platform
- </description>
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.ontologies</artifactId>
- <version>0.12</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.utils</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.typerendering.core</artifactId>
- <version>0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.typerendering.scalaserverpages</artifactId>
- <version>0.4</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>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>web.fileserver</artifactId>
- <version>0.10</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.language.ontologies</artifactId>
- <version>0.3</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageDescription.java
----------------------------------------------------------------------
diff --git a/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageDescription.java b/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageDescription.java
deleted file mode 100644
index 498dbbb..0000000
--- a/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageDescription.java
+++ /dev/null
@@ -1,115 +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.language;
-
-import java.util.Iterator;
-import java.util.concurrent.locks.Lock;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.access.LockableMGraph;
-import org.apache.clerezza.rdf.ontologies.LINGVOJ;
-import org.apache.clerezza.rdf.ontologies.RDFS;
-import org.apache.clerezza.rdf.utils.GraphNode;
-
-/**
- * An object of this class keeps information about a language.
- *
- * @author mir
- */
-public class LanguageDescription {
-
- private GraphNode resource;
- private Language language;
-
- LanguageDescription(GraphNode resource) {
- this.resource = resource;
- Literal iso1Literal = null;
- TripleCollection configGraph = resource.getGraph();
- if (configGraph instanceof LockableMGraph) {
- LockableMGraph lockableConfigGraph = (LockableMGraph)configGraph;
- Lock readLock = lockableConfigGraph.getLock().readLock();
- readLock.lock();
- try {
- iso1Literal = (Literal) resource.getObjects(LINGVOJ.iso1).next();
- } finally {
- readLock.unlock();
- }
- } else {
- iso1Literal = (Literal) resource.getObjects(LINGVOJ.iso1).next();
- }
- if (iso1Literal == null) {
- throw new RuntimeException("No iso1 code for " +resource.getNode());
- }
- String iso1 = iso1Literal.getLexicalForm();
- this.language = new Language(iso1);
- }
-
- /**
- * Returns a <code>Language</code> object which represents the language
- * described by this object.
- * @return the described language
- */
- public Language getLanguage() {
- return language;
- }
-
- /**
- * Returns a graph node in the content graph which leads to further
- * information about the language described by this object.
- * The information are those provided by http://www.lingvoj.org/lingvoj.rdf.
- * @return the graph node leading to further information about the described
- * language
- */
- public GraphNode getResource() {
- return resource;
- }
-
- /**
- * Returns the label of the language described by this object in the
- * specified language, or null if no lable is available in that language
- * @param lang the language in which the label should be.
- * @return
- */
- public String getLabel(Language lang) {
- Lock readLock = null;
- TripleCollection configGraph = resource.getGraph();
- if (configGraph instanceof LockableMGraph) {
- LockableMGraph lockableConfigGraph = (LockableMGraph)configGraph;
- readLock = lockableConfigGraph.getLock().readLock();
- readLock.lock();
- }
- try {
- Iterator<Resource> labels = resource.getObjects(RDFS.label);
- while (labels.hasNext()) {
- PlainLiteral label = (PlainLiteral) labels.next();
- if (label.getLanguage().equals(lang)) {
- return label.getLexicalForm();
- }
- }
- return null;
- } finally {
- if (readLock != null) {
- readLock.unlock();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
----------------------------------------------------------------------
diff --git a/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java b/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
deleted file mode 100644
index 883a9c9..0000000
--- a/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
+++ /dev/null
@@ -1,328 +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.language;
-
-import java.io.IOException;
-import java.lang.ref.SoftReference;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import org.apache.clerezza.platform.config.PlatformConfig;
-import org.apache.clerezza.platform.config.SystemConfig;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.osgi.service.component.ComponentContext;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.LockableMGraph;
-import org.apache.clerezza.rdf.core.access.SecuredMGraph;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.apache.clerezza.rdf.ontologies.LINGVOJ;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.ontologies.RDFS;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.utils.RdfList;
-
-/**
- * This class provides a OSGi service for managing languages in the Clerezza
- * platform.
- *
- * @author mir
- */
-@Component(immediate=true, enabled= true)
-@Service(LanguageService.class)
-public class LanguageService {
-
- @Reference
- private TcManager tcManager;
-
- /**
- * this is linked to the system-graph, accessing requires respective
- * permission
- */
- private List<Resource> languageList;
- /**
- * no permission on the system graph required to access this
- */
- private List<Resource> languageListCache;
-
- private static final String PARSER_FILTER =
- "(supportedFormat=" + SupportedFormat.RDF_XML +")";
-
- @Reference(target=PARSER_FILTER)
- private ParsingProvider parser;
-
- @Reference(target = SystemConfig.SYSTEM_GRAPH_FILTER)
- private MGraph securedSystemGraph;
-
- @Reference(target = PlatformConfig.CONFIG_GRAPH_FILTER)
- private MGraph securedConfigGraph;
-
- private SoftReference<Graph> softLingvojGraph = new SoftReference<Graph>(null);
-
-
- private LockableMGraph getSystemGraph() {
- return ((SecuredMGraph) securedSystemGraph).getUnsecuredMGraph();
- }
-
- private LockableMGraph getConfigGraph() {
- return ((SecuredMGraph) securedConfigGraph).getUnsecuredMGraph();
- }
-
- /**
- * Returns a <code>List</code> of <code>LanguageDescription</code>s which
- * describe the languages which are supported by the platform. The first
- * entry describes the default language of the platform.
- * @return a list containing all language descriptions.
- */
- public List<LanguageDescription> getLanguages() {
- List<LanguageDescription> langList = new ArrayList<LanguageDescription>();
- Iterator<Resource> languages = languageListCache.iterator();
- while (languages.hasNext()) {
- UriRef language = (UriRef) languages.next();
- langList.add(new LanguageDescription(new GraphNode(language, getConfigGraph())));
- }
- return langList;
- }
-
- /**
- * Returns the <code>LanguageDescription</code> of the default language
- * of the platform.
- * @return the language description of the default language.
- */
- public LanguageDescription getDefaultLanguage() {
- return new LanguageDescription(
- new GraphNode(languageListCache.get(0), getConfigGraph()));
- }
-
- /**
- * Returns a set containg all language uris which are in the
- * <http://www.lingvoj.org/lingvoj> graph which is included in this bundle.
- * @return a set containing all language uris. This uris can be used to
- * add the language to Clerezza over the addLanguage()-method in this class.
- */
- public Set<UriRef> getAllLanguages() {
- Set<UriRef> result = new HashSet<UriRef>();
- Graph lingvojGraph = getLingvojGraph();
- Iterator<Triple> languages = lingvojGraph.filter(null, RDFS.isDefinedBy,
- null);
- while (languages.hasNext()) {
- UriRef languageUri = (UriRef) languages.next().getSubject();
- result.add(languageUri);
- }
- return result;
- }
-
- /**
- * Returns a language uri of a language which has a label containing the
- * specified languageName. The label itself is in the language specified through
- * inLanguage. If inLanguage is null, then all labels of a language of searched.
- * If no language was found in the <http://www.lingvoj.org/lingvoj>
- * graph, then null is returned. The returned uri can be used to
- * add the language to Clerezza over the addLanguage()-method in this class.
- * @return a language uris
- */
- public UriRef getLanguage(String languageName, Language inLanguage) {
- Graph lingvojGraph = getLingvojGraph();
- Iterator<Triple> languages = lingvojGraph.filter(null, RDFS.isDefinedBy, null);
- while (languages.hasNext()) {
- GraphNode languageNode = new GraphNode((UriRef) languages.next().getSubject(), lingvojGraph);
- Iterator<Resource> labels = languageNode.getObjects(RDFS.label);
- while (labels.hasNext()) {
- PlainLiteral label = (PlainLiteral) labels.next();
- if (label.getLanguage().equals(inLanguage) || inLanguage == null) {
- if (label.getLexicalForm().contains(languageName)) {
- return (UriRef) languageNode.getNode();
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Get the language as <code>GraphNode</code> specified through languageUri.
- * The languageUri has to be a <http://www.lingvoj.org/ontology#Lingvo>
- * according to the graph <http://www.lingvoj.org/lingvoj> included in this
- * bundle., e.g. "http://www.lingvoj.org/lang/de".
- *
- * @param languageUri The language uri which specifies the language
- */
- public GraphNode getLanguageNode(NonLiteral langUri) {
- Graph lingvojRdf = getLingvojGraph();
- return new GraphNode(langUri, lingvojRdf);
- }
-
- /**
- * Adds the language specified through languageUri to the Clerezza
- * platform. The languageUri has to be a <http://www.lingvoj.org/ontology#Lingvo>
- * according to the graph <http://www.lingvoj.org/lingvoj> included in this
- * bundle., e.g. "http://www.lingvoj.org/lang/de" adds German.
- * The uri is added to the system graph and its context to the config graph.
- * The context added is the context provided by lingvoj.rdf.
- * @param languageUri The language uri which specifies the language to be
- * added to the platform.
- */
- public void addLanguage(UriRef languageUri) {
- if (!languageListCache.contains(languageUri)) {
- LockableMGraph systemGraph = getSystemGraph();
- Lock writeLock = systemGraph.getLock().writeLock();
- writeLock.lock();
- try {
- if (languageList.add(languageUri)) {
- addToLanguageConfigGraph(languageUri);
- }
- } finally {
- writeLock.unlock();
- }
- languageListCache.add(languageUri);
- }
- }
-
- private void synchronizeContentGraph() {
- for (Resource resource : languageListCache) {
- addToLanguageConfigGraph((UriRef)resource);
- }
- }
- /**
- * Adds the language information of the language specified through
- * languageUri to the config graph. The languageUri has to be of type
- * <http://www.lingvoj.org/ontology#Lingvo> according to the graph
- * <http://www.lingvoj.org/lingvoj> included in this
- * bundle., e.g. "http://www.lingvoj.org/lang/de" adds German.
- *
- * The added language will not be a platform language.
- *
- * @param languageUri
- */
- public void addToLanguageConfigGraph(NonLiteral languageUri) {
- LockableMGraph configGraph = getConfigGraph();
- Lock writeLock = configGraph.getLock().writeLock();
- writeLock.lock();
- try {
- if (!configGraph.filter(languageUri, LINGVOJ.iso1, null).hasNext()) {
- configGraph.addAll(getLanguageContext(languageUri));
- }
- } finally {
- writeLock.unlock();
- }
- }
-
- private Graph getLanguageContext(NonLiteral langUri) {
- Graph lingvojRdf = getLingvojGraph();
- GraphNode languageNode = new GraphNode(langUri, lingvojRdf);
- return languageNode.getNodeContext();
- }
-
- private Graph getLingvojGraph() {
- Graph lingvojGraph = softLingvojGraph.get();
- if (lingvojGraph != null) {
- return lingvojGraph;
- }
- URL config = getClass().getResource("lingvoj.rdf");
- if (config == null) {
- throw new RuntimeException("no file found");
- }
- try {
- MGraph lingvojMGraph = new SimpleMGraph();
- parser.parse(lingvojMGraph, config.openStream(), SupportedFormat.RDF_XML, null);
- lingvojGraph = lingvojMGraph.getGraph();
- softLingvojGraph = new SoftReference<Graph>(lingvojGraph);
- return lingvojGraph;
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * The activate method is called when SCR activates the component configuration.
- *
- * @param componentContext
- */
- protected void activate(ComponentContext componentContext) {
- LockableMGraph systemGraph = getSystemGraph();
- NonLiteral listNode = getListNode(systemGraph);
-
- Lock writeLock = systemGraph.getLock().writeLock();
- writeLock.lock();
- try {
- // the constructor of RdfList might write to the graph! => requires a write lock
- final RdfList rdfList = new RdfList(listNode, systemGraph);
- languageList = Collections.synchronizedList(rdfList);
- //access to languages should not require access to system graph,
- //so copying the resources to an ArrayList
- languageListCache = Collections.synchronizedList(
- new ArrayList<Resource>(rdfList));
- if (languageListCache.size() == 0) {
- addLanguage(new UriRef("http://www.lingvoj.org/lang/en"));
- }
- //this is to make sure the content graph contains the relevant data
- synchronizeContentGraph();
- } finally {
- writeLock.unlock();
- }
- }
-
- private NonLiteral getListNode(LockableMGraph systemGraph) {
- NonLiteral instance = null;
- Lock readLock = systemGraph.getLock().readLock();
- readLock.lock();
- try {
- Iterator<Triple> instances = systemGraph.filter(null, RDF.type, PLATFORM.Instance);
- if (!instances.hasNext()) {
- throw new RuntimeException("No Platform:Instance in system graph.");
- }
- instance = instances.next().getSubject();
- Iterator<Triple> langListIter = systemGraph.filter(instance,
- PLATFORM.languages, null);
- if (langListIter.hasNext()) {
- return (NonLiteral) langListIter.next().getObject();
- }
- } finally {
- readLock.unlock();
- }
- BNode listNode = new BNode();
- Lock writeLock = systemGraph.getLock().writeLock();
- writeLock.lock();
- try {
- systemGraph.add(new TripleImpl(instance, PLATFORM.languages, listNode));
- } finally {
- writeLock.unlock();
- }
- return listNode;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageWidget.java
----------------------------------------------------------------------
diff --git a/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageWidget.java b/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageWidget.java
deleted file mode 100644
index a403a08..0000000
--- a/platform/language/platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageWidget.java
+++ /dev/null
@@ -1,185 +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.language;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.List;
-import java.util.concurrent.locks.Lock;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-import org.apache.clerezza.platform.Constants;
-import org.apache.clerezza.platform.config.PlatformConfig;
-
-import org.apache.clerezza.rdf.utils.GraphNode;
-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.osgi.service.component.ComponentContext;
-import org.apache.clerezza.platform.language.ontologies.LANGUAGE;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.platform.typerendering.UserContextProvider;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.LockableMGraph;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.RdfList;
-import org.apache.clerezza.rdf.utils.UnionMGraph;
-import org.apache.clerezza.web.fileserver.BundlePathNode;
-import org.apache.clerezza.web.fileserver.FileServer;
-import org.apache.felix.scr.annotations.Services;
-import org.osgi.framework.Bundle;
-import org.wymiwyg.commons.util.dirbrowser.PathNode;
-
-/**
- * Use the LanguageWidget service to store an RDF list of
- * languages in a triple collection and retrieve the root node of the list. The widget
- * can be rendered by using the render method. Via javascript function
- * LanguageList.getLanguage() the currently selected language can be retrieved.
- *
- * @author tio
- */
-@Component(enabled=true, immediate=true)
-@Services({
- @Service(Object.class),
- @Service(UserContextProvider.class)
-})
-@Property(name = "javax.ws.rs", boolValue = true)
-
-@Path("/language-widget")
-public class LanguageWidget implements UserContextProvider {
-
- private FileServer fileServer;
-
- @Reference
- private TcManager tcManager;
-
- @Reference
- private PlatformConfig platformConfig;
-
- @Reference
- private RenderletManager renderletManager;
-
- @Reference
- private LanguageService languageService;
-
- protected void activate(ComponentContext context) throws IOException, URISyntaxException {
- Bundle bundle = context.getBundleContext().getBundle();
- URL resourceDir = getClass().getResource("staticweb");
- PathNode pathNode = new BundlePathNode(bundle, resourceDir.getPath());
-
- fileServer = new FileServer(pathNode);
-
- URL template = getClass().getResource("language-list.ssp");
- renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
- new UriRef(template.toURI().toString()),
- LANGUAGE.LanguageList, "naked",
- MediaType.APPLICATION_XHTML_XML_TYPE, true);
-
- }
-
- private LockableMGraph getConfigGraph() {
- return tcManager.getMGraph(Constants.CONFIG_GRAPH_URI);
- }
-
- /**
- *
- * @param node The graph of the specified GraphNode will not be locked, neither for reading nor writing.
- * It is the responsibility of the calling function to set the write lock, if necessary.
- * @return
- */
- @Override
- public GraphNode addUserContext(final GraphNode node) {
- final NonLiteral platformInstance = AccessController.doPrivileged(
- new PrivilegedAction<NonLiteral>() {
- @Override
- public NonLiteral run() {
- return (NonLiteral) platformConfig.getPlatformInstance().getNode();
- }
- });
- try {
- return addLanguages(node, platformInstance, languageService.getLanguages(), false);
-
- } catch (AccessControlException ex) {
- return AccessController.doPrivileged(
- new PrivilegedAction<GraphNode>() {
- @Override
- public GraphNode run() {
- return addLanguages(node, platformInstance, languageService.getLanguages(), true);
- }
- });
- }
- }
-
- private GraphNode addLanguages(GraphNode node, NonLiteral platformInstance, List<LanguageDescription> languages,
- boolean copyToNode) {
- TripleCollection graph = node.getGraph();
- BNode listNode = new BNode();
- RdfList list = new RdfList(listNode, graph);
- LockableMGraph configGraph = getConfigGraph();
- Lock readLock = configGraph.getLock().readLock();
- for (LanguageDescription languageDescription : languages) {
- NonLiteral languageUri = (NonLiteral) languageDescription.getResource().getNode();
- list.add(languageUri);
- if (copyToNode) {
- readLock.lock();
- try {
- graph.addAll(new GraphNode(languageUri, configGraph).getNodeContext());
- } finally {
- readLock.unlock();
- }
- }
- }
- node.addProperty(PLATFORM.instance, platformInstance);
- graph.add(new TripleImpl(platformInstance, RDF.type, PLATFORM.Instance));
- graph.add(new TripleImpl(platformInstance, PLATFORM.languages, listNode));
- graph.add(new TripleImpl(listNode, RDF.type, LANGUAGE.LanguageList));
- if (!copyToNode) {
- node = new GraphNode(node.getNode(), new UnionMGraph(graph, configGraph));
- }
- return node;
- }
-
- /**
- * Returns a PathNode of a static file from the staticweb folder.
- *
- * @param path specifies the path param of a URI
- *
- * @return {@link PathNode}
- */
- @GET
- @Path("{path:.+}")
- public PathNode getStaticFile(@PathParam("path") String path) {
- return fileServer.getNode(path);
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/language/platform.language.core/src/main/resources/org/apache/clerezza/platform/language/language-list.ssp
----------------------------------------------------------------------
diff --git a/platform/language/platform.language.core/src/main/resources/org/apache/clerezza/platform/language/language-list.ssp b/platform/language/platform.language.core/src/main/resources/org/apache/clerezza/platform/language/language-list.ssp
deleted file mode 100644
index 362009b..0000000
--- a/platform/language/platform.language.core/src/main/resources/org/apache/clerezza/platform/language/language-list.ssp
+++ /dev/null
@@ -1,50 +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.
- *
-*/
-
-import org.apache.clerezza.rdf.scala.utils.RichGraphNode
-def lingvoj(s: Any) = new UriRef("http://www.lingvoj.org/ontology#"+s)
-def rdfs(s: Any) = new UriRef("http://www.w3.org/2000/01/rdf-schema#"+s)
-def getLabel(language:Language, node:RichGraphNode) : String = {
- val matchingLabels = for (label <- node/rdfs("label");
- val labelLiteral = label.getNode.asInstanceOf[PlainLiteral];
- if (labelLiteral.getLanguage.equals(language))
- ) yield {
- label*
- }
- if (matchingLabels.length == 0) {
- "no label"
- } else {
- matchingLabels.apply(0)
- }
-}
-resultDocModifier.addScriptReference("/language-widget/scripts/language-list.js")
-val defaultLanguage:Language = new Language(res%!!(0)/lingvoj("iso1")*)
-
-<select name="availablelanguages" id="availablelanguages">
- <option value={defaultLanguage.toString} selected="selected">{getLabel(defaultLanguage, res%!!(0))}</option>
- {
- for(language <- res!!;
- val iso1 = language/lingvoj("iso1")*;
- if (!iso1.equals(defaultLanguage.toString))) yield {
- <option value={iso1}>{getLabel(defaultLanguage,language)}</option>
- }
- }
-</select>