You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jg...@apache.org on 2012/01/26 16:00:58 UTC

svn commit: r1236220 - in /karaf/trunk: assemblies/apache-karaf/ demos/dump/ demos/dump/src/main/filtered-resources/ demos/dump/src/main/filtered-resources/resources/ demos/dump/src/main/filtered-resources/resources/demos/ demos/dump/src/main/filtered-...

Author: jgoodyear
Date: Thu Jan 26 15:00:57 2012
New Revision: 1236220

URL: http://svn.apache.org/viewvc?rev=1236220&view=rev
Log:
[KARAF-1098] Update Dump Provider demo

Refactor into new kar demo format.


Added:
    karaf/trunk/demos/dump/src/main/filtered-resources/
    karaf/trunk/demos/dump/src/main/filtered-resources/resources/
    karaf/trunk/demos/dump/src/main/filtered-resources/resources/demos/
    karaf/trunk/demos/dump/src/main/filtered-resources/resources/demos/dump/
    karaf/trunk/demos/dump/src/main/resources/resources/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/NOTICE
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/pom.xml   (with props)
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/demo/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/demo/ScreenshotDumpProvider.java   (with props)
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/blueprint/
    karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/blueprint/screenshot.xml   (with props)
Removed:
    karaf/trunk/demos/dump/NOTICE
    karaf/trunk/demos/dump/src/main/java/
    karaf/trunk/demos/dump/src/main/resources/OSGI-INF/
Modified:
    karaf/trunk/assemblies/apache-karaf/pom.xml
    karaf/trunk/demos/dump/pom.xml

Modified: karaf/trunk/assemblies/apache-karaf/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/assemblies/apache-karaf/pom.xml?rev=1236220&r1=1236219&r2=1236220&view=diff
==============================================================================
--- karaf/trunk/assemblies/apache-karaf/pom.xml (original)
+++ karaf/trunk/assemblies/apache-karaf/pom.xml Thu Jan 26 15:00:57 2012
@@ -93,6 +93,13 @@
         </dependency>
         <dependency>
             <groupId>org.apache.karaf.demos</groupId>
+            <artifactId>org.apache.karaf.demos.dump</artifactId>
+            <version>${project.version}</version>
+            <type>kar</type>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.demos</groupId>
             <artifactId>org.apache.karaf.demos.web</artifactId>
             <version>${project.version}</version>
             <type>kar</type>

Modified: karaf/trunk/demos/dump/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/dump/pom.xml?rev=1236220&r1=1236219&r2=1236220&view=diff
==============================================================================
--- karaf/trunk/demos/dump/pom.xml (original)
+++ karaf/trunk/demos/dump/pom.xml Thu Jan 26 15:00:57 2012
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<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/xsd/maven-4.0.0.xsd">
+<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/xsd/maven-4.0.0.xsd">
 
     <!--
 
@@ -25,33 +28,78 @@
         <groupId>org.apache.karaf.demos</groupId>
         <artifactId>demos</artifactId>
         <version>3.0.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>dump</artifactId>
-    <packaging>bundle</packaging>
+    <artifactId>org.apache.karaf.demos.dump</artifactId>
+    <packaging>pom</packaging>
     <name>Apache Karaf :: Demos :: Demo Dump provider</name>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.karaf.diagnostic</groupId>
-            <artifactId>org.apache.karaf.diagnostic.core</artifactId>
-        </dependency>
-    </dependencies>
-
+    <modules>
+        <module>src/main/resources/resources/demos/dump</module>
+        <!--<module>branding-package</module>-->
+    </modules>
     <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>false</filtering>
+                <excludes>
+                    <exclude>**/target/**</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>src/main/filtered-resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
+        </resources>
         <plugins>
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <!--<configuration>-->
+                    <!--<resources>-->
+                        <!--<resource>src/main/resources</resource>-->
+                    <!--</resources>-->
+                <!--</configuration>-->
+                <executions>
+                    <execution>
+                        <id>process-resources</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>resources</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>${project.version}</version>
                 <configuration>
-                    <instructions>
-                        <Import-Package>*</Import-Package>
-                        <Private-Package>!*</Private-Package>
-                    </instructions>
+                    <startLevel>60</startLevel>
+                    <!--<checkDependencyChange>true</checkDependencyChange>-->
+                    <!--<overwriteChangedDependencies>true</overwriteChangedDependencies>-->
+                    <!--<warnOnDependencyChange>true</warnOnDependencyChange>-->
                 </configuration>
+                <executions>
+                    <execution>
+                        <id>compile</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>features-generate-descriptor</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>package</id>
+                        <goals>
+                            <goal>features-create-kar</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
         </plugins>
     </build>
-
 </project>

Added: karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/NOTICE
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/NOTICE?rev=1236220&view=auto
==============================================================================
--- karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/NOTICE (added)
+++ karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/NOTICE Thu Jan 26 15:00:57 2012
@@ -0,0 +1,48 @@
+Apache Karaf
+Copyright 2010-2011 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0

Added: karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/pom.xml?rev=1236220&view=auto
==============================================================================
--- karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/pom.xml (added)
+++ karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/pom.xml Thu Jan 26 15:00:57 2012
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.demos</groupId>
+        <artifactId>demos</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+        <relativePath>../../../../../../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>dump</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Karaf :: Demos :: Demo Dump provider</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.karaf.diagnostic</groupId>
+            <artifactId>org.apache.karaf.diagnostic.core</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Propchange: karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/demo/ScreenshotDumpProvider.java
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/demo/ScreenshotDumpProvider.java?rev=1236220&view=auto
==============================================================================
--- karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/demo/ScreenshotDumpProvider.java (added)
+++ karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/demo/ScreenshotDumpProvider.java Thu Jan 26 15:00:57 2012
@@ -0,0 +1,60 @@
+/*
+ * 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.karaf.diagnostic.demo;
+
+import java.awt.DisplayMode;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.image.BufferedImage;
+import java.io.OutputStream;
+
+import javax.imageio.ImageIO;
+
+import org.apache.karaf.diagnostic.core.DumpDestination;
+import org.apache.karaf.diagnostic.core.DumpProvider;
+
+/**
+ * This demo provider creates images in dump destination which
+ * contains screenshots from all attached displays.
+ */
+public class ScreenshotDumpProvider implements DumpProvider {
+
+	/**
+	 * {@inheritDoc}
+	 */
+    public void createDump(DumpDestination destination) throws Exception {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        // get all graphic devices attached to computer
+        GraphicsDevice[] gs = ge.getScreenDevices();
+
+        // create dump entry for each device  
+        for (int i=0; i < gs.length; i++) {
+            DisplayMode mode = gs[i].getDisplayMode();
+            Rectangle bounds = new Rectangle(0, 0, mode.getWidth(), mode.getHeight());
+            BufferedImage screenshot = new Robot(gs[i]).createScreenCapture(bounds);
+
+            // to attach your entry to destination you have to execute this line
+            OutputStream outputStream = destination.add("screenshot/display_" + i + ".png");
+            ImageIO.write(screenshot, "PNG", outputStream);
+
+            outputStream.close();
+        }
+
+    }
+
+}

Propchange: karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/java/org/apache/karaf/diagnostic/demo/ScreenshotDumpProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/blueprint/screenshot.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/blueprint/screenshot.xml?rev=1236220&view=auto
==============================================================================
--- karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/blueprint/screenshot.xml (added)
+++ karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/blueprint/screenshot.xml Thu Jan 26 15:00:57 2012
@@ -0,0 +1,26 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="screenshotDump" class="org.apache.karaf.diagnostic.demo.ScreenshotDumpProvider" />
+
+    <service ref="screenshotDump" auto-export="interfaces" />
+
+</blueprint>
\ No newline at end of file

Propchange: karaf/trunk/demos/dump/src/main/resources/resources/demos/dump/src/main/resources/OSGI-INF/blueprint/screenshot.xml
------------------------------------------------------------------------------
    svn:eol-style = native