use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.
the class LegacyOperationsDeployer method deploy.
public void deploy(ReflectionFactory platform) {
// TODO move to MappingStrategyRegistry?
MappingStrategyRegistry.instance().putMappingStrategy(new CommonsMappingStrategy());
InterpreterOperation.interpret(new SchemaActions().create());
platform.addOperationFactory(XsdLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new XsdPrettyPrinterVisitor();
}
});
// TODO rewrite using queries/actions in SchemaActions
// platform.addOperationFactory(XsdLanguageKit.ID, ArtifactsGeneratorOperation.ID,
// new IVisitorFactory() {
// public IVisitor create(IOperation operation, int stage) {
// return new Xsd2ModelsArtifactsGeneratorVisitor((ArtifactsGeneratorOperation) operation);
// }
// });
InterpreterOperation.interpret(new MappingActions().create());
// FIXME requires WorkflowsInterpreter see WorkflowsInterpreterDeployer
XsdRegistry.initialize();
platform.addPersistenceKit("org.whole.lang.xsd.XsdSourceEditor", XsdPersistenceKit.instance());
platform.addPersistenceKit("org.whole.lang.xsd.XsiSourceEditor", XsiPersistenceKit.instance());
InterpreterOperation.interpret(new SchemaModelsActions().create());
}
use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.
the class CoreOperationsDeployer method deploy.
public void deploy(ReflectionFactory platform) {
platform.addOperationFactory(EditorsLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new EditorsArtifactsGeneratorVisitor((ArtifactsGeneratorOperation) operation);
}
});
platform.addOperationFactory(GrammarsLanguageKit.URI, ContentAssistOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new GrammarsContentAssistVisitor();
}
});
platform.addOperationFactory(GrammarsLanguageKit.URI, ValidatorOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new GrammarsValidatorVisitor();
}
});
if (!ReflectionFactory.getLanguageKit(GrammarsLanguageKit.URI, false, null).hasVisitor(InterpreterOperation.ID))
platform.addOperationFactory(GrammarsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
if (stage == 0)
return new GrammarsInterpreterVisitor();
else
return null;
}
});
platform.addPersistenceKit("org.whole.lang.grammars.GrammarEditor", GrammarsPersistenceKit.instance());
platform.addPersistenceKit("org.whole.lang.objectivec.ObjectiveCEditor", ObjectiveCPersistenceKit.instance());
platform.addPersistenceKit("org.whole.lang.mediawiki.MediaWikiEditor", MediaWikiPersistenceKit.instance());
platform.addOperationFactory(TemplatesLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new AbstractVisitor() {
public void visit(IEntity entity) {
BehaviorUtils.apply("whole:org.whole.lang.templates:TemplatesSemantics#toJava", entity, getBindings());
}
};
}
});
platform.addOperationFactory(PojoLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new PojoArtifactsGeneratorVisitor((ArtifactsGeneratorOperation) operation);
}
});
platform.addOperationFactory(FramesLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
if (stage == 0)
return new FramesInterpreterVisitor();
else
return null;
}
});
// TODO test
// ReflectLibrary.deploy();
new ReflectLibraryDeployer().deploy(platform);
new ViewDerivationLibraryDeployer().deploy(platform);
}
use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.
the class GrammarsInterpreterVisitor method visit.
@Override
public void visit(Grammar grammar) {
grammar = normalize(grammar);
GrammarsRegistry.instance().putGrammar(grammar);
TargetLanguage targetLanguage = grammar.getTargetLanguage();
ILanguageKit languageKit = null;
final String languageUri;
IBindingManager bm = getBindings();
if (Matcher.match(GrammarsEntityDescriptorEnum.URI, targetLanguage)) {
languageUri = targetLanguage.wStringValue();
languageKit = ReflectionFactory.getLanguageKit(languageUri, true, bm);
} else {
languageUri = ((LanguageDescriptor) targetLanguage).getUri().getValue();
stagedVisit(GrammarsUtils.deriveModel(grammar, false));
languageKit = (ILanguageKit) bm.getResult().wGetValue();
}
if (languageKit.isDynamic()) {
DynamicLanguageKit dynamicLanguageKit = (DynamicLanguageKit) languageKit;
GrammarBasedDataTypeParser dataTypeParser = new GrammarBasedDataTypeParser(grammar.getUri().getValue());
dynamicLanguageKit.setDataTypeParser(DataTypeParsers.PERSISTENCE, dataTypeParser);
dynamicLanguageKit.setDataTypeParser(DataTypeParsers.PRESENTATION, dataTypeParser);
}
ReflectionFactory.updatePersistenceAndEditorKits(languageKit);
ReflectionFactory.deploy(new AbstractLanguageExtensionDeployer() {
public void deploy(ReflectionFactory platform) {
platform.addOperationFactory(languageUri, PrettyPrinterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new GenericGrammarBasedPrettyPrinterVisitor((PrettyPrinterOperation) operation);
}
});
platform.addOperationFactory(languageUri, ValidatorOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new GenericGrammarBasedValidatorVisitor();
}
});
}
});
}
use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.
the class TestsLanguageDeployer method deploy.
public void deploy(ReflectionFactory platform) {
platform.addLanguageKit(new TestsLanguageKit());
platform.addOperationFactory(TestsLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new TestsGenericBuilderAdapter((ITestsBuilder) strategy, entityContext);
}
});
platform.addOperationFactory(TestsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new TestsSpecificBuilderAdapter(strategy, entityContext);
}
});
platform.addOperationFactory(TestsLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new TestsPrettyPrinterVisitor((PrettyPrinterOperation) operation);
}
});
platform.addOperationFactory(TestsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
if (stage == 0)
return new TestsLearningInterpreterVisitor();
else
return null;
}
});
platform.addOperationFactory(TestsLanguageKit.URI, ContentAssistOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new TestsContentAssistVisitor();
}
});
}
use of org.whole.lang.visitors.IVisitorFactory in project whole by wholeplatform.
the class SchemeLanguageDeployer method deploy.
public void deploy(ReflectionFactory platform) {
platform.addLanguageKit(new SchemeLanguageKit());
platform.addOperationFactory(SchemeLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new SchemeGenericBuilderAdapter((ISchemeBuilder) strategy, entityContext);
}
});
platform.addOperationFactory(SchemeLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new SchemeSpecificBuilderAdapter(strategy, entityContext);
}
});
platform.addOperationFactory(SchemeLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
if (stage == 0)
return new SchemeInterpreterVisitor((InterpreterOperation) operation);
else
return null;
}
});
platform.addEditorKit(SchemeTextualEditorKit.ID);
}
Aggregations