http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/pom.xml ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/pom.xml b/platform.launcher.storageless.parent/platform.launcher.storageless/pom.xml new file mode 100644 index 0000000..c54b52e --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/pom.xml @@ -0,0 +1,417 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- + + 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. + +--><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"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.clerezza</groupId> + <artifactId>platform.launcher.storageless.parent</artifactId> + <version>0.9-SNAPSHOT</version> + </parent> + <groupId>org.apache.clerezza</groupId> + <artifactId>platform.launcher.storageless</artifactId> + <version>0.9-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Clerezza - Platform Launcher Storageless</name> + <description>A standalone java application for launching the clerezza.org platform. It is also a bundle, but there is no OSGi container known to support this (we are working on it :-) ). + </description> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.xsite</groupId> + <artifactId>xsite-maven-plugin</artifactId> + <configuration> + <sourceDirectoryPath>${basedir}/src/site/xsite</sourceDirectoryPath> + <sitemapPath>content/sitemap.xml</sitemapPath> + <skinPath>templates/skin.html</skinPath> + <outputDirectoryPath>${basedir}/target/site/documentation</outputDirectoryPath> + </configuration> + <executions> + <execution> + <phase>pre-site</phase> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-scr-plugin</artifactId> + <executions> + <execution> + <id>generate-scr-scrdescriptor</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <!-- Bundles to list in the installer properties file --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>copy-dependencies</goal> + </goals> + <id>copy-shell</id> + <configuration> + <outputDirectory>${basedir}/target/bundles/startlevel-4</outputDirectory> + <useRepositoryLayout>true</useRepositoryLayout> + <excludeTransitive>true</excludeTransitive> + <includeScope>runtime</includeScope> + <includeArtifactIds>shell</includeArtifactIds> + </configuration> + </execution> + <execution> + <goals> + <goal>copy-dependencies</goal> + </goals> + <id>copy-rdf-core</id> + <!-- the tc-manager should be activated after the provider --> + <configuration> + <outputDirectory>${basedir}/target/bundles/startlevel-4</outputDirectory> + <useRepositoryLayout>true</useRepositoryLayout> + <excludeTransitive>true</excludeTransitive> + <includeArtifactIds>rdf.core</includeArtifactIds> + </configuration> + </execution> + <execution> + <goals> + <goal>copy-dependencies</goal> + </goals> + <id>copy-platform-bundles</id> + <configuration> + <outputDirectory>${basedir}/target/bundles/startlevel-3</outputDirectory> + <useRepositoryLayout>true</useRepositoryLayout> + <excludeTransitive>true</excludeTransitive> + <includeScope>runtime</includeScope> + <excludeArtifactIds>rdf.core,slf4j-api,platform.security,platform.security.conditions,shell,org.apache.stanbol.commons.frameworkfragment</excludeArtifactIds> + </configuration> + </execution> + <execution> + <goals> + <goal>copy-dependencies</goal> + </goals> + <id>copy-framework-bundles</id> + <configuration> + <outputDirectory>${basedir}/target/bundles/startlevel-2</outputDirectory> + <useRepositoryLayout>true</useRepositoryLayout> + <excludeTransitive>true</excludeTransitive> + <!-- <excludeScope>compile</excludeScope> --> + <includeScope>provided</includeScope> + </configuration> + </execution> + <execution> + <goals> + <goal>copy-dependencies</goal> + </goals> + <!-- this is a temporary hack to make sure the system-graph gets created --> + <id>copy-security-as-framework-bundles</id> + <configuration> + <useRepositoryLayout>true</useRepositoryLayout> + <outputDirectory>${basedir}/target/bundles/startlevel-2</outputDirectory> + <includeArtifactIds>platform.security</includeArtifactIds> + </configuration> + </execution> + <execution> + <goals> + <goal>copy-dependencies</goal> + </goals> + <!-- After the security fragment is loaded other fragments + are no longer accepted, so having them here --> + <id>copy-extension-bundles</id> + <configuration> + <useRepositoryLayout>true</useRepositoryLayout> + <outputDirectory>${basedir}/target/bundles/startlevel-1</outputDirectory> + <includeArtifactIds>platform.security.conditions,org.apache.stanbol.commons.frameworkfragment</includeArtifactIds> + </configuration> + </execution> + <execution> + <id>inline-jars</id> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <configuration> + <includeArtifactIds> + commons-logging-api,wymiwyg-commons-core,org.apache.felix.main,org.apache.felix.framework.security + </includeArtifactIds> + <outputDirectory>target/extracted</outputDirectory> + <includes>**</includes> + <excludes> + META-INF/** + </excludes> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <mainClass>org.apache.clerezza.platform.launcher.Main</mainClass> + <addDefaultImplementationEntries>true</addDefaultImplementationEntries> + </manifest> + <manifestEntries> + <Bundle-Name>Clerezza - Platform Launcher</Bundle-Name> + <Bundle-SymbolicName>org.apache.clerezza.platform.launcher.storageless</Bundle-SymbolicName> + <Bundle-Activator>org.apache.clerezza.platform.launcher.ClerezzaActivator</Bundle-Activator> + <Import-Package>org.osgi.framework,org.osgi.service.startlevel</Import-Package> + <Private-Package>*</Private-Package> + </manifestEntries> + </archive> + </configuration> + </plugin> + </plugins> + <resources> + <resource> + <targetPath>META-INF</targetPath> + <filtering>false</filtering> + <directory>${basedir}</directory> + <includes> + <include>NOTICE.txt</include> + <include>LICENSE.*</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + </resource> + <!-- the exclude rules are here because the maven-dependency-plugin + copies both -SNAPSHOT version as well as the one with the timestamp, + see http://jira.codehaus.org/browse/MDEP-209 --> + <resource> + <targetPath>bundles</targetPath> + <directory>target/bundles</directory> + <excludes> + <exclude>**/*20*.*-*.jar</exclude> + </excludes> + </resource> + <resource> + <targetPath>org</targetPath> + <directory>target/extracted/org</directory> + </resource> + <resource> + <directory>target/extracted/</directory> + <includes> + <include>default.properties</include> + </includes> + </resource> + </resources> + </build> + <dependencies> + <!-- the most important bundle after the framework: logging --> + <dependency> + <groupId>org.ops4j.pax.logging</groupId> + <artifactId>pax-logging-api</artifactId> + <scope>provided</scope> + <version>1.6.2</version> + </dependency> + <dependency> + <groupId>org.ops4j.pax.logging</groupId> + <artifactId>pax-logging-service</artifactId> + <scope>provided</scope> + <version>1.6.2</version> + <!-- <exclusions> + <exclusion> + <artifactId>jmxri</artifactId> + <groupId>com.sun.jmx</groupId> + </exclusion> + <exclusion> + <artifactId>jmxtools</artifactId> + <groupId>com.sun.jdmk</groupId> + </exclusion> + </exclusions> --> + </dependency> + <dependency> + <groupId>org.apache.clerezza.ext</groupId> + <artifactId>slf4j-scala-api</artifactId> + <scope>provided</scope> + <version>1.6.3-SNAPSHOT</version> + </dependency> + <!-- Core Felix. --> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.main</artifactId> + <scope>provided</scope> + <version>4.3.0-SNAPSHOT</version> + </dependency> + <!-- framework bundles --> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.webconsole</artifactId> + <scope>provided</scope> + <version>4.0.0</version> + </dependency> + <!-- needed by webconsole --> + <dependency> + <groupId>commons-fileupload</groupId> + <artifactId>commons-fileupload</artifactId> + <version>1.2.2</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.bundles</groupId> + <artifactId>json</artifactId> + <version>20090211_1</version> + </dependency> + <!-- <dependency> + <groupId>org.ops4j.pax.web</groupId> + <artifactId>pax-web-jetty-bundle</artifactId> + <scope>provided</scope> + <version>0.7.2</version> + </dependency> --> + <!-- <dependency> + <groupId>org.wymiwyg</groupId> + <artifactId>jetty-osgi-httpservice</artifactId> + <scope>provided</scope> + <version>0.1</version> + </dependency> + <dependency> + <groupId>org.eclipse.equinox.http</groupId> + <artifactId>servlet</artifactId> + <scope>provided</scope> + <version>1.0.0-v20070606</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <scope>provided</scope> + <version>8.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + <scope>provided</scope> + <version>8.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-util</artifactId> + <scope>provided</scope> + <version>8.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-io</artifactId> + <scope>provided</scope> + <version>8.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-continuation</artifactId> + <scope>provided</scope> + <version>8.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-http</artifactId> + <scope>provided</scope> + <version>8.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-security</artifactId> + <scope>provided</scope> + <version>8.0.0.M2</version> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>servlet-api</artifactId> + <scope>provided</scope> + <version>3.0.20100224</version> + </dependency> --> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.http.jetty</artifactId> + <version>2.2.0</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.http.whiteboard</artifactId> + <version>2.2.0</version> + </dependency> + <!-- Apache Felix framework bundles --> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.bundlerepository</artifactId> + <scope>provided</scope> + <version>1.6.6</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.eventadmin</artifactId> + <scope>provided</scope> + <version>1.3.2</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.scr</artifactId> + <scope>provided</scope> + <version>1.6.2</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.configadmin</artifactId> + <scope>provided</scope> + <version>1.6.0</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.metatype</artifactId> + <scope>provided</scope> + <version>1.0.6</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.shell</artifactId> + <scope>provided</scope> + <version>1.4.2</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.framework.security</artifactId> + <scope>provided</scope> + <version>2.1.0-SNAPSHOT</version> + </dependency> + <!-- support for parameterhandling, etc --> + <dependency> + <groupId>org.wymiwyg</groupId> + <artifactId>wymiwyg-commons-core</artifactId> + <!-- runtime only in parent --> + </dependency> + + <!-- support for mvn URIs (to make updating easier --> + <dependency> + <groupId>org.ops4j.pax.url</groupId> + <artifactId>pax-url-mvn</artifactId> + <version>1.3.2</version> + </dependency> + </dependencies> +</project> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/appended-resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/appended-resources/META-INF/NOTICE b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/appended-resources/META-INF/NOTICE new file mode 100644 index 0000000..7d1928c --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/appended-resources/META-INF/NOTICE @@ -0,0 +1,18 @@ + +- Mort Bay Jetty Project (http://www.mortbay.org/jetty/) +- Open Participation Software for Java (http://www.ops4j.org/) +- WYMIWYG (http://wymiwyg.org/) +- HP Labs Semantic Web Research (http://www.hpl.hp.com/semweb/) +- The OSGi Alliance (http://www.osgi.org/) +- Yahoo! Inc. (http://yahoo.com/) +- Eclipse Foundation (http://eclipse.org/) +- INRIA, France Telecom (http://asm.ow2.org/) +- The Legion Of The Bouncy Castle (http://www.bouncycastle.org) +- University of Bristol (http://stars.ilrt.bris.ac.uk/) +- The University of Manchester (http://www.manchester.ac.uk/) +- Open Participation Software for Java (http://www.ops4j.org/) +- EPFL, Lausanne (http://www.epfl.ch/) + +This product includes JQuery and other javascript +files Licensed under the MIT License, see the individual +files for their copyright notice. http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaActivator.java ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaActivator.java b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaActivator.java new file mode 100644 index 0000000..c6b529c --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaActivator.java @@ -0,0 +1,73 @@ +/* + * 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.launcher; + +import java.net.URL; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Set; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.startlevel.StartLevel; + +/** + * OSGi Clerezza Launcher Bundle Activator. + * + * @author daniel + */ +public class ClerezzaActivator implements BundleActivator { + + @Override + public void start(BundleContext context) throws Exception { + System.out.println("starting platform launcher"); + ServiceReference startLevelRef = + context.getServiceReference(StartLevel.class.getName()); + StartLevel startLevel = (StartLevel) context.getService(startLevelRef); + final int currentBundleStartLevel = + startLevel.getBundleStartLevel(context.getBundle()); + startLevel.setStartLevel(currentBundleStartLevel); + final int originalStartLevel = startLevel.getStartLevel(); + int nextLevel = currentBundleStartLevel + 1; + Enumeration<URL> bundleJars = + context.getBundle().findEntries("platform-bundles", "*.jar", true); + Set<MavenArtifactDesc> artDescs = new HashSet<MavenArtifactDesc>(); + + while (bundleJars.hasMoreElements()) { + MavenArtifactDesc artDesc = + MavenArtifactDesc.parseFromURL(bundleJars.nextElement()); + artDescs.add(artDesc); + } + ClerezzaApp.installBundles(context, artDescs, nextLevel); + + final int newStartLevel = + originalStartLevel > nextLevel + 1 ? originalStartLevel : nextLevel + 1; + startLevel.setStartLevel(newStartLevel); + if (startLevel.getInitialBundleStartLevel() < nextLevel + 1) { + startLevel.setInitialBundleStartLevel(nextLevel + 1); + } + System.out.println("uninstalling platform launcher"); + context.getBundle().uninstall(); + } + + @Override + public void stop(BundleContext context) throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaApp.java ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaApp.java b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaApp.java new file mode 100644 index 0000000..cbe8636 --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ClerezzaApp.java @@ -0,0 +1,479 @@ +/* + * 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.launcher; + +import java.io.IOException; +import java.io.PrintWriter; +import java.security.AllPermission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; +import java.security.ProtectionDomain; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.TreeSet; +import org.apache.felix.framework.Felix; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.FrameworkEvent; +import org.osgi.framework.ServiceReference; +import org.osgi.service.startlevel.StartLevel; +import org.wymiwyg.commons.util.arguments.AnnotatedInterfaceArguments; +import org.wymiwyg.commons.util.arguments.ArgumentHandler; +import org.wymiwyg.commons.util.arguments.ArgumentProcessor; +import org.wymiwyg.commons.util.arguments.InvalidArgumentsException; +import org.wymiwyg.commons.util.dirbrowser.PathNameFilter; +import org.wymiwyg.commons.util.dirbrowser.PathNode; +import org.wymiwyg.commons.util.dirbrowser.PathNodeFactory; + +/** + * Clerezza Launcher Application. + * + * + * @author daniel, reto + */ +public class ClerezzaApp { + + private Felix felixInstance = null; + private int exitCode = -1; + private List<ShutdownListener> shutdownListeners = + new ArrayList<ShutdownListener>(1); + + /** + * Install bundles after core framework launch. + * + * @param context the bundle context. + * @param artDescs the bundles to install. + * @param nextLevel the start level to change to after the installation. + * + * @return the installed bundles. + * + */ + static Set<Bundle> installBundles(BundleContext context, + Collection<MavenArtifactDesc> artDescs, + int nextLevel) throws IOException, BundleException { + + Set<Bundle> installedBundles = new HashSet<Bundle>(); + for (MavenArtifactDesc artDesc : artDescs) { + try { + final Bundle installedBundle = context.installBundle(artDesc.toString(), artDesc.getInputStream()); + installedBundles.add(installedBundle); + } catch (BundleException e) { + System.out.println(e.toString()); + } + } + + ServiceReference startLevelRef = + context.getServiceReference(StartLevel.class.getName()); + StartLevel startLevel = (StartLevel) context.getService(startLevelRef); + for (Bundle bundle : installedBundles) { + startLevel.setBundleStartLevel(bundle, nextLevel); + } + return installedBundles; + } + + /** + * Set Clerezza Instance system exit code. + * + * @param code the code to set. + */ + public void setExitCode(int code) { + exitCode = code; + } + + /** + * Get Clerezza Instance system exit code. + * + * @return the exit code. + */ + public int getExitCode() { + return exitCode; + } + + /** + * Add a shutdown listener. + * + * @param shutdownListener the shutdown listener. + */ + public void addShutdownListener(ShutdownListener shutdownListener) { + shutdownListeners.add(shutdownListener); + } + + /** + * Remove a shutdown Listener. + * + * @param shutdownListener the shutdown listener. + */ + public void removeShutdownListener(ShutdownListener shutdownListener) { + shutdownListeners.remove(shutdownListener); + } + + /** + * Start this Clerezza Instance. + * + * Starts the Felix framework and installs CLerezza Bundles. + * + * This method exits after installing all bundles. + * It does not wait for the bundle installations to complete. + * + * @param args Command line arguments. + */ + public void start(String... args) throws Throwable { + LauncherArguments arguments; + try { + final ArgumentHandler argumentHandler = new ArgumentHandler(args); + arguments = argumentHandler.getInstance(LauncherArguments.class); + argumentHandler.processArguments(new ArgumentProcessor() { + + @Override + public void process(List<String> remaining) throws InvalidArgumentsException { + if (remaining.size() > 0) { + throw new InvalidArgumentsException("The following arguments could not be understood: " + remaining); + } + } + }); + } catch (InvalidArgumentsException e) { + System.out.println(e.getMessage()); + showUsage(); + return; + } + if (arguments.getHelp()) { + showUsage(); + return; + } + start(arguments); + } + + private void start(LauncherArguments arguments) throws Throwable { + Properties configProps = getConfigProps(arguments); + Policy.setPolicy(new Policy() { + + @Override + public PermissionCollection getPermissions(ProtectionDomain domain) { + PermissionCollection result = new Permissions(); + result.add(new AllPermission()); + return result; + } + }); + System.setSecurityManager(new SecurityManager()); + felixInstance = new Felix(configProps); + System.out.println("starting felix"); + felixInstance.start(); + final String revertParam = arguments.getRevertParam(); + final PathNode bundlesRoot = PathNodeFactory.getPathNode(Main.class.getResource("/bundles")); + final BundleContext bundleContext = felixInstance.getBundleContext(); + installBundlesForStartLevels(bundleContext, bundlesRoot, revertParam); + } + + /** + * Stop this Clerezza instance. + * + * This method does not wait for the shutdown to complete before it exits. + */ + public void stop() throws Throwable { + if (felixInstance != null) { + felixInstance.stop(); + } + } + + /** + * Wait for this Clerezza instance to shut down. + * + * After shut down all shutdown listeners are notified. + */ + public void waitForStop() throws Throwable { + FrameworkEvent event = null; + try { + if (felixInstance != null) { + event = felixInstance.waitForStop(0); + } + setExitCode(0); + } catch (Throwable t) { + setExitCode(-1); + event = new FrameworkEvent(FrameworkEvent.ERROR, null, t); + throw t; + } finally { + notifyShutdownListeners(event); + } + } + + private void notifyShutdownListeners(FrameworkEvent event) { + for (ShutdownListener shutdownListener : shutdownListeners) { + shutdownListener.notify(event); + } + } + + private void installBundlesForStartLevels(final BundleContext bundleContext, + final PathNode bundlesRoot, final String revertParam) throws IOException, BundleException { + final String startlevelpathprefix = "startlevel-"; + final String[] startLevelePaths = bundlesRoot.list(new PathNameFilter() { + + @Override + public boolean accept(PathNode dir, String name) { + return name.startsWith(startlevelpathprefix); + } + }); + Arrays.sort(startLevelePaths); + final Bundle[] installedBundles = bundleContext.getBundles(); + final Set<Bundle> newlyInstalledBundles = new HashSet<Bundle>(); + byte startLevel = 0; + for (String startLevelPath : startLevelePaths) { + startLevel = Byte.parseByte( + startLevelPath.substring(startlevelpathprefix.length(), + startLevelPath.length() - 1)); + final PathNode startLevelPathNode = bundlesRoot.getSubPath(startLevelPath); + Set<MavenArtifactDesc> artDescs = getArtDescsFrom(startLevelPathNode); + if (revertParam != null) { + artDescs = getRevertArtifacts(revertParam, artDescs, installedBundles); + } + if (!alreadyInstalled(artDescs, installedBundles) || revertParam != null) { + newlyInstalledBundles.addAll(installBundles(bundleContext, new TreeSet(artDescs), startLevel)); + System.out.println("level " + startLevel + " bundles installed"); + } + } + + for (Bundle bundle : newlyInstalledBundles) { + try { + bundle.start(); + } catch (BundleException e) { + System.out.println("Exception installing Bundle " + bundle + ": " + e.toString()); + } + } + + ServiceReference startLevelRef = + bundleContext.getServiceReference(StartLevel.class.getName()); + StartLevel startLevelService = (StartLevel) bundleContext.getService(startLevelRef); + startLevelService.setInitialBundleStartLevel(startLevel + 1); + startLevelService.setStartLevel(startLevel + 20); + } + + private Set<MavenArtifactDesc> getArtDescsFrom(PathNode pathNode) { + Set<MavenArtifactDesc> result = new HashSet<MavenArtifactDesc>(); + List<PathNode> jarPaths = getJarPaths(pathNode); + for (PathNode jarPath : jarPaths) { + result.add(MavenArtifactDesc.parseFromPath(jarPath)); + } + + return result; + } + + private List<PathNode> getJarPaths(PathNode pathNode) { + List<PathNode> result = new ArrayList<PathNode>(); + for (String childName : pathNode.list()) { + PathNode childNode = pathNode.getSubPath(childName); + if ((!childNode.isDirectory()) && (childName.endsWith(".jar"))) { + result.add(childNode); + } else { + for (PathNode subPath : getJarPaths(childNode)) { + result.add(subPath); + } + } + } + return result; + } + + /** + * Returns true if a bundle is found, whose location starts with a short URI + * ("mvn:[groupId]/[artifactId]") of a Maven Artifact specified. + * + * Returns false iff none of the specified Maven Artifacts is installed. + * + * @param artDescs MavenArtifacts to be checked if a corresponding bundle is + * already installed + * @param installedBundles Bundles installed in the framework + * @return + */ + private boolean alreadyInstalled(Set<MavenArtifactDesc> artDescs, + Bundle[] installedBundles) { + for (int i = 0; i < installedBundles.length; i++) { + String bundleLocation = installedBundles[i].getLocation(); + for (Iterator<MavenArtifactDesc> it = artDescs.iterator(); it.hasNext();) { + MavenArtifactDesc mavenArtifactDesc = it.next(); + if (bundleLocation.matches(mavenArtifactDesc.getShortUri() + "/.*[0-9].*")) { + return true; + } + } + } + return false; + } + + /** + * Returns the Maven Artifacts that have to be reverted to default. + * If the revertParam equals "all", then all platform bundles already installed + * are uninstalled and the returned <code>Set</code> contains all + * Maven Artifacts. + * If the revertParam is a regular expression, then the returned <code>Set</code> + * contains all Maven Artifacts, whose short URI matches the expression. If + * a corresponding bundle is installed, then it is uninstalled. + * If the revertParam equals "missing" then the returned <code>Set</code> + * contains all Maven Artifacts that are not installed. + * @param revertParam + * @param artDescs + * @param installedBundles + * @return + * @throws org.osgi.framework.BundleException + */ + private Set<MavenArtifactDesc> getRevertArtifacts(String revertParam, + Set<MavenArtifactDesc> artDescs, + Bundle[] installedBundles) throws BundleException { + boolean installMissing = revertParam.toLowerCase().equals("missing"); + if (revertParam.equals("all")) { + revertParam = ".*"; + } + Set<MavenArtifactDesc> artsToBeInstalled = new HashSet<MavenArtifactDesc>(); + for (Iterator<MavenArtifactDesc> it = artDescs.iterator(); it.hasNext();) { + MavenArtifactDesc mavenArtifactDesc = it.next(); + boolean isInstalled = false; + if (mavenArtifactDesc.getShortUri().matches(revertParam) || installMissing) { + for (int i = 0; i < installedBundles.length; i++) { + Bundle bundle = installedBundles[i]; + if (bundle.getLocation().matches(mavenArtifactDesc.getShortUri() + "/.*[0-9].*")) { + if (installMissing) { + isInstalled = true; + } else { + bundle.uninstall(); + } + } + } + if (!installMissing || (installMissing && !isInstalled)) { + artsToBeInstalled.add(mavenArtifactDesc); + } + } + } + return artsToBeInstalled; + } + + /** + * Prints usage instructions to stdout + */ + public static void showUsage() { + System.out.print("Usage: LaunchBundle "); + System.out.println(AnnotatedInterfaceArguments.getArgumentsSyntax(LauncherArguments.class)); + PrintWriter out = new PrintWriter(System.out, true); + AnnotatedInterfaceArguments.printArgumentDescriptions( + LauncherArguments.class, out); + out.flush(); + } + + + private Properties getConfigProps(LauncherArguments arguments) { + + Properties configProps = new Properties(); + + configProps.putAll(System.getProperties()); + //ignored as we're setting the starlevel manually to last used start-level + 20 + //configProps.put("org.osgi.framework.startlevel.beginning", "20"); + { + if (arguments.getNotConsoleShell()) { + configProps.put("clerezza.shell.disable", + "true"); + } + } + + { + String argLogLevel = arguments.getLogLevel(); + if (argLogLevel == null) { + argLogLevel = "INFO"; + } + System.out.println("setting log-level to: " + argLogLevel); + configProps.put("org.ops4j.pax.logging.DefaultServiceLog.level", + argLogLevel); + } + { + final String port = arguments.getPort(); + if (port != null) { + configProps.put("org.osgi.service.http.port", port); + } + configProps.put("org.ops4j.pax.url.mvn.repositories", getCommaSeparatedListOfMavenRepos()); + } + + { + //sun.reflect added because of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6265952 and loading of scala scripts + String extraPackages = (String) configProps.get("org.osgi.framework.system.packages.extra"); + if (extraPackages == null) { + extraPackages = "sun.misc;sun.reflect"; + } else { + extraPackages = "sun.misc;sun.reflect;"+extraPackages; + } + configProps.put("org.osgi.framework.system.packages.extra",extraPackages); + } + + //public static final String CONTEXT_PROPERTY_HTTP_PORT_SECURE = ""; + boolean httpsEnabled = false; + { + + final String httpsPort = arguments.getSecurePort(); + if (httpsPort != null && !"".equals(httpsPort)) { + configProps.put("org.osgi.service.http.port.secure", httpsPort); + httpsEnabled = true; + } + } + { + + final String keyStorePath = arguments.getKeyStorePath(); + if (keyStorePath != null && !"".equals(keyStorePath)) { + configProps.put("org.wymiwyg.jetty.httpservice.https.keystore.path", keyStorePath); + httpsEnabled = true; + } + } + { + + final String keyStorePassword = arguments.getKeyStorePassword(); + if (keyStorePassword != null && !"".equals(keyStorePassword)) { + configProps.put("org.wymiwyg.jetty.httpservice.https.keystore.password", keyStorePassword); + httpsEnabled = true; + } + } + { + + final String keyStoreType = arguments.getKeyStoreType(); + if (keyStoreType != null && !"".equals(keyStoreType)) { + configProps.put("org.wymiwyg.jetty.httpservice.https.keystore.type", keyStoreType); + httpsEnabled = true; + } + } + + { + + final String clientAuth = arguments.getClientAuth(); + if (clientAuth != null && !"".equals(clientAuth)) { + configProps.put("org.wymiwyg.jetty.httpservice.clientauth", clientAuth); + httpsEnabled = true; + } + } + + if (httpsEnabled) { + configProps.put("org.osgi.service.http.secure.enabled", "true"); + } + return configProps; + + } + + private String getCommaSeparatedListOfMavenRepos() { + return "http://repository.apache.org/content/groups/snapshots-group@snapshots@noreleases@id=apache-snapshots," + + "http://repo1.maven.org/maven2/@id=central"; + } +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/LauncherArguments.java ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/LauncherArguments.java b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/LauncherArguments.java new file mode 100644 index 0000000..fb99d3b --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/LauncherArguments.java @@ -0,0 +1,70 @@ +/* + * 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.launcher; + +import org.wymiwyg.commons.util.arguments.CommandLine; + +/** + * + * @author mir + */ +public interface LauncherArguments { + + @CommandLine(longName = "revert", shortName = {"R"}, required = false, + description = "Command to revert platform bundles to default. all|missing|<bundle-uri-pattern>") + public String getRevertParam(); + + @CommandLine(longName = "help", shortName = {"H"}, required = false, + isSwitch = true, description = "Show help on command line arguments") + public boolean getHelp(); + + @CommandLine(longName = "log", shortName = {"L"}, required = false, + description = "set the log-level, the value is one of the following: " + + "TRACE, DEBUG, INFO, WARN, ERROR, FATAL, or NONE") + public String getLogLevel(); + + @CommandLine(longName = "port", shortName = {"P"}, required = false, + description = "The port on which the default webservice shall listen") + public String getPort(); + + @CommandLine(longName = "https_port", shortName = {}, required = false, + description = "The port on which the https secure webserver shall listen") + public String getSecurePort(); + + @CommandLine(longName = "https_keystore_path", shortName = {}, required = false, + description = "The folder with the keystore for https") + public String getKeyStorePath(); + + @CommandLine(longName = "https_keystore_password", shortName = {}, required = false, + description = "The password for accessing the keystore for https") + public String getKeyStorePassword(); + + @CommandLine(longName = "https_keystore_type", shortName = {}, required = false, + description = "The type of the key-store") + public String getKeyStoreType(); + + @CommandLine(longName = "https_keystore_clientauth", shortName = {}, required = false, + description = "Client Auth request, one of \"none\", \"want\" or \"need\"") + public String getClientAuth(); + + @CommandLine(longName = "noConsoleShell", shortName = {"NCS"}, required = false, + isSwitch = true, description = "Disable the console shell") + public boolean getNotConsoleShell(); + +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/Main.java ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/Main.java b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/Main.java new file mode 100644 index 0000000..cfa3366 --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/Main.java @@ -0,0 +1,48 @@ +/* + * 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.launcher; + +import java.io.IOException; + +/** + * Clerezza Application launcher class. + * + * @author daniel + */ +public class Main { + + public static void main(String... args) throws IOException { + ClerezzaApp clerezza = new ClerezzaApp(); + + try { + clerezza.start(args); + } catch (Throwable t) { + System.err.println("Could not start Clerezza: " + t); + t.printStackTrace(); + System.exit(clerezza.getExitCode()); + } + try { + clerezza.waitForStop(); + } catch (Throwable t) { + System.err.println("Exception during Clerezza shutdown: " + t); + t.printStackTrace(); + System.exit(-1); + } + } +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/MavenArtifactDesc.java ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/MavenArtifactDesc.java b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/MavenArtifactDesc.java new file mode 100644 index 0000000..c8a02bc --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/MavenArtifactDesc.java @@ -0,0 +1,147 @@ +/* + * 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.launcher; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import org.wymiwyg.commons.util.dirbrowser.PathNode; + +/** + * Maven Artifact Description + * + * @author daniel + */ +class MavenArtifactDesc implements Comparable<MavenArtifactDesc> { + + //one of these is null + URL bundleUrl; + PathNode pathNode; + String groupId; + String artifactId; + String version; + + /** + * Constructor with bundle URL. + * + * @param groupId the group id. + * @param artifactId the artifact id. + * @param version the version. + * @param bundleUrl the bundle URL. + */ + MavenArtifactDesc(String groupId, String artifactId, String version, URL bundleUrl) { + this.groupId = groupId; + this.artifactId = artifactId; + this.version = version; + this.bundleUrl = bundleUrl; + } + + /** + * Constructor with bundle path. + * + * @param groupId the group id. + * @param artifactId the artifact id. + * @param version the version. + * @param pathNode the bundle path node. + */ + MavenArtifactDesc(String groupId, String artifactId, String version, PathNode pathNode) { + this.groupId = groupId; + this.artifactId = artifactId; + this.version = version; + this.pathNode = pathNode; + } + + /** + * Parse Maven Artifact Description from an URL. + * + * @param bundleUrl the URL. + * @return A new MavenArtifactDesc object. + */ + static MavenArtifactDesc parseFromURL(URL bundleUrl) { + String string = bundleUrl.toString(); + int posSlashM1 = string.lastIndexOf('/'); + int posSlashM2 = string.lastIndexOf('/', posSlashM1 - 1); + int posSlashM3 = string.lastIndexOf('/', posSlashM2 - 1); + String version = string.substring(posSlashM2 + 1, posSlashM1); + String artifactId = string.substring(posSlashM3 + 1, posSlashM2); + String groupId = getGroupId(string.substring(0, posSlashM3)); + return new MavenArtifactDesc(groupId, artifactId, version, bundleUrl); + } + + /** + * Parse Maven Artifact Description from a path node. + * + * @param pathNode The path node. + * @return A new MavenArtifactDesc object. + */ + static MavenArtifactDesc parseFromPath(PathNode pathNode) { + String string = pathNode.getPath(); + int posSlashM1 = string.lastIndexOf('/'); + int posSlashM2 = string.lastIndexOf('/', posSlashM1 - 1); + int posSlashM3 = string.lastIndexOf('/', posSlashM2 - 1); + String version = string.substring(posSlashM2 + 1, posSlashM1); + String artifactId = string.substring(posSlashM3 + 1, posSlashM2); + String groupId = getGroupId(string.substring(0, posSlashM3)); + return new MavenArtifactDesc(groupId, artifactId, version, pathNode); + } + + /** + * Assembles group-id from the diretories after "bundles/" + * + * @param string a path-string. Must contain "bundles/". + */ + static String getGroupId(String string) { + int startPos = string.indexOf("bundles/") + 8; + startPos = string.indexOf('/', startPos) + 1; + return string.substring(startPos).replace('/', '.'); + } + + /** + * Returns an URI in the form "mvn:groupId/artifactId/version" + * + * @return the URI. + */ + public String getShortUri() { + return "mvn:" + groupId + "/" + artifactId; + } + + /** + * Returns a string representation of this object in the form + * "mvn:groupId/artifactId/version" + * + * @return the string representation of this Maven Artifact Description. + */ + @Override + public String toString() { + return "mvn:" + groupId + "/" + artifactId + "/" + version; + } + + InputStream getInputStream() throws IOException { + if (bundleUrl == null) { + return pathNode.getInputStream(); + } + return bundleUrl.openStream(); + } + + @Override + public int compareTo(MavenArtifactDesc o) { + return toString().compareTo(o.toString()); + } +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ShutdownListener.java ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ShutdownListener.java b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ShutdownListener.java new file mode 100644 index 0000000..1d406ce --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/main/java/org/apache/clerezza/platform/launcher/ShutdownListener.java @@ -0,0 +1,38 @@ +/* + * 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.launcher; + +import org.osgi.framework.FrameworkEvent; + +/** + * A listener that gets notified when the Felix Framework is shut down. + * + * @author daniel + */ +public interface ShutdownListener { + + /** + * Notify listener of complete Clerezza shut down. + * + * @param event + * What event caused the shutdown. Note: event may be null. + */ + public void notify(FrameworkEvent event); +} http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/images/tut_1_class_diagram.png ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/images/tut_1_class_diagram.png b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/images/tut_1_class_diagram.png new file mode 100644 index 0000000..0bd04f4 Binary files /dev/null and b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/images/tut_1_class_diagram.png differ http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/style/style.css ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/style/style.css b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/style/style.css new file mode 100644 index 0000000..ff49a4d --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/documentation/style/style.css @@ -0,0 +1,421 @@ +/* + * + * 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. + * +*/ + +/*--------------------------------------------------------------------------- + * Two- and three-column layout + */ + +#banner { + top: 0px; + left: 0px; + right: 0px; + height: 116px; +} + +#left { + position: absolute; + z-index: 2; + left: 8px; + width: 184px; + top: 125px; + bottom: 8px; + margin: 0px; + padding: 0px; +} + +#right { + position: absolute; + z-index: 1; + right: 8px; + width: 184px; + top: 125px; + bottom: 8px; + margin: 0px; + padding: 0px; +} + +.Content3Column { + position: absolute; + top: 125px; + bottom: 8px; + left: 208px; + right: 216px; +} + +.Content2Column { + position: absolute; + top: 125px; + bottom: 8px; + left: 208px; + right: 16px; +} + +#center { + z-index: 3; + margin: 0px; + border: none; + padding-bottom: 8px; +} + + +/*--------------------------------------------------------------------------- + * Default element styles + */ + +body { + padding: 0px; + margin: 0px; + border: 0px; + + font-family: helvetica, arial, sans-serif; + font-size: 12px; + + background-color: white; + color: black; +} + +h1, h2, h3, h4, h5, h6 { + margin: 0px; + border: 0px; + padding: 0px; + font-weight: normal; +} + +a:link { color: #008DA8; } +a:active { color: #FE5400; } +a:hover { color: #FE5400; } +a:visited { color: black; } + +iframe { + width:100%; + height: 800px; + border: 0px; +} + +img { + border: 0px; + padding: 0px; + margin: 0px; +} + +p { + border: 0px; + padding: 0px; + margin: 0px; + margin-bottom: 10px; +} + +blockquote { + margin-bottom: 10px; +} + +td { + font-size: 12px; + padding: 2px; +} + +tr.a { + background-color: #e0e0e0; +} +tr.b { + background-color: #ffffff; +} + +th { + font-size: 12px; + font-weight: bold; + white-space: nowrap; + padding: 2px; +} + +th.Row { + text-align: left; + vertical-align: top; +} + +ul, ol { + border: 0px; + padding: 0px; + margin-top: 0px; + margin-bottom: 12px; + margin-left: 20px; +} + + +/*--------------------------------------------------------------------------- + * Page banner + */ + +#banner { + margin: 0px; + border: 0px; + border-bottom: 1px solid #008DA8; + padding: 0px; + background-color: #e0e0e0; + color: #008DA8; + vertical-align: bottom; +} + +#banner a { text-decoration: none; } +#banner a:visited { color: #008DA8; } +#banner a:hover { color: #FE5400; } +#banner a:active { color: #FE5400; } + +#logo { + position: absolute; + top: 5px; + left: 8px; +} + +#versions { + position: absolute; + width: auto; + right: 0px; + top: 0px; + margin: 8px; + font-weight: normal; +} + +/*--------------------------------------------------------------------------- + * Page content + */ + +#content { + margin: 0px; + background-color: white; + color: black; + height: 100%; +} + +#content h1 { + width: 100%; + font-size: 18px; + background-color: #008DA8; + color: white; + padding: 2px; + padding-left: 6px; + margin-top: 24px; + margin-bottom: 12px; +} + +#content .FirstChild { /* IE doesn't understand first-child pseudoelement */ + margin-top: 0px; +} + +#content a { text-decoration: underline; } +#content a:link { color: #008DA8; } +#content a:visited { color: #008DA8; } +#content a:active { color: #FE5400; } +#content a:hover { color: #FE5400; } + +#content h2 { + margin-top: 24px; + border-top: 1px solid #008DA8; + margin-bottom: 16px; + font-size: 15px; + font-weight: bold; + background-color: #e0e0e0;; + padding: 2px; +} + +#content li { + margin-bottom: 6px; +} + +#content th { + background-color: #e0e0e0; +} + +#content td { + +} + +.Source pre { + padding: 4px; + font-family: courier new, monospace; + font-size: 11px; + border: 1px solid #008DA8; + background-color: #e0e0e0; + color: black; +} + +.Source:before { + margin: 0px; + padding: 0px; + border: 0px; + font-size: inherit; + line-spacing: 100%; +} + +.highlight { + background-color: #e0e0e0; + border: 1px dotted #008DA8; + padding: 5px; +} + +/* The following are for images, but can also apply to div's containing images. */ + +#content .Float { + float: right; + margin-left: 8px; + margin-right: 0px; + margin-top: 8px; + margin-bottom: 8px; +} + +#content .Diagram { + display: block; + margin-left: auto; + margin-right: auto; + margin-top: 8px; + margin-bottom: 8px; +} + + +#content .Inline { + display: inline; +} + +.RuleOfThumb { + font-weight: bold; +} + +/*--------------------------------------------------------------------------- + * Side panels + */ + +.SidePanel { + background-color: white; + padding: 0px; + font-size: 11px; +} + +.SidePanel h1 { + margin: 0px; + border: 0px; + padding: 4px; + + color: #008DA8; + + font-size: 12px; + font-weight: bold; +} + + +.SidePanel a { text-decoration: none; } +.SidePanel a:link { color: #000000; } +.SidePanel a:visited { color: #000000; } +.SidePanel a:active { color: #FE5400; } +.SidePanel a:hover { color: #FE5400; } + +/*--------------------------------------------------------------------------- + * Menus + */ + +.MenuGroup { + border-left: 1px solid #A3DAE6; + border-top: 1px solid #A3DAE6; + border-bottom: 1px solid white; /* IE work-around */ + + margin-bottom: 8px; + background-color: white; + color: #008DA8; +} + +.MenuGroup ul { + margin: 0px; + padding-left: 4px; + list-style-type: none; +} + +.MenuGroup li { + padding: 2px; +} + +.MenuGroup .currentLink { +/* background-color: #060;*/ + background-color: #e0e0e0; + color: #008DA8; +} + + +/*--------------------------------------------------------------------------- + * News panel + */ + +.NewsGroup { + border-left: 1px solid #A3DAE6; + border-top: 1px solid #A3DAE6; + border-bottom: 1px solid white; /* IE workaround */ + margin-bottom: 8px; + + color: #008DA8; +} + +.NewsItem { + margin: 4px; +} + +.NewsDate { + font-weight: bold; + margin: 0px; + padding: 0px; +} + +.NewsText { + padding: 0px; + margin: 0px; + margin-bottom: 8px; +} + +.NewsText a { text-decoration: underline; } +.NewsText a:link { color: #008DA8; } +.NewsText a:visited { color: #008DA8; } +.NewsText a:active { color: #FE5400; } +.NewsText a:hover { color: #FE5400; } + +.NewsMore { + font-size: smaller; + margin: 4px; + margin-top: 8px; + text-align: left; +} + +.NewsGroup td { + font-size: 12px; +} + +/*--------------------------------------------------------------------------- + * Document meta-information + */ + +.Meta { + margin-top: 64px; + font-size: smaller; + color: #008DA8; + text-align: right; +} + +.Meta a { text-decoration: underline; } +.Meta a:link { color: #008DA8; } +.Meta a:visited { color: #008DA8; } +.Meta a:active { color: #FE5400; } +.Meta a:hover { color: #FE5400; } http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/images/clerezza.png ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/images/clerezza.png b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/images/clerezza.png new file mode 100644 index 0000000..cb0efb0 Binary files /dev/null and b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/resources/images/clerezza.png differ http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/site.xml ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/site.xml b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/site.xml new file mode 100644 index 0000000..8d5a4cb --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/site.xml @@ -0,0 +1,30 @@ +<?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. + */ +--> + +<project> + <body> + <menu name="Documentation"> + <item name="Usage" href="documentation/usage.xhtml"/> + </menu> + </body> +</project> http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/sitemap.xml ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/sitemap.xml b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/sitemap.xml new file mode 100644 index 0000000..38be885 --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/sitemap.xml @@ -0,0 +1,28 @@ +<?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. + +--> + +<sitemap> + <section> + <name>Documentation</name> + <page>usage.xhtml</page> + </section> +</sitemap> http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/usage.xhtml ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/usage.xhtml b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/usage.xhtml new file mode 100644 index 0000000..4db0157 --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/content/usage.xhtml @@ -0,0 +1,180 @@ +<?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. + */ +--> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us"> + <head> + <title>Usage: How to launch the clerezza platform</title> + </head> + <body> + <h1>Usage: How to launch the clerezza platform</h1> + <p>Author: Daniel Spicar, Tsuyoshi Ito - clerezza.org</p> + <p>Date: March 25, 2009</p> + <h2 id="download">1. Download the launcher</h2> + <p> + The latest snapshots of the launcher can be found on: + <br /> + <br /> + <a href="http://repo.trialox.org/snapshot/org/apache/clerezza/org.apache.clerezza.platform.launcher/" target="_blank"> + http://repo.trialox.org/snapshot/org/apache/clerezza/org.apache.clerezza.platform.launcher/ + </a> + <br /> + <br /> + or get a stable release from: + <br /> + <br /> + <a href="http://repo.trialox.org/release/org/apache/clerezza/org.apache.clerezza.platform.launcher/" target="_blank"> + http://repo.trialox.org/release/org/apache/clerezza/org.apache.clerezza.platform.launcher/ + </a> + <br /> + <br /> + (e.g. org.apache.clerezza.platform.launcher-0.2-20090421.105711-13.jar from <a href="http://repo.trialox.org/snapshot/org/apache/clerezza/org.apache.clerezza.platform.launcher/0.2-SNAPSHOT/" target="_blank"> + http://repo.trialox.org/snapshot/org/apache/clerezza/org.apache.clerezza.platform.launcher/0.2-SNAPSHOT/ + </a>). + </p> + <h2 id="run">2. Run the platform</h2> + <p> + Execute the jar by typing + the following into a console: + </p> + <pre> + <code>$ java -Dorg.ops4j.pax.logging.DefaultServiceLog.level=ERROR -jar '/path/to/org.apache.clerezza.platform.launcher-0.2-20090421.105711-13.jar'</code> + </pre> + <p> + This will launch the platform and send the logger output from the + level ERROR and above to the console. + If problems are encountered, make sure the jar archive is executeable. + In a desktop environment like Microsoft Windows it can be enough to + double click the file in order to launch it. + <br /> + If the platform was launched in the console, hit the return key to get a promt (->). + The loaded bundles and their state can be checked by typing: + </p> + <pre> + <code> + -> ps + </code> + </pre> + <p> + The output should look like this: + </p> + <pre> + <code> + START LEVEL 30 + ID State Level Name + [ 0] [Active ] [ 0] System Bundle (1.4.1) + [ 1] [Resolved ] [ 1] Clerezza - Platform Security Conditions (0.2.0.SNAPSHOT) + [ 2] [Active ] [ 2] Apache Felix Bundle Repository (1.2.1) + [ 3] [Active ] [ 2] Apache Felix Configuration Admin Service (1.0.10) + ... + + + <strong>[ 28] [Active ] [ 3] Clerezza - Platform Account Control Panel (0.3.0.SNAPSHOT)</strong> + <strong>[ 29] [Active ] [ 3] Clerezza - Platform Content (0.7.0.SNAPSHOT)</strong> + <strong>[ 30] [Active ] [ 3] Clerezza - Platform Template Manager (0.2.0.SNAPSHOT)</strong> + <strong>[ 32] [Active ] [ 3] Clerezza - Platform Type Handler Space (0.2.0.SNAPSHOT)</strong> + <strong>[ 33] [Active ] [ 3] Clerezza - Platform Usermanager and Rolemanager (0.7.0.SNAPSHOT)</strong> + ... + -> + </code> + </pre> + <p> + To see a list of available services type: + </p> + <pre> + <code> + -> scr list + </code> + </pre> + <p> + The output should look like this: + </p> + <pre> + <code> + Id State Name + [ 0] [active ] org.apache.clerezza.platform.security.PermissionManager + [ 1] [active ] org.apache.clerezza.platform.security.auth.AuthenticatingFilter + [ 2] [active ] org.apache.clerezza.jaxrs.rdf.providers.GraphReader + [ 3] [active ] org.apache.clerezza.jaxrs.rdf.providers.GraphWriter + + + ... + -> + </code> + </pre> + <p> + Now the platform can be accessed in a web browser by going to <i>http://localhost:8080/path_to_service/</i>, whereas <i>path_to_service</i> has to be replaced by the path to a service/module (when asked to authenticate use username "admin" and password "admin". The user account "admin" has all permissions). + <br />Try the following modules: + </p> + <ul> + <li><a href="http://localhost:8080/admin/user-manager/" target="_blank">http://localhost:8080/admin/user-manager/</a></li> + <li><a href="http://localhost:8080/admin/role-manager/" target="_blank">http://localhost:8080/admin/role-manager/</a></li> + <li><a href="http://localhost:8080/admin/template-manager/" target="_blank">http://localhost:8080/admin/template-manager/</a></li> + <li> + <a href="http://localhost:8080/user/admin/control-panel/" target="_blank"> + http://localhost:8080/user/admin/control-panel/ + </a> + (where <i>admin</i> can be the username of an arbitary user) + </li> + <li><a href="http://localhost:8080/tools/editor/" target="_blank">http://localhost:8080/tools/editor/</a></li> + </ul> + <p> + Check out the following sites for more information: + </p> + <ul> + <li> + <a href="http://clerezza.org/projects/org.apache.clerezza.platform.usermanager/" target="_blank"> + http://clerezza.org/projects/org.apache.clerezza.platform.usermanager/ + </a> + </li> + <li><a href="http://clerezza.org/projects/org.apache.clerezza.platform.accountcontrolpanel/" target="_blank">http://clerezza.org/projects/org.apache.clerezza.platform.accountcontrolpanel/</a></li> + <li><a href="http://clerezza.org/projects/org.apache.clerezza.platform.templating.manager/" target="_blank">http://clerezza.org/projects/org.apache.clerezza.platform.templating.manager/</a></li> + <li><a href="http://clerezza.org/projects/org.apache.clerezza.platform.content/" target="_blank">http://clerezza.org/projects/org.apache.clerezza.platform.content/</a></li> + </ul> + <h2 id="shutdown">3. Shutdown the platform</h2> + <p> + The platform can be stopped by typing: + </p> + <pre> + <code> + -> shutdown + </code> + </pre> + + <h2 id="shutdown">4. Felix webconsole</h2> + <p> + As an alternative to the command-line interface Felix also provides + a web-based management interface available by default at + <a href="http://localhost:8080/system/console">http://localhost:8080/system/console</a>. + The port at which the console is accessible can be set with the + <code>org.osgi.service.http.port</code> system property. + </p> + <pre> + <code>$ java -Dorg.osgi.service.http.port=8383 -jar '/path/to/org.apache.clerezza.platform.launcher-0.2-20090421.105711-13.jar'</code> + </pre> + <p> + Starting the platform as above the web-console will be available on + port 8383, note that this has no impact on the port of the plaftform's + webserver which by default listens to port 8080. + </p> + </body> +</html> + http://git-wip-us.apache.org/repos/asf/clerezza/blob/74fe1745/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/templates/skin.html ---------------------------------------------------------------------- diff --git a/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/templates/skin.html b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/templates/skin.html new file mode 100644 index 0000000..bb1b45d --- /dev/null +++ b/platform.launcher.storageless.parent/platform.launcher.storageless/src/site/xsite/templates/skin.html @@ -0,0 +1,71 @@ +<!-- + + 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. + +--> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>clerezza.org - ${title}</title> + <link rel="stylesheet" type="text/css" href="style/style.css"/> + ${head} + </head> + <body> + + <div id="banner"> + <a href="http://clerezza.org/"> + <img id="logo" src="../images/clerezza.png" alt="clerezza.org"/> + </a><br /> + </div> + + <div id="center" class="${centerClass}"> + <div id="content"> + <!-- <h1 class="FirstChild">${title}</h1> --> + ${body} + <p>Copyright (c) 2008-2009 trialox.org (trialox AG, Switzerland)</p> + <br /><br /> + </div> + </div> + + <div class="SidePanel" id="left"> + <#list sitemap.sections as section> + <div class="MenuGroup"> + <h1>${section.name}</h1> + <ul> + <#list section.entries as entry> + <#if entry = page> + <li class="currentLink">${entry.title}</li> + <#else> + <li><a href="${entry.href}">${entry.title}</a></li> + </#if> + </#list> + </ul> + </div> + </#list> + <div class="MenuGroup"> + <h1>Project Site</h1> + <ul> + + <li><a href="../index.html">Back to project site</a></li> + </ul> + </div> + </div> + + </body> +</html>
