I would like to change values in domain.xml ( JBoss Configuration file ). Please suggest me the best way to do it with sample examples to change it.
I have found the following ways. But No idea, How to use the following functions for xml files.
( i ) inline_template
( ii ) regsubst
I have to change the following four property as per each group. For Each Group, values of the 4 properties will be changed. Please suggest me the best Industry practise standard.
<system-properties>
<property name="jboss.default.multicast.address" value="230.0.1.1" boot-time="true"/>
<property name="modcluster.balancer.name" value="mylb" boot-time="true"/>
<property name="modcluster.proxylist" value="172.28.168.153:6777" boot-time="true"/>
<property name="mycluster.modcluster.lbgroup" value="coollb" boot-time="true"/>
</system-properties>
inline_template are executed on master, so they won't solve your problem.
The easiest solution is erb templates. But this means that you will control from puppet the entire file, not only the properties.
The best solution: there seems to be an augeas lens for xml: https://twiki.cern.ch/twiki/bin/view/Main/TerjeAndersenAugeas
Edit:
have an erb template in your module (templates/jboss_config.xml.erb)
<bla bla>....
<system-properties>
<property name="jboss.default.multicast.address" value="<%= #multicast_address %>" boot-time="true"/>
<property name="modcluster.balancer.name" value="<%= #balancer_name %>" boot-time="true"/>
<property name="modcluster.proxylist" value="<%= #proxylist %>" boot-time="true"/>
<property name="mycluster.modcluster.lbgroup" value="<%= #lbgroup %>" boot-time="true"/>
</system-properties>
</bla bla>....
In your puppet class declare the parameters/variables (those can came from hiera also, if you want to do overwrites based on some facts):
$multicast_address = '230.0.1.1'
$balancer_name = 'mylb'
$proxylist = '172.28.168.153:6777'
$lbgroup = 'coollb'
# and write your file:
file { 'jboss_config_file':
ensure => file,
path => '/path/to/jboss/config/file.xml',
content => template("${module_name}/jboss_config.xml.erb"),
}
Related
I am trying to write simple aplication with two windows using Glade+Python.
Take look at my code please.
Start file:
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from handlers import *
builder = Gtk.Builder.new_from_file("okno1.glade")
window = builder.get_object("okno") #Main window of the application
window_about = builder.get_object("okno2") #second window of the application - should not be shown at the beginning
builder.connect_signals(Handlers()) #here i connect class "Handlers" which make some actions with signals from both windows
window.connect("delete-event", Gtk.main_quit) # i connect "delete-event" with main window. If we close it, whole app should be closed - works as it should
window_about.connect("delete-event", Gtk.Window.hide) #Here is problematic line....
Gtk.main()
And file with handler class:
class Handlers:
def okno_button_clicked_cb(self, widget):
'''this method takes care about button on main window'''
widget.show_all()
def okno2_button_clicked_cb(self, widget):
'''this method takes care about button on second window'''
widget.hide()
Working app loks like this:
Thare is main Window on left. If I click on the button on it, window on right appears. If I click button on second window - it dissapears. When I click again button on main window second window appears - everything works fine. But if I click "X" button on the top of second window, second window dissapear, and if I click again button on main window, second window appears but without its button.... Where is the problem???? I think something is wrong with "delete event" of second window (window_about). But what should I use instead of Gtk.Window.hide????
Please help, I am completely out of ideas :-(
P.S. here is "okno1.glade":
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="okno">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="default_width">440</property>
<property name="default_height">250</property>
<child>
<object class="GtkFixed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="okno_button">
<property name="label" translatable="yes">otworz durgie okno</property>
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="okno_button_clicked_cb" object="okno2" swapped="no"/>
</object>
<packing>
<property name="x">232</property>
<property name="y">134</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
<object class="GtkWindow" id="okno2">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="default_width">440</property>
<property name="default_height">250</property>
<child>
<object class="GtkFixed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="okno2_button">
<property name="label" translatable="yes">zamknij okno
</property>
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="okno2_button_clicked_cb" object="okno2" swapped="no"/>
</object>
<packing>
<property name="x">237</property>
<property name="y">132</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
I'll explain the problem and its solution, but if you just want the solution without the explanation, the full solution code is at the end of the answer.
Here's the problem. You probably notice that, when you click okno_button, the terminal prints an error message:
TypeError: Gtk.Widget.hide() takes exactly 1 argument (2 given)
This means that when Gtk calls the hide() function that you connected to the delete-event signal, it's giving it two arguments, instead of one. In this case, the one argument is self, since hide() is a class method. When the window is closed (and the delete-event signal is sent), hide() is getting two arguments: self, and the window-close event.
The solution to this error message is to write a separate function that does take two arguments. Here is a simple example:
def hide_window(window, event):
window.hide()
However, if you use this function instead of hide() (window_about.connect("delete-event", hide_window)), the button still disappears. This is because Gtk's delete-event deletes the window (no surprise there).
To prevent the window from deleting itself, you can return True at the end of your hide_window() function. Using return True at the end of a callback function tells Gtk not to react to the event; that you've already taken care of it. This is a nice trick that comes in especially handy in things like text editors, where programmers want to override the default behaviors of a text widget.
All that being said, here is the full working code, with the hide_window() function that only hides the window when it's closed; the window isn't deleted.
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from handlers import *
def hide_window(window, event):
window.hide()
return True
builder = Gtk.Builder.new_from_file("okno1.glade")
window = builder.get_object("okno")
window_about = builder.get_object("okno2")
builder.connect_signals(Handlers())
window.connect("delete-event", Gtk.main_quit)
window_about.connect("delete-event", hide_window)
Gtk.main()
I've created a custom component with these attributes:
CustomComponent
String id
Integer sku
String color
List variants
Price price
Variant and price are custom objects.
When this CmsComponent gets populated and converted using the DefaultCmsItemConverter OOTB :
de.hybris.platform.cmsfacades.rendering.populators.CMSComponentModelToDataRenderingPopulator#populate (line 46)
de.hybris.platform.cmsfacades.cmsitems.converter.DefaultCMSItemConverter#convert(de.hybris.platform.core.model.ItemModel)
It only populates simple attributes like id, sku and color. The Custom Objects like Price and Variants doesn't populate into componentData.setOtherProperties(getCmsItemConverter().convert(componentModel));
How can I get a complete population including inner Object attributes ?
The steps are:
Create new Populator for variants and price
Assign the newly created Populator to the existing Converter
Check https://wiki.hybris.com/pages/viewpage.action?pageId=294094358 for an example.
Update: one of the following should work for you
<bean parent="modifyPopulatorList">
<property name="list" ref="cmsItemConverter" />
<property name="add" ref="myPopulatorVariantAndPrice" />
</bean>
or
<bean parent="modifyPopulatorList">
<property name="list" ref="cmsItemConverterCustomPopulators" />
<property name="add" ref="myPopulatorVariantAndPrice" />
</bean>
I am doing an app in which i have to submit data having 8 entries one by one in a stack. I used the scrollview.But when the user clicks on first entry the keypad will appear and screen scrolls.Then the user can see the second entry and fill the data.
But after coming to fourth entry or fifth entry the scrolls gets stopped.As a result the user cannot see the the next entry without closing the keypad.
Can anyone please give a solution to my problem.I tried adding the scrollview to the entire screen also.
Thanks in Advance.
Here is my code:
<ScrollView>
<StackLayout>
<Entry PlaceHolder="First Name"/>
<Entry PlaceHolder="Last Name"/>
<Entry PlaceHolder="Email"/>
<Entry PlaceHolder="Mobile Number"/>
<Label Text="Address" FontSize="15"/>
<Entry PlaceHolder="House Number"/>
<Entry PlaceHolder="Street"/>
<Entry PlaceHolder="City"/>
<Entry PlaceHolder="Street"/>
<Entry PlaceHolder="State"/>
<Entry PlaceHolder="Country"/>
<Button Text="Submit"/>
</StackLayout>
</ScrollView>
But after coming to fourth entry or fifth entry the scrolls gets stopped.As a result the user cannot see the the next entry without closing the keypad.
Please try using WindowSoftInputMode = SoftInput.AdjustResize for your Activity's setting:
Example:
[Activity(Label = "Demo", MainLauncher = true,WindowSoftInputMode =SoftInput.AdjustResize)]
public class MainActivity : Activity
{
...
}
For details please refer to Specify How Your UI Should Respond session of Handling Input Method Visiblity
I am trying to use an an xpath expression, in order to read requestId field in the xml file given below. however, this expression results in no matches. When I try to enclose the field names with single quotes, it results in a compilation error. I even tried using local-name, instead of name, in the xpath expression. I need to be able to get the value of requestId field as shown.
<int-file:outbound-channel-adapter
id="file" mode="APPEND" charset="UTF-8"
directory="C:\\Users\\dvenkat1\\Desktop\\test"
auto-create-directory="true" filename-generator-expression="#xpath(payload, '/*[name()=Envelope]/*[name()=Body]/*[name()=processArchiveRequest]/*[name()=fulfillmentRequest]/*[name()=requestHeader]/*[name()=requestID]/text()')" />
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sch="http://...schema">
<soap:Header/>
<soap:Body>
<sch:processArchiveRequest>
<sch:fulfillmentRequest>
<sch:requestHeader>
<sch:requestID>Samplereq</sch:requestID>
............
Another option would be, is to use something like this:
<int-file:outbound-channel-adapter
id="file" mode="APPEND" charset="UTF-8"
directory="C:\\Users\\dvenkat1\\Desktop\\test"
auto-create-directory="true" filename-generator-expression="#xpath(payload, 'reference exp1 here']) " />
<int-xml:xpath-expression id = "exp1"
expression="name(/soapNs:Envelope/soapNs:Body/schNs:processArchiveRequest/schNs: fulfillmentRequest/schNs:requestDetail/*[1])"
namespace-map="archiveNamespaceMap" />
<util:map id="archiveNamespaceMap">
<entry key="soapNs" value="http://www.w3.org/2003/05/soap-envelope" />
<entry key="schNs" value="http://blah../schema" />
</util:map>
It works for me like this:
filename-generator-expression="#xpath(payload, '//*[local-name()="requestID"]')"
Pay attention to the escaped " symbol.
Regarding <int-xml:xpath-expression>.
You can use it from the the filename-generator-expression as well, but you should follow with the XPathExpression and therefore use XmlPayloadConverter manually. And do that everything somewhere from the custom bean.
I'm a newbe in ActivePivot and i want to create a dimension with DimensionType = time, where the dates a shown in hierachical manner. E.g. for 30.01.2013 i need one level for the year -> 2013 (sort descending), one level for the month (also sort descending) -> 1 and one level for the days (also sort descending) -> 30, 29, 28, ...
Viewed via ActivePivotLive should look like:
- 2013
- 1
- 30
- 29
- 28
- ...
+ 2012
+ 2011
and so on.
I went through the ActivePivot sandbox project, but i didn't find anything that helps me. The TimeBucket dimension which i've found in the EquityDerivativesCube makes something similar but the buckets are created in a different manner.
How can i solve this problem?
Ok, i handle it out.
It is not necessary to make the round trip and to implement a dimension. It is easy done by levels and the a calculator.
Here the code from the EquityDerivativesCube.xml
<!-- Standard time buckets, bucketing performed at insertion -->
<dimension name="TimeBucket">
<properties>
<entry key="DimensionType" value="time" />
<entry key="IsAllMembersEnabled" value="true" />
</properties>
<level name="Year">
<properties>
<entry key="LevelType" value="TIME_YEARS" />
</properties>
<comparator pluginKey="ReverseOrder" />
</level>
<level name="Month">
<properties>
<entry key="LevelType" value="TIME_MONTHS" />
</properties>
<comparator pluginKey="Custom">
<order name="firstObjects">
<value>Jan</value>
<value>Feb</value>
<value>Mrz</value>
<value>Apr</value>
<value>Mai</value>
<value>Jun</value>
<value>Jul</value>
<value>Aug</value>
<value>Sep</value>
<value>Okt</value>
<value>Nov</value>
<value>Dez</value>
</order>
</comparator>
</level>
<!-- The Value Date level is the field Date -->
<level name="Value Date" property="Date">
<properties>
<entry key="LevelType" value="time" />
</properties>
<comparator pluginKey="ReverseOrder" />
</level>
</dimension>
I added the following snippet to PNLCalculator.enrichTrade:
...
pnl = pnlVega + pnlDelta;
// Year and month calculations BEGIN
final Calendar cal = CALENDAR.get();
cal.setTime(trade.getDate());
final int year = cal.get(Calendar.YEAR);
final String month = DateFormatSymbols.getInstance(GERMANY).getShortMonths()[cal.get(MONTH)];
// Year and month calculations END
// instantiate the result that will hold the enrichment data
final PNLCalculatorResult result = new PNLCalculatorResult();
...
// add them to the result
result.setYear(year);
result.setMonth(month);
...
I also extended the SanboxFields.xml with the two new fields:
...
<field name="Year" type="integer" />
<field name="Month" type="string" />
...
Cheers!
The TimeBucket dimension in the ActivePivot Sandbox application defines a custom bucketing based on financial time periods. Creating a standard year > month > day hierarchy is actually simpler and seamless in ActivePivot. In the description if the schema you need to declare three fields (one for year, one for month and one for the day).
<field name="Year" indexation="dictionary" />
<field name="Month" indexation="dictionary" />
<field name="Day" indexation="dictionary" />
And then you need to declare a dimension that references those fields.
<dimension name="Time">
<level name="Year" />
<level name="Month" />
<level name="Day" />
</dimension>
Then ActivePivot will build the time hierarchy incrementally, by introspecting the loaded records.
This will work automagically if the input records (objects) already contain a Year attribute, a Month attribute and a Day atribute (For instance if the input records are POJOs with getYear(), getMonth() and getDay() methods). If that is not the case and that for instance the input records only have a date attribute, you can either transform your records before puutting them into ActivePivot, or inject a calculator in ActivePivot (com.quartetfs.biz.pivot.classification.ICalculator) that will on the fly compute the three fields from the date. Look at the ActivePivot Sandbox application for an example of calculator.
Extracting those fields is usually done with standard Java code:
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
System.out.println("Date: " + date);
System.out.println("Year: " + calendar.get(Calendar.YEAR));
System.out.println("Month: " + calendar.get(Calendar.MONTH) + 1);
System.out.println("Day: " + calendar.get(Calendar.DAY_OF_MONTH));
About the ordering of members in the level of a dimension, ActivePivot per default uses the natural ordering of java objects (those that implement java.lang.Comparable interface) so dates and integers will be sorted from the lowest to the greatest. You can easily reverse that by declaring a "ReverseOrder" comparator on the target level(s).
<dimension name="Time">
<level name="Year">
<comparator pluginKey="ReverseOrder" />
</level>
<level name="Month">
<comparator pluginKey="ReverseOrder" />
</level>
<level name="Day">
<comparator pluginKey="ReverseOrder" />
</level>
</dimension>