if ( isIsolatedAppDomain )
{
List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null );
if ( artifacts.size() == 0 )
{
throw new PlatformUnsupportedException(
"NPANDAY-066-024: Could not locate the executable - missing entry in the net-dependencies.xml file: GroupId = " +
groupId + ", ArtifactId = " + artifactId );
}
Artifact artifact = artifacts.get( 0 );
if ( artifact == null )
{
throw new PlatformUnsupportedException( "NPANDAY-066-025: Could not locate the executable: GroupId = " +
groupId + ", ArtifactId = " + artifactId );
}
File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, localRepository );
commands.add( "startProcessAssembly=" + artifactPath.getAbsolutePath() );
//TODO: Replace
String pluginArtifactPath = PathUtil.getPrivateApplicationBaseFileFor(
artifactContext.getArtifactsFor( "org.apache.npanday.plugins", "NPanday.Plugin", null, null ).get( 0 ),
localRepository ).getAbsolutePath();
commands.add( "pluginArtifactPath=" + pluginArtifactPath );
return getNetExecutableFromRepository( "org.apache.npanday.plugins", "NPanday.Plugin.Runner", vendorInfo, localRepository,
commands, false );
}
if ( commands == null )
{
commands = new ArrayList<String>();
}
try
{
processor.process( vendorInfo );
}
catch ( IllegalStateException e )
{
throw new PlatformUnsupportedException( "NPANDAY-066-010: Illegal State: Vendor Info = " + vendorInfo, e );
}
if ( vendorInfo.getVendor() == null || vendorInfo.getFrameworkVersion() == null )
{
throw new PlatformUnsupportedException( "NPANDAY-066-020: Missing Vendor Information: " + vendorInfo );
}
List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null );
if ( artifacts.size() == 0 )
{
throw new PlatformUnsupportedException(
"NPANDAY-066-022: Could not locate the executable- missing entry in the net-dependencies.xml: GroupId = " +
groupId + ", ArtifactId = " + artifactId );
}
Artifact artifact = artifacts.get( 0 );
logger.debug( "NPANDAY-066-003: Found Vendor: " + vendorInfo );
File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, localRepository );
List<String> modifiedCommands = new ArrayList<String>();
String exe = null;
if ( vendorInfo.getVendor().equals( Vendor.MONO ) )
{
List<File> executablePaths = vendorInfo.getExecutablePaths();
if ( executablePaths != null )
{
for ( File executablePath : executablePaths )
{
if ( new File( executablePath.getAbsolutePath(), "mono.exe" ).exists() )
{
exe = new File( executablePath.getAbsolutePath(), "mono.exe" ).getAbsolutePath();
commands.add( "vendor=MONO" );//if forked process, it needs to know.
break;
}
}
}
if ( exe == null )
{
logger.info(
"NPANDAY-066-005: Executable path for mono does not exist. Will attempt to execute MONO using" +
" the main PATH variable." );
exe = "mono";
commands.add( "vendor=MONO" );//if forked process, it needs to know.
}
modifiedCommands.add( artifactPath.getAbsolutePath() );
for ( String command : commands )
{
modifiedCommands.add( command );
}
}
else
{
exe = artifactPath.getAbsolutePath();
modifiedCommands = commands;
}
//TODO: DotGNU on Linux?
ExecutableConfig executableConfig = ExecutableConfig.Factory.createDefaultExecutableConfig();
executableConfig.setExecutionPaths( Arrays.asList( exe ) );
executableConfig.setCommands( modifiedCommands );
try
{
repositoryExecutableContext.init( executableConfig );
}
catch ( InitializationException e )
{
throw new PlatformUnsupportedException(
"NPANDAY-066-006: Unable to initialize the repository executable context", e );
}
try
{
return repositoryExecutableContext.getNetExecutable();
}
catch ( ExecutionException e )
{
throw new PlatformUnsupportedException( "NPANDAY-066-004: Unable to find net executable", e );
}
}