Class bnd

  • All Implemented Interfaces:
    Constants, Registry, Report, Reporter, java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable<java.lang.String>

    public class bnd
    extends Processor
    Utility to make bundles. @version $Revision: 1.14 $
    • Field Detail

      • logger

        private static org.slf4j.Logger logger
      • ASSIGNMENT

        private static final java.util.regex.Pattern ASSIGNMENT
      • err

        final java.io.PrintStream err
      • out

        public final java.io.PrintStream out
      • password

        private char[] password
      • noExit

        private static final java.lang.ThreadLocal<java.lang.Boolean> noExit
      • DEFAULT_LOG_LEVEL_KEY

        private static final java.lang.String DEFAULT_LOG_LEVEL_KEY
        See Also:
        Constant Field Values
      • JARCOMMANDS

        private static final java.util.regex.Pattern JARCOMMANDS
      • COMMAND

        private static final java.util.regex.Pattern COMMAND
      • BUG_P

        private static final java.util.regex.Pattern BUG_P
      • BND_COMMAND_P

        private static final java.util.regex.Pattern BND_COMMAND_P
      • LINE_P

        private static final java.util.regex.Pattern LINE_P
    • Constructor Detail

      • bnd

        public bnd()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • mainNoExit

        static void mainNoExit​(java.lang.String[] args,
                               java.nio.file.Path baseExecDir)
                        throws java.lang.Exception
        For testing
        Throws:
        java.lang.Exception
      • start

        public void start​(java.lang.String[] args)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • rewrite

        private void rewrite​(java.util.List<java.lang.String> args)
                      throws java.lang.Exception
        Rewrite the command line to mimic the jar command
        Parameters:
        args -
        Throws:
        java.lang.Exception
      • rewriteJarCmd

        private void rewriteJarCmd​(java.util.List<java.lang.String> args)
      • _bnd

        public void _bnd​(bnd.bndOptions options)
                  throws java.lang.Exception
        Main command. This has options the bnd base options and will then run another command.
        Parameters:
        options -
        Throws:
        java.lang.Exception
      • doLogging

        private void doLogging​(bnd.bndOptions options)
        Setup SLF4J logging level.
        Parameters:
        options -
      • _create

        public void _create​(bnd.createOptions options)
                     throws java.lang.Exception
        Create jar file
          jar c[v0M]f jarfile [-C dir] inputfiles [-Joption]
         jar c[v0]mf manifest jarfile [-C dir] inputfiles [-Joption] jar c[v0M]
         [-C dir] inputfiles [-Joption] jar c[v0]m manifest [-C dir] inputfiles
         [-Joption]
         
        Parameters:
        options -
        Throws:
        java.lang.Exception
      • add

        private void add​(Jar jar,
                         java.io.File base,
                         java.lang.String path,
                         boolean report)
                  throws java.io.IOException
        Helper for the jar create function, adds files to the jar
        Parameters:
        jar -
        base -
        path -
        report -
        Throws:
        java.io.IOException
      • _extract

        public void _extract​(bnd.extractOptions opts)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _type

        public void _type​(bnd.typeOptions opts)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _do

        public void _do​(bnd.dooptions options)
                 throws java.lang.Exception
        The do command interprets files and does a default action for each file
        Throws:
        java.lang.Exception
      • build

        public void build​(java.lang.String dest,
                          boolean force,
                          java.lang.String path)
                   throws java.io.IOException,
                          java.lang.Exception
        Throws:
        java.io.IOException
        java.lang.Exception
      • _project

        public void _project​(bnd.projectOptions options)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _bump

        public void _bump​(bnd.bumpoptions options)
                   throws java.lang.Exception
        Bump a version number
        Throws:
        java.lang.Exception
      • _build

        public void _build​(bnd.buildoptions opts)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _compile

        public void _compile​(bnd.CompileOptions opts)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _test

        public void _test​(bnd.testOptions opts)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _junit

        public void _junit​(bnd.testOptions opts)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • verifyDependencies

        private boolean verifyDependencies​(Project project,
                                           boolean implies,
                                           boolean test)
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _run

        public void _run​(bnd.runOptions opts)
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • doRun

        private void doRun​(java.util.List<java.lang.String> args,
                           boolean verify,
                           java.lang.String project)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _clean

        public void _clean​(bnd.cleanOptions opts)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _syntax

        public void _syntax​(bnd.syntaxOptions opts)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • print

        private void print​(java.util.Formatter f,
                           Syntax sx,
                           java.lang.String indent)
      • _package

        public void _package​(bnd.packageOptions opts)
                      throws java.lang.Exception
        Package a bnd or bndrun file for packaging.
        Throws:
        java.lang.Exception
      • _deliverables

        public void _deliverables​(bnd.deliverableOptions options)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _macro

        public void _macro​(bnd.macroOptions options)
                    throws java.lang.Exception
        Show the value of a macro
        Throws:
        java.lang.Exception
      • _release

        public void _release​(bnd.releaseOptions options)
                      throws java.lang.Exception
        Release the project
        Throws:
        java.lang.Exception
      • _xref

        public void _xref​(XRefCommand.xrefOptions options)
                   throws java.io.IOException,
                          java.lang.Exception
        Throws:
        java.io.IOException
        java.lang.Exception
      • _eclipse

        public void _eclipse​(bnd.eclipseOptions options)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _buildx

        public void _buildx​(bnd.buildxOptions options)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • prebuild

        private void prebuild​(java.util.List<java.lang.String> set,
                              java.util.List<java.lang.String> order,
                              java.util.List<Builder> builders,
                              java.lang.String s)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • _view

        public void _view​(bnd.viewOptions options)
                   throws java.lang.Exception
        View files from JARs We parse the commandline and print each file on it.
        Throws:
        java.lang.Exception
      • _wrap

        public void _wrap​(bnd.wrapOptions options)
                   throws java.lang.Exception
        Wrap a jar to a bundle.
        Throws:
        java.lang.Exception
      • getPropertiesFile

        private java.io.File getPropertiesFile​(java.io.File properties,
                                               java.io.File file,
                                               java.lang.String stem)
      • _debug

        public void _debug​(bnd.debugOptions options)
                    throws java.lang.Exception
        Printout all the variables in scope.
        Throws:
        java.lang.Exception
      • report

        private void report​(Justif justif,
                            java.lang.String string,
                            Processor processor)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _repo

        public void _repo​(RepoCommand.repoOptions opts)
                   throws java.lang.Exception
        Manage the repo.
          out.println(" bnd repo [--repo|-r ('maven'|
         <dir>)]*"); out.println(" repos # list the
         repositories"); out.println(" list # list all content (not
         always possible)"); out.println(" get <bsn>
         <version> <file>? # get an artifact");
         out.println(" put <file>+ # put in artifacts");
         out.println(" help");
         
        Throws:
        java.lang.Exception
      • _enroute

        public void _enroute​(EnrouteOptions opts)
                      throws java.lang.Exception
        Run enroute commands
        Throws:
        java.lang.Exception
      • _print

        public void _print​(bnd.printOptions options)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • patch

        public void patch​(bnd.patchOptions opts)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _runtests

        public void _runtests​(bnd.runtestsOptions opts)
                       throws java.lang.Exception
        Run the tests from a prepared bnd file.
        Throws:
        java.lang.Exception
      • runTest

        private int runTest​(java.io.File testFile,
                            java.lang.String[] tests,
                            Workspace testws,
                            java.io.File reportDir,
                            Tag summary)
                     throws java.lang.Exception
        Help function to run the tests
        Throws:
        java.lang.Exception
      • doPerReport

        private void doPerReport​(Tag report,
                                 java.io.File file)
                          throws java.lang.Exception
        Calculate the coverage if there is coverage info in the test file.
        Throws:
        java.lang.Exception
      • doCoverage

        private void doCoverage​(Tag report,
                                org.w3c.dom.Document doc,
                                javax.xml.xpath.XPath xpath)
                         throws javax.xml.xpath.XPathExpressionException
        Throws:
        javax.xml.xpath.XPathExpressionException
      • doHtmlReport

        private void doHtmlReport​(Tag report,
                                  java.io.File file,
                                  org.w3c.dom.Document doc,
                                  javax.xml.xpath.XPath xpath)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _verify

        public void _verify​(bnd.verifyOptions opts)
                     throws java.lang.Exception
        Verify jars.
        Throws:
        java.lang.Exception
      • _source

        public void _source​(bnd.sourceOptions opts)
                     throws java.lang.Exception
        Merge a bundle with its source.
        Throws:
        java.lang.Exception
      • _diff

        public void _diff​(DiffCommand.diffOptions opts)
                   throws java.lang.Exception
        Diff two jar files
        Throws:
        java.lang.Exception
      • _schema

        public void _schema​(BaselineCommands.schemaOptions opts)
                     throws java.lang.Exception
        Create a schema of package deltas and versions
        Throws:
        java.lang.Exception
      • getProject

        public Project getProject()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getWorkspace

        public Workspace getWorkspace​(java.io.File workspaceDir)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getProject

        public Project getProject​(java.lang.String where)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getWorkspace

        public Workspace getWorkspace​(java.lang.String where)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _convert

        public void _convert​(bnd.convertOptions opts)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • _select

        public void _select​(bnd.selectOptions opts)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getJar

        Jar getJar​(java.lang.String s)
        Central routine to get a JAR with error checking
        Parameters:
        s -
      • _version

        public void _version​(bnd.versionOptions o)
                      throws java.io.IOException
        Show the version of this bnd
        Throws:
        java.io.IOException
      • _info

        public void _info​(bnd.infoOptions options)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _grep

        public void _grep​(bnd.grepOptions opts)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _settings

        public void _settings​(bnd.settingOptions opts)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • tos

        private java.lang.String tos​(boolean hex,
                                     byte[] data)
        Set the private key in the settings for this machine
        Parameters:
        hex -
        data -
        Throws:
        java.lang.Exception
      • list

        private void list​(java.util.Collection<java.lang.String> keys,
                          java.util.Map<java.lang.String,​java.lang.String> map)
      • _digest

        public void _digest​(bnd.hashOptions o)
                     throws java.security.NoSuchAlgorithmException,
                            java.lang.Exception
        hash a file
        Throws:
        java.lang.Exception
        java.security.NoSuchAlgorithmException
      • _maven

        public void _maven​(Options options)
                    throws java.lang.Exception
        Maven command
        Throws:
        java.lang.Exception
      • _bash

        public void _bash​(Options options)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _action

        public void _action​(bnd.ActionOptions opts)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _find

        public void _find​(bnd.FindOptions options)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • __merge

        public void __merge​(bnd.MergeOptions options)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _ees

        public void _ees​(bnd.EEOptions options)
                  throws java.lang.Exception
        Show the class versions used in a JAR
        Throws:
        java.lang.Exception
      • __par

        public void __par​(bnd.ParallelBuildOptions options)
                   throws java.lang.Exception
        Lets see if we can build in parallel
        Throws:
        java.lang.Exception
      • _sync

        public void _sync​(bnd.projectOptions options)
                   throws java.lang.Exception
        Force a cache update of the workspace
        Throws:
        java.lang.Exception
      • _bsn2url

        public void _bsn2url​(bnd.Bsn2UrlOptions opts)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _plugins

        public void _plugins​(bnd.projectOptions opts)
                      throws java.lang.Exception
        Show the loaded workspace plugins
        Throws:
        java.lang.Exception
      • _dependencies

        public void _dependencies​(bnd.DependencyOptions opts)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _bootstrap

        public void _bootstrap​(bnd.BootstrapOptions options)
                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _defaults

        public void _defaults​(Options o)
        Show all the defaults in bnd
      • _copy

        public void _copy​(bnd.CopyOptions options)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isIn

        private boolean isIn​(java.lang.String[] bundleSpecificHeaders,
                             java.lang.String key)
      • getJarFileNameFrom

        private java.lang.String getJarFileNameFrom​(java.lang.String name)
      • _add

        public void _add​(bnd.AddOptions opts)
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _remove

        public void _remove​(bnd.RemoveOptions opts)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _profile

        public void _profile​(bnd.ProfileOptions options)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _export

        public void _export​(bnd.ExportOptions options)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _flatten

        public void _flatten​(bnd.FlattenOptions opts)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _collect

        public void _collect​(bnd.CollectOptions options)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _classtoresource

        public void _classtoresource​(Options options)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • _packagetoresource

        public void _packagetoresource​(Options options)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • forEachLine

        private void forEachLine​(java.lang.String file,
                                 java.util.function.Consumer<java.lang.String> c)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • addAll

        private void addAll​(Jar output,
                            Jar sub,
                            java.lang.String prefix,
                            java.util.List<java.lang.String> bundleClassPath)
      • exitWithCode

        private static void exitWithCode​(int code)
      • _index

        public void _index​(IndexCommand.indexOptions options)
                    throws java.lang.Exception
        Index command
        Throws:
        java.lang.Exception
      • isWorkspaceOk

        private boolean isWorkspaceOk()
      • getWorkspace

        public Workspace getWorkspace()
      • _properties

        public void _properties​(bnd.PropertiesOptions options)
                         throws java.lang.Exception
        Print out all the properties
        Throws:
        java.lang.Exception
      • _generate

        public void _generate​(bnd.GenerateOptions options)
                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • _classpath

        public void _classpath​(bnd.ClasspathOptions options)
                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • toFile

        private java.io.File toFile​(Container c)