Polygene™
Introduction
Tutorials
Javadoc
Samples
Core
Libraries
Extensions
Tools
Glossary 

Core Runtime

code

docs

tests

First of all, your code should never, ever, have a dependency on Core Runtime. If you think you need this, you should probably contact users@polygene.apache.org mailing list and see if your usecase can either be solved in a existing way or perhaps that a new Core SPI Extension is needed.

Table 18. Artifact

Group IDArtifact IDVersion

org.apache.polygene.core

org.apache.polygene.core.runtime

3.0.0


Let’s repeat that; Never, never, ever depend on Core Runtime. Make sure that the compile dependency does NOT include the org.apache.polygene.core.runtime jar.

Custom AssemblyHelper

BUT, there are super-rare cases, where a custom AssemblyHelper might be needed. One known use-case is to introduce an alternative bytecode generation algorithm, either better than the one we have, or for a different system, such as Dalvik.

To do this, add the AssemblyHelper implementation instance as metaInfo to the ApplicationAssembly

We think this is so rare, that the AssemblyHelper class will remain in the core/runtime module and has not been promoted to the core/bootstrap module. If you plan to use this feature, please contact the Polygene development team at dev@polygene.apache.org to ensure we can make this a better supported, backed by real usecases.

Fictitious example of using a hypothetical Dalvik capable classloader;

private static Energy4Java polygene;

private static Application application;

public static void main( String[] args )
    throws Exception
{
    // Create a Polygene Runtime
    polygene = new Energy4Java();
    // Create the application
    application = polygene.newApplication( factory -> {
        ApplicationAssembly assembly = factory.newApplicationAssembly();
        assembly.setMetaInfo( new DalvikAssemblyHelper() );
          [...snip...]

        return assembly;
    } );
    // Activate the application
    application.activate();
}

public static class DalvikAssemblyHelper extends AssemblyHelper
{
    @Override
    protected FragmentClassLoader instantiateFragmentClassLoader( ClassLoader parent )
    {
        return new DalvikFragmentClassLoader( parent );
    }
}

public static class DalvikFragmentClassLoader extends FragmentClassLoader
{

    public DalvikFragmentClassLoader( ClassLoader parent )
    {
        super( parent );
    }
}