[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
Related
I have used jetty.xml for configuration in older jetty version which looks something like this:
<Configure id="Server" class="org.mortbay.jetty.Server">
<Set name="ThreadPool">
<New class="org.mortbay.thread.BoundedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">250</Set>
<Set name="lowThreads">25</Set>
</New>
</Set>
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="host">
<SystemProperty name="jetty.host"/>
</Set>
<Set name="port">
<SystemProperty name="jetty.port" default="9096"/>
</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
</Item>
<!-- Disabling this as it is a security risk (by exposing all contexts) in production-->
<!--Item>
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
</Item-->
<Item>
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.ContextDeployer">
<Set name="contexts">
<Ref id="Contexts"/>
</Set>
<Set name="configurationDir">
<SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">1</Set>
</New>
</Arg>
</Call>
<New class="org.mortbay.jetty.servlet.Context">
<Arg>
<Ref id="Contexts"/>
</Arg>
<Arg>/cts/output</Arg>
<Set name="resourceBase">
<SystemProperty name="jetty.home" default="."/>/../cache/</Set>
<Call name="addServlet">
<Arg>com.myservlet.webservices.remote.FileProxyServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
<Set name="filename">
<SystemProperty name="jetty.logs" default="../logs"/>/ws.request_yyyy_mm_dd.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">true</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
</Configure>```
And to call this configuration following code has been written:
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
<Set name="filename">
<SystemProperty name="jetty.logs" default="../logs"/>/ws.request_yyyy_mm_dd.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">true</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>
</Configure>
Following code has been written to call this configuration:
Server myServer;
File theConfigFile = new File( "C://jetty//etc//jetty.xml" );
XmlConfiguration theXmlConfiguration = new XmlConfiguration( theConfigFile.toURL() );
theXmlConfiguration.configure( myServer );
myServer.start();
I was trying to create similar configuration using jetty 9.4.43:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="jetty" class="org.eclipse.jetty.server.Server">
<New id="threadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads" type="int"><Property name="jetty.threadPool.minThreads" deprecated="threads.min" default="10"/></Set>
<Set name="maxThreads" type="int"><Property name="jetty.threadPool.maxThreads" deprecated="threads.max" default="200"/></Set>
<Set name="reservedThreads" type="int"><Property name="jetty.threadPool.reservedThreads" default="25"/></Set>
<Set name="idleTimeout" type="int"><Property name="jetty.threadPool.idleTimeout" deprecated="threads.timeout" default="60000"/></Set>
<Set name="detailedDump" type="boolean"><Property name="jetty.threadPool.detailedDump" default="false"/></Set>
</New>
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.util.thread.ScheduledExecutorScheduler"/>
</Arg>
</Call>
<Set name="connectors">
<Array type="org.eclipse.jetty.server.Connector">
<Item>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg><Ref refid="jetty"/></Arg>
<Set name="port">
<Property name="jetty.http.port" default="9096" />
</Set>
</New>
</Item>
</Array>
</Set>
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.HandlerList">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.server.handler.ResourceHandler">
<Set name="directoriesListed">true</Set>
<Set name="resourceBase">.</Set>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
<New class="org.eclipse.jetty.servlet.ServletContextHandler">
<Arg>
<Ref id="Contexts"/>
</Arg>
<Arg>/cts/output</Arg>
<Set name="resourceBase">
<SystemProperty name="jetty.home" default="."/>/../cache/</Set>
<Call name="addServlet">
<Arg>com.myservlet.webservices.remote.FileProxyServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
<Set name="stopAtShutdown"><Property name="jetty.server.stopAtShutdown" default="true"/></Set>
<Set name="stopTimeout"><Property name="jetty.server.stopTimeout" default="5000"/></Set>
<Set name="dumpAfterStart"><Property name="jetty.server.dumpAfterStart" deprecated="jetty.dump.start" default="true"/></Set>
<Set name="dumpBeforeStop"><Property name="jetty.server.dumpBeforeStop" deprecated="jetty.dump.stop" default="true"/></Set>
</Configure>
With new jetty.xml, port 9096 is exposed and all files available under that directory from where intelliJ is running is accessible but the FileProxyServlet url i.e localhost:9096/cts/output is not accessible(shows HTTP ERROR 404 Not Found).
This was not the case earlier instead only servlet was working fine.
Below is the console log on running with new jetty:
System Property [DEBUG] has been deprecated! (Use org.eclipse.jetty.LEVEL=DEBUG instead) 2021-10-16
13:56:48.162:INFO::main: Logging initialized #80050ms to
org.eclipse.jetty.util.log.StdErrLog [ShutdownMonitor] Not enabled
(port < 0): -1 2021-10-16 13:56:48.547:INFO:oejs.Server:Jetty Web
Server Start Thread: jetty-9.4.43.v20210629; built:
2021-06-30T11:07:22.254Z; git:
526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 11.0.7+10-LTS 2021-10-16
13:56:48.650:INFO:oejs.AbstractConnector:Jetty Web Server Start
Thread: Started ServerConnector#70239ac0{HTTP/1.1,
(http/1.1)}{0.0.0.0:9096} Server#4db85c57{STARTING}[9.4.43.v20210629]
STARTING
+= QueuedThreadPool[qtp1589931229]#5ec46cdd{STARTED,8<=8<=200,i=6,r=-1,q=0}[ReservedThreadExecutor#16627f86{s=0/2,p=0}]
STARTED | +- org.eclipse.jetty.util.thread.ThreadPoolBudget#2d7c53b6 | +=
ReservedThreadExecutor#16627f86{s=0/2,p=0} - STARTED | +> threads
size=8 | +> qtp1589931229-31 RUNNABLE tid=31 prio=5 #
java.base#11.0.7/java.lang.invoke.InnerClassLambdaMetafactory.getParameterSize(InnerClassLambdaMetafactory.java:522)
| +> qtp1589931229-34 TIMED_WAITING tid=34 prio=5 IDLE | +>
qtp1589931229-29 TIMED_WAITING tid=29 prio=5 IDLE | +>
qtp1589931229-27 TIMED_WAITING tid=27 prio=5 IDLE | +>
qtp1589931229-32 TIMED_WAITING tid=32 prio=5 IDLE | +>
qtp1589931229-33 RUNNABLE tid=33 prio=5 SELECTING | +>
qtp1589931229-28 TIMED_WAITING tid=28 prio=5 IDLE | +>
qtp1589931229-30 TIMED_WAITING tid=30 prio=5 IDLE
+= ScheduledExecutorScheduler#1e20e272{STARTED} - STARTED
+= ServerConnector#70239ac0{HTTP/1.1, (http/1.1)}{0.0.0.0:9096} - STARTED | +~ Server#4db85c57{STARTING}[9.4.43.v20210629] - STARTING |
+~ QueuedThreadPool[qtp1589931229]#5ec46cdd{STARTED,8<=8<=200,i=6,r=-1,q=0}[ReservedThreadExecutor#16627f86{s=0/2,p=0}]
STARTED | +~ ScheduledExecutorScheduler#1e20e272{STARTED} - STARTED | +- org.eclipse.jetty.io.ArrayByteBufferPool#3a1e66f1 | +=
HttpConnectionFactory#dc1f9ce[HTTP/1.1] - STARTED | | +-
HttpConfiguration#1960af83{32768/8192,8192/8192,https://:0,[]} | |
+> customizers size=0 | | +> formEncodedMethods size=2 | | | +> POST | | | +> PUT | | +> outputBufferSize=32768 | | +> outputAggregationSize=8192 | | +> requestHeaderSize=8192 | | +> responseHeaderSize=8192 | | +> headerCacheSize=1024 | | +> secureScheme=https | | +> securePort=0 | | +> idleTimeout=-1 | | +> blockingTimeout=-1 | | +>
sendDateHeader=true | | +> sendServerVersion=true | | +>
sendXPoweredBy=false | | +> delayDispatchUntilContent=true | |
+> persistentConnectionsEnabled=true | | +> maxErrorDispatches=10 | | +> minRequestDataRate=0 | | +> minResponseDataRate=0 |
| +> cookieCompliance=RFC6265 | | +>
setRequestCookieCompliance=RFC6265 | | +>
notifyRemoteAsyncErrors=true | | +> relativeRedirectAllowed=false
| += SelectorManager#ServerConnector#70239ac0{HTTP/1.1,
(http/1.1)}{0.0.0.0:9096} - STARTED | | +=
ManagedSelector#6ade7db{STARTED} id=0 keys=0 selected=0 updates=0 -
STARTED | | +=
EatWhatYouKill#6c4eab86/SelectorProducer#550ad4bd/PRODUCING/p=false/QueuedThreadPool[qtp1589931229]#5ec46cdd{STARTED,8<=8<=200,i=6,r=-1,q=0}[ReservedThreadExecutor#16627f86{s=0/2,p=0}][pc=0,pic=0,pec=0,epc=0]#2021-10-16T13:56:48.6782212+05:30
STARTED | | | +- SelectorProducer#550ad4bd | | | +~ QueuedThreadPool[qtp1589931229]#5ec46cdd{STARTED,8<=8<=200,i=6,r=-1,q=0}[ReservedThreadExecutor#16627f86{s=0/2,p=0}]
STARTED | | +> updates # 2021-10-16T13:56:48.6732217+05:30 size=0 | | +> keys # 2021-10-16T13:56:48.674221+05:30 size=0 |
+- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:9096] | +- qtp1589931229-31-acceptor-0#24c38c77-ServerConnector#70239ac0{HTTP/1.1,
(http/1.1)}{0.0.0.0:9096}
+= HandlerList#34d20482{STARTED} - STARTED | += ResourceHandler#28a68c0{STARTED} - STARTED
+= ErrorHandler#61ad62a3{STARTED} - STARTED
+> jdk.internal.loader.ClassLoaders$AppClassLoader#311d617d +> jdk.internal.loader.ClassLoaders$PlatformClassLoader#5e955596 key: +-
bean, += managed, +~ unmanaged, +? auto, +: iterable, +] array, +#
map, +> undefined 2021-10-16 13:56:48.679:INFO:oejs.Server:Jetty Web
Server Start Thread: Started #80567ms
I have been struggling on this from past few days, Can anyone please help me out?
Some changes I would recommend.
First, the ResourceHandler is doing nothing for you.
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.server.handler.ResourceHandler">
<Set name="directoriesListed">true</Set>
<Set name="resourceBase">.</Set>
</New>
</Item>
</Array>
At best it sits there and does nothing. (as it has no context so no requests can reach it).
At worst, the way you have set it up you've now shared your entire drive via that ResourceHandler.
Remove it.
Next, the declaration of your ServletContext ...
<New class="org.eclipse.jetty.servlet.ServletContextHandler">
<Arg>
<Ref id="Contexts"/>
</Arg>
<Arg>/cts/output</Arg>
<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/../cache/</Set>
<Call name="addServlet">
<Arg>com.myservlet.webservices.remote.FileProxyServlet</Arg>
<Arg>/</Arg>
</Call>
Things about this declaration ...
It doesn't end it </New> so it's a broken XML.
Fix your XML.
The first <Arg><Ref id="Contexts"/></Arg> is pointless and mangled as well. The first argument appears to be attempting to point to a Contexts reference somewhere else, but that reference doesn't exist anywhere, and your use of <Ref> element is wrong as well, you've declared the <Ref> itself with the id="Contexts" and are not referencing some other id, which would be <Ref refid="otherId"/>.
Remove that <Arg> entirely, it serves no purpose
The use of <Arg>/cts/output</Arg> to set the context-path is wrong in multiple ways.
Context Path rules are (Must start with / and cannot contain any other slash anywhere else, no nested context paths, that's what url-patterns are for)
Don't attempt to use the constructor to set the context-path, use the setter.
Remove this <Arg> as well, declare a valid context path, and then use the setter instead <Set name="contextPath">/foo</Set>
You add a servlet to / url-pattern, making the effort on resourceBase invalid.
Fix this url-pattern.
Your ServletContextHandler is not part of the server handler tree as well. I think you were trying to do that with the first <Arg>, but that's not how you add it to the handler tree.
If you are declaring it directly, just put the <New class="ServletContextHandler">... in the handler tree itself.
If you are loading / instantiating the ServletContextHandler later, then you have to use the DeploymentManager and WebAppProvider along with an existing ContextHandlerCollection that is present in the handler tree already for the deployment to add it to.
You have a weird and frankly broken mix of usages that not even Jetty 6 should have allowed.
You cannot have FileProxyServlet on the default url-pattern (which is /) AND have static resources served at the same time.
Suggestion, use Jetty properly (these suggestions also work in Jetty 6 and all the way back to Jetty 4 no less!)
Don't mix ServletContextHandler and ResourceHandler.
Use the ServletContextHandler only.
Make the ServletContextHandler contexPath only /ctx
Make the ServletContextHandler resourceBase point to the location (directory or jar:file:// url) where your static file content is.
Add the normal DefaultServlet to your ServletContextHandler (make sure it's named "default" and is the only servlet mapped to /).
Add your com.myservlet.webservices.remote.FileProxyServlet to the url-pattern /output.
Finally, add your ServletContextHandler to the server Handler tree.
Here's some more information from past answers that I encourage you to read.
Jetty: default servlet context path
Serving static files from alternate path in embedded Jetty
What is difference between ServletContextHandler.setResourceBase and ResourceHandler.setResourceBase when using Jetty embedded container?
Embedded Jetty handling urls to serve content
How to configure Jetty Handlers?
Serving static files from alternate path in embedded Jetty
Jetty: How to nest HandlerWrapper, HandlerList, and ContextHandlerCollection, and ContextHandler
Thing is, doing this entirely in a single XML file is just baffling (the use of a single XML file to configure Jetty was discouraged back when Jetty 6.0.0 was first released). Have you considered using the XML files that come with jetty-home already and just referencing them (in the correct order) in your own embedded-jetty startup?
That means you only have to define, by hand, the ServletContextHandler, and put it wherever you want your WebAppProvider to look for contexts to deploy.
Bonus is that your effort to upgrade Jetty versions becomes trivial.
I need to test 3 attributes of a node.
Problem is that I must return error for each attributes in error and I don't see how to achieve that in an easy way.
xquery is not really flexible so... not so much to try...
for $theHoldingListsField in //DisplaySettingCol/theDisplaySetting/theHoldingListsFields
return
if ($theHoldingListsField/#AFL != "MANDATORY") then
(
<error id="DPR-CKSEM-DEP-SMF142-2">
<args>
<arg value="{$theHoldingListsField/ancestor::node()/#id}"/>
<arg value="AFL = {$theHoldingListsField/#AFL}"/>
</args>
<location value="{functx:path-to-node-with-pos($theHoldingListsField)}"/>
</error>
)
else if ($theHoldingListsField/#attitudeIndicator != "MANDATORY") then
(
<error id="DPR-CKSEM-DEP-SMF142-2">
<args>
<arg value="{$theHoldingListsField/ancestor::node()/#id}"/>
<arg value="attitudeIndicator = {$theHoldingListsField/#attitudeIndicator}"/>
</args>
<location value="{functx:path-to-node-with-pos($theHoldingListsField)}"/>
</error>
)
So in this example I want to be able to trigger the 3 errors at one time, not one of them (like it is now).
I don't even know if it is possible...
Thanks !
Start by putting the repeated code into a function:
declare function local:check($att as attribute()) as element(error)? {
if ($att != "MANDATORY") then (
<error id="DPR-CKSEM-DEP-SMF142-2">
<args>
<arg value="{$att/../ancestor::node()/#id}"/>
<arg value="{name($att)} = {$att}"/>
</args>
<location value="{functx:path-to-node-with-pos($att/..)}"/>
</error>
) else ()
};
Then your logic reduces to
for $theHoldingListsField in //DisplaySettingCol/theDisplaySetting/theHoldingListsFields
return (local:check($theHoldingListsField/#AFL),
local:check($theHoldingListsField/#attitudeIndicator),
...)
There is no if without else in standard XQuery, since if/then/else is an expression which has to evaluate to some return value in every case (see functional programming).
If you want to return an empty sequence when the error condition is not met, you can do that explicitly, separately for each error. You can then gather all zero-or-one-element sequences into one, which is automatically flattened:
for $theHoldingListsField in //DisplaySettingCol/theDisplaySetting/theHoldingListsFields
return (
if ($theHoldingListsField/#AFL != "MANDATORY") then (
<error id="DPR-CKSEM-DEP-SMF142-2">
<args>
<arg value="{$theHoldingListsField/ancestor::node()/#id}"/>
<arg value="AFL = {$theHoldingListsField/#AFL}"/>
</args>
<location value="{functx:path-to-node-with-pos($theHoldingListsField)}"/>
</error>
) else (),
if ($theHoldingListsField/#attitudeIndicator != "MANDATORY") then (
<error id="DPR-CKSEM-DEP-SMF142-2">
<args>
<arg value="{$theHoldingListsField/ancestor::node()/#id}"/>
<arg value="attitudeIndicator = {$theHoldingListsField/#attitudeIndicator}"/>
</args>
<location value="{functx:path-to-node-with-pos($theHoldingListsField)}"/>
</error>
) else ()
)
Another option is to take a more functional programming approach.
We can generalise your test into a function that operates on a theHoldingListsField as it has only two invariants, the attribute name ($attr-name) and the error code ($error-id).
We basically loop over the attributes (with error codes) that you want to test and call the local:test function on each, e.g.
declare function local:test($theHoldingListsField, $attr-name, $error-id) {
$theHoldingListsField/#*[local-name() eq $attr-name][. ne "MANDATORY"] !
<error id="{$error-id}">
<args>
<arg value="{$theHoldingListsField/ancestor::node()/#id}"/>
<arg value="{$attr-name} = {.}"/>
</args>
<location value="{functx:path-to-node-with-pos($theHoldingListsField)}"/>
</error>
};
let $tests := (
["AFL", "DPR-CKSEM-DEP-SMF142-2"],
["attitudeIndicator", "DPR-CKSEM-DEP-SMF142-2"]
)
for $theHoldingListsField in //DisplaySettingCol/theDisplaySetting/theHoldingListsFields
let $test-fn := local:test($theHoldingListsField, ?, ?)
return
$tests ! fn:apply($test-fn, .)
The example above makes use of XQuery 3.1 features such as arrays ([]), partial function application (?), simple map operator (!), and higher-order-functions (fn:apply). I would suggest learning about those from the XQuery 3.1 W3C spec.
This could also be rewritten to remove the for, and instead have the local:test function operate on all fields (i.e. theHoldingListsFields).
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>
$qdbusxml2cpp -v -c CustomIf -p customif.h:customif.cpp org.item.custom.xml
org.item.custom.xml
<node>
<interface name="org.pace.custom">
<method name="Send_Custom_Msg">
<arg name="msg" type="a(ii)" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="Message"/>
</method>
<signal name="LateEvent">
<arg name="eventkind" type="s" direction="out"/>
</signal>
</interface>
</node>
How to add the header - message.h in the generated adaptor customif.h? I don't want to add manually into it as #include "message.h", but actually want the qdbusxml2cpp to add the inclusion.
Use the following option:
-i <filename> Add #include to the output
So, this would be the corresponding command:
qdbusxml2cpp -v -i message.h -c CustomIf -p customif.h:customif.cpp org.item.custom.xml
I'm trying to use CoreMIDI in a RubyMotion project. Here's a simple example of the code:
clientName = "Client"
clientRef = Pointer.new(:uint)
MIDIClientCreate( clientName, nil, nil, clientRef )
See more detailed code and backtrace in the following gist: https://gist.github.com/4299810
That code results in the following error:
(main)> 2012-12-15 14:43:27.410 core-midi-test[42560:c07]
app_delegate.rb:5:in application:didFinishLaunchingWithOptions:':
expected instance of Pointer of type^{OpaqueMIDIClient}', got I'
(TypeError) 2012-12-15 14:43:27.412 core-midi-test[42560:c07] ***
Terminating app due to uncaught exception 'TypeError', reason:
'app_delegate.rb:5:inapplication:didFinishLaunchingWithOptions:':
expected instance of Pointer of type ^{OpaqueMIDIClient}', gotI'
(TypeError)'
The error is apparently with the fourth argument to MIDIClientCreate. The docs for MIDIClientCreate show:
OSStatus MIDIClientCreate (
CFStringRef name,
MIDINotifyProc notifyProc,
void *notifyRefCon,
MIDIClientRef *outClient
);
MIDIClientRef derives from MIDIObjectRef which is defined as a UInt32, so I'm fairly certain that Pointer.new(:uint) is the correct type to use with RubyMotion.
Here is the pertinent portion of the CoreMIDI.bridgesupport file that RubyMotion is using:
<function name='MIDIClientCreate'>
<arg name='name' type='^{__CFString=}' declared_type='CFStringRef'/>
<arg name='notifyProc' function_pointer='true' type='^?' declared_type='MIDINotifyProc'>
<arg type='^{MIDINotification=iI}' declared_type='MIDINotification*' const='true'/>
<arg type='^v' declared_type='void*'/>
<retval type='v' declared_type='void'/>
</arg>
<arg name='notifyRefCon' type='^v' declared_type='void*'/>
<arg name='outClient' type='^^{OpaqueMIDIClient}' declared_type='MIDIClientRef*'/>
<retval type='l' declared_type='OSStatus'/>
</function>
As far as I can tell, the bridgesupport definition should include the necessary plumbing to make the proper conversion. But it's of course, not working.
Is there something wrong with my code or is there something wrong the CoreMIDI.bridgesupport file included with RubyMotion?
I found out by reading the documentation for MacRuby that one can explicitly pass the desired pointer type to the Pointer constructor like so:
clientName = "Client"
clientRef = Pointer.new(MIDIClientRef.type)
MIDIClientCreate( clientName, nil, nil, clientRef )
portName = "Output"
outport = Pointer.new(MIDIPortRef.type)
MIDIOutputPortCreate( clientRef[0], portName, outport )