clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [20/51] [partial] clerezza git commit: CLEREZZA-966: started hierarchical project structure, moved platform bundles to platform, only moved RDF artifacts ported to use commons to the rdf folder.
Date Sun, 22 Mar 2015 12:11:16 GMT
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/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/af0d99b2/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/af0d99b2/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/af0d99b2/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>


Mime
View raw message