Specify generic arguments
This commit is contained in:
@@ -67,7 +67,7 @@ public class CalabashHelper {
|
|||||||
final InputStream paramsStream = new ByteArrayInputStream(params.getBytes());
|
final InputStream paramsStream = new ByteArrayInputStream(params.getBytes());
|
||||||
|
|
||||||
//System.out.println("~!~!~!~!~!~!~!~!~!Sending: \n"+params+"\n");
|
//System.out.println("~!~!~!~!~!~!~!~!~!Sending: \n"+params+"\n");
|
||||||
List<PipelineInput> pipelineInputs = new ArrayList<PipelineInput>() {{
|
List<PipelineInput<?>> pipelineInputs = new ArrayList<PipelineInput<?>>() {{
|
||||||
add(PipelineInput.port("source", inputSource));
|
add(PipelineInput.port("source", inputSource));
|
||||||
add(PipelineInput.port("parameters", new InputSource(paramsStream)));
|
add(PipelineInput.port("parameters", new InputSource(paramsStream)));
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.rackspace.cloud.api.docs;
|
package com.rackspace.cloud.api.docs;
|
||||||
|
|
||||||
|
import com.agilejava.docbkx.maven.Entity;
|
||||||
|
import com.agilejava.docbkx.maven.Parameter;
|
||||||
import javax.xml.transform.*;
|
import javax.xml.transform.*;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
import javax.xml.transform.stream.StreamSource;
|
import javax.xml.transform.stream.StreamSource;
|
||||||
@@ -14,6 +16,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.tools.ant.Target;
|
import org.apache.tools.ant.Target;
|
||||||
import org.xml.sax.XMLReader;
|
import org.xml.sax.XMLReader;
|
||||||
@@ -55,7 +58,7 @@ public abstract class EpubMojo
|
|||||||
* @required
|
* @required
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
List artifacts;
|
List<Artifact> artifacts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ant tasks to be executed before the transformation. Comparable
|
* Ant tasks to be executed before the transformation. Comparable
|
||||||
@@ -88,7 +91,7 @@ public abstract class EpubMojo
|
|||||||
*
|
*
|
||||||
* @parameter
|
* @parameter
|
||||||
*/
|
*/
|
||||||
private List entities;
|
private List<Entity> entities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of additional XSL parameters to give to the XSLT engine.
|
* A list of additional XSL parameters to give to the XSLT engine.
|
||||||
@@ -101,7 +104,7 @@ public abstract class EpubMojo
|
|||||||
*
|
*
|
||||||
* @parameter
|
* @parameter
|
||||||
*/
|
*/
|
||||||
private List customizationParameters;
|
private List<Parameter> customizationParameters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of additional System properties.
|
* List of additional System properties.
|
||||||
@@ -4289,11 +4292,11 @@ public abstract class EpubMojo
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getEntities() {
|
public List<Entity> getEntities() {
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getCustomizationParameters()
|
public List<Parameter> getCustomizationParameters()
|
||||||
{
|
{
|
||||||
return customizationParameters;
|
return customizationParameters;
|
||||||
}
|
}
|
||||||
@@ -4315,7 +4318,7 @@ public abstract class EpubMojo
|
|||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getArtifacts() {
|
public List<Artifact> getArtifacts() {
|
||||||
return artifacts;
|
return artifacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class FileUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void extractJaredDirectory (String directory, Class jarSrc,
|
public static void extractJaredDirectory (String directory, Class<?> jarSrc,
|
||||||
File dest)
|
File dest)
|
||||||
throws MojoExecutionException {
|
throws MojoExecutionException {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public abstract class HTMLMojo extends AbstractHtmlMojo {
|
|||||||
String pathToPipelineFile = "classpath:///wadl2html.xpl"; //use "classpath:///path" for this to work
|
String pathToPipelineFile = "classpath:///wadl2html.xpl"; //use "classpath:///path" for this to work
|
||||||
Source source = super.createSource(inputFilename, sourceFile, filter);
|
Source source = super.createSource(inputFilename, sourceFile, filter);
|
||||||
|
|
||||||
Map map=new HashMap<String, String>();
|
Map<String, Object> map=new HashMap<String, Object>();
|
||||||
|
|
||||||
map.put("security", security);
|
map.put("security", security);
|
||||||
map.put("canonicalUrlBase", canonicalUrlBase);
|
map.put("canonicalUrlBase", canonicalUrlBase);
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import org.xml.sax.SAXException;
|
|||||||
import org.xml.sax.XMLReader;
|
import org.xml.sax.XMLReader;
|
||||||
|
|
||||||
import com.agilejava.docbkx.maven.CachingTransformerBuilder;
|
import com.agilejava.docbkx.maven.CachingTransformerBuilder;
|
||||||
|
import com.agilejava.docbkx.maven.Entity;
|
||||||
import com.agilejava.docbkx.maven.ExpressionHandler;
|
import com.agilejava.docbkx.maven.ExpressionHandler;
|
||||||
import com.agilejava.docbkx.maven.InjectingEntityResolver;
|
import com.agilejava.docbkx.maven.InjectingEntityResolver;
|
||||||
import com.agilejava.docbkx.maven.NullWriter;
|
import com.agilejava.docbkx.maven.NullWriter;
|
||||||
@@ -134,8 +135,8 @@ public class PDFBuilder {
|
|||||||
* @parameter
|
* @parameter
|
||||||
*/
|
*/
|
||||||
private String foCustomization;
|
private String foCustomization;
|
||||||
private List customizationParameters = new ArrayList();
|
private List<Parameter> customizationParameters = new ArrayList<Parameter>();
|
||||||
private List entities;
|
private List<Entity> entities;
|
||||||
|
|
||||||
|
|
||||||
private Log log = null;
|
private Log log = null;
|
||||||
@@ -776,10 +777,10 @@ public class PDFBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List getEntities() {
|
public List<Entity> getEntities() {
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
public void setEntities(List entities) {
|
public void setEntities(List<Entity> entities) {
|
||||||
this.entities = entities;
|
this.entities = entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,14 +847,14 @@ public class PDFBuilder {
|
|||||||
final String catalog = catalogs[i];
|
final String catalog = catalogs[i];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Enumeration enumeration = classLoader.getResources(catalog);
|
Enumeration<URL> enumeration = classLoader.getResources(catalog);
|
||||||
while (enumeration.hasMoreElements()) {
|
while (enumeration.hasMoreElements()) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
builder.append(';');
|
builder.append(';');
|
||||||
} else {
|
} else {
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
URL resource = (URL) enumeration.nextElement();
|
URL resource = enumeration.nextElement();
|
||||||
builder.append(resource.toExternalForm());
|
builder.append(resource.toExternalForm());
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
@@ -968,9 +969,9 @@ public class PDFBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (getCustomizationParameters() != null) {
|
if (getCustomizationParameters() != null) {
|
||||||
final Iterator iterator = getCustomizationParameters().iterator();
|
final Iterator<Parameter> iterator = getCustomizationParameters().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Parameter param = (Parameter) iterator.next();
|
Parameter param = iterator.next();
|
||||||
if (param.getName() != null) // who knows
|
if (param.getName() != null) // who knows
|
||||||
{
|
{
|
||||||
transformer.setParameter(param.getName(), param.getValue());
|
transformer.setParameter(param.getName(), param.getValue());
|
||||||
@@ -1024,7 +1025,7 @@ public class PDFBuilder {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getCustomizationParameters()
|
public List<Parameter> getCustomizationParameters()
|
||||||
{
|
{
|
||||||
return customizationParameters;
|
return customizationParameters;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ public abstract class AbstractPipeline implements Pipeline {
|
|||||||
|
|
||||||
protected abstract <T>void addOption(PipelineInput<T> input);
|
protected abstract <T>void addOption(PipelineInput<T> input);
|
||||||
|
|
||||||
protected void handleInputs(PipelineInput... inputs) {
|
protected void handleInputs(PipelineInput<?>... inputs) {
|
||||||
handleInputs(Arrays.asList(inputs));
|
handleInputs(Arrays.asList(inputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleInputs(List<PipelineInput> inputs) {
|
protected void handleInputs(List<PipelineInput<?>> inputs) {
|
||||||
for (PipelineInput input: inputs) {
|
for (PipelineInput<?> input: inputs) {
|
||||||
switch (input.getType()) {
|
switch (input.getType()) {
|
||||||
case PORT:
|
case PORT:
|
||||||
addPort(input);
|
addPort(input);
|
||||||
@@ -64,13 +64,13 @@ public abstract class AbstractPipeline implements Pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clearParameters(PipelineInput... inputs) {
|
protected void clearParameters(PipelineInput<?>... inputs) {
|
||||||
clearParameters(Arrays.asList(inputs));
|
clearParameters(Arrays.asList(inputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clearParameters(List<PipelineInput> inputs) {
|
protected void clearParameters(List<PipelineInput<?>> inputs) {
|
||||||
|
|
||||||
for (PipelineInput input: inputs) {
|
for (PipelineInput<?> input: inputs) {
|
||||||
switch (input.getType()) {
|
switch (input.getType()) {
|
||||||
case PARAMETER:
|
case PARAMETER:
|
||||||
clearParameter(input);
|
clearParameter(input);
|
||||||
@@ -82,7 +82,7 @@ public abstract class AbstractPipeline implements Pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(PipelineInput... inputs) {
|
public void run(PipelineInput<?>... inputs) {
|
||||||
run(Arrays.asList(inputs));
|
run(Arrays.asList(inputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class CalabashPipeline extends AbstractPipeline implements Pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addOption(PipelineInput input) {
|
protected <T> void addOption(PipelineInput<T> input) {
|
||||||
pipeline.setOption(new QName(input.getName()), getRuntimeValue(input));
|
pipeline.setOption(new QName(input.getName()), getRuntimeValue(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ public class CalabashPipeline extends AbstractPipeline implements Pipeline {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(List<PipelineInput> inputs) {
|
public void run(List<PipelineInput<?>> inputs) {
|
||||||
try {
|
try {
|
||||||
reset();
|
reset();
|
||||||
handleInputs(inputs);
|
handleInputs(inputs);
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ public interface Pipeline {
|
|||||||
|
|
||||||
List<Source> getResultPort(String name);
|
List<Source> getResultPort(String name);
|
||||||
|
|
||||||
void run(List<PipelineInput> inputs) throws PipelineException;
|
void run(List<PipelineInput<?>> inputs) throws PipelineException;
|
||||||
|
|
||||||
void run(PipelineInput... inputs);
|
void run(PipelineInput<?>... inputs);
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ public class PipelineInput<T> {
|
|||||||
private final PipelineInputType type;
|
private final PipelineInputType type;
|
||||||
private final T source;
|
private final T source;
|
||||||
|
|
||||||
public static <P> PipelineInput parameter(String name, P source) {
|
public static <P> PipelineInput<P> parameter(String name, P source) {
|
||||||
return new PipelineInput<P>(name, PipelineInputType.PARAMETER, source);
|
return new PipelineInput<P>(name, PipelineInputType.PARAMETER, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <P> PipelineInput port(String name, P source) {
|
public static <P> PipelineInput<P> port(String name, P source) {
|
||||||
return new PipelineInput<P>(name, PipelineInputType.PORT, source);
|
return new PipelineInput<P>(name, PipelineInputType.PORT, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <P> PipelineInput option(String name, P source) {
|
public static <P> PipelineInput<P> option(String name, P source) {
|
||||||
return new PipelineInput<P>(name, PipelineInputType.OPTION, source);
|
return new PipelineInput<P>(name, PipelineInputType.OPTION, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user