You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by li...@apache.org on 2010/05/06 21:50:27 UTC
svn commit: r941883 - in
/incubator/aries/trunk/blueprint/blueprint-sample/src/main:
java/org/apache/aries/blueprint/sample/ resources/OSGI-INF/blueprint/
Author: linsun
Date: Thu May 6 19:50:27 2010
New Revision: 941883
URL: http://svn.apache.org/viewvc?rev=941883&view=rev
Log:
add the account example in our aries blueprint wiki page to blueprint-sample
Added:
incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java (with props)
incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java (with props)
incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java (with props)
Modified:
incubator/aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml
Added: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java?rev=941883&view=auto
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java (added)
+++ incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java Thu May 6 19:50:27 2010
@@ -0,0 +1,34 @@
+/**
+ * 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.aries.blueprint.sample;
+
+public class Account {
+
+ private long accountNumber;
+
+ public Account(long number) {
+ this.accountNumber = number;
+ }
+
+ public long getAccountNumber() {
+ return this.accountNumber;
+ }
+
+ public void setAccountNumber(long number) {
+ this.accountNumber = number;
+ }
+}
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java?rev=941883&view=auto
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java (added)
+++ incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java Thu May 6 19:50:27 2010
@@ -0,0 +1,34 @@
+/**
+ * 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.aries.blueprint.sample;
+
+public class AccountFactory {
+ private String factoryName;
+
+ public AccountFactory(String factoryName) {
+ this.factoryName = factoryName;
+ }
+
+ public Account createAccount(long number) {
+ return new Account(number);
+ }
+
+ public String getFactoryName() {
+ return this.factoryName;
+ }
+
+}
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java?rev=941883&view=auto
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java (added)
+++ incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java Thu May 6 19:50:27 2010
@@ -0,0 +1,23 @@
+/**
+ * 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.aries.blueprint.sample;
+
+public class StaticAccountFactory {
+ public static Account createAccount(long number) {
+ return new Account(number);
+ }
+}
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/aries/trunk/blueprint/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml?rev=941883&r1=941882&r2=941883&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml (original)
+++ incubator/aries/trunk/blueprint/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml Thu May 6 19:50:27 2010
@@ -1,120 +1,153 @@
<?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.
--->
+ <!--
+ 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"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
- default-availability="optional">
-
- <type-converters>
- <bean id="converter1" class="org.apache.aries.blueprint.sample.DateTypeConverter">
- <property name="format" value="yyyy.MM.dd"/>
- </bean>
- <bean id="converter2" class="org.apache.aries.blueprint.sample.CurrencyTypeConverter"/>
-
- </type-converters>
-
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" ignore-missing-locations="true" system-properties="override">
- <ext:default-properties>
- <ext:property name="name" value="value"/>
- </ext:default-properties>
- <ext:location>file://url</ext:location>
- </ext:property-placeholder>
-
- <cm:managed-service-factory id="managed-service-factory" factory-pid="blueprint-sample-managed-service-factory"
- interface="org.apache.aries.blueprint.sample.Foo"
- ext:system-properties="fallback">
- <service-properties>
- <entry key="key1" value="value1"/>
- </service-properties>
- <cm:managed-component class="org.apache.aries.blueprint.sample.Foo"/>
- </cm:managed-service-factory>
-
- <cm:property-placeholder id="property-placeholder" persistent-id="blueprint-sample-placeholder">
- <cm:default-properties>
- <cm:property name="key.b" value="-1"/>
- </cm:default-properties>
- </cm:property-placeholder>
-
- <bean id="none-managed" class="org.apache.aries.blueprint.sample.Foo">
- <cm:managed-properties persistent-id="blueprint-sample-managed.none" update-strategy="none"/>
- </bean>
-
- <bean id="component-managed" class="org.apache.aries.blueprint.sample.Foo">
- <cm:managed-properties persistent-id="blueprint-sample-managed.component" update-strategy="component-managed" update-method="update"/>
- </bean>
-
- <bean id="container-managed" class="org.apache.aries.blueprint.sample.Foo">
- <cm:managed-properties persistent-id="blueprint-sample-managed.container" update-strategy="container-managed"/>
- </bean>
-
- <bean id="foo" class="org.apache.aries.blueprint.sample.Foo" init-method="init" destroy-method="destroy">
- <property name="a" value="5" />
- <property name="b" value="${key.b}" />
- <property name="bar" ref="bar" />
- <property name="currency">
- <value>PLN</value>
- </property>
- <property name="date">
- <value>2009.04.17</value>
- </property>
- </bean>
-
- <bean id="bar" class="org.apache.aries.blueprint.sample.Bar">
- <property name="value"><value>Hello FooBar</value></property>
- <property name="context" ref="blueprintBundleContext"/>
- <property name="list">
- <list>
- <value>a list element</value>
- <value type = "java.lang.Integer">5</value>
- </list>
- </property>
- </bean>
-
- <service ref="foo" auto-export="all-classes">
- <service-properties>
- <entry key="key" value="value"/>
- </service-properties>
- <registration-listener ref="fooRegistrationListener"
- registration-method="serviceRegistered"
- unregistration-method="serviceUnregistered"/>
- </service>
-
- <bean id="fooRegistrationListener" class="org.apache.aries.blueprint.sample.FooRegistrationListener"/>
-
- <reference id="ref2" interface="org.apache.aries.blueprint.sample.InterfaceA" timeout="100">
- <reference-listener bind-method="bind" unbind-method="unbind" ref="bindingListener" />
- </reference>
-
- <bean id="bindingListener" class="org.apache.aries.blueprint.sample.BindingListener"/>
-
- <reference-list id="ref-list" interface="org.apache.aries.blueprint.sample.InterfaceA">
- <reference-listener bind-method="bind" unbind-method="unbind" ref="listBindingListener" />
- </reference-list>
-
- <bean id="listBindingListener" class="org.apache.aries.blueprint.sample.BindingListener"/>
-
- <bean id="circularReference" class="org.apache.aries.blueprint.sample.BindingListener" init-method="init">
- <property name="list">
- <reference-list interface="org.apache.aries.blueprint.sample.InterfaceA" availability="optional">
- <reference-listener bind-method="bind" unbind-method="unbind" ref="circularReference"/>
- </reference-list>
- </property>
- </bean>
-
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
+ default-availability="optional">
+
+ <type-converters>
+ <bean id="converter1" class="org.apache.aries.blueprint.sample.DateTypeConverter">
+ <property name="format" value="yyyy.MM.dd" />
+ </bean>
+ <bean id="converter2"
+ class="org.apache.aries.blueprint.sample.CurrencyTypeConverter" />
+
+ </type-converters>
+
+ <ext:property-placeholder placeholder-prefix="$["
+ placeholder-suffix="]" ignore-missing-locations="true"
+ system-properties="override">
+ <ext:default-properties>
+ <ext:property name="name" value="value" />
+ </ext:default-properties>
+ <ext:location>file://url</ext:location>
+ </ext:property-placeholder>
+
+ <cm:managed-service-factory id="managed-service-factory"
+ factory-pid="blueprint-sample-managed-service-factory" interface="org.apache.aries.blueprint.sample.Foo"
+ ext:system-properties="fallback">
+ <service-properties>
+ <entry key="key1" value="value1" />
+ </service-properties>
+ <cm:managed-component class="org.apache.aries.blueprint.sample.Foo" />
+ </cm:managed-service-factory>
+
+ <cm:property-placeholder id="property-placeholder"
+ persistent-id="blueprint-sample-placeholder">
+ <cm:default-properties>
+ <cm:property name="key.b" value="-1" />
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <bean id="none-managed" class="org.apache.aries.blueprint.sample.Foo">
+ <cm:managed-properties persistent-id="blueprint-sample-managed.none"
+ update-strategy="none" />
+ </bean>
+
+ <bean id="component-managed" class="org.apache.aries.blueprint.sample.Foo">
+ <cm:managed-properties persistent-id="blueprint-sample-managed.component"
+ update-strategy="component-managed" update-method="update" />
+ </bean>
+
+ <bean id="container-managed" class="org.apache.aries.blueprint.sample.Foo">
+ <cm:managed-properties persistent-id="blueprint-sample-managed.container"
+ update-strategy="container-managed" />
+ </bean>
+
+ <bean id="foo" class="org.apache.aries.blueprint.sample.Foo"
+ init-method="init" destroy-method="destroy">
+ <property name="a" value="5" />
+ <property name="b" value="${key.b}" />
+ <property name="bar" ref="bar" />
+ <property name="currency">
+ <value>PLN</value>
+ </property>
+ <property name="date">
+ <value>2009.04.17</value>
+ </property>
+ </bean>
+
+ <bean id="bar" class="org.apache.aries.blueprint.sample.Bar">
+ <property name="value">
+ <value>Hello FooBar</value>
+ </property>
+ <property name="context" ref="blueprintBundleContext" />
+ <property name="list">
+ <list>
+ <value>a list element</value>
+ <value type="java.lang.Integer">5</value>
+ </list>
+ </property>
+ </bean>
+
+ <service ref="foo" auto-export="all-classes">
+ <service-properties>
+ <entry key="key" value="value" />
+ </service-properties>
+ <registration-listener ref="fooRegistrationListener"
+ registration-method="serviceRegistered" unregistration-method="serviceUnregistered" />
+ </service>
+
+ <bean id="fooRegistrationListener"
+ class="org.apache.aries.blueprint.sample.FooRegistrationListener" />
+
+ <reference id="ref2" interface="org.apache.aries.blueprint.sample.InterfaceA"
+ timeout="100">
+ <reference-listener bind-method="bind"
+ unbind-method="unbind" ref="bindingListener" />
+ </reference>
+
+ <bean id="bindingListener" class="org.apache.aries.blueprint.sample.BindingListener" />
+
+ <reference-list id="ref-list"
+ interface="org.apache.aries.blueprint.sample.InterfaceA">
+ <reference-listener bind-method="bind"
+ unbind-method="unbind" ref="listBindingListener" />
+ </reference-list>
+
+ <bean id="listBindingListener" class="org.apache.aries.blueprint.sample.BindingListener" />
+
+ <bean id="circularReference" class="org.apache.aries.blueprint.sample.BindingListener"
+ init-method="init">
+ <property name="list">
+ <reference-list interface="org.apache.aries.blueprint.sample.InterfaceA"
+ availability="optional">
+ <reference-listener bind-method="bind"
+ unbind-method="unbind" ref="circularReference" />
+ </reference-list>
+ </property>
+ </bean>
+
+ <bean id="accountOne" class="org.apache.aries.blueprint.sample.Account">
+ <argument value="1" />
+ </bean>
+
+ <bean id="accountTwo" class="org.apache.aries.blueprint.sample.StaticAccountFactory"
+ factory-method="createAccount">
+ <argument value="2" />
+ </bean>
+
+ <bean id="accountFactory" class="org.apache.aries.blueprint.sample.AccountFactory">
+ <argument value="account factory" />
+ </bean>
+
+ <bean id="accountThree" factory-ref="accountFactory"
+ factory-method="createAccount">
+ <argument value="3" />
+ </bean>
</blueprint>