tree: 8e7c131a48ef5bb9e5395b48427411592c312865 [path history] [tgz]
  1. .settings/
  2. META-INF/
  3. source-save/
  4. src/
  5. .classpath
  6. .project
  7. about.html
  8. about.ini
  9. about.mappings
  10. about.properties
  11. build.properties
  12. epl-v10.html
  13. license.html
  14. LICENSE.txt
  15. plugin.properties
  16. pom.xml
  17. README.md
org.eclipse.osbp.dsl.xtext.builder.participant/README.md

Lunifera DSL Metadata Service

Returns metadata for datatypes, entities and dtos. These services are provided as OSGi-Services.

available services

datatypes

Get information about a datatype:

public interface IDatatypesMetadataService {

/**
 * Returns the datatypes model for the given datatype name.
 * 
 * @param datatypeName
 * @return
 */
LDataType getMetadata(String datatypeName);

The service will use the given qualified name of the datatype to return the proper LDataType eObject for it.
Qualified follows the pattern “{package}.{name}” like org.eclipse.osbp.datatypes.String

entities

Get information about a entities:

public interface IEntityMetadataService {

/**
 * Returns the entity model for the given class. 
 * @param entityClass
 * @return
 */
LEntity getMetadata(Class<?> entityClass);

/**
 * Returns the entity model for the given class name. 
 * @param entityName
 * @return
 */
LEntity getMetadata(String entityName);

The service will use the given qualified name of the entity to return the proper LEntity eObject for it.
Qualified follows the pattern “{package}.{name}” like org.eclipse.osbp.carstore.entities.general.Customer

dtos

Get information about a entities:

public interface IDtoMetadataService {

/**
 * Returns the dto model for the given class.
 * 
 * @param dtoClass
 * @return
 */
LDto getMetadata(Class<?> dtoClass);

/**
 * Returns the dto model for the given class name.
 * 
 * @param dtoName
 * @return
 */
LDto getMetadata(String dtoName);

The service will use the given qualified name of the entity to return the proper LDto eObject for it.
Qualified follows the pattern “{package}.{name}” like org.eclipse.osbp.carstore.general.CustomerDto

How to use

Services are provided as OSGi Service. So you can consume them by DS (declarative services), get a reference by the bundleContext or even use a ServiceTracker.

The services also allow you to navigate along cross references.

public void foo(){
	LDto customerDto = dtoService.getMetadata(CustomerDto.class);
	
	// access the entity
	LEntity customer = customerDto.getWrappedType();
	List<LIndex> index = customer.getIndexes();
	
	// navigate along attributes
	for(LEntityAttribute attribute : customer.getAllAttributes()) {
		LDataType datatype = attribute.getDatatype();
	}
}

Attention

Never ever change values in the given metadata objects. It is not constrainted and may lead to major problems.