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();
}
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();
}
};
}
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();
}
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();
}
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;
}
});
}
Aggregations