Spring data neo4j 3 with embedded neo 2 - neo4j

im working on my scaffold and i can't seem to get Neo embedded to initialize. I am using Neo 2, so I am running spring data 3.0.0.m1. I can't get it to light up. Here is my context
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<context:spring-configured />
<context:component-scan base-package="com.onuspride.wisdom" />
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
<import resource="spring-data-Neo4j.xml" />
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<bean id="jotm" class="org.springframework.data.neo4j.transaction.JotmFactoryBean"/>
</property>
</bean>
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
<constructor-arg value="target/test-db"/>
<constructor-arg>
<map>
<entry key="tx_manager_impl" value="spring-jta"/>
</map>
</constructor-arg>
</bean>
</beans>
But i get this exception
Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphDatabaseService' defined in class path resource [applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 2 of type [java.lang.Iterable]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1075)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:979)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
I can't find anything anywhere saying there are more constructor parameters.
here's my dependencies
akka = '2.2.3'
akkaSeries = '_2.10'
apacheLog4jVersion = '2.0-beta9'
aspectjVersion = '1.7.2'
cglibVersion = '2.2.2'
commonsCodecVersion = '1.5'
commonsDigesterVersion = '2.1'
commonsFileuploadVersion = '1.3'
commonsLang3Version = '3.1'
elApiVersion = '1.0'
fasterxmlJacksonVersion = '2.3.0'
flexJsonVersion = '2.1'
ginVersion = '2.0.0'
googleAPIClient = '1.17.0-rc'
googleAPIDrive = 'v2-rev110-1.17.0-rc'
googleAPIOauth2 = 'v2-rev59-1.17.0-rc'
googleJackson = '1.15.0-rc'
guavaVersion = '14.0.1'
guiceVersion = '3.0'
gwtpVersion = '1.0.3'
gwtqueryVersion = '1.3.2'
gwtsecurityVersion = '1.2.3'
gwtVersion = '2.5.1'
hamcrestDateVersion = '0.9.5'
hibernateValidator = '5.0.2.Final'
ioSpray = '1.2.0'
javaxServletVersion = '3.0.1'
jedisVersion = '2.1.0'
jettyVersion = '9.1.0.v20131115'
jodaTimeVersion = '1.6'
json4sVersion = '3.2.6'
jspApiVersion = '2.1'
jstlApiVersion = '1.2'
jukitoVersion = '1.1'
junitVersion = '4.11'
lmaxDistruptorVersion = '3.2.0'
neo4jVersion = '2.0.0'
persistenceApiVersion = '1.0'
scalaLangVersion = '2.10.2'
slf4jVersion = '1.7.5'
socialSigninTwitterVersion = '1.1.0-SNAPSHOT'
//springDataNeo4jVersion = '2.3.3.RELEASE'
springDataNeo4jVersion = '3.0.0.M1'
springDataRedis = '1.1.0.RELEASE'
springJsResourcesVerison = '2.3.2.RELEASE'
springJsVersion = '2.3.2.RELEASE'
springScalaVersion = '1.0.0.RC1'
springSecurityVersion = '3.2.0.RELEASE'
springSocialGoogleVersion = '1.0.0.M3'
springSocialVersion = '1.1.0.M4'
springVersion = '3.2.6.RELEASE'
tilesJspVersion = '2.2.2'
compile "com.lmax:disruptor:$lmaxDistruptorVersion"
compile "com.typesafe.akka:akka-actor$akkaSeries:$akka"
compile "com.typesafe.akka:akka-slf4j$akkaSeries:$akka"
compile "io.spray:spray-can:$ioSpray"
compile "io.spray:spray-routing:$ioSpray"
compile "joda-time:joda-time:$jodaTimeVersion"
compile "org.apache.logging.log4j:log4j-api:$apacheLog4jVersion"
compile "org.apache.logging.log4j:log4j-core:$apacheLog4jVersion"
compile "org.apache.logging.log4j:log4j-slf4j-impl:$apacheLog4jVersion"
compile "org.hibernate:hibernate-validator:$hibernateValidator"
compile "org.json4s:json4s-native_2.10:$json4sVersion"
compile "org.scala-lang:scala-library:$scalaLangVersion"
compile "org.springframework.data:spring-data-neo4j-aspects:$springDataNeo4jVersion"
compile "org.springframework.data:spring-data-neo4j-tx:$springDataNeo4jVersion"
compile "org.springframework.data:spring-data-neo4j:$springDataNeo4jVersion"
compile "org.springframework.scala:spring-scala_2.10:$springScalaVersion"
compile "org.springframework:spring-aop:$springVersion"
compile "org.springframework:spring-aspects:$springVersion"
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-tx:$springVersion"
compile group: 'org.neo4j', name: 'neo4j', version: "$neo4jVersion"
compile group: 'org.neo4j.app', name: 'neo4j-server', version: "$neo4jVersion", classifier: 'static-web'
testCompile "junit:junit:$junitVersion"
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.springframework:spring-test:$springVersion"

Spring Data Neo4j 3.0.M1 only works with Neo4j 2.0.0-M06
The next milestone is almost ready, which then will work with Neo4j 2.0.0

I had the same problem. Changing spring-data.xml to the following helped resolve the issue...
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
<bean class="org.springframework.data.neo4j.config.Neo4jConfiguration"/>
<bean class="org.springframework.context.annotation.ConfigurationClassPostProcessor"/>
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"
destroy-method="shutdown" scope="singleton">
</bean>
<bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
<constructor-arg index="0" ref="graphDatabaseService"/>
</bean>
<neo4j:config storeDirectory="target/db/data"/>
<neo4j:repositories base-package="org.example.repository"/>

Related

Ant script javac command converted to a groovy script AntBuilder.javac

Hi im new in the jenkins/ant/groovy world and google couldnt help me to solve my problem.
My task is to get rid of ant scripts in the build process (with jenkins) and include them into the jenkins job (Execute system Groovy script).
The bold sections of my script are the reason for the failure, but i dont know how to solve this.
I hope someone can help me with that problem.
This is my "Execute system Groovy script":
antbuild = new AntBuilder()
projectHome = '...Homedirectory'
projectDomainModel = projectHome + '/CSSDomainModel'
projectPresentationBase = projectHome + '/CSSPresentationBase'
projectServices = projectHome + '/CSSServices'
projectResource = projectHome + '/src/main/resources'
Sources = projectHome + '/Presentation/JavaSource'
projectLibraries = 'lib/bin'
projectWebContent = projectHome + '/Presentation/WebContent'
projectWebInf = projectWebContent + '/WEB-INF'
deployHome = projectHome + '/target/servicekundenportal'
deployBuild = deployHome + '/build/classes'
deployWebInf = deployHome + '/WEB-INF'
foreignSources = 'src'
deployWARFile = deployHome + '/serviceportal.war'
j2eeLibraries = 'D:/Programme_x64/tomcat/8.0.21/Instanz_02/lib'
compileTarget = '1.8'
<b>compilerSourceFiles = antbuild.path{
pathelement(path:Sources)
pathelement(path:projectDomainModel + '/' + foreignSources)
pathelement(path:projectPresentationBase + '/' + foreignSources)
pathelement(path:projectServices + '/' + foreignSources)
}
compilerLibraryFiles = antbuild.path{
fileset(dir:projectDomainModel + '/' + projectLibraries) {include name:'**/*.jar'}
fileset(dir:projectPresentationBase + '/' + projectLibraries) {include name:'**/*.jar'}
fileset(dir:projectServices + '/' + projectLibraries) {include name:'**/*.jar'}
fileset(dir:j2eeLibraries) {include name:'**/*.jar'}
}</b>
antbuild.delete(dir:deployHome)
antbuild.delete(file:deployWARFile)
antbuild.mkdir(dir:deployBuild)
build() {
antbuild.javac(
destdir:deployBuild,
target:compileTarget,
debug:true,
fork:true,
executable:'D:/Programme_x64/Java/jdk1.8.0_45/bin/javac')<b>{
src(path:compilerSourceFiles)
classpath(path:compilerLibraryFiles)
}</b>
}
build()
The part of the Ant script that i am not able to convert:
<!-- Compiler Source File Definition -->
<path id="compilerSourceFiles">
<pathelement path="${Sources}" />
<pathelement path="${projectDomainModel}/${foreignSources}" />
<pathelement path="${projectPresentationBase}/${foreignSources}" />
<pathelement path="${projectServices}/${foreignSources}" />
</path>
<!-- Compiler Library Definition -->
<path id="compilerLibraryFiles">
<fileset id="librariesDomainModel" dir="${projectDomainModel}/${projectLibraries}">
<include name="**/*.jar" />
</fileset>
<fileset id="librariesPresentationBase" dir="${projectPresentationBase}/${projectLibraries}">
<include name="**/*.jar" />
</fileset>
<fileset id="librariesServices" dir="${projectServices}/${projectLibraries}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${j2eeLibraries}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="executeCompiler" depends="preCompile">
<javac destdir="${deployBuild}" target="${compileTarget}"
debug="true" debuglevel="lines,vars" encoding="ISO8859-1">
<src refid="compilerSourceFiles" />
<classpath refid="compilerLibraryFiles" />
</javac>
</target>
You example has a few too many dependencies on local directory structures etc to replicate in full, but using something like the below as a pattern should get you moving in the right direction:
def ant = new AntBuilder()
def projectHome = '...Homedirectory'
ant.path(id: 'compilerSourceFiles') {
pathelement(path: "$projectHome/Presentation/JavaSource")
pathelement(path: "$projectHome/CSSDomainModel/src")
pathelement(path: "$projectHome/CSSPresentationBase/src")
pathelement(path: "$projectHome/CSSServices/src")
}
ant.path(id: "compilerSourceFiles") {
fileset(id: "librariesDomainModel", dir: "$projectHome/CSSDomainModel/lib/bin") {
include(name: "**/*.jar")
}
fileset(id: "librariesPresentationBase", dir: "....") {
include(name: "**/*.jar")
}
//...
}
ant.target(name: 'executeCompiler', depends: 'preCompile') {
javac(destDir: "...", target: "...", debug: true, debugLevel: "lines,vars", encoding: "...") {
src(refid: "compilerSourceFiles")
classpath(refid: "compilerLibraryFiles")
}
}
In other words, each ant xml snippet:
<outerelement outerattribute="outervalue">
<innerelement innerattribute="innervalue" />
</outerelement>
gets converted to:
ant.outerelement(outerattribute: "outervalue") {
innerelement(innerattribute: "innervalue")
}
when using AntBuilder.

BlueZ: get device name by it's mac address

Background: I'm working on OOB Pairing (via USB) between iOS device and embedded Linux board. Currently, on Linux side, I'm receiving bluetooth linkkey (needed for future connections) and mac address.
ps: if you are familiar with the subject - please, look at this question as well.
My current implementation, uses mac address as device's name (for details - see link to the question above), which is being resolved after second bluetoothd service restart.
Question: is there a way to get bluetooth name of the device having it's mac only with a help of BlueZ? I will use this in the C code with an access to BlueZ's DBus interface.
AFAIK, there is no straight forward DBus API or method to find the name from MAC address. But this can done using the method "GetManagedObjects" in "org.freedesktop.DBus.Properties" interface of the device.
Below is the pseudo code which will should work if proper error handling and variables are added. DBus XML is added at the top of the source just for reference.
#if 0
dbus-send --system --dest=org.bluez --type=method_call --print-reply /org/bluez/hci0/dev_44_D8_84_02_A3_17 org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.1 -> dest=:1.7 reply_serial=2
string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml" type="s" direction="out"/>
</method>
</interface>
<interface name="org.bluez.Device1">
<method name="Disconnect"></method>
<method name="Connect"></method>
<method name="ConnectProfile">
<arg name="UUID" type="s" direction="in"/>
</method>
<method name="DisconnectProfile">
<arg name="UUID" type="s" direction="in"/>
</method>
<method name="Pair"></method>
<method name="CancelPairing"></method>
<property name="Address" type="s" access="read"></property>
<property name="Name" type="s" access="read"></property>
<property name="Alias" type="s" access="readwrite"></property>
<property name="Class" type="u" access="read"></property>
<property name="Appearance" type="q" access="read"></property>
<property name="Icon" type="s" access="read"></property>
<property name="Paired" type="b" access="read"></property>
<property name="Trusted" type="b" access="readwrite"></property>
<property name="Blocked" type="b" access="readwrite"></property>
<property name="LegacyPairing" type="b" access="read"></property>
<property name="RSSI" type="n" access="read"></property>
<property name="Connected" type="b" access="read"></property>
<property name="UUIDs" type="as" access="read"></property>
<property name="Modalias" type="s" access="read"></property>
<property name="Adapter" type="o" access="read"></property>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface" type="s" direction="in"/>
<arg name="properties" type="a{sv}" direction="out"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<node name="player0"/></node>"
#endif
#define BT_BLUEZ_NAME "org.bluez"
#define BT_MANAGER_PATH "/"
#define BT_ADAPTER_INTERFACE "org.bluez.Adapter1"
#define BT_DEVICE_IFACE "org.bluez.Device1"
#define BT_MANAGER_INTERFACE "org.freedesktop.DBus.ObjectManager"
#define BT_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
int main(void)
{
char *known_address = "2C:F0:A2:26:D7:F5"; /*This is your address to search */
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, BT_MANAGER_PATH, BT_MANAGER_INTERFACE, NULL, &err);
result = g_dbus_proxy_call_sync(proxy, "GetManagedObjects", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
g_variant_get(result, "(a{oa{sa{sv}}})", &iter);
char *device_path = NULL;
char device_address[18] = { 0 };
/* Parse the signature: oa{sa{sv}}} */
while (g_variant_iter_loop(iter, "{&oa{sa{sv}}}", &device_path, NULL)) {
{
char address[BT_ADDRESS_STRING_SIZE] = { 0 };
char *dev_addr;
dev_addr = strstr(device_path, "dev_");
if (dev_addr != NULL) {
char *pos = NULL;
dev_addr += 4;
g_strlcpy(address, dev_addr, sizeof(address));
while ((pos = strchr(address, '_')) != NULL) {
*pos = ':';
}
g_strlcpy(device_address, address, BT_ADDRESS_STRING_SIZE);
}
}
if (g_strcmp0(known_address, device_address) == 0) {
/* Find the name of the device */
device_property_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, &device_path, BT_PROPERTIES_INTERFACE, NULL, NULL);
result = g_dbus_proxy_call_sync(proxy, "Get", g_variant_new("(ss)", BT_DEVICE_IFACE, "Alias"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
const char *local = NULL;
g_variant_get(result, "(v)", &temp);
local = g_variant_get_string(temp, NULL);
printf("Your desired name : %s\n", local);
}
}
}

KahaDb properties in Grails

Using ActiveMQ in Grails through JMS plugin I cannot figure how to set KahaDb persistence properties.
Tried something like:
amq.broker(useJmx: true, persistent: true) {
amq.transportConnectors() {
amq.transportConnector(uri: "tcp://0.0.0.0:61616")
}
amq.persistenceAdapter() {
amq.kahaDB(directory:${application.config.grails.moviesxd.activemq.kahadb},
checksumJournalFiles:true,
checkForCorruptJournalFiles:true,
ignoreMissingJournalfiles:true)
}
}
But i get
groovy.lang.GroovyRuntimeException: Namespace prefix: kahadb is not bound to a URI
Seems like kahadb prefix is not recognized but i cannot find documentation anywhere on how to do this.
You're just missing the equivalent of
xmlns:amq='http://activemq.apache.org/schema/core'
which would be
xmlns amq:'http://activemq.apache.org/schema/core'
(see the reference docs for more info - search for "Using Spring Namespaces")
so the whole conversion would be
import org.springframework.jms.connection.SingleConnectionFactory
xmlns amq:'http://activemq.apache.org/schema/core'
amq.broker(useJmx: true, persistent: true) {
amq.transportConnectors {
amq.transportConnector(uri: 'tcp://0.0.0.0:61616')
}
amq.persistenceAdapter {
amq.kahaDB(directory: application.config.grails.moviesxd.activemq.kahadb,
checksumJournalFiles: true,
checkForCorruptJournalFiles: true,
ignoreMissingJournalfiles: true)
}
}
amq.connectionFactory(id: 'amqConnectionFactory', brokerURL: 'vm://localhost')
jmsConnectionFactory(SingleConnectionFactory, ref('amqConnectionFactory'))
As a workaround what i've done is to include an additional resources.xml and use standard and well documented XML properties as:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<amq:broker useJmx="true" persistent="true">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://0.0.0.0:61616" />
</amq:transportConnectors>
<amq:persistenceAdapter>
<amq:kahaDB directory="${grails.moviesxd.activemq.kahadb.path}" />
</amq:persistenceAdapter>
</amq:broker>
<amq:connectionFactory id="amqConnectionFactory"
brokerURL="vm://localhost" />
<bean id="jmsConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg ref="amqConnectionFactory" />
</bean>
</beans>
... but it's a piti i have to do this ... still will be great if i get an answer.

How to use Spring Security http pattern on Mule?

Im using spring security, but some parts without been secure and some with so i implemented http pattern for my paths, but it doesnt appear to be working or even going through that part of the code...
Code done so far:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:servlet="http://www.mulesoft.org/schema/mule/servlet"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:ssl="http://www.mulesoft.org/schema/mule/ssl" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/servlet http://www.mulesoft.org/schema/mule/servlet/current/mule-servlet.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/current/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.4/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.4/mule-http.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.4/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.4/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.mulesoft.org/schema/mule/ssl http://www.mulesoft.org/schema/mule/ssl/current/mule-ssl.xsd" version="EE-3.4.0">
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="jdbc-provider" delegate-ref="authenticationManager"></mule-ss:delegate-security-provider>
</mule-ss:security-manager>
<spring:beans>
<spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor" id="loggingInInterceptor" />
<spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" id="loggingOutInterceptor"/>
<spring:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<spring:property name="driverClassName" value="${database.driver}"/>
<spring:property name="url" value="${database.url}"/>
<spring:property name="username" value="${database.user}"/>
<spring:property name="password" value="${database.pass}"/>
</spring:bean>
<ss:http auto-config="true" use-expressions="true" request-matcher="regex">
<ss:intercept-url pattern="^/services/.*\.WSDL$" access="permitAll"/>
<ss:intercept-url pattern="^/services/${webservice.idp.in.pessoas.path}" access="hasRole('ROLE_IDP')" />
<ss:intercept-url pattern="^/services/${webservice.idp.in.setor.path}" access="hasRole('ROLE_IDP')" >
</ss:http>
<ss:authentication-manager alias="authenticationManager" >
<ss:authentication-provider>
<ss:jdbc-user-service data-source-ref="dataSource"
users-by-username-query="
select username, password, enabled
from users where username=?"
authorities-by-username-query="
select u.username, ur.authority from users u, authorities ur
where u.id = ur.user_id and u.username =? "/>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<https:connector name="httpsConnector" doc:name="HTTP\HTTPS">
<https:tls-key-store path="${mule.home}/conf/keystore.jks" keyPassword="ciasc.123" storePassword="ciasc.123"></https:tls-key-store>
</https:connector>
<scripting:transformer name="noopLoggingTransformer">
<scripting:script engine="groovy">
def props = [:]
props['User-Agent'] = message.getProperty('User-Agent', org.mule.api.transport.PropertyScope.INBOUND)
props['MULE_REMOTE_CLIENT_ADDRESS'] = message.getProperty('MULE_REMOTE_CLIENT_ADDRESS', org.mule.api.transport.PropertyScope.INBOUND)
props['http.request'] = message.getProperty('http.request', org.mule.api.transport.PropertyScope.INBOUND)
muleContext.client.dispatch('vm://log-request.in', payload, props)
message
</scripting:script>
</scripting:transformer>
<pattern:web-service-proxy name="Logradouros2" transformer-refs="noopLoggingTransformer" wsdlFile="AutenticacaoServico.wsdl">
<http:inbound-endpoint address="${serverName}/services/Logradouros/AutenticacaoServico" exchange-pattern="request-response">
<http:basic-security-filter realm="mule-realm"/>
</http:inbound-endpoint>
<http:outbound-endpoint address="${targetServer}/servicos/v2/AutenticacaoServico.svc" exchange-pattern="request-response" />
</pattern:web-service-proxy>
<jdbc-ee:postgresql-data-source name="WSA" user="${database.user}" password="${database.pass}" url="${database.url}" transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source">
</jdbc-ee:postgresql-data-source>
<jdbc-ee:connector name="jdbcConnector" dataSource-ref="WSA" validateConnections="false" transactionPerMessage="true" queryTimeout="10" pollingFrequency="10000" doc:name="JDBC">
<jdbc-ee:query key="wsadb" value="insert into inbound_messages (payload, timestamp, agent, ip_from, endpoint, soap_operation) values ('', now(), #[groovy: return message.getInboundProperty('user-agent').toString()], #[groovy: return message.getInboundProperty('MULE_REMOTE_CLIENT_ADDRESS').toString()], #[groovy: return message.getInboundProperty('http.request').toString()], '');"></jdbc-ee:query>
</jdbc-ee:connector>
<flow name="log-request" doc:name="log-request">
<vm:inbound-endpoint path="log-request.in" />
<logger message="#[groovy: return message.getInboundProperty('user-agent').toString()], #[groovy: return message.getInboundProperty('MULE_REMOTE_CLIENT_ADDRESS').toString()], #[groovy: return message.getInboundProperty('http.request').toString()]" level="INFO" doc:name="Logger"/>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="wsadb" responseTimeout="10000" queryTimeout="-1" connector-ref="jdbcConnector" doc:name="Persist raw message" />
</flow>
</mule>
What is required to do to access that?
What i intend to do with that is access the wsdl file without login requirements, and the methods with...
Since you are using Mule's inbound HTTP endpoint, most of the Spring Security you have in place is useless. For example the intercept-url are not doing anything.
I suggest your look at the source code of org.mule.transport.http.filters.HttpBasicAuthenticationFilter and extend it with your own code that will waive security for WSDL requests.
Then replace <http:basic-security-filter realm="mule-realm"/> with your own version.

grails: add context to embedded tomcat in development

In production I have setup an external folder to upload and display
images from by editing server.xml:
<Service name="Catalina">
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="/opt/winmail_storage/imgs" path="/imgs"/>
</Host>
</Engine>
</Service>
I am trying to do the same thing in development by editing _Events.groovy :
eventConfigureTomcat = {tomcat ->
def ctx = tomcat.addContext("/imgs" , "/tmp/images")
}
I also tried
eventConfigureTomcat = {tomcat ->
def ctx = tomcat.addContext("/appName/imgs" , "/tmp/images")
}
this is not working, the imgs directory is not accessible via :
http://host/appName/imgs any idea how I can do this correctly?
finally got it thanks to the grails mailing list:
eventConfigureTomcat = {tomcat ->
def context = tomcat.addWebapp('/acrm/imgs' , '/tmp/images')
def loader = new WebappLoader(tomcat.class.classLoader)
loader.addRepository(new File('/home/mohadib/workspace/acrm/lib').toURI().toURL().toString())
loader.container = context
context.loader = loader
}

Resources