Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 141644 Details for
Bug 274980
[plug-in registry] Investigate possibility of reuse JMX spec in remote monitoring
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for org.eclipse.pde.runtime
jmx_plugin.txt (text/plain), 24.09 KB, created by
Wojciech Galanciak
on 2009-07-15 09:47:26 EDT
(
hide
)
Description:
patch for org.eclipse.pde.runtime
Filename:
MIME Type:
Creator:
Wojciech Galanciak
Created:
2009-07-15 09:47:26 EDT
Size:
24.09 KB
patch
obsolete
>Index: src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java,v >retrieving revision 1.2 >diff -u -r1.2 ConfigurationElement.java >--- src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java 15 Jul 2009 13:45:54 -0000 >@@ -27,4 +27,18 @@ > public Attribute[] getElements() { > return elements; > } >+ >+ public ModelObject[] getChildren() { >+ return elements; >+ } >+ >+ public void addChild(ModelObject o) { >+ if (o instanceof Attribute) { >+ // XXX very ineffective >+ Attribute[] tmp = new Attribute[elements.length + 1]; >+ System.arraycopy(elements, 0, tmp, 0, elements.length); >+ tmp[tmp.length - 1] = (Attribute) o; >+ elements = tmp; >+ } >+ } > } >Index: src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java,v >retrieving revision 1.2 >diff -u -r1.2 ModelObject.java >--- src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java 15 Jul 2009 13:45:54 -0000 >@@ -17,4 +17,17 @@ > > private static final long serialVersionUID = 1L; > >+ protected RegistryModel model; >+ >+ public void setModel(RegistryModel model) { >+ this.model = model; >+ } >+ >+ public void addChild(ModelObject obj) { >+ // empty >+ } >+ >+ public ModelObject[] getChildren() { >+ return null; >+ } > } >Index: src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java,v >retrieving revision 1.2 >diff -u -r1.2 RegistryModel.java >--- src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java 15 Jul 2009 13:45:54 -0000 >@@ -24,7 +24,7 @@ > private BackendChangeListener backendListener = new BackendChangeListener() { > public void addBundle(Bundle adapter) { > ModelChangeDelta delta = new ModelChangeDelta(adapter, ModelChangeDelta.ADDED); >- >+ adapter.setModel(RegistryModel.this); > bundles.put(new Long(adapter.getId()), adapter); > > if (adapter.getFragmentHost() != null) { >@@ -62,7 +62,7 @@ > > public void updateBundle(Bundle adapter, int updated) { > ModelChangeDelta delta = new ModelChangeDelta(adapter, updated); >- >+ adapter.setModel(RegistryModel.this); > bundles.put(new Long(adapter.getId()), adapter); // replace old with new one > > if (adapter.getFragmentHost() != null) { >@@ -113,7 +113,7 @@ > > public void updateService(ServiceRegistration adapter) { > services.put(new Long(adapter.getId()), adapter); >- >+ adapter.setModel(RegistryModel.this); > ModelChangeDelta delta = new ModelChangeDelta(adapter, ModelChangeDelta.UPDATED); > > fireModelChangeEvent(new ModelChangeDelta[] {delta}); >Index: src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java,v >retrieving revision 1.2 >diff -u -r1.2 ServiceRegistration.java >--- src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java 15 Jul 2009 13:45:54 -0000 >@@ -130,4 +130,18 @@ > } > return 0; > } >+ >+ public void addChild(ModelObject obj) { >+ if (obj instanceof Property) { >+ // XXX very ineffective >+ Property[] tmp = new Property[properties.length + 1]; >+ System.arraycopy(properties, 0, tmp, 0, properties.length); >+ tmp[tmp.length - 1] = (Property) obj; >+ properties = tmp; >+ } >+ } >+ >+ public ModelObject[] getChildren() { >+ return properties; >+ } > } >Index: src/org/eclipse/pde/internal/runtime/registry/model/Extension.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Extension.java,v >retrieving revision 1.2 >diff -u -r1.2 Extension.java >--- src/org/eclipse/pde/internal/runtime/registry/model/Extension.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/Extension.java 15 Jul 2009 13:45:54 -0000 >@@ -106,4 +106,18 @@ > result = prime * result + ((namespaceIdentifier == null) ? 0 : namespaceIdentifier.hashCode()); > return result; > } >+ >+ public void addChild(ModelObject o) { >+ if (o instanceof ConfigurationElement) { >+ // XXX very ineffective >+ ConfigurationElement[] tmp = new ConfigurationElement[configurationElements.length + 1]; >+ System.arraycopy(configurationElements, 0, tmp, 0, configurationElements.length); >+ tmp[tmp.length - 1] = (ConfigurationElement) o; >+ configurationElements = tmp; >+ } >+ } >+ >+ public ModelObject[] getChildren() { >+ return configurationElements; >+ } > } >Index: src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java,v >retrieving revision 1.2 >diff -u -r1.2 Bundle.java >--- src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java 15 Jul 2009 13:45:54 -0000 >@@ -141,4 +141,27 @@ > public BundlePrerequisite[] getExportedPackages() { > return exportedPackages; > } >+ >+ public ModelObject[] getChildren() { >+ ModelObject[] children = new ModelObject[imports.length + libraries.length]; >+ System.arraycopy(imports, 0, children, 0, imports.length); >+ System.arraycopy(libraries, 0, children, imports.length, libraries.length); >+ return children; >+ } >+ >+ public void addChild(ModelObject o) { >+ if (o instanceof BundlePrerequisite) { >+ // XXX very ineffective >+ BundlePrerequisite[] tmp = new BundlePrerequisite[imports.length + 1]; >+ System.arraycopy(imports, 0, tmp, 0, imports.length); >+ tmp[tmp.length - 1] = (BundlePrerequisite) o; >+ imports = tmp; >+ } else if (o instanceof BundleLibrary) { >+ // XXX very ineffective >+ BundleLibrary[] tmp = new BundleLibrary[libraries.length + 1]; >+ System.arraycopy(libraries, 0, tmp, 0, libraries.length); >+ tmp[tmp.length - 1] = (BundleLibrary) o; >+ libraries = tmp; >+ } >+ } > } >Index: src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java,v >retrieving revision 1.2 >diff -u -r1.2 ExtensionPoint.java >--- src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java 15 Jul 2009 13:45:54 -0000 >@@ -89,4 +89,14 @@ > return false; > return true; > } >+ >+ public void addChild(ModelObject obj) { >+ if (obj instanceof Extension) { >+ extensions.add(obj); >+ } >+ } >+ >+ public ModelObject[] getChildren() { >+ return (ModelObject[]) extensions.toArray(new ModelObject[extensions.size()]); >+ } > } >Index: src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java,v >retrieving revision 1.2 >diff -u -r1.2 ModelChangeDelta.java >--- src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java 15 Jul 2009 13:45:54 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2009 IBM Corporation and others. >+ * Copyright (c) 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,15 +7,15 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >- * Wojciech Galanciak <wojciech.galanciak@gmail.com> - bug 282804 > *******************************************************************************/ > package org.eclipse.pde.internal.runtime.registry.model; > > /** > * Delta model objects are of type IBundle, IService, IExtension, IExtensionPoint > */ >-public class ModelChangeDelta { >+public class ModelChangeDelta extends ModelObject { > >+ private static final long serialVersionUID = 1L; > public static final int ADDED = 0; > public static final int UPDATED = 1; > public static final int REMOVED = 2; >@@ -47,6 +47,14 @@ > return fFlag; > } > >+ public void addChild(ModelObject o) { >+ setModelObject(o); >+ } >+ >+ public ModelObject[] getChildren() { >+ return new ModelObject[] {fObject}; >+ } >+ > public void setModelObject(ModelObject fObject) { > this.fObject = fObject; > } >Index: src/org/eclipse/pde/internal/runtime/registry/model/Property.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Property.java,v >retrieving revision 1.2 >diff -u -r1.2 Property.java >--- src/org/eclipse/pde/internal/runtime/registry/model/Property.java 10 Jul 2009 14:19:50 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/model/Property.java 15 Jul 2009 13:45:54 -0000 >@@ -131,5 +131,9 @@ > // simply compare strings > return name0.compareTo(name1); > } >- >+ >+ public String toString() { >+ return "Property(\"" + name + "\", \"" + value + "\")"; >+ } >+ > } >Index: src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java >=================================================================== >RCS file: /cvsroot/eclipse/pde-incubator/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java,v >retrieving revision 1.2 >diff -u -r1.2 RegistryBrowser.java >--- src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java 10 Jul 2009 14:19:51 -0000 1.2 >+++ src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java 15 Jul 2009 13:45:54 -0000 >@@ -157,7 +157,7 @@ > } > > private void initializeModel() { >- model = RegistryModelFactory.getRegistryModel("local:///"); //$NON-NLS-1$ >+ model = RegistryModelFactory.getRegistryModel("jmx:///"); //$NON-NLS-1$ > > fTreeViewer.setInput(model); > listener = new RegistryBrowserModelChangeListener(RegistryBrowser.this); >Index: src/org/eclipse/pde/internal/runtime/registry/model/ModelSerializer.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/runtime/registry/model/ModelSerializer.java >diff -N src/org/eclipse/pde/internal/runtime/registry/model/ModelSerializer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/runtime/registry/model/ModelSerializer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,356 @@ >+package org.eclipse.pde.internal.runtime.registry.model; >+ >+import java.util.*; >+import org.xml.sax.Attributes; >+import org.xml.sax.SAXException; >+import org.xml.sax.helpers.DefaultHandler; >+ >+public class ModelSerializer { >+ >+ private static final String BUNDLE = "bundle"; //$NON-NLS-1$ >+ private static final String USING_BUNDLES = "usingBundles"; //$NON-NLS-1$ >+ private static final String CLASSES = "classes"; //$NON-NLS-1$ >+ private static final String EXTENSION_POINT_UNIQUE_IDENTIFIER = "extensionPointUniqueIdentifier"; //$NON-NLS-1$ >+ private static final String CONTRIBUTOR = "contributor"; //$NON-NLS-1$ >+ private static final String LABEL = "label"; //$NON-NLS-1$ >+ private static final String UNIQUE_IDENTIFIER = "uniqueIdentifier"; //$NON-NLS-1$ >+ private static final String NAMESPACE_IDENTIFIER = "namespaceIdentifier"; //$NON-NLS-1$ >+ private static final String IS_EXPORTED = "isExported"; //$NON-NLS-1$ >+ private static final String LIBRARY = "library"; //$NON-NLS-1$ >+ private static final String ID = "id"; //$NON-NLS-1$ >+ private static final String STATE = "state"; //$NON-NLS-1$ >+ private static final String VERSION = "version"; //$NON-NLS-1$ >+ private static final String IS_ENABLED = "isEnabled"; //$NON-NLS-1$ >+ private static final String LOCATION = "location"; //$NON-NLS-1$ >+ private static final String SYMBOLIC_NAME = "symbolicName"; //$NON-NLS-1$ >+ private static final String VALUE = "value"; //$NON-NLS-1$ >+ private static final String NAME = "name"; //$NON-NLS-1$ >+ private static final String FLAG = "flag"; //$NON-NLS-1$ >+ >+ public static abstract class XMLHandler extends DefaultHandler { >+ >+ private Stack stack = new Stack(); >+ >+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { >+ if (qName.equals("start")) //$NON-NLS-1$ >+ return; >+ >+ ModelObject o = create(qName); >+ if (o == null) >+ return; >+ >+ for (int i = 0; i < attributes.getLength(); i++) { >+ set(o, attributes.getQName(i), attributes.getValue(i)); >+ } >+ >+ if (!(o instanceof ModelChangeDelta)) { >+ ((ModelObject) stack.peek()).addChild(o); >+ } >+ >+ //System.out.println("push " + o); //XXX remove syso >+ stack.push(o); >+ >+ } >+ >+ public void endElement(String uri, String localName, String qName) throws SAXException { >+ if (qName.equals("start")) >+ return; >+ >+ //System.out.print("pop "); //XXX remove syso >+ ModelObject o = (ModelObject) stack.pop(); >+ //System.out.println(o); //XXX remove syso >+ >+ if (o instanceof ModelChangeDelta) { >+ handleDelta((ModelChangeDelta) o); >+ } >+ } >+ >+ public abstract void handleDelta(ModelChangeDelta delta); >+ >+ } >+ >+ protected static void set(ModelObject o, String name, String value) { >+ if (o instanceof Attribute) { >+ Attribute attribute = (Attribute) o; >+ if (NAME.equals(name)) { >+ attribute.setName(value); >+ } else if (VALUE.equals(name)) { >+ attribute.setValue(value); >+ } >+ >+ } else if (o instanceof Bundle) { >+ Bundle bundle = (Bundle) o; >+ >+ if (SYMBOLIC_NAME.equals(name)) { >+ bundle.setSymbolicName(value); >+ } else if (LOCATION.equals(name)) { >+ bundle.setLocation(value); >+ } else if (IS_ENABLED.equals(name)) { >+ bundle.setEnabled(Boolean.valueOf(value).booleanValue()); >+ } else if (VERSION.equals(name)) { >+ bundle.setVersion(value); >+ } else if (STATE.equals(name)) { >+ bundle.setState(Integer.parseInt(value)); >+ } else if (ID.equals(name)) { >+ bundle.setId(Long.parseLong(value)); >+ } >+ >+ } else if (o instanceof BundleLibrary) { >+ BundleLibrary library = (BundleLibrary) o; >+ if (LIBRARY.equals(name)) { >+ library.setLibrary(value); >+ } >+ >+ } else if (o instanceof BundlePrerequisite) { >+ BundlePrerequisite prereq = (BundlePrerequisite) o; >+ if (NAME.equals(name)) { >+ prereq.setName(value); >+ } else if (VERSION.equals(name)) { >+ prereq.setVersion(value); >+ } else if (IS_EXPORTED.equals(name)) { >+ prereq.setExported(Boolean.valueOf(value).booleanValue()); >+ } >+ >+ } else if (o instanceof Extension) { >+ Extension ext = (Extension) o; >+ if (NAMESPACE_IDENTIFIER.equals(name)) { >+ ext.setNamespaceIdentifier(value); >+ } else if (LABEL.equals(name)) { >+ ext.setLabel(value); >+ } else if (EXTENSION_POINT_UNIQUE_IDENTIFIER.equals(name)) { >+ ext.setExtensionPointUniqueIdentifier(value); >+ } else if (CONTRIBUTOR.equals(name)) { >+ ext.setContributor(Long.valueOf(value)); >+ } >+ >+ } else if (o instanceof ExtensionPoint) { >+ ExtensionPoint extPt = (ExtensionPoint) o; >+ if (LABEL.equals(name)) { >+ extPt.setLabel(value); >+ } else if (UNIQUE_IDENTIFIER.equals(name)) { >+ extPt.setUniqueIdentifier(value); >+ } else if (NAMESPACE_IDENTIFIER.equals(name)) { >+ extPt.setNamespaceIdentifier(value); >+ } else if (CONTRIBUTOR.equals(name)) { >+ extPt.setContributor(Long.valueOf(value)); >+ } >+ >+ } else if (o instanceof ServiceRegistration) { >+ ServiceRegistration service = (ServiceRegistration) o; >+ if (ID.equals(name)) { >+ service.setId(Long.parseLong(value)); >+ } else if (BUNDLE.equals(name)) { >+ service.setBundle(value); >+ } else if (USING_BUNDLES.equals(name)) { >+ StringTokenizer st = new StringTokenizer(value, ","); >+ List l = new ArrayList(); >+ while (st.hasMoreTokens()) { >+ l.add(Long.valueOf(st.nextToken())); >+ } >+ long[] ids = new long[l.size()]; >+ for (int i = 0; i < l.size(); i++) { >+ ids[i] = ((Long) l.get(i)).longValue(); >+ } >+ service.setUsingBundles(ids); >+ } else if (CLASSES.equals(name)) { >+ StringTokenizer st = new StringTokenizer(value, ","); >+ List l = new ArrayList(); >+ while (st.hasMoreTokens()) { >+ l.add(st.nextToken()); >+ } >+ >+ ServiceName sn = new ServiceName((String[]) l.toArray(new String[l.size()])); >+ service.setName(sn); >+ } >+ } else if (o instanceof Property) { >+ Property property = (Property) o; >+ if (NAME.equals(name)) { >+ property.setName(value); >+ } else if (VALUE.equals(name)) { >+ property.setValue(value); >+ } >+ >+ } else if (o instanceof ModelChangeDelta) { >+ ModelChangeDelta delta = (ModelChangeDelta) o; >+ >+ if (FLAG.equals(name)) { >+ delta.setFlag(Integer.parseInt(value)); >+ } >+ } >+ } >+ >+ protected static void addAttribute(StringBuffer sb, String name, String value) { >+ if (value == null) >+ return; >+ >+ sb.append(" ").append(name).append("=\"").append(getWritableString(value)).append("\""); >+ } >+ >+ protected static void addAttributes(StringBuffer sb, ModelObject o) { >+ >+ if (o instanceof Attribute) { >+ Attribute attribute = (Attribute) o; >+ addAttribute(sb, NAME, attribute.getName()); >+ addAttribute(sb, VALUE, attribute.getValue()); >+ >+ } else if (o instanceof Bundle) { >+ Bundle bundle = (Bundle) o; >+ >+ addAttribute(sb, SYMBOLIC_NAME, bundle.getSymbolicName()); >+ addAttribute(sb, LOCATION, bundle.getLocation()); >+ addAttribute(sb, IS_ENABLED, Boolean.toString(bundle.isEnabled())); >+ addAttribute(sb, VERSION, bundle.getVersion()); >+ addAttribute(sb, STATE, Integer.toString(bundle.getState())); >+ addAttribute(sb, ID, Long.toString(bundle.getId())); >+ >+ } else if (o instanceof BundleLibrary) { >+ BundleLibrary library = (BundleLibrary) o; >+ addAttribute(sb, LIBRARY, library.getLibrary()); >+ >+ } else if (o instanceof BundlePrerequisite) { >+ BundlePrerequisite prereq = (BundlePrerequisite) o; >+ addAttribute(sb, NAME, prereq.getName()); >+ addAttribute(sb, VERSION, prereq.getVersion()); >+ addAttribute(sb, IS_EXPORTED, Boolean.toString(prereq.isExported())); >+ >+ } else if (o instanceof Extension) { >+ Extension ext = (Extension) o; >+ addAttribute(sb, NAMESPACE_IDENTIFIER, ext.getNamespaceIdentifier()); >+ addAttribute(sb, LABEL, ext.getLabel()); >+ addAttribute(sb, EXTENSION_POINT_UNIQUE_IDENTIFIER, ext.getExtensionPointUniqueIdentifier()); >+ Long id = ext.getContributorId(); >+ if (id != null) >+ addAttribute(sb, CONTRIBUTOR, id.toString()); >+ >+ } else if (o instanceof ExtensionPoint) { >+ ExtensionPoint extPt = (ExtensionPoint) o; >+ addAttribute(sb, LABEL, extPt.getLabel()); >+ addAttribute(sb, UNIQUE_IDENTIFIER, extPt.getUniqueIdentifier()); >+ addAttribute(sb, NAMESPACE_IDENTIFIER, extPt.getNamespaceIdentifier()); >+ Long id = extPt.getContributorId(); >+ if (id != null) >+ addAttribute(sb, CONTRIBUTOR, id.toString()); >+ >+ } else if (o instanceof ServiceRegistration) { >+ ServiceRegistration service = (ServiceRegistration) o; >+ addAttribute(sb, ID, Long.toString(service.getId())); >+ addAttribute(sb, BUNDLE, service.getBundle()); >+ addAttribute(sb, USING_BUNDLES, arrayToString(service.getUsingBundleIds())); >+ addAttribute(sb, CLASSES, arrayToString(service.getName().getClasses())); >+ >+ } else if (o instanceof Property) { >+ Property property = (Property) o; >+ addAttribute(sb, NAME, property.getName()); >+ addAttribute(sb, VALUE, property.getValue()); >+ >+ } else if (o instanceof ModelChangeDelta) { >+ ModelChangeDelta delta = (ModelChangeDelta) o; >+ addAttribute(sb, FLAG, Integer.toString(delta.getFlag())); >+ } >+ } >+ >+ private static String arrayToString(Object[] array) { >+ StringBuffer sb = new StringBuffer(); >+ for (int i = 0; i < array.length; i++) { >+ if (i > 0) >+ sb.append(','); >+ sb.append(array[i]); >+ } >+ >+ return sb.toString(); >+ } >+ >+ private static String arrayToString(long[] array) { >+ StringBuffer sb = new StringBuffer(); >+ for (int i = 0; i < array.length; i++) { >+ if (i > 0) >+ sb.append(','); >+ sb.append(array[i]); >+ } >+ >+ return sb.toString(); >+ } >+ >+ private static ModelObject create(String name) { >+ if (Attribute.class.getName().equals(name)) { >+ return new Attribute(); >+ } else if (Bundle.class.getName().equals(name)) { >+ return new Bundle(); >+ } else if (BundleLibrary.class.getName().equals(name)) { >+ return new BundleLibrary(); >+ } else if (BundlePrerequisite.class.getName().equals(name)) { >+ return new BundlePrerequisite(); >+ } else if (ConfigurationElement.class.getName().equals(name)) { >+ return new ConfigurationElement(); >+ } else if (Extension.class.getName().equals(name)) { >+ return new Extension(); >+ } else if (ExtensionPoint.class.getName().equals(name)) { >+ return new ExtensionPoint(); >+ } else if (ModelChangeDelta.class.getName().equals(name)) { >+ return new ModelChangeDelta(); >+ } else if (ServiceRegistration.class.getName().equals(name)) { >+ return new ServiceRegistration(); >+ } else if (Property.class.getName().equals(name)) { >+ return new Property(); >+ } >+ >+ return null; >+ } >+ >+ public static String serialize(ModelObject o) { >+ return serialize(o, new StringBuffer()); >+ } >+ >+ // XXX From PDEXMLHelper >+ private static String getWritableString(String source) { >+ if (source == null) >+ return ""; //$NON-NLS-1$ >+ StringBuffer buf = new StringBuffer(); >+ for (int i = 0; i < source.length(); i++) { >+ char c = source.charAt(i); >+ switch (c) { >+ case '&' : >+ buf.append("&"); //$NON-NLS-1$ >+ break; >+ case '<' : >+ buf.append("<"); //$NON-NLS-1$ >+ break; >+ case '>' : >+ buf.append(">"); //$NON-NLS-1$ >+ break; >+ case '\'' : >+ buf.append("'"); //$NON-NLS-1$ >+ break; >+ case '\"' : >+ buf.append("""); //$NON-NLS-1$ >+ break; >+ default : >+ buf.append(c); >+ break; >+ } >+ } >+ return buf.toString(); >+ } >+ >+ private static String serialize(ModelObject o, StringBuffer sb) { >+ String className = o.getClass().getName(); >+ sb.append('<').append(className); >+ >+ addAttributes(sb, o); >+ >+ sb.append('>').append('\n'); >+ >+ ModelObject[] children = o.getChildren(); >+ >+ if (children != null) { >+ for (int i = 0; i < children.length; i++) { >+ if (children[i] != null) >+ serialize(children[i], sb); >+ } >+ } >+ >+ sb.append("</").append(className).append('>').append('\n'); //$NON-NLS-1$ >+ >+ return sb.toString(); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 274980
:
136698
|
141643
| 141644