o remove unused eventing code

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@757611 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-03-24 00:12:22 +00:00
parent 9d05d7a835
commit c981673e9e
6 changed files with 6 additions and 140 deletions

View File

@ -39,6 +39,7 @@ import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.lifecycle.Lifecycle;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.DeprecationEventDispatcher;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
@ -106,7 +107,7 @@ public class DefaultMaven
return result;
}
EventDispatcher dispatcher = new DeprecationEventDispatcher( MavenEvents.DEPRECATIONS, request.getEventMonitors() );
EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
String event = MavenEvents.MAVEN_EXECUTION;

View File

@ -1,62 +0,0 @@
package org.apache.maven.monitor.event;
public abstract class AbstractEmbedderLifecycleMonitor
extends AbstractSelectiveEventMonitor implements MavenEmbedderLifecycleMonitor
{
public static final String[] EMBEDDER_LIFECYCLE_EVENTS = {
MavenEvents.EMBEDDER_LIFECYCLE,
MavenEvents.EMBEDDER_METHOD
};
protected AbstractEmbedderLifecycleMonitor()
{
super( EMBEDDER_LIFECYCLE_EVENTS, EMBEDDER_LIFECYCLE_EVENTS, MavenEvents.NO_EVENTS );
}
public void embedderInitialized( long timestamp )
{
}
public void embedderStopped( long timestamp )
{
}
public void embedderMethodStarted( String method, long timestamp )
{
}
public void embedderMethodEnded( String method, long timestamp )
{
}
protected void doEndEvent( String eventName,
String target,
long timestamp )
{
if ( MavenEvents.EMBEDDER_LIFECYCLE.equals( eventName ) )
{
embedderStopped( timestamp );
}
else if ( MavenEvents.EMBEDDER_METHOD.equals( eventName ) )
{
embedderMethodEnded( target, timestamp );
}
}
protected void doStartEvent( String eventName,
String target,
long timestamp )
{
if ( MavenEvents.EMBEDDER_LIFECYCLE.equals( eventName ) )
{
embedderInitialized( timestamp );
}
else if ( MavenEvents.EMBEDDER_METHOD.equals( eventName ) )
{
embedderMethodStarted( target, timestamp );
}
}
}

View File

@ -1,54 +0,0 @@
package org.apache.maven.monitor.event;
import java.util.List;
import java.util.Map;
public class DeprecationEventDispatcher
extends DefaultEventDispatcher
{
private final Map deprecatedEventsByReplacement;
public DeprecationEventDispatcher( Map deprecatedEventsByReplacement )
{
this.deprecatedEventsByReplacement = deprecatedEventsByReplacement;
}
public DeprecationEventDispatcher( Map deprecatedEventsByReplacement, List eventMonitors )
{
super( eventMonitors );
this.deprecatedEventsByReplacement = deprecatedEventsByReplacement;
}
public void dispatchEnd( String event,
String target )
{
super.dispatchEnd( event, target );
if ( deprecatedEventsByReplacement.containsKey( event ) )
{
super.dispatchEnd( (String) deprecatedEventsByReplacement.get( event ), target );
}
}
public void dispatchError( String event,
String target,
Throwable cause )
{
super.dispatchError( event, target, cause );
if ( deprecatedEventsByReplacement.containsKey( event ) )
{
super.dispatchError( (String) deprecatedEventsByReplacement.get( event ), target, cause );
}
}
public void dispatchStart( String event,
String target )
{
super.dispatchStart( event, target );
if ( deprecatedEventsByReplacement.containsKey( event ) )
{
super.dispatchStart( (String) deprecatedEventsByReplacement.get( event ), target );
}
}
}

View File

@ -1,16 +0,0 @@
package org.apache.maven.monitor.event;
public interface MavenEmbedderLifecycleMonitor
{
public void embedderInitialized( long timestamp );
public void embedderStopped( long timestamp );
public void embedderMethodStarted( String method,
long timestamp );
public void embedderMethodEnded( String method,
long timestamp );
}

View File

@ -6,17 +6,14 @@ import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.model.Repository;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.DefaultEventMonitor;
import org.apache.maven.monitor.event.DeprecationEventDispatcher;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.MavenPluginCollector;
import org.apache.maven.plugin.MavenPluginDiscoverer;
import org.apache.maven.plugin.MojoExecution;
@ -173,7 +170,8 @@ public class LifecycleExecutorTest
.setPluginGroups( Arrays.asList( new String[] { "org.apache.maven.plugins" } ) )
.setLocalRepository( localRepository )
.setRemoteRepositories( Arrays.asList( remoteRepository ) )
.setGoals( Arrays.asList( new String[] { "package" } ) )
.setGoals( Arrays.asList( new String[] { "package" } ) )
// This is wrong
.addEventMonitor( new DefaultEventMonitor( new ConsoleLogger( 0, "" ) ) )
.setProperties( new Properties() );
@ -188,7 +186,7 @@ public class LifecycleExecutorTest
ReactorManager reactorManager = new ReactorManager( projects, request.getReactorFailureBehavior() );
EventDispatcher dispatcher = new DeprecationEventDispatcher( MavenEvents.DEPRECATIONS, request.getEventMonitors() );
EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
MavenSession session = new MavenSession( getContainer(), request, reactorManager, dispatcher );
//!!jvz This is not really quite right, take a look at how this actually works.

View File

@ -31,7 +31,6 @@ import org.apache.maven.embedder.MavenEmbedderException;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.model.Profile;
import org.apache.maven.model.Repository;
import org.apache.maven.model.RepositoryPolicy;
import org.apache.maven.monitor.event.DefaultEventMonitor;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.DefaultProfileManager;