UML metamodel not found in createing Acceleo project - eclipse

I am new in Acceleo. I use eclipse Mars. I want to getting start and learn with this link. when I want to create a new project and click add in the field of Metamodel URIs I didn't find UML Metamodel. what can I do?

The UML metamodel is only accessible by Acceleo if it is registered in the global EMF ERegistry. It means that it must be either loaded as an EMF plugin in your Eclipse environment or manually added to the global registry of your running Eclipse instance.
For UML, it is quite simple, you need to install the UML2 plugin. It provides the UML metamodel java code and .ecore as well as many tools around UML.
Also, if you want more details about Acceleo syntax, you can use these links:
Language Reference
http://help.eclipse.org/mars/topic/org.eclipse.acceleo.doc/pages/reference/language.html
Operations
https://wiki.eclipse.org/Acceleo/OCL_Operations_Reference
https://wiki.eclipse.org/Acceleo/Acceleo_Operations_Reference
Text production rules
https://wiki.eclipse.org/Acceleo/Text_Production_Rules
And a small tutorial I wrote (only part 1 at the moment):
http://blog.genmymodel.com/build-your-own-php-generator-from-uml-using-acceleo-part-1.html

Related

How to add java source code for AspectJ in eclipse

I am learning AOP with Spring framework and I want to set the javadoc for AOP in eclipse. So what I did I downloaded aspectj-1.8.10.jar from eclipse web site https://eclipse.org/aspectj/downloads.php#install then I installed that jar and got 4 new jar files: aspectjrt.jar, aspectjtools.jar, aspectjweaver.jar, org.aspectj.matcher.jar which I added to my class path in eclipse. Now what I want is to add source files for these jars so, for example, when I hover over #Aspect I want to be able to see what this annotation represents. Unfortunately I can not find the source files for these jars, on the eclipse website mentioned above there is a file aspectj-1.8.10-src.jar but I'm not sure what to do with it, I tried to attach this file directly in the build path for each of the jars mentioned above but it didn't do the trick. Also I thought that maybe I had to install aspectj-1.8.10-src.jar the way I installed aspectj-1.8.10.jar so I would get 4 source files, but I'm not sure how (if possible) to install it, when I double click aspectj-1.8.10-src.jar, installation does not get triggered.
So can you please help me out to add javadoc for AspectJ 1.8.10 in Eclipse?
Select the library in your Eclipse project explorer window, click right button, select properties, select javasource attachment or javadoc location and enter the path to the source or javadoc file.
But I would suggest to use maven to maintain the dependencies of your project. It makes getting javadoc much easier, because libraries, source code and javadoc are fetch from a central repository. You just add the library you need in your project configuration (pom.xml file) and the other files are fetched for you.
You do not need all those libraries. Please first learn which one serves which purpose. E.g. aspectjrt is the runtime. When using Spring AOP you actually do not really use AspectJ, only a subset of its syntax. Thus, the runtime is needed for identifying some of the annotation classes. However, aspectjweaver is only needed if you want to use full AspectJ in a load-time weaving (LTW) scenario, with or without Spring. The weaver lib is a superset of the runtime, so you only need one of them. Last, but not least, aspectjtools again is a superset of the weaver lib and contains the AspectJ compiler (among other tools). This is only needed for compile-time weaving as part of your toolchain.
I do not think that source code and Javadoc will help you much in learning AspectJ. I suggest you read the Spring manual's AOP chapter describing both proxy-based Spring AOP and full AspectJ integration via LTW. If you want to learn AspectJ basics and maybe just use AspectJ without Spring (which is what I do), read the AspectJ documentation.
If you are still not convinced and want to add source and JavaDoc to your Eclipse project, why don't you follow jaysee's advice and use Maven? Then you get all the source/javadoc libs for free. But anyway, you can also load those JARs directly from Maven Central, e.g. the source and javadoc for AspectJ runtime 1.8.10. Good luck! But I assume you will be disappointed because the AspectJ JavaDoc is really bad for learning purposes and not suited to understanding how to actually use AspectJ.

What is the appropriate facet for a JSP tag library?

I am converting some old Eclipse projects over to faceted form, and I'm uncertain which facets are appropriate for a JSP tag library (one Java class, one TLD file). "Dynamic Web Module" is overkill (generates a WebContent/WEB-INF and WebContent/META-INF, which are not needed for a tag library).
The web applications that use the tag library use Servlet Specification 3.1. The tag library conforms to web-jsptaglibrary_2_1.xsd.
Is the standard practice here to simply use the "Java" facet?
Is there no additional facet that is appropriate for JSP Tag libraries?
The screenshot shows my current configuration, which works but feels like it is missing a facet.
Eclipse Mars, Java 1.8.0_60, Tomcat 8.0.26
I think the comments have the answer to your question, I will try to
explain the same thing in a different way. Keeping the project facet just to java is enough.
Facets are just the aspects for your IDE to interpret the project related configurations well. To develop a JSP tag lib, all you need is Tag Library Descriptor youTag.tld and the compiled Java tag handler class files used in your tag library. Java project Facet is enough to provide you all the helps needed for writing the tag handler class.
Your only worry may be to package it as a jar in the right way, his is explained well in the below link.
Packaging the JSP Tag Library as JAR file is simple as per the
official guide.

Eclipse Indigo, how to autogenerate Entity Meta Model

I have read this on how to auto-generate the Entity Meta Model, but I think there is something wrong.
I have: Eclipse Indigo SR2, build 20120216-1857 and configured the "Annotation Processor" as specified here. To the factory path I have added ONLY these jars
hibernate-jpamodelgen-1.2.0.Final.jar (taken from here)
hibernate-jpa-2.0-api-1.0.1.Final.jar (taken from the zip archive of Hibernate ORM 4.1.0 from here)
I suppose after configuring this for my the EJB project (I did not do that for my Web or EAR Project), the project gets rebuild and the Meta Model Classes will be autogenerated, without clicking on another button, is that right?
If everything should have worked, do you have any clues on what could go wrong?
Notes:
I see absolutely no messages from any annotation processors in the "Error Log" Eclipse View.
My persistence.xml file is in the ejbModule/META-INF/persistence.xml
All my entities extend an Abstract class, imported in the project with svn:externals.
My entities are annotated with #Entity, and that's all.
The problem is that the project has also AspectJ compatibility, which makes the Project use another compiler. More details on this bug here.
Beside that, you could (bun not mandatory you will) get an NullPointerException (see the "Error Log" Eclipse View) if you have at least an Abstract Class in your project.
You just need to select the source folder of the generated metamodel on your Project -> Properties -> JPA

Sub-packaging my static meta-model classes on Eclipse Indigo

I'm currently using Eclipse Indigo and I'd like to have my meta-model classes to be automatically generated in a sub-package instead of having them in the same package of my entities.
I've followed the instructions in the JPA User Guide for Canonical Model Generator on Eclipse Galileo, but it's not working at all with Indigo. :(
Does anybody use the static meta-model classes in a sub-package? Is there any way to configure it on Eclipse Indigo?
Maybe you should not change package
I would suggest against it, because having those in sub package (or any other) violates current JPA 2 specification:
• For each managed class X in package p, a metamodel class X_ in
package p is created.[67]
...
[67] We expect that the option of
different packages will be provided in a future release of this
specification.
...
Implementations of this specification are not
required to support the use of non-canonical metamodel classes.
Applications that use non-canonical metamodel classes will not be
portable.
Other way to organize is common JUnit practice: same package in different source directory.
But if you have to, this is how it is done
Following works at least with Eclipse version: Indigo Service Release 1 20110916-0149 and EclipseLink: eclipselink-2.3.0.v20110604-r9504. Names of the JARs can slightly vary from version to another.
If enabled, disable generating to the same package where entities are:
Go to Project Properties - JPA and check that value of Source Folder
is <None>
Adjusting generating to the other package:
Properties - Annotation Processing
[x] Enable project specific settings
[x] Enable annotation processing
[x] Enable processing in editor
Generated source directory: src (or wherever sources live)
New processor option:
key=eclipselink.canonicalmodel.subpackage
value=sub | (desired package name)
Go one level deeper to the Annotation Processing | Factory Path and select Add External JARs and add following jars:
eclipselink/jlib/jpajavax.persistence_2.0.3.v201010191057.jar
eclipselink/jlib/jpaeclipselink-jpa-modelgen_2.3.0.v20110604-r9504.jar
eclipselink/jlib/eclipselink.jar
Let Eclipse rebuild project.

Using EclipseLink 2.3.0 from Target

I want to use EclipseLink 2.3.0 (as provided with Indigo, resp. the Update Site target provided on http://www.eclipse.org/eclipselink/downloads/) in an Eclipse RCP application.
If I include the EclipseLink libraries specifically in a Plug-In by means of creating a lib folder, stuffing them all in and adding them to the classpath, all the Entities I have in the Plug-In are being found and registered.
If I however switch to using the target distributed EclipseLink Implementation, by adding javax.persistence and org.eclipse.persistence.jpa, the connection to the database is readily built... however NONE of the Entities are found! The occuring message always is:
[EL Warning]: The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units. Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element
My persistence.xml however denotes the respective class, as it is being found when I use the manual libraries! This is rather confusing, any hint on this? :) THX
Take a look at the EclipseLink OSGi examples on the Eclispe wiki for details on how to develop in PDE, how to enable byte code weaving, and an RCP example.
http://wiki.eclipse.org/EclipseLink/Examples/OSGi
--Shaun