diff options
author | Jad | 2017-07-13 22:36:58 +0000 |
---|---|---|
committer | Jad | 2017-08-14 09:05:23 +0000 |
commit | 4d1f2d9e03aa2dfae8462518385d1286faf600a2 (patch) | |
tree | 4b945dbcdc0cb38bb37ad15a164ed5c3d31f66fc | |
parent | 63be9e02404cdc1f382179973de240ddc5ab1c97 (diff) | |
download | org.eclipse.lyo.tools-change/101245/3.tar.gz org.eclipse.lyo.tools-change/101245/3.tar.xz org.eclipse.lyo.tools-change/101245/3.zip |
Bug 519663 - Allow DomainSpecifications to override the defaultchange/101245/3
packagenames and locations of their resulting javaclasses
A GenerationSettings property can be set on the whole Specification
and/or a specific DomainSpecification. This settings
allows the modeller to override the default path & package names defined
for a specific adaptorInterface.
For a Domain Specification, The GenerationSettings property are modified
through a context menu on a Domain Specification element in the
Modeller.
For a Specification, the GenerationSettings property are modified
through a context menu on Specification diagram in the Modeller.
For each Domain specification (or for the whole Specification), its
resources and a "Constants" interface
class is generated at its destination path (default or overrriden).
For each adaptor, a resourceCreationFactory class is generated to
support the construction of resource instances (or their URI/links) that
is specific for that particular adaptor.
The adaptor-specific constructors and ConstructURI/Link methods
originally generated in the resource classes are now marked as
deprecated.
Change-Id: I53d3378d75b19025ad2a45e05231673204ecbabb
Signed-off-by: Jad <jad@kth.se>
43 files changed, 1547 insertions, 68 deletions
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore b/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore index e658a71..55ee76f 100644 --- a/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore +++ b/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore @@ -42,6 +42,8 @@ eType="#//DomainSpecification" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="domainPrefixes" upperBound="-1" eType="#//NamespacePrefix" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generationSetting" eType="#//GenerationSetting" + containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="DomainSpecification"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> @@ -53,6 +55,8 @@ eType="#//Resource" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="resourceProperties" upperBound="-1" eType="#//ResourceProperty" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generationSetting" eType="#//GenerationSetting" + containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="NamespacePrefix"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> @@ -212,4 +216,8 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="adaptorInterface" lowerBound="1" eType="#//AdaptorInterface"/> </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="GenerationSetting"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="javaClassPackageName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="javaFilesPath" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> </ecore:EPackage> diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.genmodel b/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.genmodel index a79c949..ac31b39 100644 --- a/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.genmodel +++ b/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.genmodel @@ -65,6 +65,7 @@ <genClasses ecoreClass="adaptorInterface.ecore#//Specification"> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//Specification/domainSpecifications"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//Specification/domainPrefixes"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//Specification/generationSetting"/> </genClasses> <genClasses ecoreClass="adaptorInterface.ecore#//DomainSpecification"> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//DomainSpecification/name"/> @@ -72,6 +73,7 @@ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//DomainSpecification/namespacePrefix"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//DomainSpecification/resources"/> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//DomainSpecification/resourceProperties"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//DomainSpecification/generationSetting"/> </genClasses> <genClasses ecoreClass="adaptorInterface.ecore#//NamespacePrefix"> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//NamespacePrefix/name"/> @@ -163,5 +165,9 @@ <genClasses ecoreClass="adaptorInterface.ecore#//ModelledRequiredAdaptor"> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference adaptorInterface.ecore#//ModelledRequiredAdaptor/adaptorInterface"/> </genClasses> + <genClasses ecoreClass="adaptorInterface.ecore#//GenerationSetting"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//GenerationSetting/javaClassPackageName"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute adaptorInterface.ecore#//GenerationSetting/javaFilesPath"/> + </genClasses> </genPackages> </genmodel:GenModel> diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl index 8e262ec..8f9ba0a 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl @@ -25,6 +25,7 @@ [import org::eclipse::lyo::oslc4j::codegenerator::services::services/] [import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::domainSpecificationServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderServices/] @@ -93,7 +94,7 @@ import [javaClassFullNameForService(aServiceProvider)/]; import [javaClassFullNameForResourceShapeService(anAdaptorInterface) /]; [for (aResource: Resource | relevantResources(anAdaptorInterface)->sortedBy(name)) separator(lineSeparator())]import [javaClassFullName(aResource, anAdaptorInterface) /];[/for] -import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /]; +[for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)->sortedBy(name)) separator(lineSeparator())]import [javaInterfaceFullNameForConstants(aDomainSpecification, anAdaptorInterface) /];[/for] [for (aService: Service | anAdaptorInterface.serviceProviders().services) separator(lineSeparator())]import [javaClassFullName(aService) /];[/for] // [protected ('imports')] @@ -163,7 +164,7 @@ public class [javaClassNameForAdaptorApplication(anAdaptorInterface) /] extends } [for (aResource: Resource | relevantResources(anAdaptorInterface)->sortedBy(name))] - RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put([javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[resourcePathConstantName(aResource) /], [javaClassName(aResource)/].class); + RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put([javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourcePathConstantName(aResource) /], [javaClassName(aResource)/].class); [/for] } diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl index 3696b73..3d3d880 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl @@ -30,19 +30,6 @@ [import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::domainSpecificationServices/] -[template public generateDomainSpecificationConstants(aDomainSpecification : DomainSpecification)] -public static String [domainSpecificationConstantName(aDomainSpecification)/] = "[aDomainSpecification.namespaceURI/]"; -public static String [domainSpecificationNamespaceConstantName(aDomainSpecification)/] = "[aDomainSpecification.namespaceURI/]"; -public static String [domainSpecificationNamespacePrefixConstantName(aDomainSpecification)/] = "[aDomainSpecification.namespacePrefix.name/]"; -[/template] - - -[template public generateResourceConstants(aResource : Resource)] -public static String [resourceConstantName(aResource)/] = "[aResource.javaName(true)/]"; -public static String [resourcePathConstantName(aResource)/] = "[aResource.javaName(false)/]"; -public static String [resourceTypeConstantName(aResource)/] = [domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification())/] + "[aResource.javaName(false)/]"; -[/template] - [template public generateAdaptorConstants(anAdaptorInterface : AdaptorInterface)] [file (javaInterfaceFullFileNameForAdaptorConstants(anAdaptorInterface), false, 'UTF-8')] /******************************************************************************* @@ -80,18 +67,8 @@ public interface [javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /] // [protected ('user constants')] // [/protected] - [for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)->sortedBy(name))] - [generateDomainSpecificationConstants(aDomainSpecification) /] - [/for] - - [for (aResource: Resource | relevantResources(anAdaptorInterface)->sortedBy(name))] - [generateResourceConstants(aResource) /] - [/for] - public static final String HDR_OSLC_VERSION = "OSLC-Core-Version"; public static final String OSLC_VERSION_V2 = "2.0"; - } - [/file] [/template] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl index 391ce24..76fb4b5 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl @@ -25,6 +25,7 @@ [import org::eclipse::lyo::oslc4j::codegenerator::services::services/] [import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::domainSpecificationServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderServices/] @@ -60,7 +61,7 @@ @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_DATA_NAMESPACE), @OslcNamespaceDefinition(prefix = OslcConstants.RDF_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDF_NAMESPACE), @OslcNamespaceDefinition(prefix = OslcConstants.RDFS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDFS_NAMESPACE), -[for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)->sortedBy(name)) separator(','.concat(lineSeparator()))] @OslcNamespaceDefinition(prefix = [javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespacePrefixConstantName(aDomainSpecification) /], namespaceURI = [javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespaceConstantName(aDomainSpecification) /])[/for] +[for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)->sortedBy(name)) separator(','.concat(lineSeparator()))] @OslcNamespaceDefinition(prefix = [javaInterfaceNameForConstants(aDomainSpecification)/].[domainSpecificationNamespacePrefixConstantName(aDomainSpecification) /], namespaceURI = [javaInterfaceNameForConstants(aDomainSpecification)/].[domainSpecificationNamespaceConstantName(aDomainSpecification) /])[/for] }) package [javaClassPackageNameForAdaptorPackageInfo(anAdaptorInterface) /]; @@ -68,7 +69,7 @@ import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespaceDefinition; import org.eclipse.lyo.oslc4j.core.annotation.OslcSchema; import org.eclipse.lyo.oslc4j.core.model.OslcConstants; -import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /]; +[for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)->sortedBy(name)) separator(lineSeparator())]import [javaInterfaceFullNameForConstants(aDomainSpecification, anAdaptorInterface) /];[/for] [/file] [/template] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorResourcesFactory.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorResourcesFactory.mtl new file mode 100644 index 0000000..5ce607d --- /dev/null +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorResourcesFactory.mtl @@ -0,0 +1,124 @@ +[comment encoding = UTF-8 /] +[comment +/******************************************************************************* + * Copyright (c) 2017 Jad El-khoury. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v. 1.0 which accompanies this distribution. + * + * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * + * Jad El-khoury - initial implementation + * + *******************************************************************************/ +/] + +[module generateAdaptorResourcesFactory('http://org.eclipse.lyo/oslc4j/adaptorInterface')] + +[import org::eclipse::lyo::oslc4j::codegenerator::services::services/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/] + +[template public generateImports(anAdaptorInterface : AdaptorInterface)] +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; +import javax.ws.rs.core.UriBuilder; + +import org.eclipse.lyo.oslc4j.core.model.Link; +import org.eclipse.lyo.oslc4j.core.OSLC4JUtils; +[for (aResource: Resource | relevantResources(anAdaptorInterface))] +import [javaClassFullName(aResource, anAdaptorInterface) /]; +[/for] + +// [protected ('imports')] +// [/protected] +[/template] + +[template public generateFactoryMethods(aResource : Resource, anAdaptorInterface : AdaptorInterface)] +[for (aBasicCapability: BasicCapability | basicCapabilities(anAdaptorInterface, aResource))] +[let methodSuffix: String = (if (basicCapabilities(anAdaptorInterface, aResource)->size() = 1) then '' else basicCapabilities(anAdaptorInterface, aResource)->indexOf(aBasicCapability).toString() endif)] +[if (basicCapabilities(anAdaptorInterface, aResource)->indexOf(aBasicCapability) = 1)] +public static [javaClassName(aResource)/] create[javaName(aResource, true)/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, false)/]) + throws URISyntaxException +{ + return new [javaClassName(aResource)/](constructURIFor[javaName(aResource, true)/][methodSuffix/]([commaSeparate(aResource.instanceMethodParameterList(aBasicCapability), false, false)/])); +} +[/if] + +public static URI constructURIFor[javaName(aResource, true)/][methodSuffix/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, false)/]) +{ + String basePath = OSLC4JUtils.getServletURI(); + Map<String, Object> pathParameters = new HashMap<String, Object>(); + [for (instanceCompositeID: String | aResource.instanceCompositeID(aBasicCapability))] + pathParameters.put("[instanceCompositeID /]", [instanceCompositeID /]); + [/for] + String instanceURI = "[aResource.instanceURI(aBasicCapability) /]"; + + final UriBuilder builder = UriBuilder.fromUri(basePath); + return builder.path(instanceURI).buildFromMap(pathParameters); +} + +public static Link constructLinkFor[javaName(aResource, true)/][methodSuffix/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, true)/] final String label) +{ + return new Link(constructURIFor[javaName(aResource, true)/][methodSuffix/]([commaSeparate(aResource.instanceMethodParameterList(aBasicCapability), false, false)/]), label); +} + +public static Link constructLinkFor[javaName(aResource, true)/][methodSuffix/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, false)/]) +{ + return new Link(constructURIFor[javaName(aResource, true)/][methodSuffix/]([commaSeparate(aResource.instanceMethodParameterList(aBasicCapability), false, false)/])); +} +[/let] +[/for] +[/template] + + +[template public generateAdaptorResourcesFactory(anAdaptorInterface : AdaptorInterface)] +[file (javaClassFullFileNameForResourcesFactory(anAdaptorInterface), false, 'UTF-8')] +/******************************************************************************* + * Copyright (c) 2017 Jad El-khoury. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v. 1.0 which accompanies this distribution. + * + * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * + * Jad El-khoury - initial implementation + * + *******************************************************************************/ + +package [javaClassPackageNameForResourcesFactory(anAdaptorInterface) /]; + +[generateImports(anAdaptorInterface)/] + +// [protected ('pre_class_code')] +// [/protected] + +public class [javaClassNameForResourcesFactory(anAdaptorInterface) /] { + + // [protected ('class_attributes')] + // [/protected] + + // [protected ('class_methods')] + // [/protected] + + [for (aResource: Resource | servicedResources(anAdaptorInterface))] + //methods for [aResource.javaClassName()/] resource + [aResource.generateFactoryMethods(anAdaptorInterface) /] + + [/for] +} +[/file] +[/template] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl index 960d3f2..c5065ae 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl @@ -31,6 +31,7 @@ [import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderServices/] [import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::domainSpecificationServices/] [template public generateAdaptorServiceProviderFactory(aServiceProvider: ServiceProvider)] [file (javaClassFullFileNameForFactory(aServiceProvider), false, 'UTF-8')] @@ -74,7 +75,7 @@ import org.eclipse.lyo.oslc4j.core.model.Publisher; import org.eclipse.lyo.oslc4j.core.model.ServiceProvider; import org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory; -import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /]; +[for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)->sortedBy(name)) separator(lineSeparator())]import [javaInterfaceFullNameForConstants(aDomainSpecification, anAdaptorInterface) /];[/for] [for (aService: Service | aServiceProvider.services) separator(lineSeparator())]import [javaClassFullName(aService) /];[/for] // [protected ('imports')] @@ -113,7 +114,7 @@ public class [javaClassNameForFactory(aServiceProvider) /] new PrefixDefinition(OslcConstants.RDF_NAMESPACE_PREFIX, new URI(OslcConstants.RDF_NAMESPACE)), new PrefixDefinition(OslcConstants.RDFS_NAMESPACE_PREFIX, new URI(OslcConstants.RDFS_NAMESPACE)), [for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(aServiceProvider)->sortedBy(name)) separator(','.concat(lineSeparator()))] - new PrefixDefinition([javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespacePrefixConstantName(aDomainSpecification) /], new URI([javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespaceConstantName(aDomainSpecification) /])) + new PrefixDefinition([javaInterfaceNameForConstants(aDomainSpecification)/].[domainSpecificationNamespacePrefixConstantName(aDomainSpecification) /], new URI([javaInterfaceNameForConstants(aDomainSpecification)/].[domainSpecificationNamespaceConstantName(aDomainSpecification) /])) [/for] }; diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateClientOnlyMainApplication.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateClientOnlyMainApplication.mtl index 10260dc..eb154f8 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateClientOnlyMainApplication.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateClientOnlyMainApplication.mtl @@ -67,7 +67,6 @@ import org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper; import com.hp.hpl.jena.rdf.model.Model; -import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /]; [for (aResource: Resource | relevantResources(anAdaptorInterface)->sortedBy(name)) separator(lineSeparator())]import [javaClassFullName(aResource, anAdaptorInterface) /];[/for] [for (aRequiredAdaptor: RequiredAdaptor | anAdaptorInterface.requiredAdaptors) separator(lineSeparator())]import [javaClassFullNameForClient(aRequiredAdaptor, anAdaptorInterface) /];[/for] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateDomainSpecificationConstants.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateDomainSpecificationConstants.mtl new file mode 100644 index 0000000..502cb32 --- /dev/null +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateDomainSpecificationConstants.mtl @@ -0,0 +1,85 @@ +[comment encoding = UTF-8 /] +[comment +/******************************************************************************* + * Copyright (c) 2012 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 + * and Eclipse Distribution License v. 1.0 which accompanies this distribution. + * + * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * + * Russell Boykin - initial API and implementation + * Alberto Giammaria - initial API and implementation + * Chris Peters - initial API and implementation + * Gianluca Bernardini - initial API and implementation + * Michael Fiedler - Bugzilla adpater implementations + * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) + *******************************************************************************/ +/] + +[module generateDomainSpecificationConstants('http://org.eclipse.lyo/oslc4j/adaptorInterface')] + +[import org::eclipse::lyo::oslc4j::codegenerator::services::services/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::domainSpecificationServices/] + +[template public generateResourceConstants(aResource : Resource)] +public static String [resourceConstantName(aResource)/] = "[aResource.javaName(true)/]"; +public static String [resourcePathConstantName(aResource)/] = "[aResource.javaName(false)/]"; +public static String [resourceTypeConstantName(aResource)/] = [domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification())/] + [resourceConstantName(aResource)/]; +[/template] + +[template public generateDomainSpecificationConstants(aDomainSpecification: DomainSpecification, anAdaptorInterface : AdaptorInterface)] +[file (javaInterfaceFullFileNameForConstants(aDomainSpecification, anAdaptorInterface), false, 'UTF-8')] +/******************************************************************************* + * Copyright (c) 2012 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 + * and Eclipse Distribution License v. 1.0 which accompanies this distribution. + * + * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * + * Russell Boykin - initial API and implementation + * Alberto Giammaria - initial API and implementation + * Chris Peters - initial API and implementation + * Gianluca Bernardini - initial API and implementation + * Michael Fiedler - Bugzilla adpater implementations + * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) + * + * This file is generated by org.eclipse.lyo.oslc4j.codegenerator + *******************************************************************************/ + +package [javaInterfacePackageNameForConstants(aDomainSpecification, anAdaptorInterface) /]; + +import org.eclipse.lyo.oslc4j.core.model.OslcConstants; + +// [protected ('imports')] +// [/protected] + +public interface [javaInterfaceNameForConstants(aDomainSpecification) /] +{ + // [protected ('user constants')] + // [/protected] + + public static String [domainSpecificationConstantName(aDomainSpecification)/] = "[aDomainSpecification.namespaceURI/]"; + public static String [domainSpecificationNamespaceConstantName(aDomainSpecification)/] = "[aDomainSpecification.namespaceURI/]"; + public static String [domainSpecificationNamespacePrefixConstantName(aDomainSpecification)/] = "[aDomainSpecification.namespacePrefix.name/]"; + + [for (aResource: Resource | relevantResources(anAdaptorInterface)->intersection(aDomainSpecification.resources)->sortedBy(name))] + [generateResourceConstants(aResource) /] + [/for] +} +[/file] +[/template] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl index ad8e16b..67a914d 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl @@ -144,7 +144,8 @@ import org.eclipse.lyo.oslc4j.core.model.ValueType; import org.eclipse.lyo.oslc4j.core.model.ResourceShape; import org.eclipse.lyo.oslc4j.core.model.ResourceShapeFactory; -import [javaInterfaceFullNameForAdaptorConstants(contextAdaptorInterface) /]; +import [javaInterfaceFullNameForConstants(aResource.definingDomainSpecification(), contextAdaptorInterface)/]; +[for (aDomainSpecification: DomainSpecification | (aResource.resourceProperties->union(aResource.interfaceProperties()->asSet())->collect(p: ResourceProperty | Set{p.definingDomainSpecification()}->union(p.range.definingDomainSpecification()->asSet())))->flatten()->asSet()->sortedBy(name)) separator(lineSeparator())]import [javaInterfaceFullNameForConstants(aDomainSpecification, contextAdaptorInterface) /];[/for] [for (aProperty: ResourceProperty | allProperties(aResource)->sortedBy(name))] [if(Sequence{'Resource', 'LocalResource'}->includes(aProperty.valueType.toString())) ] [for (r: Resource | aProperty.range)] @@ -165,9 +166,9 @@ import [javaClassFullName(r, contextAdaptorInterface) /]; [template public generateClassAnnotations(aResource : Resource, contextAdaptorInterface : AdaptorInterface)] // [protected ('classAnnotations')] // [/protected] -@OslcNamespace([javaInterfaceNameForAdaptorConstants(contextAdaptorInterface) /].[domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification()) /]) -@OslcName([javaInterfaceNameForAdaptorConstants(contextAdaptorInterface) /].[resourceConstantName(aResource) /]) -@OslcResourceShape(title = "[aResource.name /] Resource Shape", describes = [javaInterfaceNameForAdaptorConstants(contextAdaptorInterface) /].[resourceTypeConstantName(aResource) /]) +@OslcNamespace([javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification()) /]) +@OslcName([javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceConstantName(aResource) /]) +@OslcResourceShape(title = "[aResource.name /] Resource Shape", describes = [javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceTypeConstantName(aResource) /]) [/template] [template public generateClassDeclaration(aResource : Resource, contextAdaptorInterface : AdaptorInterface)] @@ -216,6 +217,10 @@ public [javaClassName(aResource) /](final URI about) [for (aBasicCapability: BasicCapability | basicCapabilities(contextAdaptorInterface, aResource))] [let methodSuffix: String = (if (basicCapabilities(contextAdaptorInterface, aResource)->size() = 1) then '' else basicCapabilities(contextAdaptorInterface, aResource)->indexOf(aBasicCapability).toString() endif)] [if (basicCapabilities(contextAdaptorInterface, aResource)->indexOf(aBasicCapability) = 1)] +/** +* @deprecated Use the methods in class {@link [javaClassFullNameForResourcesFactory(contextAdaptorInterface)/]} instead. +*/ +@Deprecated public [javaClassName(aResource)/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, false)/]) throws URISyntaxException { @@ -225,6 +230,10 @@ public [javaClassName(aResource)/]([commaSeparate(aResource.instanceMethodSignat } [/if] +/** +* @deprecated Use the methods in class {@link [javaClassFullNameForResourcesFactory(contextAdaptorInterface)/]} instead. +*/ +@Deprecated public static URI constructURI[methodSuffix/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, false)/]) { String basePath = OSLC4JUtils.getServletURI(); @@ -238,11 +247,19 @@ public static URI constructURI[methodSuffix/]([commaSeparate(aResource.instanceM return builder.path(instanceURI).buildFromMap(pathParameters); } +/** +* @deprecated Use the methods in class {@link [javaClassFullNameForResourcesFactory(contextAdaptorInterface)/]} instead. +*/ +@Deprecated public static Link constructLink[methodSuffix/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, true)/] final String label) { return new Link(constructURI[methodSuffix/]([commaSeparate(aResource.instanceMethodParameterList(aBasicCapability), false, false)/]), label); } +/** +* @deprecated Use the methods in class {@link [javaClassFullNameForResourcesFactory(contextAdaptorInterface)/]} instead. +*/ +@Deprecated public static Link constructLink[methodSuffix/]([commaSeparate(aResource.instanceMethodSignature(aBasicCapability, false), false, false)/]) { return new Link(constructURI[methodSuffix/]([commaSeparate(aResource.instanceMethodParameterList(aBasicCapability), false, false)/])); @@ -255,7 +272,7 @@ public static Link constructLink[methodSuffix/]([commaSeparate(aResource.instanc public static ResourceShape createResourceShape() throws OslcCoreApplicationException, URISyntaxException { return ResourceShapeFactory.createResourceShape(OSLC4JUtils.getServletURI(), OslcConstants.PATH_RESOURCE_SHAPES, - [javaInterfaceNameForAdaptorConstants(contextAdaptorInterface) /].[resourcePathConstantName(aResource)/], + [javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourcePathConstantName(aResource)/], [javaClassName(aResource) /].class); } diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceInterface.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceInterface.mtl index a8975b3..7f88406 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceInterface.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceInterface.mtl @@ -97,7 +97,8 @@ import org.eclipse.lyo.oslc4j.core.model.OslcConstants; import org.eclipse.lyo.oslc4j.core.model.Representation; import org.eclipse.lyo.oslc4j.core.model.ValueType; -import [javaInterfaceFullNameForAdaptorConstants(contextAdaptorInterface) /]; +import [javaInterfaceFullNameForConstants(aResource.definingDomainSpecification(), contextAdaptorInterface)/]; +[for (aDomainSpecification: DomainSpecification | (aResource.resourceProperties->union(aResource.interfaceProperties()->asSet())->collect(p: ResourceProperty | Set{p.definingDomainSpecification()}->union(p.range.definingDomainSpecification()->asSet())))->flatten()->asSet()->sortedBy(name)) separator(lineSeparator())]import [javaInterfaceFullNameForConstants(aDomainSpecification, contextAdaptorInterface) /];[/for] [for (aProperty: ResourceProperty | allProperties(aResource)->sortedBy(name))] [if(Sequence{'Resource', 'LocalResource'}->includes(aProperty.valueType.toString())) ] [for (r: Resource | aProperty.range)] @@ -109,9 +110,9 @@ import [javaInterfaceFullName(r, contextAdaptorInterface) /]; // [protected ('imports')] // [/protected] -@OslcNamespace([javaInterfaceNameForAdaptorConstants(contextAdaptorInterface) /].[domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification()) /]) -@OslcName([javaInterfaceNameForAdaptorConstants(contextAdaptorInterface) /].[resourceConstantName(aResource) /]) -@OslcResourceShape(title = "[aResource.name /] Resource Shape", describes = [javaInterfaceNameForAdaptorConstants(contextAdaptorInterface) /].[resourceTypeConstantName(aResource) /]) +@OslcNamespace([javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification()) /]) +@OslcName([javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceConstantName(aResource) /]) +@OslcResourceShape(title = "[aResource.name /] Resource Shape", describes = [javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceTypeConstantName(aResource) /]) public interface [javaInterfaceName(aResource) /] { diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl index 7ec7dca..f32aa63 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceService.mtl @@ -108,6 +108,7 @@ import org.eclipse.lyo.oslc4j.core.model.AbstractResource; import [javaClassFullNameForAdaptorManager(anAdaptorInterface) /]; import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /]; +[for (aDomainSpecification: DomainSpecification | (aService.servicedResources().definingDomainSpecification()->union(Set{aService.domainSpecification}))->sortedBy(name)) separator(lineSeparator())]import [javaInterfaceFullNameForConstants(aDomainSpecification, anAdaptorInterface) /];[/for] import [javaClassFullNameForSingleton(anAdaptorInterface.serviceProviderCatalog) /]; [for (aResource: Resource | aService.relevantResources()->sortedBy(name))] import [javaClassFullName(aResource, anAdaptorInterface) /]; @@ -118,7 +119,7 @@ import [javaClassFullName(aResource, anAdaptorInterface) /]; // [protected ('pre_class_code')] // [/protected] -@OslcService([javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[domainSpecificationConstantName(aService.domainSpecification) /]) +@OslcService([javaInterfaceNameForConstants(aService.domainSpecification)/].[domainSpecificationConstantName(aService.domainSpecification)/]) [JAXRSPathAnnotation(aService.serviceBaseURI()) /] public class [javaClassName(aService) /] { @@ -142,8 +143,8 @@ public class [javaClassName(aService) /] ( title = "[aQueryCapability.title /]", label = "[aQueryCapability.label /]", - resourceShape = OslcConstants.PATH_RESOURCE_SHAPES + "/" + [javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[resourcePathConstantName(aQueryCapability.resourceTypes->first()) /], - resourceTypes = {[for (aResource: Resource | aQueryCapability.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[resourceTypeConstantName(aResource) /][/for]}, + resourceShape = OslcConstants.PATH_RESOURCE_SHAPES + "/" + [javaInterfaceNameForConstants(aQueryCapability.resourceTypes->first().definingDomainSpecification())/].[resourcePathConstantName(aQueryCapability.resourceTypes->first()) /], + resourceTypes = {[for (aResource: Resource | aQueryCapability.resourceTypes) separator(', ') ][javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceTypeConstantName(aResource) /][/for]}, usages = {[for (usage: String | aQueryCapability.usages) separator(', ') ]"[usage/]"[/for]} ) @GET @@ -223,7 +224,7 @@ public class [javaClassName(aService) /] uri = "[aSelectionDialog.URI(true)/]", hintWidth = "[aSelectionDialog.hintWidth /]px", hintHeight = "[aSelectionDialog.hintHeight /]px", - resourceTypes = {[for (aResource: Resource | aSelectionDialog.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[resourceTypeConstantName(aResource) /][/for]}, + resourceTypes = {[for (aResource: Resource | aSelectionDialog.resourceTypes) separator(', ') ][javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceTypeConstantName(aResource) /][/for]}, usages = {[for (usage: String | aSelectionDialog.usages) separator(', ') ]"[usage/]"[/for]} ) @GET @@ -278,8 +279,8 @@ public class [javaClassName(aService) /] ( title = "[aCreationFactory.title /]", label = "[aCreationFactory.label /]", - resourceShapes = {[for (aResource: Resource | aCreationFactory.resourceTypes) separator(', ') ]OslcConstants.PATH_RESOURCE_SHAPES + "/" + [javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[resourcePathConstantName(aResource)/][/for]}, - resourceTypes = {[for (aResource: Resource | aCreationFactory.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[resourceTypeConstantName(aResource) /][/for]}, + resourceShapes = {[for (aResource: Resource | aCreationFactory.resourceTypes) separator(', ') ]OslcConstants.PATH_RESOURCE_SHAPES + "/" + [javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourcePathConstantName(aResource)/][/for]}, + resourceTypes = {[for (aResource: Resource | aCreationFactory.resourceTypes) separator(', ') ][javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceTypeConstantName(aResource) /][/for]}, usages = {[for (usage: String | aCreationFactory.usages) separator(', ') ]"[usage/]"[/for]} ) @POST @@ -340,7 +341,7 @@ public class [javaClassName(aService) /] uri = "[aCreationDialog.URI(false)/]", hintWidth = "[aCreationDialog.hintWidth /]px", hintHeight = "[aCreationDialog.hintHeight /]px", - resourceTypes = {[for (aResource: Resource | aCreationDialog.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[resourceTypeConstantName(aResource) /][/for]}, + resourceTypes = {[for (aResource: Resource | aCreationDialog.resourceTypes) separator(', ') ][javaInterfaceNameForConstants(aResource.definingDomainSpecification())/].[resourceTypeConstantName(aResource) /][/for]}, usages = {[for (usage: String | aCreationDialog.usages) separator(', ') ]"[usage/]"[/for]} ) @POST diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl index 38409dc..d9e8962 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl @@ -30,10 +30,12 @@ [import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderCatalogSingleton/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorServiceProviderFactory/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorManager/] +[import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorResourcesFactory/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorServletListener/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorApplication/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateClientOnlyMainApplication/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorPackageInfo/] +[import org::eclipse::lyo::oslc4j::codegenerator::files::generateDomainSpecificationConstants/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorConstants/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderService/] [import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderInfo/] @@ -69,6 +71,7 @@ [anAdaptorInterface.generateAdaptorApplication() /] [anAdaptorInterface.generateAdaptorServletListener() /] [anAdaptorInterface.generateAdaptorManager() /] +[anAdaptorInterface.generateAdaptorResourcesFactory() /] [anAdaptorInterface.serviceProviderCatalog.generateServiceProviderCatalogService() /] [anAdaptorInterface.serviceProviderCatalog.generateServiceProviderCatalogSingleton() /] [anAdaptorInterface.serviceProviderCatalog.generateServiceProviderCatalogHTML() /] @@ -81,6 +84,12 @@ [/if] [/template] +[template public generateForRelevantDomainSpecifications(anAdaptorInterface : AdaptorInterface)] +[for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface))] + [aDomainSpecification.generateDomainSpecificationConstants(anAdaptorInterface)/] +[/for] +[/template] + [template public generateForRelevantResources(anAdaptorInterface : AdaptorInterface)] [for (aResource: Resource | relevantResources(anAdaptorInterface))] [aResource.generateResource(anAdaptorInterface) /] @@ -156,6 +165,7 @@ [else] [generateClientOnlyMainApplication(anAdaptorInterface)/] [/if] +[generateForRelevantDomainSpecifications(anAdaptorInterface)/] [generateForRelevantResources(anAdaptorInterface)/] [generateForRequiredAdaptors(anAdaptorInterface)/] [/template] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl index 19cdfbc..deafb03 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl @@ -30,7 +30,11 @@ This method should be able to work even for objects that come from a differnet emf file than that containing the AdaptorInterface. You should also question any other use of "eContainer" in this whole project /] [query public containingAdaptorInterface(obj : OclAny) : AdaptorInterface = -obj.eContainer(AdaptorInterface).oclAsType(AdaptorInterface) +(if (not obj.eContainer(AdaptorInterface).oclIsUndefined()) then + obj.eContainer(AdaptorInterface).oclAsType(AdaptorInterface) +else + null +endif) /] [query public javaName(anAdaptorInterface : AdaptorInterface, toUpperFirst : Boolean) : String = @@ -163,6 +167,23 @@ javaClassPackageNameForAdaptorServletListener(anAdaptorInterface).concat('.').co javaFilesBasePath(anAdaptorInterface).concatenatePaths(javaClassPackageNameForAdaptorServletListener(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassNameForAdaptorServletListener(anAdaptorInterface)).concat('.java') /] +[comment Services for ResourcesFactory /] +[query public javaClassPackageNameForResourcesFactory(anAdaptorInterface : AdaptorInterface) : String = +javaClassBaseNamespace(anAdaptorInterface) +/] + +[query public javaClassNameForResourcesFactory(anAdaptorInterface : AdaptorInterface) : String = +javaName(anAdaptorInterface, true).concat('ResourcesFactory') +/] + +[query public javaClassFullNameForResourcesFactory(anAdaptorInterface : AdaptorInterface) : String = +javaClassPackageNameForResourcesFactory(anAdaptorInterface).concat('.').concat(javaClassNameForResourcesFactory(anAdaptorInterface)) +/] + +[query public javaClassFullFileNameForResourcesFactory(anAdaptorInterface : AdaptorInterface) : String = +javaFilesBasePath(anAdaptorInterface).concatenatePaths(javaClassPackageNameForResourcesFactory(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassNameForResourcesFactory(anAdaptorInterface)).concat('.java') +/] + [comment Services for AdaptorManager /] [query public javaClassPackageNameForAdaptorManager(anAdaptorInterface : AdaptorInterface) : String = javaClassBaseNamespace(anAdaptorInterface) diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/domainSpecificationServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/domainSpecificationServices.mtl index 4fad4dc..fa011cf 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/domainSpecificationServices.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/domainSpecificationServices.mtl @@ -20,6 +20,8 @@ [module domainSpecificationServices('http://org.eclipse.lyo/oslc4j/adaptorInterface')/] +[import org::eclipse::lyo::oslc4j::codegenerator::services::services/] + [query public definingDomainSpecification(aProperty: ResourceProperty) : DomainSpecification = aProperty.eContainer(DomainSpecification) /] @@ -28,3 +30,53 @@ aProperty.eContainer(DomainSpecification) aResource.eContainer(DomainSpecification) /] +[query public javaFullFilesPath(aSpecification: Specification, anAdaptorInterface : AdaptorInterface) : String = +(if (aSpecification.generationSetting.oclIsUndefined())._or(aSpecification.generationSetting.javaFilesPath.isNullOrEmpty()) then + javaFilesBasePath(anAdaptorInterface) +else + aSpecification.generationSetting.javaFilesPath +endif) +/] + +[query public javaPackageName(aSpecification: Specification, anAdaptorInterface : AdaptorInterface) : String = +(if (aSpecification.generationSetting.oclIsUndefined())._or(aSpecification.generationSetting.javaClassPackageName.isNullOrEmpty()) then + javaClassBaseNamespace(anAdaptorInterface).concat('.resources') +else + aSpecification.generationSetting.javaClassPackageName +endif) +/] + +[query public javaFullFilesPath(aDomainSpecification: DomainSpecification, anAdaptorInterface : AdaptorInterface) : String = +(if (aDomainSpecification.generationSetting.oclIsUndefined())._or(aDomainSpecification.generationSetting.javaFilesPath.isNullOrEmpty()) then + javaFullFilesPath(aDomainSpecification.eContainer(Specification), anAdaptorInterface) +else + aDomainSpecification.generationSetting.javaFilesPath +endif) +/] + +[query public javaPackageName(aDomainSpecification: DomainSpecification, anAdaptorInterface : AdaptorInterface) : String = +(if (aDomainSpecification.generationSetting.oclIsUndefined())._or(aDomainSpecification.generationSetting.javaClassPackageName.isNullOrEmpty()) then + javaPackageName(aDomainSpecification.eContainer(Specification), anAdaptorInterface) +else + aDomainSpecification.generationSetting.javaClassPackageName +endif) +/] + +[query public javaInterfacePackageNameForConstants(aDomainSpecification: DomainSpecification, anAdaptorInterface : AdaptorInterface) : String = +javaPackageName(aDomainSpecification, anAdaptorInterface) +/] + +[query public javaInterfaceNameForConstants(aDomainSpecification: DomainSpecification) : String = +javaString(aDomainSpecification.namespacePrefix.name, 'oslc', true).concat('Constants') +/] + +[query public javaInterfaceFullNameForConstants(aDomainSpecification: DomainSpecification, anAdaptorInterface : AdaptorInterface) : String = +javaInterfacePackageNameForConstants(aDomainSpecification, anAdaptorInterface).concat('.').concat(javaInterfaceNameForConstants(aDomainSpecification)) +/] + +[query public javaInterfaceFullFileNameForConstants(aDomainSpecification: DomainSpecification, anAdaptorInterface : AdaptorInterface) : String = + javaFullFilesPath(aDomainSpecification, anAdaptorInterface) + .concatenatePaths(javaInterfacePackageNameForConstants(aDomainSpecification, anAdaptorInterface).substituteAll('.', '/')) + .concatenatePaths(javaInterfaceNameForConstants(aDomainSpecification)) + .concat('.java') +/] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl index 03e66ea..6abc8df 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl @@ -41,7 +41,7 @@ not (Sequence{'URI'}->includes(aProperty.valueType.toString())) /] [query public propertyDefinitionAnnotation(aProperty: ResourceProperty, aResource: Resource, anAdaptorInterface: AdaptorInterface) : String = -'@OslcPropertyDefinition('.concat(javaInterfaceNameForAdaptorConstants(anAdaptorInterface)).concat('.').concat(domainSpecificationNamespaceConstantName(aProperty.definingDomainSpecification())) . concat(' + "').concat(javaName(aProperty, false)).concat('")') +'@OslcPropertyDefinition('.concat(javaInterfaceNameForConstants(aProperty.definingDomainSpecification())).concat('.').concat(domainSpecificationNamespaceConstantName(aProperty.definingDomainSpecification())) . concat(' + "').concat(javaName(aProperty, false)).concat('")') /] [query public descriptionAnnotation(aProperty: ResourceProperty) : String = @@ -108,7 +108,7 @@ endif) [query public rangeAnnotation(aProperty: ResourceProperty, aResource: Resource, anAdaptorInterface: AdaptorInterface) : String = (if (aProperty.range->size() > 0) then '@OslcRange({' - .concat(concatenate(aProperty.range->collect(aRange : Resource | javaInterfaceNameForAdaptorConstants(anAdaptorInterface).concat('.').concat(resourceTypeConstantName(aRange))), ', ')) + .concat(concatenate(aProperty.range->collect(aRange : Resource | javaInterfaceNameForConstants(aRange.definingDomainSpecification()).concat('.').concat(resourceTypeConstantName(aRange))), ', ')) .concat('})') else '' diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl index b5c69cf..30d6574 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl @@ -136,7 +136,7 @@ javaName(aResource, false) /] [query public javaClassPackageName(aResource: Resource, anAdaptorInterface : AdaptorInterface) : String = -javaClassBaseNamespace(anAdaptorInterface).concat('.resources') +javaPackageName(aResource.definingDomainSpecification(), anAdaptorInterface) /] [query public javaClassName(aResource: Resource) : String = @@ -147,12 +147,15 @@ javaName(aResource, true) javaClassPackageName(aResource, anAdaptorInterface).concat('.').concat(javaClassName(aResource)) /] -[query public javaClassFullFileName(aResource: Resource, anAdaptorInterface : AdaptorInterface) : String = -javaFilesBasePath(anAdaptorInterface).concatenatePaths(javaClassPackageName(aResource, anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassName(aResource)).concat('.java') +[query public javaClassFullFileName(aResource: Resource, anAdaptorInterface : AdaptorInterface) : String = + javaFullFilesPath(aResource.definingDomainSpecification(), anAdaptorInterface) + .concatenatePaths(javaClassPackageName(aResource, anAdaptorInterface).substituteAll('.', '/')) + .concatenatePaths(javaClassName(aResource)) + .concat('.java') /] [query public javaInterfacePackageName(aResource: Resource, anAdaptorInterface : AdaptorInterface) : String = -javaClassBaseNamespace(anAdaptorInterface).concat('.resources') +javaClassPackageName(aResource, anAdaptorInterface) /] [query public javaInterfaceName(aResource: Resource) : String = @@ -164,6 +167,9 @@ javaInterfacePackageName(aResource, anAdaptorInterface).concat('.').concat(javaI /] [query public javaInterfaceFullFileName(aResource: Resource, anAdaptorInterface : AdaptorInterface) : String = -javaFilesBasePath(anAdaptorInterface).concatenatePaths(javaInterfacePackageName(aResource, anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaInterfaceName(aResource)).concat('.java') + javaFullFilesPath(aResource.definingDomainSpecification(), anAdaptorInterface) + .concatenatePaths(javaInterfacePackageName(aResource, anAdaptorInterface).substituteAll('.', '/')) + .concatenatePaths(javaInterfaceName(aResource)) + .concat('.java') /] diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl index b698b54..57dcb2f 100644 --- a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl +++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl @@ -179,4 +179,7 @@ endif) concatenate(aStringSequence->sep(separatorString).oclAsType(String)) /] +[query public isNullOrEmpty (aString : String) : Boolean = +(aString.oclIsUndefined())._or(aString.trim().equalsIgnoreCase('')) +/] diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateDomainSpecification_generationSetting_GenerationSetting.gif b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateDomainSpecification_generationSetting_GenerationSetting.gif Binary files differnew file mode 100644 index 0000000..281b5cf --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateDomainSpecification_generationSetting_GenerationSetting.gif diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateDomainSpecification_implementation_Implementation.gif b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateDomainSpecification_implementation_Implementation.gif Binary files differnew file mode 100644 index 0000000..3d00c57 --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateDomainSpecification_implementation_Implementation.gif diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateSpecification_generationSetting_GenerationSetting.gif b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateSpecification_generationSetting_GenerationSetting.gif Binary files differnew file mode 100644 index 0000000..3494d53 --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateSpecification_generationSetting_GenerationSetting.gif diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateSpecification_implementation_Implementation.gif b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateSpecification_implementation_Implementation.gif Binary files differnew file mode 100644 index 0000000..13d1a04 --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/ctool16/CreateSpecification_implementation_Implementation.gif diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/obj16/GenerationSetting.gif b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/obj16/GenerationSetting.gif Binary files differnew file mode 100644 index 0000000..106881e --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.edit/icons/full/obj16/GenerationSetting.gif diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/plugin.properties b/org.eclipse.lyo.tools.adaptormodel.edit/plugin.properties index 115722c..7fd490d 100644 --- a/org.eclipse.lyo.tools.adaptormodel.edit/plugin.properties +++ b/org.eclipse.lyo.tools.adaptormodel.edit/plugin.properties @@ -144,3 +144,8 @@ _UI_Service_usages_feature = Usages _UI_CreationFactory_usages_feature = Usages _UI_QueryCapability_usages_feature = Usages _UI_Dialog_usages_feature = Usages +_UI_GenerationSetting_type = Generation Setting +_UI_DomainSpecification_generationSetting_feature = Generation Setting +_UI_GenerationSetting_javaClassPackageName_feature = Java Class Package Name +_UI_GenerationSetting_javaFilesPath_feature = Java Files Path +_UI_Specification_generationSetting_feature = Generation Setting diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/AdaptorinterfaceItemProviderAdapterFactory.java b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/AdaptorinterfaceItemProviderAdapterFactory.java index 4ba5258..52e2cef 100644 --- a/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/AdaptorinterfaceItemProviderAdapterFactory.java +++ b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/AdaptorinterfaceItemProviderAdapterFactory.java @@ -440,6 +440,29 @@ public class AdaptorinterfaceItemProviderAdapterFactory extends Adaptorinterface } /** + * This keeps track of the one adapter used for all {@link adaptorinterface.GenerationSetting} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected GenerationSettingItemProvider generationSettingItemProvider; + + /** + * This creates an adapter for a {@link adaptorinterface.GenerationSetting}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Adapter createGenerationSettingAdapter() { + if (generationSettingItemProvider == null) { + generationSettingItemProvider = new GenerationSettingItemProvider(this); + } + + return generationSettingItemProvider; + } + + /** * This returns the root adapter factory that contains this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -554,6 +577,7 @@ public class AdaptorinterfaceItemProviderAdapterFactory extends Adaptorinterface if (publisherItemProvider != null) publisherItemProvider.dispose(); if (genericRequiredAdaptorItemProvider != null) genericRequiredAdaptorItemProvider.dispose(); if (modelledRequiredAdaptorItemProvider != null) modelledRequiredAdaptorItemProvider.dispose(); + if (generationSettingItemProvider != null) generationSettingItemProvider.dispose(); } } diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/DomainSpecificationItemProvider.java b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/DomainSpecificationItemProvider.java index ab2c453..17b367e 100644 --- a/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/DomainSpecificationItemProvider.java +++ b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/DomainSpecificationItemProvider.java @@ -150,6 +150,7 @@ public class DomainSpecificationItemProvider super.getChildrenFeatures(object); childrenFeatures.add(AdaptorinterfacePackage.Literals.DOMAIN_SPECIFICATION__RESOURCES); childrenFeatures.add(AdaptorinterfacePackage.Literals.DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES); + childrenFeatures.add(AdaptorinterfacePackage.Literals.DOMAIN_SPECIFICATION__GENERATION_SETTING); } return childrenFeatures; } @@ -211,6 +212,7 @@ public class DomainSpecificationItemProvider return; case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__RESOURCES: case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES: + case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -237,6 +239,11 @@ public class DomainSpecificationItemProvider (createChildParameter (AdaptorinterfacePackage.Literals.DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES, AdaptorinterfaceFactory.eINSTANCE.createResourceProperty())); + + newChildDescriptors.add + (createChildParameter + (AdaptorinterfacePackage.Literals.DOMAIN_SPECIFICATION__GENERATION_SETTING, + AdaptorinterfaceFactory.eINSTANCE.createGenerationSetting())); } /** diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/GenerationSettingItemProvider.java b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/GenerationSettingItemProvider.java new file mode 100644 index 0000000..596c73a --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/GenerationSettingItemProvider.java @@ -0,0 +1,182 @@ +/** + */ +package adaptorinterface.provider; + + +import adaptorinterface.AdaptorinterfacePackage; +import adaptorinterface.GenerationSetting; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.ResourceLocator; + +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; + +/** + * This is the item provider adapter for a {@link adaptorinterface.GenerationSetting} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ +public class GenerationSettingItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public GenerationSettingItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addJavaClassPackageNamePropertyDescriptor(object); + addJavaFilesPathPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Java Class Package Name feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addJavaClassPackageNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_GenerationSetting_javaClassPackageName_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_GenerationSetting_javaClassPackageName_feature", "_UI_GenerationSetting_type"), + AdaptorinterfacePackage.Literals.GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Java Files Path feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addJavaFilesPathPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_GenerationSetting_javaFilesPath_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_GenerationSetting_javaFilesPath_feature", "_UI_GenerationSetting_type"), + AdaptorinterfacePackage.Literals.GENERATION_SETTING__JAVA_FILES_PATH, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns GenerationSetting.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/GenerationSetting")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String getText(Object object) { + String label = ((GenerationSetting)object).getJavaClassPackageName(); + return label == null || label.length() == 0 ? + getString("_UI_GenerationSetting_type") : + getString("_UI_GenerationSetting_type") + " " + label; + } + + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(GenerationSetting.class)) { + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME: + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_FILES_PATH: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return AdaptorInterfaceEditPlugin.INSTANCE; + } + +} diff --git a/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/SpecificationItemProvider.java b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/SpecificationItemProvider.java index 6978540..0d8a54c 100644 --- a/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/SpecificationItemProvider.java +++ b/org.eclipse.lyo.tools.adaptormodel.edit/src/adaptorinterface/provider/SpecificationItemProvider.java @@ -79,6 +79,7 @@ public class SpecificationItemProvider super.getChildrenFeatures(object); childrenFeatures.add(AdaptorinterfacePackage.Literals.SPECIFICATION__DOMAIN_SPECIFICATIONS); childrenFeatures.add(AdaptorinterfacePackage.Literals.SPECIFICATION__DOMAIN_PREFIXES); + childrenFeatures.add(AdaptorinterfacePackage.Literals.SPECIFICATION__GENERATION_SETTING); } return childrenFeatures; } @@ -133,6 +134,7 @@ public class SpecificationItemProvider switch (notification.getFeatureID(Specification.class)) { case AdaptorinterfacePackage.SPECIFICATION__DOMAIN_SPECIFICATIONS: case AdaptorinterfacePackage.SPECIFICATION__DOMAIN_PREFIXES: + case AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -159,6 +161,11 @@ public class SpecificationItemProvider (createChildParameter (AdaptorinterfacePackage.Literals.SPECIFICATION__DOMAIN_PREFIXES, AdaptorinterfaceFactory.eINSTANCE.createNamespacePrefix())); + + newChildDescriptors.add + (createChildParameter + (AdaptorinterfacePackage.Literals.SPECIFICATION__GENERATION_SETTING, + AdaptorinterfaceFactory.eINSTANCE.createGenerationSetting())); } /** diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfaceFactory.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfaceFactory.java index c13c6b5..bd72b34 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfaceFactory.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfaceFactory.java @@ -166,6 +166,15 @@ public interface AdaptorinterfaceFactory extends EFactory { ModelledRequiredAdaptor createModelledRequiredAdaptor(); /** + * Returns a new object of class '<em>Generation Setting</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Generation Setting</em>'. + * @generated + */ + GenerationSetting createGenerationSetting(); + + /** * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfacePackage.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfacePackage.java index c7fab7d..b283026 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfacePackage.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/AdaptorinterfacePackage.java @@ -267,13 +267,22 @@ public interface AdaptorinterfacePackage extends EPackage { int SPECIFICATION__DOMAIN_PREFIXES = 1; /** + * The feature id for the '<em><b>Generation Setting</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SPECIFICATION__GENERATION_SETTING = 2; + + /** * The number of structural features of the '<em>Specification</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int SPECIFICATION_FEATURE_COUNT = 2; + int SPECIFICATION_FEATURE_COUNT = 3; /** * The number of operations of the '<em>Specification</em>' class. @@ -340,13 +349,22 @@ public interface AdaptorinterfacePackage extends EPackage { int DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES = 4; /** + * The feature id for the '<em><b>Generation Setting</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DOMAIN_SPECIFICATION__GENERATION_SETTING = 5; + + /** * The number of structural features of the '<em>Domain Specification</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int DOMAIN_SPECIFICATION_FEATURE_COUNT = 5; + int DOMAIN_SPECIFICATION_FEATURE_COUNT = 6; /** * The number of operations of the '<em>Domain Specification</em>' class. @@ -1326,6 +1344,52 @@ public interface AdaptorinterfacePackage extends EPackage { int MODELLED_REQUIRED_ADAPTOR_OPERATION_COUNT = REQUIRED_ADAPTOR_OPERATION_COUNT + 0; /** + * The meta object id for the '{@link adaptorinterface.impl.GenerationSettingImpl <em>Generation Setting</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see adaptorinterface.impl.GenerationSettingImpl + * @see adaptorinterface.impl.AdaptorinterfacePackageImpl#getGenerationSetting() + * @generated + */ + int GENERATION_SETTING = 17; + + /** + * The feature id for the '<em><b>Java Class Package Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME = 0; + + /** + * The feature id for the '<em><b>Java Files Path</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GENERATION_SETTING__JAVA_FILES_PATH = 1; + + /** + * The number of structural features of the '<em>Generation Setting</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GENERATION_SETTING_FEATURE_COUNT = 2; + + /** + * The number of operations of the '<em>Generation Setting</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int GENERATION_SETTING_OPERATION_COUNT = 0; + + /** * The meta object id for the '{@link adaptorinterface.ResourcePropertyOccurs <em>Resource Property Occurs</em>}' enum. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1333,7 +1397,7 @@ public interface AdaptorinterfacePackage extends EPackage { * @see adaptorinterface.impl.AdaptorinterfacePackageImpl#getResourcePropertyOccurs() * @generated */ - int RESOURCE_PROPERTY_OCCURS = 17; + int RESOURCE_PROPERTY_OCCURS = 18; /** * The meta object id for the '{@link adaptorinterface.ResourcePropertyValueType <em>Resource Property Value Type</em>}' enum. @@ -1343,7 +1407,7 @@ public interface AdaptorinterfacePackage extends EPackage { * @see adaptorinterface.impl.AdaptorinterfacePackageImpl#getResourcePropertyValueType() * @generated */ - int RESOURCE_PROPERTY_VALUE_TYPE = 18; + int RESOURCE_PROPERTY_VALUE_TYPE = 19; /** * The meta object id for the '{@link adaptorinterface.ResourcePropertyRepresentation <em>Resource Property Representation</em>}' enum. @@ -1353,7 +1417,7 @@ public interface AdaptorinterfacePackage extends EPackage { * @see adaptorinterface.impl.AdaptorinterfacePackageImpl#getResourcePropertyRepresentation() * @generated */ - int RESOURCE_PROPERTY_REPRESENTATION = 19; + int RESOURCE_PROPERTY_REPRESENTATION = 20; /** * The meta object id for the '{@link adaptorinterface.ResourcePropertyIsMemberProperty <em>Resource Property Is Member Property</em>}' enum. @@ -1363,7 +1427,7 @@ public interface AdaptorinterfacePackage extends EPackage { * @see adaptorinterface.impl.AdaptorinterfacePackageImpl#getResourcePropertyIsMemberProperty() * @generated */ - int RESOURCE_PROPERTY_IS_MEMBER_PROPERTY = 20; + int RESOURCE_PROPERTY_IS_MEMBER_PROPERTY = 21; /** * The meta object id for the '{@link adaptorinterface.ResourceServiceNamespace <em>Resource Service Namespace</em>}' enum. @@ -1373,7 +1437,7 @@ public interface AdaptorinterfacePackage extends EPackage { * @see adaptorinterface.impl.AdaptorinterfacePackageImpl#getResourceServiceNamespace() * @generated */ - int RESOURCE_SERVICE_NAMESPACE = 21; + int RESOURCE_SERVICE_NAMESPACE = 22; /** @@ -1606,6 +1670,17 @@ public interface AdaptorinterfacePackage extends EPackage { EReference getSpecification_DomainPrefixes(); /** + * Returns the meta object for the containment reference '{@link adaptorinterface.Specification#getGenerationSetting <em>Generation Setting</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference '<em>Generation Setting</em>'. + * @see adaptorinterface.Specification#getGenerationSetting() + * @see #getSpecification() + * @generated + */ + EReference getSpecification_GenerationSetting(); + + /** * Returns the meta object for class '{@link adaptorinterface.DomainSpecification <em>Domain Specification</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1671,6 +1746,17 @@ public interface AdaptorinterfacePackage extends EPackage { EReference getDomainSpecification_ResourceProperties(); /** + * Returns the meta object for the containment reference '{@link adaptorinterface.DomainSpecification#getGenerationSetting <em>Generation Setting</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference '<em>Generation Setting</em>'. + * @see adaptorinterface.DomainSpecification#getGenerationSetting() + * @see #getDomainSpecification() + * @generated + */ + EReference getDomainSpecification_GenerationSetting(); + + /** * Returns the meta object for class '{@link adaptorinterface.NamespacePrefix <em>Namespace Prefix</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2493,6 +2579,38 @@ public interface AdaptorinterfacePackage extends EPackage { EReference getModelledRequiredAdaptor_AdaptorInterface(); /** + * Returns the meta object for class '{@link adaptorinterface.GenerationSetting <em>Generation Setting</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Generation Setting</em>'. + * @see adaptorinterface.GenerationSetting + * @generated + */ + EClass getGenerationSetting(); + + /** + * Returns the meta object for the attribute '{@link adaptorinterface.GenerationSetting#getJavaClassPackageName <em>Java Class Package Name</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Java Class Package Name</em>'. + * @see adaptorinterface.GenerationSetting#getJavaClassPackageName() + * @see #getGenerationSetting() + * @generated + */ + EAttribute getGenerationSetting_JavaClassPackageName(); + + /** + * Returns the meta object for the attribute '{@link adaptorinterface.GenerationSetting#getJavaFilesPath <em>Java Files Path</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Java Files Path</em>'. + * @see adaptorinterface.GenerationSetting#getJavaFilesPath() + * @see #getGenerationSetting() + * @generated + */ + EAttribute getGenerationSetting_JavaFilesPath(); + + /** * Returns the meta object for enum '{@link adaptorinterface.ResourcePropertyOccurs <em>Resource Property Occurs</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2738,6 +2856,14 @@ public interface AdaptorinterfacePackage extends EPackage { EReference SPECIFICATION__DOMAIN_PREFIXES = eINSTANCE.getSpecification_DomainPrefixes(); /** + * The meta object literal for the '<em><b>Generation Setting</b></em>' containment reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference SPECIFICATION__GENERATION_SETTING = eINSTANCE.getSpecification_GenerationSetting(); + + /** * The meta object literal for the '{@link adaptorinterface.impl.DomainSpecificationImpl <em>Domain Specification</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -2788,6 +2914,14 @@ public interface AdaptorinterfacePackage extends EPackage { EReference DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES = eINSTANCE.getDomainSpecification_ResourceProperties(); /** + * The meta object literal for the '<em><b>Generation Setting</b></em>' containment reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference DOMAIN_SPECIFICATION__GENERATION_SETTING = eINSTANCE.getDomainSpecification_GenerationSetting(); + + /** * The meta object literal for the '{@link adaptorinterface.impl.NamespacePrefixImpl <em>Namespace Prefix</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -3424,6 +3558,32 @@ public interface AdaptorinterfacePackage extends EPackage { EReference MODELLED_REQUIRED_ADAPTOR__ADAPTOR_INTERFACE = eINSTANCE.getModelledRequiredAdaptor_AdaptorInterface(); /** + * The meta object literal for the '{@link adaptorinterface.impl.GenerationSettingImpl <em>Generation Setting</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see adaptorinterface.impl.GenerationSettingImpl + * @see adaptorinterface.impl.AdaptorinterfacePackageImpl#getGenerationSetting() + * @generated + */ + EClass GENERATION_SETTING = eINSTANCE.getGenerationSetting(); + + /** + * The meta object literal for the '<em><b>Java Class Package Name</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME = eINSTANCE.getGenerationSetting_JavaClassPackageName(); + + /** + * The meta object literal for the '<em><b>Java Files Path</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute GENERATION_SETTING__JAVA_FILES_PATH = eINSTANCE.getGenerationSetting_JavaFilesPath(); + + /** * The meta object literal for the '{@link adaptorinterface.ResourcePropertyOccurs <em>Resource Property Occurs</em>}' enum. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/DomainSpecification.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/DomainSpecification.java index 5360b22..cec3677 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/DomainSpecification.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/DomainSpecification.java @@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EObject; * <li>{@link adaptorinterface.DomainSpecification#getNamespacePrefix <em>Namespace Prefix</em>}</li> * <li>{@link adaptorinterface.DomainSpecification#getResources <em>Resources</em>}</li> * <li>{@link adaptorinterface.DomainSpecification#getResourceProperties <em>Resource Properties</em>}</li> + * <li>{@link adaptorinterface.DomainSpecification#getGenerationSetting <em>Generation Setting</em>}</li> * </ul> * * @see adaptorinterface.AdaptorinterfacePackage#getDomainSpecification() @@ -137,4 +138,30 @@ public interface DomainSpecification extends EObject { */ EList<ResourceProperty> getResourceProperties(); + /** + * Returns the value of the '<em><b>Generation Setting</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Generation Setting</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Generation Setting</em>' containment reference. + * @see #setGenerationSetting(GenerationSetting) + * @see adaptorinterface.AdaptorinterfacePackage#getDomainSpecification_GenerationSetting() + * @model containment="true" + * @generated + */ + GenerationSetting getGenerationSetting(); + + /** + * Sets the value of the '{@link adaptorinterface.DomainSpecification#getGenerationSetting <em>Generation Setting</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Generation Setting</em>' containment reference. + * @see #getGenerationSetting() + * @generated + */ + void setGenerationSetting(GenerationSetting value); + } // DomainSpecification diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/GenerationSetting.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/GenerationSetting.java new file mode 100644 index 0000000..69d07ff --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/GenerationSetting.java @@ -0,0 +1,77 @@ +/** + */ +package adaptorinterface; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Generation Setting</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * </p> + * <ul> + * <li>{@link adaptorinterface.GenerationSetting#getJavaClassPackageName <em>Java Class Package Name</em>}</li> + * <li>{@link adaptorinterface.GenerationSetting#getJavaFilesPath <em>Java Files Path</em>}</li> + * </ul> + * + * @see adaptorinterface.AdaptorinterfacePackage#getGenerationSetting() + * @model + * @generated + */ +public interface GenerationSetting extends EObject { + /** + * Returns the value of the '<em><b>Java Class Package Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Java Class Package Name</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Java Class Package Name</em>' attribute. + * @see #setJavaClassPackageName(String) + * @see adaptorinterface.AdaptorinterfacePackage#getGenerationSetting_JavaClassPackageName() + * @model + * @generated + */ + String getJavaClassPackageName(); + + /** + * Sets the value of the '{@link adaptorinterface.GenerationSetting#getJavaClassPackageName <em>Java Class Package Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Java Class Package Name</em>' attribute. + * @see #getJavaClassPackageName() + * @generated + */ + void setJavaClassPackageName(String value); + + /** + * Returns the value of the '<em><b>Java Files Path</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Java Files Path</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Java Files Path</em>' attribute. + * @see #setJavaFilesPath(String) + * @see adaptorinterface.AdaptorinterfacePackage#getGenerationSetting_JavaFilesPath() + * @model + * @generated + */ + String getJavaFilesPath(); + + /** + * Sets the value of the '{@link adaptorinterface.GenerationSetting#getJavaFilesPath <em>Java Files Path</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Java Files Path</em>' attribute. + * @see #getJavaFilesPath() + * @generated + */ + void setJavaFilesPath(String value); + +} // GenerationSetting diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/Specification.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/Specification.java index 715eb98..1ed3a62 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/Specification.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/Specification.java @@ -17,6 +17,7 @@ import org.eclipse.emf.ecore.EObject; * <ul> * <li>{@link adaptorinterface.Specification#getDomainSpecifications <em>Domain Specifications</em>}</li> * <li>{@link adaptorinterface.Specification#getDomainPrefixes <em>Domain Prefixes</em>}</li> + * <li>{@link adaptorinterface.Specification#getGenerationSetting <em>Generation Setting</em>}</li> * </ul> * * @see adaptorinterface.AdaptorinterfacePackage#getSpecification() @@ -56,4 +57,30 @@ public interface Specification extends EObject { */ EList<NamespacePrefix> getDomainPrefixes(); + /** + * Returns the value of the '<em><b>Generation Setting</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Generation Setting</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Generation Setting</em>' containment reference. + * @see #setGenerationSetting(GenerationSetting) + * @see adaptorinterface.AdaptorinterfacePackage#getSpecification_GenerationSetting() + * @model containment="true" + * @generated + */ + GenerationSetting getGenerationSetting(); + + /** + * Sets the value of the '{@link adaptorinterface.Specification#getGenerationSetting <em>Generation Setting</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Generation Setting</em>' containment reference. + * @see #getGenerationSetting() + * @generated + */ + void setGenerationSetting(GenerationSetting value); + } // Specification diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfaceFactoryImpl.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfaceFactoryImpl.java index 395d39d..a700605 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfaceFactoryImpl.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfaceFactoryImpl.java @@ -73,6 +73,7 @@ public class AdaptorinterfaceFactoryImpl extends EFactoryImpl implements Adaptor case AdaptorinterfacePackage.PUBLISHER: return createPublisher(); case AdaptorinterfacePackage.GENERIC_REQUIRED_ADAPTOR: return createGenericRequiredAdaptor(); case AdaptorinterfacePackage.MODELLED_REQUIRED_ADAPTOR: return createModelledRequiredAdaptor(); + case AdaptorinterfacePackage.GENERATION_SETTING: return createGenerationSetting(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -289,6 +290,16 @@ public class AdaptorinterfaceFactoryImpl extends EFactoryImpl implements Adaptor * <!-- end-user-doc --> * @generated */ + public GenerationSetting createGenerationSetting() { + GenerationSettingImpl generationSetting = new GenerationSettingImpl(); + return generationSetting; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public ResourcePropertyOccurs createResourcePropertyOccursFromString(EDataType eDataType, String initialValue) { ResourcePropertyOccurs result = ResourcePropertyOccurs.get(initialValue); if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfacePackageImpl.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfacePackageImpl.java index 0b67872..2c37bb3 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfacePackageImpl.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/AdaptorinterfacePackageImpl.java @@ -9,6 +9,7 @@ import adaptorinterface.BasicCapability; import adaptorinterface.CreationFactory; import adaptorinterface.Dialog; import adaptorinterface.DomainSpecification; +import adaptorinterface.GenerationSetting; import adaptorinterface.GenericRequiredAdaptor; import adaptorinterface.ModelledRequiredAdaptor; import adaptorinterface.NamespacePrefix; @@ -166,6 +167,13 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor * <!-- end-user-doc --> * @generated */ + private EClass generationSettingEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ private EEnum resourcePropertyOccursEEnum = null; /** @@ -451,6 +459,15 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor * <!-- end-user-doc --> * @generated */ + public EReference getSpecification_GenerationSetting() { + return (EReference)specificationEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getDomainSpecification() { return domainSpecificationEClass; } @@ -505,6 +522,15 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor * <!-- end-user-doc --> * @generated */ + public EReference getDomainSpecification_GenerationSetting() { + return (EReference)domainSpecificationEClass.getEStructuralFeatures().get(5); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getNamespacePrefix() { return namespacePrefixEClass; } @@ -1189,6 +1215,33 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor * <!-- end-user-doc --> * @generated */ + public EClass getGenerationSetting() { + return generationSettingEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getGenerationSetting_JavaClassPackageName() { + return (EAttribute)generationSettingEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getGenerationSetting_JavaFilesPath() { + return (EAttribute)generationSettingEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EEnum getResourcePropertyOccurs() { return resourcePropertyOccursEEnum; } @@ -1279,6 +1332,7 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor specificationEClass = createEClass(SPECIFICATION); createEReference(specificationEClass, SPECIFICATION__DOMAIN_SPECIFICATIONS); createEReference(specificationEClass, SPECIFICATION__DOMAIN_PREFIXES); + createEReference(specificationEClass, SPECIFICATION__GENERATION_SETTING); domainSpecificationEClass = createEClass(DOMAIN_SPECIFICATION); createEAttribute(domainSpecificationEClass, DOMAIN_SPECIFICATION__NAME); @@ -1286,6 +1340,7 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor createEReference(domainSpecificationEClass, DOMAIN_SPECIFICATION__NAMESPACE_PREFIX); createEReference(domainSpecificationEClass, DOMAIN_SPECIFICATION__RESOURCES); createEReference(domainSpecificationEClass, DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES); + createEReference(domainSpecificationEClass, DOMAIN_SPECIFICATION__GENERATION_SETTING); namespacePrefixEClass = createEClass(NAMESPACE_PREFIX); createEAttribute(namespacePrefixEClass, NAMESPACE_PREFIX__NAME); @@ -1377,6 +1432,10 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor modelledRequiredAdaptorEClass = createEClass(MODELLED_REQUIRED_ADAPTOR); createEReference(modelledRequiredAdaptorEClass, MODELLED_REQUIRED_ADAPTOR__ADAPTOR_INTERFACE); + generationSettingEClass = createEClass(GENERATION_SETTING); + createEAttribute(generationSettingEClass, GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME); + createEAttribute(generationSettingEClass, GENERATION_SETTING__JAVA_FILES_PATH); + // Create enums resourcePropertyOccursEEnum = createEEnum(RESOURCE_PROPERTY_OCCURS); resourcePropertyValueTypeEEnum = createEEnum(RESOURCE_PROPERTY_VALUE_TYPE); @@ -1439,6 +1498,7 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor initEClass(specificationEClass, Specification.class, "Specification", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getSpecification_DomainSpecifications(), this.getDomainSpecification(), null, "domainSpecifications", null, 0, -1, Specification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getSpecification_DomainPrefixes(), this.getNamespacePrefix(), null, "domainPrefixes", null, 0, -1, Specification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSpecification_GenerationSetting(), this.getGenerationSetting(), null, "generationSetting", null, 0, 1, Specification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(domainSpecificationEClass, DomainSpecification.class, "DomainSpecification", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getDomainSpecification_Name(), ecorePackage.getEString(), "name", null, 1, 1, DomainSpecification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -1446,6 +1506,7 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor initEReference(getDomainSpecification_NamespacePrefix(), this.getNamespacePrefix(), null, "namespacePrefix", null, 1, 1, DomainSpecification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDomainSpecification_Resources(), this.getResource(), null, "resources", null, 0, -1, DomainSpecification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDomainSpecification_ResourceProperties(), this.getResourceProperty(), null, "resourceProperties", null, 0, -1, DomainSpecification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDomainSpecification_GenerationSetting(), this.getGenerationSetting(), null, "generationSetting", null, 0, 1, DomainSpecification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(namespacePrefixEClass, NamespacePrefix.class, "NamespacePrefix", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getNamespacePrefix_Name(), ecorePackage.getEString(), "name", null, 1, 1, NamespacePrefix.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -1537,6 +1598,10 @@ public class AdaptorinterfacePackageImpl extends EPackageImpl implements Adaptor initEClass(modelledRequiredAdaptorEClass, ModelledRequiredAdaptor.class, "ModelledRequiredAdaptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getModelledRequiredAdaptor_AdaptorInterface(), this.getAdaptorInterface(), null, "adaptorInterface", null, 1, 1, ModelledRequiredAdaptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(generationSettingEClass, GenerationSetting.class, "GenerationSetting", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getGenerationSetting_JavaClassPackageName(), ecorePackage.getEString(), "javaClassPackageName", null, 0, 1, GenerationSetting.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getGenerationSetting_JavaFilesPath(), ecorePackage.getEString(), "javaFilesPath", null, 0, 1, GenerationSetting.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Initialize enums and add enum literals initEEnum(resourcePropertyOccursEEnum, ResourcePropertyOccurs.class, "ResourcePropertyOccurs"); addEEnumLiteral(resourcePropertyOccursEEnum, ResourcePropertyOccurs.EXACTLY_ONE); diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/DomainSpecificationImpl.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/DomainSpecificationImpl.java index f2b82fa..30107ec 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/DomainSpecificationImpl.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/DomainSpecificationImpl.java @@ -4,6 +4,7 @@ package adaptorinterface.impl; import adaptorinterface.AdaptorinterfacePackage; import adaptorinterface.DomainSpecification; +import adaptorinterface.GenerationSetting; import adaptorinterface.NamespacePrefix; import adaptorinterface.Resource; import adaptorinterface.ResourceProperty; @@ -37,6 +38,7 @@ import org.eclipse.emf.ecore.util.InternalEList; * <li>{@link adaptorinterface.impl.DomainSpecificationImpl#getNamespacePrefix <em>Namespace Prefix</em>}</li> * <li>{@link adaptorinterface.impl.DomainSpecificationImpl#getResources <em>Resources</em>}</li> * <li>{@link adaptorinterface.impl.DomainSpecificationImpl#getResourceProperties <em>Resource Properties</em>}</li> + * <li>{@link adaptorinterface.impl.DomainSpecificationImpl#getGenerationSetting <em>Generation Setting</em>}</li> * </ul> * * @generated @@ -113,6 +115,16 @@ public class DomainSpecificationImpl extends MinimalEObjectImpl.Container implem protected EList<ResourceProperty> resourceProperties; /** + * The cached value of the '{@link #getGenerationSetting() <em>Generation Setting</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getGenerationSetting() + * @generated + * @ordered + */ + protected GenerationSetting generationSetting; + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -240,6 +252,49 @@ public class DomainSpecificationImpl extends MinimalEObjectImpl.Container implem * <!-- end-user-doc --> * @generated */ + public GenerationSetting getGenerationSetting() { + return generationSetting; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetGenerationSetting(GenerationSetting newGenerationSetting, NotificationChain msgs) { + GenerationSetting oldGenerationSetting = generationSetting; + generationSetting = newGenerationSetting; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING, oldGenerationSetting, newGenerationSetting); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setGenerationSetting(GenerationSetting newGenerationSetting) { + if (newGenerationSetting != generationSetting) { + NotificationChain msgs = null; + if (generationSetting != null) + msgs = ((InternalEObject)generationSetting).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING, null, msgs); + if (newGenerationSetting != null) + msgs = ((InternalEObject)newGenerationSetting).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING, null, msgs); + msgs = basicSetGenerationSetting(newGenerationSetting, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING, newGenerationSetting, newGenerationSetting)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { @@ -247,6 +302,8 @@ public class DomainSpecificationImpl extends MinimalEObjectImpl.Container implem return ((InternalEList<?>)getResources()).basicRemove(otherEnd, msgs); case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES: return ((InternalEList<?>)getResourceProperties()).basicRemove(otherEnd, msgs); + case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING: + return basicSetGenerationSetting(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -270,6 +327,8 @@ public class DomainSpecificationImpl extends MinimalEObjectImpl.Container implem return getResources(); case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES: return getResourceProperties(); + case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING: + return getGenerationSetting(); } return super.eGet(featureID, resolve, coreType); } @@ -300,6 +359,9 @@ public class DomainSpecificationImpl extends MinimalEObjectImpl.Container implem getResourceProperties().clear(); getResourceProperties().addAll((Collection<? extends ResourceProperty>)newValue); return; + case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING: + setGenerationSetting((GenerationSetting)newValue); + return; } super.eSet(featureID, newValue); } @@ -327,6 +389,9 @@ public class DomainSpecificationImpl extends MinimalEObjectImpl.Container implem case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES: getResourceProperties().clear(); return; + case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING: + setGenerationSetting((GenerationSetting)null); + return; } super.eUnset(featureID); } @@ -349,6 +414,8 @@ public class DomainSpecificationImpl extends MinimalEObjectImpl.Container implem return resources != null && !resources.isEmpty(); case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__RESOURCE_PROPERTIES: return resourceProperties != null && !resourceProperties.isEmpty(); + case AdaptorinterfacePackage.DOMAIN_SPECIFICATION__GENERATION_SETTING: + return generationSetting != null; } return super.eIsSet(featureID); } diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/GenerationSettingImpl.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/GenerationSettingImpl.java new file mode 100644 index 0000000..6d750d9 --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/GenerationSettingImpl.java @@ -0,0 +1,217 @@ +/** + */ +package adaptorinterface.impl; + +import adaptorinterface.AdaptorinterfacePackage; +import adaptorinterface.GenerationSetting; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Generation Setting</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link adaptorinterface.impl.GenerationSettingImpl#getJavaClassPackageName <em>Java Class Package Name</em>}</li> + * <li>{@link adaptorinterface.impl.GenerationSettingImpl#getJavaFilesPath <em>Java Files Path</em>}</li> + * </ul> + * + * @generated + */ +public class GenerationSettingImpl extends MinimalEObjectImpl.Container implements GenerationSetting { + /** + * The default value of the '{@link #getJavaClassPackageName() <em>Java Class Package Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getJavaClassPackageName() + * @generated + * @ordered + */ + protected static final String JAVA_CLASS_PACKAGE_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getJavaClassPackageName() <em>Java Class Package Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getJavaClassPackageName() + * @generated + * @ordered + */ + protected String javaClassPackageName = JAVA_CLASS_PACKAGE_NAME_EDEFAULT; + + /** + * The default value of the '{@link #getJavaFilesPath() <em>Java Files Path</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getJavaFilesPath() + * @generated + * @ordered + */ + protected static final String JAVA_FILES_PATH_EDEFAULT = null; + + /** + * The cached value of the '{@link #getJavaFilesPath() <em>Java Files Path</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getJavaFilesPath() + * @generated + * @ordered + */ + protected String javaFilesPath = JAVA_FILES_PATH_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected GenerationSettingImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return AdaptorinterfacePackage.Literals.GENERATION_SETTING; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getJavaClassPackageName() { + return javaClassPackageName; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setJavaClassPackageName(String newJavaClassPackageName) { + String oldJavaClassPackageName = javaClassPackageName; + javaClassPackageName = newJavaClassPackageName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, AdaptorinterfacePackage.GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME, oldJavaClassPackageName, javaClassPackageName)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getJavaFilesPath() { + return javaFilesPath; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setJavaFilesPath(String newJavaFilesPath) { + String oldJavaFilesPath = javaFilesPath; + javaFilesPath = newJavaFilesPath; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, AdaptorinterfacePackage.GENERATION_SETTING__JAVA_FILES_PATH, oldJavaFilesPath, javaFilesPath)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME: + return getJavaClassPackageName(); + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_FILES_PATH: + return getJavaFilesPath(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME: + setJavaClassPackageName((String)newValue); + return; + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_FILES_PATH: + setJavaFilesPath((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME: + setJavaClassPackageName(JAVA_CLASS_PACKAGE_NAME_EDEFAULT); + return; + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_FILES_PATH: + setJavaFilesPath(JAVA_FILES_PATH_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_CLASS_PACKAGE_NAME: + return JAVA_CLASS_PACKAGE_NAME_EDEFAULT == null ? javaClassPackageName != null : !JAVA_CLASS_PACKAGE_NAME_EDEFAULT.equals(javaClassPackageName); + case AdaptorinterfacePackage.GENERATION_SETTING__JAVA_FILES_PATH: + return JAVA_FILES_PATH_EDEFAULT == null ? javaFilesPath != null : !JAVA_FILES_PATH_EDEFAULT.equals(javaFilesPath); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (javaClassPackageName: "); + result.append(javaClassPackageName); + result.append(", javaFilesPath: "); + result.append(javaFilesPath); + result.append(')'); + return result.toString(); + } + +} //GenerationSettingImpl diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/SpecificationImpl.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/SpecificationImpl.java index ab11838..742e5d6 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/SpecificationImpl.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/impl/SpecificationImpl.java @@ -4,11 +4,13 @@ package adaptorinterface.impl; import adaptorinterface.AdaptorinterfacePackage; import adaptorinterface.DomainSpecification; +import adaptorinterface.GenerationSetting; import adaptorinterface.NamespacePrefix; import adaptorinterface.Specification; import java.util.Collection; +import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; @@ -16,6 +18,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; @@ -31,6 +34,7 @@ import org.eclipse.emf.ecore.util.InternalEList; * <ul> * <li>{@link adaptorinterface.impl.SpecificationImpl#getDomainSpecifications <em>Domain Specifications</em>}</li> * <li>{@link adaptorinterface.impl.SpecificationImpl#getDomainPrefixes <em>Domain Prefixes</em>}</li> + * <li>{@link adaptorinterface.impl.SpecificationImpl#getGenerationSetting <em>Generation Setting</em>}</li> * </ul> * * @generated @@ -57,6 +61,16 @@ public class SpecificationImpl extends MinimalEObjectImpl.Container implements S protected EList<NamespacePrefix> domainPrefixes; /** + * The cached value of the '{@link #getGenerationSetting() <em>Generation Setting</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getGenerationSetting() + * @generated + * @ordered + */ + protected GenerationSetting generationSetting; + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -104,6 +118,49 @@ public class SpecificationImpl extends MinimalEObjectImpl.Container implements S * <!-- end-user-doc --> * @generated */ + public GenerationSetting getGenerationSetting() { + return generationSetting; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetGenerationSetting(GenerationSetting newGenerationSetting, NotificationChain msgs) { + GenerationSetting oldGenerationSetting = generationSetting; + generationSetting = newGenerationSetting; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING, oldGenerationSetting, newGenerationSetting); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setGenerationSetting(GenerationSetting newGenerationSetting) { + if (newGenerationSetting != generationSetting) { + NotificationChain msgs = null; + if (generationSetting != null) + msgs = ((InternalEObject)generationSetting).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING, null, msgs); + if (newGenerationSetting != null) + msgs = ((InternalEObject)newGenerationSetting).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING, null, msgs); + msgs = basicSetGenerationSetting(newGenerationSetting, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING, newGenerationSetting, newGenerationSetting)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { @@ -111,6 +168,8 @@ public class SpecificationImpl extends MinimalEObjectImpl.Container implements S return ((InternalEList<?>)getDomainSpecifications()).basicRemove(otherEnd, msgs); case AdaptorinterfacePackage.SPECIFICATION__DOMAIN_PREFIXES: return ((InternalEList<?>)getDomainPrefixes()).basicRemove(otherEnd, msgs); + case AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING: + return basicSetGenerationSetting(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -127,6 +186,8 @@ public class SpecificationImpl extends MinimalEObjectImpl.Container implements S return getDomainSpecifications(); case AdaptorinterfacePackage.SPECIFICATION__DOMAIN_PREFIXES: return getDomainPrefixes(); + case AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING: + return getGenerationSetting(); } return super.eGet(featureID, resolve, coreType); } @@ -148,6 +209,9 @@ public class SpecificationImpl extends MinimalEObjectImpl.Container implements S getDomainPrefixes().clear(); getDomainPrefixes().addAll((Collection<? extends NamespacePrefix>)newValue); return; + case AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING: + setGenerationSetting((GenerationSetting)newValue); + return; } super.eSet(featureID, newValue); } @@ -166,6 +230,9 @@ public class SpecificationImpl extends MinimalEObjectImpl.Container implements S case AdaptorinterfacePackage.SPECIFICATION__DOMAIN_PREFIXES: getDomainPrefixes().clear(); return; + case AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING: + setGenerationSetting((GenerationSetting)null); + return; } super.eUnset(featureID); } @@ -182,6 +249,8 @@ public class SpecificationImpl extends MinimalEObjectImpl.Container implements S return domainSpecifications != null && !domainSpecifications.isEmpty(); case AdaptorinterfacePackage.SPECIFICATION__DOMAIN_PREFIXES: return domainPrefixes != null && !domainPrefixes.isEmpty(); + case AdaptorinterfacePackage.SPECIFICATION__GENERATION_SETTING: + return generationSetting != null; } return super.eIsSet(featureID); } diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceAdapterFactory.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceAdapterFactory.java index 0192d1d..461b6b3 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceAdapterFactory.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceAdapterFactory.java @@ -136,6 +136,10 @@ public class AdaptorinterfaceAdapterFactory extends AdapterFactoryImpl { return createModelledRequiredAdaptorAdapter(); } @Override + public Adapter caseGenerationSetting(GenerationSetting object) { + return createGenerationSettingAdapter(); + } + @Override public Adapter defaultCase(EObject object) { return createEObjectAdapter(); } @@ -394,6 +398,20 @@ public class AdaptorinterfaceAdapterFactory extends AdapterFactoryImpl { } /** + * Creates a new adapter for an object of class '{@link adaptorinterface.GenerationSetting <em>Generation Setting</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see adaptorinterface.GenerationSetting + * @generated + */ + public Adapter createGenerationSettingAdapter() { + return null; + } + + /** * Creates a new adapter for the default case. * <!-- begin-user-doc --> * This default implementation returns null. diff --git a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceSwitch.java b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceSwitch.java index 3e3c8f9..2ec6d08 100644 --- a/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceSwitch.java +++ b/org.eclipse.lyo.tools.adaptormodel.model/src/adaptorinterface/util/AdaptorinterfaceSwitch.java @@ -170,6 +170,12 @@ public class AdaptorinterfaceSwitch<T> extends Switch<T> { if (result == null) result = defaultCase(theEObject); return result; } + case AdaptorinterfacePackage.GENERATION_SETTING: { + GenerationSetting generationSetting = (GenerationSetting)theEObject; + T result = caseGenerationSetting(generationSetting); + if (result == null) result = defaultCase(theEObject); + return result; + } default: return defaultCase(theEObject); } } @@ -430,6 +436,21 @@ public class AdaptorinterfaceSwitch<T> extends Switch<T> { } /** + * Returns the result of interpreting the object as an instance of '<em>Generation Setting</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Generation Setting</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseGenerationSetting(GenerationSetting object) { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. * <!-- begin-user-doc --> * This implementation returns null; diff --git a/org.eclipse.lyo.tools.adaptormodel.tests/src/adaptorinterface/tests/GenerationSettingTest.java b/org.eclipse.lyo.tools.adaptormodel.tests/src/adaptorinterface/tests/GenerationSettingTest.java new file mode 100644 index 0000000..b756d47 --- /dev/null +++ b/org.eclipse.lyo.tools.adaptormodel.tests/src/adaptorinterface/tests/GenerationSettingTest.java @@ -0,0 +1,89 @@ +/** + */ +package adaptorinterface.tests; + +import adaptorinterface.AdaptorinterfaceFactory; +import adaptorinterface.GenerationSetting; + +import junit.framework.TestCase; + +import junit.textui.TestRunner; + +/** + * <!-- begin-user-doc --> + * A test case for the model object '<em><b>Generation Setting</b></em>'. + * <!-- end-user-doc --> + * @generated + */ +public class GenerationSettingTest extends TestCase { + + /** + * The fixture for this Generation Setting test case. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected GenerationSetting fixture = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static void main(String[] args) { + TestRunner.run(GenerationSettingTest.class); + } + + /** + * Constructs a new Generation Setting test case with the given name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public GenerationSettingTest(String name) { + super(name); + } + + /** + * Sets the fixture for this Generation Setting test case. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void setFixture(GenerationSetting fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this Generation Setting test case. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected GenerationSetting getFixture() { + return fixture; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see junit.framework.TestCase#setUp() + * @generated + */ + @Override + protected void setUp() throws Exception { + setFixture(AdaptorinterfaceFactory.eINSTANCE.createGenerationSetting()); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() throws Exception { + setFixture(null); + } + +} //GenerationSettingTest diff --git a/org.eclipse.lyo.tools.toolchain.design/description/ToolChainModel.odesign b/org.eclipse.lyo.tools.toolchain.design/description/ToolChainModel.odesign index e69b05c..3db16c4 100644 --- a/org.eclipse.lyo.tools.toolchain.design/description/ToolChainModel.odesign +++ b/org.eclipse.lyo.tools.toolchain.design/description/ToolChainModel.odesign @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/description/tool/1.1.0" name="ToolchainModel" version="11.1.1.201610211630"> <ownedViewpoints name="ToolchainViewpoint"> - <ownedRepresentations xsi:type="description_1:DiagramDescription" dropDescriptions="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DropDomainSpecification']" name="SpecificationDiagram" initialisation="true" domainClass="adaptorinterface.Specification" rootExpression="[if (self.eClass().name = 'Toolchain') then self.eGet('specification').oclAsType(Specification) else self endif/]"> + <ownedRepresentations xsi:type="description_1:DiagramDescription" dropDescriptions="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DropDomainSpecification']" name="SpecificationDiagram" initialisation="true" domainClass="adaptorinterface.Specification" rootExpression="[if (self.eClass().name = 'Toolchain') then self.eGet('specification').oclAsType(Specification) else self endif/]" enablePopupBars="true"> <diagramInitialisation/> <defaultLayer name="Default"> <edgeMappings name="Specification.ResourceToReferenceProperty" deletionDescription="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DeleteResourceToReferenceProperty']" semanticElements="[self.resourceProperties->select(p : ResourceProperty | Sequence{ResourcePropertyValueType::Resource}->includes(p.valueType))->select(p : ResourceProperty | p.range->includes(view.targetNode.oclAsType(DNodeList).target.oclAsType(Resource)))/]" sourceMapping="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@containerMappings[name='Specification.DomainSpecification']/@subContainerMappings[name='Specification.DomainSpecification.Resource']" targetMapping="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@containerMappings[name='Specification.DomainSpecification']/@subContainerMappings[name='Specification.DomainSpecification.Resource']" targetFinderExpression="[self.resourceProperties->select(p : ResourceProperty | Sequence{ResourcePropertyValueType::Resource}->includes(p.valueType)).range /]"> @@ -34,7 +34,7 @@ </centerLabelStyleDescription> </style> </edgeMappings> - <containerMappings name="Specification.DomainSpecification" deletionDescription="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DeleteDomainSpecification']" labelDirectEdit="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DirectEditName']" createElements="false" domainClass="adaptorinterface.DomainSpecification" dropDescriptions="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.MoveResource'] //@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.MoveProperty']"> + <containerMappings name="Specification.DomainSpecification" deletionDescription="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DeleteDomainSpecification']" labelDirectEdit="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DirectEditName']" createElements="false" semanticElements="[Set{self, self.generationSetting}/]" domainClass="adaptorinterface.DomainSpecification" dropDescriptions="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.MoveResource'] //@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.MoveProperty']"> <subContainerMappings name="Specification.DomainSpecification.Resource" deletionDescription="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DeleteResource']" semanticCandidatesExpression="feature:eAllContents" domainClass="adaptorinterface.Resource" dropDescriptions="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.RelatePropertyToResource']" childrenPresentation="List"> <subNodeMappings name="Specification.DomainSpecification.Resource.LiteralProperty" deletionDescription="//@ownedViewpoints[name='ToolchainViewpoint']/@ownedRepresentations[name='SpecificationDiagram']/@defaultLayer/@toolSections.0/@ownedTools[name='Specification.DeleteResourceLiteralPropertySubnode']" semanticCandidatesExpression="[self.resourceProperties->select(p : ResourceProperty | (not Sequence{ResourcePropertyValueType::Resource, ResourcePropertyValueType::LocalResource}->includes(p.valueType))._or((Sequence{ResourcePropertyValueType::Resource, ResourcePropertyValueType::LocalResource}->includes(p.valueType))._and(p.range->size() = 0)))/]" domainClass="adaptorinterface.ResourceProperty"> <style xsi:type="style:SquareDescription" labelSize="9" showIcon="false" labelExpression="[(if (self.eContainer(DomainSpecification) = view.eContainer().oclAsType(DNodeList).target.oclAsType(Resource).eContainer(DomainSpecification)) then '' else self.eContainer(DomainSpecification).namespacePrefix.name + ':' endif) + name + ': ' + valueType + (if (Sequence{ResourcePropertyOccurs::oneOrMany, ResourcePropertyOccurs::zeroOrMany}->includes(occurs)) then ' []' else '' endif)/]" labelAlignment="LEFT" resizeKind="NSEW"> @@ -275,17 +275,43 @@ <containerView name="containerView"/> <initialOperation/> </ownedTools> - <ownedTools xsi:type="tool_1:PopupMenu" name="Specification.DomainSpecificationMenu" label="OSLC" precondition="[self.oclIsTypeOf(DomainSpecification)/]"> + <ownedTools xsi:type="tool_1:PopupMenu" name="SpecificationDiagram.Menu" label="OSLC Lyo Designer"> <menuItemDescription xsi:type="tool_1:OperationAction" name="Specification.DomainSpecificationMenu.SetPrefix" label="Set Domain Prefix" precondition="[self.oclIsTypeOf(DomainSpecification)/]"> - <view name="views"> - <subVariables xsi:type="tool_1:AcceleoVariable" name="domainSpecification" computationExpression="[views->any(true).oclAsType(DNodeContainer).target/]"/> - </view> + <view name="views"/> <initialOperation> - <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[domainSpecification.namespacePrefix/]"> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[self.namespacePrefix/]"> <subModelOperations xsi:type="tool_1:SetValue" featureName="name" valueExpression="[let userInput : String = self.promptForString('Enter the domain namespace prefix', 'Enter the domain namespace prefix', self.name) in (if (userInput = null) then name else userInput endif) /]"/> </firstModelOperations> </initialOperation> </menuItemDescription> + <menuItemDescription xsi:type="tool_1:OperationAction" name="Specification.DomainSpecificationMenu.SetJavaGenerationSettings" label="Set Java Generation Settings" precondition="[self.oclIsTypeOf(DomainSpecification)/]"> + <view name="views"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[self/]"> + <subModelOperations xsi:type="tool_1:If" conditionExpression="[self.generationSetting.oclIsUndefined()/]"> + <subModelOperations xsi:type="tool_1:CreateInstance" typeName="GenerationSetting" referenceName="generationSetting" variableName="generationSetting"/> + </subModelOperations> + <subModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[self.generationSetting/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="javaFilesPath" valueExpression="[self.eContainer(DomainSpecification).oclAsType(DomainSpecification).promptForJavaFilesPath()/]"/> + <subModelOperations xsi:type="tool_1:SetValue" featureName="javaClassPackageName" valueExpression="[self.eContainer(DomainSpecification).oclAsType(DomainSpecification).promptForJavaClassPackageName()/]"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </menuItemDescription> + <menuItemDescription xsi:type="tool_1:OperationAction" name="Specification.SpecificationMenu.SetJavaGenerationSettings" label="Set Java Generation Settings" precondition="[self.oclIsTypeOf(Specification)/]"> + <view name="views"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[self/]"> + <subModelOperations xsi:type="tool_1:If" conditionExpression="[self.generationSetting.oclIsUndefined()/]"> + <subModelOperations xsi:type="tool_1:CreateInstance" typeName="GenerationSetting" referenceName="generationSetting" variableName="generationSetting"/> + </subModelOperations> + <subModelOperations xsi:type="tool_1:ChangeContext" browseExpression="[self.generationSetting/]"> + <subModelOperations xsi:type="tool_1:SetValue" featureName="javaFilesPath" valueExpression="[self.eContainer(Specification).oclAsType(Specification).promptForJavaFilesPath()/]"/> + <subModelOperations xsi:type="tool_1:SetValue" featureName="javaClassPackageName" valueExpression="[self.eContainer(Specification).oclAsType(Specification).promptForJavaClassPackageName()/]"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </menuItemDescription> </ownedTools> </toolSections> </defaultLayer> diff --git a/org.eclipse.lyo.tools.toolchain.design/src/org/eclipse/lyo/tools/toolchain/design/queries.mtl b/org.eclipse.lyo.tools.toolchain.design/src/org/eclipse/lyo/tools/toolchain/design/queries.mtl index 18ba5fc..7e348cd 100644 --- a/org.eclipse.lyo.tools.toolchain.design/src/org/eclipse/lyo/tools/toolchain/design/queries.mtl +++ b/org.eclipse.lyo.tools.toolchain.design/src/org/eclipse/lyo/tools/toolchain/design/queries.mtl @@ -20,6 +20,8 @@ [module queries('http://org.eclipse.lyo/oslc4j/adaptorInterface', 'http://www.eclipse.org/sirius/diagram/1.1.0')/] +[import org::eclipse::lyo::tools::toolchain::design::DialogInputServices/] + [query public visibleResources(diagram : DDiagram) : Sequence(Resource) = (diagram.containers->select(c : DDiagramElementContainer | (c.actualMapping.name = 'Specification.DomainSpecification.Resource')._and(c.visible))).target.oclAsType(Resource) @@ -41,3 +43,59 @@ aResource.name + + (if (aResource.invisibleParentResources(diagram)->size() > 1) then ' & ...' else '' endif) endif) /] + +[comment specificationDiagram/] + +[query public promptForJavaFilesPath(aDomainSpecification : DomainSpecification) : String = +let userInput : String = aDomainSpecification.promptForString('Enter relative file path', + 'For the resources of this domain specification, enter the relative file path for their corresponding java classes.' + + lineSeparator() + + 'This path will override any setting on the whole Specification, and/or a specific adaptor', + aDomainSpecification.generationSetting.javaFilesPath) in + (if (userInput = null) then + aDomainSpecification.generationSetting.javaFilesPath + else + userInput + endif) +/] + + +[query public promptForJavaClassPackageName(aDomainSpecification : DomainSpecification) : String = +let userInput : String = aDomainSpecification.promptForString('Enter the java package name', + 'For the resources of this domain specification, enter the package name for their corresponding java classes.' + + lineSeparator() + + 'This package name will override any setting on the whole Specification, and/or a specific adaptor.', + aDomainSpecification.generationSetting.javaClassPackageName) in + (if (userInput = null) then + aDomainSpecification.generationSetting.javaClassPackageName + else + userInput + endif) +/] + +[query public promptForJavaFilesPath(aSpecification : Specification) : String = +let userInput : String = aSpecification.promptForString('Enter relative file path', + 'For the resources of this specification, enter the relative file path for their corresponding java classes.' + + lineSeparator() + + 'This path will override any setting on a specific adaptor', + aSpecification.generationSetting.javaFilesPath) in + (if (userInput = null) then + aSpecification.generationSetting.javaFilesPath + else + userInput + endif) +/] + + +[query public promptForJavaClassPackageName(aSpecification : Specification) : String = +let userInput : String = aSpecification.promptForString('Enter the java package name', + 'For the resources of this specification, enter the package name for their corresponding java classes.' + + lineSeparator() + + 'This package name will override any setting on a specific adaptor.', + aSpecification.generationSetting.javaClassPackageName) in + (if (userInput = null) then + aSpecification.generationSetting.javaClassPackageName + else + userInput + endif) +/] |