[Git][java-team/plexus-interactivity-api][master] 8 commits: New upstream version 1.3
Pierre Gruet (@pgt)
gitlab at salsa.debian.org
Wed Oct 9 14:35:57 BST 2024
Pierre Gruet pushed to branch master at Debian Java Maintainers / plexus-interactivity-api
Commits:
79bcfcd3 by Pierre Gruet at 2024-10-09T09:35:28+02:00
New upstream version 1.3
- - - - -
65e6ff05 by Pierre Gruet at 2024-10-09T09:35:29+02:00
Update upstream source from tag 'upstream/1.3'
Update to upstream version '1.3'
with Debian dir 5f803f2a812cfb6b35f7d706e0081534d1a04ba5
- - - - -
e8e5aa8c by Pierre Gruet at 2024-10-09T09:37:26+02:00
Raising Standards version to 4.7.0 (no change)
- - - - -
eef0ddc6 by Pierre Gruet at 2024-10-09T09:37:52+02:00
Refreshing patches
- - - - -
e1472127 by Pierre Gruet at 2024-10-09T10:03:03+02:00
Refreshing d/libplexus-interactivity-api-java.poms after the jline artifact was removed upstream
- - - - -
4d58ab82 by Pierre Gruet at 2024-10-09T13:46:52+02:00
Removing now useless Lintian override for bad-jar-name
- - - - -
d303452f by Pierre Gruet at 2024-10-09T15:18:56+02:00
Adding new required build-dependencies
- - - - -
3fd963fa by Pierre Gruet at 2024-10-09T15:19:21+02:00
Upload to unstable
- - - - -
27 changed files:
- + .github/dependabot.yml
- + .github/release-drafter.yml
- − .github/workflows/codeql-analysis.yml
- + .github/workflows/maven.yml
- + .github/workflows/release-drafter.yml
- debian/changelog
- debian/control
- − debian/libplexus-interactivity-api-java.lintian-overrides
- debian/libplexus-interactivity-api-java.poms
- debian/patches/dependency_management.patch
- plexus-interactivity-api/pom.xml
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/AbstractInputHandler.java
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultInputHandler.java
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultPrompter.java
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/InputHandler.java
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/OutputHandler.java
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/Prompter.java
- plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/PrompterException.java
- plexus-interactivity-jline/src/main/java/org/codehaus/plexus/components/interactivity/jline/JLineInputHandler.java → plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/jline/JLineInputHandler.java
- − plexus-interactivity-api/src/main/resources/META-INF/plexus/components.xml
- + plexus-interactivity-api/src/test/java/org/codehaus/plexus/components/interactivity/DefaultPrompterComponentTest.java
- + plexus-interactivity-api/src/test/java/org/codehaus/plexus/components/interactivity/DefaultPrompterTest.java
- − plexus-interactivity-jline/pom.xml
- − plexus-interactivity-jline/src/main/resources/META-INF/plexus/components.xml
- − plexus-interactivity-jline/src/site/site.xml
- pom.xml
Changes:
=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,10 @@
+version: 2
+updates:
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
=====================================
.github/release-drafter.yml
=====================================
@@ -0,0 +1,2 @@
+_extends: .github
+tag-template: plexus-interactivity-$NEXT_MINOR_VERSION
=====================================
.github/workflows/codeql-analysis.yml deleted
=====================================
@@ -1,67 +0,0 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
-#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
-#
-# ******** NOTE ********
-# We have attempted to detect the languages in your repository. Please check
-# the `language` matrix defined below to confirm you have the correct set of
-# supported CodeQL languages.
-#
-name: "CodeQL"
-
-on:
- push:
- branches: [ master ]
- pull_request:
- # The branches below must be a subset of the branches above
- branches: [ master ]
- schedule:
- - cron: '33 3 * * 1'
-
-jobs:
- analyze:
- name: Analyze
- runs-on: ubuntu-latest
-
- strategy:
- fail-fast: false
- matrix:
- language: [ 'java' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
- # Learn more:
- # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
-
- steps:
- - name: Checkout repository
- uses: actions/checkout at v2
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init at v1
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries at main
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild at v1
-
- # ℹ️ Command-line programs to run using the OS shell.
- # 📚 https://git.io/JvXDl
-
- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
-
- #- run: |
- # make bootstrap
- # make release
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze at v1
=====================================
.github/workflows/maven.yml
=====================================
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: GitHub CI
+
+on: [push, pull_request]
+
+jobs:
+ build:
+ name: Build it
+ uses: codehaus-plexus/.github/.github/workflows/maven.yml at master
+
+ deploy:
+ name: Deploy
+ needs: build
+ uses: codehaus-plexus/.github/.github/workflows/maven-deploy.yml at master
+ secrets: inherit
=====================================
.github/workflows/release-drafter.yml
=====================================
@@ -0,0 +1,12 @@
+name: Release Drafter
+on:
+ push:
+ branches:
+ - master
+jobs:
+ update_release_draft:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: release-drafter/release-drafter at v5
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
=====================================
debian/changelog
=====================================
@@ -1,3 +1,15 @@
+plexus-interactivity-api (1.3-1) unstable; urgency=medium
+
+ * New upstream version 1.3
+ * Raising Standards version to 4.7.0 (no change)
+ * Refreshing patches
+ * Adding new required build-dependencies
+ * Refreshing d/libplexus-interactivity-api-java.poms after the jline artifact
+ was removed upstream
+ * Removing now useless Lintian override for bad-jar-name
+
+ -- Pierre Gruet <pgt at debian.org> Wed, 09 Oct 2024 15:19:03 +0200
+
plexus-interactivity-api (1.1-2) unstable; urgency=medium
* Team upload.
=====================================
debian/control
=====================================
@@ -6,10 +6,13 @@ Uploaders: Torsten Werner <twerner at debian.org>
Build-Depends:
debhelper-compat (= 13),
default-jdk,
+ libeclipse-sisu-maven-plugin-java,
+ libjline3-java,
libplexus-container-default1.5-java,
libplexus-utils2-java,
+ libsisu-inject-java <!nocheck>,
maven-debian-helper (>= 2.2)
-Standards-Version: 4.6.1
+Standards-Version: 4.7.0
Vcs-Git: https://salsa.debian.org/java-team/plexus-interactivity-api.git
Vcs-Browser: https://salsa.debian.org/java-team/plexus-interactivity-api
Homepage: https://codehaus-plexus.github.io/plexus-interactivity/
=====================================
debian/libplexus-interactivity-api-java.lintian-overrides deleted
=====================================
@@ -1,3 +0,0 @@
-# The indicated file is the real jar and not a symlink, but this really does
-# not harm.
-bad-jar-name [usr/share/java/plexus-interactivity-api.jar]
=====================================
debian/libplexus-interactivity-api-java.poms
=====================================
@@ -25,4 +25,3 @@
#
pom.xml --no-parent
plexus-interactivity-api/pom.xml --has-package-version --java-lib
-plexus-interactivity-jline/pom.xml --ignore
=====================================
debian/patches/dependency_management.patch
=====================================
@@ -8,10 +8,11 @@ Last-Update: 2022-10-09
--- a/pom.xml
+++ b/pom.xml
-@@ -52,4 +52,18 @@
+@@ -58,4 +58,19 @@
+ </plugin>
</plugins>
</build>
-
++
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
=====================================
plexus-interactivity-api/pom.xml
=====================================
@@ -1,10 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>plexus-interactivity</artifactId>
<groupId>org.codehaus.plexus</groupId>
- <version>1.1</version>
+ <artifactId>plexus-interactivity</artifactId>
+ <version>1.3</version>
</parent>
<artifactId>plexus-interactivity-api</artifactId>
@@ -12,13 +13,47 @@
<name>Plexus Default Interactivity Handler</name>
<dependencies>
+ <!-- JLine is optional -->
+ <dependency>
+ <groupId>org.jline</groupId>
+ <artifactId>jline-reader</artifactId>
+ <version>3.25.1</version>
+ <optional>true</optional>
+ </dependency>
+
<dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ <scope>provided</scope>
</dependency>
+
+ <!-- Test -->
<dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.sisu</groupId>
+ <artifactId>org.eclipse.sisu.inject</artifactId>
+ <version>0.9.0.M2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ <version>6.0.0</version>
+ <scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.sisu</groupId>
+ <artifactId>sisu-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/AbstractInputHandler.java
=====================================
@@ -24,30 +24,22 @@ package org.codehaus.plexus.components.interactivity;
* SOFTWARE.
*/
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-
-import java.util.List;
-import java.util.ArrayList;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
/**
* Base input handler, implements a default <code>readMultipleLines</code>.
*
* @author Brett Porter
- * @version $Id$
*/
-public abstract class AbstractInputHandler
- extends AbstractLogEnabled
- implements InputHandler
-{
- public List readMultipleLines()
- throws IOException
- {
- List lines = new ArrayList();
+public abstract class AbstractInputHandler implements InputHandler {
+ @Override
+ public List<String> readMultipleLines() throws IOException {
+ List<String> lines = new ArrayList<>();
String line = readLine();
- while ( line != null && line.length() > 0 )
- {
- lines.add( line );
+ while (line != null && !line.isEmpty()) {
+ lines.add(line);
line = readLine();
}
return lines;
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultInputHandler.java
=====================================
@@ -24,8 +24,7 @@ package org.codehaus.plexus.components.interactivity;
* SOFTWARE.
*/
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import javax.inject.Named;
import java.io.BufferedReader;
import java.io.IOException;
@@ -35,29 +34,18 @@ import java.io.InputStreamReader;
* Default input handler, that uses the console.
*
* @author Brett Porter
- * @version $Id$
*/
-public class DefaultInputHandler
- extends AbstractInputHandler
- implements Initializable
-{
- private BufferedReader consoleReader;
+ at Named
+public class DefaultInputHandler extends AbstractInputHandler {
+ private final BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));
- public String readLine()
- throws IOException
- {
+ @Override
+ public String readLine() throws IOException {
return consoleReader.readLine();
}
- public String readPassword()
- throws IOException
- {
+ @Override
+ public String readPassword() throws IOException {
return consoleReader.readLine();
}
-
- public void initialize()
- throws InitializationException
- {
- consoleReader = new BufferedReader( new InputStreamReader( System.in ) );
- }
}
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultOutputHandler.java
=====================================
@@ -24,40 +24,27 @@ package org.codehaus.plexus.components.interactivity;
* SOFTWARE.
*/
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import javax.inject.Named;
-import java.io.IOException;
import java.io.PrintWriter;
/**
* Default output handler, that uses the console.
*
* @author Brett Porter
- * @version $Id$
*/
-public class DefaultOutputHandler
- implements Initializable, OutputHandler
-{
- private PrintWriter consoleWriter;
+ at Named
+public class DefaultOutputHandler implements OutputHandler {
+ private final PrintWriter consoleWriter = new PrintWriter(System.out);
- public void initialize()
- throws InitializationException
- {
- consoleWriter = new PrintWriter( System.out );
- }
-
- public void write( String line )
- throws IOException
- {
- consoleWriter.print( line );
+ @Override
+ public void write(String line) {
+ consoleWriter.print(line);
consoleWriter.flush();
}
- public void writeLine( String line )
- throws IOException
- {
+ @Override
+ public void writeLine(String line) {
consoleWriter.println();
}
}
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/DefaultPrompter.java
=====================================
@@ -24,7 +24,8 @@ package org.codehaus.plexus.components.interactivity;
* SOFTWARE.
*/
-import org.codehaus.plexus.util.StringUtils;
+import javax.inject.Inject;
+import javax.inject.Named;
import java.io.IOException;
import java.util.Iterator;
@@ -34,202 +35,149 @@ import java.util.List;
* Default prompter.
*
* @author Brett Porter
- * @version $Id$
*/
-public class DefaultPrompter
- implements Prompter
-{
- /**
- * @requirement
- */
- private OutputHandler outputHandler;
-
- /**
- * @requirement
- */
- private InputHandler inputHandler;
-
- public String prompt( String message )
- throws PrompterException
- {
- try
- {
- writePrompt( message );
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to present prompt", e );
+ at Named
+public class DefaultPrompter implements Prompter {
+ private final OutputHandler outputHandler;
+
+ private final InputHandler inputHandler;
+
+ @Inject
+ public DefaultPrompter(OutputHandler outputHandler, InputHandler inputHandler) {
+ this.outputHandler = outputHandler;
+ this.inputHandler = inputHandler;
+ }
+
+ @Override
+ public String prompt(String message) throws PrompterException {
+ try {
+ writePrompt(message);
+ } catch (IOException e) {
+ throw new PrompterException("Failed to present prompt", e);
}
- try
- {
+ try {
return inputHandler.readLine();
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to read user response", e );
+ } catch (IOException e) {
+ throw new PrompterException("Failed to read user response", e);
}
}
- public String prompt( String message, String defaultReply )
- throws PrompterException
- {
- try
- {
- writePrompt( formatMessage( message, null, defaultReply ) );
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to present prompt", e );
+ @Override
+ public String prompt(String message, String defaultReply) throws PrompterException {
+ try {
+ writePrompt(formatMessage(message, null, defaultReply));
+ } catch (IOException e) {
+ throw new PrompterException("Failed to present prompt", e);
}
- try
- {
+ try {
String line = inputHandler.readLine();
-
- if ( StringUtils.isEmpty( line ) )
- {
+ if (line == null || line.isEmpty()) {
line = defaultReply;
}
-
return line;
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to read user response", e );
+ } catch (IOException e) {
+ throw new PrompterException("Failed to read user response", e);
}
}
- public String prompt( String message, List possibleValues, String defaultReply )
- throws PrompterException
- {
- String formattedMessage = formatMessage( message, possibleValues, defaultReply );
+ @Override
+ public String prompt(String message, List<String> possibleValues, String defaultReply) throws PrompterException {
+ String formattedMessage = formatMessage(message, possibleValues, defaultReply);
String line;
- do
- {
- try
- {
- writePrompt( formattedMessage );
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to present prompt", e );
+ do {
+ try {
+ writePrompt(formattedMessage);
+ } catch (IOException e) {
+ throw new PrompterException("Failed to present prompt", e);
}
- try
- {
+ try {
line = inputHandler.readLine();
if (line == null && defaultReply == null) {
throw new IOException("EOF");
}
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to read user response", e );
+ } catch (IOException e) {
+ throw new PrompterException("Failed to read user response", e);
}
- if ( StringUtils.isEmpty( line ) )
- {
+ if (line == null || line.isEmpty()) {
line = defaultReply;
}
- if ( line != null && !possibleValues.contains( line ) )
- {
- try
- {
- outputHandler.writeLine( "Invalid selection." );
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to present feedback", e );
+ if (line != null && !possibleValues.contains(line)) {
+ try {
+ outputHandler.writeLine("Invalid selection.");
+ } catch (IOException e) {
+ throw new PrompterException("Failed to present feedback", e);
}
}
- }
- while ( line == null || !possibleValues.contains( line ) );
+ } while (line == null || !possibleValues.contains(line));
return line;
}
- public String prompt( String message, List possibleValues )
- throws PrompterException
- {
- return prompt( message, possibleValues, null );
+ @Override
+ public String prompt(String message, List<String> possibleValues) throws PrompterException {
+ return prompt(message, possibleValues, null);
}
- public String promptForPassword( String message )
- throws PrompterException
- {
- try
- {
- writePrompt( message );
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to present prompt", e );
+ @Override
+ public String promptForPassword(String message) throws PrompterException {
+ try {
+ writePrompt(message);
+ } catch (IOException e) {
+ throw new PrompterException("Failed to present prompt", e);
}
- try
- {
+ try {
return inputHandler.readPassword();
- }
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to read user response", e );
+ } catch (IOException e) {
+ throw new PrompterException("Failed to read user response", e);
}
}
- private String formatMessage( String message, List possibleValues, String defaultReply )
- {
- StringBuffer formatted = new StringBuffer( message.length() * 2 );
+ private String formatMessage(String message, List<String> possibleValues, String defaultReply) {
+ StringBuilder formatted = new StringBuilder(message.length() * 2);
- formatted.append( message );
+ formatted.append(message);
- if ( possibleValues != null && !possibleValues.isEmpty() )
- {
- formatted.append( " (" );
+ if (possibleValues != null && !possibleValues.isEmpty()) {
+ formatted.append(" (");
- for ( Iterator it = possibleValues.iterator(); it.hasNext(); )
- {
- String possibleValue = (String) it.next();
+ for (Iterator<String> it = possibleValues.iterator(); it.hasNext(); ) {
+ String possibleValue = it.next();
- formatted.append( possibleValue );
+ formatted.append(possibleValue);
- if ( it.hasNext() )
- {
- formatted.append( '/' );
+ if (it.hasNext()) {
+ formatted.append('/');
}
}
- formatted.append( ')' );
+ formatted.append(')');
}
- if ( defaultReply != null )
- {
- formatted.append( ' ' ).append( defaultReply ).append( ": " );
+ if (defaultReply != null) {
+ formatted.append(' ').append(defaultReply);
}
return formatted.toString();
}
- private void writePrompt( String message )
- throws IOException
- {
- outputHandler.write( message + ": " );
+ private void writePrompt(String message) throws IOException {
+ outputHandler.write(message + ": ");
}
- public void showMessage( String message )
- throws PrompterException
- {
- try
- {
- writePrompt( message );
+ @Override
+ public void showMessage(String message) throws PrompterException {
+ try {
+ writePrompt(message);
+ } catch (IOException e) {
+ throw new PrompterException("Failed to present prompt", e);
}
- catch ( IOException e )
- {
- throw new PrompterException( "Failed to present prompt", e );
- }
-
}
}
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/InputHandler.java
=====================================
@@ -24,43 +24,35 @@ package org.codehaus.plexus.components.interactivity;
* SOFTWARE.
*/
-import java.util.List;
import java.io.IOException;
+import java.util.List;
/**
* Manage user input from different sources.
- *
- * @todo should this also echo any prompts before the input?
- * @todo should this validate the input, reprompt if required?
- * @todo readBoolean, readInt, readSingleChar - readLine's that parse the input
+ * TODO should this also echo any prompts before the input?
+ * TODO should this validate the input, reprompt if required?
+ * TODO readBoolean, readInt, readSingleChar - readLine's that parse the input
* @author <a href="mailto:brett at apache.org">Brett Porter</a>
- * @version $Id$
*/
-public interface InputHandler
-{
- String ROLE = InputHandler.class.getName();
-
+public interface InputHandler {
/**
* Read a single line of input, swalling the newline at the end.
* If the input can be echoed, it will be.
* @return the line read
*/
- String readLine()
- throws IOException;
+ String readLine() throws IOException;
/**
* Read a single line of input, swalling the newline at the end.
* This method guarantees input is not echoed.
* @return the line read
*/
- String readPassword()
- throws IOException;
+ String readPassword() throws IOException;
/**
* Read a set of lines. Equivalent to multiple calls to {@link #readLine()}.
* Ends when an empty line is encountered.
* @return a list of lines read
*/
- List readMultipleLines()
- throws IOException;
+ List<String> readMultipleLines() throws IOException;
}
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/OutputHandler.java
=====================================
@@ -30,23 +30,17 @@ import java.io.IOException;
* Manage user output to different sources.
*
* @author <a href="mailto:brett at apache.org">Brett Porter</a>
- * @version $Id$
*/
-public interface OutputHandler
-{
- String ROLE = OutputHandler.class.getName();
-
+public interface OutputHandler {
/**
* Write a single line of input, excluding the newline at the end.
* @param line the line
*/
- void write( String line )
- throws IOException;
+ void write(String line) throws IOException;
/**
* Write a single line of input, including the newline at the end.
* @param line the line
*/
- void writeLine( String line )
- throws IOException;
+ void writeLine(String line) throws IOException;
}
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/Prompter.java
=====================================
@@ -30,27 +30,17 @@ import java.util.List;
* Prompt the user for input.
*
* @author <a href="mailto:brett at apache.org">Brett Porter</a>
- * @version $Id$
*/
-public interface Prompter
-{
- String ROLE = Prompter.class.getName();
+public interface Prompter {
+ String prompt(String message) throws PrompterException;
- String prompt( String message )
- throws PrompterException;
+ String prompt(String message, String defaultReply) throws PrompterException;
- String prompt( String message, String defaultReply )
- throws PrompterException;
+ String prompt(String message, List<String> possibleValues) throws PrompterException;
- String prompt( String message, List possibleValues )
- throws PrompterException;
+ String prompt(String message, List<String> possibleValues, String defaultReply) throws PrompterException;
- String prompt( String message, List possibleValues, String defaultReply )
- throws PrompterException;
+ String promptForPassword(String message) throws PrompterException;
- String promptForPassword( String message )
- throws PrompterException;
-
- void showMessage( String message )
- throws PrompterException;
+ void showMessage(String message) throws PrompterException;
}
=====================================
plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/PrompterException.java
=====================================
@@ -28,18 +28,13 @@ package org.codehaus.plexus.components.interactivity;
* Error while prompting.
*
* @author <a href="mailto:brett at apache.org">Brett Porter</a>
- * @version $Id$
*/
-public class PrompterException
- extends Exception
-{
- public PrompterException( String message )
- {
- super( message );
+public class PrompterException extends Exception {
+ public PrompterException(String message) {
+ super(message);
}
- public PrompterException( String message, Throwable cause )
- {
- super( message, cause );
+ public PrompterException(String message, Throwable cause) {
+ super(message, cause);
}
}
=====================================
plexus-interactivity-jline/src/main/java/org/codehaus/plexus/components/interactivity/jline/JLineInputHandler.java → plexus-interactivity-api/src/main/java/org/codehaus/plexus/components/interactivity/jline/JLineInputHandler.java
=====================================
@@ -24,47 +24,28 @@ package org.codehaus.plexus.components.interactivity.jline;
* SOFTWARE.
*/
-import jline.ConsoleReader;
-import org.codehaus.plexus.components.interactivity.AbstractInputHandler;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+import javax.inject.Named;
import java.io.IOException;
+import org.codehaus.plexus.components.interactivity.AbstractInputHandler;
+import org.jline.reader.LineReader;
+import org.jline.reader.LineReaderBuilder;
+
/**
* Default input handler, that uses the console.
*
* @author Brett Porter
- * @version $Id$
*/
-public class JLineInputHandler
- extends AbstractInputHandler
- implements Initializable
-{
- private ConsoleReader consoleReader;
+ at Named("jline")
+public class JLineInputHandler extends AbstractInputHandler {
+ private final LineReader consoleReader = LineReaderBuilder.builder().build();
- public String readLine()
- throws IOException
- {
+ public String readLine() throws IOException {
return consoleReader.readLine();
}
- public String readPassword()
- throws IOException
- {
- return consoleReader.readLine( new Character( '*' ) );
- }
-
- public void initialize()
- throws InitializationException
- {
- try
- {
- consoleReader = new ConsoleReader();
- }
- catch ( IOException e )
- {
- throw new InitializationException( "Cannot create console reader: ", e );
- }
+ public String readPassword() throws IOException {
+ return consoleReader.readLine('*');
}
}
=====================================
plexus-interactivity-api/src/main/resources/META-INF/plexus/components.xml deleted
=====================================
@@ -1,32 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.codehaus.plexus.components.interactivity.InputHandler</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.components.interactivity.DefaultInputHandler</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- <component>
- <role>org.codehaus.plexus.components.interactivity.OutputHandler</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.components.interactivity.DefaultOutputHandler</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- <component>
- <role>org.codehaus.plexus.components.interactivity.Prompter</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.components.interactivity.DefaultPrompter</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.components.interactivity.InputHandler</role>
- <role-hint>default</role-hint>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.components.interactivity.OutputHandler</role>
- <role-hint>default</role-hint>
- </requirement>
- </requirements>
- </component>
- </components>
-</component-set>
=====================================
plexus-interactivity-api/src/test/java/org/codehaus/plexus/components/interactivity/DefaultPrompterComponentTest.java
=====================================
@@ -0,0 +1,43 @@
+package org.codehaus.plexus.components.interactivity;
+
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2005, The Codehaus
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+import javax.inject.Inject;
+
+import org.eclipse.sisu.launch.InjectedTest;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+public class DefaultPrompterComponentTest extends InjectedTest {
+
+ @Inject
+ private Prompter prompter;
+
+ @Test
+ void smoke() {
+ assertNotNull(prompter);
+ }
+}
=====================================
plexus-interactivity-api/src/test/java/org/codehaus/plexus/components/interactivity/DefaultPrompterTest.java
=====================================
@@ -0,0 +1,96 @@
+package org.codehaus.plexus.components.interactivity;
+
+/*
+ * The MIT License
+ *
+ * Copyright (c) 2005, The Codehaus
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+
+import static java.util.Arrays.asList;
+import static java.util.Objects.requireNonNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class DefaultPrompterTest {
+ @Test
+ void promptSimple() throws PrompterException {
+ final InMemoryOutput out = new InMemoryOutput();
+ final Prompter prompter = new DefaultPrompter(out, new InMemoryInput("ok"));
+ prompter.prompt("test");
+ assertEquals("test: ", out.builder.toString());
+ }
+
+ @Test
+ void promptOption() throws PrompterException {
+ final InMemoryOutput out = new InMemoryOutput();
+ final Prompter prompter = new DefaultPrompter(out, new InMemoryInput("ok"));
+ prompter.prompt("test", "value");
+ assertEquals("test value: ", out.builder.toString());
+ }
+
+ @Test
+ void promptOptions() throws PrompterException {
+ final InMemoryOutput out = new InMemoryOutput();
+ final Prompter prompter = new DefaultPrompter(out, new InMemoryInput("yes"));
+ prompter.prompt("test", asList("yes", "no"), "value");
+ assertEquals("test (yes/no) value: ", out.builder.toString());
+ }
+
+ private static class InMemoryInput implements InputHandler {
+ private final String line;
+
+ private InMemoryInput(String line) {
+ this.line = requireNonNull(line);
+ }
+
+ @Override
+ public String readLine() {
+ return line;
+ }
+
+ @Override
+ public String readPassword() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public List<String> readMultipleLines() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private static class InMemoryOutput implements OutputHandler {
+ private final StringBuilder builder = new StringBuilder();
+
+ @Override
+ public void write(String line) {
+ builder.append(line);
+ }
+
+ @Override
+ public void writeLine(String line) {
+ builder.append(line);
+ }
+ }
+}
=====================================
plexus-interactivity-jline/pom.xml deleted
=====================================
@@ -1,30 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>plexus-interactivity</artifactId>
- <groupId>org.codehaus.plexus</groupId>
- <version>1.1</version>
- </parent>
-
- <artifactId>plexus-interactivity-jline</artifactId>
-
- <name>Plexus JLine Interactivity Handler</name>
-
- <dependencies>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- <version>0.9.94</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-interactivity-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
=====================================
plexus-interactivity-jline/src/main/resources/META-INF/plexus/components.xml deleted
=====================================
@@ -1,10 +0,0 @@
-<component-set>
- <components>
- <component>
- <role>org.codehaus.plexus.components.inputhandler.InputHandler</role>
- <role-hint>jline</role-hint>
- <implementation>org.codehaus.plexus.components.interactivity.jline.JLineInputHandler</implementation>
- <instantiation-strategy>per-lookup</instantiation-strategy>
- </component>
- </components>
-</component-set>
=====================================
plexus-interactivity-jline/src/site/site.xml deleted
=====================================
@@ -1,15 +0,0 @@
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
- <body>
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="JavaDocs" href="apidocs/index.html"/>
- <item name="Source Xref" href="xref/index.html"/>
- <!--item name="FAQ" href="faq.html"/-->
- </menu>
-
- <menu ref="parent"/>
- <menu ref="reports"/>
- </body>
-</project>
=====================================
pom.xml
=====================================
@@ -1,23 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>plexus-components</artifactId>
<groupId>org.codehaus.plexus</groupId>
- <version>6.5</version>
+ <artifactId>plexus</artifactId>
+ <version>16</version>
</parent>
<artifactId>plexus-interactivity</artifactId>
- <version>1.1</version>
+ <version>1.3</version>
<packaging>pom</packaging>
<name>Plexus Interactivity Handler Component</name>
+ <modules>
+ <module>plexus-interactivity-api</module>
+ </modules>
+
<scm>
<connection>${scm.url}</connection>
<developerConnection>${scm.url}</developerConnection>
+ <tag>plexus-interactivity-1.3</tag>
<url>https://github.com/codehaus-plexus/plexus-interactivity</url>
- <tag>plexus-interactivity-1.1</tag>
</scm>
<issueManagement>
<system>github</system>
@@ -32,16 +37,18 @@
<properties>
<scm.url>scm:git:https://github.com/codehaus-plexus/plexus-interactivity.git</scm.url>
- <project.build.outputTimestamp>2021-09-11T07:18:40Z</project.build.outputTimestamp>
+ <project.build.outputTimestamp>2024-02-04T16:53:38Z</project.build.outputTimestamp>
</properties>
- <modules>
- <module>plexus-interactivity-api</module>
- <module>plexus-interactivity-jline</module>
- </modules>
-
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <proc>none</proc>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
@@ -51,5 +58,4 @@
</plugin>
</plugins>
</build>
-
</project>
View it on GitLab: https://salsa.debian.org/java-team/plexus-interactivity-api/-/compare/9b98da900ab8593ae80c2d038326ad1628ec7b79...3fd963fa6c2c6309381e26e6b92db863ea67b476
--
View it on GitLab: https://salsa.debian.org/java-team/plexus-interactivity-api/-/compare/9b98da900ab8593ae80c2d038326ad1628ec7b79...3fd963fa6c2c6309381e26e6b92db863ea67b476
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20241009/7e1e5383/attachment.htm>
More information about the pkg-java-commits
mailing list