//Setup initializes the JSON Checker
354359
func (j *JSON) Setup() error {
	r, err := j.gen()
	if err != nil {
		return err
	}

	dec := json.NewDecoder(r)
	j.values = make(map[string]interface{})

	return dec.Decode(&j.values)
}
130411
func setup(c *caddy.Controller) error {
	configs, err := mimeParse(c)
	if err != nil {
		return err
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Mime{Next: next, Configs: configs}
	})

	return nil
}
842737
func (mounter *quobyteMounter) SetUp(fsGroup *int64) error {
	pluginDir := mounter.plugin.host.GetPluginDir(utilstrings.EscapeQualifiedName(quobytePluginName))
	return mounter.SetUpAt(pluginDir, fsGroup)
}
1354845
func (m *Machine) Setup() error {
	err := m.Validate()
	if err != nil {
		return errors.Wrapf(err, "validation failed")
	}

	return m.buildFSM()
}
1241822
func (m *localVolumeMounter) SetUp(fsGroup *int64) error {
	return m.SetUpAt(m.GetPath(), fsGroup)
}
698018
func setup(c *caddy.Controller) error {
	mdconfigs, err := markdownParse(c)
	if err != nil {
		return err
	}

	cfg := httpserver.GetConfig(c)

	md := Markdown{
		Root:       cfg.Root,
		FileSys:    http.Dir(cfg.Root),
		Configs:    mdconfigs,
		IndexFiles: []string{"index.md"},
	}

	cfg.AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		md.Next = next
		return md
	})

	return nil
}
254424
func (r *Render) Setup() {
	if r.title != "" {
		r.out.SetTitle(r.title)
		debug.AssertNoError(r.out.Flush())
	}
}
1214292
func (ts *TemporalSet) Setup() error {
	if ts.Name == "" {
		return errors.New("Name cannot be empty")
	}
	if len(ts.Shards) == 0 {
		return errors.New("temporal set contains no shards")
	}
	for i := range ts.Shards {
		if ts.Shards[i].WindowEnd.Before(ts.Shards[i].WindowStart) ||
			ts.Shards[i].WindowEnd.Equal(ts.Shards[i].WindowStart) {
			return errors.New("WindowStart must be before WindowEnd")
		}
	}
	return nil
}
516434
func (w *connectedStatusHandler) SetUp() (watcher.NotifyWatcher, error) {
	var err error
	w.code, w.info, _, err = w.config.StateFile.Read()
	if err != nil {
		return nil, errors.Trace(err)
	}

	return w.config.Status.WatchMeterStatus()
}
495839
func (r *amqpRequester) Setup() error {
	conn, err := amqp.Dial(r.url)
	if err != nil {
		return err
	}
	c, err := conn.Channel()
	if err != nil {
		return err
	}
	queue, err := c.QueueDeclare(
		r.queueName, // name
		false,       // not durable
		false,       // delete when unused
		true,        // exclusive
		false,       // no wait
		nil,         // arguments
	)
	if err != nil {
		return err
	}
	err = c.ExchangeDeclare(
		r.exchangeName, // name
		"fanout",       // type
		false,          // not durable
		false,          // auto-deleted
		false,          // internal
		false,          // no wait
		nil,            // arguments
	)
	if err != nil {
		return err
	}
	err = c.QueueBind(
		r.queueName,
		r.queueName,
		r.exchangeName,
		false,
		nil,
	)
	if err != nil {
		return err
	}

	inbound, err := c.Consume(
		r.queueName, // queue
		"",          // consumer
		true,        // auto ack
		false,       // exclusive
		true,        // no local
		false,       // no wait
		nil,         // args
	)
	if err != nil {
		return err
	}
	r.conn = conn
	r.queue = queue
	r.channel = c
	r.inbound = inbound
	r.msg = amqp.Publishing{
		DeliveryMode: amqp.Transient,
		Timestamp:    time.Now(),
		ContentType:  "text/plain",
		Body:         make([]byte, r.payloadSize),
	}
	return nil
}
1311758
func (m *FileSource) Setup(ss *schema.Schema) error {
	m.ss = ss
	if err := m.init(); err != nil {
		return err
	}
	if m.lastLoad.Before(time.Now().Add(-schemaRefreshInterval)) {
		m.lastLoad = time.Now()
	}
	m.partitionCt = uint64(m.ss.Conf.PartitionCt)

	m.partitionFunc = SipPartitioner
	return nil
}
1337213
func Setup(conf config.Config) error {
	keks = make(map[string][]byte)

	netID = conf.NetworkServer.NetID
	rx2DR = conf.NetworkServer.NetworkSettings.RX2DR
	rx1DROffset = conf.NetworkServer.NetworkSettings.RX1DROffset
	rx1Delay = conf.NetworkServer.NetworkSettings.RX1Delay

	for _, k := range conf.JoinServer.KEK.Set {
		kek, err := hex.DecodeString(k.KEK)
		if err != nil {
			return errors.Wrap(err, "decode kek error")
		}

		keks[k.Label] = kek
	}

	return nil
}
1211415
func Setup(ctx *cli.Context, logdir string) error {
	// logging
	log.PrintOrigins(ctx.GlobalBool(debugFlag.Name))
	if logdir != "" {
		rfh, err := log.RotatingFileHandler(
			logdir,
			262144,
			log.JSONFormatOrderedEx(false, true),
		)
		if err != nil {
			return err
		}
		glogger.SetHandler(log.MultiHandler(ostream, rfh))
	}
	glogger.Verbosity(log.Lvl(ctx.GlobalInt(verbosityFlag.Name)))
	glogger.Vmodule(ctx.GlobalString(vmoduleFlag.Name))
	glogger.BacktraceAt(ctx.GlobalString(backtraceAtFlag.Name))
	log.Root().SetHandler(glogger)

	// profiling, tracing
	runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
	Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name))
	if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
		if err := Handler.StartGoTrace(traceFile); err != nil {
			return err
		}
	}
	if cpuFile := ctx.GlobalString(cpuprofileFlag.Name); cpuFile != "" {
		if err := Handler.StartCPUProfile(cpuFile); err != nil {
			return err
		}
	}

	// pprof server
	if ctx.GlobalBool(pprofFlag.Name) {
		address := fmt.Sprintf("%s:%d", ctx.GlobalString(pprofAddrFlag.Name), ctx.GlobalInt(pprofPortFlag.Name))
		StartPProf(address)
	}
	return nil
}
28458
func (*DefaultScene) Setup(u engo.Updater) {
	w, _ := u.(*ecs.World)

	common.SetBackground(color.RGBA{55, 55, 55, 255})
	w.AddSystem(&common.RenderSystem{})

	// Adding camera controllers so we can verify it doesn't break when we move
	w.AddSystem(common.NewKeyboardScroller(scrollSpeed, engo.DefaultHorizontalAxis, engo.DefaultVerticalAxis))
	w.AddSystem(&common.MouseZoomer{zoomSpeed})
	w.AddSystem(&common.MouseRotator{RotationSpeed: 0.125})

	triangle1 := MyShape{BasicEntity: ecs.NewBasic()}
	triangle1.SpaceComponent = common.SpaceComponent{Width: 100, Height: 100}
	triangle1.RenderComponent = common.RenderComponent{Drawable: common.Triangle{}, Color: color.RGBA{255, 0, 0, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&triangle1.BasicEntity, &triangle1.RenderComponent, &triangle1.SpaceComponent)
		}
	}

	rectangle1 := MyShape{BasicEntity: ecs.NewBasic()}
	rectangle1.SpaceComponent = common.SpaceComponent{Position: engo.Point{100, 100}, Width: 100, Height: 100}
	rectangle1.RenderComponent = common.RenderComponent{Drawable: common.Rectangle{}, Color: color.RGBA{0, 255, 0, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&rectangle1.BasicEntity, &rectangle1.RenderComponent, &rectangle1.SpaceComponent)
		}
	}

	circle1 := MyShape{BasicEntity: ecs.NewBasic()}
	circle1.SpaceComponent = common.SpaceComponent{Position: engo.Point{200, 200}, Width: 100, Height: 100}
	circle1.RenderComponent = common.RenderComponent{Drawable: common.Circle{}, Color: color.RGBA{0, 0, 255, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&circle1.BasicEntity, &circle1.RenderComponent, &circle1.SpaceComponent)
		}
	}

	triangle2 := MyShape{BasicEntity: ecs.NewBasic()}
	triangle2.SpaceComponent = common.SpaceComponent{Position: engo.Point{300, 300}, Width: 100, Height: 100}
	triangle2.RenderComponent = common.RenderComponent{Drawable: common.Triangle{TriangleType: common.TriangleRight}, Color: color.RGBA{255, 255, 0, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&triangle2.BasicEntity, &triangle2.RenderComponent, &triangle2.SpaceComponent)
		}
	}

	line1 := MyShape{BasicEntity: ecs.NewBasic()}
	line1.SpaceComponent = common.SpaceComponent{Position: engo.Point{400, 400}, Width: 1, Height: 100}
	line1.RenderComponent = common.RenderComponent{Drawable: common.Rectangle{}, Color: color.RGBA{0, 255, 255, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&line1.BasicEntity, &line1.RenderComponent, &line1.SpaceComponent)
		}
	}

	complexTriangle1 := MyShape{BasicEntity: ecs.NewBasic()}
	complexTriangle1.SpaceComponent = common.SpaceComponent{Position: engo.Point{500, 500}, Width: 100, Height: 100}
	complexTriangle1.RenderComponent = common.RenderComponent{Drawable: common.ComplexTriangles{
		Points: []engo.Point{
			{0.0, 0.0}, {1.0, 0.25}, {0.5, 0.5},
			{0.5, 0.5}, {1.0, 0.75}, {0.0, 1.0},
			{0.0, 0.0}, {0.5, 0.50}, {0.0, 1.0},
		}}, Color: color.RGBA{255, 0, 255, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&complexTriangle1.BasicEntity, &complexTriangle1.RenderComponent, &complexTriangle1.SpaceComponent)
		}
	}

	triangle3 := MyShape{BasicEntity: ecs.NewBasic()}
	triangle3.SpaceComponent = common.SpaceComponent{Position: engo.Point{23, 123}, Width: 50, Height: 50}
	triangle3.RenderComponent = common.RenderComponent{Drawable: common.Triangle{BorderWidth: 1, BorderColor: color.White}, Color: color.RGBA{255, 0, 0, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&triangle3.BasicEntity, &triangle3.RenderComponent, &triangle3.SpaceComponent)
		}
	}

	rectangle2 := MyShape{BasicEntity: ecs.NewBasic()}
	rectangle2.SpaceComponent = common.SpaceComponent{Position: engo.Point{123, 223}, Width: 50, Height: 50}
	rectangle2.RenderComponent = common.RenderComponent{Drawable: common.Rectangle{BorderWidth: 1, BorderColor: color.White}, Color: color.RGBA{0, 255, 0, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&rectangle2.BasicEntity, &rectangle2.RenderComponent, &rectangle2.SpaceComponent)
		}
	}

	circle2 := MyShape{BasicEntity: ecs.NewBasic()}
	circle2.SpaceComponent = common.SpaceComponent{Position: engo.Point{223, 323}, Width: 50, Height: 50}
	circle2.RenderComponent = common.RenderComponent{Drawable: common.Circle{BorderWidth: 1, BorderColor: color.White}, Color: color.RGBA{0, 0, 255, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&circle2.BasicEntity, &circle2.RenderComponent, &circle2.SpaceComponent)
		}
	}

	triangle4 := MyShape{BasicEntity: ecs.NewBasic()}
	triangle4.SpaceComponent = common.SpaceComponent{Position: engo.Point{323, 423}, Width: 50, Height: 50}
	triangle4.RenderComponent = common.RenderComponent{Drawable: common.Triangle{TriangleType: common.TriangleRight, BorderWidth: 1, BorderColor: color.White}, Color: color.RGBA{255, 255, 0, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&triangle4.BasicEntity, &triangle4.RenderComponent, &triangle4.SpaceComponent)
		}
	}

	complexTriangle2 := MyShape{BasicEntity: ecs.NewBasic()}
	complexTriangle2.SpaceComponent = common.SpaceComponent{Position: engo.Point{523, 623}, Width: 50, Height: 50}
	complexTriangle2.RenderComponent = common.RenderComponent{Drawable: common.ComplexTriangles{
		BorderWidth: 1, BorderColor: color.White,
		Points: []engo.Point{
			{0.0, 0.0}, {1.0, 0.25}, {0.5, 0.5},
			{0.5, 0.5}, {1.0, 0.75}, {0.0, 1.0},
			{0.0, 0.0}, {0.5, 0.50}, {0.0, 1.0},
		}}, Color: color.RGBA{255, 0, 255, 255}}

	for _, system := range w.Systems() {
		switch sys := system.(type) {
		case *common.RenderSystem:
			sys.Add(&complexTriangle2.BasicEntity, &complexTriangle2.RenderComponent, &complexTriangle2.SpaceComponent)
		}
	}
}
820026
func Setup(c *Client) error {
	var err error

	client = c

	config, err = loadConfig()
	if err != nil {
		return err
	}

	setupLogging()
	err = setupStore()
	if err != nil {
		return err
	}

	if needsRegistration() {
		registrationInfo.registrationID = generateRegistrationID()
		textSecureStore.SetLocalRegistrationID(registrationInfo.registrationID)

		registrationInfo.password = generatePassword()
		textSecureStore.storeHTTPPassword(registrationInfo.password)

		registrationInfo.signalingKey = generateSignalingKey()
		textSecureStore.storeHTTPSignalingKey(registrationInfo.signalingKey)

		identityKey = axolotl.GenerateIdentityKeyPair()
		err := textSecureStore.SetIdentityKeyPair(identityKey)
		if err != nil {
			return err
		}

		err = registerDevice()
		if err != nil {
			return err
		}
	}
	registrationInfo.registrationID, err = textSecureStore.GetLocalRegistrationID()
	if err != nil {
		return err
	}
	registrationInfo.password, err = textSecureStore.loadHTTPPassword()
	if err != nil {
		return err
	}
	registrationInfo.signalingKey, err = textSecureStore.loadHTTPSignalingKey()
	if err != nil {
		return err
	}
	setupTransporter()
	identityKey, err = textSecureStore.GetIdentityKeyPair()
	return err
}
495300
func (h *handler) SetUp() (watcher.StringsWatcher, error) {
	actions, err := h.config.Facade.RunningActions(h.config.MachineTag)
	if err != nil {
		return nil, errors.Trace(err)
	}
	// We try to cancel any running action before starting up so actions don't linger around
	// We *should* really have only one action coming up here if the execution is serial but
	// this is best effort anyway.
	for _, action := range actions {
		tag, err := names.ParseActionTag(action.Action.Tag)
		if err != nil {
			logger.Infof("tried to cancel action %s but failed with error %v", action.Action.Tag, err)
			continue
		}
		err = h.config.Facade.ActionFinish(tag, params.ActionFailed, nil, "action cancelled")
		if err != nil {
			logger.Infof("tried to cancel action %s but failed with error %v", action.Action.Tag, err)
		}
	}
	return h.config.Facade.WatchActionNotifications(h.config.MachineTag)
}
1118480
func (o *Organizer) Setup(f func()) {
	o.setup = append(o.setup, f)
}