コード例 #1
0
ファイル: factory.go プロジェクト: burkechris/brooklyn-cli
func NewFactory(network *net.Network, config *io.Config) (factory concreteFactory) {
	factory.cmdsByName = make(map[string]command.Command)
	factory.cmdsByName["access"] = commands.NewAccess(network)
	factory.cmdsByName["login"] = commands.NewLogin(network, config)
	factory.cmdsByName["tree"] = commands.NewTree(network)
	factory.cmdsByName["entities"] = commands.NewEntities(network)
	factory.cmdsByName["entity-children"] = commands.NewChildren(network)
	factory.cmdsByName["add-children"] = commands.NewAddChildren(network)
	factory.cmdsByName["catalog"] = commands.NewCatalog(network)
	factory.cmdsByName["add-catalog"] = commands.NewAddCatalog(network)
	factory.cmdsByName["version"] = commands.NewVersion(network)
	factory.cmdsByName["create"] = commands.NewCreate(network)
	factory.cmdsByName["delete"] = commands.NewDelete(network)
	factory.cmdsByName["application"] = commands.NewApplication(network)
	factory.cmdsByName["applications"] = commands.NewApplications(network)
	factory.cmdsByName["sensors"] = commands.NewSensors(network)
	factory.cmdsByName["sensor"] = commands.NewSensor(network)
	factory.cmdsByName["effectors"] = commands.NewEffectors(network)
	factory.cmdsByName["policies"] = commands.NewPolicies(network)
	factory.cmdsByName["policy"] = commands.NewPolicy(network)
	factory.cmdsByName["start-policy"] = commands.NewStartPolicy(network)
	factory.cmdsByName["stop-policy"] = commands.NewStopPolicy(network)
	factory.cmdsByName["destroy-policy"] = commands.NewDestroyPolicy(network)
	factory.cmdsByName["config"] = commands.NewConfig(network)
	factory.cmdsByName["set-config"] = commands.NewSetConfig(network)
	factory.cmdsByName["locations"] = commands.NewLocations(network)
	factory.cmdsByName["activity"] = commands.NewActivity(network)
	factory.cmdsByName["activity-children"] = commands.NewActivityChildren(network)
	factory.cmdsByName["activity-stream"] = commands.NewActivityStream(network)
	//factory.cmdsByName["activities"] = commands.NewActivities(network)
	factory.cmdsByName["spec"] = commands.NewSpec(network)
	factory.cmdsByName["rename-entity"] = commands.NewRename(network)
	return factory
}
コード例 #2
0
ファイル: factory.go プロジェクト: andreaturli/brooklyn-cli
func NewFactory(network *net.Network, config *io.Config) (factory concreteFactory) {
	factory.cmdsByName = make(map[string]command.Command)
	factory.subCommands = make(map[string]map[string]command.Command)

	factory.simpleCommand(commands.NewAccess(network))
	//factory.command(commands.NewActivities(network))
	factory.simpleCommand(commands.NewActivity(network))
	factory.simpleCommand(commands.NewActivityStreamEnv(network))
	factory.simpleCommand(commands.NewActivityStreamStderr(network))
	factory.simpleCommand(commands.NewActivityStreamStdin(network))
	factory.simpleCommand(commands.NewActivityStreamStdout(network))
	factory.simpleCommand(commands.NewAddCatalog(network))
	factory.simpleCommand(commands.NewAddChildren(network))
	factory.simpleCommand(commands.NewApplication(network))
	//factory.simpleCommand(commands.NewApplications(network))
	factory.simpleCommand(commands.NewCatalog(network))
	factory.simpleCommand(commands.NewConfig(network))
	factory.simpleCommand(commands.NewDeploy(network))
	factory.simpleCommand(commands.NewDelete(network))
	factory.simpleCommand(commands.NewDestroyPolicy(network))
	factory.simpleCommand(commands.NewEffector(network))
	factory.simpleCommand(commands.NewEntity(network))
	factory.simpleCommand(commands.NewInvoke(network))
	factory.simpleCommand(commands.NewInvokeRestart(network))
	factory.simpleCommand(commands.NewInvokeStart(network))
	factory.simpleCommand(commands.NewInvokeStop(network))
	// NewList below is not used but we retain the code as an example of how to do a super command.
	//	factory.superCommand(commands.NewList(network))
	factory.simpleCommand(commands.NewLocations(network))
	factory.simpleCommand(commands.NewLogin(network, config))
	factory.simpleCommand(commands.NewPolicy(network))
	factory.simpleCommand(commands.NewRename(network))
	factory.simpleCommand(commands.NewSensor(network))
	factory.simpleCommand(commands.NewSetConfig(network))
	factory.simpleCommand(commands.NewSpec(network))
	factory.simpleCommand(commands.NewStartPolicy(network))
	factory.simpleCommand(commands.NewStopPolicy(network))
	factory.simpleCommand(commands.NewTree(network))
	factory.simpleCommand(commands.NewVersion(network))

	return factory
}