STP Core Overview Documentation

Introspection Framework [Index]

The Introspection framework provides a mechanism to derive a ComponentType from an Implementation. The ComponentType provides the contract between the container and the implementation; that is, it specifies the available Services and required References from the viewpoint of the implementation.

Introspectors are defined through the org.eclipse.stp.core extension point (as below). The following example declares an Introspector for a simple Properties-file based model. The full source of this example can be found in org.eclipse.stp.core.tests.

   

<extension point=

"org.eclipse.stp.core.componentTypeIntrospector"

>

<componentTypeIntrospector

class=

"org.eclipse.stp.core.tests.introspection.PropertiesComponentTypeIntrospector"

extension=

"properties"

implementationElementType=

"implementation.properties"

shareableURIFactoryClass=

"org...ShareablePropertyComponentTypeFactory"

/>

</extension>

In this example, we declare an Introspector for XML elements named "implementation.properties". Whenever a client attempts to resolve the ComponentType (Component.resolveComponentType())) for an Implementation element with the name "implementation.properties", this Introspector will be given the opportunity to convert the XML element into a ComponentType. In this, the XML element looks like <implementation.properties properties="..." /> where the "properties" attribute specifies the path to a *.properties file.

Similarly, the "extension" attribute in the Introspector extension indicates what file extensions are supported. Whenever we need to derive a ComponentType for a file with the extension *.properties, we will use this Introspector. The support for loading and sharing ComponentType types for files is handled transparently through the EMF Resource Management layer. Whenever a request is received for a resource with the protocol "comptype://", the extension of the resource is used to determine which Introspector can derive the ComponentType and transparently facade the ComponentType as if it were loaded like a normal EMF Resource. EMF Resource are requested using the standard IEditModelScribbler layer which will be described later.

This documentation is maintained by Michael D. Elder (mdelder{at}us.ibm.com). Questions or requests for clarifications should be made to the STP Developer mailing list (stp-dev@eclipse.org). See http://www.eclipse.org/mail/index_all.php for details on how to sign up.

Copyright (c) 2006 IBM Corporation. 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 http://www.eclipse.org/legal/epl-v10.html

[Index] [Top]