From jboss-osgi-commits at lists.jboss.org Thu Nov 19 18:40:31 2009 Content-Type: multipart/mixed; boundary="===============7503849622809239691==" MIME-Version: 1.0 From: jboss-osgi-commits at lists.jboss.org To: jboss-osgi-commits at lists.jboss.org Subject: [jboss-osgi-commits] JBoss-OSGI SVN: r96604 - projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle. Date: Thu, 19 Nov 2009 18:40:31 -0500 Message-ID: <200911192340.nAJNeVv4001842@svn01.web.mwc.hst.phx2.redhat.com> --===============7503849622809239691== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: alesj Date: 2009-11-19 18:40:30 -0500 (Thu, 19 Nov 2009) New Revision: 96604 Added: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi= /framework/bundle/OSGiScopeInfo.java Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi= /framework/bundle/OSGiServiceState.java Log: Fix scope info usage. Copied: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss= /osgi/framework/bundle/OSGiScopeInfo.java (from rev 96603, projects/jboss-o= sgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/bundle/O= SGiServiceState.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osg= i/framework/bundle/OSGiScopeInfo.java (rev 0) +++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osg= i/framework/bundle/OSGiScopeInfo.java 2009-11-19 23:40:30 UTC (rev 96604) @@ -0,0 +1,51 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2009, Red Hat Middleware LLC, and individual contributors +* as indicated by the @author tags. See the copyright.txt file in the +* distribution for a full listing of individual contributors. +* +* This is free software; you can redistribute it and/or modify it +* under the terms of the GNU Lesser General Public License as +* published by the Free Software Foundation; either version 2.1 of +* the License, or (at your option) any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this software; if not, write to the Free +* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA, or see the FSF site: http://www.fsf.org. +*/ +package org.jboss.osgi.framework.bundle; + +import org.jboss.dependency.plugins.AbstractScopeInfo; +import org.jboss.metadata.spi.scope.ScopeKey; +import org.jboss.metadata.spi.scope.Scope; +import org.jboss.metadata.spi.scope.CommonLevels; + +/** + * OSGi ScopeInfo + * + * @author Ales Justin + */ +public class OSGiScopeInfo extends AbstractScopeInfo +{ + public OSGiScopeInfo(Object name, String className) + { + super(name, className); + } + + /** + * Add class scope. + * + * @param clazz the class + */ + void update(Class clazz) + { + ScopeKey key =3D getScope(); + key.addScope(new Scope(CommonLevels.CLASS, clazz)); + } +} \ No newline at end of file Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jbo= ss/osgi/framework/bundle/OSGiServiceState.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osg= i/framework/bundle/OSGiServiceState.java 2009-11-19 23:12:27 UTC (rev 96603) +++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osg= i/framework/bundle/OSGiServiceState.java 2009-11-19 23:40:30 UTC (rev 96604) @@ -34,7 +34,6 @@ = import org.jboss.beans.info.spi.BeanInfo; import org.jboss.dependency.plugins.AbstractControllerContext; -import org.jboss.dependency.plugins.AbstractScopeInfo; import org.jboss.dependency.spi.dispatch.InvokeDispatchContext; import org.jboss.kernel.Kernel; import org.jboss.kernel.spi.config.KernelConfigurator; @@ -188,10 +187,14 @@ protected void initOSGiScopeInfo() { String className =3D null; + Object target =3D serviceOrFactory; - if (target !=3D null) + if (target !=3D null && target instanceof ServiceFactory =3D=3D fals= e) className =3D target.getClass().getName(); - setScopeInfo(new AbstractScopeInfo(getName(), className)); + else if (clazzes.length =3D=3D 1) + className =3D clazzes[0]; + + setScopeInfo(new OSGiScopeInfo(getName(), className)); } = @Override @@ -258,6 +261,12 @@ return beanInfo; } = + @Override + public OSGiScopeInfo getScopeInfo() + { + return (OSGiScopeInfo)super.getScopeInfo(); + } + /** * Get the service. * = @@ -286,6 +295,7 @@ { service =3D checkObjClass(serviceFactory.getService(bundleS= tate.getBundle(), getRegistration())); serviceCache.put(bundleState, service); + getScopeInfo().update(service.getClass()); } catch (Throwable t) { --===============7503849622809239691==--