Search in sources :

Example 1 with IArtifactsBuilder

use of org.whole.lang.artifacts.builders.IArtifactsBuilder in project whole by wholeplatform.

the class MatcherTest method buildArtifactsPattern.

public IEntity buildArtifactsPattern(boolean isPattern) {
    ModelBuilderOperation op = new ModelBuilderOperation();
    IArtifactsBuilder b0 = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
    ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
    b0.PackageArtifact_();
    b0.Name("org.whole.lang.models");
    cb.Resolver();
    b0.Artifacts_(1);
    b0.FileArtifact_();
    cb.Resolver();
    b0.Metadata_();
    b0.Copyright("Copyright 2004-2016 Riccardo Solmi.");
    if (isPattern)
        cb.Variable("licenseText", ArtifactsEntityDescriptorEnum.License, QuantifierEnum.MANDATORY);
    else
        b0.License("LGPL");
    b0.Author("Riccardo Solmi");
    b0._Metadata();
    cb.Resolver();
    b0._FileArtifact();
    b0._Artifacts();
    b0._PackageArtifact();
    return op.wGetResult();
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) IArtifactsBuilder(org.whole.lang.artifacts.builders.IArtifactsBuilder) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder)

Example 2 with IArtifactsBuilder

use of org.whole.lang.artifacts.builders.IArtifactsBuilder in project whole by wholeplatform.

the class ModelsArtifactsTemplateManager method newModelArtifact.

public ITemplateFactory<Workspace> newModelArtifact(final EntityDescriptor<?> fileContentRootED) {
    return new AbstractTemplateFactory<Workspace>() {

        public void apply(org.whole.lang.builders.IBuilderOperation op) {
            IArtifactsBuilder b0 = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
            ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
            b0.Workspace_();
            cb.Resolver();
            b0.Projects_(1);
            b0.Project_();
            cb.Variable("projectName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
            cb.Resolver();
            b0.Metadata();
            b0.Artifacts_(1);
            b0.FolderArtifact_();
            cb.Variable("sourceFolderName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
            b0.Metadata();
            b0.Artifacts_(1);
            b0.PackageArtifact_();
            cb.Variable("packageName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
            b0.Metadata();
            b0.Artifacts_(1);
            b0.FileArtifact_();
            b0.NameWithExtension_();
            cb.Variable("modelFileName", ArtifactsEntityDescriptorEnum.Name, QuantifierEnum.MANDATORY);
            b0.Extension("java");
            b0._NameWithExtension();
            b0.Metadata_();
            b0.wFeature(ArtifactsFeatureDescriptorEnum.persistenceKitId);
            b0.PersistenceKitId("org.whole.lang.java.codebase.JavaBuilderPersistenceKit");
            b0._Metadata();
            cb.StageUpFragment_();
            cb.Variable("modelFileContent", fileContentRootED, QuantifierEnum.MANDATORY);
            cb._StageUpFragment();
            b0._FileArtifact();
            b0._Artifacts();
            b0._PackageArtifact();
            b0._Artifacts();
            b0._FolderArtifact();
            b0._Artifacts();
            b0._Project();
            b0._Projects();
            b0._Workspace();
        }
    };
}
Also used : IArtifactsBuilder(org.whole.lang.artifacts.builders.IArtifactsBuilder) AbstractTemplateFactory(org.whole.lang.templates.AbstractTemplateFactory) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder)

Example 3 with IArtifactsBuilder

use of org.whole.lang.artifacts.builders.IArtifactsBuilder in project whole by wholeplatform.

the class ResourceTemplateTest method getMetadataPattern.

private IEntity getMetadataPattern() {
    ModelBuilderOperation op = new ModelBuilderOperation();
    IArtifactsBuilder ab = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
    ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
    ab.Metadata_();
    cb.Resolver();
    cb.Resolver();
    cb.Resolver();
    ab.Attributes_(1);
    ab.Attribute(AttributeEnum.readonly);
    ab._Attributes();
    cb.Resolver();
    ab._Metadata();
    return op.wGetResult();
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) IArtifactsBuilder(org.whole.lang.artifacts.builders.IArtifactsBuilder) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder)

Example 4 with IArtifactsBuilder

use of org.whole.lang.artifacts.builders.IArtifactsBuilder in project whole by wholeplatform.

the class ResourceTemplateTest method getFilesystemPattern.

private IEntity getFilesystemPattern() {
    ModelBuilderOperation op = new ModelBuilderOperation();
    IArtifactsBuilder ab = (IArtifactsBuilder) op.wGetBuilder(ArtifactsLanguageKit.URI);
    ICommonsBuilder cb = (ICommonsBuilder) op.wGetBuilder(CommonsLanguageKit.URI);
    ab.FolderArtifact_();
    ab.Name("testfolder");
    cb.Resolver();
    ab.Artifacts_(3);
    ab.FolderArtifact_();
    ab.Name("empty.folder");
    cb.Resolver();
    ab.Artifacts();
    ab._FolderArtifact();
    ab.FolderArtifact_();
    ab.Name("subfolder");
    cb.Resolver();
    ab.Artifacts_(1);
    ab.FileArtifact_();
    ab.NameWithExtension_();
    ab.Name("test");
    ab.Extension("txt");
    ab._NameWithExtension();
    cb.Resolver();
    cb.Resolver();
    ab._FileArtifact();
    ab._Artifacts();
    ab._FolderArtifact();
    ab.FileArtifact_();
    ab.NameWithExtension_();
    ab.Name("test.extensions");
    ab.Extension("txt");
    ab._NameWithExtension();
    cb.Resolver();
    cb.Resolver();
    ab._FileArtifact();
    ab.FileArtifact_();
    ab.Name("withoutext");
    cb.Resolver();
    cb.Resolver();
    ab._FileArtifact();
    return op.wGetResult();
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) IArtifactsBuilder(org.whole.lang.artifacts.builders.IArtifactsBuilder) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder)

Example 5 with IArtifactsBuilder

use of org.whole.lang.artifacts.builders.IArtifactsBuilder 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

IArtifactsBuilder (org.whole.lang.artifacts.builders.IArtifactsBuilder)7 ICommonsBuilder (org.whole.lang.commons.builders.ICommonsBuilder)5 ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)4 ArtifactsGenericBuilderAdapter (org.whole.lang.artifacts.builders.ArtifactsGenericBuilderAdapter)1 ArtifactsSpecificBuilderAdapter (org.whole.lang.artifacts.builders.ArtifactsSpecificBuilderAdapter)1 ArtifactsInterpreterVisitor (org.whole.lang.artifacts.visitors.ArtifactsInterpreterVisitor)1 ResourceArtifactsGeneratorVisitor (org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor)1 IBuilder (org.whole.lang.builders.IBuilder)1 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)1 IEntityContext (org.whole.lang.contexts.IEntityContext)1 IMiscBuilder (org.whole.lang.misc.builders.IMiscBuilder)1 IModelsBuilder (org.whole.lang.models.builders.IModelsBuilder)1 IOperation (org.whole.lang.operations.IOperation)1 AbstractTemplateFactory (org.whole.lang.templates.AbstractTemplateFactory)1 IVisitor (org.whole.lang.visitors.IVisitor)1 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)1