use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class XmlPrettyPrinterPerformanceTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
ReflectionFactory.deployWholePlatform();
String packagePath = StringUtils.packagePath(XmlPrettyPrinterPerformanceTest.class.getPackage().getName());
IPersistenceProvider pp = new ClasspathPersistenceProvider(packagePath + "/content.xml");
xmlModel = XmlSourcePersistenceKit.instance().readModel(pp);
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class LegacyContributionExtensionsDeployer method deploy.
public void deploy(ReflectionFactory platform) {
try {
InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/html/HTML5Semantics.xwl")));
InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/html/HTML5Actions.xwl")));
InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/javascript/JavaScriptSemantics.xwl")));
InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/javascript/JavaScriptActions.xwl")));
InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/mediawiki/MediaWikiActions.xwl")));
InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/ui/CaretActionsSemantics.xwl")));
} catch (Exception e) {
throw new IllegalStateException(e);
}
platform.addPersistenceKit("org.whole.lang.html.Html5Editor", HtmlPersistenceKit.instance());
platform.addOperationFactory(LegacyMetaModelsDeployer.HTML5_URI, PrettyPrinterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new HtmlPrettyPrinterVisitor((PrettyPrinterOperation) operation);
}
});
platform.addOperationFactory(JavaScriptLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
if (stage == 0)
return new JavaScriptInterpreterVisitor();
else
return null;
}
});
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class ArtifactsGeneratorTest method testGenerate.
@Test
public void testGenerate() throws Exception {
IBindingManager env = BindingManagerFactory.instance.createArguments();
env.wDefValue("projectName", "testProject");
env.wDefValue("sourceFolderName", "src");
env.wDefValue("packageName", "org.whole.lang.templates.codebase");
IEntity templates = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/templates/codebase/TemplateManagerArtifactsTemplates.xwl"));
ArtifactsGeneratorOperation.generate(templates, env);
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class GenericForwardSpecificBuilderTest method testMultiLanguage.
@Test
public void testMultiLanguage() throws Exception {
IEntity entity = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/queries/util/BindVariablesInPathTemplates.xwl"));
ModelBuilderOperation mop = new ModelBuilderOperation();
ModelTemplate template = new ModelTemplate(entity);
template.apply(new GenericForwardSpecificBuilder(mop));
IEntity newEntity = mop.wGetResult();
// to match variables fill variables with defaults
IEntityIterator<IEntity> variableIterator = IteratorFactory.<IEntity>descendantOrSelfMatcherIterator().withPattern(GenericMatcherFactory.instance.isVariableMatcher());
variableIterator.reset(entity);
IEntityIterator<IEntity> newVariableIterator = IteratorFactory.<IEntity>descendantOrSelfMatcherIterator().withPattern(GenericMatcherFactory.instance.isVariableMatcher());
newVariableIterator.reset(newEntity);
while (variableIterator.hasNext()) {
assertTrue(newVariableIterator.hasNext());
Variable variable = (Variable) variableIterator.next().wGetAdaptee(false);
Variable newVariable = (Variable) newVariableIterator.next().wGetAdaptee(false);
EntityDescriptor<?> ed = variable.getVarType().getValue();
EntityDescriptor<?> newEd = newVariable.getVarType().getValue();
assertEquals(ed, newEd);
String name = variable.getVarName().getValue();
String newName = newVariable.getVarName().getValue();
assertEquals(name, newName);
IEntity replacement = GenericEntityFactory.instance.create(ed);
variableIterator.set(replacement);
newVariableIterator.set(EntityUtils.clone(replacement));
}
assertTrue(Matcher.match(entity, newEntity));
}
use of org.whole.lang.codebase.ClasspathPersistenceProvider in project whole by wholeplatform.
the class IteratorFactoryTest method testFragmentRootIterator.
@Test
public void testFragmentRootIterator() throws Exception {
IEntity e = XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/templates/codebase/TemplateManagerArtifactsTemplates.xwl"));
CompilationUnit cu = Matcher.find(JavaEntityDescriptorEnum.CompilationUnit, e, false);
ImportModifier im = Matcher.find(JavaEntityDescriptorEnum.ImportModifier, e, false);
IEntityIterator<IEntity> i1 = IteratorFactory.rootIterator();
i1.reset(im);
assertTrue(i1.hasNext());
assertSame(e, i1.next());
IEntityIterator<IEntity> i2 = IteratorFactory.fragmentRootIterator();
i2.reset(im);
assertTrue(i2.hasNext());
assertSame(cu, i2.next());
}
Aggregations