Exemplo n.º 1
0
func confAmq(
	amqConfPath string,
	confPolicyEntry string,
	confLevelDB string) string {

	xmlStr := gd.StrFromFilePath(amqConfPath)
	xmlMap, _ := mxj.NewMapXml([]byte(xmlStr))

	step := Step{&xmlMap}

	// flow
	(&step).
		SetJvmHeap("80").
		RemoveLogQuery().
		InsertPolicyEntry(confPolicyEntry).
		RemoveKahadb().
		AddLevelDB(confLevelDB).
		FixAmpersand().
		FixColonKey()
	// dd(xmlMap)

	resultBytes, _ := mxj.AnyXmlIndent(
		xmlMap["beans"], "", "  ", "beans")
	r := gd.BytesToString(resultBytes)

	return r
}
Exemplo n.º 2
0
func confAmqConf(confPath string, confName string) map[string]interface{} {
	prf("read amqconf from %s ...\n", confPath)
	jsonStr := gd.StrFromFilePath(confPath)
	jsonMap, _ := mxj.NewMapJson([]byte(jsonStr))

	ConfMap := jsonMap[confName].([]interface{})[0].(map[string]interface{})

	return ConfMap
}
func (step *Step) InsertPolicyEntry(confPolicyEntry string) *Step {
	xmlMap := step.Value

	prf("read PolicyEntryPath %s...\n", confPolicyEntry)
	nxmlStr := gd.StrFromFilePath(confPolicyEntry)
	nxmlMap, _ := mxj.NewMapXml([]byte(nxmlStr))

	pePath := xmlMap.PathForKeyShortest("policyEntry")
	peValues, _ := xmlMap.ValuesForPath(pePath)
	peValues = append(peValues, nxmlMap["policyEntry"])

	xmlMap.SetValueForPath(peValues, pePath)

	return step
}
Exemplo n.º 4
0
func (step *Step) AddLevelDB(confLevelDB string) *Step {
	xmlMap := step.Value

	prf("read LevelDBconfPath %s...\n", confLevelDB)
	nxmlStr := gd.StrFromFilePath(confLevelDB)
	nxmlMap, _ := mxj.NewMapXml([]byte(nxmlStr))

	m := make(map[string]interface{})
	m["replicatedLevelDB"] = nxmlMap["replicatedLevelDB"]

	paPath := xmlMap.PathForKeyShortest("persistenceAdapter")
	xmlMap.SetValueForPath(m, paPath)

	return step
}
Exemplo n.º 5
0
func confJetty(jettyConfPath string, portValue string) string {
	xmlStr := gd.StrFromFilePath(jettyConfPath)
	// pln(xmlStr)
	xmlMap, _ := mxj.NewMapXml([]byte(xmlStr))
	// dd(xmlMap)
	// pln(typeof(xmlMap))

	step := Step{&xmlMap}
	(&step).
		SetJettyPort(portValue).
		FixColonKey()
	// dd(xmlMap)

	resultBytes, _ := mxj.AnyXmlIndent(xmlMap["beans"], "", "  ", "beans")
	r := gd.BytesToString(resultBytes)
	return r
}