Skip to content

Commit

Permalink
updated version and platform release printing methods
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed Apr 17, 2013
1 parent c6b287e commit 71c7e12
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
Expand Up @@ -73,6 +73,7 @@ public class ElementGraph extends SimpleDirectedGraph<FlowElement, Scope>
/** Field resolved */
private boolean resolved;

private PlatformInfo platformInfo;
/** Field sources */
private Map<String, Tap> sources;
/** Field sinks */
Expand All @@ -94,6 +95,7 @@ public class ElementGraph extends SimpleDirectedGraph<FlowElement, Scope>
public ElementGraph( ElementGraph elementGraph )
{
this();
this.platformInfo = elementGraph.platformInfo;
this.sources = elementGraph.sources;
this.sinks = elementGraph.sinks;
this.traps = elementGraph.traps;
Expand All @@ -112,9 +114,10 @@ public ElementGraph( ElementGraph elementGraph )
* @param sources of type Map<String, Tap>
* @param sinks of type Map<String, Tap>
*/
public ElementGraph( Pipe[] pipes, Map<String, Tap> sources, Map<String, Tap> sinks, Map<String, Tap> traps, Map<String, Tap> checkpoints, boolean requireUniqueCheckpoints, PlannerLevel... plannerLevels )
public ElementGraph( PlatformInfo platformInfo, Pipe[] pipes, Map<String, Tap> sources, Map<String, Tap> sinks, Map<String, Tap> traps, Map<String, Tap> checkpoints, boolean requireUniqueCheckpoints, PlannerLevel... plannerLevels )
{
super( Scope.class );
this.platformInfo = platformInfo;
this.sources = sources;
this.sinks = sinks;
this.traps = traps;
Expand Down Expand Up @@ -483,6 +486,9 @@ public String getVertexName( FlowElement object )
String result = object.toString().replaceAll( "\"", "\'" );
String versionString = Version.getVersionString();

if( platformInfo != null )
versionString = ( versionString == null ? "" : versionString + "\\n" ) + platformInfo;

return versionString == null ? result : result + "\\n" + versionString;
}

Expand Down
Expand Up @@ -146,7 +146,7 @@ protected ElementGraph createElementGraph( FlowDef flowDef )
DebugLevel debugLevel = flowDef.getDebugLevel() == null ? this.debugLevel : flowDef.getDebugLevel();
checkpointRootPath = makeCheckpointRootPath( flowDef );

return new ElementGraph( pipes, sources, sinks, traps, checkpoints, checkpointRootPath != null, assertionLevel, debugLevel );
return new ElementGraph( getPlatformInfo(), pipes, sources, sinks, traps, checkpoints, checkpointRootPath != null, assertionLevel, debugLevel );
}

private String makeCheckpointRootPath( FlowDef flowDef )
Expand Down
Expand Up @@ -80,11 +80,15 @@ public int hashCode()
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append( "PlatformInfo" );
sb.append( "{name='" ).append( name ).append( '\'' );
sb.append( ", vendor='" ).append( vendor ).append( '\'' );
sb.append( ", version='" ).append( version ).append( '\'' );
sb.append( '}' );

sb.append( name ).append( ':' );

if( version != null )
sb.append( version ).append( ':' );

if( vendor != null )
sb.append( vendor );

return sb.toString();
}
}
11 changes: 11 additions & 0 deletions cascading-core/src/main/java/cascading/util/Version.java
Expand Up @@ -93,6 +93,17 @@ public static String getVersionString()
return releaseVersion;
}

public static String getRelease()
{
if( getVersionProperties().isEmpty() )
return null;

if( getReleaseBuild() == null || getReleaseBuild().isEmpty() )
return String.format( "%s", getReleaseFull() );
else
return String.format( "%s-%s", getReleaseFull(), getReleaseBuild() );
}

public static String getReleaseFull()
{
String releaseFull;
Expand Down
Expand Up @@ -31,6 +31,7 @@
import cascading.flow.planner.FlowStepGraph;
import cascading.flow.planner.PlatformInfo;
import cascading.tap.Tap;
import cascading.util.Version;

/**
*
Expand All @@ -44,7 +45,7 @@ public LocalPlanner()
@Override
public PlatformInfo getPlatformInfo()
{
return new PlatformInfo( "local", null, null );
return new PlatformInfo( "local", "Concurrent, Inc.", Version.getRelease() );
}

@Override
Expand Down

0 comments on commit 71c7e12

Please sign in to comment.