Skip to content

Commit

Permalink
WINDUP-547: Adding a tooling API in order to properly support the Ecl…
Browse files Browse the repository at this point in the history
…ipse plugin
  • Loading branch information
jsight committed Apr 15, 2015
1 parent 55ec229 commit 55b67c0
Show file tree
Hide file tree
Showing 34 changed files with 1,588 additions and 65 deletions.
17 changes: 17 additions & 0 deletions bom/pom.xml
Expand Up @@ -137,6 +137,23 @@
<version>${project.version}</version>
</dependency>

<!-- Windup Engine - Tooling API Addon -->
<dependency>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-tooling</artifactId>
<classifier>forge-addon</classifier>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-tooling-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-tooling-impl</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Windup Engine - Reporting Addon -->
<dependency>
Expand Down
8 changes: 8 additions & 0 deletions exec/api/pom.xml
Expand Up @@ -27,6 +27,14 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.windup.utils</groupId>
<artifactId>windup-utils</artifactId>
<version>${project.version}</version>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>


<!-- Furnace Container -->
<dependency>
Expand Down
@@ -1,6 +1,8 @@
package org.jboss.windup.exec.configuration;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -27,6 +29,7 @@
import org.jboss.windup.exec.configuration.options.UserIgnorePathOption;
import org.jboss.windup.exec.configuration.options.UserRulesDirectoryOption;
import org.jboss.windup.graph.GraphContext;
import org.jboss.windup.util.PathUtil;

/**
* Configuration of WindupProcessor.
Expand All @@ -45,6 +48,53 @@ public class WindupConfiguration

private GraphContext context;

public WindupConfiguration()
{
}

public void useDefaultDirectories() throws IOException
{
Path userRulesDir = PathUtil.getUserRulesDir();
if (userRulesDir != null && !Files.isDirectory(userRulesDir))
{
Files.createDirectories(userRulesDir);
}
if (userRulesDir != null)
{
addDefaultUserRulesDirectory(userRulesDir);
}

Path userIgnoreDir = PathUtil.getUserIgnoreDir();
if (userIgnoreDir != null && !Files.isDirectory(userIgnoreDir))
{
Files.createDirectories(userIgnoreDir);
}
if (userIgnoreDir != null)
{
addDefaultUserIgnorePath(userIgnoreDir);
}

Path windupHomeRulesDir = PathUtil.getWindupRulesDir();
if (windupHomeRulesDir != null && !Files.isDirectory(windupHomeRulesDir))
{
Files.createDirectories(windupHomeRulesDir);
}
if (windupHomeRulesDir != null)
{
addDefaultUserRulesDirectory(windupHomeRulesDir);
}

Path windupHomeIgnoreDir = PathUtil.getWindupIgnoreDir();
if (windupHomeIgnoreDir != null && !Files.isDirectory(windupHomeIgnoreDir))
{
Files.createDirectories(windupHomeIgnoreDir);
}
if (windupHomeIgnoreDir != null)
{
addDefaultUserIgnorePath(windupHomeIgnoreDir);
}
}

/**
* Sets a configuration option to the specified value.
*/
Expand Down
Expand Up @@ -115,7 +115,7 @@ protected FramedGraphQuery findAllQuery()
@Override
public Iterable<T> findAll()
{
return (Iterable<T>) findAllQuery().vertices(type);
return findAllQuery().vertices(type);
}

@Override
Expand All @@ -126,17 +126,17 @@ public Iterable<T> findAllByProperties(final String[] keys, final String[] vals)
@Override
public Iterable<T> execute() throws BuildException
{
FramedGraphQuery fgq = findAllQuery();
FramedGraphQuery query = findAllQuery();

for (int i = 0, j = keys.length; i < j; i++)
{
String key = keys[i];
String val = vals[i];

fgq = fgq.has(key, val);
query = query.has(key, val);
}

return fgq.vertices(type);
return query.vertices(type);
}
});
}
Expand Down Expand Up @@ -237,10 +237,10 @@ public T getUnique() throws NonUniqueResultException
return null;
}

Iterator<T> iter = results.iterator();
T result = iter.next();
Iterator<T> iterator = results.iterator();
T result = iterator.next();

if (iter.hasNext())
if (iterator.hasNext())
{
throw new NonUniqueResultException("Expected unique value, but returned non-unique.");
}
Expand All @@ -258,10 +258,10 @@ public T getUniqueByProperty(String property, Object value) throws NonUniqueResu
return null;
}

Iterator<T> iter = results.iterator();
T result = iter.next();
Iterator<T> iterator = results.iterator();
T result = iterator.next();

if (iter.hasNext())
if (iterator.hasNext())
{
throw new NonUniqueResultException("Expected unique value, but returned non-unique.");
}
Expand Down Expand Up @@ -302,8 +302,6 @@ public TitanTransaction newTransaction()

/**
* Adds the specified type to this frame, and returns a new object that implements this type.
*
* @see GraphTypeManagerTest
*/
public static <T extends WindupVertexFrame> T addTypeToModel(GraphContext graphContext, WindupVertexFrame frame,
Class<T> type)
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -79,6 +79,7 @@
<module>rules-xml</module>

<module>exec</module>
<module>tooling</module>
<module>reporting</module>
<module>rules-java-project</module>
<module>ui</module>
Expand Down
Expand Up @@ -15,9 +15,9 @@
* @author <a href="mailto:jesse.sightler@gmail.com">Jesse Sightler</a>
*
*/
public class SourceReportModelService extends GraphService<SourceReportModel>
public class SourceReportService extends GraphService<SourceReportModel>
{
public SourceReportModelService(GraphContext context)
public SourceReportService(GraphContext context)
{
super(context, SourceReportModel.class);
}
Expand Down
Expand Up @@ -5,7 +5,7 @@
import org.jboss.windup.config.GraphRewrite;
import org.jboss.windup.graph.model.resource.FileModel;
import org.jboss.windup.reporting.model.source.SourceReportModel;
import org.jboss.windup.reporting.service.SourceReportModelService;
import org.jboss.windup.reporting.service.SourceReportService;
import org.jboss.windup.util.ExecutionStatistics;

import freemarker.ext.beans.StringModel;
Expand All @@ -27,12 +27,12 @@
public class FileModelToSourceReportModelMethod implements WindupFreeMarkerMethod
{
public static final String NAME = "fileModelToSourceReport";
private SourceReportModelService sourceReportService;
private SourceReportService sourceReportService;

@Override
public void setContext(GraphRewrite event)
{
this.sourceReportService = new SourceReportModelService(event.getGraphContext());
this.sourceReportService = new SourceReportService(event.getGraphContext());
}

@Override
Expand Down
Expand Up @@ -26,7 +26,7 @@
import org.jboss.windup.reporting.query.FindSourceReportFilesGremlinCriterion;
import org.jboss.windup.reporting.service.ApplicationReportService;
import org.jboss.windup.reporting.service.ReportService;
import org.jboss.windup.reporting.service.SourceReportModelService;
import org.jboss.windup.reporting.service.SourceReportService;
import org.jboss.windup.util.Logging;
import org.ocpsoft.rewrite.config.Condition;
import org.ocpsoft.rewrite.config.Configuration;
Expand Down Expand Up @@ -68,7 +68,7 @@ public Configuration getConfiguration(GraphContext context)
{
public void perform(GraphRewrite event, EvaluationContext context, FileModel payload)
{
SourceReportModelService sourceReportModelService = new SourceReportModelService(
SourceReportService sourceReportModelService = new SourceReportService(
event.getGraphContext());
SourceReportModel sm = sourceReportModelService.create();
ReportFileModel reportFileModel = GraphService.addTypeToModel(event.getGraphContext(), payload,
Expand Down
Expand Up @@ -36,7 +36,7 @@ public class CopyJavaConfigToGraphRuleProvider extends AbstractRuleProvider
public CopyJavaConfigToGraphRuleProvider()
{
super(MetadataBuilder.forProvider(CopyJavaConfigToGraphRuleProvider.class)
.setPhase(InitializationPhase.class));
.setPhase(InitializationPhase.class).setHaltOnException(true));
}

@Override
Expand Down
117 changes: 117 additions & 0 deletions tooling/addon/pom.xml
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-tooling-parent</artifactId>
<version>2.3.0-SNAPSHOT</version>
</parent>

<artifactId>windup-tooling</artifactId>
<name>Windup Tooling - Addon</name>

<dependencies>

<!-- Local Dependencies -->
<dependency>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-tooling-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-tooling-impl</artifactId>
<optional>true</optional>
</dependency>

<!-- Addon Dependencies -->
<dependency>
<groupId>org.jboss.windup.exec</groupId>
<artifactId>windup-exec</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.windup.graph</groupId>
<artifactId>windup-graph</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.windup.config</groupId>
<artifactId>windup-config</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.windup.utils</groupId>
<artifactId>windup-utils</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.windup.reporting</groupId>
<artifactId>windup-reporting</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.windup.rules.apps</groupId>
<artifactId>windup-rules-java</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.windup.rules.apps</groupId>
<artifactId>windup-rules-java-ee</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>

<!-- Furnace Container -->
<dependency>
<groupId>org.jboss.forge.furnace.container</groupId>
<artifactId>cdi</artifactId>
<classifier>forge-addon</classifier>
<scope>provided</scope>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.jboss.forge.furnace</groupId>
<artifactId>furnace-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-dot</id>
<phase>prepare-package</phase>
<goals>
<goal>generate-dot</goal>
</goals>
<configuration>
<attach>true</attach>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>create-forge-addon</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>forge-addon</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 55b67c0

Please sign in to comment.