Skip to content

Commit

Permalink
WINDUP-707 - Fixed properties file to layer on top instead of referen…
Browse files Browse the repository at this point in the history
…ce the underlying file. Fixed import statement in Variables. Set Manifest and Properties to generate source.
  • Loading branch information
bradsdavis committed Aug 4, 2015
1 parent ceb5e40 commit d4b49f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
Expand Up @@ -11,7 +11,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;

Expand Down
Expand Up @@ -6,6 +6,7 @@

import org.jboss.windup.graph.model.WindupVertexFrame;
import org.jboss.windup.graph.model.resource.FileModel;
import org.jboss.windup.graph.model.resource.SourceFileModel;

import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Vertex;
Expand All @@ -21,23 +22,10 @@
*
*/
@TypeValue(PropertiesModel.TYPE)
public interface PropertiesModel extends WindupVertexFrame
public interface PropertiesModel extends FileModel, SourceFileModel
{
public static final String PROPERTIES_FILE_RESOURCE = "w:windupPropertiesModelToPropertiesFile";
public static final String TYPE = "PropertiesModel";

/**
* Gets the {@link FileModel} that contains these @{link {@link Properties}
*/
@Adjacency(label = PROPERTIES_FILE_RESOURCE, direction = Direction.OUT)
public FileModel getFileResource();

/**
* Sets the {@link FileModel} that contains these @{link {@link Properties}
*/
@Adjacency(label = PROPERTIES_FILE_RESOURCE, direction = Direction.OUT)
public void setFileResource(FileModel resource);

/**
* Gets the contents of the file as a {@link Properties} object.
*/
Expand All @@ -48,7 +36,7 @@ abstract class Impl implements PropertiesModel, JavaHandlerContext<Vertex>
{
public Properties getProperties() throws IOException
{
try (InputStream is = getFileResource().asInputStream())
try (InputStream is = this.asInputStream())
{
Properties props = new Properties();
props.load(is);
Expand Down
Expand Up @@ -69,6 +69,7 @@ public void perform(GraphRewrite event, EvaluationContext context, ArchiveModel

JarManifestModel jarManifest = jarManifestService.addTypeToModel(manifestFile);
jarManifest.setArchive(payload);
jarManifest.setGenerateSourceReport(true);

try (InputStream is = manifestFile.asInputStream())
{
Expand Down
Expand Up @@ -51,8 +51,8 @@ public void perform(GraphRewrite event, EvaluationContext context, FileModel pay
ExecutionStatistics.get().begin("DiscoverPropertiesFilesRuleProvider.perform");
GraphService<PropertiesModel> service = new GraphService<>(event.getGraphContext(), PropertiesModel.class);
TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext());
PropertiesModel properties = service.create();
properties.setFileResource(payload);
PropertiesModel properties = service.addTypeToModel(payload);
properties.setGenerateSourceReport(true);

GraphService.addTypeToModel(event.getGraphContext(), payload, SourceFileModel.class);

Expand Down

0 comments on commit d4b49f4

Please sign in to comment.