wiring

project-build-environment grammar version 34

  1. The minimal wiring
  2. Wiring
    1. Interfaces
    2. Models
    3. External Systems
    4. Internal Systems
    5. Provided Connections
  3. Components

The minimal wiring


Every Alan project needs a wiring. The minimal wiring for a single Alan application with client, server, and authentication is

interfaces

models
	'model'

external-systems

systems
	'server': 'datastore'
		project / (
			'interfaces' / (
				'providing' / ( )
				'consuming' / ( )
			)
			'model' = provide 'model'
		)

	'sessions': 'session-manager'
		project / (
			'model' = bind 'server'::'authenticate'
		)

	'client': 'auto-webclient'
		project / (
			'model' = consume 'server'/'model'
		)

provided-connections
	'auth'   = 'sessions'::'http'
	'client' = 'client'::'http'

Wiring


The wiring describes which components make up the Alan project, and how they interact with each other.

Interfaces

If your application consumes data from, or provide data to another application, you need an Alan interface. In the interfaces section of the wiring, you list the names of the interfaces. For each item in the list, you need a file interfaces/<name>/interface.alan in your project, which specifies the interface.

'interfaces': [ interfaces ] dictionary { }

Models

An Alan project typically has one Alan application model, but projects can have multiple application models. For each item in the models section, you need a corresponding file models/<name>/application.alan in your project.

'models': [ models ] dictionary { }

External Systems

If your application consumes data from external sources, you need to specify the types of these sources. The type of an external source must be one of:

'external systems': [ external-systems ] dictionary {
	'is dynamic mapping': [ : ] stategroup (
		'yes' { [ dynamic ] }
		'no' { }
	)
	'type': stategroup (
		'library' {
			'binding': stategroup (
				'interface' {
					'interface': [ interface ] reference
				}
				'model' {
					'model': [ model ] reference
				}
			)
		}
		'protocol' {
			'type': text
			'binding': stategroup (
				'interface' {
					'interface': [ bind interface ] reference
				}
				'model' {
					'model': [ bind model ] reference
				}
				'none' { }
			)
		}
	)
}

Internal Systems

The internal systems are the active components of your Alan project. Each system is an instance of a System Type, which defines the structure of the connection mapping.

The mapping of a system is divided into two mappings.

Whether a mapping is required, depends on the System Type. The compiler can tell you which one(s) you need.

'systems': [ systems ] dictionary {
	'has more systems': stategroup = node-switch successor (
		| node = 'yes' { 'next' = successor }
		| none = 'no'
	)
	'system type': [ : ] reference
	/* the libraries mapping */
	'map libraries': stategroup (
		'yes' { [ project ]
			'mapping': component 'library mapping'
		}
		'no' { }
	)
	/* the consumed connections mapping */
	'map connections': stategroup (
		'yes' { [ consume ]
			'connections': [ (, ) ] dictionary {
				'target': [ = ] component 'provider selector'
			}
		}
		'no' { }
	)
}

Provided Connections

The provided-connections section describes which parts of your systems can be accessed from the outside world.

'provided connections': [ provided-connections ] dictionary {
	'system': [ = ] reference
	'type': stategroup (
		'library' {
			'library': component 'library selector'
		}
		'connection' {
			'connection': [ :: ] reference
		}
	)
}

Components

'library mapping' {
	'step': stategroup (
		'directory mapping' {
			'type': [ / (, ) ] stategroup (
				'static mapping' {
					'children': dictionary {
						'mapping': component 'library mapping'
					}
				}
				'dynamic mapping' {
					'entries': dictionary { [ [ ]
						'mapping': [ ] ] component 'library mapping'
					}
				}
			)
		}
		'library mapping' {
			'type': [ = ] stategroup (
				'provide' { [ provide ]
					'library': reference
				}
				'consume' { [ consume ]
					'target': component 'provider selection'
				}
				'bind' { [ bind ]
					'target': component 'provider selection'
				}
			)
		}
	)
}
'library selector' {
	'has step': stategroup (
		'yes' {
			'step': [ / ] reference
			'tail': component 'library selector'
		}
		'no' { }
	)
}
'provider selector' {
	'target': stategroup (
		'external' { [ external ]
			'system': reference
		}
		'internal connection' {
			'system': reference
			'connection': [ :: ] reference
		}
		'internal library' {
			'system': reference
			'library': component 'library selector'
		}
	)
}
'provider selection' {
	'select': stategroup (
		'single' {
			'target': component 'provider selector'
		}
		'multiple' {
			'system': [ dynamic external ] reference
		}
	)
}