Package npanday

Examples of npanday.PlatformUnsupportedException


            // Mac OS X default location
            return new File( "/Library/Frameworks/Mono.framework/Home/lib/mono/gac/" ).getAbsolutePath();
        }
        else
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-061-008: Could not locate Global Assembly Cache for Mono. Try setting the MONO_ROOT environmental variable." );
        }
    }
View Full Code Here


            netCompiler = (CompilerExecutable) cc.newInstance();
            netCompiler.init( this );//TODO: Add ArtifactInfo?
        }
        catch ( ClassNotFoundException e )
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-061-004: Unable to create NetCompiler: Class Name = " + className, e );
        }
        catch ( InstantiationException e )
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-061-005: Unable to create NetCompiler: Class Name = " + className, e );
        }
        catch ( IllegalAccessException e )
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-061-006: Unable to create NetCompiler: Class Name = " + className, e );
        }
        commandFilter =
            CommandFilter.Factory.createDefaultCommandFilter( compilerCapability.getCommandCapability(), logger );

        String basedir = project.getBuild().getDirectory() + File.separator + "assembly-resources" + File.separator;
        linkedResources = new File( basedir, "linkresource" ).exists() ? Arrays.asList(
            new File( basedir, "linkresource" ).listFiles() ) : new ArrayList<File>();
        getEmbeddedResources( new File( basedir, "resource" ) );
        win32resources = new File( basedir, "win32res" ).exists() ? Arrays.asList(
            new File( basedir, "win32res" ).listFiles() ) : new ArrayList<File>();
        File win32IconDir = new File( basedir, "win32icon" );
        if ( win32IconDir.exists() )
        {
            File[] icons = win32IconDir.listFiles();
            if ( icons.length > 1 )
            {
                throw new PlatformUnsupportedException(
                    "NPANDAY-061-007: There is more than one win32icon in resource directory: Number = " + icons
                        .length );
            }
            if ( icons.length == 1 )
            {
View Full Code Here

            logger.info( "NPANDAY-000-000:[COM Reference] updating artifact path to ["+ newPath +"]" );
           
            artifact.setFile( new File( newPath ) );
        }catch(Exception e)
        {
            throw new PlatformUnsupportedException (e);
        }
       
    }
View Full Code Here

            gacFile = new File( gacRoot, artifact.getArtifactId() + File.separator + artifact.getVersion() + "__" +
                                artifact.getClassifier() + File.separator + artifact.getArtifactId() + ".dll" );
            if ( !gacFile.exists() )
            {
               
                throw new PlatformUnsupportedException(
                                                       "NPANDAY-000-000: Could not find GAC dependency: File = " + gacFile.getAbsolutePath() );
            }
           
           
        }
View Full Code Here

            netExecutable = (NetExecutable) cc.newInstance();
            netExecutable.init( this );
        }
        catch ( ClassNotFoundException e )
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-064-001: Unable to create NetCompiler: Class Name = " + className, e );
        }
        catch ( InstantiationException e )
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-064-002: Unable to create NetCompiler: Class Name = " + className, e );
        }
        catch ( IllegalAccessException e )
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-064-003: Unable to create NetCompiler: Class Name = " + className, e );
        }
        commandFilter =
            CommandFilter.Factory.createDefaultCommandFilter( executableCapability.getCommandCapability(), logger );
    }
View Full Code Here

                    throws PlatformUnsupportedException
                {
                    String netHome = ( netHomePath == null ) ? null : netHomePath.getAbsolutePath();
                    if ( isEmpty( command ) && isEmpty( netHome ) )
                    {
                        throw new PlatformUnsupportedException(
                            "NPANDAY-042-000: Both command and netHome params cannot be null or empty" );
                    }
                    else if ( !isEmpty( command ) && isEmpty( netHome ) )
                    {
                        return getVendorForCommand( command );
                    }
                    else if ( isEmpty( command ) && !isEmpty( netHome ) )
                    {
                        return getVendorFromPath( netHome );
                    }
                    else if ( !isEmpty( command ) && !isEmpty( netHome ) )
                    {
                        try
                        {
                            return getVendorFromPath( netHome );
                        }
                        catch ( PlatformUnsupportedException e )
                        {

                            //log.debug(e);
                        }
                        try
                        {
                            return getVendorForCommand( netHome + File.separator + "bin" + File.separator + command );
                        }
                        catch ( PlatformUnsupportedException e )
                        {
                            throw new PlatformUnsupportedException( "" );
                        }
                    }
                    return null;
                }

                /**
                 * Determine the vendor based on executing the command and matching the standard output.
                 *
                 * @param command
                 * @return vendor instance
                 * @throws npanday.PlatformUnsupportedException
                 *          if the platform cannot be matched.
                 */
                private Vendor getVendorForCommand( String command )
                    throws PlatformUnsupportedException
                {
                    CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
                    //commandExecutor.setLogger(logger);
                    try
                    {
                        List<String> commands = new ArrayList<String>();
                        commandExecutor.executeCommand( command, commands );
                    }
                    catch ( ExecutionException e )
                    {
                        throw new PlatformUnsupportedException( "", e );
                    }
                    String results = commandExecutor.getStandardOut();
                    if ( results.contains( microsoftContainsString ) )
                    {
                        return Vendor.MICROSOFT;
                    }
                    else if ( results.contains( monoContainsString ) )
                    {
                        return Vendor.MONO;
                    }
                    else if ( results.contains( gnuContainsString ) || results.contains( "cscc" ) )
                    {//cscc does not contain vendor name
                        return Vendor.DOTGNU;
                    }
                    else
                    {
                        throw new PlatformUnsupportedException(
                            "NPANDAY-042-001: Platform not supported: Results = " + results );
                    }
                }

                /**
                 * Determines the vendor based on the path of the executable
                 *
                 * @param path
                 * @return vendor
                 * @throws PlatformUnsupportedException
                 */
                private Vendor getVendorFromPath( String path )
                    throws PlatformUnsupportedException
                {
                    if ( !new File( path ).exists() )
                    {
                        throw new PlatformUnsupportedException(
                            "NPANDAY-042-002: Unable to locate path: Path = " + path );
                    }

                    if ( path.contains( "Microsoft.NET" ) )
                    {
                        return Vendor.MICROSOFT;
                    }
                    else if ( path.contains( "Mono" ) )
                    {
                        return Vendor.MONO;
                    }
                    else if ( path.contains( "Portable.NET" ) )
                    {
                        return Vendor.DOTGNU;
                    }
                    throw new PlatformUnsupportedException( "NPANDAY-042-003: Platform not supported: Path " + path );
                }

                private boolean isEmpty( String value )
                {
                    return ( value == null || value.trim().equals( "" ) );
View Full Code Here

            logger.debug("NPANDAY-066-025 - Try to find executable for vendor:" + vendorInfo + ":processor:" + processor);       
            processor.process( vendorInfo );
        }
        catch ( IllegalStateException e )
        {
            throw new PlatformUnsupportedException( "NPANDAY-066-011: Illegal State: Vendor Info = " + vendorInfo, e );
        }

        if ( vendorInfo.getVendor() == null || vendorInfo.getFrameworkVersion() == null )
        {
            throw new PlatformUnsupportedException( "NPANDAY-066-012: Missing Vendor Information: " + vendorInfo );
        }

        logger.info( "NPANDAY-066-013: Found Vendor = " + vendorInfo );
        compilerRequirement.setVendor( vendorInfo.getVendor() );
        compilerRequirement.setVendorVersion( vendorInfo.getVendorVersion() );
        compilerRequirement.setFrameworkVersion( vendorInfo.getFrameworkVersion() );

        // init does not need the executable paths to be set
        compilerContext.init( compilerRequirement, compilerConfig, project, capabilityMatcher );

        if ( assemblyPath != null )
        {
            compilerContext.getCompilerCapability().setAssemblyPath( assemblyPath.getAbsolutePath() );
        }

        List<String> executionPaths = ( compilerConfig.getExecutionPaths() == null ) ? new ArrayList<String>()
            : compilerConfig.getExecutionPaths();
        if (executionPaths == null  || executionPaths.size() == 0 )
        {
            if (vendorInfo.getExecutablePaths() != null) {
                for(File path : vendorInfo.getExecutablePaths()){
                    executionPaths.add(path.getAbsolutePath());
                }
            }


            String netDependencyId = compilerContext.getCompilerCapability().getNetDependencyId();

            if ( netDependencyId != null )
            {
                Artifact artifact = artifactContext.getArtifactByID( netDependencyId );
                if ( artifact != null )
                {
                    File artifactPath =
                        PathUtil.getPrivateApplicationBaseFileFor( artifact, compilerConfig.getLocalRepository() );
                    executionPaths.add( artifactPath.getParentFile().getAbsolutePath() );
                }
            }

            compilerConfig.setExecutionPaths( executionPaths );
        }

        try
        {
            return compilerContext.getCompilerExecutable();
        }
        catch ( ExecutionException e )
        {
            throw new PlatformUnsupportedException( "NPANDAY-066-007: Unable to find net executable", e );
        }
    }
View Full Code Here

    public Artifact getArtifactFor(String groupId, String artifactId) throws PlatformUnsupportedException {
        List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null );
        if ( artifacts.size() == 0 )
        {
            throw new PlatformUnsupportedException(
                "NPANDAY-066-023: Could not locate the plugin - 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-021: Could not locate the plugin: GroupId = " + groupId + ", ArtifactId = " + artifactId );
        }
        return artifact;
    }
View Full Code Here

        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 );
        }
    }
View Full Code Here

        {
            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 ||
            vendorInfo.getVendorVersion() == null )
        {
            throw new PlatformUnsupportedException( "NPANDAY-066-018: Missing Vendor Information: " + vendorInfo );
        }

        ExecutableRequirement executableRequirement =
            ExecutableRequirement.Factory.createDefaultExecutableRequirement();
        executableRequirement.setVendor( vendorInfo.getVendor() );
        executableRequirement.setFrameworkVersion( vendorInfo.getFrameworkVersion() );
        executableRequirement.setVendorVersion( vendorInfo.getVendorVersion() );
        executableRequirement.setProfile( "dotnet-jetty:start" );//TODO: Remove hard-coded value

        ExecutableConfig executableConfig = ExecutableConfig.Factory.createDefaultExecutableConfig();
        executableConfig.setCommands( commands );

        executableConfig.setExecutionPaths( new ArrayList<String>() );
        executableContext.init( executableRequirement, executableConfig, capabilityMatcher );

        try
        {
            return executableContext.getNetExecutable();
        }
        catch ( ExecutionException e )
        {
            throw new PlatformUnsupportedException( "NPANDAY-066-001: Unable to find net executable", e );
        }
    }
View Full Code Here

TOP

Related Classes of npanday.PlatformUnsupportedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.