This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
forked from highsource/jaxb-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from phax/v016
V016
- Loading branch information
Showing
119 changed files
with
9,239 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
plugin-4.0/src/test/java/org/jvnet/mjiip/v_4_0/MainDummyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package org.jvnet.mjiip.v_4_0; | ||
|
||
import java.io.File; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
import org.apache.maven.plugin.logging.Log; | ||
import org.apache.maven.plugin.logging.SystemStreamLog; | ||
import org.jvnet.jaxb2.maven2.IDependencyResourceResolver; | ||
import org.jvnet.jaxb2.maven2.resolver.CatalogManager; | ||
import org.jvnet.jaxb2.maven2.resolver.tools.MavenCatalogResolver; | ||
import org.jvnet.jaxb2.maven2.resolver.tools.ReResolvingEntityResolverWrapper; | ||
|
||
import com.sun.codemodel.JCodeModel; | ||
import com.sun.tools.xjc.Language; | ||
import com.sun.tools.xjc.ModelLoader; | ||
import com.sun.tools.xjc.Options; | ||
import com.sun.tools.xjc.model.Model; | ||
|
||
public class MainDummyTest | ||
{ | ||
public static void main (final String [] args) throws Exception | ||
{ | ||
final Log log = new SystemStreamLog () | ||
{ | ||
@Override | ||
public boolean isDebugEnabled () | ||
{ | ||
return true; | ||
} | ||
}; | ||
|
||
final LoggingErrorReceiver er = new LoggingErrorReceiver ("Error while parsing schema(s).", log, true); | ||
final Options options = new Options (); | ||
options.setSchemaLanguage (Language.XMLSCHEMA); | ||
options.strictCheck = false; | ||
options.compatibilityMode = Options.EXTENSION; | ||
final MavenCatalogResolver catalogResolver; | ||
{ | ||
final CatalogManager catalogManager = new CatalogManager (); | ||
catalogManager.setIgnoreMissingProperties (true); | ||
catalogManager.setUseStaticCatalog (false); | ||
catalogManager.setVerbosity (Integer.MAX_VALUE); | ||
final IDependencyResourceResolver dependencyResourceResolver = dependencyResource -> { | ||
if (false) | ||
System.err.println ("TODO " + dependencyResource); | ||
try | ||
{ | ||
final String sVersion = dependencyResource.getVersion () != null ? dependencyResource.getVersion () | ||
: dependencyResource.getArtifactId () | ||
.startsWith ("ph-xsds-") ? "3.0.0" | ||
: "6.7.1-SNAPSHOT"; | ||
final String sUrl = "jar:file:/C:/Users/phili/.m2/repository/" + | ||
dependencyResource.getGroupId ().replace ('.', '/') + | ||
"/" + | ||
dependencyResource.getArtifactId () + | ||
"/" + | ||
sVersion + | ||
"/" + | ||
dependencyResource.getArtifactId () + | ||
"-" + | ||
sVersion + | ||
".jar!/" + | ||
dependencyResource.getResource (); | ||
System.err.println ("Resolved to " + sUrl); | ||
return new URL (sUrl); | ||
} | ||
catch (final MalformedURLException ex) | ||
{ | ||
throw new IllegalStateException ("Invalid URL", ex); | ||
} | ||
}; | ||
catalogResolver = new MavenCatalogResolver (catalogManager, dependencyResourceResolver, log); | ||
options.entityResolver = new ReResolvingEntityResolverWrapper (catalogResolver, log); | ||
} | ||
|
||
// Parse catalog | ||
final File fCat = new File ("C:\\dev\\git\\ph-ubl\\ph-ubltr\\src\\main\\jaxb\\catalog-ubltr.txt"); | ||
catalogResolver.getCatalog ().parseCatalog (fCat.toURI ().toURL ()); | ||
|
||
// Don't add catalog | ||
|
||
// After the rest | ||
final String sPath = "C:\\dev\\git\\ph-ubl\\ph-ubltr\\src\\main\\resources\\schemas\\ubltr"; | ||
options.addGrammar (new File (sPath, "Envelope/Package_1_2.xsd")); | ||
options.addGrammar (new File (sPath, "HRXML/UserAccount.xsd")); | ||
options.addBindFile (new File ("C:\\dev\\git\\ph-ubl\\ph-ubltr\\src\\main\\jaxb\\bindings-ubltr.xjb")); | ||
|
||
final Model model = ModelLoader.load (options, new JCodeModel (), er); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.