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:50:01 UTC
[35/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/config/pom.xml
----------------------------------------------------------------------
diff --git a/platform/config/pom.xml b/platform/config/pom.xml
deleted file mode 100644
index 07ee878..0000000
--- a/platform/config/pom.xml
+++ /dev/null
@@ -1,93 +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>8-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.config</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza - Platform Configuration</name>
- <description>This bundles initializes the system graph with default values,
- provides a service to access configuration default values, and a GUI to
- edit such values.
- </description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <!-- a problem with more recent versions and combined targets target="(&(foo=bar)(name=foo)" -->
- <version>2.4.0</version>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.ontologies</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.utils</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>permissiondescriptions</artifactId>
- <version>0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.file.storage</artifactId>
- <version>1.0.0</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
----------------------------------------------------------------------
diff --git a/platform/config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java b/platform/config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
deleted file mode 100644
index b05f0c1..0000000
--- a/platform/config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
+++ /dev/null
@@ -1,191 +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.config;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import org.apache.clerezza.platform.Constants;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
-import org.apache.clerezza.commons.rdf.RDFTerm;
-import org.apache.clerezza.commons.rdf.Triple;
-import org.apache.clerezza.commons.rdf.IRI;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.commons.rdf.Graph;
-
-/**
- * This class provides a OSGi service for getting system properties from
- * the sytem graph.
- *
- * @author mir
- */
-@Component
-@Service(PlatformConfig.class)
-public class PlatformConfig {
-
- @Reference(target = SystemConfig.SYSTEM_GRAPH_FILTER)
- private Graph systemGraph;
- private BundleContext context;
- private static String DEFAULT_PORT = "8080";
-
- /**
- * @deprecated use org.apache.clerezza.platform.Contants instead
- */
- @Deprecated
- public static final IRI CONFIG_GRAPH_URI = Constants.CONFIG_GRAPH_URI;
-
- /**
- * A filter that can be used to get the config graph as OSGi service,
- * that is provided by <code>org.apache.clerezza.rdf.core.access.TcManager</code>.
- */
- public static final String CONFIG_GRAPH_FILTER =
- "(name="+ Constants.CONFIG_GRAPH_URI_STRING +")";
-
- @Reference
- private TcManager tcManager;
-
-
- /**
- * Returns the default base URI of the Clerezza platform instance.
- * @return the base URI of the Clerezza platform
- */
- public IRI getDefaultBaseUri() {
- return AccessController.doPrivileged(new PrivilegedAction<IRI>() {
-
- @Override
- public IRI run() {
- GraphNode platformInstance = getPlatformInstance();
- Lock l = platformInstance.readLock();
- l.lock();
- try {
- Iterator<RDFTerm> triples = platformInstance.getObjects(PLATFORM.defaultBaseUri);
- if (triples.hasNext()) {
- return (IRI) triples.next();
- } else {
- String port = context.getProperty("org.osgi.service.http.port");
- if (port == null) {
- port = DEFAULT_PORT;
- }
- if (port.equals("80")) {
- return new IRI("http://localhost/");
- }
- return new IRI("http://localhost:" + port + "/");
- }
- } finally {
- l.unlock();
- }
- }
- });
- }
-
- /**
- * Returns the platforminstance as <code>GraphNode</code> of the system
- * graph (a LockableGraph). Access controls applies to the system graph
- * instance underlying the <code>GraphNode</code>.
- *
- * @return
- */
- public GraphNode getPlatformInstance() {
- return new GraphNode(getPlatformInstanceRDFTerm(), systemGraph);
- }
-
- private BlankNodeOrIRI getPlatformInstanceRDFTerm() {
- Lock l = systemGraph.getLock().readLock();
- l.lock();
- try {
- Iterator<Triple> instances = systemGraph.filter(null, RDF.type, PLATFORM.Instance);
- if (!instances.hasNext()) {
- throw new RuntimeException("No Platform:Instance in system graph.");
- }
- return instances.next().getSubject();
- } finally {
- l.unlock();
- }
- }
-
- /**
- * Returns the base URIs of the Clerezza platform instance.
- * A base Uri is the shortest URI of a URI-Hierarhy the platform handles.
- * @return the base URI of the Clerezza platform
- */
- //todo: if this is the only class that sets and reads base uris then getBaseURIs should keep a cache
- public Set<IRI> getBaseUris() {
-
- return AccessController.doPrivileged(new PrivilegedAction<Set<IRI>>() {
-
- @Override
- public Set<IRI> run() {
- Iterator<RDFTerm> baseUrisIter = getPlatformInstance().
- getObjects(PLATFORM.baseUri);
- Set<IRI> baseUris = new HashSet<IRI>();
- while (baseUrisIter.hasNext()) {
- IRI baseUri = (IRI) baseUrisIter.next();
- baseUris.add(baseUri);
- }
- baseUris.add(getDefaultBaseUri());
- return baseUris;
- }
- });
-
- }
-
- /**
- * Adds a base URI to the Clerezza platform instance.
- *
- * @param baseUri The base URI which will be added to the platform instance
- */
- public void addBaseUri(IRI baseUri) {
- systemGraph.add(new TripleImpl(getPlatformInstanceRDFTerm(), PLATFORM.baseUri, baseUri));
- }
-
- /**
- * Removes a base URI from the Clerezza platform instance.
- *
- * @param baseUri The base URI which will be removed from the platform instance
- */
- public void removeBaseUri(IRI baseUri) {
- systemGraph.remove(new TripleImpl(getPlatformInstanceRDFTerm(), PLATFORM.baseUri, baseUri));
- }
-
- protected void activate(ComponentContext componentContext) {
- this.context = componentContext.getBundleContext();
- try {
- tcManager.getGraph(Constants.CONFIG_GRAPH_URI);
- } catch (NoSuchEntityException nsee) {
- tcManager.createGraph(Constants.CONFIG_GRAPH_URI);
- }
- }
-
- protected void deactivate(ComponentContext componentContext) {
- this.context = null;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java
----------------------------------------------------------------------
diff --git a/platform/config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java b/platform/config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java
deleted file mode 100644
index 1527ee4..0000000
--- a/platform/config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java
+++ /dev/null
@@ -1,183 +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.config;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Set;
-import org.apache.clerezza.platform.Constants;
-import org.apache.clerezza.commons.rdf.ImmutableGraph;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.osgi.service.component.ComponentContext;
-import org.apache.clerezza.commons.rdf.Graph;
-import org.apache.clerezza.commons.rdf.IRI;
-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.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.clerezza.rdf.core.serializedform.Serializer;
-import org.apache.clerezza.rdf.file.storage.FileGraph;
-import org.apache.felix.scr.annotations.Service;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Deactivate;
-
-/**
- * When the
- * <code>SystemConfig</code> component is activated it checks if the system
- * graph exists, in case it does not exist then it creates the system graph and
- * writes the default platform configuration into it.
- *
- * @author mir
- */
-@Component(immediate = true)
-@Service(WeightedTcProvider.class)
-public class SystemConfig implements WeightedTcProvider {
-
- public static final String DEFAULT_SYSTEM_GRAPH = "default-system-graph.rdf";
- private static final String DATA_FILE_SYSTEM_GRAPH = "system-graph.nt";
- private final Logger logger = LoggerFactory.getLogger(getClass());
- /**
- *
- * @deprecated use org.apache.clerezza.platform.Contants instead
- */
- @Deprecated
- public static final IRI SYSTEM_GRAPH_URI = Constants.SYSTEM_GRAPH_URI;
- /**
- * A filter that can be used to get the system graph as OSGi service, that
- * is provided by
- * <code>org.apache.clerezza.rdf.core.access.TcManager</code>.
- */
- public static final String SYSTEM_GRAPH_FILTER =
- "(name=" + Constants.SYSTEM_GRAPH_URI_STRING + ")";
-
- public static final String PARSER_FILTER =
- "(&("+SupportedFormat.supportedFormat+"=" + SupportedFormat.RDF_XML + ") "+
- "("+SupportedFormat.supportedFormat+"=" + SupportedFormat.N_TRIPLE + "))";
- @Reference(target = PARSER_FILTER)
- private Parser parser;
-
- public static final String SERIALIZER_FILTER =
- "("+SupportedFormat.supportedFormat+"=" + SupportedFormat.N_TRIPLE + ")";
- @Reference(target = SERIALIZER_FILTER)
- private Serializer serializer;
- private Graph systemGraph;
-
- @Activate
- protected void activate(ComponentContext componentContext) {
- final BundleContext bundleContext = componentContext.getBundleContext();
- File systemGraphFile = bundleContext.getDataFile(DATA_FILE_SYSTEM_GRAPH);
- boolean dataFileExisted = systemGraphFile.exists();
- //yould be good to use IndexedGraph to be faster
- systemGraph = new FileGraph(systemGraphFile, parser, serializer);
- if (!dataFileExisted) {
- readConfigGraphFile(systemGraph);
- logger.info("Add initial configuration to system graph");
- }
- }
-
- @Deactivate
- protected void deactivate(ComponentContext componentContext) {
- systemGraph = null;
- }
-
- private void readConfigGraphFile(Graph mGraph) {
- URL config = getClass().getResource(DEFAULT_SYSTEM_GRAPH);
- if (config == null) {
- throw new RuntimeException("no config file found");
- }
- try {
- parser.parse(mGraph, config.openStream(),
- SupportedFormat.RDF_XML, null);
- } catch (IOException ex) {
- logger.warn("Cannot parse coniguration at URL: {}", config);
- throw new RuntimeException(ex);
- }
- }
-
- /*
- * Reason to be high: don't allow overwriting of system graph (by accident or as an attack)
- * Reason to be low: avoid that TcManager always first tries to create Graphs using this provider
- */
- @Override
- public int getWeight() {
- return Integer.MAX_VALUE;
- }
-
- @Override
- public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
- throw new NoSuchEntityException(name);
- }
-
- @Override
- public Graph getMGraph(IRI name) throws NoSuchEntityException {
- if (name.equals(Constants.SYSTEM_GRAPH_URI)) {
- return systemGraph;
- } else {
- throw new NoSuchEntityException(name);
- }
- }
-
- @Override
- public Graph getGraph(IRI name) throws NoSuchEntityException {
- return getMGraph(name);
- }
-
- @Override
- public Set<IRI> listImmutableGraphs() {
- return Collections.emptySet();
- }
-
- @Override
- public Set<IRI> listMGraphs() {
- return Collections.singleton(Constants.SYSTEM_GRAPH_URI);
- }
-
- @Override
- public Set<IRI> listGraphs() {
- return listMGraphs();
- }
-
- @Override
- public Graph createGraph(IRI name) throws UnsupportedOperationException, EntityAlreadyExistsException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public ImmutableGraph createImmutableGraph(IRI name, Graph triples) throws UnsupportedOperationException, EntityAlreadyExistsException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void deleteGraph(IRI name) throws UnsupportedOperationException, NoSuchEntityException, EntityUndeletableException {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Set<IRI> getNames(ImmutableGraph graph) {
- return Collections.emptySet();
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/config/src/main/java/org/apache/clerezza/platform/config/TcPermissionDescriptionsProvider.java
----------------------------------------------------------------------
diff --git a/platform/config/src/main/java/org/apache/clerezza/platform/config/TcPermissionDescriptionsProvider.java b/platform/config/src/main/java/org/apache/clerezza/platform/config/TcPermissionDescriptionsProvider.java
deleted file mode 100644
index caa2009..0000000
--- a/platform/config/src/main/java/org/apache/clerezza/platform/config/TcPermissionDescriptionsProvider.java
+++ /dev/null
@@ -1,70 +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.config;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.clerezza.permissiondescriptions.PermissionDescriptionsProvider;
-import org.apache.clerezza.permissiondescriptions.PermissionDescripton;
-import org.apache.clerezza.rdf.core.access.security.TcPermission;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
-
-/**
- * <code>PermissionDescriptionsProvider</code> implementation that provides
- * <code>PermissionDescripton</code>s of the graph access permissions for
- * the graphs used by the platform.
- * The access permissions for the following graphs are described:
- * <ul>
- * <li>system graph</li>
- * <li>config graph</li>
- * </ul>
- *
- * @author mir
- */
-@Component
-@Service(PermissionDescriptionsProvider.class)
-public class TcPermissionDescriptionsProvider implements PermissionDescriptionsProvider {
-
- private static final Set<PermissionDescripton> GRAPH_ACCESS_PERMISSION_DESCRIPTIONS =
- new HashSet<PermissionDescripton>();
- static {
- GRAPH_ACCESS_PERMISSION_DESCRIPTIONS.add(new PermissionDescripton("System ImmutableGraph Read Permission",
- "Grants permission to the user to read the system graph", null, TcPermission.class,
- "(org.apache.clerezza.rdf.core.access.security.TcPermission \"urn:x-localinstance:/system.graph\" \"read\")"));
-
- GRAPH_ACCESS_PERMISSION_DESCRIPTIONS.add(new PermissionDescripton("System ImmutableGraph Read/Write Permission",
- "Grants permission to the user to read and write the system graph", null, TcPermission.class,
- "(org.apache.clerezza.rdf.core.access.security.TcPermission \"urn:x-localinstance:/system.graph\" \"readwrite\")"));
-
- GRAPH_ACCESS_PERMISSION_DESCRIPTIONS.add(new PermissionDescripton("Configuration ImmutableGraph Read Permission",
- "Grants permission to the user to read the configuration graph", null, TcPermission.class,
- "(org.apache.clerezza.rdf.core.access.security.TcPermission \"urn:x-localinstance:/config.graph\" \"read\")"));
-
- GRAPH_ACCESS_PERMISSION_DESCRIPTIONS.add(new PermissionDescripton("Configuration ImmutableGraph Read/Write Permission",
- "Grants permission to the user to read and write the configuration graph", null, TcPermission.class,
- "(org.apache.clerezza.rdf.core.access.security.TcPermission \"urn:x-localinstance:/config.graph\" \"readwrite\")"));
- }
-
- @Override
- public Set<PermissionDescripton> getPermissionDescriptors() {
- return GRAPH_ACCESS_PERMISSION_DESCRIPTIONS;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/config/src/main/resources/org/apache/clerezza/platform/config/default-system-graph.rdf
----------------------------------------------------------------------
diff --git a/platform/config/src/main/resources/org/apache/clerezza/platform/config/default-system-graph.rdf b/platform/config/src/main/resources/org/apache/clerezza/platform/config/default-system-graph.rdf
deleted file mode 100644
index f530afd..0000000
--- a/platform/config/src/main/resources/org/apache/clerezza/platform/config/default-system-graph.rdf
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version='1.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.
-
--->
-
-<rdf:RDF
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:perm="http://clerezza.org/2008/10/permission#"
- xmlns:foaf="http://xmlns.com/foaf/0.1/"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:sioc="http://rdfs.org/sioc/ns#"
- xmlns:plat="http://clerezza.org/2009/08/platform#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
- <perm:Role>
- <dc:title>CommunityUser</dc:title>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.apache.clerezza.rdf.core.access.security.TcPermission "urn:x-localinstance:/user/{username}/*" "readwrite")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.apache.clerezza.platform.accountcontrolpanel.UserBundlePermission "{username}" "")</perm:javaPermissionEntry>
- </perm:hasPermission>
- </perm:Role>
- <plat:Instance></plat:Instance>
- <foaf:Agent>
- <plat:userName>anonymous</plat:userName>
- <sioc:has_function>
- <perm:Role>
- <dc:title>BasePermissionsRole</dc:title>
- <rdfs:comment>Every user implicitely has this role as this is a perm:BaseRole</rdfs:comment>
- <rdf:type rdf:resource="http://clerezza.org/2008/10/permission#BaseRole"/>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(java.util.PropertyPermission "*" "read")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.osgi.framework.AdminPermission "*" "resource")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.osgi.framework.ServicePermission "*" "get")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(java.lang.RuntimePermission "accessDeclaredMembers" "")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(java.lang.RuntimePermission "getClassLoader" "")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <!-- it seems pax-logger impl needs this, see comment to https://issues.apache.org/jira/browse/CLEREZZA-205 -->
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.osgi.framework.AdminPermission "*" "metadata")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.apache.clerezza.rdf.core.access.security.TcPermission "urn:x-localinstance:/content.graph" "read")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.apache.clerezza.rdf.core.access.security.TcPermission "urn:x-localinstance:/documentation.graph" "read")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.apache.clerezza.rdf.core.access.security.TcPermission "urn:x-localinstance:/config.graph" "read")</perm:javaPermissionEntry>
- </perm:hasPermission>
- </perm:Role>
- </sioc:has_function>
- </foaf:Agent>
- <perm:Role>
- <dc:title>DefaultRole</dc:title>
- <rdfs:comment>A role regular users typically have</rdfs:comment>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.apache.clerezza.platform.accountcontrolpanel.AccountControlPanelAppPermission "{username}" "")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(org.apache.clerezza.platform.accountcontrolpanel.ChangePasswordPermission "{username}" "")</perm:javaPermissionEntry>
- </perm:hasPermission>
- </perm:Role>
- <rdf:Description rdf:about="urn:x-localinstance:/typePriorityList">
- <rdf:rest rdf:parseType="Collection">
- <rdf:Description rdf:about="http://www.w3.org/2000/01/rdf-schema#Resource"/>
- </rdf:rest>
- <rdf:first rdf:resource="http://clerezza.org/2009/07/script#ScriptGeneratedResource"/>
- </rdf:Description>
- <foaf:Agent>
- <perm:hasPermission rdf:parseType="Resource">
- <perm:javaPermissionEntry>(java.security.AllPermission "" "")</perm:javaPermissionEntry>
- </perm:hasPermission>
- <plat:userName>admin</plat:userName>
- <foaf:mbox rdf:resource="mailto:noreply@clerezza.org"/>
- <perm:passwordSha1>d033e22ae348aeb5660fc2140aec35850c4da997</perm:passwordSha1>
- </foaf:Agent>
-</rdf:RDF>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/content.default404/LICENSE
----------------------------------------------------------------------
diff --git a/platform/content.default404/LICENSE b/platform/content.default404/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/platform/content.default404/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/content.default404/pom.xml
----------------------------------------------------------------------
diff --git a/platform/content.default404/pom.xml b/platform/content.default404/pom.xml
deleted file mode 100644
index 22e6ea9..0000000
--- a/platform/content.default404/pom.xml
+++ /dev/null
@@ -1,100 +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>8-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.content.default404</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza - Platform Content Default 404 response provider</name>
- <description>
- Provides a default implementation of PageNotFoundService
- </description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform</artifactId>
- <version>0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.content</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src/main/scala</sourceDirectory>
- <testSourceDirectory>src/test/scala</testSourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.scala-tools</groupId>
- <artifactId>maven-scala-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!-- <scalaVersion>${scala.version}</scalaVersion> -->
- <!-- <args>
- <arg>-target:jvm-1.5</arg>
- </args> -->
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
- <Export-Package>org.apache.clerezza.platform.content.default404</Export-Package>
- <!-- <Bundle-SymbolicName>org.apache.clerezza.platform.users.core</Bundle-SymbolicName> -->
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/content.default404/src/main/resources/META-INF/documentation.nt
----------------------------------------------------------------------
diff --git a/platform/content.default404/src/main/resources/META-INF/documentation.nt b/platform/content.default404/src/main/resources/META-INF/documentation.nt
deleted file mode 100644
index d5a8a00..0000000
--- a/platform/content.default404/src/main/resources/META-INF/documentation.nt
+++ /dev/null
@@ -1,35 +0,0 @@
-<bundle:///intro-content-el/0> <http://discobits.org/ontology#infoBit> "The default 404 Response Provider budle with id org.apache.clerezza.platform.content.default404 provides an implementation of the PageNotFoundService (package/bundle: org.apache.clerezza.platform.content) that the delivers the response retrieved from the uri with the same protocol and host and the /page-not-found. For example if 404 is to be generated for http://example.org/foo/bar the entity obtained by dereferencing http://example.org/page-not-found will be returned."^^<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-content> <http://discobits.org/ontology#infoBit> "example: curl -u admin:admin -H \"Content-type: text/html\" -T tmp.html http://127.0.0.1:8080/page-not-found"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///intro-content-el/1-content> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#XHTMLInfoDiscoBit> .
-<bundle:///intro-content-el/1-title> <http://discobits.org/ontology#infoBit> "Uploading 404 response page with curl"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .
-<bundle:///intro-content-el/1-title> <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#contains> _:6a610bd3bb246f2a6afd9624eeb843581 .
-<bundle:///intro-content-el/1> <http://discobits.org/ontology#contains> _:e696a99dc91ebddcf13b5a4fd83e55991 .
-<bundle:///intro-content-el/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-<bundle:///intro-content> <http://discobits.org/ontology#contains> _:86e4309edd82a6d415338546caff2d551 .
-<bundle:///intro-content> <http://discobits.org/ontology#contains> _:8ced329518dac9ef741f4099548bb8451 .
-<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> "Default 404 Response Provider "^^<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://discobits.org/ontology#contains> _:566a75916142ac411441d067f09a49f71 .
-<bundle:///intro> <http://discobits.org/ontology#contains> _:eb4272f6f47656ae428d834bb170dfe81 .
-<bundle:///intro> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#TitledContent> .
-_: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> .
-_:6a610bd3bb246f2a6afd9624eeb843581 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/1-title> .
-_:6a610bd3bb246f2a6afd9624eeb843581 <http://discobits.org/ontology#pos> "0" .
-_:6a610bd3bb246f2a6afd9624eeb843581 <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> .
-_:8ced329518dac9ef741f4099548bb8451 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/0> .
-_:8ced329518dac9ef741f4099548bb8451 <http://discobits.org/ontology#pos> "0" .
-_:8ced329518dac9ef741f4099548bb8451 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:e696a99dc91ebddcf13b5a4fd83e55991 <http://discobits.org/ontology#holds> <bundle:///intro-content-el/1-content> .
-_:e696a99dc91ebddcf13b5a4fd83e55991 <http://discobits.org/ontology#pos> "1" .
-_:e696a99dc91ebddcf13b5a4fd83e55991 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://discobits.org/ontology#Entry> .
-_:eb4272f6f47656ae428d834bb170dfe81 <http://discobits.org/ontology#holds> <bundle:///intro-title> .
-_:eb4272f6f47656ae428d834bb170dfe81 <http://discobits.org/ontology#pos> "0" .
-_:eb4272f6f47656ae428d834bb170dfe81 <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/14575ea3/platform/content.default404/src/main/resources/OSGI-INF/serviceComponents.xml
----------------------------------------------------------------------
diff --git a/platform/content.default404/src/main/resources/OSGI-INF/serviceComponents.xml b/platform/content.default404/src/main/resources/OSGI-INF/serviceComponents.xml
deleted file mode 100644
index 71c9b2b..0000000
--- a/platform/content.default404/src/main/resources/OSGI-INF/serviceComponents.xml
+++ /dev/null
@@ -1,30 +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.
-
--->
-
-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
- <scr:component enabled="true" immediate="true" name="org.apache.clerezza.platform.content.default404.DefaultPageNotFoundService">
- <implementation class="org.apache.clerezza.platform.content.default404.DefaultPageNotFoundService"/>
- <service>
- <provide interface="org.apache.clerezza.platform.content.PageNotFoundService" />
- </service>
- </scr:component>
-</components>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/content.default404/src/main/scala/org/apache/clerezza/platform/content/default404/DefaultPageNotFoundService.scala
----------------------------------------------------------------------
diff --git a/platform/content.default404/src/main/scala/org/apache/clerezza/platform/content/default404/DefaultPageNotFoundService.scala b/platform/content.default404/src/main/scala/org/apache/clerezza/platform/content/default404/DefaultPageNotFoundService.scala
deleted file mode 100644
index a0c4ab6..0000000
--- a/platform/content.default404/src/main/scala/org/apache/clerezza/platform/content/default404/DefaultPageNotFoundService.scala
+++ /dev/null
@@ -1,64 +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.content.default404
-
-import org.apache.clerezza.platform.content.PageNotFoundService
-import javax.ws.rs.core.UriInfo
-import java.io.FileNotFoundException
-import java.io.InputStream
-import java.net.URL
-import java.security.AccessController
-import java.security.PrivilegedAction
-import javax.ws.rs.core.Response
-import javax.ws.rs.core.Response.Status
-
-/**
- * This returns the content of the resource /page-not-found dereferenced as uri
- * with the same authority section as the request.
- */
-class DefaultPageNotFoundService extends PageNotFoundService {
-
- private val notFoundPagePath = "/page-not-found"
-
- override def createResponse(uriInfo: UriInfo) = {
- if (uriInfo.getPath == notFoundPagePath) {
- Response.status(Status.NOT_FOUND).build();
- } else {
- val pageNotFoundUrl = new URL(uriInfo.getBaseUri.toURL, notFoundPagePath)
- AccessController.doPrivileged(
- new PrivilegedAction[Option[(String, InputStream)]] {
- def run() = {
- val connection = pageNotFoundUrl.openConnection()
- try {
- Some(connection.getContentType, connection.getInputStream)
- } catch {
- case _: FileNotFoundException => None
- }
- }
- }
- ) match {
- case Some((mediaTypeString, in)) => Response.status(Status.NOT_FOUND).`type`(mediaTypeString).entity(in).build();
- case None => Response.status(Status.NOT_FOUND).build();
- }
-
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/content.fsadaptor/LICENSE
----------------------------------------------------------------------
diff --git a/platform/content.fsadaptor/LICENSE b/platform/content.fsadaptor/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/platform/content.fsadaptor/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/content.fsadaptor/pom.xml
----------------------------------------------------------------------
diff --git a/platform/content.fsadaptor/pom.xml b/platform/content.fsadaptor/pom.xml
deleted file mode 100644
index b5c467f..0000000
--- a/platform/content.fsadaptor/pom.xml
+++ /dev/null
@@ -1,120 +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>8-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.content.fsadaptor</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza - Platform Content Filesystem Adaptor</name>
- <description>
- Makes directories appear as a graph describing the files and theits
- contents with the discobits ontology.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.graphprovider.content</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.scala.utils</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>web.fileserver</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src/main/scala</sourceDirectory>
- <testSourceDirectory>src/test/scala</testSourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.scala-tools</groupId>
- <artifactId>maven-scala-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!-- <scalaVersion>${scala.version}</scalaVersion> -->
- <!-- <args>
- <arg>-target:jvm-1.5</arg>
- </args> -->
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
- <Export-Package>org.apache.clerezza.platform.content.fsadaptor</Export-Package>
- <!-- <Bundle-SymbolicName>org.apache.clerezza.platform.users.core</Bundle-SymbolicName> -->
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/content.fsadaptor/src/main/resources/OSGI-INF/serviceComponents.xml
----------------------------------------------------------------------
diff --git a/platform/content.fsadaptor/src/main/resources/OSGI-INF/serviceComponents.xml b/platform/content.fsadaptor/src/main/resources/OSGI-INF/serviceComponents.xml
deleted file mode 100644
index 75b5938..0000000
--- a/platform/content.fsadaptor/src/main/resources/OSGI-INF/serviceComponents.xml
+++ /dev/null
@@ -1,38 +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.
-
--->
-
-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
- <scr:component enabled="true" immediate="true" name="org.apache.clerezza.platform.content.fsadaptor.BundleFsLoader">
- <implementation class="org.apache.clerezza.platform.content.fsadaptor.BundleFsLoader"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.rdf.core.access.WeightedTcProvider"/>
- </service>
- <reference name="tcManager" interface="org.apache.clerezza.rdf.core.access.TcManager"
- cardinality="1..1" policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
- <reference name="cgProvider" interface="org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider"
- cardinality="1..1" policy="static" bind="bindContentGraphProvider" unbind="unbindContentGraphProvider"/>
- <reference name="startLevel" interface="org.osgi.service.startlevel.StartLevel"
- cardinality="1..1" policy="static" bind="bindStartLevel" unbind="unbindStartLevel"/>
- <reference name="pathNode" interface="org.wymiwyg.commons.util.dirbrowser.PathNode"
- cardinality="0..n" policy="dynamic" bind="bindPathNode" unbind="unbindPathNode"/>
- </scr:component>
-</components>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
----------------------------------------------------------------------
diff --git a/platform/content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala b/platform/content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
deleted file mode 100644
index 242fd55..0000000
--- a/platform/content.fsadaptor/src/main/scala/org/apache/clerezza/platform/content/fsadaptor/BundleFsLoader.scala
+++ /dev/null
@@ -1,293 +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.content.fsadaptor
-
-import java.util.Collections
-import org.apache.clerezza.platform.Constants
-import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider
-import org.apache.clerezza.commons.rdf.ImmutableGraph
-import org.apache.clerezza.commons.rdf.Graph
-import org.apache.clerezza.commons.rdf.BlankNodeOrIRI
-import org.apache.clerezza.commons.rdf.RDFTerm
-import org.apache.clerezza.commons.rdf.Graph
-import org.apache.clerezza.commons.rdf.Triple
-import org.apache.clerezza.commons.rdf.IRI
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException
-import org.apache.clerezza.rdf.core.access.TcManager
-import org.apache.clerezza.rdf.core.access.WeightedTcProvider
-import org.apache.clerezza.rdf.core.access.security.TcPermission
-import org.apache.clerezza.commons.rdf.impl.utils.AbstractGraph
-import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph
-import org.apache.clerezza.utils.osgi.BundlePathNode
-import org.osgi.framework.Bundle
-import org.osgi.framework.BundleEvent
-import org.osgi.framework.BundleListener
-import org.osgi.service.component.ComponentContext
-import org.osgi.service.startlevel.StartLevel
-import org.slf4j.LoggerFactory
-import org.wymiwyg.commons.util.dirbrowser.MultiPathNode
-import org.wymiwyg.commons.util.dirbrowser.PathNode
-import scala.util._
-
-/**
- * This weighted TcProvider provides a graph named urn:x-localinstance/web-resources.graph which contains descriptions
- * of the files below the CLEREZZA-INF/web-resources directory in every bundles. The
- * name of these descriptions (i.e. the rdf resources) use the urn:x-localinstance uri scheme to indicate that
- * they are local to the instance and they will thus be returned as description
- * for all uris with a local authority and the specified path-section.
- */
-class BundleFsLoader extends BundleListener with Logger with WeightedTcProvider {
-
- private val RESOURCE_MGRAPH_URI = new IRI(Constants.URN_LOCAL_INSTANCE+"/web-resources.graph")
- private val cacheGraphPrefix = Constants.URN_LOCAL_INSTANCE+"/web-resources-cache.graph"
- private var currentCacheUri: IRI = null
-
- private var tcManager: TcManager = null
- private var cgProvider: ContentGraphProvider = null
- private var startLevel: StartLevel = null
- private var pathNodes: List[PathNode] = Nil
- private var bundleList = List[Bundle]()
- private var currentCacheGraph: Graph = null
-
- private var frequentUpdateDirectory: Option[PathNode] = None
-
- private val virtualGraph: Graph = new AbstractGraph() {
-
- private def baseGraph: Graph = frequentUpdateDirectory match {
- case Some(p) => new DirectoryOverlay(p, currentCacheGraph)
- case None => currentCacheGraph
- }
-
- override def performFilter(s: BlankNodeOrIRI, p: IRI,
- o: RDFTerm): java.util.Iterator[Triple] = {
- val baseIter = baseGraph.filter(s,p,o)
- new java.util.Iterator[Triple]() {
- override def next = {
- baseIter.next
- }
- override def hasNext = baseIter.hasNext
- override def remove = throw new UnsupportedOperationException
- }
- }
-
- override def performSize = baseGraph.size
-
- override def toString = "BundleFsLoader virtual graph"
-
- }
-
- class UpdateThread extends Thread {
-
- private var updateRequested = false;
-
- start()
-
- override def run() {
- try {
- while (!isInterrupted) {
- synchronized {
- while (!updateRequested) wait();
- }
- updateRequested = false
- updateCache()
- }
- } catch {
- case e: InterruptedException => BundleFsLoader.log.debug("Update thread interrupted");
- }
- }
-
- def update() = {
- synchronized {
- updateRequested = true
- notify();
- }
- }
- }
-
- private var updateThread: UpdateThread = null
-
-
- private def deleteCacheGraphs() {
- import collection.JavaConversions._
- for(mGraphUri <- tcManager.listGraphs) {
- if(mGraphUri.getUnicodeString.startsWith(cacheGraphPrefix)) {
- tcManager.deleteGraph(mGraphUri);
- }
- }
- }
-
- protected def activate(context: ComponentContext) {
- synchronized {
- deleteCacheGraphs()
- for (bundle <- context.getBundleContext().getBundles();
- if bundle.getState == Bundle.ACTIVE) {
- bundleList ::= bundle
- }
- updateCache
- tcManager.getTcAccessController.setRequiredReadPermissions(
- RESOURCE_MGRAPH_URI, Collections.singleton(new TcPermission(Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ)))
- cgProvider.addTemporaryAdditionGraph(RESOURCE_MGRAPH_URI)
- updateThread = new UpdateThread()
- context.getBundleContext().addBundleListener(this);
- }
- }
- protected def deactivate(context: ComponentContext) {
- synchronized {
- context.getBundleContext().removeBundleListener(this);
- updateThread.interrupt()
- cgProvider.removeTemporaryAdditionGraph(RESOURCE_MGRAPH_URI)
- tcManager.deleteGraph(currentCacheUri);
- updateThread == null;
- }
- }
-
- private def updateCache() = {
- def getVirtualGraph(bundles: Seq[Bundle]): Graph = {
- if (bundles.isEmpty) {
- new SimpleGraph()
- } else {
- val pathNode = new BundlePathNode(bundles.head, "CLEREZZA-INF/web-resources");
- if (pathNode.isDirectory) {
- BundleFsLoader.log.debug("Creating directory overlay for "+bundles.head)
- new DirectoryOverlay(pathNode, getVirtualGraph(bundles.tail))
- } else {
- getVirtualGraph(bundles.tail)
- }
- }
- }
- synchronized {
- val sortedList = Sorting.stableSort(bundleList, (b:Bundle) => -startLevel.getBundleStartLevel(b))
- val newCacheUri = new IRI(cacheGraphPrefix+System.currentTimeMillis)
- val newChacheGraph = tcManager.createGraph(newCacheUri);
- tcManager.getTcAccessController.setRequiredReadPermissions(
- newCacheUri, Collections.singleton(new TcPermission(Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ)))
- newChacheGraph.addAll(getVirtualGraph(sortedList))
- currentCacheGraph = newChacheGraph
- val oldCacheUri = currentCacheUri
- currentCacheUri = newCacheUri
- if (oldCacheUri != null) tcManager.deleteGraph(oldCacheUri);
- BundleFsLoader.log.debug("updated web-resource cache")
- }
- }
-
-
-
- override def getWeight() = 30
-
- override def getGraph(name: IRI) = {
- if (name.equals(RESOURCE_MGRAPH_URI)) {
- virtualGraph
- } else {
- throw new NoSuchEntityException(name);
- }
- }
-
- override def getMGraph(name: IRI) = getGraph(name);
-
- override def getImmutableGraph(name: IRI) = throw new NoSuchEntityException(name);
-
- override def listGraphs(): java.util.Set[IRI] = {
- java.util.Collections.singleton(RESOURCE_MGRAPH_URI);
- }
-
- override def listMGraphs() = listGraphs();
-
- override def listImmutableGraphs(): java.util.Set[IRI] = java.util.Collections.emptySet();
-
-
- override def createGraph(name: IRI) = {
- throw new UnsupportedOperationException("Not supported.");
- }
-
- override def createImmutableGraph(name: IRI, triples: Graph): ImmutableGraph = {
- throw new UnsupportedOperationException("Not supported.");
- }
-
- override def deleteGraph(name: IRI) {
- throw new UnsupportedOperationException("Not supported.");
- }
-
- override def getNames(graph: ImmutableGraph) = {
- val result = new java.util.HashSet[IRI]();
- result;
- }
-
-
- def bundleChanged(event: BundleEvent) {
- val updateThread = this.updateThread
- if (updateThread == null) {
- BundleFsLoader.log.error("UpdateThread is null, yet we get bundle Events")
- }
- val bundle = event.getBundle();
- event.getType() match {
- case BundleEvent.STARTED => {
- bundleList ::= bundle
- updateThread.update()
- }
- case BundleEvent.STOPPED => {
- bundleList = bundleList.filterNot(b => b == bundle)
- updateThread.update()
- }
- case _ => BundleFsLoader.log.debug("only reacting on bundle start and stop")
- }
- }
-
-
- def bindTcManager(tcManager: TcManager) {
- this.tcManager = tcManager;
- }
-
- def unbindTcManager(tcManager: TcManager) {
- this.tcManager = null;
- }
-
- def bindContentGraphProvider(p: ContentGraphProvider) {
- cgProvider = p
- }
-
- def unbindContentGraphProvider(p: ContentGraphProvider) {
- cgProvider = null
- }
-
- def bindStartLevel(startLevel: StartLevel) {
- this.startLevel = startLevel;
- }
-
- def unbindStartLevel(startLevel: StartLevel) {
- this.startLevel = null;
- }
-
- def bindPathNode(pathNode: PathNode) {
- this.pathNodes ::= pathNode;
- frequentUpdateDirectory = Some(new MultiPathNode(pathNodes: _*))
- }
-
- def unbindPathNode(pathNode: PathNode) {
- this.pathNodes = this.pathNodes.filter(_ != pathNode);
- frequentUpdateDirectory = pathNodes match {
- case Nil => None
- case _ => Some(new MultiPathNode(pathNodes: _*))
- }
- }
-
-}
-object BundleFsLoader {
- private val log = LoggerFactory.getLogger(classOf[BundleFsLoader])
-}
\ No newline at end of file