Author: [email protected]
Date: Mon Apr  4 09:44:14 2011
New Revision: 932

Log:
[sandbox] favicon: align to trunk version

Added:
   sandbox/bdekruijff/amdatu-web/
   sandbox/bdekruijff/amdatu-web/favicon/
   sandbox/bdekruijff/amdatu-web/favicon/pom.xml
   sandbox/bdekruijff/amdatu-web/favicon/src/
   sandbox/bdekruijff/amdatu-web/favicon/src/main/
   sandbox/bdekruijff/amdatu-web/favicon/src/main/java/
   sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/
   sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/
   sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/
   sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/
   
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/osgi/
   
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/osgi/Activator.java
   
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/service/
   
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/service/FaviconResourceProviderImpl.java
   sandbox/bdekruijff/amdatu-web/favicon/src/main/resources/
   sandbox/bdekruijff/amdatu-web/favicon/src/main/resources/favicon.ico   
(contents, props changed)

Added: sandbox/bdekruijff/amdatu-web/favicon/pom.xml
==============================================================================
--- (empty file)
+++ sandbox/bdekruijff/amdatu-web/favicon/pom.xml       Mon Apr  4 09:44:14 2011
@@ -0,0 +1,53 @@
+<?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/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.amdatu</groupId>
+    <artifactId>org.amdatu.web</artifactId>
+    <version>0.2.0-SNAPSHOT</version>
+  </parent>
+  <groupId>org.amdatu.web</groupId>
+  <artifactId>favicon</artifactId>
+  <packaging>bundle</packaging>
+  <name>Amdatu Web - Default Favicon</name>
+  <description>${pom.name}</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.amdatu.web</groupId>
+      <artifactId>dispatcher</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+      <type>bundle</type>
+    </dependency>
+    <dependency>
+      <groupId>org.amdatu.web</groupId>
+      <artifactId>httpcontext</artifactId>
+      <scope>provided</scope>
+      <type>bundle</type>
+    </dependency>
+    <dependency>
+      <groupId>org.amdatu.web</groupId>
+      <artifactId>resource</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+      <type>bundle</type>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            
<Bundle-Activator>org.amdatu.web.favicon.osgi.Activator</Bundle-Activator>
+            <Bundle-SymbolicName>org.amdatu.web.favicon</Bundle-SymbolicName>
+          </instructions>
+        </configuration>
+      </plugin>
+
+    </plugins>
+  </build>
+</project>

Added: 
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/osgi/Activator.java
==============================================================================
--- (empty file)
+++ 
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/osgi/Activator.java
      Mon Apr  4 09:44:14 2011
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2010 Amdatu.org
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.amdatu.web.favicon.osgi;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.amdatu.web.dispatcher.DispatcherService;
+import org.amdatu.web.favicon.service.FaviconResourceProviderImpl;
+import org.amdatu.web.httpcontext.ResourceProvider;
+import org.amdatu.web.resource.ResourceSupport;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends DependencyActivatorBase {
+
+    public final static String CONTEXTID = "amdatu-web";
+    public final static String ALIAS = "/favicon.ico";
+
+    @Override
+    public void init(BundleContext context, DependencyManager manager) throws 
Exception {
+
+        Dictionary<String, Object> properties = new Hashtable<String, 
Object>();
+        properties.put(DispatcherService.CONTEXT_ID_KEY, CONTEXTID);
+        properties.put(ResourceSupport.RESOURCE_ALIAS_KEY, ALIAS);
+
+        
manager.add(createComponent().setInterface(ResourceProvider.class.getName(), 
properties)
+            .setImplementation(FaviconResourceProviderImpl.class));
+    }
+
+    @Override
+    public void destroy(BundleContext arg0, DependencyManager arg1) throws 
Exception {
+    }
+}

Added: 
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/service/FaviconResourceProviderImpl.java
==============================================================================
--- (empty file)
+++ 
sandbox/bdekruijff/amdatu-web/favicon/src/main/java/org/amdatu/web/favicon/service/FaviconResourceProviderImpl.java
 Mon Apr  4 09:44:14 2011
@@ -0,0 +1,35 @@
+/*
+    Copyright (C) 2010 Amdatu.org
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.amdatu.web.favicon.service;
+
+import java.net.URL;
+
+import org.amdatu.web.favicon.osgi.Activator;
+import org.amdatu.web.httpcontext.ResourceProvider;
+import org.osgi.framework.BundleContext;
+
+public class FaviconResourceProviderImpl implements ResourceProvider {
+
+    private volatile BundleContext m_bundleContext;
+
+    public URL getResource(String name) {
+        if (name != null && name.startsWith(Activator.ALIAS)) {
+            return m_bundleContext.getBundle().getResource("favicon.ico");
+        }
+        return null;
+    }
+}

Added: sandbox/bdekruijff/amdatu-web/favicon/src/main/resources/favicon.ico
==============================================================================
Binary file. No diff available.
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits

Reply via email to