Skip to content

Commit

Permalink
JSR330 Replace plexus-container-default with javax.annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
slachiewicz committed May 28, 2023
1 parent 5dfa486 commit 6744041
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
8 changes: 6 additions & 2 deletions plexus-interactivity-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
<version>5.9.3</version>
<scope>test</scope>
</dependency>
<!--
| @PostConstruct and @PreDestroy help with Plexus->JSR330 migration
-->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
* SOFTWARE.
*/

import org.codehaus.plexus.logging.AbstractLogEnabled;

import java.util.List;
import java.util.ArrayList;
import java.io.IOException;
Expand All @@ -37,7 +35,6 @@
* @version $Id$
*/
public abstract class AbstractInputHandler
extends AbstractLogEnabled
implements InputHandler
{
public List<String> readMultipleLines()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
* SOFTWARE.
*/

import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;

import javax.annotation.PostConstruct;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Expand All @@ -39,7 +37,6 @@
*/
public class DefaultInputHandler
extends AbstractInputHandler
implements Initializable
{
private BufferedReader consoleReader;

Expand All @@ -55,8 +52,8 @@ public String readPassword()
return consoleReader.readLine();
}

@PostConstruct
public void initialize()
throws InitializationException
{
consoleReader = new BufferedReader( new InputStreamReader( System.in ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
* SOFTWARE.
*/

import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.PrintWriter;

Expand All @@ -37,12 +35,12 @@
* @version $Id$
*/
public class DefaultOutputHandler
implements Initializable, OutputHandler
implements OutputHandler
{
private PrintWriter consoleWriter;

@PostConstruct
public void initialize()
throws InitializationException
{
consoleWriter = new PrintWriter( System.out );
}
Expand Down
8 changes: 6 additions & 2 deletions plexus-interactivity-jline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
<artifactId>plexus-interactivity-api</artifactId>
<version>${project.version}</version>
</dependency>
<!--
| @PostConstruct and @PreDestroy help with Plexus->JSR330 migration
-->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@

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.annotation.PostConstruct;
import java.io.IOException;

/**
Expand All @@ -39,7 +38,6 @@
*/
public class JLineInputHandler
extends AbstractInputHandler
implements Initializable
{
private ConsoleReader consoleReader;

Expand All @@ -55,16 +53,16 @@ public String readPassword()
return consoleReader.readLine( new Character( '*' ) );
}

@PostConstruct
public void initialize()
throws InitializationException
{
try
{
consoleReader = new ConsoleReader();
}
catch ( IOException e )
{
throw new InitializationException( "Cannot create console reader: ", e );
throw new IllegalStateException( "Cannot create console reader: ", e );
}
}
}

0 comments on commit 6744041

Please sign in to comment.