<commit_before>package brooklyn.web.console

import brooklyn.entity.Application
import brooklyn.entity.Entity
import brooklyn.entity.ParameterType
import brooklyn.entity.basic.AbstractApplication
import brooklyn.entity.basic.AbstractEntity
import brooklyn.entity.basic.AbstractGroup
import brooklyn.entity.basic.BasicParameterType
import brooklyn.entity.webapp.tomcat.TomcatNode
import brooklyn.event.basic.BasicAttributeSensor
import brooklyn.management.ExecutionManager
import brooklyn.management.ManagementContext
import brooklyn.management.internal.LocalManagementContext
import brooklyn.web.console.entity.TestEffector

class ManagementContextService {
    private final ManagementContext context = LocalManagementContext.context
    private final Application application = new TestApplication()
    protected static int ID_GENERATOR = 0

    public ManagementContextService() {
        context.applications.add(application)
    }


    Collection<Application> getApplications() {
        return context.applications
    }

    Entity getEntity(String id) {
        return context.getEntity(id)
    }

    public ExecutionManager getExecutionManager() {
        return context.executionManager
    }

    private class TestApplication extends AbstractApplication {
        TestApplication() {<commit_msg>tidy reference to remote factory method<commit_after>package brooklyn.web.console

import brooklyn.entity.Application
import brooklyn.entity.Entity
import brooklyn.entity.ParameterType
import brooklyn.entity.basic.AbstractApplication
import brooklyn.entity.basic.AbstractEntity
import brooklyn.entity.basic.AbstractGroup
import brooklyn.entity.basic.BasicParameterType
import brooklyn.entity.webapp.tomcat.TomcatNode
import brooklyn.event.basic.BasicAttributeSensor
import brooklyn.management.ExecutionManager
import brooklyn.management.ManagementContext
import brooklyn.management.internal.LocalManagementContext
import brooklyn.web.console.entity.TestEffector

class ManagementContextService {
    //FIXME: how should this be supplied?  (previously it called to LocalManagementContext to generate, but that isn't the answer...)  --Alex
    //it does have to get set in the application
    private final ManagementContext context = new LocalManagementContext()
    private final Application application = new TestApplication()
    
    protected static int ID_GENERATOR = 0

    public ManagementContextService() {
        context.applications.add(application)
    }


    Collection<Application> getApplications() {
        return context.applications
    }

    Entity getEntity(String id) {
        return context.getEntity(id)
    }

    public ExecutionManager getExecutionManager() {
        return context.executionManager
    }

    private class TestApplication extends AbstractApplication {
        TestApplication() {
{'fraction_non_alphanumeric': 0.0613107822410148, 'fraction_numerical': 0.0007047216349541931, 'mean_word_length': 4.655378486055777, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '380225', 'n_tokens_mistral': 709, 'n_tokens_neox': 689, 'n_words': 172}