Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging: Java and XQuery code #1413

Closed
2 tasks done
ChristianGruen opened this issue Feb 11, 2017 · 1 comment
Closed
2 tasks done

Packaging: Java and XQuery code #1413

ChristianGruen opened this issue Feb 11, 2017 · 1 comment
Labels
Milestone

Comments

@ChristianGruen
Copy link
Member

ChristianGruen commented Feb 11, 2017

Our current packaging mechanism detects either XQuery modules or Java archives. In many cases, the entry points of a Java archive are defined via an XQuery module, and it would be nice if both of them could be packaged and installed.

Idea (built on top of http://docs.basex.org/wiki/Repository#Java):

  • In a JAR, the main class is defined in the MANIFEST.MF file:
Manifest-Version: 1.0
Main-Class: org.basex.modules.Hello
  • If a .xqm file with this name exists additionally to the .class file in the installed JAR file, it will be extracted and used as the entry point:
 META-INF/
   MANIFEST.MF
 org/basex/modules/
   Hello.class
   Hello.xqm
  • After installation, both Hello.jar and Hello.xqm will be in the repository. If the module is imported, the .xqm file takes precedence:
import module namespace m = 'http://basex.org/modules/Hello';
m:hello("Universe")
  • The JAR file still needs to be imported from the XQuery module in the repository. This can be enforced by using the java: prefix:
(:~ Hello.xqm :)
module namespace m = 'http://basex.org/modules/Hello';

(: Import JAR file :)
import module namespace jar = 'java:org.basex.modules.Hello';

(:~
 : Creates a greetings strings.
 : @param  $guy  guy to greet.
 : @return greetings
 :)
declare function m:hello($guy as xs:string) as xs:string {
  jar:hello($guy)
};

Todos:

  • REPO INSTALL: Extract .xqm file
  • REPO DELETE: Delete both .jar and .xqm files
@ChristianGruen ChristianGruen added this to the 8.7 milestone Feb 11, 2017
@ChristianGruen
Copy link
Member Author

Documentation: http://docs.basex.org/wiki/Repository#Combined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant