Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 99034 invoked from network); 8 Jun 2009 10:02:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Jun 2009 10:02:50 -0000 Received: (qmail 18609 invoked by uid 500); 8 Jun 2009 10:03:01 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 18519 invoked by uid 500); 8 Jun 2009 10:03:01 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 18510 invoked by uid 99); 8 Jun 2009 10:03:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jun 2009 10:03:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jun 2009 10:02:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5EEE123888FF; Mon, 8 Jun 2009 10:02:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r782577 - in /cxf/dosgi/trunk/distribution: ./ discovery-single-bundle/ discovery-single-bundle/src/ discovery-single-bundle/src/main/ discovery-single-bundle/src/main/java/ discovery-single-bundle/src/main/java/org/ discovery-single-bundle... Date: Mon, 08 Jun 2009 10:02:36 -0000 To: commits@cxf.apache.org From: davidb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090608100236.5EEE123888FF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davidb Date: Mon Jun 8 10:02:35 2009 New Revision: 782577 URL: http://svn.apache.org/viewvc?rev=782577&view=rev Log: Initial bits for a convenience singlebundle distribution for Discovery. Added: cxf/dosgi/trunk/distribution/discovery-single-bundle/ cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml (with props) cxf/dosgi/trunk/distribution/discovery-single-bundle/src/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/AggregatedActivator.java (with props) cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/discovery/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/discovery/singlebundle/ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/discovery/singlebundle/activators.list Modified: cxf/dosgi/trunk/distribution/pom.xml Added: cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml?rev=782577&view=auto ============================================================================== --- cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml (added) +++ cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml Mon Jun 8 10:02:35 2009 @@ -0,0 +1,138 @@ + + + + + 4.0.0 + org.apache.cxf.dosgi + cxf-dosgi-ri-discovery-singlebundle-distribution + 1.1-SNAPSHOT + bundle + Distributed OSGI Zookeeper-Based Discovery Single-Bundle Distribution + http://cxf.apache.org + + + org.apache.cxf.dosgi + cxf-dosgi-ri-distribution-parent + 1.1-SNAPSHOT + ../pom.xml + + + + ../.. + + + + + org.apache.felix + org.osgi.compendium + 1.2.0 + provided + + + org.apache.felix + org.osgi.foundation + + + + + + org.apache.felix + org.apache.felix.configadmin + 1.0.10 + + + org.apache.felix + org.apache.felix.fileinstall + 1.0.0 + + + + org.apache.log4j + com.springsource.org.apache.log4j + ${log4j.version} + + + org.apache.cxf.dosgi + cxf-dosgi-ri-discovery-distributed-zookeeper-wrapper + ${project.version} + + + org.apache.cxf.dosgi + cxf-dosgi-ri-discovery-distributed + ${project.version} + + + + + + + org.apache.felix + maven-bundle-plugin + + + Distributed OSGi Zookeeper-Based Discovery Single-Bundle Distribution + ${pom.artifactId} + The Apache Software Foundation + org.apache.cxf.dosgi.discovery.singlebundle.AggregatedActivator + + @cxf-dosgi-ri-discovery-distributed-${project.version}.jar!/META-INF/spring/*, + {maven-resources} + + + com.sun.jdmk.comm;resolution:=optional, + javax.jms;resolution:=optional, + javax.mail.*;resolution:=optional, + javax.management;resolution:=optional, + javax.naming;resolution:=optional, + javax.swing.*;resolution:=optional, + javax.xml.*, + org.apache.cxf.dosgi.discovery.local;version=${pom.version}, + org.osgi.framework;version="[1.4.0,2.0.0)", + org.osgi.service.cm;version="[1.2.0,2.0.0)", + org.osgi.service.discovery;version="[1.0.0,2.0.0)", + org.osgi.service.packageadmin;version="[1.2.0,2.0.0)", + org.osgi.util.tracker;version="[1.3.0,2.0.0)", + org.springframework.beans.factory;version="[2.5.0,3.0.0)", + org.springframework.osgi.context;version="[1.2.0,2.0.0)", + org.w3c.dom, + org.xml.sax.*, + !* + + + !* + + org.apache.cxf.dosgi.discovery.singlebundle + *;scope=compile;inline=false + lib + <_exportcontents> + !* + + <_removeheaders> + Ignore-Package, + Include-Resource, + Private-Package, + Embed-Dependency + + + + + + + Propchange: cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: cxf/dosgi/trunk/distribution/discovery-single-bundle/pom.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/AggregatedActivator.java URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/AggregatedActivator.java?rev=782577&view=auto ============================================================================== --- cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/AggregatedActivator.java (added) +++ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/AggregatedActivator.java Mon Jun 8 10:02:35 2009 @@ -0,0 +1,91 @@ +/** + * 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.cxf.dosgi.discovery.singlebundle; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class AggregatedActivator implements BundleActivator { + static final String ACTIVATOR_RESOURCE = "activators.list"; + + private List activators = new ArrayList(); + + public void start(BundleContext ctx) throws Exception { + startEmbeddedActivators(ctx); + } + + public void stop(BundleContext ctx) throws Exception { + stopEmbeddedActivators(ctx); + } + + void startEmbeddedActivators(BundleContext ctx) throws Exception { + ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + for (String s : getActivators()) { + try { + Class clazz = getClass().getClassLoader().loadClass(s); + Object o = clazz.newInstance(); + if (o instanceof BundleActivator) { + BundleActivator ba = (BundleActivator) o; + activators.add(ba); + ba.start(ctx); + } + } catch (Throwable th) { + th.printStackTrace(); + } + } + } finally { + Thread.currentThread().setContextClassLoader(oldClassLoader); + } + } + + void stopEmbeddedActivators(BundleContext ctx) throws Exception { + for (BundleActivator ba : activators) { + ba.stop(ctx); + } + } + + static Collection getActivators() throws IOException { + List bundleActivators = new ArrayList(); + + URL url = AggregatedActivator.class.getResource(ACTIVATOR_RESOURCE); + if (url == null) { + return Collections.emptyList(); + } + + BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); + String line = null; + while ((line = br.readLine()) != null) { + bundleActivators.add(line); + } + + return bundleActivators; + } + +} Propchange: cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/AggregatedActivator.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/java/org/apache/cxf/dosgi/discovery/singlebundle/AggregatedActivator.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/discovery/singlebundle/activators.list URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/discovery/singlebundle/activators.list?rev=782577&view=auto ============================================================================== --- cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/discovery/singlebundle/activators.list (added) +++ cxf/dosgi/trunk/distribution/discovery-single-bundle/src/main/resources/org/apache/cxf/dosgi/discovery/singlebundle/activators.list Mon Jun 8 10:02:35 2009 @@ -0,0 +1,4 @@ +org.apache.felix.cm.impl.ConfigurationManager +org.apache.felix.fileinstall.FileInstall +org.apache.cxf.dosgi.discovery.zookeeper.Activator + Modified: cxf/dosgi/trunk/distribution/pom.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/distribution/pom.xml?rev=782577&r1=782576&r2=782577&view=diff ============================================================================== --- cxf/dosgi/trunk/distribution/pom.xml (original) +++ cxf/dosgi/trunk/distribution/pom.xml Mon Jun 8 10:02:35 2009 @@ -40,6 +40,7 @@ multi-bundle single-bundle + discovery-single-bundle sources