maven jaxb plugin, java packages generated has mis-match with XSD namespace - maven-jaxb2-plugin

Background: I am trying to convert WSDL/XSD to Java classes
Issue: package names generated is mismatching with the namespace. Last part of number namespace is missing, below 02 is missing from package
XSD has - xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02"
Java class generated - package iso.std.iso._20022.tech.xsd.pain_001_001;
Steps Taken:
I tried with 2 maven plugin, both gave me same results.
org.jvnet.jaxb2.maven2
maven-jaxb2-plugin
org.codehaus.mojo
jaxb2-maven-plugin

This works as designed. See Section D.5.2 of the JAXB Specification.
Step 2 says:
Remove the trailing file type, one of .?? or .??? or .html.
Apparently, .02 is considered to be the "trailing file type" here and is removed.
Consider using bindings to specify the target package.

Related

Escaping module names with hyphen ceylon module descriptors

How can I escape the hyphen in a ceylon module descriptor?
import com.fasterxml.jackson-core "2.8.4";
Edit:
In this case the jar are downloaded and included in the correct file hierarchy of the local ceylon repository ./repo . So, I expect that I can handle it like any other .car . Then, the only remaining problem is to escape the hyphen in the module name.
You can use quotes. Specifying the explicit maven: namespace is also recommended:
import maven:"com.fasterxml.jackson.core:jackson-core" "2.8.4";
See section 9.3.10. “Module descriptors” of the Ceylon language spec:
Note: quoted module names enable interoperation with Maven and other module repository systems whose module identifiers do not comply with the format specified for Ceylon module names.
As of Ceylon 1.3.2, the preferred syntax for this is to quote:
only the maven artifact id, since that is the bit that often has a dash in it, and
not the maven group id, since that is almost always a legal Ceylon module name.
So you would write:
import maven:com.fasterxml.jackson.core:"jackson-core" "2.8.8";
I'm assuming that this is the module you're trying to import.

How to use ceylon js (also with google closure compiler)

Calling a file resulting from the concatenation (bash: cat ... >> app.js) of the following three files:
/usr/share/ceylon/1.2.0/repo/ceylon/language/1.2.0/ceylon.language-1.2.0.js
modules/com/example/helloworld/1.0.0/com.example.helloworld-1.0.0-model.js
modules/com/example/helloworld/1.0.0/com.example.helloworld-1.0.0.js
with the command nodejs app.js does nothing. The same when used in a web page. How do have I to call that javascript program so that it runs without using require.js ?
Please give the rules how ceylon modules and the run function and other functions contained within translate to javascript and are to be called.
How can I get one javascript file from compilation of several ceylon modules without concatenating them manually or with require.js?
The above is without using google closure compiler.
Given the size of 1.6 MB of the language module, it makes no sense to run ceylon-js without using google closure compiler.
Compiling "ceylon.language-1.2.0.js" alone with google closure compiler results in a lot of warnings.
java -jar compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js /usr/share/ceylon/1.2.0/repo/ceylon/language/1.2.0/ceylon.language-1.2.0.js --js_output_file lib-compiled.js
How can I get rid of those warnings?
In what order do I have to chain together files resulting from ceylon-js with the model file and the language file to compile them in advanced mode with google closure compiler for dead code elimination.
These are 3 questions, really.
A Ceylon module is compiled to a CommonJS module. Concatenating the resulting files won't work because each file is on CommonJS format, which is a big function that returns an object with the exported declarations.
You can compile the modules with the --no-module option to get just the generated code, without it being wrapped in CommonJS format. For the language module, you can copy the file and just delete the first line and the last 5 lines.
I do not yet know how to get rid of the warnings you mention in the second question.
And as for the third question, I would recommend putting the language module first, then the rest of the files. If you have any toplevel declarations with the same name in different modules, you'll have conflicts (only the last declaration will remain), even if they're not shared, since they're all in the same module/unit.
Well, I think require.js can run the compilation of the modules to one file and then run the google-closure-compiler, see: http://www.requirejs.org/docs/optimization.html

How can I import JSON data from a REST API into BIRT?

I want to use BIRT to generate reports against data that comes from a JSON based REST API. How can I import this data?
The process for doing this is described at http://developer.actuate.com/community/forum/?app=blog&blogid=45&showentry=471, but it turns out that there are a few important steps missing. I'll fill in a few blanks here.
The original instructions describe creating a Scripted Data Source, with an "open" script that makes use of the com.actuate.json.JSONParser class. First, it is important to realise that this class is not part of BIRT, and needs to be manually added (along with any dependencies).
The download provided by the original instructions provides the com.actuate.json.JSONParser class, but leaves it up to you to source the dependencies. To make things easier I have reimplemented the JSONParser library in Maven, which will then download and package the dependencies for you. It also includes some bug fixes and enhancements like GZIP compression support. You can get the Maven project from https://github.com/mcasperson/birt-jsonparser, and to build the JSONParser library and package the dependencies, run the command
mvn clean package dependency:copy-dependencies
This will result in the birt-jsonparser-0.0.1-SNAPSHOT.jar file being created in the target directory, and all the dependencies copied into the target\dependency directory. Copy all of these JAR files into the {BIRT_INSTALL}/plugins/org.eclipse.birt.report.viewer_{BIRT_VIEWER_VERSION}/birt/scriptlib directory to allow the JSONParser class to be accessed from within your BIRT report.
If you want to debug your report, these JAR files will also have to be referenced in the Debug profile.

Get HTML file produced by JavaDocs

I understand that Javadoc is a documentation generator from Sun Microsystems for generating API documentation in HTML format from Java source code.
I infer that the documentation is stored onto an HTML file.
Is there a way I can access it?
If yes where is it stored?
The word Javadoc can refer to
special comments in Java source files (preceding a declaration, and of the form /** ... */)
a program which converts these comments (as well as the declarations themselves) to readable output
the output itself, usually in HTML form.
The Javadoc program is contained in Sun's (or now Oracle's) Java Development Kit (JDK).
If you have installed a JDK (which you should if you do Java development), you can call it on the command line, passing it the package names to document, or some source file names. You should also indicate the output directory, using the -d option.
I'm assuming the following directory (and package) structure in my example below:
current directory
source
de
dclj
paul
examples
HelloWorld.java [containing package de.dclj.paul.examples; and public class HelloWorld { ... }]
docs
Then you use the following command line:
javadoc -sourcpath source -d docs de.dclj.paul.examples
It will then create a the documentation in the docs directory, with an index.html which you can open in your web browser, and other files reachable from it.
For more details have a look at the documentation linked above. For an example output, have a look at the Java Standard API Javadoc.
If you are using an IDE, you likely have a generate Javadoc button there, and the IDE might even show the formatted output of documentation of single classes or methods on the fly.

Classes generated by XML Data Generator Tool are not contained within the specified namespace

I have the same problem as described in this connect issue
http://connect.microsoft.com/VisualStudio/feedback/details/577382/classes-generated-by-xml-data-generator-tool-are-not-contained-within-the-specified-namespace
"An XSD file using the XML Data Generator Tool within a C++/CLI project will create a set of classes that are NOT within a namespace. The classes should be within the namespace specified by the Namespace property of the XML Data Generator Tool. This was detected when upgrading a VS2008 project to VS2010."
I see the /namespace option is on the command line of the XML Data Generator tool but still it does not write the namespace.
In VS 2008
// This source code was auto-generated by xsd, Version=2.0.50727.3038.
//
namespace IOLib {
using namespace System;
ref class CPDS;
In VS 2010
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
using namespace System;
ref class CPDS;
Is there a way to force xsd tool to write the namespace too.
for xsd.exe the parameter /n: is used to specify the namespace. Don't put a space between the parameter and the value.
Example:
xsd myschema.xsd /c /n:MyNamespace
Visual Studio uses MSBuild to build the targets specified in the solution. They seem to be abandoning C++ in favor of VB and C#. VS 2010 uses settings in
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets`
file. The XSD section is missing an entry namely "Namespace". I set mine to
Namespace ="%(Xsd.Namespace)"
and compliled the xsd and the classes are now in the namespace I specify in the projects property pages.