Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.common.core.service
Class AbstractProviderConfiguration

java.lang.Object
  extended by 
org.eclipse.gmf.runtime.common.core.service.AbstractProviderConfiguration
Direct Known Subclasses:
ModelingAssistantProviderConfiguration, ViewProviderConfiguration

public class AbstractProviderConfiguration
extends java.lang.Object

Concrete subclasses can be used to assist in parsing service provider descriptors to filter out and delay loading of service providers that do not apply.

This abstract class contains a set of useful utilities for such concrete subclasses.


Nested Class Summary
static class AbstractProviderConfiguration.ObjectDescriptor
          A descriptor for an XML configuration element that identifies a class by name and optionally its methods.
 
Field Summary
protected static java.lang.String CLASS
          The name of the 'class' XML attribute.
protected static java.lang.String contextParam
          the name of the context param
protected static java.lang.String ID
          The name of the 'id' XML attribute.
protected static java.lang.String METHOD
          The name of the 'method' XML attribute.
protected static java.lang.String NAME
          The name of the 'name' XML attribute.
protected static java.lang.String NOT_VALUE
          The name of the 'notValue' XML attribute.
protected static java.lang.String NULL
          The name of the 'null' XML attribute value.
protected static java.lang.String OBJECT
          The name of the 'object' XML attribute.
protected static java.lang.String STATIC_METHOD
          The name of the 'method' XML attribute.
protected static java.lang.String VALUE
          The name of the 'value' XML attribute.
 
Constructor Summary
AbstractProviderConfiguration ()
           
 
Method Summary
protected static java.lang.Object getAdapter (java.lang.Object object, java.lang.String className, java.lang.String pluginId)
          Gets an adapter for object to the class described by className qualified by the optional pluginId.
protected static java.util.List getObjectList (java.lang.String objectsIds, java.util.Map objectMap, IConfigurationElement configElement)
          A helper method to return a list of objects whose ids are given in a comma-separated string and whose instances are given in an object map.
protected static org.osgi.framework.Bundle getPluginBundle (java.lang.String pluginId)
          Given a bundle id, it checks if the bundle is found and activated.
protected static java.util.Set getStrings (java.lang.String s)
          Parses the comma-separated s string and returns a set of the individual entries in the string.
protected static java.lang.Object invokeMethod (org.eclipse.gmf.runtime.common.core.service.AbstractProviderConfiguration.MethodDescriptor methodDescriptor, java.lang.Object object)
          A utility method to invoke a cascading list of methods.
protected static java.lang.Object invokeStaticMethod (org.eclipse.gmf.runtime.common.core.service.AbstractProviderConfiguration.StaticMethodDescriptor methodDescriptor, java.lang.Object object)
          A utility method to invoke a cascading list of methods.
protected static boolean isAssignableTo (java.lang.Class clazz, java.lang.String className)
          Tests if the given class is assignable to the given class name.
protected static java.lang.Class loadClass (java.lang.String className, java.lang.String pluginId)
          A utility method to load a class using its name and a given class loader.
protected static boolean objectMatches (java.lang.Object object, java.util.List objects)
          Tests if an object matches at least one in the list of object descriptors passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECT

protected static final java.lang.String OBJECT
The name of the 'object' XML attribute.

See Also:
Constant Field Values

ID

protected static final java.lang.String ID
The name of the 'id' XML attribute.

See Also:
Constant Field Values

CLASS

protected static final java.lang.String CLASS
The name of the 'class' XML attribute.

See Also:
Constant Field Values

METHOD

protected static final java.lang.String METHOD
The name of the 'method' XML attribute.

See Also:
Constant Field Values

STATIC_METHOD

protected static final java.lang.String STATIC_METHOD
The name of the 'method' XML attribute.

See Also:
Constant Field Values

NAME

protected static final java.lang.String NAME
The name of the 'name' XML attribute.

See Also:
Constant Field Values

VALUE

protected static final java.lang.String VALUE
The name of the 'value' XML attribute.

See Also:
Constant Field Values

NOT_VALUE

protected static final java.lang.String NOT_VALUE
The name of the 'notValue' XML attribute.

See Also:
Constant Field Values

NULL

protected static final java.lang.String NULL
The name of the 'null' XML attribute value.

See Also:
Constant Field Values

contextParam

protected static final java.lang.String contextParam
the name of the context param

See Also:
Constant Field Values
Constructor Detail

AbstractProviderConfiguration

public AbstractProviderConfiguration()
Method Detail

getObjectList

protected static java.util.List getObjectList(java.lang.String objectsIds,
                                              java.util.Map objectMap,
                                              
IConfigurationElement configElement)
A helper method to return a list of objects whose ids are given in a comma-separated string and whose instances are given in an object map.

Parameters:
objectsIds - A comma-separated object ids string
objectMap - A map of object ids to their instances
configElement - The configuration element, used for error logging
Returns:
a list of object instances whose ids are given or null if no ids matched any instances

getStrings

protected static java.util.Set getStrings(java.lang.String s)
Parses the comma-separated s string and returns a set of the individual entries in the string.

Parameters:
s - A comma-separated string
Returns:
a set of the individual entries in the string.

objectMatches

protected static boolean objectMatches(java.lang.Object object,
                                       java.util.List objects)
Tests if an object matches at least one in the list of object descriptors passed.

Parameters:
object - the object for which to find a match
objects - the list of object in which to find a match
Returns:
true if there was a match, false otherwise

loadClass

protected static java.lang.Class loadClass(java.lang.String className,
                                           java.lang.String pluginId)
A utility method to load a class using its name and a given class loader.

Parameters:
className - The class name
bundle - The class loader
Returns:
The loaded class or null if could not be loaded

getPluginBundle

protected static org.osgi.framework.Bundle getPluginBundle(java.lang.String pluginId)
Given a bundle id, it checks if the bundle is found and activated. If it is, the method returns the bundle, otherwise it returns null.

Parameters:
pluginId - the bundle ID
Returns:
the bundle, if found

isAssignableTo

protected static boolean isAssignableTo(java.lang.Class clazz,
                                        java.lang.String className)
Tests if the given class is assignable to the given class name. Optimized to look first in a cache of previously retrieved results.

Parameters:
clazz - the class to be tested
className - the class name to test against
Returns:
true if the class is assignable to the class name, false otherwise.

getAdapter

protected static java.lang.Object getAdapter(java.lang.Object object,
                                             java.lang.String className,
                                             java.lang.String pluginId)
Gets an adapter for object to the class described by className qualified by the optional pluginId.

Parameters:
object - the object to be adapted
className - the name of the adapter class
pluginId - the optional plugin ID (can be null/code>)
Returns:
the adapted object, or null if it couldn't be found

invokeMethod

protected static java.lang.Object invokeMethod(org.eclipse.gmf.runtime.common.core.service.AbstractProviderConfiguration.MethodDescriptor methodDescriptor,
                                               java.lang.Object object)
A utility method to invoke a cascading list of methods.

Parameters:
methodDescriptor - the first method descriptor
object - The object to invoke the method on
Returns:
the value of the invokation

invokeStaticMethod

protected static java.lang.Object invokeStaticMethod(org.eclipse.gmf.runtime.common.core.service.AbstractProviderConfiguration.StaticMethodDescriptor methodDescriptor,
                                                     java.lang.Object object)
A utility method to invoke a cascading list of methods.

Parameters:
StaticMethodDescriptor - the static method descriptor
object - The context object to use (it could be null)
Returns:
the value of the invokation

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire