You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 22:21:22 UTC
svn commit: r1075149 [22/23] - in /aries/tags/blueprint-0.3.1: ./
blueprint-annotation-api/ blueprint-annotation-api/src/
blueprint-annotation-api/src/main/ blueprint-annotation-api/src/main/java/
blueprint-annotation-api/src/main/java/org/ blueprint-a...
Added: aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,88 @@
+/**
+ * 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;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.aries.blueprint.annotation.Bean;
+import org.apache.aries.blueprint.annotation.Bind;
+import org.apache.aries.blueprint.annotation.Init;
+import org.apache.aries.blueprint.annotation.Inject;
+import org.apache.aries.blueprint.annotation.ReferenceList;
+import org.apache.aries.blueprint.annotation.ReferenceListener;
+import org.apache.aries.blueprint.annotation.Unbind;
+import org.osgi.framework.ServiceReference;
+
+@Bean(id="listBindingListener")
+@ReferenceListener
+public class ListBindingListener {
+
+ @Inject @ReferenceList (id="ref-list",
+ serviceInterface = InterfaceA.class,
+ referenceListeners=@ReferenceListener(ref="listBindingListener"))
+ private InterfaceA a;
+ private Map props;
+ private ServiceReference reference;
+ private List list;
+
+ public InterfaceA getA() {
+ return a;
+ }
+
+ public Map getProps() {
+ return props;
+ }
+
+ public ServiceReference getReference() {
+ return reference;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+ @Init
+ public void init() {
+ }
+
+ @Bind
+ public void bind(InterfaceA a, Map props) {
+ this.a = a;
+ this.props = props;
+ }
+
+ @Bind
+ public void bind(ServiceReference ref) {
+ this.reference = ref;
+ }
+
+ @Unbind
+ public void unbind(InterfaceA a, Map props) {
+ this.a = null;
+ this.props = null;
+ }
+
+ @Unbind
+ public void unbind(ServiceReference ref) {
+ this.reference = null;
+ }
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/NewAccount.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/NewAccount.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/NewAccount.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/NewAccount.java Sun Feb 27 21:21:05 2011
@@ -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.aries.blueprint.sample;
+
+import org.apache.aries.blueprint.annotation.Bean;
+import org.apache.aries.blueprint.annotation.Arg;
+
+@Bean(id="accountThree",
+ factoryRef="accountFactory",
+ factoryMethod="createAccount",
+ args=@Arg(value="3"))
+public class NewAccount {
+
+ private long accountNumber;
+
+ public NewAccount(long number) {
+ this.accountNumber = number;
+ }
+
+ public long getAccountNumber() {
+ return this.accountNumber;
+ }
+
+ public void setAccountNumber(long number) {
+ this.accountNumber = number;
+ }
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,30 @@
+/**
+ * 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;
+
+import org.apache.aries.blueprint.annotation.Arg;
+import org.apache.aries.blueprint.annotation.Bean;
+
+@Bean(id="accountTwo",
+ factoryMethod="createAccount",
+ args = @Arg(value="2"))
+public class StaticAccountFactory {
+
+ public static Account createAccount(long number) {
+ return new Account(number);
+ }
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/pom.xml?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/pom.xml (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/pom.xml Sun Feb 27 21:21:05 2011
@@ -0,0 +1,53 @@
+<!--
+ 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.
+-->
+<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.apache.aries.blueprint</groupId>
+ <artifactId>blueprint</artifactId>
+ <version>0.3.1</version>
+ </parent>
+
+ <artifactId>org.apache.aries.blueprint.sample</artifactId>
+ <name>Apache Aries Blueprint Sample</name>
+ <packaging>bundle</packaging>
+ <description>
+ Example blueprint application, mostly used for integration tests.
+ </description>
+
+ <properties>
+ <aries.osgi.export>
+ org.apache.aries.blueprint.sample;-noimport:=true
+ </aries.osgi.export>
+ <aries.osgi.activator>
+ org.apache.aries.blueprint.sample.Activator
+ </aries.osgi.activator>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.api</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Account.java Sun Feb 27 21:21:05 2011
@@ -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;
+ }
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/AccountFactory.java Sun Feb 27 21:21:05 2011
@@ -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;
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Activator.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Activator.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Activator.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Activator.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,32 @@
+/**
+ * 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;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ public void start(BundleContext context) {
+ System.out.println("Bundle start");
+ }
+
+ public void stop(BundleContext context) {
+ System.out.println("Bundle stop");
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Bar.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Bar.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Bar.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Bar.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,57 @@
+/**
+ * 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;
+
+import java.util.List;
+
+import org.osgi.framework.BundleContext;
+
+public class Bar {
+
+ private BundleContext context;
+ private String value;
+ private List list;
+
+ public BundleContext getContext() {
+ return context;
+ }
+
+ public void setContext(BundleContext ctx) {
+ context = ctx;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String s) {
+ value = s;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List l) {
+ list = l;
+ }
+
+ public String toString() {
+ return hashCode() + ": " + value + " " + context + " " + list;
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,72 @@
+/**
+ * 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;
+
+import java.util.Map;
+import java.util.List;
+import java.io.Serializable;
+
+import org.osgi.framework.ServiceReference;
+
+public class BindingListener {
+
+ private InterfaceA a;
+ private Map props;
+ private ServiceReference reference;
+ private List list;
+
+ public InterfaceA getA() {
+ return a;
+ }
+
+ public Map getProps() {
+ return props;
+ }
+
+ public ServiceReference getReference() {
+ return reference;
+ }
+
+ public List getList() {
+ return list;
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+ public void init() {
+ }
+
+ public void bind(InterfaceA a, Map props) {
+ this.a = a;
+ this.props = props;
+ }
+
+ public void bind(ServiceReference ref) {
+ this.reference = ref;
+ }
+
+ public void unbind(InterfaceA a, Map props) {
+ this.a = null;
+ this.props = null;
+ }
+
+ public void unbind(ServiceReference ref) {
+ this.reference = null;
+ }
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java Sun Feb 27 21:21:05 2011
@@ -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;
+
+import java.util.Currency;
+
+import org.osgi.service.blueprint.container.Converter;
+import org.osgi.service.blueprint.container.ReifiedType;
+
+public class CurrencyTypeConverter implements Converter {
+
+ public boolean canConvert(Object fromValue, ReifiedType toType) {
+ return Currency.class.isAssignableFrom(toType.getRawClass());
+ }
+
+ public Object convert(Object source, ReifiedType toType) throws Exception {
+ return Currency.getInstance(source.toString());
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,42 @@
+/**
+ * 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;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.osgi.service.blueprint.container.Converter;
+import org.osgi.service.blueprint.container.ReifiedType;
+
+public class DateTypeConverter implements Converter {
+
+ DateFormat dateFormat;
+
+ public void setFormat(String format) {
+ dateFormat = new SimpleDateFormat(format);
+ }
+
+ public Object convert(Object source, ReifiedType toType) throws Exception {
+ return dateFormat.parse(source.toString());
+ }
+
+ public boolean canConvert(Object fromValue, ReifiedType toType) {
+ return Date.class.isAssignableFrom(toType.getRawClass());
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DodgyListener.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DodgyListener.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DodgyListener.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/DodgyListener.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,54 @@
+/**
+ * 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;
+
+import java.util.Set;
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class DodgyListener {
+ private BundleContext ctx;
+
+ public void setBundleContext(BundleContext ctx) {
+ this.ctx = ctx;
+ }
+
+ public void bind(Set a, Map props) {
+ System.out.println("Attempting to provoke deadlock");
+
+ Thread t = new Thread() {
+ public void run() {
+ // we pretend to be another bundle (otherwise we'll deadlock in Equinox itself :(
+ BundleContext otherCtx = ctx.getBundle(0).getBundleContext();
+
+ ServiceReference ref = otherCtx.getServiceReference("java.util.List");
+ otherCtx.getService(ref);
+ }
+ };
+ t.start();
+
+ // let the other thread go first
+ try {
+ Thread.sleep(100);
+ } catch (Exception e) {}
+
+ ServiceReference ref = ctx.getServiceReference("java.util.List");
+ ctx.getService(ref);
+ }
+}
\ No newline at end of file
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/Foo.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,107 @@
+/**
+ * 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;
+
+import java.io.Serializable;
+import java.util.Currency;
+import java.util.Date;
+import java.util.Map;
+
+public class Foo implements Serializable {
+
+ private int a;
+ private int b;
+ private Bar bar;
+ private Currency currency;
+ private Date date;
+
+ public boolean initialized;
+ public boolean destroyed;
+ private Map<String, Object> props;
+
+ public int getA() {
+ return a;
+ }
+
+ public void setA(int i) {
+ a = i;
+ }
+
+ public int getB() {
+ return b;
+ }
+
+ public void setB(int i) {
+ b = i;
+ }
+
+ public Bar getBar() {
+ return bar;
+ }
+
+ public void setBar(Bar b) {
+ bar = b;
+ }
+
+ public Currency getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(Currency c) {
+ currency = c;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date d) {
+ date = d;
+ }
+
+ public String toString() {
+ return a + " " + b + " " + bar + " " + currency + " " + date;
+ }
+
+ public void init() {
+ System.out.println("======== Initializing Foo =========");
+ initialized = true;
+ }
+
+ public void destroy() {
+ System.out.println("======== Destroying Foo =========");
+ destroyed = true;
+ }
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ public void update(Map<String,Object> props) {
+ this.props = props;
+ }
+
+ public Map<String, Object> getProps() {
+ return props;
+ }
+
+}
+
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,45 @@
+/**
+ * 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;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public class FooRegistrationListener {
+
+ private Map props;
+
+ private Object lock = new Object();
+
+ public void serviceRegistered(Serializable foo, Map props) {
+ System.out.println("Service registration notification: " + foo + " " + props);
+ synchronized (lock) {
+ this.props = props;
+ }
+ }
+
+ public void serviceUnregistered(Foo foo, Map props) {
+ System.out.println("Service unregistration notification: " + foo + " " + props);
+ }
+
+ public Map getProperties() {
+ synchronized (lock) {
+ return this.props;
+ }
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,22 @@
+/**
+ * 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 interface InterfaceA {
+
+ String hello(String msg);
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/java/org/apache/aries/blueprint/sample/StaticAccountFactory.java Sun Feb 27 21:21:05 2011
@@ -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);
+ }
+}
Added: aries/tags/blueprint-0.3.1/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml (added)
+++ aries/tags/blueprint-0.3.1/blueprint-sample/src/main/resources/OSGI-INF/blueprint/config.xml Sun Feb 27 21:21:05 2011
@@ -0,0 +1,183 @@
+<?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.
+ -->
+<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" />
+
+
+
+ <!-- Deadlock setup
+ We have a lazily activated service (i.e. register the service but don't create it yet)
+ Then we have a reference-listener (or some other piece of client code that is called while instantiating blueprint components)
+
+ This then tries to obtain the initial service twice:
+ - first from a new thread
+ - second from the current thread (that is creating blueprint components)
+
+ This is of course contrived. However, any other piece of code may be substituted for the first thread and with unlucky
+ timing we get into the same deadlock situation.
+ -->
+
+ <service interface="java.util.List" activation="lazy">
+ <bean class="java.util.ArrayList" />
+ </service>
+
+ <bean id="dodgyListener" class="org.apache.aries.blueprint.sample.DodgyListener">
+ <property name="bundleContext" ref="blueprintBundleContext" />
+ </bean>
+
+ <reference-list interface="java.util.Set" availability="optional">
+ <reference-listener bind-method="bind" ref="dodgyListener" />
+ </reference-list>
+
+
+
+
+
+ <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>
+
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/pom.xml?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/pom.xml (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/pom.xml Sun Feb 27 21:21:05 2011
@@ -0,0 +1,52 @@
+<!--
+ 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.
+-->
+<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>
+ <description>Blueprint Test Bundle A, provides NamespaceHandler, BeanProcessor etc implementations for Test Bundle B</description>
+ <parent>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint</artifactId>
+ <version>0.3.1</version>
+ </parent>
+
+ <artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
+ <name>Apache Aries Blueprint Test Bundle A</name>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <aries.osgi.activator>
+ org.apache.aries.blueprint.testbundlea.Activator
+ </aries.osgi.activator>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/Activator.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/Activator.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/Activator.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/Activator.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,28 @@
+/**
+ * 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.testbundlea;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+ public void start(BundleContext context) {
+ }
+ public void stop(BundleContext context) {
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/BeanProcessorTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/BeanProcessorTest.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/BeanProcessorTest.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/BeanProcessorTest.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,49 @@
+/**
+ * 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.testbundlea;
+
+import org.apache.aries.blueprint.BeanProcessor;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+
+public class BeanProcessorTest implements BeanProcessor {
+
+ public Object beforeInit(Object bean, String beanName,
+ BeanCreator beanCreator, BeanMetadata beanData) {
+ if(bean instanceof ProcessableBean){
+ ProcessableBean pb = (ProcessableBean)bean;
+ pb.processBeforeInit(this);
+ }
+ return bean;
+ }
+ public Object afterInit(Object bean, String beanName,
+ BeanCreator beanCreator, BeanMetadata beanData) {
+ if(bean instanceof ProcessableBean){
+ ((ProcessableBean)bean).processAfterInit(this);
+ }
+ return bean;
+ }
+ public void beforeDestroy(Object bean, String beanName) {
+ if(bean instanceof ProcessableBean){
+ ((ProcessableBean)bean).processBeforeDestroy(this);
+ }
+ }
+ public void afterDestroy(Object bean, String beanName) {
+ if(bean instanceof ProcessableBean){
+ ((ProcessableBean)bean).processAfterDestroy(this);
+ }
+ }
+}
\ No newline at end of file
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/InterfaceWithDependency.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/InterfaceWithDependency.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/InterfaceWithDependency.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/InterfaceWithDependency.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,25 @@
+/**
+ * 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.testbundlea;
+
+import org.apache.aries.blueprint.testbundlea.dependency.Dependency;
+
+public interface InterfaceWithDependency {
+ public void doSomething(Dependency dep);
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerOne.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerOne.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerOne.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerOne.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,127 @@
+/**
+ * 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.testbundlea;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.ParserContext;
+import org.apache.aries.blueprint.PassThroughMetadata;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.apache.aries.blueprint.mutable.MutableRefMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.RefMetadata;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * A simple example namespace handler, that understands an element, and 2 attributes
+ *
+ * When the element is encountered in a top level blueprint element, the handler will add a
+ * passthroughmetadata with it's id as the contained attribone.
+ * The passthroughmetadata will return a string with the value from the contained
+ * attrib two.
+ *
+ * If the element is encountered during processing of a bean, it will add a property to the
+ * bean with the name of the attribone value, and a value of the passthroughmetadata with id
+ * matching attribtwo
+ *
+ * This handler is designed to exercise aspects of the NamespaceHandler capability set.
+ *
+ */
+public class NSHandlerOne implements NamespaceHandler {
+
+ public static String NSURI = "http://ns.handler.one";
+
+ private static String ELT_NAME = "nshandlerone";
+ private static String ATTRIB_ONE = "attribone";
+ private static String ATTRIB_TWO = "attribtwo";
+
+ //process attributes
+ public ComponentMetadata decorate(Node node, ComponentMetadata component,
+ ParserContext context) {
+
+ //this test makes use of the 'Mutable' implementations
+ //without which the code would need to implement our own BeanMetadata,
+ //and RefMetadata.
+ if(component !=null && component instanceof MutableBeanMetadata){
+ MutableBeanMetadata mbm = (MutableBeanMetadata)component;
+
+ Attr a = (Attr)node;
+ Element bean = a.getOwnerElement();
+
+ String propname = bean.getAttributeNS(NSURI,ATTRIB_ONE);
+
+ //if this were not a test, we might attempt to ensure this ref existed
+ String passthruref = bean.getAttributeNS(NSURI,ATTRIB_TWO);
+
+ MutableRefMetadata ref = (MutableRefMetadata)context.createMetadata(RefMetadata.class);
+ ref.setComponentId(passthruref);
+
+ mbm.addProperty(propname, ref);
+ }
+ return component;
+ }
+
+ //process elements
+ public Metadata parse(Element element, ParserContext context) {
+ Metadata retval = null;
+ if( element.getLocalName().equals(ELT_NAME) ) {
+
+ final String id = element.getAttributeNS(NSURI,ATTRIB_ONE);
+ final String value = element.getAttributeNS(NSURI,ATTRIB_TWO);
+
+ PassThroughMetadata ptm = new PassThroughMetadata() {
+
+ public String getId() {
+ return id;
+ }
+
+ //not used currently
+ public List<String> getDependsOn() {
+ return null;
+ }
+
+ //also not used currently
+ public int getActivation() {
+ return 0;
+ }
+
+ public Object getObject() {
+ return value;
+ }
+ };
+
+ retval = ptm;
+ }
+ return retval;
+ }
+
+ //supply schema back to blueprint.
+ public URL getSchemaLocation(String namespace) {
+ return this.getClass().getResource("nshandlerone.xsd");
+ }
+
+ public Set<Class> getManagedClasses() {
+ return null;
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerThree.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerThree.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerThree.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerThree.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,70 @@
+/**
+ * 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.testbundlea;
+
+import java.net.URL;
+import java.util.Set;
+
+import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.ParserContext;
+import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class NSHandlerThree implements NamespaceHandler{
+ public static String NSURI = "http://ns.handler.three";
+
+ private static String ELT_NAME = "nshandlerthree";
+ private static String ATTRIB_ONE = "attribone";
+ private static String ATTRIB_TWO = "attribtwo";
+
+ public ComponentMetadata decorate(Node node, ComponentMetadata component,
+ ParserContext context) {
+ if(node.getLocalName().equals(ATTRIB_ONE)){
+ if(component instanceof BeanMetadata){
+ if(context.getComponentDefinitionRegistry().getComponentDefinition(NSURI+"/BeanProcessor")==null){
+ BeanMetadata bm = context.createMetadata(BeanMetadata.class);
+ MutableBeanMetadata mbm = (MutableBeanMetadata)bm;
+ mbm.setProcessor(true);
+ mbm.setRuntimeClass(BeanProcessorTest.class);
+ mbm.setScope(BeanMetadata.SCOPE_SINGLETON);
+ mbm.setId(NSURI+"/BeanProcessor");
+ context.getComponentDefinitionRegistry().registerComponentDefinition(mbm);
+ }
+ }
+ }
+ return component;
+ }
+
+ //process elements
+ public Metadata parse(Element element, ParserContext context) {
+ return null;
+ }
+
+ //supply schema back to blueprint.
+ public URL getSchemaLocation(String namespace) {
+ return this.getClass().getResource("nshandlerthree.xsd");
+ }
+
+ public Set<Class> getManagedClasses() {
+ return null;
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerTwo.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerTwo.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerTwo.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/NSHandlerTwo.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,134 @@
+/**
+ * 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.testbundlea;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.aries.blueprint.Interceptor;
+import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.ParserContext;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * A simple example namespace handler, that understands an element, and 2 attributes
+ *
+ * When attribone is found on a bean, an interceptor is added that will track invocations.
+ *
+ * This handler is designed to exercise aspects of the NamespaceHandler capability set.
+ *
+ */
+public class NSHandlerTwo implements NamespaceHandler{
+
+ public static String NSURI = "http://ns.handler.two";
+
+ private static String ELT_NAME = "nshandlertwo";
+ private static String ATTRIB_ONE = "attribone";
+ private static String ATTRIB_TWO = "attribtwo";
+
+ private static List<String> interceptorLog = new ArrayList<String>();
+
+ private static Interceptor tracker = new Interceptor() {
+
+ //debug/trace calls to toString etc will mess up the interceptor
+ //log, and break tests if tracked. So we filter them out here.
+ private boolean isIgnorableMethod(Method m){
+ if(m.getDeclaringClass()==Object.class){
+ return true;
+ }
+ else
+ return false;
+ }
+
+ public Object preCall(ComponentMetadata cm, Method m, Object... parameters)
+ throws Throwable {
+ String args = "[";
+ if(parameters!=null){
+ if(parameters.length>0){
+ args+=parameters[0]==null ? "null" : parameters[0].toString();
+ }
+ for(int index=1; index<parameters.length; index++){
+ args+=","+(parameters[index]==null ? "null" : parameters[index].toString());
+ }
+ }
+ args+="]";
+ String token = cm.getId() +":"+ m.getName() +":"+args+":"+System.currentTimeMillis();
+
+ if(!isIgnorableMethod(m))
+ interceptorLog.add("PRECALL:"+token);
+
+ return token;
+ }
+
+ public void postCallWithReturn(ComponentMetadata cm, Method m,
+ Object returnType, Object preCallToken) throws Throwable {
+
+ if(!isIgnorableMethod(m))
+ interceptorLog.add("POSTCALL["+returnType.toString()+"]:"+preCallToken);
+ }
+
+ public void postCallWithException(ComponentMetadata cm, Method m,
+ Throwable ex, Object preCallToken) throws Throwable {
+
+ if(!isIgnorableMethod(m))
+ interceptorLog.add("POSTCALLEXCEPTION["+ex.toString()+"]:"+preCallToken);
+ }
+
+ public int getRank() {
+ return 0;
+ }
+ };
+
+ //
+ public ComponentMetadata decorate(Node node, ComponentMetadata component,
+ ParserContext context) {
+
+ if(node.getLocalName().equals(ATTRIB_ONE)){
+ if(context.getComponentDefinitionRegistry().getInterceptors(component) == null ||
+ !context.getComponentDefinitionRegistry().getInterceptors(component).contains(tracker) ){
+ context.getComponentDefinitionRegistry().registerInterceptorWithComponent(component, tracker);
+ }
+ }
+ return component;
+ }
+
+ //process elements
+ public Metadata parse(Element element, ParserContext context) {
+ return null;
+ }
+
+ //supply schema back to blueprint.
+ public URL getSchemaLocation(String namespace) {
+ return this.getClass().getResource("nshandlertwo.xsd");
+ }
+
+ public Set<Class> getManagedClasses() {
+ return null;
+ }
+
+ public List<String> getLog() {
+ return Collections.unmodifiableList(interceptorLog);
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/ProcessableBean.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/ProcessableBean.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/ProcessableBean.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/ProcessableBean.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,38 @@
+/**
+ * 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.testbundlea;
+
+import java.util.List;
+
+import org.apache.aries.blueprint.BeanProcessor;
+
+/**
+ * Simple little interface to allow testing of BeanProcessors.
+ */
+public interface ProcessableBean {
+ public enum Phase {BEFORE_INIT, AFTER_INIT, BEFORE_DESTROY, AFTER_DESTROY};
+
+ List<BeanProcessor> getProcessedBy();
+ List<BeanProcessor> getProcessedBy(Phase p);
+
+ void processBeforeInit(BeanProcessor bp);
+ void processAfterInit(BeanProcessor bp);
+ void processBeforeDestroy(BeanProcessor bp);
+ void processAfterDestroy(BeanProcessor bp);
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/dependency/Dependency.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/dependency/Dependency.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/dependency/Dependency.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/java/org/apache/aries/blueprint/testbundlea/dependency/Dependency.java Sun Feb 27 21:21:05 2011
@@ -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.testbundlea.dependency;
+
+public interface Dependency {
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/OSGI-INF/blueprint/config.xml Sun Feb 27 21:21:05 2011
@@ -0,0 +1,50 @@
+<?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.
+-->
+<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">
+
+ <bean id="NSHandlerOne" class="org.apache.aries.blueprint.testbundlea.NSHandlerOne">
+ </bean>
+
+ <bean id="NSHandlerTwo" class="org.apache.aries.blueprint.testbundlea.NSHandlerTwo">
+ </bean>
+
+ <bean id="NSHandlerThree" class="org.apache.aries.blueprint.testbundlea.NSHandlerThree">
+ </bean>
+
+ <service interface="org.apache.aries.blueprint.NamespaceHandler" ref="NSHandlerOne">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace" value="http://ns.handler.one"/>
+ </service-properties>
+ </service>
+
+ <service interface="org.apache.aries.blueprint.NamespaceHandler" ref="NSHandlerTwo">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace" value="http://ns.handler.two"/>
+ </service-properties>
+ </service>
+
+ <service interface="org.apache.aries.blueprint.NamespaceHandler" ref="NSHandlerThree">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace" value="http://ns.handler.three"/>
+ </service-properties>
+ </service>
+
+</blueprint>
+
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerone.xsd
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerone.xsd?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerone.xsd (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerone.xsd Sun Feb 27 21:21:05 2011
@@ -0,0 +1,32 @@
+<?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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://ns.handler.one"
+ xmlns:tns="http://ns.handler.one"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="qualified" >
+ <element name="nshandlerone">
+ <complexType>
+ <attribute ref="tns:attribone"/>
+ <attribute ref="tns:attribtwo"/>
+ </complexType>
+ </element>
+ <attribute name="attribone" type="xsd:string"/>
+ <attribute name="attribtwo" type="xsd:string"/>
+</schema>
\ No newline at end of file
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerthree.xsd
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerthree.xsd?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerthree.xsd (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlerthree.xsd Sun Feb 27 21:21:05 2011
@@ -0,0 +1,32 @@
+<?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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://ns.handler.three"
+ xmlns:tns="http://ns.handler.three"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="qualified" >
+ <element name="nshandlerthree">
+ <complexType>
+ <attribute ref="tns:attribone"/>
+ <attribute ref="tns:attribtwo"/>
+ </complexType>
+ </element>
+ <attribute name="attribone" type="xsd:string"/>
+ <attribute name="attribtwo" type="xsd:string"/>
+</schema>
\ No newline at end of file
Added: aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlertwo.xsd
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlertwo.xsd?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlertwo.xsd (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundlea/src/main/resources/org/apache/aries/blueprint/testbundlea/nshandlertwo.xsd Sun Feb 27 21:21:05 2011
@@ -0,0 +1,32 @@
+<?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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://ns.handler.two"
+ xmlns:tns="http://ns.handler.two"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="qualified" >
+ <element name="nshandlertwo">
+ <complexType>
+ <attribute ref="tns:attribone"/>
+ <attribute ref="tns:attribtwo"/>
+ </complexType>
+ </element>
+ <attribute name="attribone" type="xsd:string"/>
+ <attribute name="attribtwo" type="xsd:string"/>
+</schema>
\ No newline at end of file
Added: aries/tags/blueprint-0.3.1/blueprint-testbundleb/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundleb/pom.xml?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundleb/pom.xml (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundleb/pom.xml Sun Feb 27 21:21:05 2011
@@ -0,0 +1,56 @@
+<!--
+ 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.
+-->
+<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>
+ <description>Blueprint Test Bundle B, tests namespace handlers, bean processors etc provided by Test Bundle A</description>
+ <parent>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint</artifactId>
+ <version>0.3.1</version>
+ </parent>
+
+ <artifactId>org.apache.aries.blueprint.testbundleb</artifactId>
+ <name>Apache Aries Blueprint Test Bundle B</name>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <aries.osgi.activator>
+ org.apache.aries.blueprint.testbundleb.Activator
+ </aries.osgi.activator>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.testbundlea</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/Activator.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/Activator.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/Activator.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/Activator.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,30 @@
+/**
+ * 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.testbundleb;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ public void start(BundleContext context) {
+ }
+
+ public void stop(BundleContext context) {
+ }
+
+}
Added: aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/BeanForBeanProcessorTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/BeanForBeanProcessorTest.java?rev=1075149&view=auto
==============================================================================
--- aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/BeanForBeanProcessorTest.java (added)
+++ aries/tags/blueprint-0.3.1/blueprint-testbundleb/src/main/java/org/apache/aries/blueprint/testbundleb/BeanForBeanProcessorTest.java Sun Feb 27 21:21:05 2011
@@ -0,0 +1,75 @@
+/**
+ * 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.testbundleb;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.aries.blueprint.BeanProcessor;
+import org.apache.aries.blueprint.testbundlea.ProcessableBean;
+
+public class BeanForBeanProcessorTest implements ProcessableBean{
+
+ Set<BeanProcessor> bps = new HashSet<BeanProcessor>();
+ Set<BeanProcessor> ad_bps = new HashSet<BeanProcessor>();
+ Set<BeanProcessor> ai_bps = new HashSet<BeanProcessor>();
+ Set<BeanProcessor> bd_bps = new HashSet<BeanProcessor>();
+ Set<BeanProcessor> bi_bps = new HashSet<BeanProcessor>();
+
+ private List<BeanProcessor> toList(Set<BeanProcessor> s){
+ List<BeanProcessor> lbps = new ArrayList<BeanProcessor>();
+ lbps.addAll(s);
+ return lbps;
+ }
+
+ public List<BeanProcessor> getProcessedBy() {
+ return toList(bps);
+ }
+
+ public List<BeanProcessor> getProcessedBy(Phase p) {
+ switch(p){
+ case BEFORE_INIT : return toList(bi_bps);
+ case AFTER_INIT : return toList(ai_bps);
+ case BEFORE_DESTROY : return toList(bd_bps);
+ case AFTER_DESTROY : return toList(ad_bps);
+ default: return null;
+ }
+ }
+
+ public void processAfterDestroy(BeanProcessor bp) {
+ bps.add(bp);
+ ad_bps.add(bp);
+ }
+
+ public void processAfterInit(BeanProcessor bp) {
+ bps.add(bp);
+ ai_bps.add(bp);
+ }
+
+ public void processBeforeDestroy(BeanProcessor bp) {
+ bps.add(bp);
+ bd_bps.add(bp);
+ }
+
+ public void processBeforeInit(BeanProcessor bp) {
+ bps.add(bp);
+ bi_bps.add(bp);
+ }
+
+}