org.jomc.mojo
Class JomcResourceTransformer

Package class diagram package JomcResourceTransformer
java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.jomc.mojo.JomcResourceTransformer
All Implemented Interfaces:
ResourceTransformer, org.codehaus.plexus.logging.LogEnabled

public class JomcResourceTransformer
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements ResourceTransformer

Maven Shade Plugin ResourceTransformer implementation for shading JOMC resources.

Maven Shade Plugin Usage

 <transformer implementation="org.jomc.mojo.JomcResourceTransformer">
   <model>http://jomc.org/model</model>
   <modelContextFactoryClassName>class name</modelContextFactoryClassName>
     <modelContextAttributes>
       <modelContextAttribute>
         <key>The name of the attribute</key>
         <value>The name of the attribute</value>
         <type>The name of the class of the object.</type>
       </modelContextAttribute>
     </modelContextAttributes/>
   <moduleEncoding>${project.build.sourceEncoding}</moduleEncoding>
   <moduleName>${project.name}</moduleName>
   <moduleVersion>${project.version}</moduleVersion>
   <moduleVendor>${project.organization.name}</moduleVendor>
   <moduleResource>META-INF/custom-jomc.xml</moduleResource>
   <moduleResources>
     <moduleResource>META-INF/jomc.xml</moduleResource>
   </moduleResources>
   <moduleIncludes>
     <moduleInclude>module name</moduleInclude>
   </moduleIncludes>
   <moduleExcludes>
     <moduleExclude>module name</moduleExclude>
   </moduleExcludes>
   <modletEncoding>${project.build.sourceEncoding}</modletEncoding>
   <modletName>${project.name}</modletName>
   <modletVersion>${project.version}</modletVersion>
   <modletVendor>${project.organization.name}</modletVendor>
   <modletResource>META-INF/custom-jomc-modlet.xml</modletResource>
   <modletResources>
     <modletResource>META-INF/jomc-modlet.xml</modletResource>
   </modletResources>
   <modletIncludes>
     <modletInclude>modlet name</modletInclude>
   </modletIncludes>
   <modletExcludes>
     <modletExclude>modlet name</modletExclude>
   </modletExcludes>
   <modelObjectStylesheet>Location of a XSLT document to use for transforming the merged model document.</modelObjectStylesheet>
   <modletObjectStylesheet>Location of a XSLT document to use for transforming the merged modlet document.</modletObjectStylesheet>
   <providerLocation>META-INF/custom-services</providerLocation>
   <platformProviderLocation>${java.home}/jre/lib/custom-jomc.properties</platformProviderLocation>
   <modletLocation>META-INF/custom-jomc-modlet.xml</modletLocation>
   <modletSchemaSystemId>http://custom.host.tld/custom/path/jomc-modlet-1.2.xsd</modletSchemaSystemId>
 </transformer>
 

Version:
$JOMC: JomcResourceTransformer.java 4200 2012-01-25 09:46:13Z schulte2005 $
Author:
Christian Schulte
Plexus component:
role:
"org.apache.maven.plugins.shade.resource.ResourceTransformer"
role-hint:
"JOMC"

Constructor Summary
JomcResourceTransformer()
          Creates a new JomcResourceTransformer instance.
 
Method Summary
 boolean canTransformResource(String arg)
           
protected  URL getResource(String location)
          Creates an URL for a given resource location.
 boolean hasTransformedResource()
           
 void modifyOutputStream(JarOutputStream out)
           
 void processResource(InputStream in)
           
 void processResource(String name, InputStream in, List relocators)
           
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JomcResourceTransformer

public JomcResourceTransformer()
Creates a new JomcResourceTransformer instance.

Method Detail

canTransformResource

public boolean canTransformResource(String arg)
Specified by:
canTransformResource in interface ResourceTransformer

processResource

public void processResource(InputStream in)
                     throws IOException
Throws:
IOException

processResource

public void processResource(String name,
                            InputStream in,
                            List relocators)
                     throws IOException
Specified by:
processResource in interface ResourceTransformer
Throws:
IOException

hasTransformedResource

public boolean hasTransformedResource()
Specified by:
hasTransformedResource in interface ResourceTransformer

modifyOutputStream

public void modifyOutputStream(JarOutputStream out)
                        throws IOException
Specified by:
modifyOutputStream in interface ResourceTransformer
Throws:
IOException

getResource

protected URL getResource(String location)
                   throws IOException
Creates an URL for a given resource location.

This method first searches the class loader of the class for a single resource matching location. If such a resource is found, the URL of that resource is returned. If no such resource is found, an attempt is made to parse the given location to an URL. On successful parsing, that URL is returned. Failing that, the given location is interpreted as a file name. If that file is found, the URL of that file is returned. Otherwise an IOException is thrown.

Parameters:
location - The location to create an URL from.
Returns:
An URL for location.
Throws:
NullPointerException - if location is null.
IOException - if creating an URL fails.
Since:
1.2


Copyright © 2005-2012 The JOMC Project. All Rights Reserved.Get JOMC at SourceForge.net. Fast, secure and Free Open Source software downloads
Please note that this documentation is maintained by non-native english speaking authors. As such, you may encounter phrases or wordings which seem imprecise or may even have a totally different meaning to native english speaking readers than what the individual author was trying to express. If you are a native english speaking reader and find any such phrases or wordings we kindly ask you to send an email to the corresponding author and help us improve this documentation in order to avoid misunderstandings. You will find the authors' email addresses at the top of each class. Please accept our apologies for any inconvenience caused.