Search in sources :

Example 11 with StringPersistenceProvider

use of org.whole.lang.codebase.StringPersistenceProvider in project whole by wholeplatform.

the class PerformHandler method defineBindings.

protected void defineBindings(String behaviorXwl, String predicateXwl, IBindingManager bm) throws Exception {
    IPersistenceKit persistenceKit = ReflectionFactory.getDefaultPersistenceKit();
    bm.wDef("behaviorEntity", persistenceKit.readModel(new StringPersistenceProvider(behaviorXwl)));
    bm.wDef("predicateEntity", persistenceKit.readModel(new StringPersistenceProvider(predicateXwl)));
}
Also used : StringPersistenceProvider(org.whole.lang.codebase.StringPersistenceProvider) IPersistenceKit(org.whole.lang.codebase.IPersistenceKit)

Example 12 with StringPersistenceProvider

use of org.whole.lang.codebase.StringPersistenceProvider in project whole by wholeplatform.

the class LaunchConfigurationUtils method loadBindingScope.

@SuppressWarnings("unchecked")
public static IBindingScope loadBindingScope(ILaunchConfiguration configuration) throws CoreException {
    Map<String, String> environmentMap = configuration.getAttribute(ENVIRONMENT, (Map<String, String>) null);
    IBindingScope scope = BindingManagerFactory.instance.createSimpleScope();
    if (environmentMap == null)
        return scope;
    for (String name : environmentMap.keySet()) try {
        IEntity entity = XmlBuilderPersistenceKit.instance().readModel(new StringPersistenceProvider(environmentMap.get(name)));
        scope.wDef(name, entity);
    } catch (Exception e) {
        WholePlugin.log(e);
    }
    return scope;
}
Also used : StringPersistenceProvider(org.whole.lang.codebase.StringPersistenceProvider) IBindingScope(org.whole.lang.bindings.IBindingScope) IEntity(org.whole.lang.model.IEntity) CoreException(org.eclipse.core.runtime.CoreException)

Example 13 with StringPersistenceProvider

use of org.whole.lang.codebase.StringPersistenceProvider in project whole by wholeplatform.

the class LaunchConfigurationUtils method saveBindingScope.

public static void saveBindingScope(ILaunchConfigurationWorkingCopy configuration, IBindingScope scope) {
    Map<String, String> environmentMap = new HashMap<String, String>();
    for (String name : scope.wLocalNames()) try {
        StringPersistenceProvider pp = new StringPersistenceProvider();
        XmlBuilderPersistenceKit.instance().writeModel(scope.wGet(name), pp);
        environmentMap.put(name, pp.getStore());
    } catch (Exception e) {
        WholePlugin.log(e);
    }
    configuration.setAttribute(ENVIRONMENT, environmentMap);
}
Also used : StringPersistenceProvider(org.whole.lang.codebase.StringPersistenceProvider) HashMap(java.util.HashMap) CoreException(org.eclipse.core.runtime.CoreException)

Example 14 with StringPersistenceProvider

use of org.whole.lang.codebase.StringPersistenceProvider in project whole by wholeplatform.

the class WholeModelWizardPage1 method getInitialContents.

protected InputStream getInitialContents() {
    IEntity model = templateFactory.create(templates[templateCombo.getSelectionIndex()]);
    persistenceKit = getPersistenceKit(saveAsCombo);
    try {
        IPersistenceProvider pp = new StringPersistenceProvider();
        defineResourceBindings(pp.getBindings(), fileHandle);
        persistenceKit.writeModel(model, pp);
        return pp.openInputStream();
    } catch (Exception e) {
        throw new IllegalStateException("error writing file contents", e);
    }
}
Also used : StringPersistenceProvider(org.whole.lang.codebase.StringPersistenceProvider) IEntity(org.whole.lang.model.IEntity) IPersistenceProvider(org.whole.lang.codebase.IPersistenceProvider)

Example 15 with StringPersistenceProvider

use of org.whole.lang.codebase.StringPersistenceProvider in project whole by wholeplatform.

the class ActionCallHandler method defineBindings.

protected void defineBindings(String functionUri, String predicateXwl, String analyzing, IBindingManager bm) throws Exception {
    IPersistenceKit persistenceKit = ReflectionFactory.getDefaultPersistenceKit();
    bm.wDefValue("analyzing", Boolean.parseBoolean(analyzing));
    bm.wDefValue("functionUri", functionUri);
    bm.wDef("predicateEntity", persistenceKit.readModel(new StringPersistenceProvider(predicateXwl)));
}
Also used : StringPersistenceProvider(org.whole.lang.codebase.StringPersistenceProvider) IPersistenceKit(org.whole.lang.codebase.IPersistenceKit)

Aggregations

StringPersistenceProvider (org.whole.lang.codebase.StringPersistenceProvider)20 IEntity (org.whole.lang.model.IEntity)10 IPersistenceKit (org.whole.lang.codebase.IPersistenceKit)6 HashMap (java.util.HashMap)5 Test (org.junit.Test)4 IBindingManager (org.whole.lang.bindings.IBindingManager)4 CoreException (org.eclipse.core.runtime.CoreException)2 IPersistenceProvider (org.whole.lang.codebase.IPersistenceProvider)2 StreamPersistenceProvider (org.whole.lang.codebase.StreamPersistenceProvider)2 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 ArrayList (java.util.ArrayList)1 ChangeBoundsRequest (org.eclipse.gef.requests.ChangeBoundsRequest)1 Shell (org.eclipse.swt.widgets.Shell)1 IBindingScope (org.whole.lang.bindings.IBindingScope)1 ClasspathPersistenceProvider (org.whole.lang.codebase.ClasspathPersistenceProvider)1 JSONGeneratorBuilderOperation (org.whole.lang.json.util.JSONGeneratorBuilderOperation)1 Model (org.whole.lang.models.model.Model)1 PathExpression (org.whole.lang.queries.model.PathExpression)1 ILanguageKit (org.whole.lang.reflect.ILanguageKit)1