mirror of https://github.com/apache/maven.git
Forgot to remove the module package.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@227177 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b072910ab3
commit
bf93930cf9
|
@ -1,53 +0,0 @@
|
|||
package org.apache.maven.plugin.ear.module;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
/**
|
||||
* A base implementation of an {@link EarModule}.
|
||||
*
|
||||
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
|
||||
* @author $Author: sni $ (last edit)
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public abstract class AbstractEarModule
|
||||
implements EarModule
|
||||
{
|
||||
|
||||
protected static final String MODULE_ELEMENT = "module";
|
||||
|
||||
private final String uri;
|
||||
|
||||
private final Artifact artifact;
|
||||
|
||||
AbstractEarModule( String uri, Artifact a )
|
||||
{
|
||||
this.uri = uri;
|
||||
this.artifact = a;
|
||||
}
|
||||
|
||||
public Artifact getArtifact()
|
||||
{
|
||||
return artifact;
|
||||
}
|
||||
|
||||
public String getUri()
|
||||
{
|
||||
return uri;
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package org.apache.maven.plugin.ear.module;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||
|
||||
/**
|
||||
* The ear module interface.
|
||||
*
|
||||
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
|
||||
* @author $Author: sni $ (last edit)
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public interface EarModule
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns the <tt>Artifact</tt> representing this module.
|
||||
*
|
||||
* @return the <tt>Artifact</tt>
|
||||
*/
|
||||
public Artifact getArtifact();
|
||||
|
||||
/**
|
||||
* Returns the <tt>URI</tt> fo the Ear module.
|
||||
*
|
||||
* @return the <tt>URI</tt>
|
||||
*/
|
||||
public String getUri();
|
||||
|
||||
/**
|
||||
* Appends the <tt>XML</tt> representation of this module.
|
||||
*
|
||||
* @param writer the writer to use
|
||||
* @param version the version of the <tt>application.xml</tt> file
|
||||
*/
|
||||
public void appendModule( XMLWriter writer, String version );
|
||||
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package org.apache.maven.plugin.ear.module;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
/**
|
||||
* Builds an {@link EarModule} based on an <tt>Artifact</tt>.
|
||||
*
|
||||
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
|
||||
* @author $Author: sni $ (last edit)
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public final class EarModuleFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a new {@link EarModule} based on the specified <tt>Artifact</tt>.
|
||||
*
|
||||
* @param artifact the artifact
|
||||
* @return an ear module for this artifact
|
||||
*/
|
||||
public static final EarModule newEarModule( Artifact artifact )
|
||||
{
|
||||
if ( "jar".equals( artifact.getType() ) || "ejb-client".equals( artifact.getType() ) )
|
||||
{
|
||||
return new JavaModule( getUri( artifact ), artifact );
|
||||
}
|
||||
else if ( "ejb".equals( artifact.getType() ) )
|
||||
{
|
||||
return new EjbModule( getUri( artifact ), artifact );
|
||||
}
|
||||
else if ( "rar".equals( artifact.getType() ) )
|
||||
{
|
||||
return new RarModule( getUri( artifact ), artifact );
|
||||
}
|
||||
else if ( "war".equals( artifact.getType() ) )
|
||||
{
|
||||
return new WebModule( getUri( artifact ), artifact, getContextRoot( artifact ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException( "Could not handle artifact type[" + artifact.getType() + "]" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URI for the specifed <tt>Artifact</tt>.
|
||||
*
|
||||
* @param artifact the artifact
|
||||
* @return the URI of this artifact in the EAR file
|
||||
* @TODO handle custom URI - for now it returns the file name
|
||||
*/
|
||||
private static String getUri( Artifact artifact )
|
||||
{
|
||||
// FIXME: this should be in ArtifactHandler
|
||||
if ( "ejb-client".equals( artifact.getType() ) )
|
||||
{
|
||||
return artifact.getArtifactId() + "-" + artifact.getVersion() +
|
||||
"-client." + artifact.getArtifactHandler().getExtension();
|
||||
}
|
||||
else
|
||||
{
|
||||
return artifact.getFile().getName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the context root for the specifed war <tt>Artifact</tt>.
|
||||
*
|
||||
* @param artifact the artifact
|
||||
* @return the context root of the artifact
|
||||
* @TODO handle custom context root - for now it returns the artifact Id
|
||||
*/
|
||||
private static String getContextRoot( Artifact artifact )
|
||||
{
|
||||
if ( artifact.getType().equals( "war" ) )
|
||||
{
|
||||
return "/" + artifact.getArtifactId();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"Could not get context-root for an artifact with type[" + artifact.getType() + "]" );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package org.apache.maven.plugin.ear.module;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||
|
||||
/**
|
||||
* The {@link EarModule} implementation for an EJB module.
|
||||
*
|
||||
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
|
||||
* @author $Author: sni $ (last edit)
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public class EjbModule
|
||||
extends AbstractEarModule
|
||||
{
|
||||
protected static final String EJB_MODULE = "ejb";
|
||||
|
||||
EjbModule( String uri, Artifact a )
|
||||
{
|
||||
super( uri, a );
|
||||
}
|
||||
|
||||
public void appendModule( XMLWriter writer, String version )
|
||||
{
|
||||
writer.startElement( MODULE_ELEMENT );
|
||||
writer.startElement( EJB_MODULE );
|
||||
writer.writeText( getUri() );
|
||||
writer.endElement();
|
||||
writer.endElement();
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package org.apache.maven.plugin.ear.module;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||
|
||||
/**
|
||||
* The {@link EarModule} implementation for a J2EE client module.
|
||||
*
|
||||
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
|
||||
* @author $Author: sni $ (last edit)
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public class JavaModule
|
||||
extends AbstractEarModule
|
||||
{
|
||||
protected static final String JAVA_MODULE = "java";
|
||||
|
||||
JavaModule( String uri, Artifact a )
|
||||
{
|
||||
super( uri, a );
|
||||
}
|
||||
|
||||
public void appendModule( XMLWriter writer, String version )
|
||||
{
|
||||
writer.startElement( MODULE_ELEMENT );
|
||||
writer.startElement( JAVA_MODULE );
|
||||
writer.writeText( getUri() );
|
||||
writer.endElement();
|
||||
writer.endElement();
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package org.apache.maven.plugin.ear.module;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||
|
||||
/**
|
||||
* The {@link EarModule} implementation for an J2EE connector module.
|
||||
*
|
||||
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
|
||||
* @author $Author: sni $ (last edit)
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public class RarModule
|
||||
extends AbstractEarModule
|
||||
{
|
||||
protected static final String RAR_MODULE = "connector";
|
||||
|
||||
RarModule( String uri, Artifact a )
|
||||
{
|
||||
super( uri, a );
|
||||
}
|
||||
|
||||
public void appendModule( XMLWriter writer, String version )
|
||||
{
|
||||
writer.startElement( MODULE_ELEMENT );
|
||||
writer.startElement( RAR_MODULE );
|
||||
writer.writeText( getUri() );
|
||||
writer.endElement();
|
||||
writer.endElement();
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package org.apache.maven.plugin.ear.module;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||
|
||||
/**
|
||||
* The {@link EarModule} implementation for an Web application module.
|
||||
*
|
||||
* @author Stephane Nicoll <stephane.nicoll@gmail.com>
|
||||
* @author $Author: sni $ (last edit)
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
public class WebModule
|
||||
extends AbstractEarModule
|
||||
{
|
||||
protected static final String WEB_MODULE = "web";
|
||||
|
||||
protected static final String WEB_URI_FIELD = "web-uri";
|
||||
|
||||
protected static final String CONTEXT_ROOT_FIELD = "context-root";
|
||||
|
||||
private final String contextRoot;
|
||||
|
||||
WebModule( String uri, Artifact a, String contextRoot )
|
||||
{
|
||||
super( uri, a );
|
||||
this.contextRoot = contextRoot;
|
||||
}
|
||||
|
||||
public void appendModule( XMLWriter writer, String version )
|
||||
{
|
||||
writer.startElement( MODULE_ELEMENT );
|
||||
writer.startElement( WEB_MODULE );
|
||||
writer.startElement( WEB_URI_FIELD );
|
||||
writer.writeText( getUri() );
|
||||
writer.endElement(); // web-uri
|
||||
writer.startElement( CONTEXT_ROOT_FIELD );
|
||||
writer.writeText( getContextRoot() );
|
||||
writer.endElement(); // context-root
|
||||
writer.endElement(); // web
|
||||
writer.endElement(); // module
|
||||
}
|
||||
|
||||
public String getContextRoot()
|
||||
{
|
||||
return contextRoot;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue