Dynamically populate version from version.sbt - sbt

I'm trying to take the version from version.sbt and and populate it to logback.xml's log appender's applicationVersion field.
version.sbt
version in ThisBuild := "0.4.63"
logback.xml
<configuration debug="true" scan="true" scanPeriod="60 seconds">
<appender name="ADP-MESSAGING" class="com.agoda.adp.messaging.logging.appenders.LogbackAppender">
<applicationName>MyApp</applicationName>
<applicationAssemblyName>myapp</applicationAssemblyName>
<applicationVersion>0.4.61</applicationVersion>
<!-- <applicationVersion>${application.version}</applicationVersion> -->
<apiKey>s234W##$WFW$#$#</apiKey>
<getCallerData>false</getCallerData>
</appender>
....
<root level="WARN">
<appender-ref ref="ADP-MESSAGING" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
I tried by adding ${application.version}, ${version} but no success.
How can I do this?
Please share your thoughts.
Thanks

The values interpolated in a logback.xml file are simply Java system properties. All you have to do is add a value to your Java commandline defining the value you want:
// NOTE: This will only work when running through sbt. You'll have to
// append the same value to your startup scripts when running elsewhere.
javaOptions += "-Dapplication.version=" + version.value
With this flag, you should be able to interpolate the version in your XML file:
<applicationVersion>${application.version}</applicationVersion>

You can add logback PropertyDefiner implementation:
package org.mypackage
import ch.qos.logback.core.PropertyDefinerBase
class VersionPropertyDefiner extends PropertyDefinerBase {
override def getPropertyValue: String = BuildInfo.version
}
You will get autogenerated (managed) scala code BuildInfo.version if you use BuildInfoPlugin in your project build settings.
Then you can define and use variable in your logback.xml configuration:
<configuration debug="true" scan="true" scanPeriod="60 seconds">
<define name="appVersion" class="org.mypackage.VersionPropertyDefiner"/>
<appender name="ADP-MESSAGING" class="com.agoda.adp.messaging.logging.appenders.LogbackAppender">
<applicationName>MyApp</applicationName>
<applicationAssemblyName>myapp</applicationAssemblyName>
<applicationVersion>${appVersion}</applicationVersion>
<apiKey>s234W##$WFW$#$#</apiKey>
<getCallerData>false</getCallerData>
</appender>
....
<root level="WARN">
<appender-ref ref="ADP-MESSAGING" />
<appender-ref ref="STDOUT" />
</root>
</configuration>

Related

WSO2 : Transforming response xml

I would like to turn this xml response into something more easily readable.
<?xml version="1.0" encoding="ISO-8859-1"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body>
<executeResponse xmlns="urn:GCE">
<BusinessViewServiceexecuteOut xmlns="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" xmlns:ns2="http://www.generixgroup.com/processus/configuration/scheduler" xmlns:ns3="http://www.generix.fr/technicalframework/business/service/common">
<xmlpres><?xml version = '1.0' encoding = 'UTF-8'?> <VueTable type="View" name="Table" habctr="true" total_business_row="2" nbline="400" confNbline="400" numpage="1" nbpage="1">
<JTblView name="JTblView" type="ViewObject" maxfetchsize="999" maxfetchsizeexceeded="false">
<JTblViewRow current="true" type="ViewRow" index="1" business_row_index="1">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>N</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Non</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Non</business_data>
</Lir>
</JTblViewRow>
<JTblViewRow type="ViewRow" index="2" business_row_index="2">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>O</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Oui</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Oui</business_data>
</Lir>
</JTblViewRow>
</JTblView>
</VueTable></xmlpres>
</BusinessViewServiceexecuteOut>
</executeResponse>
</soap:Body></soap:Envelope>
At least if I could extract what's in the value of "xmlpres", the better I could do:
<table><row><code></code><libelle></libelle/></row></table>
To then turn it into a json response but I can't see ... I just get all the output or in json stream but with everything , which is not usable.
Create an out-mediation sequence with the following content and attach it to the respective API and try out the scenario. This is to extract the xmlpres content and send that as the response to the client
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="out-sequence">
<!-- extract the xmlpres content and store as OM element -->
<property name="XMLBody"
expression="$body//soap:Body//generic:xmlpres"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:gce="urn:GCE"
xmlns:generic="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" type="OM" />
<!-- pass the extracted property as response body -->
<enrich>
<source type="property" property="XMLBody" />
<target type="body" />
</enrich>
</sequence>
Hope this helps you to extract and send the response accordingly.

How to fix: "Status: GracePeriod Blueprint Missing dependencies: (&(objectClass=org.apache.aries.blueprint.NamespaceHandler)"

I built a bundle using camel-archetype-blueprint.
But after deploy to ServiceMix, it has not run and stayed in GracePeriod state.
There is no errors in log:display.
Calling bundle:diag results in:
"Status: GracePeriod Blueprint Missing dependencies:
(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint))".
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">
<cm:property-placeholder
persistent-id="HelloBean" update-strategy="reload">
<cm:default-properties>
<cm:property name="greeting" value="Hi from Camel" />
</cm:default-properties>
</cm:property-placeholder>
<bean id="MyRouteBuilder" class="com.bpjava.tfsredmine.MyRouteBuilder" />
<camelContext id="blueprint-bean-context"
xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="MyRouteBuilder" />
</camelContext>
You need to install camel-blueprint feature on your container

How to config bigbluebutton to work with external Red5 server

From high level architecture overview for bigbluebutton http://docs.bigbluebutton.org/overview/architecture.html I understand that red5 server communicates with client using rtmp or by tunning rtmp via nginx. And then red5 server communicate with FreeSwitch using redis (with fsesl-akka). It mean we are able to desploy red5 in separately server. The result should be 3 servers:
Server for nginx/tomcat7 to run client, bbb-web
Server for Red5 + redis which handle rtmp for module videoconf/sharing/call/audio
Server for Freeswitch
Currently, I am able to config module to use rtmp from separately Red5 server by changing client/conf/config.xml
<config>
<localeversion suppressWarning="false">0.9.0</localeversion>
<version>VERSION</version>
<help url="http://10.0.121.16/help.html"/>
<javaTest url="http://10.0.121.16/testjava.html"/>
<porttest host="10.0.121.16" application="video/portTest" timeout="10000"/>
<bwMon server="10.0.121.16" application="video/bwTest"/>
<application uri="rtmp://10.0.121.16/bigbluebutton" host="http://10.0.121.16/bigbluebutton/api/enter"/>
<language userSelectionEnabled="true" />
<skinning enabled="true" url="http://10.0.121.16/client/branding/css/BBBDefault.css.swf" />
<shortcutKeys showButton="true" />
<browserVersions chrome="CHROME_VERSION" firefox="FIREFOX_VERSION" flash="FLASH_VERSION" java="1.7.0_51" />
<layout showLogButton="false" defaultLayout="bbb.layout.name.defaultlayout"
showToolbar="true" showFooter="true" showMeetingName="true" showHelpButton="true"
showLogoutWindow="true" showLayoutTools="true" confirmLogout="true"
showRecordingNotification="true"/>
<meeting muteOnStart="false" />
<logging enabled="true" target="trace" level="info" format="{dateUTC} {time} :: {name} :: [{logLevel}] {message}" uri="http://10.0.121.16"/>
<lock disableCamForLockedUsers="false" disableMicForLockedUsers="false" disablePrivateChatForLockedUsers="false"
disablePublicChatForLockedUsers="false" lockLayoutForLockedUsers="false" lockOnJoin="true" lockOnJoinConfigurable="false"/>
<modules>
<module name="ChatModule" url="http://10.0.121.16/client/ChatModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="UsersModule"
privateEnabled="true"
fontSize="12"
position="top-right"
baseTabIndex="701"
colorPickerIsVisible="false"
maxMessageLength="1024"
/>
<module name="UsersModule" url="http://10.0.121.16/client/UsersModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
allowKickUser="true"
enableEmojiStatus="true"
enableSettingsButton="true"
baseTabIndex="301"
/>
<module name="DeskShareModule"
url="http://10.0.121.16/client/DeskShareModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/deskShare"
publishURI="10.0.121.16"
useTLS="false"
showButton="true"
autoStart="false"
autoFullScreen="false"
baseTabIndex="201"
/>
<module name="PhoneModule" url="http://10.0.121.16/client/PhoneModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/sip"
autoJoin="true"
listenOnlyMode="true"
presenterShareOnly="false"
skipCheck="false"
showButton="true"
enabledEchoCancel="true"
useWebRTCIfAvailable="true"
showPhoneOption="false"
echoTestApp="9196"
dependsOn="UsersModule"
/>
<module name="VideoconfModule" url="http://10.0.121.16/client/VideoconfModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/video"
dependson = "UsersModule"
baseTabIndex="401"
presenterShareOnly = "false"
controlsForPresenter = "false"
autoStart = "false"
skipCamSettingsCheck="false"
showButton = "true"
showCloseButton = "true"
publishWindowVisible = "true"
viewerWindowMaxed = "false"
viewerWindowLocation = "top"
smoothVideo="false"
applyConvolutionFilter="false"
convolutionFilter="-1, 0, -1, 0, 6, 0, -1, 0, -1"
filterBias="0"
filterDivisor="4"
displayAvatar = "false"
focusTalking = "false"
glowColor = "0x4A931D"
glowBlurSize = "30.0"
priorityRatio = "0.67"
/>
<module name="WhiteboardModule" url="http://10.0.121.16/client/WhiteboardModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="PresentModule"
baseTabIndex="601"
whiteboardAccess="presenter"
keepToolbarVisible="false"
/>
<module name="PollingModule" url="http://10.0.121.16/client/PollingModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="PresentModule"
/>
<module name="PresentModule" url="http://10.0.121.16/client/PresentModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
host="http://10.0.121.16"
showPresentWindow="true"
showWindowControls="true"
openExternalFileUploadDialog="false"
dependsOn="UsersModule"
baseTabIndex="501"
maxFileSize="30"
/>
<module name="LayoutModule" url="http://10.0.121.16/client/LayoutModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
layoutConfig="http://10.0.121.16/client/conf/layout.xml"
enableEdit="false"
/>
</modules>
</config>
Where 10.0.121.14 - run Red5 + redis. 10.0.121.16 run nginx + tomcat7. Any document/help/suggestion from expert for solve this issue?
Seperate Red5 servers can distribute video and deskshare modules, just need to get the archiving scripts to pull the .flv files from stream directory when processing. I would leave the basic red5 on bbb server to handle the rest of messaging with local redis store.
If you want to not have red5 on server all together, then you would need to enable the red5 server to have access to connect to redis. Be careful. downt think and password is set, so you dont want to expose this on public interface without using correct iptable rules.
regards,
Stephen
hostbbb.com

ComponentLookupError raised on z3c.form based form updateWidgets()

I'm having this issue while running tests only after I removed the <includeDependencies package="." /> directive from my configure.zcml file:
Error in test test_get_load_action (sc.embedder.tests.test_content.MultimediaTestCase)
Traceback (most recent call last):
File "/home/hvelarde/collective/buildout.python/parts/opt/lib/python2.7/unittest/case.py", line 329, in run
testMethod()
File "/home/hvelarde/collective/sc.embedder/src/sc/embedder/tests/test_content.py", line 135, in test_get_load_action
edit_form.update()
File "/home/hvelarde/.buildout/eggs/plone.dexterity-1.1.2-py2.7.egg/plone/dexterity/browser/edit.py", line 52, in update
super(DefaultEditForm, self).update()
File "/home/hvelarde/.buildout/eggs/plone.z3cform-0.7.8-py2.7.egg/plone/z3cform/fieldsets/extensible.py", line 59, in update
super(ExtensibleForm, self).update()
File "/home/hvelarde/.buildout/eggs/plone.z3cform-0.7.8-py2.7.egg/plone/z3cform/patch.py", line 30, in GroupForm_update
_original_GroupForm_update(self)
File "/home/hvelarde/.buildout/eggs/z3c.form-2.5.1-py2.7.egg/z3c/form/group.py", line 125, in update
self.updateWidgets()
File "/home/hvelarde/.buildout/eggs/z3c.form-2.5.1-py2.7.egg/z3c/form/form.py", line 129, in updateWidgets
(self, self.request, self.getContent()), interfaces.IWidgets)
File "/home/hvelarde/.buildout/eggs/zope.component-3.9.5-py2.7.egg/zope/component/_api.py", line 109, in getMultiAdapter
raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<Products.Five.metaclass.EditForm object at 0x7f5262a3f490>, <HTTPRequest, URL=http://nohost>, <Embedder at /plone/test-folder/multimedia>), <InterfaceClass z3c.form.interfaces.IWidgets>, u'')
Same versions where working before; current configure.zcml now includes the following:
<include package="Products.CMFCore" file="permissions.zcml" />
<include package="plone.app.dexterity" />
<include package="plone.app.dexterity" file="meta.zcml" />
<include package="five.grok" />
According to the documentation this is a known issue due to a bad migration, but this can't the case.
I'm testing under Plone 4.2.6. Same code works and tests pass under Plone 4.3 as you can see in the CI builds.
Seems I was missing a package on the configure.zcml declaration; now it looks like this:
<include package="Products.CMFCore" file="permissions.zcml" />
<include package="plone.app.dexterity" />
<include package="plone.app.dexterity" file="meta.zcml" />
<include package="collective.dexteritytextindexer" />
and now is working: https://travis-ci.org/simplesconsultoria/sc.embedder/builds/126432050

ASDOC Ant : error with DEFINE

[Flex4.5 - Windows XP]
I defined all my define (string type) in asdoc target like this :
<target name="build-asdoc" depends="setup-asdoc-dir, manifest">
<exec executable="${FLEX_HOME}/bin/asdoc.exe" failonerror="true">
...
<!-- Defines -->
<arg line="-define+=CONFIG::version,'${env.VERSION}'" />
<arg line="-define+=CONFIG::mode,'${mode.production}'" />
<arg line="-define+=CONFIG::label,'${env.LABEL}'" />
Even these define, when ASDOC.exe runs, there are some errors on all these define in the code; example :
[exec] C:\DATA\Trinity\Dev\trinity-client\src\fr\laposte\trinity\common\GlobalClass.as(44): col: 76 Erreur: Accès à la propriété non définie mode.
[exec] private static var WEBSERVICE_SERVER_LABEL_TOKEN:String = String(CONFIG::mode).toUpperCase();
Thank you very much,
regards,
Anthony

Resources