Return-Path: Delivered-To: apmail-incubator-felix-commits-archive@www.apache.org Received: (qmail 46632 invoked from network); 10 Aug 2006 22:16:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Aug 2006 22:16:52 -0000 Received: (qmail 31979 invoked by uid 500); 10 Aug 2006 22:16:51 -0000 Delivered-To: apmail-incubator-felix-commits-archive@incubator.apache.org Received: (qmail 31961 invoked by uid 500); 10 Aug 2006 22:16:51 -0000 Mailing-List: contact felix-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: felix-dev@incubator.apache.org Delivered-To: mailing list felix-commits@incubator.apache.org Received: (qmail 31913 invoked by uid 99); 10 Aug 2006 22:16:51 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 15:16:51 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Aug 2006 15:16:41 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 0EC8D1A9822; Thu, 10 Aug 2006 15:16:14 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r430562 [3/6] - in /incubator/felix/sandbox/santillan/org.apache.felix.jmood: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/jmood/ src/main/java/... Date: Thu, 10 Aug 2006 22:16:02 -0000 To: felix-commits@incubator.apache.org From: santillan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060810221615.0EC8D1A9822@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/BundleInfo.java URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/BundleInfo.java?rev=430562&view=auto ============================================================================== --- incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/BundleInfo.java (added) +++ incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/BundleInfo.java Thu Aug 10 15:15:58 2006 @@ -0,0 +1,171 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * 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. + * + */ + +package org.apache.felix.jmood.core.instrumentation; + +import java.io.Serializable; +import java.util.Hashtable; +public class BundleInfo implements Serializable { + + //mgmt attributes + private int startLevel; + private String state; + private ServiceInfo[] registeredServices; + private ServiceInfo[] servicesInUse; + private Hashtable headers; + private long bundleId; + private PackageInfo[] exportedPackages; + private PackageInfo[] importedPackages; + private BundleInfo[] fragments; + private BundleInfo[] hosts; + private BundleInfo[] requiredBundles; + private BundleInfo[] requiringBundles; + private long lastModified; + private String symbolicName; + //private String version; //Included in the headers except for required bundles + private boolean bundlePersistentlyStarted; + private boolean removalPending; + private boolean required; + private boolean fragment; +// private R4Permission[] permissions;//TODO This should include conditional permz as well as regular ones +// private R4Configuration[] configurations; //TODO + + public BundleInfo() { + } + + + ////////////GETTERS'n'SETTERS//////////////////////// + public boolean isFragment() { + return fragment; + } + + + protected void setFragment(boolean fragment) { + this.fragment = fragment; + } + + + public long getLastModified() { + return lastModified; + } + + + protected void setLastModified(long lastModified) { + this.lastModified = lastModified; + } + + + public boolean isRequired() { + return required; + } + + + protected void setRequired(boolean required) { + this.required = required; + } + public long getBundleId() { + return bundleId; + } + protected void setBundleId(long bundleId) { + this.bundleId = bundleId; + } + public boolean isBundlePersistentlyStarted() { + return bundlePersistentlyStarted; + } + protected void setBundlePersistentlyStarted(boolean bundlePersistentlyStarted) { + this.bundlePersistentlyStarted = bundlePersistentlyStarted; + } + public PackageInfo[] getExportedPackages() { + return exportedPackages; + } + protected void setExportedPackages(PackageInfo[] exportedPackages) { + this.exportedPackages = exportedPackages; + } + public BundleInfo[] getFragments() { + return fragments; + } + protected void setFragments(BundleInfo[] fragments) { + this.fragments = fragments; + } + public Hashtable getHeaders() { + return headers; + } + protected void setHeaders(Hashtable headers) { + this.headers = headers; + } + public BundleInfo[] getHosts() { + return hosts; + } + protected void setHosts(BundleInfo[] hosts) { + this.hosts = hosts; + } + public PackageInfo[] getImportedPackages() { + return importedPackages; + } + protected void setImportedPackages(PackageInfo[] importedPackages) { + this.importedPackages = importedPackages; + } + public ServiceInfo[] getRegisteredServices() { + return registeredServices; + } + protected void setRegisteredServices(ServiceInfo[] registeredServices) { + this.registeredServices = registeredServices; + } + public boolean isRemovalPending() { + return removalPending; + } + protected void setRemovalPending(boolean removalPending) { + this.removalPending = removalPending; + } + public BundleInfo[] getRequiredBundles() { + return requiredBundles; + } + protected void setRequiredBundles(BundleInfo[] requiredBundles) { + this.requiredBundles = requiredBundles; + } + public BundleInfo[] getRequiringBundles() { + return requiringBundles; + } + protected void setRequiringBundles(BundleInfo[] requiringBundles) { + this.requiringBundles = requiringBundles; + } + public ServiceInfo[] getServicesInUse() { + return servicesInUse; + } + protected void setServicesInUse(ServiceInfo[] servicesInUse) { + this.servicesInUse = servicesInUse; + } + public int getStartLevel() { + return startLevel; + } + protected void setStartLevel(int startLevel) { + this.startLevel = startLevel; + } + public String getState() { + return state; + } + protected void setState(String state) { + this.state = state; + } + public String getSymbolicName() { + return symbolicName; + } + protected void setSymbolicName(String symbolicName) { + this.symbolicName = symbolicName; + } + +} Added: incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/FrameworkSnapshot.java URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/FrameworkSnapshot.java?rev=430562&view=auto ============================================================================== --- incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/FrameworkSnapshot.java (added) +++ incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/core/instrumentation/FrameworkSnapshot.java Thu Aug 10 15:15:58 2006 @@ -0,0 +1,245 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * 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. + * + */ + +package org.apache.felix.jmood.core.instrumentation; + +import java.util.Enumeration; +import java.util.Hashtable; + +import org.apache.felix.jmood.AgentContext; +import org.apache.felix.jmood.core.ServiceNotAvailableException; +import org.apache.felix.jmood.utils.InstrumentationSupport; +import org.osgi.framework.Bundle; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.packageadmin.ExportedPackage; + +public class FrameworkSnapshot { + private Hashtable bundles = new Hashtable(); // + + private Hashtable services = new Hashtable();// + + private Hashtable packages = new Hashtable();// + + private AgentContext ac; + + private long timestamp; + + public FrameworkSnapshot(AgentContext ac) { + super(); + this.ac = ac; + this.populate(); + } + + public long getShotTime() { + return timestamp; + } + + public void refreshSnapshot() { + bundles = new Hashtable(); + services = new Hashtable(); + packages = new Hashtable(); + this.populate(); + ac.debug("factory-bundles found: " + bundles.size()); + ac.debug("factory-services found: " + services.size()); + ac.debug("factory-packages found: " + packages.size()); + + } + + public BundleInfo[] getAllBundles() { + Enumeration b = bundles.elements(); + BundleInfo[] binfo = new BundleInfo[bundles.size()]; + for (int i = 0; i < binfo.length; i++) { + binfo[i] = (BundleInfo) b.nextElement(); + } + return binfo; + } + + public ServiceInfo[] getAllServiceInfo() { + Enumeration s = services.elements(); + ServiceInfo[] sinfo = new ServiceInfo[services.size()]; + for (int i = 0; i < sinfo.length; i++) { + sinfo[i] = (ServiceInfo) s.nextElement(); + } + return sinfo; + } + + public PackageInfo[] getAllPackageInfo() { + Enumeration p = packages.elements(); + PackageInfo[] pinfo = new PackageInfo[packages.size()]; + for (int i = 0; i < pinfo.length; i++) { + pinfo[i] = (PackageInfo) p.nextElement(); + } + return pinfo; + } + + // ///////////PRIVATE METHODS////////////////////////// + + private void populate() { + Bundle[] bundles = ac.getBundleContext().getBundles(); + BundleInfo[] binfo = new BundleInfo[bundles.length]; + for (int i = 0; i < binfo.length; i++) { + binfo[i] = getBundleInfo(bundles[i]); + } + this.timestamp = System.currentTimeMillis(); + } + +private BundleInfo getBundleInfo(Bundle bundle) { + if (bundle==null) return null; + ac.debug("creating R4 bundleinfo: "+bundle.getSymbolicName()); + Long key = new Long(bundle.getBundleId()); + if (bundles.containsKey(key)) + return (BundleInfo) bundles.get(key); + BundleInfo b = new BundleInfo(); + b.setBundleId(bundle.getBundleId()); + bundles.put(key, b); + try{ + b.setFragments(this.getFragments(bundle)); + b.setHeaders(InstrumentationSupport.getHashtable(bundle.getHeaders())); + b.setLastModified(bundle.getLastModified()); + b.setRegisteredServices(this.getSvcsInfo(bundle.getRegisteredServices())); + b.setBundlePersistentlyStarted(InstrumentationSupport.isBundlePersistentlyStarted(bundle, ac)); + b.setStartLevel(InstrumentationSupport.getBundleStartLevel(bundle, ac)); + b.setExportedPackages(this.getPkgInfo(InstrumentationSupport.getExportedPackages(bundle, ac))); + b.setFragment(InstrumentationSupport.isFragment(bundle, ac)); + b.setRequired(InstrumentationSupport.isBundleRequired(bundle, ac)); + b.setRemovalPending(InstrumentationSupport.isRequiredBundleRemovalPending(bundle, ac)); + b.setRequiredBundles(this.getBundleDependencies(bundle)); + b.setRequiringBundles(this.getBInfos(InstrumentationSupport.getRequiringBundles(bundle, ac))); + b.setImportedPackages(this.getImportedPackages(bundle)); + }catch(ServiceNotAvailableException sae){ + //Not needed, since they are default values, placed for clarity + b.setBundlePersistentlyStarted(false); + b.setStartLevel(-1); + b.setExportedPackages(null); + b.setFragment(false); + b.setRequired(false); + b.setRemovalPending(false); + b.setRequiredBundles(null); + b.setRequiringBundles(null); + b.setImportedPackages(null); + ac.warning(sae.getMessage()); + } + b.setServicesInUse(this.getSvcsInfo(bundle.getServicesInUse())); + b.setState(InstrumentationSupport.getState(bundle.getState())); + b.setSymbolicName(bundle.getSymbolicName()); + return b; + } private ServiceInfo getServiceInfo(ServiceReference svc) { + if (svc == null) + return null; + ac.debug("Creating R4service for service id " + + svc.getProperty(Constants.SERVICE_ID)); + Long key = (Long) svc.getProperty(Constants.SERVICE_ID); + if (services.containsKey(key)) + return (ServiceInfo) services.get(key); + ServiceInfo s = new ServiceInfo(); + services.put(key, s); + + // now we set the atts + s.setBundle(this.getBundleInfo(svc.getBundle())); + Bundle[] using = svc.getUsingBundles(); + if (using != null) { + BundleInfo[] r4Using = new BundleInfo[using.length]; + for (int i = 0; i < r4Using.length; i++) { + r4Using[i] = getBundleInfo(using[i]); + } + s.setUsingBundles(r4Using); + } + Hashtable props = new Hashtable();// + String[] keys=svc.getPropertyKeys(); + for (int i=0; iFor each BundleInfo, this method returns the symbolic name String, which we define as the concatenation of + * the getSymbolicName of the Bundle interface and the bundle version as specified + * in the bundle header. Both parts are divided by a semicolon. An example would be:

+ *

+ * com.acme.foo;1.0.0 + *

+ * @param bundles The Bundle array to be converted + * @return The String array + * @see org.osgi.framework.Bundle#getSymbolicName() + */ + public static String[] getSymbolicNames(Bundle[] bundles) { + if(bundles==null) return null; + String[] names=new String[bundles.length]; + for (int i = 0; i < names.length; i++) { + names[i]=getSymbolicName(bundles[i]); + } + return names; + } + public static String getSymbolicName(Bundle bundle){ + return bundle.getSymbolicName()+";"+bundle.getHeaders().get(Constants.BUNDLE_VERSION); + + } + + /** + *

+ * + * OSGi exported packages can be uniquely identified by the tuple (packageName, packageVersion). + * This methods returns a String array representing those packages with the following syntax: + *

+ *

+ * packageName;packageVersion + *

+ * where packageName is as returned by the method getName() and packageVersion as returned by the method getVersion() + * in package admin's ExportedPackage class. + *

+ * @param packages The ExportedPackage array to be converted + * @return The String array + * @see org.osgi.service.packageadmin.ExportedPackage + */ + public static String[] getPackageNames(ExportedPackage[] packages) { + if (packages==null) return null; + String[] names=new String[packages.length]; + for (int i = 0; i < names.length; i++) { + names[i]=getPackageName(packages[i]); + } + return names; + + } + public static String getPackageName(ExportedPackage pkg) { + return pkg.getName()+";"+pkg.getVersion().toString(); + } + + + /** + *

+ * OSGi Services can be registered under more than one interface (objectClass in + * the spec). Services have a mandatory unique service id (as defined in the SERVICE_ID property of the org.osgi.framework.Constants interface), during their lifetime (i.e, until they are + * garbage collected). To show this information in a consistent way, we use the following String representation + * of the service: + *

+ *

+ * objectClass1[;objectClass2[;objectClass3...]]:service.id + *

+ * where objectClass1..objectClassN are the elements of the mandatory objectClass array + * included in the service property dictionary (and set by the framework at registration time. The property name is defined in org.osgi.framework.Constants#OBJECTCLASS + *

+ * @param services The ServiceReference array to be converted + * @return The String array + * @see org.osgi.framework.Constants#OBJECTCLASS + * @see org.osgi.framework.Constants#SERVICE_ID + * @see org.osgi.framework.ServiceReference + */ + public static String[] getServiceNames(ServiceReference[] services) { + if(services==null) return null; + String[] names=new String[services.length]; + for (int i = 0; i < names.length; i++) { + String[] objectClass=(String[])services[i].getProperty(Constants.OBJECTCLASS); + //We asume that the framework always returns a non-empty, non-null array. + StringBuffer sb=new StringBuffer(objectClass[0]); + for (int j = 1; j < objectClass.length; j++) { + sb.append(";"); + sb.append(objectClass[j]); + } + sb.append(services[i].getProperty(Constants.SERVICE_ID)); + names[i]=sb.toString(); + } + return names; + } + public static ExportedPackage[] getImportedPackages(Bundle bundle, AgentContext ac) throws ServiceNotAvailableException { + Vector imported = new Vector(); + Bundle[] allBundles = ac.getBundleContext().getBundles(); + for (int i=0; i1) throw new BundleNotAvailableException("could not distinguish among multiple candidates"); + if(candidates.size()==1) { + id=cId; + break; + } + } + if (version.equals(s[1])) id=cId; + } + if(id==-1) throw new BundleNotAvailableException("No " + symbolicName+ "installed"); + return id; + } + + +} Added: incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/utils/OSGi2JMXCodec.java URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/utils/OSGi2JMXCodec.java?rev=430562&view=auto ============================================================================== --- incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/utils/OSGi2JMXCodec.java (added) +++ incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/java/org/apache/felix/jmood/utils/OSGi2JMXCodec.java Thu Aug 10 15:15:58 2006 @@ -0,0 +1,304 @@ +/* + * Copyright 2005 The Apache Software Foundation + * + * 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. + * + */ +package org.apache.felix.jmood.utils; +import java.util.*; +import javax.management.openmbean.*; +import org.osgi.service.useradmin.*; +import org.osgi.service.log.*; +import org.osgi.framework.*; + +/** + * This class's task is to be in charge of all needed type conversions + * inside the management agent. This involves translating osgi-defined types + * to jmx's open types. It implements methods for obtaining open instances. + * This class implements the singleton pattern. + * + */ +public class OSGi2JMXCodec { + public static CompositeData encodeBundleEvent(BundleEvent event) throws Exception{ + if(event==null) return null; + String[] itemNames=CompositeDataItemNames.BUNDLE_EVENT; + Object[] itemValues=new Object [3]; + itemValues[0]=new Integer((int)event.getBundle().getBundleId()); + itemValues[1]=event.getBundle().getLocation(); + itemValues[2]=new Integer(event.getType()); + return new CompositeDataSupport( + OSGiTypes.BUNDLEEVENT, + itemNames, + itemValues); + } + public static CompositeData encodeServiceEvent(ServiceEvent event) throws Exception{ + if(event==null) return null; + String[] itemNames=CompositeDataItemNames.SERVICE_EVENT; + Object[] itemValues=new Object[2]; + itemValues[0]=encodeService(event.getServiceReference()); + itemValues[1]=new Integer(event.getType()); + return new CompositeDataSupport( + OSGiTypes.SERVICEEVENT, + itemNames, + itemValues); + + } + public static CompositeData encodeFrameworkEvent(FrameworkEvent event) throws Exception{ + if(event==null) return null; + String[] itemNames=CompositeDataItemNames.FRAMEWORK_EVENT; + Object[] itemValues=new Object[4]; + itemValues[0]=new Integer((int)event.getBundle().getBundleId()); + itemValues[1]=event.getBundle().getLocation(); + if (event.getThrowable()==null) itemValues[2]=null; + else itemValues[2]=encodeException(event.getThrowable()); + itemValues[3]=new Integer(event.getType()); + return new CompositeDataSupport( + OSGiTypes.FRAMEWORKEVENT, + itemNames, + itemValues); + + } + public static CompositeData encodeUserAdminEvent(UserAdminEvent event) throws Exception{ + //type: better as a String or as a number? for the moment number. + //FUTURE WORK Enable some bulk methods in most used parts: optimization issue + if(event==null) return null; + String [] itemNames =CompositeDataItemNames.USER_EVENT; + Object[] itemValues=new Object[3]; + itemValues[0]=new Integer(event.getType()); + itemValues[1]=encodeRole(event.getRole()); + itemValues[2]=encodeService(event.getServiceReference()); + return new CompositeDataSupport( + OSGiTypes.USERADMINEVENT, + itemNames, + itemValues); + } + public static CompositeData[] encodeLog(Enumeration enumeration) throws Exception{ + if(enumeration==null) return null; + Vector vector=new Vector(); + while(enumeration.hasMoreElements()){ + vector.add(encodeLogEntry((LogEntry)enumeration.nextElement())); + } + CompositeData[] value=new CompositeData[vector.size()]; + vector.copyInto(value); + return value; + } + public static CompositeData encodeUser(User user) throws Exception { + if(user==null) return null; + String[] itemNames = CompositeDataItemNames.USER; + Object[] itemValues = new Object[2]; + itemValues[0] = encodeRole((Role)user); + itemValues[1] = + OSGi2JMXCodec.encodeUserCredentials(user.getCredentials()); + return new CompositeDataSupport( + OSGiTypes.USER, + itemNames, + itemValues); + } + public static CompositeData encodeRole(Role role) throws Exception { + if (role==null) return null; + Object[] itemValues = new Object[3]; + itemValues[0] = role.getName(); + itemValues[1] = new Integer(role.getType()); + itemValues[2] = + OSGi2JMXCodec.encodeRoleProperties(role.getProperties()); + CompositeData cdata = + new CompositeDataSupport( + OSGiTypes.ROLE, + CompositeDataItemNames.ROLE, + itemValues); + return cdata; + } + public static CompositeData encodeGroup(Group group) throws Exception { + if(group==null) return null; + String[] itemNames = CompositeDataItemNames.GROUP; + Object[] itemValues = new Object[3]; + itemValues[0] = encodeUser((User)group); + Role[] members = group.getMembers(); + String[] membersNames; + if (members!=null){ + membersNames = new String[members.length]; + for (int i = 0; i < members.length; i++) + membersNames[i] = members[i].getName(); + } + else{ + membersNames=new String[0]; + } + itemValues[1] = membersNames; + Role[] requiredMembers = group.getRequiredMembers(); + String [] requiredMembersNames; + if(requiredMembers!=null){ + requiredMembersNames = new String[requiredMembers.length]; + for (int i = 0; i < requiredMembers.length; i++) + requiredMembersNames[i] = requiredMembers[i].getName(); + }else requiredMembersNames=new String[0]; + itemValues[2] = requiredMembersNames; + return new CompositeDataSupport(OSGiTypes.GROUP, itemNames, itemValues); + } + public static CompositeData encodeAuthorization(Authorization authorization) + throws Exception { + if(authorization==null) return null; + Object[] itemValues = new Object[2]; + String[] itemNames = CompositeDataItemNames.AUTHORIZATION; + itemValues[0] = authorization.getName(); + itemValues[1] = authorization.getRoles(); + return new CompositeDataSupport( + OSGiTypes.AUTHORIZATION, + itemNames, + itemValues); + } + public static CompositeData encodeLogEntry(LogEntry entry) + throws Exception { + if (entry==null) return null; + String[] itemNames = CompositeDataItemNames.LOG_ENTRY; + Object[] itemValues = new Object[7]; + itemValues[0] = new Integer((int) entry.getBundle().getBundleId()); + itemValues[1] =entry.getBundle().getLocation(); + itemValues[2] = OSGi2JMXCodec.encodeException(entry.getException()); + itemValues[3] = new Integer(entry.getLevel()); + itemValues[4] = entry.getMessage(); + itemValues[5] = + OSGi2JMXCodec.encodeService(entry.getServiceReference()); + itemValues[6] = new Integer((int) entry.getTime()); + return new CompositeDataSupport( + OSGiTypes.LOGENTRY, + itemNames, + itemValues); + } + public static CompositeData encodeRoleProperties(Dictionary RoleProperties) + throws Exception { + if (RoleProperties==null) return null; + if(RoleProperties.isEmpty()) return null; + Enumeration propkeys= RoleProperties.keys(); + Vector byteKeys=new Vector(); + Vector byteValues=new Vector(); + Vector StringKeys=new Vector(); + Vector StringValues=new Vector(); + while(propkeys.hasMoreElements()){ + Object key=propkeys.nextElement(); + Object value= RoleProperties.get(key); + if ( value instanceof byte[] ) { + byteKeys.add(key); + byteValues.add(value); + } + else if (value instanceof String) { + StringKeys.add(key); + StringValues.add(value); + } + } + Byte[][] bvalues=new Byte[byteValues.size()][]; + for(int i=0; iObjectNames under which the + * core MBeans (CoreControllerMBean, ManagedBundleMBean, + * ManagedServiceMBean) and ManagedPackageMBean + * Note that service, bundle and package data mbeans are created dynamically + * and need a dynamic property to be added to the objectName. + * + */ +public interface ObjectNames { + public static final String CORE= "osgi.core"; + public static final String COMPENDIUM="osgi.compendium"; + public static final String CORE_CONTROLLER=CORE+":type=controller"; + public static final String FRAMEWORK=CORE+":type=framework"; + public static final String BUNDLE=CORE+":type=bundle, symbolicName="; + public static final String SERVICE=CORE+":type=service, service.id="; + public static final String CM_SERVICE=COMPENDIUM+":service=cm, type=manager"; + public static final String CM_OBJECT=COMPENDIUM+":service=cm, type=object,"; + public static final String LOG_SERVICE = COMPENDIUM+":service=log"; + public static final String UA_SERVICE = COMPENDIUM+":service=useradmin"; + + /** + * package mbean object names also contain a version property to + * avoid InstanceAlreadyExistsException when two + * versions of the same package co-exist. + */ + public static final String PACKAGE=CORE+":type=package, name="; + public static final String ALLBUNDLES=CORE+":type=bundle,*"; + public static final String ALLSERVICES=CORE+":type=service,*"; + public static final String ALLPACKAGES=CORE+":type=package,*"; + public static final String ALL_CM_OBJECT=COMPENDIUM+":service=cm, type=object,*"; + +} Added: incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/agent.properties URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/agent.properties?rev=430562&view=auto ============================================================================== --- incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/agent.properties (added) +++ incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/agent.properties Thu Aug 10 15:15:58 2006 @@ -0,0 +1,2 @@ +java.security.policy=simple.policy +policy.embedded=true \ No newline at end of file Added: incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/config.properties URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/config.properties?rev=430562&view=auto ============================================================================== --- incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/config.properties (added) +++ incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/config.properties Thu Aug 10 15:15:58 2006 @@ -0,0 +1,333 @@ +# +# Framework config properties. +# +org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \ + org.osgi.service.packageadmin; version=1.2.0, \ + org.osgi.service.startlevel; version=1.0.0, \ + org.osgi.service.url; version=1.0.0, \ + org.osgi.service.permissionadmin; version=1.0.0, \ + org.osgi.service.useradmin; version=1.0.0, \ + org.osgi.service.cm; version=1.0.0, \ + org.osgi.service.log, \ + org.osgi.util.tracker, \ + ${jre-${java.specification.version}} + +#org.osgi.framework.bootdelegation=sun.*,com.sun.* +#felix.cache.profile=foo +#repo=${settings.localRepository} #Somehow, it does not get substituted +repo="/C:/Documents and Settings/mili/.m2/repository" + +version=${pom.version} +felix.auto.start.1= \ + file:${repo}/org/apache/felix/org.apache.felix.shell/0.8.0-SNAPSHOT/org.apache.felix.shell-0.8.0-SNAPSHOT.jar \ + file:${repo}/repository/org/apache/felix/org.apache.felix.shell.tui/0.8.0-SNAPSHOT/org.apache.felix.shell.tui-0.8.0-SNAPSHOT.jar \ + file:${repo}/org/apache/felix/org.apache.felix.jmood/0.8.0-SNAPSHOT/org.apache.felix.jmood-0.8.0-SNAPSHOT.jar \ + +felix.startlevel.framework=1 +felix.startlevel.bundle=1 +#framework.service.urlhandlers=false + +# +# Bundle config properties. +# +org.osgi.service.http.port=8080 +obr.shell.telnet=on +#obr.repository.url=http://bundles.osgi.org/obr/browse?_xml=1&cmd=repository + + +# +# Java platform package export properties. +# +jre-1.3= \ + javax.accessibility; \ + javax.accessibility.resources; \ + javax.naming; \ + javax.naming.directory; \ + javax.naming.event; \ + javax.naming.ldap; \ + javax.naming.spi; \ + javax.rmi; \ + javax.rmi.CORBA; \ + javax.sound.midi; \ + javax.sound.midi.spi; \ + javax.sound.sampled; \ + javax.sound.sampled.spi; \ + javax.swing; \ + javax.swing.border; \ + javax.swing.colorchooser; \ + javax.swing.event; \ + javax.swing.filechooser; \ + javax.swing.plaf; \ + javax.swing.plaf.basic; \ + javax.swing.plaf.basic.resources; \ + javax.swing.plaf.metal; \ + javax.swing.plaf.metal.resources; \ + javax.swing.plaf.multi; \ + javax.swing.table; \ + javax.swing.text; \ + javax.swing.text.html; \ + javax.swing.text.html.parser; \ + javax.swing.text.rtf; \ + javax.swing.tree; \ + javax.swing.undo; \ + javax.transaction; \ + org.omg.CORBA; \ + org.omg.CORBA_2_3; \ + org.omg.CORBA_2_3.portable; \ + org.omg.CORBA.DynAnyPackage; \ + org.omg.CORBA.ORBPackage; \ + org.omg.CORBA.portable; \ + org.omg.CORBA.TypeCodePackage; \ + org.omg.CosNaming; \ + org.omg.CosNaming.NamingContextPackage; \ + org.omg.SendingContext; \ + org.omg.stub.java.rmi; \ + version="1.3.0" + +jre-1.4= \ + javax.accessibility; \ + javax.imageio; \ + javax.imageio.event; \ + javax.imageio.metadata; \ + javax.imageio.plugins.jpeg; \ + javax.imageio.spi; \ + javax.imageio.stream; \ + javax.naming; \ + javax.naming.directory; \ + javax.naming.event; \ + javax.naming.ldap; \ + javax.naming.spi; \ + javax.print; \ + javax.print.attribute; \ + javax.print.attribute.standard; \ + javax.print.event; \ + javax.rmi; \ + javax.rmi.CORBA; \ + javax.security.auth; \ + javax.security.auth.callback; \ + javax.security.auth.kerberos; \ + javax.security.auth.login; \ + javax.security.auth.spi; \ + javax.security.auth.x500; \ + javax.sound.midi; \ + javax.sound.midi.spi; \ + javax.sound.sampled; \ + javax.sound.sampled.spi; \ + javax.sql; \ + javax.swing; \ + javax.swing.border; \ + javax.swing.colorchooser; \ + javax.swing.event; \ + javax.swing.filechooser; \ + javax.swing.plaf; \ + javax.swing.plaf.basic; \ + javax.swing.plaf.metal; \ + javax.swing.plaf.multi; \ + javax.swing.table; \ + javax.swing.text; \ + javax.swing.text.html; \ + javax.swing.text.html.parser; \ + javax.swing.text.rtf; \ + javax.swing.tree; \ + javax.swing.undo; \ + javax.transaction; \ + javax.transaction.xa; \ + javax.xml.parsers; \ + javax.xml.transform; \ + javax.xml.transform.dom; \ + javax.xml.transform.sax; \ + javax.xml.transform.stream; \ + org.apache.crimson.jaxp; \ + org.apache.crimson.parser; \ + org.apache.crimson.parser.resources; \ + org.apache.crimson.tree; \ + org.apache.crimson.tree.resources; \ + org.apache.crimson.util; \ + org.apache.xalan; \ + org.apache.xalan.client; \ + org.apache.xalan.extensions; \ + org.apache.xalan.lib; \ + org.apache.xalan.lib.sql; \ + org.apache.xalan.processor; \ + org.apache.xalan.res; \ + org.apache.xalan.serialize; \ + org.apache.xalan.templates; \ + org.apache.xalan.trace; \ + org.apache.xalan.transformer; \ + org.apache.xalan.xslt; \ + org.apache.xml.dtm; \ + org.apache.xml.dtm.ref; \ + org.apache.xml.dtm.ref.dom2dtm; \ + org.apache.xml.dtm.ref.sax2dtm; \ + org.apache.xml.utils; \ + org.apache.xml.utils.res; \ + org.apache.xml.utils.synthetic; \ + org.apache.xml.utils.synthetic.reflection; \ + org.apache.xpath; \ + org.apache.xpath.axes; \ + org.apache.xpath.compiler; \ + org.apache.xpath.functions; \ + org.apache.xpath.objects; \ + org.apache.xpath.operations; \ + org.apache.xpath.patterns; \ + org.apache.xpath.res; \ + org.ietf.jgss; \ + org.omg.CORBA; \ + org.omg.CORBA_2_3; \ + org.omg.CORBA_2_3.portable; \ + org.omg.CORBA.DynAnyPackage; \ + org.omg.CORBA.ORBPackage; \ + org.omg.CORBA.portable; \ + org.omg.CORBA.TypeCodePackage; \ + org.omg.CosNaming; \ + org.omg.CosNaming.NamingContextExtPackage; \ + org.omg.CosNaming.NamingContextPackage; \ + org.omg.Dynamic; \ + org.omg.DynamicAny; \ + org.omg.DynamicAny.DynAnyFactoryPackage; \ + org.omg.DynamicAny.DynAnyPackage; \ + org.omg.IOP; \ + org.omg.IOP.CodecFactoryPackage; \ + org.omg.IOP.CodecPackage; \ + org.omg.Messaging; \ + org.omg.PortableInterceptor; \ + org.omg.PortableInterceptor.ORBInitInfoPackage; \ + org.omg.PortableServer; \ + org.omg.PortableServer.CurrentPackage; \ + org.omg.PortableServer.POAManagerPackage; \ + org.omg.PortableServer.POAPackage; \ + org.omg.PortableServer.portable; \ + org.omg.PortableServer.ServantLocatorPackage; \ + org.omg.SendingContext; \ + org.omg.stub.java.rmi; \ + org.w3c.dom; \ + org.w3c.dom.css; \ + org.w3c.dom.events; \ + org.w3c.dom.html; \ + org.w3c.dom.stylesheets; \ + org.w3c.dom.traversal; \ + org.w3c.dom.views; \ + org.xml.sax; \ + org.xml.sax.ext; \ + org.xml.sax.helpers; \ + version="1.4.0" + +jre-1.5= \ + javax.accessibility; \ + javax.activity; \ + javax.imageio; \ + javax.imageio.event; \ + javax.imageio.metadata; \ + javax.imageio.plugins.bmp; \ + javax.imageio.plugins.jpeg; \ + javax.imageio.spi; \ + javax.imageio.stream; \ + javax.management; \ + javax.management.loading; \ + javax.management.modelmbean; \ + javax.management.monitor; \ + javax.management.openmbean; \ + javax.management.relation; \ + javax.management.remote; \ + javax.management.remote.rmi; \ + javax.management.timer; \ + javax.naming; \ + javax.naming.directory; \ + javax.naming.event; \ + javax.naming.ldap; \ + javax.naming.spi; \ + javax.print; \ + javax.print.attribute; \ + javax.print.attribute.standard; \ + javax.print.event; \ + javax.rmi; \ + javax.rmi.CORBA; \ + javax.rmi.ssl; \ + javax.security.auth; \ + javax.security.auth.callback; \ + javax.security.auth.kerberos; \ + javax.security.auth.login; \ + javax.security.auth.spi; \ + javax.security.auth.x500; \ + javax.security.sasl; \ + javax.sound.midi; \ + javax.sound.midi.spi; \ + javax.sound.sampled; \ + javax.sound.sampled.spi; \ + javax.sql; \ + javax.sql.rowset; \ + javax.sql.rowset.serial; \ + javax.sql.rowset.spi; \ + javax.swing; \ + javax.swing.border; \ + javax.swing.colorchooser; \ + javax.swing.event; \ + javax.swing.filechooser; \ + javax.swing.plaf; \ + javax.swing.plaf.basic; \ + javax.swing.plaf.metal; \ + javax.swing.plaf.multi; \ + javax.swing.plaf.synth; \ + javax.swing.table; \ + javax.swing.text; \ + javax.swing.text.html; \ + javax.swing.text.html.parser; \ + javax.swing.text.rtf; \ + javax.swing.tree; \ + javax.swing.undo; \ + javax.transaction; \ + javax.transaction.xa; \ + javax.xml; \ + javax.xml.datatype; \ + javax.xml.namespace; \ + javax.xml.parsers; \ + javax.xml.transform; \ + javax.xml.transform.dom; \ + javax.xml.transform.sax; \ + javax.xml.transform.stream; \ + javax.xml.validation; \ + javax.xml.xpath; \ + org.ietf.jgss; \ + org.omg.CORBA; \ + org.omg.CORBA_2_3; \ + org.omg.CORBA_2_3.portable; \ + org.omg.CORBA.DynAnyPackage; \ + org.omg.CORBA.ORBPackage; \ + org.omg.CORBA.portable; \ + org.omg.CORBA.TypeCodePackage; \ + org.omg.CosNaming; \ + org.omg.CosNaming.NamingContextExtPackage; \ + org.omg.CosNaming.NamingContextPackage; \ + org.omg.Dynamic; \ + org.omg.DynamicAny; \ + org.omg.DynamicAny.DynAnyFactoryPackage; \ + org.omg.DynamicAny.DynAnyPackage; \ + org.omg.IOP; \ + org.omg.IOP.CodecFactoryPackage; \ + org.omg.IOP.CodecPackage; \ + org.omg.Messaging; \ + org.omg.PortableInterceptor; \ + org.omg.PortableInterceptor.ORBInitInfoPackage; \ + org.omg.PortableServer; \ + org.omg.PortableServer.CurrentPackage; \ + org.omg.PortableServer.POAManagerPackage; \ + org.omg.PortableServer.POAPackage; \ + org.omg.PortableServer.portable; \ + org.omg.PortableServer.ServantLocatorPackage; \ + org.omg.SendingContext; \ + org.omg.stub.java.rmi; \ + org.omg.stub.javax.management.remote.rmi; \ + org.w3c.dom; \ + org.w3c.dom.bootstrap; \ + org.w3c.dom.css; \ + org.w3c.dom.events; \ + org.w3c.dom.html; \ + org.w3c.dom.ls; \ + org.w3c.dom.ranges; \ + org.w3c.dom.stylesheets; \ + org.w3c.dom.traversal; \ + org.w3c.dom.views; \ + org.xml.sax; \ + org.xml.sax.ext; \ + org.xml.sax.helpers; \ + version="1.5.0" Added: incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/descriptor.xml URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/descriptor.xml?rev=430562&view=auto ============================================================================== --- incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/descriptor.xml (added) +++ incubator/felix/sandbox/santillan/org.apache.felix.jmood/src/main/resources/descriptor.xml Thu Aug 10 15:15:58 2006 @@ -0,0 +1,54 @@ + + + + + optional + 12 + + jmood + 0.8 + + UPM + 3 + + + jmood + 0.8 + http://cauca.dit.upm.es:9000/testing/jmood.jar + http://maquina.dit.upm.es:9000/testing/metadata/jmood.xml + + + + application + and + + OSGi-service + 1.0 + http://maquina.dit.upm.es:9000/testing/osgi-service.jar + http://cauca.dit.upm.es:9000/osgi-service.xml + + Bundle containing all the standard services definitions + + + application + and + + OSGi-util + 1.0 + http://maquina.dit.upm.es:9000/testing/osgi-util.jar + http://cauca.dit.upm.es:9000/osgi-util.xml + + Bundle containing all the standard osgi utils + + + application + and + + telvent-bundle + 1.0 + http://maquina.dit.upm.es:9000/testing/telvent-bundle.jar + http://maquina.dit.upm.es:9000/testing/metadata/telvent-bundle.xml + + This is a dependency to Telvent's Axis wrapper + +