You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2011/08/13 01:02:15 UTC
svn commit: r1157286 [2/2] - in /maven/sandbox/trunk/mae:
mae-api/src/main/java/org/apache/maven/mae/
mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/
mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/proje...
Added: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/ProjectKey.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/ProjectKey.java?rev=1157286&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/ProjectKey.java (added)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/ProjectKey.java Fri Aug 12 23:02:14 2011
@@ -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.
+ */
+
+package org.apache.maven.mae.project.key;
+
+public interface ProjectKey
+{
+
+ String getGroupId();
+
+ String getArtifactId();
+
+ String getId();
+
+}
Propchange: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/ProjectKey.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/VersionlessProjectKey.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/VersionlessProjectKey.java?rev=1157286&view=auto
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/VersionlessProjectKey.java (added)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/VersionlessProjectKey.java Fri Aug 12 23:02:14 2011
@@ -0,0 +1,184 @@
+/*
+ * 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.
+ */
+
+package org.apache.maven.mae.project.key;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+
+public class VersionlessProjectKey
+ implements Comparable<ProjectKey>, ProjectKey
+{
+ private final String groupId;
+
+ private final String artifactId;
+
+ public VersionlessProjectKey( final String groupId, final String artifactId )
+ {
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ }
+
+ public VersionlessProjectKey( final Dependency dep )
+ {
+ groupId = dep.getGroupId();
+ artifactId = dep.getArtifactId();
+ }
+
+ public VersionlessProjectKey( final Plugin plugin )
+ {
+ groupId = plugin.getGroupId();
+ artifactId = plugin.getArtifactId();
+ }
+
+ public VersionlessProjectKey( final Parent parent )
+ {
+ groupId = parent.getGroupId();
+ artifactId = parent.getArtifactId();
+ }
+
+ public VersionlessProjectKey( final String ga )
+ {
+ String[] parts = ga.split( ":" );
+ if ( parts.length < 2 )
+ {
+ throw new IllegalArgumentException( "Invalid versionless POM key: '" + ga + "'" );
+ }
+
+ groupId = parts[0].trim();
+ artifactId = parts[1].trim();
+ }
+
+ public VersionlessProjectKey( final ReportPlugin plugin )
+ {
+ groupId = plugin.getGroupId();
+ artifactId = plugin.getArtifactId();
+ }
+
+ public VersionlessProjectKey( final ProjectKey tk )
+ {
+ groupId = tk.getGroupId();
+ artifactId = tk.getArtifactId();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see com.redhat.rcm.version.model.ProjectKey#getGroupId()
+ */
+ @Override
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see com.redhat.rcm.version.model.ProjectKey#getArtifactId()
+ */
+ @Override
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
+ result = prime * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
+ return result;
+ }
+
+ @Override
+ public boolean equals( final Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( obj == null )
+ {
+ return false;
+ }
+ if ( getClass() != obj.getClass() )
+ {
+ return false;
+ }
+ final VersionlessProjectKey other = (VersionlessProjectKey) obj;
+ if ( artifactId == null )
+ {
+ if ( other.artifactId != null )
+ {
+ return false;
+ }
+ }
+ else if ( !artifactId.equals( other.artifactId ) )
+ {
+ return false;
+ }
+ if ( groupId == null )
+ {
+ if ( other.groupId != null )
+ {
+ return false;
+ }
+ }
+ else if ( !groupId.equals( other.groupId ) )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getId();
+ }
+
+ @Override
+ public int compareTo( final ProjectKey other )
+ {
+ if ( other == null )
+ {
+ return -1;
+ }
+
+ int comp = getGroupId().compareTo( other.getGroupId() );
+ if ( comp == 0 )
+ {
+ comp = getArtifactId().compareTo( other.getArtifactId() );
+ }
+
+ return comp;
+ }
+
+ @Override
+ public String getId()
+ {
+ return groupId + ":" + artifactId;
+ }
+
+}
Propchange: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/key/VersionlessProjectKey.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java Fri Aug 12 23:02:14 2011
@@ -1,21 +1,28 @@
/*
- * Copyright 2011 Red Hat, Inc.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.
*/
package org.apache.maven.mae.project.session;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.log4j.Logger;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -36,10 +43,6 @@ import org.sonatype.aether.repository.Pr
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
@Component( role = SessionInjector.class )
public class DefaultSessionInjector
implements SessionInjector
@@ -63,8 +66,7 @@ public class DefaultSessionInjector
if ( pbr == null )
{
pbr =
- embedder.serviceManager()
- .createProjectBuildingRequest( session.getTemplateProjectBuildingRequest() );
+ embedder.serviceManager().createProjectBuildingRequest( session.getTemplateProjectBuildingRequest() );
pbr.setValidationLevel( session.getPomValidationLevel() );
pbr.setProcessPlugins( session.isProcessPomPlugins() );
@@ -75,8 +77,7 @@ public class DefaultSessionInjector
final RepositorySystemSession rss = getRepositorySystemSession( session );
pbr.setRepositorySession( rss );
- pbr.setLocalRepository( mavenRepositorySystem.createLocalRepository( rss.getLocalRepository()
- .getBasedir() ) );
+ pbr.setLocalRepository( mavenRepositorySystem.createLocalRepository( rss.getLocalRepository().getBasedir() ) );
pbr.setRemoteRepositories( getArtifactRepositories( session ) );
session.setProjectBuildingRequest( pbr );
@@ -93,8 +94,7 @@ public class DefaultSessionInjector
}
catch ( final InvalidRepositoryException e )
{
- throw new ProjectToolsException( "Failed to create local-repository instance. Reason: %s",
- e,
+ throw new ProjectToolsException( "Failed to create local-repository instance. Reason: %s", e,
e.getMessage() );
}
@@ -111,8 +111,8 @@ public class DefaultSessionInjector
if ( sess == null )
{
final DefaultRepositorySystemSession rss =
- new DefaultRepositorySystemSession( embedder.serviceManager()
- .createAetherRepositorySystemSession( session.getExecutionRequest() ) );
+ new DefaultRepositorySystemSession(
+ embedder.serviceManager().createAetherRepositorySystemSession( session.getExecutionRequest() ) );
// session.setWorkspaceReader( new ImportWorkspaceReader( workspace ) );
rss.setConfigProperty( ProjectToolsSession.SESSION_KEY, session );
@@ -211,10 +211,9 @@ public class DefaultSessionInjector
}
catch ( final InvalidRepositoryException e )
{
- throw new ProjectToolsException( "Failed to create remote artifact repository instance from: %s\nReason: %s",
- e,
- repo,
- e.getMessage() );
+ throw new ProjectToolsException(
+ "Failed to create remote artifact repository instance from: %s\nReason: %s",
+ e, repo, e.getMessage() );
}
}
}
@@ -225,8 +224,7 @@ public class DefaultSessionInjector
}
catch ( final InvalidRepositoryException e )
{
- throw new ProjectToolsException( "Failed to create default (central) repository instance: %s",
- e,
+ throw new ProjectToolsException( "Failed to create default (central) repository instance: %s", e,
e.getMessage() );
}
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/ProjectToolsSession.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/ProjectToolsSession.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/ProjectToolsSession.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/ProjectToolsSession.java Fri Aug 12 23:02:14 2011
@@ -1,23 +1,31 @@
/*
- * Copyright 2011 Red Hat, Inc.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.
*/
package org.apache.maven.mae.project.session;
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.mae.project.event.EventDispatcher;
import org.apache.maven.model.Repository;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;
@@ -27,10 +35,6 @@ import org.sonatype.aether.collection.De
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.repository.RemoteRepository;
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
public interface ProjectToolsSession
{
@@ -109,4 +113,8 @@ public interface ProjectToolsSession
ProjectBuildingRequest getTemplateProjectBuildingRequest();
+ <E> EventDispatcher<E> getEventDispatcher( Class<E> eventType );
+
+ <E> ProjectToolsSession setEventDispatcher( Class<E> eventType, EventDispatcher<E> dispatcher );
+
}
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionInjector.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionInjector.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionInjector.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionInjector.java Fri Aug 12 23:02:14 2011
@@ -1,21 +1,26 @@
/*
- * Copyright 2011 Red Hat, Inc.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.
*/
package org.apache.maven.mae.project.session;
+import java.util.List;
+
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.mae.MAEException;
import org.apache.maven.mae.project.ProjectToolsException;
@@ -23,8 +28,6 @@ import org.apache.maven.project.ProjectB
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
-import java.util.List;
-
/**
*
*/
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionWorkspaceReader.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionWorkspaceReader.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionWorkspaceReader.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SessionWorkspaceReader.java Fri Aug 12 23:02:14 2011
@@ -1,30 +1,33 @@
/*
- * Copyright 2011 Red Hat, Inc.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.
*/
package org.apache.maven.mae.project.session;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.maven.project.MavenProject;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.repository.WorkspaceRepository;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
public class SessionWorkspaceReader
implements WorkspaceReader
{
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SimpleProjectToolsSession.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SimpleProjectToolsSession.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SimpleProjectToolsSession.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/SimpleProjectToolsSession.java Fri Aug 12 23:02:14 2011
@@ -1,25 +1,37 @@
/*
- * Copyright 2011 Red Hat, Inc.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.
*/
package org.apache.maven.mae.project.session;
import static org.apache.maven.artifact.ArtifactUtils.key;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.mae.project.event.EventDispatcher;
import org.apache.maven.model.Repository;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.project.DefaultProjectBuildingRequest;
@@ -32,14 +44,6 @@ import org.sonatype.aether.graph.Depende
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
public class SimpleProjectToolsSession
implements ProjectToolsSession
{
@@ -444,6 +448,7 @@ public class SimpleProjectToolsSession
return this;
}
+ @Override
@SuppressWarnings( "unchecked" )
public <T> T setState( final T state )
{
@@ -455,17 +460,20 @@ public class SimpleProjectToolsSession
return null;
}
+ @Override
public void clearStates()
{
states.clear();
}
+ @Override
@SuppressWarnings( "unchecked" )
public <T> T clearState( final Class<T> type )
{
return (T) states.remove( type );
}
+ @Override
public <T> T getState( final Class<T> type )
{
final Object state = states.get( type );
@@ -488,6 +496,7 @@ public class SimpleProjectToolsSession
return pomValidationLevel;
}
+ @Override
public ProjectToolsSession setPomValidationLevel( final int pomValidationLevel )
{
this.pomValidationLevel = pomValidationLevel;
@@ -511,4 +520,20 @@ public class SimpleProjectToolsSession
return this;
}
+ private final Map<Class<?>, EventDispatcher<?>> eventDispatchers = new HashMap<Class<?>, EventDispatcher<?>>();
+
+ @SuppressWarnings( "unchecked" )
+ @Override
+ public <E> EventDispatcher<E> getEventDispatcher( final Class<E> eventType )
+ {
+ return (EventDispatcher<E>) eventDispatchers.get( eventType );
+ }
+
+ @Override
+ public <E> ProjectToolsSession setEventDispatcher( final Class<E> eventType, final EventDispatcher<E> dispatcher )
+ {
+ eventDispatchers.put( eventType, dispatcher );
+ return this;
+ }
+
}
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/repository/internal/ConfigurableArtifactDescriptorReader.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/repository/internal/ConfigurableArtifactDescriptorReader.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/repository/internal/ConfigurableArtifactDescriptorReader.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/repository/internal/ConfigurableArtifactDescriptorReader.java Fri Aug 12 23:02:14 2011
@@ -1,22 +1,4 @@
/*
- * Copyright 2011 Red Hat, Inc.
- *
- * Licensed 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.
- */
-
-package org.apache.maven.repository.internal;
-
-/*
* 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
@@ -24,9 +6,9 @@ package org.apache.maven.repository.inte
* 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
- *
+ *
+ * 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
@@ -35,6 +17,17 @@ package org.apache.maven.repository.inte
* under the License.
*/
+package org.apache.maven.repository.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
import org.apache.maven.mae.project.session.ProjectToolsSession;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.DistributionManagement;
@@ -88,15 +81,6 @@ import org.sonatype.aether.util.artifact
import org.sonatype.aether.util.artifact.DefaultArtifactType;
import org.sonatype.aether.util.listener.DefaultRepositoryEvent;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
/**
* @author Benjamin Bentmann
*/
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/ProjectLoaderTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/ProjectLoaderTest.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/ProjectLoaderTest.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/ProjectLoaderTest.java Fri Aug 12 23:02:14 2011
@@ -1,17 +1,20 @@
/*
- * Copyright 2011 Red Hat, Inc.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.
*/
package org.apache.maven.mae.project;
@@ -19,17 +22,16 @@ package org.apache.maven.mae.project;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import org.apache.maven.mae.project.ProjectLoader;
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
import org.apache.maven.mae.project.testutil.TestFixture;
import org.apache.maven.project.MavenProject;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
public class ProjectLoaderTest
{
Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/testutil/TestFixture.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/testutil/TestFixture.java?rev=1157286&r1=1157285&r2=1157286&view=diff
==============================================================================
--- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/testutil/TestFixture.java (original)
+++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/test/java/org/apache/maven/mae/project/testutil/TestFixture.java Fri Aug 12 23:02:14 2011
@@ -1,21 +1,35 @@
/*
- * Copyright 2011 Red Hat, Inc.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.
*/
package org.apache.maven.mae.project.testutil;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
import org.apache.commons.io.FileUtils;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
@@ -47,17 +61,6 @@ import org.codehaus.plexus.component.ann
import org.codehaus.plexus.component.annotations.Requirement;
import org.junit.Assert;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
@Component( role = TestFixture.class )
public final class TestFixture
extends AbstractMAEApplication