Search in sources :

Example 1 with ResourceArtifactsGeneratorVisitor

use of org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor in project whole by wholeplatform.

the class GenOperationsDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    // from java (legacy)
    platform.addOperationFactory(JavaLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new JavaJavaModelGeneratorVisitor();
            else
                return new JavaJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    // from artifacts (core)
    platform.addOperationFactory(ArtifactsLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ArtifactsJavaModelGeneratorVisitor();
            else
                return new ArtifactsJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    platform.addOperationFactory(ArtifactsLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            // if (stage == 0)
            IBindingManager args = operation.getOperationEnvironment();
            if (args.wIsSet("resourceKind") && ResourceKindEnum.FILE_SYSTEM.equals(((ResourceKind) args.wGet("resourceKind")).getValue()))
                return new ResourceArtifactsGeneratorVisitor();
            else
                return new WorkspaceArtifactsGeneratorVisitor();
        }
    });
    // from editors (core)
    // platform.addOperationFactory(EditorsLanguageKit.URI, JavaCompilerOperation.ID,
    // new IVisitorFactory() {
    // public IVisitor create(IOperation operation, int stage) {
    // if (stage == 0)
    // return new EditorsJavaModelGeneratorVisitor();
    // else
    // return new EditorsJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
    // }
    // });
    // misc (core)
    platform.addOperationFactory(MiscLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new MiscTraverseAllVisitor();
            else
                return new MiscJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    // from models (core)
    platform.addOperationFactory(ModelsLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ModelsJavaModelGeneratorVisitor();
            else
                return new ModelsJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
    platform.addOperationFactory(GrammarsLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new GrammarsJavaModelGeneratorVisitor();
        }
    });
    // from pojo (core.op)
    platform.addOperationFactory(PojoLanguageKit.URI, JavaCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new PojoJavaModelGeneratorVisitor();
            else
                return new PojoJavaStoreGeneratorVisitor(((JavaCompilerOperation) operation).getGenerator().javaStoreBuilder(), true);
        }
    });
}
Also used : IOperation(org.whole.lang.operations.IOperation) ModelsJavaModelGeneratorVisitor(org.whole.lang.visitors.ModelsJavaModelGeneratorVisitor) PojoJavaModelGeneratorVisitor(org.whole.lang.visitors.PojoJavaModelGeneratorVisitor) IVisitor(org.whole.lang.visitors.IVisitor) ResourceArtifactsGeneratorVisitor(org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor) GrammarsJavaModelGeneratorVisitor(org.whole.lang.visitors.GrammarsJavaModelGeneratorVisitor) JavaCompilerOperation(org.whole.lang.operations.JavaCompilerOperation) MiscTraverseAllVisitor(org.whole.lang.misc.visitors.MiscTraverseAllVisitor) MiscJavaStoreGeneratorVisitor(org.whole.lang.visitors.MiscJavaStoreGeneratorVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) JavaJavaStoreGeneratorVisitor(org.whole.lang.visitors.JavaJavaStoreGeneratorVisitor) ArtifactsJavaModelGeneratorVisitor(org.whole.lang.visitors.ArtifactsJavaModelGeneratorVisitor) WorkspaceArtifactsGeneratorVisitor(org.whole.lang.visitors.WorkspaceArtifactsGeneratorVisitor) JavaJavaModelGeneratorVisitor(org.whole.lang.visitors.JavaJavaModelGeneratorVisitor) IBindingManager(org.whole.lang.bindings.IBindingManager) PojoJavaStoreGeneratorVisitor(org.whole.lang.visitors.PojoJavaStoreGeneratorVisitor) ModelsJavaStoreGeneratorVisitor(org.whole.lang.visitors.ModelsJavaStoreGeneratorVisitor) ArtifactsJavaStoreGeneratorVisitor(org.whole.lang.visitors.ArtifactsJavaStoreGeneratorVisitor)

Example 2 with ResourceArtifactsGeneratorVisitor

use of org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor in project whole by wholeplatform.

the class ArtifactsLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new ArtifactsLanguageKit());
    platform.addOperationFactory(ArtifactsLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ArtifactsGenericBuilderAdapter((IArtifactsBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(ArtifactsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ArtifactsSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(ArtifactsLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ResourceArtifactsGeneratorVisitor();
        }
    });
    platform.addOperationFactory(ArtifactsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ArtifactsInterpreterVisitor();
            else
                return null;
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) ResourceArtifactsGeneratorVisitor(org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor) ArtifactsGenericBuilderAdapter(org.whole.lang.artifacts.builders.ArtifactsGenericBuilderAdapter) ArtifactsInterpreterVisitor(org.whole.lang.artifacts.visitors.ArtifactsInterpreterVisitor) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IArtifactsBuilder(org.whole.lang.artifacts.builders.IArtifactsBuilder) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ArtifactsSpecificBuilderAdapter(org.whole.lang.artifacts.builders.ArtifactsSpecificBuilderAdapter)

Aggregations

ResourceArtifactsGeneratorVisitor (org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor)2 IOperation (org.whole.lang.operations.IOperation)2 IVisitor (org.whole.lang.visitors.IVisitor)2 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)2 ArtifactsGenericBuilderAdapter (org.whole.lang.artifacts.builders.ArtifactsGenericBuilderAdapter)1 ArtifactsSpecificBuilderAdapter (org.whole.lang.artifacts.builders.ArtifactsSpecificBuilderAdapter)1 IArtifactsBuilder (org.whole.lang.artifacts.builders.IArtifactsBuilder)1 ArtifactsInterpreterVisitor (org.whole.lang.artifacts.visitors.ArtifactsInterpreterVisitor)1 IBindingManager (org.whole.lang.bindings.IBindingManager)1 IBuilder (org.whole.lang.builders.IBuilder)1 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)1 IEntityContext (org.whole.lang.contexts.IEntityContext)1 MiscTraverseAllVisitor (org.whole.lang.misc.visitors.MiscTraverseAllVisitor)1 JavaCompilerOperation (org.whole.lang.operations.JavaCompilerOperation)1 ArtifactsJavaModelGeneratorVisitor (org.whole.lang.visitors.ArtifactsJavaModelGeneratorVisitor)1 ArtifactsJavaStoreGeneratorVisitor (org.whole.lang.visitors.ArtifactsJavaStoreGeneratorVisitor)1 GrammarsJavaModelGeneratorVisitor (org.whole.lang.visitors.GrammarsJavaModelGeneratorVisitor)1 JavaJavaModelGeneratorVisitor (org.whole.lang.visitors.JavaJavaModelGeneratorVisitor)1 JavaJavaStoreGeneratorVisitor (org.whole.lang.visitors.JavaJavaStoreGeneratorVisitor)1 MiscJavaStoreGeneratorVisitor (org.whole.lang.visitors.MiscJavaStoreGeneratorVisitor)1