Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 39553 invoked from network); 17 Apr 2009 20:02:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Apr 2009 20:02:44 -0000 Received: (qmail 79583 invoked by uid 500); 17 Apr 2009 20:02:43 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 79501 invoked by uid 500); 17 Apr 2009 20:02:43 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 79347 invoked by uid 99); 17 Apr 2009 20:02:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2009 20:02:39 +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; Fri, 17 Apr 2009 20:02:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4AC8923889BB; Fri, 17 Apr 2009 20:02:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r766129 - in /geronimo/sandbox/blueprint/sample: ./ src/main/java/org/apache/geronimo/osgi/example/ src/main/resources/OSGI-INF/blueprint/ Date: Fri, 17 Apr 2009 20:02:07 -0000 To: scm@geronimo.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090417200207.4AC8923889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gawor Date: Fri Apr 17 20:02:06 2009 New Revision: 766129 URL: http://svn.apache.org/viewvc?rev=766129&view=rev Log: update sample to use type-converters Added: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java (with props) geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java (with props) Modified: geronimo/sandbox/blueprint/sample/pom.xml geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Bar.java geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Foo.java geronimo/sandbox/blueprint/sample/src/main/resources/OSGI-INF/blueprint/config.xml Modified: geronimo/sandbox/blueprint/sample/pom.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/sample/pom.xml?rev=766129&r1=766128&r2=766129&view=diff ============================================================================== --- geronimo/sandbox/blueprint/sample/pom.xml (original) +++ geronimo/sandbox/blueprint/sample/pom.xml Fri Apr 17 20:02:06 2009 @@ -53,5 +53,10 @@ org.osgi.core provided + + org.apache.felix + blueprint-api + ${version} + Modified: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Bar.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Bar.java?rev=766129&r1=766128&r2=766129&view=diff ============================================================================== --- geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Bar.java (original) +++ geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Bar.java Fri Apr 17 20:02:06 2009 @@ -16,13 +16,18 @@ */ package org.apache.geronimo.osgi.example; +import java.util.List; + +import org.osgi.framework.BundleContext; + public class Bar { + private BundleContext context; private String value; + private List list; public String toString() { - return hashCode() + ": " + value; + return hashCode() + ": " + value + " " + context + " " + list; } } - Added: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java?rev=766129&view=auto ============================================================================== --- geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java (added) +++ geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java Fri Apr 17 20:02:06 2009 @@ -0,0 +1,33 @@ +/** + * 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.geronimo.osgi.example; + +import java.util.Currency; + +import org.osgi.service.blueprint.convert.Converter; + +public class CurrencyTypeConverter implements Converter { + + public Object convert(Object source) throws Exception { + return Currency.getInstance(source.toString()); + } + + public Class getTargetClass() { + return Currency.class; + } + +} Propchange: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/CurrencyTypeConverter.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java?rev=766129&view=auto ============================================================================== --- geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java (added) +++ geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java Fri Apr 17 20:02:06 2009 @@ -0,0 +1,41 @@ +/** + * 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.geronimo.osgi.example; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.osgi.service.blueprint.convert.Converter; + +public class DateTypeConverter implements Converter { + + DateFormat dateFormat; + + public void setFormat(String format) { + dateFormat = new SimpleDateFormat(format); + } + + public Object convert(Object source) throws Exception { + return dateFormat.parse(source.toString()); + } + + public Class getTargetClass() { + return Date.class; + } + +} Propchange: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/DateTypeConverter.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Foo.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Foo.java?rev=766129&r1=766128&r2=766129&view=diff ============================================================================== --- geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Foo.java (original) +++ geronimo/sandbox/blueprint/sample/src/main/java/org/apache/geronimo/osgi/example/Foo.java Fri Apr 17 20:02:06 2009 @@ -16,14 +16,19 @@ */ package org.apache.geronimo.osgi.example; +import java.util.Currency; +import java.util.Date; + public class Foo { private int a; private int b; private Bar bar; + private Currency currency; + private Date date; public String toString() { - return a + " " + b + " " + bar; + return a + " " + b + " " + bar + " " + currency + " " + date; } } Modified: geronimo/sandbox/blueprint/sample/src/main/resources/OSGI-INF/blueprint/config.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/sample/src/main/resources/OSGI-INF/blueprint/config.xml?rev=766129&r1=766128&r2=766129&view=diff ============================================================================== --- geronimo/sandbox/blueprint/sample/src/main/resources/OSGI-INF/blueprint/config.xml (original) +++ geronimo/sandbox/blueprint/sample/src/main/resources/OSGI-INF/blueprint/config.xml Fri Apr 17 20:02:06 2009 @@ -2,15 +2,37 @@ + + + + + + + + + PLN + + + 2009.04.17 + Hello FooBar + + + + a list element followed by a reference + 5 + + + +