Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 74448 invoked from network); 12 Jun 2009 15:46:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Jun 2009 15:46:27 -0000 Received: (qmail 15280 invoked by uid 500); 12 Jun 2009 15:46:38 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 15251 invoked by uid 500); 12 Jun 2009 15:46:38 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 15242 invoked by uid 99); 12 Jun 2009 15:46:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2009 15:46:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2009 15:46:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D00FD2388898; Fri, 12 Jun 2009 15:46:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r784162 - in /felix/trunk: scr-annotations/pom.xml scrplugin/pom.xml scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java Date: Fri, 12 Jun 2009 15:46:13 -0000 To: commits@felix.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090612154613.D00FD2388898@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Fri Jun 12 15:46:13 2009 New Revision: 784162 URL: http://svn.apache.org/viewvc?rev=784162&view=rev Log: FELIX-1229 : Deactivate has more possibilites than activate; update versions as this are new major features. Modified: felix/trunk/scr-annotations/pom.xml felix/trunk/scrplugin/pom.xml felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/cl/ClassLoaderJavaClassDescription.java Modified: felix/trunk/scr-annotations/pom.xml URL: http://svn.apache.org/viewvc/felix/trunk/scr-annotations/pom.xml?rev=784162&r1=784161&r2=784162&view=diff ============================================================================== --- felix/trunk/scr-annotations/pom.xml (original) +++ felix/trunk/scr-annotations/pom.xml Fri Jun 12 15:46:13 2009 @@ -29,7 +29,7 @@ org.apache.felix org.apache.felix.scr.annotations - 0.9.1-SNAPSHOT + 1.0.0-SNAPSHOT jar Annotations for Maven SCR Plugin Modified: felix/trunk/scrplugin/pom.xml URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/pom.xml?rev=784162&r1=784161&r2=784162&view=diff ============================================================================== --- felix/trunk/scrplugin/pom.xml (original) +++ felix/trunk/scrplugin/pom.xml Fri Jun 12 15:46:13 2009 @@ -29,7 +29,7 @@ org.apache.felix maven-scr-plugin - 1.2.1-SNAPSHOT + 1.4.0-SNAPSHOT maven-plugin Maven SCR Plugin @@ -109,7 +109,7 @@ org.apache.felix org.apache.felix.scr.annotations - 0.9.0 + 1.0.0-SNAPSHOT Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java?rev=784162&r1=784161&r2=784162&view=diff ============================================================================== --- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java (original) +++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/om/Component.java Fri Jun 12 15:46:13 2009 @@ -266,8 +266,8 @@ final String deactivateName = this.deactivate == null ? "deactivate" : this.deactivate; // check activate and deactivate methods - this.checkLifecycleMethod(specVersion, javaClass, activateName, iLog); - this.checkLifecycleMethod(specVersion, javaClass, deactivateName, iLog); + this.checkLifecycleMethod(specVersion, javaClass, activateName, true, iLog); + this.checkLifecycleMethod(specVersion, javaClass, deactivateName, false, iLog); // ensure public default constructor boolean constructorFound = true; @@ -338,6 +338,9 @@ private static final String TYPE_COMPONENT_CONTEXT = "org.osgi.service.component.ComponentContext"; private static final String TYPE_BUNDLE_CONTEXT = "org.osgi.framework.BundleContext"; private static final String TYPE_MAP = "java.util.Map"; + private static final String TYPE_INT = "int"; + private static final String TYPE_INTEGER = "java.lang.Integer"; + /** * Check for existence of lifecycle methods. * @param specVersion The spec version @@ -348,6 +351,7 @@ protected void checkLifecycleMethod(final int specVersion, final JavaClassDescription javaClass, final String methodName, + final boolean isActivate, final IssueLog iLog) throws MojoExecutionException { // first candidate is (de)activate(ComponentContext) @@ -361,11 +365,20 @@ method = javaClass.getMethodBySignature(methodName, new String[] {TYPE_MAP}); if ( method == null ) { + // if this is a deactivate method, we have two additional possibilities + // a method with parameter of type int and one of type Integer + if ( !isActivate ) { + method = javaClass.getMethodBySignature(methodName, new String[] {TYPE_INT}); + if ( method == null ) { + method = javaClass.getMethodBySignature(methodName, new String[] {TYPE_INTEGER}); + } + } + // fourth candidate is (de)activate with two or three arguments (type must be BundleContext, ComponentCtx and Map) // as we have to iterate now and the fifth candidate is zero arguments // we already store this option JavaMethod zeroArgMethod = null; - JavaMethod found = null; + JavaMethod found = method; final JavaMethod[] methods = javaClass.getMethods(); int i = 0; while ( i < methods.length && found == null ) { @@ -373,14 +386,17 @@ if ( methods[i].getParameters().length == 0 ) { zeroArgMethod = methods[i]; - } else if ( methods[i].getParameters().length == 2 || methods[i].getParameters().length == 3) { + } else if ( methods[i].getParameters().length >= 2 ) { boolean valid = true; for(int m=0; m clazz; protected final JavaClassDescriptorManager manager; protected final Component component; - public ClassLoaderJavaClassDescription(Class c, Component comp, JavaClassDescriptorManager m) { + public ClassLoaderJavaClassDescription(Class c, Component comp, JavaClassDescriptorManager m) { this.clazz = c; this.manager = m; this.component = comp; @@ -99,7 +99,7 @@ * @see org.apache.felix.scrplugin.tags.JavaClassDescription#getImplementedInterfaces() */ public JavaClassDescription[] getImplementedInterfaces() throws MojoExecutionException { - Class[] implemented = clazz.getInterfaces(); + Class[] implemented = clazz.getInterfaces(); if (implemented.length == 0) { return JavaClassDescription.EMPTY_RESULT; } @@ -116,7 +116,7 @@ */ public JavaMethod getMethodBySignature(String name, String[] parameters) throws MojoExecutionException { - Class[] classParameters = null; + Class[] classParameters = null; if ( parameters != null ) { classParameters = new Class[parameters.length]; for(int i=0; i c, String type) { + final Class[] interfaces = c.getInterfaces(); for(int i=0; i