diff --git a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genCompose.mtl b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genCompose.mtl index 1a8adab..b597236 100644 --- a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genCompose.mtl +++ b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genCompose.mtl @@ -1,5 +1,5 @@ [comment encoding = UTF-8 /] -[module genCompose('http://occiware.org/occi/docker/ecore', 'http://schemas.ogf.org/occi/infrastructure/ecore', 'http://schemas.ogf.org/occi/core/ecore')] +[module genCompose('http://www.eclipse.org/emf/2002/Ecore', 'http://schemas.ogf.org/occi/core/ecore', 'http://schemas.ogf.org/occi/infrastructure/ecore', 'http://occiware.org/occi/docker/ecore')] [template public generateCompose(configuration : Configuration)] [file ('docker/compose.yml', false, 'UTF-8')] diff --git a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genSH.mtl b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genSH.mtl index ea267eb..6407007 100644 --- a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genSH.mtl +++ b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/files/genSH.mtl @@ -1,5 +1,5 @@ [comment encoding = UTF-8 /] -[module genSH('http://occiware.org/occi/docker/ecore', 'http://schemas.ogf.org/occi/infrastructure/ecore', 'http://schemas.ogf.org/occi/core/ecore')] +[module genSH('http://occiware.org/occi/docker/ecore', 'http://www.eclipse.org/emf/2002/Ecore', 'http://schemas.ogf.org/occi/core/ecore', 'http://schemas.ogf.org/occi/infrastructure/ecore')] [template public generateSH(configuration : Configuration)] [file ('docker/' + configurationFileName(configuration) + '.sh', false, 'UTF-8')] @@ -8,31 +8,31 @@ # Generated at [getNow()/] from [getFilePath(configuration)/] by org.occiware.clouddesigner.occi.docker.gen.conf # -[for (machine : Machine | configuration.resources->filter(Machine))] +[for (machine : docker::Machine | configuration.resources->filter(docker::Machine))] [machine.genMachine()/] [/for] [/file] [/template] -[template public genMachine (machine : Machine) ] +[template public genMachine (machine : docker::Machine) ] # Create the Docker [eClass().name/] named [name/] -docker-machine create [genDriverConfig()/] [name/] +docker-machine create [machine.genDriverConfig()/] [name/] eval "$(docker-machine env [name/])" [getOrderedContainers().genContainer()/] [/template] -[template public genDriverConfig (machine : Machine) post (trim())] +[template public genDriverConfig (machine : docker::Machine) post (trim())] [/template] -[template public genDriverConfig (machine : Machinevirtualbox) post (trim())] +[template public genDriverConfig (machine :docker::Machinevirtualbox) post (trim())] --driver=virtualbox[if (not occiComputeMemory.oclIsUndefined() and occiComputeMemory <> 0)] --virtualbox-memory [toInteger(occiComputeMemory)/][/if][if (not diskSize.oclIsUndefined() and diskSize <> null)] --virtualbox-disk-size [diskSize/][/if] [/template] [comment TODO: Add genDriverConfig for each Machine_* /] -[template public genContainer (container : Container) ] +[template public genContainer (container : docker::Container) ] # Create the Docker Container named [name/] [comment TODO: Add other parameters of the docker create command. /] docker create --name [name/][if publishAll] -P[/if][if (not volumes.oclIsUndefined())] -v [volumes.trim()/][/if][if (not ports.oclIsUndefined())] -p [ports.trim()/][/if][genLinkConfig()/][if (not image.oclIsUndefined())] [image.trim()/][/if][if (not command.oclIsUndefined())] [command.trim()/][/if] @@ -43,9 +43,9 @@ docker start [name/] [/template] -[template public genLinkConfig (container : Container) post (trim())] -[for (link : Link | links->filter(docker::Link))] -[let name : String = link.target.oclAsType(Container).name] +[template public genLinkConfig (container : docker::Container) post (trim())] +[for (link : docker::Link | links->filter(docker::Link))] +[let name : String = link.target.oclAsType(docker::Container).name] --link [name/]:[if link.alias <> null][link.alias/][else][name/][/if] [/let] [/for] diff --git a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/Generate.java b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/Generate.java index 496fe95..c34051f 100644 --- a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/Generate.java +++ b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/Generate.java @@ -18,17 +18,11 @@ import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener; import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy; import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator; -import org.eclipse.cmf.occi.core.OCCIPackage; -import org.eclipse.cmf.occi.docker.DockerFactory; -import org.eclipse.cmf.occi.docker.DockerPackage; -import org.eclipse.cmf.occi.infrastructure.InfrastructurePackage; import org.eclipse.emf.common.util.BasicMonitor; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; /** * Entry point of the 'Generate' generation module. @@ -346,33 +340,33 @@ public String[] getTemplateNames() { @Override public void registerPackages(ResourceSet resourceSet) { super.registerPackages(resourceSet); - // The following doesnt work same message as described below. - resourceSet.getPackageRegistry().put(OCCIPackage.eNS_URI, - OCCIPackage.eINSTANCE); - resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, - InfrastructurePackage.eINSTANCE); - resourceSet.getPackageRegistry().put(DockerPackage.eNS_URI, - DockerPackage.eINSTANCE); + if (!isInWorkspace(org.eclipse.emf.ecore.EcorePackage.class)) { + resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE); + } +// // The following doesnt work same message as described below. +// resourceSet.getPackageRegistry().put(OCCIPackage.eNS_URI, +// OCCIPackage.eINSTANCE); +// resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, +// InfrastructurePackage.eINSTANCE); +// resourceSet.getPackageRegistry().put(DockerPackage.eNS_URI, +// DockerPackage.eINSTANCE); // Other try with acceleo forum comments in forums, the following doesnt work... // Message : !MESSAGE The generation failed to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates. // The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator. It could also come from a missing [comment @main/] // in the template used as the entry point of the generation. - if (!isInWorkspace(OCCIPackage.class)) { - // The normal package registration if your metamodel is in a plugin. - resourceSet.getPackageRegistry().put(OCCIPackage.eNS_URI, OCCIPackage.eINSTANCE); - } - if (!isInWorkspace(InfrastructurePackage.class)) { + if (!isInWorkspace(org.eclipse.cmf.occi.core.OCCIPackage.class)) { // The normal package registration if your metamodel is in a plugin. - resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, InfrastructurePackage.eINSTANCE); + resourceSet.getPackageRegistry().put(org.eclipse.cmf.occi.core.OCCIPackage.eNS_URI, org.eclipse.cmf.occi.core.OCCIPackage.eINSTANCE); } - if (!isInWorkspace(InfrastructurePackage.class)) { + if (!isInWorkspace(org.eclipse.cmf.occi.infrastructure.InfrastructurePackage.class)) { // The normal package registration if your metamodel is in a plugin. - resourceSet.getPackageRegistry().put(InfrastructurePackage.eNS_URI, InfrastructurePackage.eINSTANCE); + resourceSet.getPackageRegistry().put(org.eclipse.cmf.occi.infrastructure.InfrastructurePackage.eNS_URI, org.eclipse.cmf.occi.infrastructure.InfrastructurePackage.eINSTANCE); } - if (!isInWorkspace(DockerPackage.class)) { + + if (!isInWorkspace(org.eclipse.cmf.occi.docker.DockerPackage.class)) { // The normal package registration if your metamodel is in a plugin. - resourceSet.getPackageRegistry().put(DockerPackage.eNS_URI, DockerPackage.eINSTANCE); + resourceSet.getPackageRegistry().put(org.eclipse.cmf.occi.docker.DockerPackage.eNS_URI, org.eclipse.cmf.occi.docker.DockerPackage.eINSTANCE); } // EcoreUtil.resolveAll(resourceSet); diff --git a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/generate.mtl b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/generate.mtl index a488f3f..aa2051c 100644 --- a/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/generate.mtl +++ b/plugins/org.eclipse.cmf.occi.docker.gen.conf/src/org/eclipse/cmf/occi/docker/gen/conf/main/generate.mtl @@ -1,5 +1,5 @@ [comment encoding = UTF-8 /] -[module generate('http://occiware.org/occi/docker/ecore', 'http://schemas.ogf.org/occi/infrastructure/ecore', 'http://schemas.ogf.org/occi/core/ecore')] +[module generate('http://www.eclipse.org/emf/2002/Ecore', 'http://schemas.ogf.org/occi/core/ecore', 'http://schemas.ogf.org/occi/infrastructure/ecore', 'http://occiware.org/occi/docker/ecore')] [import org::eclipse::cmf::occi::docker::gen::conf::files::genCompose /] [import org::eclipse::cmf::occi::docker::gen::conf::files::genSH /] [template public generateElement(configuration : Configuration)]