You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2006/10/30 17:36:06 UTC
svn commit: r469182 [4/6] - in /incubator/felix/trunk: ipojo.metadata/
ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/ ipojo.plugin/
ipojo.plugin/src/main/java/org/apache/felix/ipojo/manipulation/
ipojo.plugin/src/main/java/org/apache/fel...
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency;
@@ -22,7 +24,8 @@
import java.util.logging.Level;
import org.apache.felix.ipojo.Activator;
-import org.apache.felix.ipojo.ComponentManager;
+import org.apache.felix.ipojo.ComponentManagerImpl;
+import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
@@ -90,6 +93,11 @@
*/
private Class m_clazz;
+ /**
+ * LDAP Filter of the dependency.
+ */
+ private Filter m_filter;
+
/**
* Dependency contructor. After the creation the dependency is not started.
@@ -97,7 +105,7 @@
* @param dm : the depednency metadata
*/
public Dependency(DependencyHandler dh, DependencyMetadata dm) {
- m_handler = dh;
+ m_handler = dh;
m_metadata = dm;
}
@@ -115,15 +123,15 @@
* @return the used service.
*/
public HashMap getUsedServices() {
- HashMap hm = new HashMap();
- if (m_metadata.isMultiple()) {
- for (int i = 0; i < m_ref.length; i++) {
- if (i < m_services.length) { hm.put(((Object)m_services[i]).toString(), m_ref[i]); }
- }
- } else {
- if (m_ref.length != 0 && m_services.length != 0) { hm.put(((Object)m_services[0]).toString(), m_ref[0]); }
- }
- return hm;
+ HashMap hm = new HashMap();
+ if (m_metadata.isMultiple()) {
+ for (int i = 0; i < m_ref.length; i++) {
+ if (i < m_services.length) { hm.put(((Object) m_services[i]).toString(), m_ref[i]); }
+ }
+ } else {
+ if (m_ref.length != 0 && m_services.length != 0) { hm.put(((Object) m_services[0]).toString(), m_ref[0]); }
+ }
+ return hm;
}
/**
@@ -141,7 +149,7 @@
*/
protected Object get() {
Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Call get for a dependency on : " + m_metadata.getServiceSpecification()
- + " Multiple : " + m_metadata.isMultiple() + " Optional : " + m_metadata.isOptional());
+ + " Multiple : " + m_metadata.isMultiple() + " Optional : " + m_metadata.isOptional());
try {
// 1 : Test if there is any change in the reference list :
@@ -149,15 +157,15 @@
if (!m_metadata.isMultiple()) {
if (m_services.length > 0) {
return m_services[0]; }
- }
+ }
else {
return m_services;
- }
+ }
}
// 2 : Else there is a change in the list -> recompute the m_services array
Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Create a service array of " + m_clazz.getName());
- m_services = (Object[])Array.newInstance(m_clazz, m_ref.length);
+ m_services = (Object[]) Array.newInstance(m_clazz, m_ref.length);
for (int i = 0; i < m_ref.length; i++) {
m_services[i] = m_handler.getComponentManager().getContext().getService(m_ref[i]);
@@ -173,33 +181,33 @@
if (m_services.length > 0) {
return m_services[0];
} else {
- // Load the nullable class
- String[] segment = m_metadata.getServiceSpecification().split("[.]");
- String className = "org.apache.felix.ipojo." + segment[segment.length - 1] + "Nullable";
- Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Try to load the nullable class for " + getMetadata().getServiceSpecification() + " -> " + className);
- Class nullableClazz = m_handler.getNullableClass(className);
-
- if (nullableClazz == null) {
- Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Cannot load the nullable class to return a dependency object for " + m_metadata.getField() + " -> " + m_metadata.getServiceSpecification());
- return null;
- }
-
- // The nullable class is loaded, create the object and return it
- Object instance = nullableClazz.newInstance();
- Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Nullable object created for " + getMetadata().getServiceSpecification() + " -> " + instance);
- return instance;
- }
+ // Load the nullable class
+ String[] segment = m_metadata.getServiceSpecification().split("[.]");
+ String className = "org.apache.felix.ipojo." + segment[segment.length - 1] + "Nullable";
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Try to load the nullable class for " + getMetadata().getServiceSpecification() + " -> " + className);
+ Class nullableClazz = m_handler.getNullableClass(className);
+
+ if (nullableClazz == null) {
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Cannot load the nullable class to return a dependency object for " + m_metadata.getField() + " -> " + m_metadata.getServiceSpecification());
+ return null;
+ }
+
+ // The nullable class is loaded, create the object and return it
+ Object instance = nullableClazz.newInstance();
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Nullable object created for " + getMetadata().getServiceSpecification() + " -> " + instance);
+ return instance;
+ }
}
else { // Multiple dependency
- return m_services;
+ return m_services;
}
} catch (Exception e) {
// There is a problem in the dependency resolving (like in stopping method)
if (!m_metadata.isMultiple()) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Return null, an exception was throwed in the get method -> " + e.getMessage());
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Return null, an exception was throwed in the get method -> " + e.getMessage());
return null; }
else {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Return an empty array, an exception was throwed in the get method" + e.getMessage());
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Return an empty array, an exception was throwed in the get method" + e.getMessage());
return Array.newInstance(m_clazz, 0); }
}
}
@@ -215,133 +223,272 @@
// If a service goes way.
if (event.getType() == ServiceEvent.UNREGISTERING) {
Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] A service is gone -> " + event.getServiceReference().getBundle());
- if (containsSR(event.getServiceReference())) {
- // Call unbind method
- callUnbindMethod(event.getServiceReference());
- // Unget the service reference
- m_handler.getComponentManager().getContext().ungetService(event.getServiceReference());
- int index = removeReference(event.getServiceReference());
-
- // Is the state valid or invalid
- if (m_ref.length == 0 && !m_metadata.isOptional()) {
- m_state = UNRESOLVED;
- }
- if (m_ref.length == 0 && m_metadata.isOptional()) {
- m_state = RESOLVED;
- }
- // Is there any change ?
- if (!m_metadata.isMultiple() && index == 0) { m_change = true; }
- if (!m_metadata.isMultiple() && index != 0) { m_change = false; }
- if (m_metadata.isMultiple()) { m_change = true; }
- }
- m_handler.checkContext();
- return;
+ if (containsSR(event.getServiceReference())) { departureManagement(event.getServiceReference()); }
+ return;
}
// If a service arrives
if (event.getType() == ServiceEvent.REGISTERED) {
- // Add the new service inside the ref list
- Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Add a service for a dependency");
- addReference(event.getServiceReference());
- if (isSatisfied()) {
- m_state = RESOLVED;
- if (m_metadata.isMultiple() || m_ref.length == 1) { m_change = true; }
- callBindMethod(event.getServiceReference());
+ if (m_filter.match(event.getServiceReference())) { arrivalManagement(event.getServiceReference()); return; }
+ else { return; }
+ }
+
+ // If a service is modified
+ if (event.getType() == ServiceEvent.MODIFIED) {
+ if (m_filter.match(event.getServiceReference())) {
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] A service with a filter matching is arrived -> " + event.getServiceReference().getBundle());
+ if (!containsSR(event.getServiceReference())) { arrivalManagement(event.getServiceReference()); }
}
- m_handler.checkContext();
+ else {
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] A service with a filter matching has gone -> " + event.getServiceReference().getBundle());
+ if (containsSR(event.getServiceReference())) { departureManagement(event.getServiceReference()); }
+ }
+ return;
}
}
}
+ /**
+ * Method called when a service arrives.
+ * @param ref : the arriving service reference
+ */
+ private void arrivalManagement(ServiceReference ref) {
+ // Add the new service inside the ref list
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Add a service for a dependency");
+ addReference(ref);
+ if (isSatisfied()) {
+ m_state = RESOLVED;
+ if (m_metadata.isMultiple() || m_ref.length == 1) { m_change = true; callBindMethod(ref); }
+ }
+ m_handler.checkContext();
+ }
+
+ /**
+ * Method called when a service goes away.
+ * @param ref : the leaving service reference
+ */
+ private void departureManagement(ServiceReference ref) {
+ // Call unbind method
+ if (!m_metadata.isMultiple() && ref == m_ref[0]) { callUnbindMethod(ref); }
+ if (m_metadata.isMultiple()) { callUnbindMethod(ref); }
+
+ // Unget the service reference
+ m_handler.getComponentManager().getContext().ungetService(ref);
+ int index = removeReference(ref);
+
+ // Is the state valid or invalid
+ if (m_ref.length == 0 && !m_metadata.isOptional()) {
+ m_state = UNRESOLVED;
+ }
+ if (m_ref.length == 0 && m_metadata.isOptional()) {
+ m_state = RESOLVED;
+ }
+ // Is there any change ?
+ if (!m_metadata.isMultiple() && index == 0) {
+ m_change = true;
+ if (m_ref.length != 0) { callBindMethod(m_ref[0]); }
+ }
+ if (!m_metadata.isMultiple() && index != 0) { m_change = false; }
+ if (m_metadata.isMultiple()) { m_change = true; }
+
+ m_handler.checkContext();
+ return;
+ }
+
+ /**
+ * Call unbind callback method.
+ * @param ref : reference to send (if accepted) to the method
+ */
private void callUnbindMethod(ServiceReference ref) {
- if (m_handler.getComponentManager().getState() == ComponentManager.VALID && m_metadata.isMultiple()) {
- for (int i = 0; i < m_metadata.getCallbacks().length; i++) {
- if (m_metadata.getCallbacks()[i].getMethodType() == DependencyCallback.UNBIND) {
- // Try to call the bind method with a service reference inside
- try {
- m_metadata.getCallbacks()[i].call(new Object[] {ref});
- } catch (NoSuchMethodException e) {
- // The method was not found : try without service reference
- try {
- m_metadata.getCallbacks()[i].call();
- } catch (NoSuchMethodException e1) {
- // The method was not found : try with the service object
- try {
- m_metadata.getCallbacks()[i].call(new Object[] {m_handler.getComponentManager().getContext().getService(ref)});
- } catch (NoSuchMethodException e2) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Unbind method not found : " + e1.getMessage());
- return;
- } catch (IllegalAccessException e2) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on unbind method : " + e2.getMessage());
- return;
- } catch (InvocationTargetException e2) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the unbind method " + e2.getMessage());
- return;
- }
- } catch (IllegalAccessException e1) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on unbind method : " + e1.getMessage());
- return;
- } catch (InvocationTargetException e1) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the unbind method " + e1.getMessage());
- return;
- }
-
- } catch (IllegalAccessException e) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e.getMessage());
- return;
- } catch (InvocationTargetException e) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e.getMessage());
- return;
- }
- }
- }
+ if (m_handler.getComponentManager().getState() == ComponentManagerImpl.VALID) {
+ for (int i = 0; i < m_metadata.getCallbacks().length; i++) {
+ if (m_metadata.getCallbacks()[i].getMethodType() == DependencyCallback.UNBIND) {
+ // Try to call the bind method with a service reference inside
+ try {
+ m_metadata.getCallbacks()[i].call(new Object[] {ref});
+ } catch (NoSuchMethodException e) {
+ // The method was not found : try without service reference
+ try {
+ m_metadata.getCallbacks()[i].call();
+ } catch (NoSuchMethodException e1) {
+ // The method was not found : try with the service object
+ try {
+ m_metadata.getCallbacks()[i].call(new Object[] {m_handler.getComponentManager().getContext().getService(ref)});
+ } catch (NoSuchMethodException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Unbind method not found : " + e1.getMessage());
+ return;
+ } catch (IllegalAccessException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on unbind method : " + e2.getMessage());
+ return;
+ } catch (InvocationTargetException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the unbind method " + e2.getMessage());
+ return;
+ }
+ } catch (IllegalAccessException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on unbind method : " + e1.getMessage());
+ return;
+ } catch (InvocationTargetException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the unbind method " + e1.getMessage());
+ return;
+ }
+
+ } catch (IllegalAccessException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e.getMessage());
+ return;
+ } catch (InvocationTargetException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e.getMessage());
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Call the bind method.
+ * @param instance : instance on which calling the bind method.
+ */
+ protected void callBindMethod(Object instance) {
+ // Check optional case : nullable object case : do not call bind on nullable object
+ if (m_metadata.isOptional() && m_ref.length == 0) { return; }
+
+
+ if (m_metadata.isMultiple()) {
+ for (int i = 0; i < m_ref.length; i++) {
+ for (int j = 0; j < m_metadata.getCallbacks().length; j++) {
+ if (m_metadata.getCallbacks()[j].getMethodType() == DependencyCallback.BIND) {
+ // Try to call the bind method with a service reference inside
+ try {
+ m_metadata.getCallbacks()[j].call(instance, new Object[] {m_ref[i]});
+ } catch (NoSuchMethodException e) {
+ // The method was not found : try without service reference
+ try {
+ m_metadata.getCallbacks()[j].call(instance);
+ } catch (NoSuchMethodException e1) {
+ // The method was not found : try with the service object
+ try {
+ m_metadata.getCallbacks()[j].call(instance, new Object[] {m_handler.getComponentManager().getContext().getService(m_ref[i])});
+ } catch (NoSuchMethodException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Bind method not found : " + e1.getMessage());
+ return;
+ } catch (IllegalAccessException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e2.getMessage());
+ return;
+ } catch (InvocationTargetException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e2.getMessage());
+ return;
+ }
+ } catch (IllegalAccessException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e1.getMessage());
+ return;
+ } catch (InvocationTargetException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e1.getMessage());
+ return;
+ }
+ } catch (IllegalAccessException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e.getMessage());
+ return;
+ } catch (InvocationTargetException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e.getMessage());
+ return;
+ }
+ }
+ }
+ }
+ } else {
+ for (int j = 0; j < m_metadata.getCallbacks().length; j++) {
+ if (m_metadata.getCallbacks()[j].getMethodType() == DependencyCallback.BIND) {
+ // Try to call the bind method with a service reference inside
+ try {
+ m_metadata.getCallbacks()[j].call(instance, new Object[] {m_ref[0]});
+ } catch (NoSuchMethodException e) {
+ // The method was not found : try without service reference
+ try {
+ Activator.getLogger().log(Level.WARNING, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Call the Bind method");
+ m_metadata.getCallbacks()[j].call(instance);
+ } catch (NoSuchMethodException e1) {
+ // The method was not found : try with the service object
+ try {
+ m_metadata.getCallbacks()[j].call(new Object[] {m_handler.getComponentManager().getContext().getService(m_ref[0])});
+ } catch (NoSuchMethodException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Bind method not found : " + e1.getMessage());
+ return;
+ } catch (IllegalAccessException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e2.getMessage());
+ return;
+ } catch (InvocationTargetException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e2.getMessage());
+ return;
+ }
+ } catch (IllegalAccessException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e1.getMessage());
+ return;
+ } catch (InvocationTargetException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e1.getMessage());
+ return;
+ }
+
+ } catch (IllegalAccessException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e.getMessage());
+ return;
+ } catch (InvocationTargetException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e.getMessage());
+ return;
+ }
+ }
+ }
}
}
+ /**
+ * Call bind method with the service reference in parameter (if accepted).
+ * @param ref : the service reference of the new service
+ */
private void callBindMethod(ServiceReference ref) {
- // call bind method :
- if (m_handler.getComponentManager().getState() == ComponentManager.VALID && m_metadata.isMultiple()) {
- for (int i = 0; i < m_metadata.getCallbacks().length; i++) {
- if (m_metadata.getCallbacks()[i].getMethodType() == DependencyCallback.BIND) {
- // Try to call the bind method with a service reference inside
- try {
- m_metadata.getCallbacks()[i].call(new Object[] {ref});
- } catch (NoSuchMethodException e) {
- // The method was not found : try without service reference
- try {
- m_metadata.getCallbacks()[i].call();
- } catch (NoSuchMethodException e1) {
- // The method was not found : try with the service object
- try {
- m_metadata.getCallbacks()[i].call(new Object[] {m_handler.getComponentManager().getContext().getService(ref)});
- } catch (NoSuchMethodException e2) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Bind method not found : " + e1.getMessage());
- return;
- } catch (IllegalAccessException e2) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e2.getMessage());
- return;
- } catch (InvocationTargetException e2) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e2.getMessage());
- return;
- }
- } catch (IllegalAccessException e1) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e1.getMessage());
- return;
- } catch (InvocationTargetException e1) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e1.getMessage());
- return;
- }
-
- } catch (IllegalAccessException e) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e.getMessage());
- return;
- } catch (InvocationTargetException e) {
- Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e.getMessage());
- return;
- }
- }
- }
+ // call bind method :
+ if (m_handler.getComponentManager().getState() == ComponentManagerImpl.VALID) {
+ for (int i = 0; i < m_metadata.getCallbacks().length; i++) {
+ if (m_metadata.getCallbacks()[i].getMethodType() == DependencyCallback.BIND) {
+ // Try to call the bind method with a service reference inside
+ try {
+ m_metadata.getCallbacks()[i].call(new Object[] {ref});
+ } catch (NoSuchMethodException e) {
+ // The method was not found : try without service reference
+ try {
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Call the Bind method");
+ m_metadata.getCallbacks()[i].call();
+ } catch (NoSuchMethodException e1) {
+ // The method was not found : try with the service object
+ try {
+ m_metadata.getCallbacks()[i].call(new Object[] {m_handler.getComponentManager().getContext().getService(ref)});
+ } catch (NoSuchMethodException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Bind method not found : " + e1.getMessage());
+ return;
+ } catch (IllegalAccessException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e2.getMessage());
+ return;
+ } catch (InvocationTargetException e2) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e2.getMessage());
+ return;
+ }
+ } catch (IllegalAccessException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e1.getMessage());
+ return;
+ } catch (InvocationTargetException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e1.getMessage());
+ return;
+ }
+
+ } catch (IllegalAccessException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Illegal access on bind method : " + e.getMessage());
+ return;
+ } catch (InvocationTargetException e) {
+ Activator.getLogger().log(Level.SEVERE, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Dependency Callback Error : Invocation Target Exception in the bind method " + e.getMessage());
+ return;
+ }
+ }
+ }
}
}
@@ -372,13 +519,16 @@
try {
// Look if the service is already present :
ServiceReference[] sr = m_handler.getComponentManager().getContext().getServiceReferences(
- m_metadata.getServiceSpecification(), filter);
+ m_metadata.getServiceSpecification(), filter);
if (sr != null) {
for (int i = 0; i < sr.length; i++) { addReference(sr[i]); }
m_state = RESOLVED;
- }
+ }
// Register a listener :
- m_handler.getComponentManager().getContext().addServiceListener(this, filter);
+ //m_handler.getComponentManager().getContext().addServiceListener(this, filter); // Try without filter
+ m_handler.getComponentManager().getContext().addServiceListener(this);
+ m_filter = m_handler.getComponentManager().getContext().createFilter(filter); // Store the filter
+ Activator.getLogger().log(Level.INFO, "[" + m_handler.getComponentManager().getComponentMetatada().getClassName() + "] Create a filter from : " + filter);
m_change = true;
}
catch (InvalidSyntaxException e1) {
@@ -396,7 +546,7 @@
// Unget all services references
for (int i = 0; i < m_ref.length; i++) {
- m_handler.getComponentManager().getContext().ungetService(m_ref[i]);
+ m_handler.getComponentManager().getContext().ungetService(m_ref[i]);
}
m_ref = new ServiceReference[0];
@@ -410,7 +560,8 @@
* @return the state of the dependency (1 : valid, 2 : invalid)
*/
public int getState() {
- return m_state;
+ if (m_metadata.isOptional()) { return 1; }
+ else { return m_state; }
}
/**
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyCallback.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyCallback.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyCallback.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyCallback.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency;
@@ -27,20 +29,20 @@
*/
public class DependencyCallback {
- /**
- * Bind method (called when a service arrives).
- */
- public static final int BIND = 0;
-
- /**
- * Unbind method (called when a service disappears).
- */
- public static final int UNBIND = 1;
-
- /**
- * Is the method a bind method or an unbind method ?
- */
- private int m_methodType;
+ /**
+ * Bind method (called when a service arrives).
+ */
+ public static final int BIND = 0;
+
+ /**
+ * Unbind method (called when a service disappears).
+ */
+ public static final int UNBIND = 1;
+
+ /**
+ * Is the method a bind method or an unbind method ?
+ */
+ private int m_methodType;
/**
* Callback object.
@@ -56,7 +58,7 @@
* @param isStatic : is the method to call static ?
*/
public DependencyCallback(Dependency dep, String method, int methodType, boolean isStatic) {
- m_methodType = methodType;
+ m_methodType = methodType;
m_callback = new Callback(method, isStatic, dep.getDependencyHandler().getComponentManager());
}
@@ -72,7 +74,7 @@
* @throws IllegalAccessException : The method can not be invoked
*/
protected void call() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- m_callback.call();
+ m_callback.call();
}
/**
@@ -82,6 +84,28 @@
* @throws IllegalAccessException : The method can not be invoked
*/
protected void call(Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- m_callback.call(arg);
+ m_callback.call(arg);
+ }
+
+ /**
+ * Call the callback on the given instance.
+ * @param instance : the instance on which call the callback
+ * @throws NoSuchMethodException : the method is not found
+ * @throws IllegalAccessException : the method could not be called
+ * @throws InvocationTargetException : an error happens in the called method
+ */
+ protected void call(Object instance) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { m_callback.call(instance); }
+
+ /**
+ * Call the callback on the given instance with the given argument.
+ * @param instance : the instance on which call the callback
+ * @param arg : the argument of the callback
+ * @throws NoSuchMethodException : the method is not found
+ * @throws IllegalAccessException : the method could not be called
+ * @throws InvocationTargetException : an error happens in the called method
+ * @throws InvocationTargetException
+ */
+ protected void call(Object instance, Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ m_callback.call(instance, arg);
}
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java Mon Oct 30 08:36:04 2006
@@ -1,28 +1,31 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency;
import java.io.IOException;
import java.net.URL;
+import java.util.Dictionary;
import java.util.logging.Level;
-import org.apache.felix.ipojo.ComponentManager;
-import org.apache.felix.ipojo.Handler;
import org.apache.felix.ipojo.Activator;
+import org.apache.felix.ipojo.ComponentManagerImpl;
+import org.apache.felix.ipojo.Handler;
import org.apache.felix.ipojo.handlers.dependency.nullable.NullableObjectWriter;
import org.apache.felix.ipojo.metadata.Element;
@@ -30,36 +33,40 @@
* The dependency handler manages a list of dependencies.
* @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
*/
-public class DependencyHandler implements Handler {
-
- /**
- * The component manager using this handler.
- */
- private ComponentManager m_componentManager;
-
- /**
- * List of depednencies of the component.
- */
- private Dependency[] m_dependencies = new Dependency[0];
-
- /**
- * List of nullable class for optional dependencies.
- */
- private Class[] m_nullableClasses = new Class[0];
-
- /**
- * Classloader to use to load nullable classes.
- */
- private NullableClassloader m_classloader;
-
- /**
- * State of the handler.
- */
- private int m_state;
-
-// ===================== Fields getters & setters =====================
+public class DependencyHandler extends Handler {
- private void addDependency(Dependency dep) {
+ /**
+ * The component manager using this handler.
+ */
+ private ComponentManagerImpl m_componentManager;
+
+ /**
+ * List of depednencies of the component.
+ */
+ private Dependency[] m_dependencies = new Dependency[0];
+
+ /**
+ * List of nullable class for optional dependencies.
+ */
+ private Class[] m_nullableClasses = new Class[0];
+
+ /**
+ * Classloader to use to load nullable classes.
+ */
+ private NullableClassloader m_classloader;
+
+ /**
+ * State of the handler.
+ */
+ private int m_state;
+
+// ===================== Fields getters & setters =====================
+
+ /**
+ * Add a dependency.
+ * @param dep : the dependency to add
+ */
+ private void addDependency(Dependency dep) {
for (int i = 0; (m_dependencies != null) && (i < m_dependencies.length); i++) {
if (m_dependencies[i] == dep) {
return;
@@ -72,12 +79,16 @@
m_dependencies = newDep;
}
else {
- m_dependencies = new Dependency[] {dep};
+ m_dependencies = new Dependency[] {dep};
}
- }
+ }
- private void addNullableClass(Class clazz) {
- for (int i = 0; (m_nullableClasses != null) && (i < m_nullableClasses.length); i++) {
+ /**
+ * Add a nullable class.
+ * @param clazz : the class to add
+ */
+ private void addNullableClass(Class clazz) {
+ for (int i = 0; (m_nullableClasses != null) && (i < m_nullableClasses.length); i++) {
if (m_nullableClasses[i] == clazz) {
return;
}
@@ -89,263 +100,275 @@
m_nullableClasses = newClass;
}
else {
- m_nullableClasses = new Class[] {clazz};
+ m_nullableClasses = new Class[] {clazz};
}
- }
+ }
- /**
- * @return the dependency list
- */
- public Dependency[] getDependencies() { return m_dependencies; }
-
- /**
- * @return the component manager
- */
- protected ComponentManager getComponentManager() { return m_componentManager; }
-
-// ===================== Handler implementation =====================
-
- /**
- * Check the validity of the dependencies.
- */
- protected void checkContext() {
-
- synchronized (this) {
-
- Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Check Context ...");
-
- // Store the initial state
- int initialState = m_state;
-
- // Check the component dependencies
- if (!validateComponentDependencies()) {
- // The dependencies are not valid
- if (initialState == ComponentManager.VALID) {
- //There is a state change
- m_state = ComponentManager.INVALID;
- m_componentManager.check();
- }
- // Else do nothing, the component state stay UNRESOLVED
- }
- else {
- // The dependencies are valid
- if (initialState == ComponentManager.INVALID) {
- //There is a state change
- m_state = ComponentManager.VALID;
- m_componentManager.check();
- }
- // Else do nothing, the component state stay VALID
- }
+ /**
+ * @return the dependency list
+ */
+ public Dependency[] getDependencies() { return m_dependencies; }
+
+ /**
+ * @return the component manager
+ */
+ protected ComponentManagerImpl getComponentManager() { return m_componentManager; }
+
+// ===================== Handler implementation =====================
+
+ /**
+ * Check the validity of the dependencies.
+ */
+ protected void checkContext() {
+
+ synchronized (this) {
+
+ Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Check Context ...");
+
+ // Store the initial state
+ int initialState = m_state;
+
+ // Check the component dependencies
+ if (!validateComponentDependencies()) {
+ // The dependencies are not valid
+ if (initialState == ComponentManagerImpl.VALID) {
+ //There is a state change
+ m_state = ComponentManagerImpl.INVALID;
+ m_componentManager.checkComponentState();
+ }
+ // Else do nothing, the component state stay UNRESOLVED
+ }
+ else {
+ // The dependencies are valid
+ if (initialState == ComponentManagerImpl.INVALID) {
+ //There is a state change
+ m_state = ComponentManagerImpl.VALID;
+ m_componentManager.checkComponentState();
+ }
+ // Else do nothing, the component state stay VALID
+ }
- }
- }
+ }
+ }
- private boolean checkDependency(Dependency dep) {
+ /**
+ * Check if the dependency given is valid in the sense that metadata are consistent.
+ * @param dep : the dependency to check
+ * @return true if the dependency is valid
+ */
+ private boolean checkDependency(Dependency dep) {
// Check the internal type of dependency
- String field = dep.getMetadata().getField();
+ String field = dep.getMetadata().getField();
- Element manipulation = m_componentManager.getComponentMetatada().getMetadata().getElements("Manipulation")[0];
- String type = null;
- for (int i = 0; i < manipulation.getElements("Field").length; i++) {
- if (field.equals(manipulation.getElements("Field")[i].getAttribute("name"))) {
- type = manipulation.getElements("Field")[i].getAttribute("type");
- break;
- }
- }
-
- if (type == null) {
- Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] A declared dependency was not found in the class : " + dep.getMetadata().getField());
- return false;
- }
-
- if (type != null) {
- if (type.endsWith("[]")) {
- // Set the dependency to multiple
- dep.getMetadata().setMultiple();
- type = type.substring(0, type.length() - 2);
- }
-
- if (dep.getMetadata().getServiceSpecification() == null) { dep.getMetadata().setServiceSpecification(type); }
-
- if (!dep.getMetadata().getServiceSpecification().equals(type)) {
- Activator.getLogger().log(Level.WARNING, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] The field type [" + type + "] and the needed service interface [" + dep.getMetadata().getServiceSpecification() + "] are not the same");
- dep.getMetadata().setServiceSpecification(type);
- }
+ Element manipulation = m_componentManager.getComponentMetatada().getMetadata().getElements("Manipulation")[0];
+ String type = null;
+ for (int i = 0; i < manipulation.getElements("Field").length; i++) {
+ if (field.equals(manipulation.getElements("Field")[i].getAttribute("name"))) {
+ type = manipulation.getElements("Field")[i].getAttribute("type");
+ break;
}
- else {
- Activator.getLogger().log(Level.WARNING, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] The declared dependency " + dep.getMetadata().getField() + " does not exist in the code");
+ }
+
+ if (type == null) {
+ Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] A declared dependency was not found in the class : " + dep.getMetadata().getField());
+ return false;
+ }
+
+ if (type != null) {
+ if (type.endsWith("[]")) {
+ // Set the dependency to multiple
+ dep.getMetadata().setMultiple();
+ type = type.substring(0, type.length() - 2);
}
- return true;
- }
+
+ if (dep.getMetadata().getServiceSpecification() == null) { dep.getMetadata().setServiceSpecification(type); }
+
+ if (!dep.getMetadata().getServiceSpecification().equals(type)) {
+ Activator.getLogger().log(Level.WARNING, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] The field type [" + type + "] and the needed service interface [" + dep.getMetadata().getServiceSpecification() + "] are not the same");
+ dep.getMetadata().setServiceSpecification(type);
+ }
+ }
+ else {
+ Activator.getLogger().log(Level.WARNING, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] The declared dependency " + dep.getMetadata().getField() + " does not exist in the code");
+ }
+ return true;
+ }
- /**
- * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.ComponentManager, org.apache.felix.ipojo.metadata.Element)
- */
- public void configure(ComponentManager cm, Element componentMetadata) {
- // Fix the component manager
- m_componentManager = cm;
- m_dependencies = new Dependency[0];
- m_nullableClasses = new Class[0];
-
- // Create the dependency according to the component metadata
- Element[] deps = componentMetadata.getElements("Dependency");
- for (int i = 0; i < deps.length; i++) {
- // Create the dependency metadata
- String field = deps[i].getAttribute("field");
- String serviceSpecification = null;
- if (deps[i].containsAttribute("interface")) { serviceSpecification = deps[i].getAttribute("interface"); }
- String filter = "";
- if (deps[i].containsAttribute("filter")) { filter = deps[i].getAttribute("filter"); }
- boolean optional = false;
- if (deps[i].containsAttribute("optional") && deps[i].getAttribute("optional").equals("true")) { optional = true; }
- DependencyMetadata dm = new DependencyMetadata(field, serviceSpecification, filter, optional);
-
-
- Dependency dep = new Dependency(this, dm);
- // Check the dependency :
- if (checkDependency(dep)) { addDependency(dep); }
- else { Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] The dependency on " + dep.getMetadata().getField() + " is not valid"); }
-
- // Look for dependency callback :
- for (int j = 0; j < (deps[i].getElements("Callback", "")).length; j++) {
- String method = deps[i].getElements("Callback", "")[j].getAttribute("method");
- String type = deps[i].getElements("Callback", "")[j].getAttribute("type");
- int methodType = 0;
- if (type.equals("bind")) { methodType = DependencyCallback.BIND; }
- else { methodType = DependencyCallback.UNBIND; }
- boolean isStatic = false;
- if (deps[i].getElements("Callback", "")[j].containsAttribute("isStatic") && deps[i].getElements("Callback", "")[j].getAttribute("isStatic").equals("true")) { isStatic = true; }
- DependencyCallback dc = new DependencyCallback(dep, method, methodType, isStatic);
- dep.getMetadata().addDependencyCallback(dc);
- }
- }
-
- if (deps.length > 0) {
- m_componentManager.register(this);
-
- // Create the nullable classloader
- m_classloader = new NullableClassloader(m_componentManager.getContext().getBundle());
-
- }
- }
-
- private void createNullableClass(Dependency dep) {
- Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Try to load the nullable class for " + dep.getMetadata().getServiceSpecification());
- // Try to load the nullable object :
+ /**
+ * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.ComponentManagerImpl, org.apache.felix.ipojo.metadata.Element)
+ */
+ public void configure(ComponentManagerImpl cm, Element componentMetadata, Dictionary configuration) {
+ // Fix the component manager
+ m_componentManager = cm;
+ m_dependencies = new Dependency[0];
+ m_nullableClasses = new Class[0];
+
+ // Create the dependency according to the component metadata
+ Element[] deps = componentMetadata.getElements("Dependency");
+ for (int i = 0; i < deps.length; i++) {
+ // Create the dependency metadata
+ String field = deps[i].getAttribute("field");
+ String serviceSpecification = null;
+ if (deps[i].containsAttribute("interface")) { serviceSpecification = deps[i].getAttribute("interface"); }
+ String filter = "";
+ if (deps[i].containsAttribute("filter")) { filter = deps[i].getAttribute("filter"); }
+ boolean optional = false;
+ if (deps[i].containsAttribute("optional") && deps[i].getAttribute("optional").equals("true")) { optional = true; }
+ DependencyMetadata dm = new DependencyMetadata(field, serviceSpecification, filter, optional);
+
+
+ Dependency dep = new Dependency(this, dm);
+ // Check the dependency :
+ if (checkDependency(dep)) { addDependency(dep); }
+ else { Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] The dependency on " + dep.getMetadata().getField() + " is not valid"); }
+
+ // Look for dependency callback :
+ for (int j = 0; j < (deps[i].getElements("Callback", "")).length; j++) {
+ String method = deps[i].getElements("Callback", "")[j].getAttribute("method");
+ String type = deps[i].getElements("Callback", "")[j].getAttribute("type");
+ int methodType = 0;
+ if (type.equals("bind")) { methodType = DependencyCallback.BIND; }
+ else { methodType = DependencyCallback.UNBIND; }
+ boolean isStatic = false;
+ if (deps[i].getElements("Callback", "")[j].containsAttribute("isStatic") && deps[i].getElements("Callback", "")[j].getAttribute("isStatic").equals("true")) { isStatic = true; }
+ DependencyCallback dc = new DependencyCallback(dep, method, methodType, isStatic);
+ dep.getMetadata().addDependencyCallback(dc);
+ }
+ }
+
+ if (deps.length > 0) {
+ String[] fields = new String[m_dependencies.length];
+ for (int k = 0; k < m_dependencies.length; k++) {
+ fields[k] = m_dependencies[k].getMetadata().getField();
+ }
+ m_componentManager.register(this, fields);
+
+ // Create the nullable classloader
+ m_classloader = new NullableClassloader(m_componentManager.getContext().getBundle());
+
+ }
+ }
+
+ /**
+ * Create a nullable class for the given dependency.
+ * @param dep : the dependency
+ */
+ private void createNullableClass(Dependency dep) {
+ Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Try to load the nullable class for " + dep.getMetadata().getServiceSpecification());
+ // Try to load the nullable object :
String[] segment = dep.getMetadata().getServiceSpecification().split("[.]");
String className = "org/apache/felix/ipojo/" + segment[segment.length - 1] + "Nullable";
String resource = dep.getMetadata().getServiceSpecification().replace('.', '/') + ".class";
URL url = m_componentManager.getContext().getBundle().getResource(resource);
- try {
- byte[] b = NullableObjectWriter.dump(url, dep.getMetadata().getServiceSpecification());
+ try {
+ byte[] b = NullableObjectWriter.dump(url, dep.getMetadata().getServiceSpecification());
-// // DEBUG :
-// try {
-// File file = new File("P:\\workspace\\iPOJO\\adapted\\" + className.replace('/', '.') + ".class");
-// file.createNewFile();
-// FileOutputStream fos = new FileOutputStream(file);
-// fos.write(b);
-// fos.close();
-// } catch (Exception e3) {
-// System.err.println("Problem to write the adapted class on the file system : " + e3.getMessage());
-//
-// }
-
- addNullableClass(m_classloader.defineClass(className.replace('/', '.'), b, null));
- Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Nullable class created for " + dep.getMetadata().getServiceSpecification());
-
- } catch (IOException e1) {
- Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Cannot open a stream of an interface to generate the nullable class for " + dep.getMetadata().getServiceSpecification() + " -> " + e1.getMessage());
- } catch (Exception e2) {
- Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Cannot load the nullable class for " + dep.getMetadata().getServiceSpecification() + " -> " + e2.getMessage());
- }
- }
+// // DEBUG :
+// try {
+// File file = new File("P:\\workspace\\iPOJO\\adapted\\" + className.replace('/', '.') + ".class");
+// file.createNewFile();
+// FileOutputStream fos = new FileOutputStream(file);
+// fos.write(b);
+// fos.close();
+// } catch (Exception e3) {
+// System.err.println("Problem to write the adapted class on the file system : " + e3.getMessage());
+
+// }
+
+ addNullableClass(m_classloader.defineClass(className.replace('/', '.'), b, null));
+ Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Nullable class created for " + dep.getMetadata().getServiceSpecification());
+
+ } catch (IOException e1) {
+ Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Cannot open a stream of an interface to generate the nullable class for " + dep.getMetadata().getServiceSpecification() + " -> " + e1.getMessage());
+ } catch (Exception e2) {
+ Activator.getLogger().log(Level.SEVERE, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Cannot load the nullable class for " + dep.getMetadata().getServiceSpecification() + " -> " + e2.getMessage());
+ }
+ }
- /**
+ /**
* Return the nullable class corresponding to the given name.
- * @param name the needed type
- * @return the class correspondig to the name, or null if the class does not exist.
- */
- protected Class getNullableClass(String name) {
- for (int i = 0; i < m_nullableClasses.length; i++) {
- Class c = m_nullableClasses[i];
- if (c.getName().equals(name)) {
- return c;
- }
- }
- return null;
- }
-
- /**
- * @see org.apache.felix.ipojo.Handler#getterCallback(java.lang.String, java.lang.Object)
- */
- public Object getterCallback(String fieldName, Object value) {
- for (int i = 0; i < m_dependencies.length; i++) {
- Dependency dep = m_dependencies[i];
- if (dep.getMetadata().getField().equals(fieldName)) {
- // The field name is a dependency, return the get
- return dep.get();
- }
- }
- // Else return the value
- return value;
- }
-
- /**
- * @see org.apache.felix.ipojo.Handler#isValid()
- */
- public boolean isValid() {
- return (m_state == ComponentManager.VALID);
- }
-
- /**
- * @see org.apache.felix.ipojo.Handler#setterCallback(java.lang.String, java.lang.Object)
- */
- public void setterCallback(String fieldName, Object value) {
- // Do nothing
- }
-
- /**
- * @see org.apache.felix.ipojo.Handler#start()
- */
- public void start() {
- Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Start the dependency handler");
-
- // Start the dependencies, for optional dependencies create Nullable class
- for (int i = 0; i < m_dependencies.length; i++) {
- Dependency dep = m_dependencies[i];
- if (dep.getMetadata().isOptional() && !dep.getMetadata().isMultiple()) { createNullableClass(dep); }
- dep.start();
- }
- // Check the state
- m_state = m_componentManager.getState();
- checkContext();
- }
-
- /**
- * @see org.apache.felix.ipojo.Handler#stateChanged(int)
- */
- public void stateChanged(int state) {
- // Another handler or the component manager itself change the state
- if (m_state == ComponentManager.VALID && state == ComponentManager.INVALID) {
- // The component is stopped => Stop the dependency tracking
- stop();
- }
- m_state = state;
- }
-
- /**
- * @see org.apache.felix.ipojo.Handler#stop()
- */
- public void stop() {
- for (int i = 0; i < m_dependencies.length; i++) { m_dependencies[i].stop(); }
- }
+ * @param name the needed type
+ * @return the class correspondig to the name, or null if the class does not exist.
+ */
+ protected Class getNullableClass(String name) {
+ for (int i = 0; i < m_nullableClasses.length; i++) {
+ Class c = m_nullableClasses[i];
+ if (c.getName().equals(name)) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.felix.ipojo.Handler#getterCallback(java.lang.String, java.lang.Object)
+ */
+ public Object getterCallback(String fieldName, Object value) {
+ //TODO : non performant
+ for (int i = 0; i < m_dependencies.length; i++) {
+ Dependency dep = m_dependencies[i];
+ if (dep.getMetadata().getField().equals(fieldName)) {
+ // The field name is a dependency, return the get
+ return dep.get();
+ }
+ }
+ // Else return the value
+ return value;
+ }
+
+ /**
+ * @see org.apache.felix.ipojo.Handler#isValid()
+ */
+ public boolean isValid() {
+ return (m_state == ComponentManagerImpl.VALID);
+ }
+
+ /**
+ * @see org.apache.felix.ipojo.Handler#start()
+ */
+ public void start() {
+ Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Start the dependency handler");
+
+ // Start the dependencies, for optional dependencies create Nullable class
+ for (int i = 0; i < m_dependencies.length; i++) {
+ Dependency dep = m_dependencies[i];
+ if (dep.getMetadata().isOptional() && !dep.getMetadata().isMultiple()) { createNullableClass(dep); }
+ dep.start();
+ }
+ // Check the state
+ m_state = m_componentManager.getState();
+ checkContext();
+ }
+
+ /**
+ * @see org.apache.felix.ipojo.Handler#stateChanged(int)
+ */
+ public void stateChanged(int state) { m_state = state; }
+
+ /**
+ * @see org.apache.felix.ipojo.Handler#stop()
+ */
+ public void stop() {
+ for (int i = 0; i < m_dependencies.length; i++) { m_dependencies[i].stop(); }
+ }
+
+ /**
+ * @see org.apache.felix.ipojo.Handler#createInstance(java.lang.Object)
+ */
+ public void createInstance(Object instance) {
+ for (int i = 0; i < m_dependencies.length; i++) {
+ m_dependencies[i].callBindMethod(instance);
+ }
+ }
- private boolean validateComponentDependencies() {
- boolean valide = true;
+ /**
+ * @return true if all dependencies are resolved.
+ */
+ private boolean validateComponentDependencies() {
+ boolean valide = true;
for (int i = 0; i < m_dependencies.length; i++) {
Dependency dep = m_dependencies[i];
valide = valide & dep.isSatisfied();
@@ -356,6 +379,6 @@
}
Activator.getLogger().log(Level.INFO, "[DependencyHandler on " + m_componentManager.getComponentMetatada().getClassName() + "] Component Dependencies are valid");
return valide;
- }
+ }
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyMetadata.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyMetadata.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyMetadata.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyMetadata.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency;
@@ -22,127 +24,127 @@
*/
public class DependencyMetadata {
- /**
- * Service Specification <=> Service contract (or interface in OSGi).
- */
- private String m_serviceSpecification;
-
- /**
- * LDAP filter.
- */
- private String m_filter;
-
- /**
- * is the dependency optional ?
- */
- private boolean m_isOptional;
-
- /**
- * is the dependency multiple ?
- */
- private boolean m_isMultiple = false;
-
- /**
- * List of dependency callbacks attached to this dependency.
- */
- private DependencyCallback[] m_callbacks = new DependencyCallback[0];
-
- /**
- * The field linking the metadata and the component implementation.
- */
- private String m_field;
+ /**
+ * Service Specification <=> Service contract (or interface in OSGi).
+ */
+ private String m_serviceSpecification;
+
+ /**
+ * LDAP filter.
+ */
+ private String m_filter;
+
+ /**
+ * is the dependency optional ?
+ */
+ private boolean m_isOptional;
+
+ /**
+ * is the dependency multiple ?
+ */
+ private boolean m_isMultiple = false;
+
+ /**
+ * List of dependency callbacks attached to this dependency.
+ */
+ private DependencyCallback[] m_callbacks = new DependencyCallback[0];
+
+ /**
+ * The field linking the metadata and the component implementation.
+ */
+ private String m_field;
- // Constructor
+ // Constructor
- /**
+ /**
* Constructor.
- * @param field : the field name
- * @param service : the interface name.
- * @param filter : the filter of the dependency
- * @param isOptional : is the dependency optional
- */
- public DependencyMetadata(String field, String service, String filter, boolean isOptional) {
- m_field = field;
- m_serviceSpecification = service;
- m_isOptional = isOptional;
- m_filter = filter;
- }
-
- /**
- * Add a callback to the dependency.
- * @param cb : callback to add
- */
- public void addDependencyCallback(DependencyCallback cb) {
- for (int i = 0; (m_callbacks != null) && (i < m_callbacks.length); i++) {
- if (m_callbacks[i] == cb) { return; }
- }
-
- if (m_callbacks.length > 0) {
- DependencyCallback[] newCallbacks = new DependencyCallback[m_callbacks.length + 1];
- System.arraycopy(m_callbacks, 0, newCallbacks, 0, m_callbacks.length);
- newCallbacks[m_callbacks.length] = cb;
- m_callbacks = newCallbacks;
- }
- else {
- m_callbacks = new DependencyCallback[] {cb};
- }
- }
-
- // Getter
-
- /**
- * @return Returns the m_field.
- */
- public String getField() {
- return m_field;
- }
-
- /**
- * @return Returns the m_filter.
- */
- public String getFilter() {
- return m_filter;
- }
-
- /**
- * @return Returns the m_isMultiple.
- */
- public boolean isMultiple() {
- return m_isMultiple;
- }
-
- /**
- * @return Returns the m_isOptional.
- */
- public boolean isOptional() {
- return m_isOptional;
- }
-
- /**
- * @return Returns the m_serviceSpecification.
- */
- public String getServiceSpecification() {
- return m_serviceSpecification;
- }
-
- /**
- * return true if the dependency is multiple.
- */
- public void setMultiple() {
- m_isMultiple = true;
- }
+ * @param field : the field name
+ * @param service : the interface name.
+ * @param filter : the filter of the dependency
+ * @param isOptional : is the dependency optional
+ */
+ public DependencyMetadata(String field, String service, String filter, boolean isOptional) {
+ m_field = field;
+ m_serviceSpecification = service;
+ m_isOptional = isOptional;
+ m_filter = filter;
+ }
+
+ /**
+ * Add a callback to the dependency.
+ * @param cb : callback to add
+ */
+ public void addDependencyCallback(DependencyCallback cb) {
+ for (int i = 0; (m_callbacks != null) && (i < m_callbacks.length); i++) {
+ if (m_callbacks[i] == cb) { return; }
+ }
+
+ if (m_callbacks.length > 0) {
+ DependencyCallback[] newCallbacks = new DependencyCallback[m_callbacks.length + 1];
+ System.arraycopy(m_callbacks, 0, newCallbacks, 0, m_callbacks.length);
+ newCallbacks[m_callbacks.length] = cb;
+ m_callbacks = newCallbacks;
+ }
+ else {
+ m_callbacks = new DependencyCallback[] {cb};
+ }
+ }
+
+ // Getter
+
+ /**
+ * @return Returns the m_field.
+ */
+ public String getField() {
+ return m_field;
+ }
+
+ /**
+ * @return Returns the m_filter.
+ */
+ public String getFilter() {
+ return m_filter;
+ }
+
+ /**
+ * @return Returns the m_isMultiple.
+ */
+ public boolean isMultiple() {
+ return m_isMultiple;
+ }
+
+ /**
+ * @return Returns the m_isOptional.
+ */
+ public boolean isOptional() {
+ return m_isOptional;
+ }
+
+ /**
+ * @return Returns the m_serviceSpecification.
+ */
+ public String getServiceSpecification() {
+ return m_serviceSpecification;
+ }
+
+ /**
+ * return true if the dependency is multiple.
+ */
+ public void setMultiple() {
+ m_isMultiple = true;
+ }
- /**
+ /**
* Set the service specification.
- * @param serviceSpecification : the dependency service specification
- */
- public void setServiceSpecification(String serviceSpecification) {
- m_serviceSpecification = serviceSpecification;
- }
-
- /**
- * @return the list of the callbacks
- */
- public DependencyCallback[] getCallbacks() { return m_callbacks; }
+ * @param serviceSpecification : the dependency service specification
+ */
+ public void setServiceSpecification(String serviceSpecification) {
+ m_serviceSpecification = serviceSpecification;
+ }
+
+ /**
+ * @return the list of the callbacks
+ */
+ public DependencyCallback[] getCallbacks() { return m_callbacks; }
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/NullableClassloader.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/NullableClassloader.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/NullableClassloader.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/NullableClassloader.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency;
@@ -30,7 +32,7 @@
*/
public class NullableClassloader extends ClassLoader {
- /**
+ /**
* The owner bundle.
* m_bundle : Bundle
*/
@@ -95,8 +97,8 @@
*/
public Class defineClass(String name, byte[] b,
ProtectionDomain domain) throws Exception {
- Class clazz = super.defineClass(name, b, 0, b.length, domain);
- return clazz;
+ Class clazz = super.defineClass(name, b, 0, b.length, domain);
+ return clazz;
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignature.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignature.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignature.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignature.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency.nullable;
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignatureVisitor.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignatureVisitor.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignatureVisitor.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/MethodSignatureVisitor.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency.nullable;
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java?view=diff&rev=469182&r1=469181&r2=469182
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java Mon Oct 30 08:36:04 2006
@@ -1,18 +1,20 @@
-/*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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
*
- * Licensed 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.
+ * 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.felix.ipojo.handlers.dependency.nullable;