private static void startJAASSNAA( String path, String urnprefix, String jaasModuleName, String jaasConfigFile, IUserAuthorization authorization) { log.debug( "Starting JAAS SNAA, path [" + path + "], prefix[" + urnprefix + "], jaasConfigFile[" + jaasConfigFile + "], jaasModuleName[" + jaasModuleName + "], authorization[" + authorization + "]"); System.setProperty("java.security.auth.login.config", jaasConfigFile); JAASSNAA jaasSnaa = new JAASSNAA(urnprefix, jaasModuleName, authorization); HttpContext context = server.createContext(path); Endpoint endpoint = Endpoint.create(jaasSnaa); endpoint.publish(context); log.debug("Started JAAS SNAA on " + server.getAddress() + path); }
public static void main(String[] args) throws Exception { // create Options object Options options = new Options(); options.addOption("b", "branch", true, "force branch name in case of a detached repo"); options.addOption( "s", "snapshot", false, "Use Maven SNAPSHOT instead of semver build metadata"); options.addOption("m", "maven", false, "Maven compatible semver versions"); options.addOption("l", "logLevel", true, "Configures log level to TRACE|DEBUG|INFO|WARN|ERROR"); CommandLineParser parser = new DefaultParser(); CommandLine cmd = parser.parse(options, args); String logLevel = cmd.getOptionValue("l", "error"); // $NON-NLS-1$ System.setProperty("org.slf4j.simpleLogger.log.com.quicksign", logLevel); // $NON-NLS-1$ LOGGER = LoggerFactory.getLogger(JGitFlowSemver.class); final GitflowVersioningConfiguration conf = new GitflowVersioningConfiguration(); try { // parse the command line arguments CommandLine line = parser.parse(options, args); if (line.hasOption('b')) { conf.setForceBranch(line.getOptionValue('b')); LOGGER.debug("Forcing branch name {}", conf.getForceBranch()); } if (line.hasOption('s')) { conf.useMavenSnapshot(); LOGGER.debug("Maven snapshots mode"); } if (line.hasOption('m')) { conf.mavenCompatibility(); LOGGER.debug("Maven compatibility mode"); } args = line.getArgs(); } catch (ParseException exp) { printUsage(options, System.err); System.exit(1); } if (args.length != 1) { printUsage(options, System.err); System.exit(1); } try { Version v = null; final File root = new File(args[0]).getAbsoluteFile(); final File dir = new File(root, ".git"); conf.setRepositoryRoot(dir.getPath()); if (new File(root, "pom.xml").exists()) { LOGGER.debug("Detected Maven pom.xml so activating Maven compatibility"); conf.mavenCompatibility(); } v = new JGitFlowSemver(dir, conf).infer(); String adjusted = v.toString(); if (conf.isMavenCompatibility()) { adjusted = adjusted.replaceAll("\\+", "."); } System.out.println(adjusted); } catch (Exception e) { System.err.println("An error ocured: " + e); LOGGER.error("An error occured", e); System.exit(2); } }