magick93 / sculptor-cartridge-camelrs Goto Github PK
View Code? Open in Web Editor NEWsculptor-cartridge-camelrs
License: Apache License 2.0
sculptor-cartridge-camelrs
License: Apache License 2.0
Rest DSL - Swagger intagration: http://camel.apache.org/rest-dsl.html
Swagger configuration: http://camel.apache.org/swagger
To achive this we need:
'@nAmed' beans should be generated instead of '@service' and '@repository' annotated
Resource Impl class template needs to have methods implemented
In some cases routes could not be created automatically. For example, when DTO's is involved, or resource method is not delegated. For example, to generate update method, as described in http://sculptorgenerator.org/documentation/rest-tutorial#a-note-regarding-update---put mapping between DTO and entity. So, it's required to
INFO] ------------------------------------------------------------------------
[INFO] Building New Sculptor Project :: Business Tier 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sculptor-maven-plugin:3.1.0:generate (code-generation) @ tradeaudit ---
[ERROR] Error formating code for '/home/anton/Documents/magick/modeling/rest/tradeaudit/src/generated/java/org/helloworld/planet/rest/PlanetResourceBase.java'. Using original code from generator
[ERROR] Error running action 'org.sculptor.generator.template.RootTmpl.root': null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sculptor.generator.workflow.SculptorGeneratorWorkflow.runAction(SculptorGeneratorWorkflow.java:432)
at org.sculptor.generator.workflow.SculptorGeneratorWorkflow.generateCode(SculptorGeneratorWorkflow.java:397)
at org.sculptor.generator.workflow.SculptorGeneratorWorkflow.run(SculptorGeneratorWorkflow.java:116)
at org.sculptor.generator.SculptorGeneratorRunner.run(SculptorGeneratorRunner.java:50)
at org.sculptor.maven.plugin.GeneratorMojo.doRunGenerator(GeneratorMojo.java:474)
at org.sculptor.maven.plugin.GeneratorMojo.executeGenerator(GeneratorMojo.java:439)
at org.sculptor.maven.plugin.GeneratorMojo.execute(GeneratorMojo.java:223)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.NullPointerException
at org.sculptor.generator.cartridge.camelrs.RestWebTmplExtension.writeRestApplicationfile(RestWebTmplExtension.java:47)
at org.sculptor.generator.cartridge.camelrs.RestWebTmplExtension.restWeb(RestWebTmplExtension.java:31)
at org.sculptor.generator.template.RootTmpl._chained_root(RootTmpl.java:265)
at org.sculptor.generator.template.RootTmplMethodDispatch.root(RootTmplMethodDispatch.java:45)
at org.sculptor.generator.cartridge.builder.RootTmplExtension._chained_root(RootTmplExtension.java:84)
at org.sculptor.generator.cartridge.builder.RootTmplExtension.root(RootTmplExtension.java:55)
... 33 more
[ERROR] Executing generator workflow failed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
When running the following:
Application Universe {
basePackage=org.helloworld
Module planet {
Resource PlanetResource {
show => PlanetService.findById;
String createForm;
create => PlanetService.save;
delete => PlanetService.delete;
showAll => PlanetService.findAll;
}
Service PlanetService {
findById => PlanetRepository.findById;
findAll => PlanetRepository.findAll;
save => PlanetRepository.save;
delete => PlanetRepository.delete;
}
Entity Planet {
String name
int diameter
Repository PlanetRepository {
findById;
save;
delete;
findAll;
}
}
}
}
See the last code example on http://camel.apache.org/rest-dsl.html
There is a type() method (the data-type that is put or posted) is missing.
CamelRS bindingMode can be set to auto to support respondig with both XML/JSON (depending from Content-Type header passed by client). However, there is a problem with list processing (for example, in findAll). JAXB requires some kind of support to serrialize lists.
The generic solution may include creating a wrapper for lists as described in http://blog.bdoughan.com/2012/11/creating-generic-list-wrapper-in-jaxb.html.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.