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 21:50:51 UTC

svn commit: r1075143 [15/23] - in /aries/tags/blueprint-0.2.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.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableMapMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableMapMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableMapMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableMapMetadata.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,43 @@
+/**
+ * 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.mutable;
+
+import org.osgi.service.blueprint.reflect.MapEntry;
+import org.osgi.service.blueprint.reflect.MapMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.NonNullMetadata;
+
+/**
+ * A mutable version of the <code>MapMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableMapMetadata extends MapMetadata {
+
+    void setKeyType(String keyType);
+
+    void setValueType(String valueType);
+
+    void addEntry(MapEntry entry);
+
+    MapEntry addEntry(NonNullMetadata key, Metadata value);
+
+    void removeEntry(MapEntry entry);
+
+}
\ No newline at end of file

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePassThroughMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePassThroughMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePassThroughMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePassThroughMetadata.java Sun Feb 27 20:50:38 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.mutable;
+
+import org.apache.aries.blueprint.PassThroughMetadata;
+
+/**
+ * The mutable version of the PassThroughMetadata interface
+ */
+public interface MutablePassThroughMetadata extends PassThroughMetadata, MutableComponentMetadata {
+
+    void setObject(Object object);
+
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePropsMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePropsMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePropsMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutablePropsMetadata.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,39 @@
+/**
+ * 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.mutable;
+
+import org.osgi.service.blueprint.reflect.MapEntry;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.NonNullMetadata;
+import org.osgi.service.blueprint.reflect.PropsMetadata;
+
+/**
+ * A mutable version of the <code>PropsMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutablePropsMetadata extends PropsMetadata {
+
+    void addEntry(MapEntry entry);
+
+    MapEntry addEntry(NonNullMetadata key, Metadata value);
+
+    void removeEntry(MapEntry entry);
+
+}
\ No newline at end of file

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRefMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRefMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRefMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRefMetadata.java Sun Feb 27 20:50:38 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.mutable;
+
+import org.osgi.service.blueprint.reflect.RefMetadata;
+
+/**
+ * A mutable version of the <code>RefMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableRefMetadata extends RefMetadata {
+
+    public void setComponentId(String componentId);
+
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListMetadata.java Sun Feb 27 20:50:38 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.mutable;
+
+import org.apache.aries.blueprint.ExtendedReferenceListMetadata;
+
+/**
+ * A mutable version of the <code>RefCollectionMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableReferenceListMetadata extends ExtendedReferenceListMetadata, MutableServiceReferenceMetadata {
+
+    void setMemberType(int memberType);
+
+}
\ No newline at end of file

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListener.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListener.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListener.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceListener.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,37 @@
+/**
+ * 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.mutable;
+
+import org.osgi.service.blueprint.reflect.ReferenceListener;
+import org.osgi.service.blueprint.reflect.Target;
+
+/**
+ * A mutable version of the <code>Listener</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableReferenceListener extends ReferenceListener {
+
+    void setListenerComponent(Target listenerComponent);
+
+    void setBindMethod(String bindMethodName);
+
+    void setUnbindMethod(String unbindMethodName);
+
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableReferenceMetadata.java Sun Feb 27 20:50:38 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.mutable;
+
+import org.osgi.service.blueprint.reflect.ReferenceMetadata;
+
+/**
+ * A mutable version of the <code>ReferenceMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableReferenceMetadata extends ReferenceMetadata, MutableServiceReferenceMetadata {
+
+    void setTimeout(long timeout);
+
+}
\ No newline at end of file

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRegistrationListener.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRegistrationListener.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRegistrationListener.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableRegistrationListener.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,37 @@
+/**
+ * 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.mutable;
+
+import org.osgi.service.blueprint.reflect.RegistrationListener;
+import org.osgi.service.blueprint.reflect.Target;
+
+/**
+ * A mutable version of the <code>RegistrationListener</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableRegistrationListener extends RegistrationListener {
+
+    void setListenerComponent(Target listenerComponent);
+
+    void setRegistrationMethod(String registrationMethodName);
+
+    void setUnregistrationMethod(String unregistrationMethodName);
+
+}
\ No newline at end of file

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceMetadata.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,59 @@
+/**
+ * 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.mutable;
+
+import org.osgi.service.blueprint.reflect.MapEntry;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.NonNullMetadata;
+import org.osgi.service.blueprint.reflect.RegistrationListener;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.Target;
+
+/**
+ * A mutable version of the <code>ServiceMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableServiceMetadata extends ServiceMetadata, MutableComponentMetadata {
+
+    void setServiceComponent(Target serviceComponent);
+
+    void addInterface(String interfaceName);
+
+    void removeInterface(String interfaceName);
+
+    void setAutoExport(int autoExportMode);
+
+    void addServiceProperty(MapEntry serviceProperty);
+
+    MapEntry addServiceProperty(NonNullMetadata key, Metadata value);
+
+    void removeServiceProperty(MapEntry serviceProperty);
+
+    void setRanking(int ranking);
+
+    void addRegistrationListener(RegistrationListener listener);
+
+    RegistrationListener addRegistrationListener(Target listenerComponent,
+                                                 String registrationMethodName,
+                                                 String unregistrationMethodName);
+
+    void removeRegistrationListener(RegistrationListener listener);
+
+}
\ No newline at end of file

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableServiceReferenceMetadata.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,51 @@
+/**
+ * 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.mutable;
+
+import org.apache.aries.blueprint.ExtendedServiceReferenceMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceListener;
+import org.osgi.service.blueprint.reflect.Target;
+
+/**
+ * A mutable version of the <code>ServiceReferenceMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 950985 $, $Date: 2010-06-03 14:19:22 +0100 (Thu, 03 Jun 2010) $
+ */
+public interface MutableServiceReferenceMetadata extends ExtendedServiceReferenceMetadata, MutableComponentMetadata {
+
+    void setAvailability(int availability);
+
+    void setInterface(String interfaceName);
+
+    void setComponentName(String componentName);
+
+    void addServiceListener(ReferenceListener listener);
+
+    ReferenceListener addServiceListener(Target listenerComponent,
+                                String bindMethodName,
+                                String unbindMethodName);
+
+    void removeReferenceListener(ReferenceListener listener);
+
+    void setProxyMethod(int proxyMethod);
+
+    void setFilter(String filter);
+
+    void setRuntimeInterface(Class clazz);
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableValueMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableValueMetadata.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableValueMetadata.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/mutable/MutableValueMetadata.java Sun Feb 27 20:50:38 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.mutable;
+
+import org.osgi.service.blueprint.reflect.ValueMetadata;
+
+/**
+ * A mutable version of the <code>ValueMetadata</code> that allows modifications.
+ *
+ * @version $Rev: 896324 $, $Date: 2010-01-06 06:05:04 +0000 (Wed, 06 Jan 2010) $
+ */
+public interface MutableValueMetadata extends ValueMetadata {
+
+    void setStringValue(String stringValue);
+
+    void setType(String type);
+
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/ComponentDefinitionRegistryImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/ComponentDefinitionRegistryImpl.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/ComponentDefinitionRegistryImpl.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/ComponentDefinitionRegistryImpl.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,129 @@
+/*
+ * 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.namespace;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.aries.blueprint.ComponentDefinitionRegistry;
+import org.apache.aries.blueprint.ComponentNameAlreadyInUseException;
+import org.apache.aries.blueprint.Interceptor;
+import org.apache.aries.blueprint.reflect.PassThroughMetadataImpl;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.Target;
+
+/**
+ * ComponentDefinitionRegistry implementation.
+ *
+ * This implementation uses concurrent lists and maps to store components and converters metadata
+ * to allow its use by concurrent threads. 
+ *
+ * @version $Rev: 922829 $, $Date: 2010-03-14 12:34:19 +0000 (Sun, 14 Mar 2010) $
+ */
+public class ComponentDefinitionRegistryImpl implements ComponentDefinitionRegistry {
+
+    private final Map<String, ComponentMetadata> components;
+    private final List<Target> typeConverters;
+    private final Map<ComponentMetadata, List<Interceptor>> interceptors;
+
+    public ComponentDefinitionRegistryImpl() {
+        // Use a linked hash map to keep the declaration order 
+        components = Collections.synchronizedMap(new LinkedHashMap<String, ComponentMetadata>());
+        typeConverters = new CopyOnWriteArrayList<Target>();
+        interceptors = Collections.synchronizedMap(new HashMap<ComponentMetadata, List<Interceptor>>());
+    }
+
+    public boolean containsComponentDefinition(String name) {
+        return components.containsKey(name);
+    }
+
+    public ComponentMetadata getComponentDefinition(String name) {
+        return components.get(name);
+    }
+
+    public Set<String> getComponentDefinitionNames() {
+        return Collections.unmodifiableSet(components.keySet());
+    }
+
+    public void registerComponentDefinition(ComponentMetadata component) {
+        String id = component.getId();
+        if (id == null) {
+            // TODO: should we generate a unique name?
+            throw new IllegalArgumentException("Component must have a valid id");
+        }
+        if (id.startsWith("blueprint") && !(component instanceof PassThroughMetadataImpl)) {
+            // TODO: log a warning
+        }
+        // TODO: perform other validation: scope, class/runtimeClass/factoryMethod, etc...
+        if (components.containsKey(id)) {
+            throw new ComponentNameAlreadyInUseException(id);
+        }
+        components.put(id, component);
+    }
+
+    public void removeComponentDefinition(String name) {
+        ComponentMetadata removed = components.remove(name);
+        if(removed!=null){
+            interceptors.remove(removed);
+        }
+    }
+
+    public void registerTypeConverter(Target component) {
+        typeConverters.add(component);
+        if (component instanceof ComponentMetadata) {
+            registerComponentDefinition((ComponentMetadata) component);
+        }
+    }
+
+    public List<Target> getTypeConverters() {
+        return typeConverters;
+    }
+
+    public void registerInterceptorWithComponent(ComponentMetadata component, Interceptor interceptor) {
+        if(interceptor!=null){
+            List<Interceptor> componentInterceptorList = interceptors.get(component);
+            if(componentInterceptorList==null){
+                componentInterceptorList = new ArrayList<Interceptor>();
+                interceptors.put(component, componentInterceptorList);
+            }
+            if(!componentInterceptorList.contains(interceptor)){
+                componentInterceptorList.add(interceptor);
+                Collections.sort(componentInterceptorList, new Comparator<Interceptor>(){
+                    public int compare(Interceptor object1, Interceptor object2) {
+                        //invert the order so higher ranks are sorted 1st
+                        return object2.getRank() - object1.getRank();
+                    }
+                });
+            }
+        }
+    }
+
+    public List<Interceptor> getInterceptors(ComponentMetadata component) {
+        List<Interceptor> result = interceptors.get(component);
+        return (result == null) ? Collections.<Interceptor>emptyList() : result;
+    }
+    
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/namespace/NamespaceHandlerRegistryImpl.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,551 @@
+/*
+ * 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.namespace;
+
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.net.URI;
+import java.net.URL;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+import java.io.IOException;
+
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.transform.Source;
+import javax.xml.XMLConstants;
+
+import org.apache.aries.blueprint.NamespaceHandler;
+import org.apache.aries.blueprint.container.NamespaceHandlerRegistry;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.SAXException;
+
+/**
+ * Default implementation of the NamespaceHandlerRegistry.
+ * 
+ * This registry will track NamespaceHandler objects in the OSGi registry and make
+ * them available, calling listeners when handlers are registered or unregistered.
+ *
+ * @version $Rev: 1071762 $, $Date: 2011-02-17 19:51:23 +0000 (Thu, 17 Feb 2011) $
+ */
+public class NamespaceHandlerRegistryImpl implements NamespaceHandlerRegistry, ServiceTrackerCustomizer {
+    
+    public static final URI BLUEPRINT_NAMESPACE = URI.create("http://www.osgi.org/xmlns/blueprint/v1.0.0");
+
+    public static final String NAMESPACE = "osgi.service.blueprint.namespace";
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(NamespaceHandlerRegistryImpl.class);
+
+    private final BundleContext bundleContext;
+    private final Map<URI, Set<NamespaceHandler>> handlers;
+    private final ServiceTracker tracker;
+    private final Map<Map<URI, NamespaceHandler>, Reference<Schema>> schemas = new LRUMap<Map<URI, NamespaceHandler>, Reference<Schema>>(10);
+    private SchemaFactory schemaFactory;
+    private List<NamespaceHandlerSetImpl> sets;
+
+    public NamespaceHandlerRegistryImpl(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+        handlers = new HashMap<URI, Set<NamespaceHandler>>();
+        sets = new ArrayList<NamespaceHandlerSetImpl>();
+        tracker = new ServiceTracker(bundleContext, NamespaceHandler.class.getName(), this);
+        tracker.open();
+    }
+
+    public Object addingService(ServiceReference reference) {
+        LOGGER.debug("Adding NamespaceHandler "+reference.toString());
+        NamespaceHandler handler = (NamespaceHandler) bundleContext.getService(reference);
+        if(handler!=null){
+            try {
+                Map<String, Object> props = new HashMap<String, Object>();
+                for (String name : reference.getPropertyKeys()) {
+                    props.put(name, reference.getProperty(name));
+                }
+                registerHandler(handler, props);
+            } catch (Exception e) {
+                LOGGER.warn("Error registering NamespaceHandler", e);
+            }
+        }else{
+            LOGGER.warn("Error resolving NamespaceHandler, null Service obtained from tracked ServiceReference {} for bundle {}, ver {}", new Object[]{reference.toString(), reference.getBundle().getSymbolicName(), reference.getBundle().getVersion()});
+        }
+        return handler;
+    }
+
+    public void modifiedService(ServiceReference reference, Object service) {
+        removedService(reference, service);
+        addingService(reference);
+    }
+
+    public void removedService(ServiceReference reference, Object service) {
+        try {
+            NamespaceHandler handler = (NamespaceHandler) service;
+            Map<String, Object> props = new HashMap<String, Object>();
+            for (String name : reference.getPropertyKeys()) {
+                props.put(name, reference.getProperty(name));
+            }
+            unregisterHandler(handler, props);
+        } catch (Exception e) {
+            LOGGER.warn("Error unregistering NamespaceHandler", e);
+        }
+    }
+
+    public synchronized void registerHandler(NamespaceHandler handler, Map properties) {
+        List<URI> namespaces = getNamespaces(properties);
+        for (URI uri : namespaces) {
+            Set<NamespaceHandler> h = handlers.get(uri);
+            if (h == null) {
+                h = new HashSet<NamespaceHandler>();
+                handlers.put(uri, h);
+            }
+            if (h.add(handler)) {
+                for (NamespaceHandlerSetImpl s : sets) {
+                    s.registerHandler(uri, handler);
+                }
+            }
+        }
+    }
+
+    public synchronized void unregisterHandler(NamespaceHandler handler, Map properties) {
+        List<URI> namespaces = getNamespaces(properties);
+        for (URI uri : namespaces) {
+            Set<NamespaceHandler> h = handlers.get(uri);
+            if (h == null || !h.remove(handler)) {
+                continue;
+            }
+            for (NamespaceHandlerSetImpl s : sets) {
+                s.unregisterHandler(uri, handler);
+            }
+        }
+        removeSchemasFor(handler);
+    }
+
+    private static List<URI> getNamespaces(Map properties) {
+        Object ns = properties != null ? properties.get(NAMESPACE) : null;
+        if (ns == null) {
+            throw new IllegalArgumentException("NamespaceHandler service does not have an associated " + NAMESPACE + " property defined");
+        } else if (ns instanceof URI[]) {
+            return Arrays.asList((URI[]) ns);
+        } else if (ns instanceof URI) {
+            return Collections.singletonList((URI) ns);
+        } else if (ns instanceof String) {
+            return Collections.singletonList(URI.create((String) ns));
+        } else if (ns instanceof String[]) {
+            String[] strings = (String[]) ns;
+            List<URI> namespaces = new ArrayList<URI>(strings.length);
+            for (String string : strings) {
+                namespaces.add(URI.create(string));
+            }
+            return namespaces;
+        } else if (ns instanceof Collection) {
+            Collection col = (Collection) ns;
+            List<URI> namespaces = new ArrayList<URI>(col.size());
+            for (Object o : col) {
+                namespaces.add(toURI(o));
+            }
+            return namespaces;
+        } else if (ns instanceof Object[]) {
+            Object[] array = (Object[]) ns;
+            List<URI> namespaces = new ArrayList<URI>(array.length);
+            for (Object o : array) {
+                namespaces.add(toURI(o));
+            }
+            return namespaces;
+        } else {
+            throw new IllegalArgumentException("NamespaceHandler service has an associated " + NAMESPACE + " property defined which can not be converted to an array of URI");
+        }
+    }
+
+    private static URI toURI(Object o) {
+        if (o instanceof URI) {
+            return (URI) o;
+        } else if (o instanceof String) {
+            return URI.create((String) o);
+        } else {
+            throw new IllegalArgumentException("NamespaceHandler service has an associated " + NAMESPACE + " property defined which can not be converted to an array of URI");
+        }
+    }
+    
+    public synchronized NamespaceHandlerSet getNamespaceHandlers(Set<URI> uris, Bundle bundle) {
+        NamespaceHandlerSetImpl s = new NamespaceHandlerSetImpl(uris, bundle);
+        sets.add(s);
+        return s;
+    }
+
+    public void destroy() {
+        tracker.close();
+    }
+
+    public synchronized Schema getSchema(Map<URI, NamespaceHandler> handlers) throws IOException, SAXException {
+        Schema schema = null;
+        // Find a schema that can handle all the requested namespaces
+        // If it contains additional namespaces, it should not be a problem since
+        // they won't be used at all
+        for (Map<URI, NamespaceHandler> key : schemas.keySet()) {
+            boolean found = true;
+            for (URI uri : handlers.keySet()) {
+                if (!handlers.get(uri).equals(key.get(uri))) {
+                    found = false;
+                    break;
+                }
+            }
+            if (found) {
+                schema = schemas.get(key).get();
+                break;
+            }
+        }
+        if (schema == null) {
+            List<StreamSource> schemaSources = new ArrayList<StreamSource>();
+            try {
+                schemaSources.add(new StreamSource(getClass().getResourceAsStream("/org/apache/aries/blueprint/blueprint.xsd")));
+                // Create a schema for all namespaces known at this point
+                // It will speed things as it can be reused for all other blueprint containers
+                for (URI ns : handlers.keySet()) {
+                    URL url = handlers.get(ns).getSchemaLocation(ns.toString());
+                    if (url == null) {
+                        LOGGER.warn("No URL is defined for schema " + ns + ". This schema will not be validated");
+                    } else {
+                        schemaSources.add(new StreamSource(url.openStream()));
+                    }
+                }
+                schema = getSchemaFactory().newSchema(schemaSources.toArray(new Source[schemaSources.size()]));
+                // Remove schemas that are fully included
+                for (Iterator<Map<URI, NamespaceHandler>> iterator = schemas.keySet().iterator(); iterator.hasNext();) {
+                    Map<URI, NamespaceHandler> key = iterator.next();
+                    boolean found = true;
+                    for (URI uri : key.keySet()) {
+                        if (!key.get(uri).equals(handlers.get(uri))) {
+                            found = false;
+                            break;
+                        }
+                    }
+                    if (found) {
+                        iterator.remove();
+                        break;
+                    }
+                }
+                // Add our new schema
+                schemas.put(handlers, new SoftReference<Schema>(schema));
+            } finally {
+                for (StreamSource s : schemaSources) {
+                    try {
+                        s.getInputStream().close();
+                    } catch (IOException e) {
+                        // Ignore
+                    }
+                }
+            }
+        }
+        return schema;
+    }
+
+    protected synchronized void removeSchemasFor(NamespaceHandler handler) {
+        List<Map<URI, NamespaceHandler>> keys = new ArrayList<Map<URI, NamespaceHandler>>();
+        for (Map<URI, NamespaceHandler> key : schemas.keySet()) {
+            if (key.values().contains(handler)) {
+                keys.add(key);
+            }
+        }
+        for (Map<URI, NamespaceHandler> key : keys) {
+            schemas.remove(key);
+        }
+    }
+
+    private SchemaFactory getSchemaFactory() {
+        SchemaFactory schemaFactory = null;
+        if (schemaFactory == null) {
+            schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        }
+        return schemaFactory;
+    }
+
+    protected class NamespaceHandlerSetImpl implements NamespaceHandlerSet {
+
+        private final Map<Listener, Boolean> listeners;
+        private final Bundle bundle;
+        private final Set<URI> namespaces;
+        private final Map<URI, NamespaceHandler> handlers;
+        private Schema schema;
+
+        public NamespaceHandlerSetImpl(Set<URI> namespaces, Bundle bundle) {
+            this.listeners = new HashMap<Listener, Boolean>();
+            this.namespaces = namespaces;
+            this.bundle = bundle;
+            handlers = new HashMap<URI, NamespaceHandler>();
+            for (URI ns : namespaces) {
+                findCompatibleNamespaceHandler(ns);
+            }
+        }
+
+        public boolean isComplete() {
+            return handlers.size() == namespaces.size();
+        }
+
+        public Set<URI> getNamespaces() {
+            return namespaces;
+        }
+
+        public NamespaceHandler getNamespaceHandler(URI namespace) {
+            return handlers.get(namespace);
+        }
+
+        public Schema getSchema() throws SAXException, IOException {
+            if (!isComplete()) {
+                throw new IllegalStateException("NamespaceHandlerSet is not complete");
+            }
+            if (schema == null) {
+                schema = NamespaceHandlerRegistryImpl.this.getSchema(handlers);
+            }
+            return schema;
+        }
+
+        public synchronized void addListener(Listener listener) {
+            listeners.put(listener, Boolean.TRUE);
+        }
+
+        public synchronized void removeListener(Listener listener) {
+            listeners.remove(listener);
+        }
+
+        public void destroy() {
+            NamespaceHandlerRegistryImpl.this.sets.remove(this);
+        }
+
+        public void registerHandler(URI uri, NamespaceHandler handler) {
+            if (namespaces.contains(uri) && handlers.get(uri) == null) {
+                if (findCompatibleNamespaceHandler(uri) !=  null) {
+                    for (Listener listener : listeners.keySet()) {
+                        try {
+                            listener.namespaceHandlerRegistered(uri);
+                        } catch (Throwable t) {
+                            LOGGER.debug("Unexpected exception when notifying a NamespaceHandler listener", t);
+                        }
+                    }
+                }
+            }
+        }
+
+        public void unregisterHandler(URI uri, NamespaceHandler handler) {
+            if (handlers.get(uri) == handler) {
+                handlers.remove(uri);
+                for (Listener listener : listeners.keySet()) {
+                    try {
+                        listener.namespaceHandlerUnregistered(uri);
+                    } catch (Throwable t) {
+                        LOGGER.debug("Unexpected exception when notifying a NamespaceHandler listener", t);
+                    }
+                }
+            }
+        }
+
+        private NamespaceHandler findCompatibleNamespaceHandler(URI ns) {
+            Set<NamespaceHandler> candidates = NamespaceHandlerRegistryImpl.this.handlers.get(ns);
+            if (candidates != null) {
+                for (NamespaceHandler h : candidates) {
+                    Set<Class> classes = h.getManagedClasses();
+                    boolean compat = true;
+                    if (classes != null) {
+                        Set<Class> allClasses = new HashSet<Class>();
+                        for (Class cl : classes) {
+                            for (Class c = cl; c != null; c = c.getSuperclass()) {
+                                allClasses.add(c);
+                                for (Class i : c.getInterfaces()) {
+                                    allClasses.add(i);
+                                }
+                            }
+                        }
+                        for (Class cl : allClasses) {
+                            Class clb;
+                            try {
+                                clb = bundle.loadClass(cl.getName());
+                                if (clb != cl) {
+                                    compat = false;
+                                    break;
+                                }
+                            } catch (ClassNotFoundException e) {
+                                // Ignore
+                            } catch (NoClassDefFoundError e) {
+                                // Ignore
+                            }
+                        }
+                    }
+                    if (compat) {
+                        handlers.put(ns, h);
+                        return h;
+                    }
+                }
+            }
+            return null;
+        }
+    }
+
+    protected static Map<URI, NamespaceHandler> findHandlers(Map<URI, Set<NamespaceHandler>> allHandlers,
+                                                             Set<URI> namespaces,
+                                                             Bundle bundle) {
+        Map<URI, NamespaceHandler> handlers = new HashMap<URI, NamespaceHandler>();
+        Map<URI, Set<NamespaceHandler>> candidates = new HashMap<URI, Set<NamespaceHandler>>();
+        // Populate initial candidates
+        for (URI ns : namespaces) {
+            Set<NamespaceHandler> h = new HashSet<NamespaceHandler>();
+            if (allHandlers.get(ns) != null) {
+                h.addAll(allHandlers.get(ns));
+            }
+            candidates.put(ns, h);
+        }
+        // Exclude directly incompatible handlers
+        for (URI ns : namespaces) {
+            for (Iterator<NamespaceHandler> it = candidates.get(ns).iterator(); it.hasNext();) {
+                NamespaceHandler h = it.next();
+                Set<Class> classes = h.getManagedClasses();
+                boolean compat = true;
+                if (classes != null) {
+                    Set<Class> allClasses = new HashSet<Class>();
+                    for (Class cl : classes) {
+                        for (Class c = cl; c != null; c = c.getSuperclass()) {
+                            allClasses.add(c);
+                            for (Class i : c.getInterfaces()) {
+                                allClasses.add(i);
+                            }
+                        }
+                    }
+                    for (Class cl : allClasses) {
+                        Class clb;
+                        try {
+                            clb = bundle.loadClass(cl.getName());
+                        } catch (Throwable t) {
+                            clb = null;
+                        }
+                        if (clb != cl) {
+                            compat = false;
+                            break;
+                        }
+                    }
+                }
+                if (!compat) {
+                    it.remove();
+                }
+            }
+        }
+        // TODO: do we need to check if there are incompatibilities between namespaces?
+        // Pick the first ones
+        for (URI ns : namespaces) {
+            Set<NamespaceHandler> h = candidates.get(ns);
+            if (!h.isEmpty()) {
+                handlers.put(ns, h.iterator().next());
+            }
+        }
+        return handlers;
+    }
+
+    public static class LRUMap<K,V> extends AbstractMap<K,V> {
+
+        private final int bound;
+        private final LinkedList<Entry<K,V>> entries = new LinkedList<Entry<K,V>>();
+
+        private static class LRUEntry<K,V> implements Entry<K,V> {
+            private final K key;
+            private final V value;
+
+            private LRUEntry(K key, V value) {
+                this.key = key;
+                this.value = value;
+            }
+
+            public K getKey() {
+                return key;
+            }
+
+            public V getValue() {
+                return value;
+            }
+
+            public V setValue(V value) {
+                throw new UnsupportedOperationException();
+            }
+        }
+
+        private LRUMap(int bound) {
+            this.bound = bound;
+        }
+
+        public V get(Object key) {
+            if (key == null) {
+                throw new NullPointerException();
+            }
+            for (Entry<K,V> e : entries) {
+                if (e.getKey().equals(key)) {
+                    entries.remove(e);
+                    entries.addFirst(e);
+                    return e.getValue();
+                }
+            }
+            return null;
+        }
+
+        public V put(K key, V value) {
+            if (key == null) {
+                throw new NullPointerException();
+            }
+            V old = null;
+            for (Entry<K,V> e : entries) {
+                if (e.getKey().equals(key)) {
+                    entries.remove(e);
+                    old = e.getValue();
+                    break;
+                }
+            }
+            if (value != null) {
+                entries.addFirst(new LRUEntry<K,V>(key, value));
+                while (entries.size() > bound) {
+                    entries.removeLast();
+                }
+            }
+            return old;
+        }
+
+        public Set<Entry<K, V>> entrySet() {
+            return new AbstractSet<Entry<K,V>>() {
+                public Iterator<Entry<K, V>> iterator() {
+                    return entries.iterator();
+                }
+
+                public int size() {
+                    return entries.size();
+                }
+            };
+        }
+    }
+
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/AsmInterceptorWrapper.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/AsmInterceptorWrapper.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/AsmInterceptorWrapper.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/AsmInterceptorWrapper.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,202 @@
+/*
+ * 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.proxy;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Proxy;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.aries.blueprint.Interceptor;
+import org.osgi.service.blueprint.container.ComponentDefinitionException;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsmInterceptorWrapper
+{
+  private static final Logger LOGGER = LoggerFactory.getLogger(AsmInterceptorWrapper.class);
+  final static String LOG_ENTRY = "Method entry: {}, args {}";
+  final static String LOG_EXIT = "Method exit: {}, returning {}";
+  final static String LOG_EXCEPTION = "Caught exception";
+
+  public static Object createProxyObject(ClassLoader cl, ComponentMetadata cm,
+      List<Interceptor> interceptors, Object delegate, Class<?>... classesToProxy)
+  {
+
+    LOGGER.debug(LOG_ENTRY, "createProxyObject", new Object[] { cl, cm, interceptors, delegate,
+        classesToProxy });
+
+    Object proxyObject = null;
+    try {
+      if (classesToProxy.length == 1 && !classesToProxy[0].isInterface()) {
+
+        Class<?> classToProxy = classesToProxy[0];
+        LOGGER.debug("Single class to proxy: {}", classToProxy.getName());
+
+        boolean isProxy = isProxyClass(classToProxy);
+        LOGGER.debug("Class already a proxy: {}", isProxy);
+
+        if (isProxy) {
+          try {
+            LOGGER.debug("Get a new instance of existing proxy class");
+            /*
+             * the class is already a proxy, we should just invoke
+             * the constructor to get a new instance of the proxy
+             * with a new Collaborator using the specified delegate
+             */
+            proxyObject = classToProxy.getConstructor(InvocationHandler.class).newInstance(
+                new Collaborator(cm, interceptors, delegate));
+            LOGGER.debug("New proxy object instance {}", proxyObject);
+          } catch (InvocationTargetException e) {
+            LOGGER.debug(LOG_EXCEPTION, e);
+          } catch (NoSuchMethodException e) {
+            LOGGER.debug(LOG_EXCEPTION, e);
+          } catch (InstantiationException e) {
+            LOGGER.debug(LOG_EXCEPTION, e);
+          } catch (IllegalArgumentException e) {
+            LOGGER.debug(LOG_EXCEPTION, e);
+          } catch (SecurityException e) {
+            LOGGER.debug(LOG_EXCEPTION, e);
+          } catch (IllegalAccessException e) {
+            LOGGER.debug(LOG_EXCEPTION, e);
+          }
+        } else {
+          // we should generate a subclass proxy of the given class
+          LOGGER.debug("Generating a subclass proxy for: {}", classToProxy.getName());
+          proxyObject = createSubclassProxy(classToProxy, cm, interceptors, delegate);
+        }
+
+      } else {
+        // we had more than one class specified or only an interface
+        LOGGER.debug("Multiple classes or interface(s) to proxy: {}", classesToProxy);
+        // if we just have interfaces and no classes we default to using
+        // the interface proxy because we can't dynamically
+        // subclass more than one interface
+        // unless we have a class
+        // that implements all of them
+
+        // default to not subclass
+        boolean useSubclassProxy = false;
+
+        // loop through the classes checking if they are java interfaces
+        // if we find any class that isn't an interface we need to use
+        // the subclass proxy
+        Set<Class<?>> notInterfaces = new HashSet<Class<?>>();
+        for (Class<?> clazz : classesToProxy) {
+          if (!clazz.isInterface()) {
+            useSubclassProxy = true;
+            notInterfaces.add(clazz);
+          }
+        }
+
+        if (useSubclassProxy) {
+          LOGGER.debug("Going to use subclass proxy");
+          // if we need to use the subclass proxy then we need to find
+          // the most specific class
+          Class<?> classToProxy = null;
+          int deepest = 0;
+          // for each of the classes find out how deep it is in the
+          // hierarchy
+          for (Class<?> clazz : notInterfaces) {
+            Class<?> nextHighestClass = clazz;
+            int depth = 0;
+            do {
+              nextHighestClass = nextHighestClass.getSuperclass();
+              depth++;
+            } while (nextHighestClass != null);
+            if (depth > deepest) {
+              // if we find a class deeper than the one we already
+              // had
+              // it becomes the new most specific
+              deepest = depth;
+              classToProxy = clazz;
+            }
+          }
+          LOGGER.debug("Most specific class to proxy: {}", classToProxy);
+          proxyObject = createSubclassProxy(classToProxy, cm, interceptors, delegate);
+        } else {
+          LOGGER.debug("Going to use interface proxy");
+          proxyObject = Proxy.newProxyInstance(cl, classesToProxy, new Collaborator(cm,
+              interceptors, delegate));
+        }
+
+      }
+    } catch (UnableToProxyException e) {
+      // translate UnableToProxyException into
+      // ComponentDefinitionException
+      // if the bean is final, or otherwise unable to be proxied.
+      LOGGER.debug(LOG_EXIT, "createProxyObject", e);
+      throw new ComponentDefinitionException("Unable to proxy bean for interceptors: " + e);
+    }
+
+    LOGGER.debug(LOG_EXIT, "createProxyObject", proxyObject);
+
+    return proxyObject;
+  }
+
+  private static Object createSubclassProxy(Class<?> classToProxy, ComponentMetadata cm,
+      List<Interceptor> interceptors, Object delegate) throws UnableToProxyException
+  {
+    LOGGER.debug(LOG_ENTRY, "createSubclassProxy", new Object[] { classToProxy, cm, interceptors,
+        delegate });
+    LOGGER.debug("Generating a subclass proxy for: {}", classToProxy.getName());
+    try {
+      Object proxyObject = ProxySubclassGenerator.newProxySubclassInstance(classToProxy,
+          new Collaborator(cm, interceptors, delegate));
+
+      LOGGER.debug("Generated subclass proxy object: {}", proxyObject);
+      LOGGER.debug(LOG_EXIT, "createSubclassProxy", proxyObject);
+      return proxyObject;
+    } catch (UnableToProxyException e) {
+      LOGGER.debug(LOG_EXCEPTION, e);
+      LOGGER.debug(LOG_EXIT, "createSubclassProxy", e);
+      throw e;
+    }
+  }
+
+  static boolean isProxyClass(Class<?> clazz)
+  {
+    LOGGER.debug(LOG_ENTRY, "isProxyClass", new Object[] { clazz });
+    boolean isProxyObject = false;
+    isProxyObject = ProxySubclassGenerator.isProxySubclass(clazz);
+    LOGGER.debug(LOG_EXIT, "isProxyClass", isProxyObject);
+    return isProxyObject;
+  }
+
+  static Object unwrapObject(Object o)
+  {
+    LOGGER.debug(LOG_ENTRY, "unwrapObject", new Object[] { o });
+    InvocationHandler ih = null;
+    Object unwrappedObject = null;
+    if (ProxySubclassGenerator.isProxySubclass(o.getClass())) {
+      ih = ProxySubclassGenerator.getInvocationHandler(o);
+    } else {
+      ih = Proxy.getInvocationHandler(o);
+    }
+    if (ih instanceof Collaborator) {
+      unwrappedObject = ((Collaborator) ih).object;
+    }
+    LOGGER.debug(LOG_EXIT, "unwrapObject", unwrappedObject);
+    return unwrappedObject;
+  }
+
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/CgLibInterceptorWrapper.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/CgLibInterceptorWrapper.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/CgLibInterceptorWrapper.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/CgLibInterceptorWrapper.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,140 @@
+/*
+ * 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.proxy;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.apache.aries.blueprint.Interceptor;
+import org.osgi.service.blueprint.container.ComponentDefinitionException;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Simple class that coordinates creation of object wrappers that invoke
+ * interceptors.
+ */
+public class CgLibInterceptorWrapper {
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(CgLibInterceptorWrapper.class);
+
+    /**
+     * Classloader for CGLib usage, that spans the delegate classloader (for the
+     * bean being intercepted), the blueprint classloader (for the wrapped bean
+     * interface), and the cglib classloader (for cglib packages).
+     */
+    private static class BridgingClassLoader extends ClassLoader {
+        private ClassLoader cgLibClassLoader;
+        private ClassLoader blueprintClassLoader;
+        private ClassLoader delegateClassLoader;
+
+        public BridgingClassLoader(ClassLoader delegate) {
+            this.delegateClassLoader = delegate;
+            this.cgLibClassLoader = Enhancer.class.getClassLoader();
+            this.blueprintClassLoader = this.getClass().getClassLoader();
+        }
+
+        public Class<?> loadClass(String className)
+                throws ClassNotFoundException {
+            if (className.equals("org.apache.aries.blueprint.proxy.WrapperedObject")) {
+                //CgLib will need to use 'WrapperedObject' which is from us.
+                return blueprintClassLoader.loadClass(className);
+            } else if (className.startsWith("net.sf.cglib")) {
+                //CgLib will need to load classes from within its bundle, that we 
+                //cannot load with the blueprintClassLoader.
+                return cgLibClassLoader.loadClass(className);
+            } else {
+                //CgLib will need to load classes from the application bundle.
+                return delegateClassLoader.loadClass(className);
+            }
+        }
+    }
+
+    /**
+     * Create a proxy object, given a delegate instance, associated metadata,
+     * and a list of interceptors.
+     * <p>
+     * 
+     * @param cl
+     *            Classloader to use to create proxy instance
+     * @param cm
+     *            ComponentMetadata for delegate instance
+     * @param interceptors
+     *            List of Interceptor for invocation pre/post.
+     * @param delegate
+     *            Instance to delegate method calls to.
+     * @param classesToProxy
+     *            List of interfaces/classes this proxy should present itself
+     *            as.
+     * @return Interceptor wrappered proxy. Can be used functionally the same as
+     *         'delegate' but will invoke interceptors. Will implement WrapperedObject
+     *         which can be used to unwrap the original object.
+     * @throws ComponentDefinitionException
+     *             if the delegate cannot be proxied.
+     */
+    public static Object createProxyObject(ClassLoader cl,
+            ComponentMetadata cm, List<Interceptor> interceptors,
+            Object delegate, Class<?>... classesToProxy) {
+
+        LOGGER.debug("createProxyObject " + cm.getId() + " " + delegate);
+        final Collaborator c = new Collaborator(cm, interceptors, delegate);
+        Enhancer e = new Enhancer();
+
+        e.setClassLoader(new BridgingClassLoader(cl));
+        e.setInterceptDuringConstruction(false);
+
+        // add the WrapperedObject interface to the list of interfaces for the
+        // subclass.
+        int origIfLen = 0;
+        if (classesToProxy != null)
+            origIfLen = classesToProxy.length;
+        Class<?> ifs[] = new Class<?>[origIfLen + 1];
+        ifs[0] = WrapperedObject.class;
+        if (classesToProxy != null && classesToProxy.length > 0) {
+            for (int i = 1; i < (classesToProxy.length + 1); i++) {
+                ifs[i] = classesToProxy[i - 1];
+            }
+        }
+        e.setInterfaces(ifs);
+        
+        e.setSuperclass(delegate.getClass());
+        e.setCallback(new MethodInterceptor() {
+            public Object intercept(Object arg0, Method arg1, Object[] arg2,
+                    MethodProxy arg3) throws Throwable {
+                return c.invoke(arg0, arg1, arg2);
+            }
+        });
+
+        Object wrappered = null;
+        try {
+            wrappered = e.create();
+        } catch (IllegalArgumentException iae) {
+            // thrown if the bean has no zero-arg constructor,
+            // or is final, or otherwise unable to be proxied.
+            throw new ComponentDefinitionException(
+                    "Unable to proxy bean for interceptors: " + iae);
+        }
+        return wrappered;
+    }
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/Collaborator.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/Collaborator.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/Collaborator.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/Collaborator.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,287 @@
+/*
+ * 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.proxy;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.List;
+import java.util.Stack;
+
+import org.apache.aries.blueprint.Interceptor;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A collaborator which ensures preInvoke and postInvoke occur before and after
+ * method invocation
+ */
+class Collaborator implements InvocationHandler, Serializable {
+
+    /** Serial version UID for this class */
+    private static final long serialVersionUID = -58189302118314469L;
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(Collaborator.class);
+
+    /** The invocation handler to call */
+    final InvocationHandler delegate;
+    final Object object;
+
+    private transient List<Interceptor> interceptors = null;
+    private transient ComponentMetadata cm = null;
+    private transient boolean sorted = false;
+
+    Collaborator(ComponentMetadata cm, List<Interceptor> interceptors,
+            final Object delegateObj) {
+        this.cm = cm;
+        this.object = delegateObj;
+        this.delegate = new InvocationHandler() {
+            private void onUnexpectedException(Throwable cause) {
+                throw new Error("Unreachable catch statement reached", cause);
+            }
+
+            public Object invoke(Object proxy, Method method, Object[] args)
+                    throws Throwable {
+                Object result;
+                try {
+                    result = method.invoke(object, args);
+                } catch (InvocationTargetException ite) {
+                    // We are invisible, so unwrap and throw the cause as
+                    // though we called the method directly.
+                    throw ite.getCause();
+                } catch (IllegalAccessException e) {
+                    onUnexpectedException(e);
+                    return null;
+                } catch (IllegalArgumentException e) {
+                    onUnexpectedException(e);
+                    return null;
+                } catch (SecurityException e) {
+                    onUnexpectedException(e);
+                    return null;
+                }
+
+                return result;
+            }
+        };
+        this.interceptors = interceptors;
+    }
+
+    /**
+     * Invoke the preCall method on the interceptor
+     * 
+     * @param cm
+     *            : component Metadata
+     * @param m
+     *            : method
+     * @param parameters
+     *            : method paramters
+     * @throws Throwable
+     */
+    private void preCallInterceptor(List<Interceptor> interceptorList,
+            ComponentMetadata cm, Method m, Object[] parameters,
+            Stack<Collaborator.StackElement> calledInterceptors)
+            throws Throwable {
+        if ((interceptors != null) && !(interceptors.isEmpty())) {
+            for (Interceptor im : interceptorList) {
+                Collaborator.StackElement se = new StackElement(im);
+
+                // should we do this before or after the preCall ?
+                calledInterceptors.push(se);
+
+                // allow exceptions to propagate
+                se.setPreCallToken(im.preCall(cm, m, parameters));
+            }
+        }
+    }
+
+    public Object invoke(Object proxy, Method method, Object[] args)
+            throws Throwable {
+        Object toReturn = null;
+        
+        // Added method to unwrap from the collaborator.
+        if (method.getName().equals("unwrapObject")
+                && method.getDeclaringClass() == WrapperedObject.class) {
+            toReturn = object;
+        } else
+        // Unwrap calls for equals
+        if (method.getName().equals("equals")
+                && method.getDeclaringClass() == Object.class) {
+            // replace the wrapper with the unwrapped object, to
+            // enable object identity etc to function.
+            if (args[0] instanceof WrapperedObject) {
+                // unwrap in the WrapperedObject case
+                args[0] = ((WrapperedObject) args[0]).unwrapObject();
+            } else if (AsmInterceptorWrapper.isProxyClass(args[0].getClass())
+	                    || Proxy.isProxyClass(args[0].getClass())) {
+                // unwrap in the asm case
+                args[0] = AsmInterceptorWrapper.unwrapObject(args[0]);
+            }
+            toReturn = delegate.invoke(proxy, method, args);
+        } else if (method.getName().equals("finalize") && method.getParameterTypes().length == 0) {
+            // special case finalize, don't route through to delegate because that will get its own call
+            toReturn = null;
+        } else 
+        // Proxy the call through to the delegate, wrapping call in 
+        // interceptor invocations.
+        {
+            Stack<Collaborator.StackElement> calledInterceptors = new Stack<Collaborator.StackElement>();
+            boolean inInvoke = false;
+            try {
+                preCallInterceptor(interceptors, cm, method, args,
+                        calledInterceptors);
+                inInvoke = true;
+                toReturn = delegate.invoke(proxy, method, args);
+                inInvoke = false;
+                postCallInterceptorWithReturn(cm, method, toReturn,
+                        calledInterceptors);
+
+            } catch (Throwable e) {
+                // log the exception e
+                LOGGER.error("invoke", e);
+
+                // if we catch an exception we decide carefully which one to
+                // throw onwards
+                Throwable exceptionToRethrow = null;
+                // if the exception came from a precall or postcall interceptor
+                // we will rethrow it
+                // after we cycle through the rest of the interceptors using
+                // postCallInterceptorWithException
+                if (!inInvoke) {
+                    exceptionToRethrow = e;
+                }
+                // if the exception didn't come from precall or postcall then it
+                // came from invoke
+                // we will rethrow this exception if it is not a runtime
+                // exception
+                else {
+                    if (!(e instanceof RuntimeException)) {
+                        exceptionToRethrow = e;
+                    }
+                }
+                try {
+                    postCallInterceptorWithException(cm, method, e,
+                            calledInterceptors);
+                } catch (Exception f) {
+                    // we caught an exception from
+                    // postCallInterceptorWithException
+                    // logger.catching("invoke", f);
+                    // if we haven't already chosen an exception to rethrow then
+                    // we will throw this exception
+                    if (exceptionToRethrow == null) {
+                        exceptionToRethrow = f;
+                    }
+                }
+                // if we made it this far without choosing an exception we
+                // should throw e
+                if (exceptionToRethrow == null) {
+                    exceptionToRethrow = e;
+                }
+                throw exceptionToRethrow;
+            }
+        }
+        return toReturn;
+    }
+
+    /**
+     * Called when the method is called and returned normally
+     * 
+     * @param cm
+     *            : component metadata
+     * @param method
+     *            : method
+     * @param returnType
+     *            : return type
+     * @throws Throwable
+     */
+    private void postCallInterceptorWithReturn(ComponentMetadata cm,
+            Method method, Object returnType,
+            Stack<Collaborator.StackElement> calledInterceptors)
+            throws Throwable {
+
+        while (!calledInterceptors.isEmpty()) {
+            Collaborator.StackElement se = calledInterceptors.pop();
+            try {
+                se.interceptor.postCallWithReturn(cm, method, returnType, se
+                        .getPreCallToken());
+            } catch (Throwable t) {
+                LOGGER.error("postCallInterceptorWithReturn", t);
+                // propagate this to invoke ... further interceptors will be
+                // called via the postCallInterceptorWithException method
+                throw t;
+            }
+        } // end while
+    }
+
+    /**
+     * Called when the method is called and returned with an exception
+     * 
+     * @param cm
+     *            : component metadata
+     * @param method
+     *            : method
+     * @param exception
+     *            : exception throwed
+     */
+    private void postCallInterceptorWithException(ComponentMetadata cm,
+            Method method, Throwable exception,
+            Stack<Collaborator.StackElement> calledInterceptors)
+            throws Throwable {
+        Throwable tobeRethrown = null;
+        while (!calledInterceptors.isEmpty()) {
+            Collaborator.StackElement se = calledInterceptors.pop();
+
+            try {
+                se.interceptor.postCallWithException(cm, method, exception, se
+                        .getPreCallToken());
+            } catch (Throwable t) {
+                // log the exception
+                LOGGER.error("postCallInterceptorWithException", t);
+                if (tobeRethrown == null)
+                    tobeRethrown = t;
+            }
+
+        } // end while
+
+        if (tobeRethrown != null)
+            throw tobeRethrown;
+    }
+
+    // info to store on interceptor stack during invoke
+    private static class StackElement {
+        private Interceptor interceptor;
+        private Object preCallToken;
+
+        private StackElement(Interceptor i) {
+            interceptor = i;
+        }
+
+        private void setPreCallToken(Object preCallToken) {
+            this.preCallToken = preCallToken;
+        }
+
+        private Object getPreCallToken() {
+            return preCallToken;
+        }
+
+    }
+}
\ No newline at end of file

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/FinalModifierException.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/FinalModifierException.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/FinalModifierException.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/FinalModifierException.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,51 @@
+/*
+ * 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.proxy;
+
+public class FinalModifierException extends UnableToProxyException
+{
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = -3139392096074404448L;
+  public String finalMethods = null;
+
+  public FinalModifierException(Class<?> clazz)
+  {
+    super(clazz);
+  }
+
+  public FinalModifierException(Class<?> clazz, String finalMethods)
+  {
+    super(clazz);
+    this.finalMethods = finalMethods;
+  }
+
+  public boolean isFinalClass()
+  {
+    return (finalMethods == null || finalMethods.equals(""));
+  }
+
+  public String getFinalMethods()
+  {
+    return finalMethods;
+  }
+
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassBytecodeGenerationException.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassBytecodeGenerationException.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassBytecodeGenerationException.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassBytecodeGenerationException.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.proxy;
+
+public class ProxyClassBytecodeGenerationException extends UnableToProxyException
+{
+
+  /**
+   * 
+   */
+  private static final long serialVersionUID = -8015178382210046784L;
+
+  public ProxyClassBytecodeGenerationException(String string, Throwable throwable)
+  {
+    super(string, throwable);
+  }
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassDefinitionException.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassDefinitionException.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassDefinitionException.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassDefinitionException.java Sun Feb 27 20:50:38 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.proxy;
+
+public class ProxyClassDefinitionException extends UnableToProxyException
+{
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 604215734831044743L;
+
+  public ProxyClassDefinitionException(String className, Exception e)
+  {
+    super(className, e);
+  }
+}

Added: aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassInstantiationException.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassInstantiationException.java?rev=1075143&view=auto
==============================================================================
--- aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassInstantiationException.java (added)
+++ aries/tags/blueprint-0.2.1/blueprint-core/src/main/java/org/apache/aries/blueprint/proxy/ProxyClassInstantiationException.java Sun Feb 27 20:50:38 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.proxy;
+
+public class ProxyClassInstantiationException extends UnableToProxyException
+{
+  /**
+   * 
+   */
+  private static final long serialVersionUID = -2303296601108980837L;
+
+  public ProxyClassInstantiationException(Class<?> clazz, Exception e)
+  {
+    super(clazz, e);
+  }
+
+}