Using Spring Ldap I need to create a subContext to an already created context - spring-ldap

I am using Spring core 2.0.2. When I call 'context.createSubContext()' I get a 'not implemented' error. When I look at the Spring Ldap core source for LdapTemplate I see that it isn't implemented.
So how do I create a subContext in Spring Ldap?

DirContextAdapter is intended to simplify working with attribute values, not interacting with the LDAP tree (see reference docs). You should use LdapTemplate instead - more specifically, in this case, the bind operation.

Related

How to retrieve post data, validate it in controller and save it in database using GORM in Micronaut?

I come from Grails background and have recently started a project in Micronaut using GORM.
I tried to find required information in documentation but its not clear how we retrieve post data in controller, validate it similar to Command Objects offered in Grails and save it into database using interface service provided in documentation
PS : I know I can map every field to action argument in controller, and also declare a interface method specifying each argument as property but that does not seems right thing to do as my domain class has so many properties.
Making the action #Transactional or any method would work for saving data as far as I know but I want to know the proper way in Micronaut.
My requirement is simple, save post data in database using GORM in Micronaut.
If I were you I would look back at the documentation, sections 6.4 to 6.11:
https://docs.micronaut.io/snapshot/guide/index.html#binding
https://docs.micronaut.io/snapshot/guide/index.html#datavalidation
http://hibernate.org/validator/
Micronaut is very annotation based, unlike Grails which uses convention over configuration. However in Grails 4, Micronaut will toke over the application context, giving you some of the benefits of Micronaut, but still maintaining the convention over configuration.

Adding custom attribute in all spring integration component

I need to add custom attribute to all spring integration component for example - need to add 'description' attribute to all inbound and outbound gateway.
Once we are able to add the custom attribute, I need to log the newly added attribute - 'description'.
Can you please suggest the approach for this.
Thanks
I've explained you how it isn't going to be possible because if Java nature. Now let's try to imagine what we could do on the matter. You can register some additional support beans in the application context and have their relationship to the integration components. For example through some id pattern or key-value store like simple HashMap. So, this way you always will be able to extract that additional information whenever you get access to the original component: or rely on its id or call the map registry.

spring integration multiple stored procedure enricher pattern

I am new to spring integration. I have very specific requirement.
I have two Database to fetch.
Created two SP.
I have to get the data calling their respective stored procedure and create a JAXB object to make webservice call.
I am able to call one SP but not able to call 2nd SP. I think I can use enricher pattern but dont know how to configure.
Please help.
Well, trying to answer to your so broad question I only may suggest:
Configure <int-jdbc:stored-proc-outbound-gateway> to call first SP
Configure <int:enricher> with a request-channel for sub-flow to call the second SP similar way like a previous one
with this <int:enricher> you will be able to store additional info in some your Customer model property (which is payload) or headers
And so on until WS call.
Everything rest you can find in the Spring Integration Reference Manual and samples project.
UPDATE
I still need help.
Since it looks like you still don't understand Spring Integration principles properly, I'd suggest you to have one <service-activator> and call both stored procedures in custom code using Spring JDBC directly.
Eventually with an experience you will be able to refactor it really to separate components with the <enricher> on board.
OTOH your scenario recalls me Scatter-Gather pattern.

Best approach for multiple versioned WSDLs

We have a web service that contains 6 different service endpoints, and thus 6 different WSDLs. We are using spring integration for the underlying infrastructure. This particular project will support multiple versions, which is working correctly.
From what I understand, I can server WSDLs one of three ways:
> - <static-wsdl>
> - <dynamic-wsdl>
> - custom servlet approach
The first two approaches do not scale well, I would have to add a new set of WSDL definitions for each version and since the id specifies the WSDL location, the user would have to access something like service1_v1.wsdl, service1_v2.wsdl, etc. For example, here is what the config would look like for static wsdls for two versions:
<sws:static-wsdl id="service1_v1" location="/WEB-INF/wsdl/v1/service1.wsdl"/>
<sws:static-wsdl id="service2_v1" location="/WEB-INF/wsdl/v2/service2.wsdl"/>
...
<sws:static-wsdl id="service1_v2" location="/WEB-INF/wsdl/v2/service1.wsdl"/>
<sws:static-wsdl id="service2_v2" location="/WEB-INF/wsdl/v2/service2.wsdl"/>
...
<sws:static-wsdl id="service1_v3" location="/WEB-INF/wsdl/v3/service1.wsdl"/>
<sws:static-wsdl id="service2_v3" location="/WEB-INF/wsdl/v3/service2.wsdl"/>
The last approach would involve a servlet that processed any wsdl requests, and using a request parameter determine the version. However, I will not be able to take adavantage of any built in spring functionality, like transformLocations.
Is it possible to generate WSDLs programatically? I could add a maven task to generate the WSDLs and add the spring beans at startup.
What I am trying to avoid is having a lot of config and having to update this config every time that we add a new version or deprecate one. I already have a mechanism in SI to correctly router the messages to the appropriate versioned endpoint, just need to finalize the WSDL mappings.
You should be able to do it programmatically, using the same classes that the MessageDispatcherServlet uses, as documented in the Spring Web Services Reference.
Note, however, the caution there about dynamically creating WSDLs.

Injecting blueprint OSGi service into JSF/PrimeFaces bean

I have a project built on top OSGi and Karaf server. For dependency injection we are using Aries Blueprint.
The main part of the project is a Apache Camel routes and integration things, but now I need to create some maintenance web interface.
So I give a try to JSF - PrimeFaces implementation. I was able to create some demo, which works in OSGi under Karaf, that's ok.
Now I'd like to know if it's possible to use Blueprint here, to reference some already existing OSGi services we have and inject the service into JSF Bean, so we can benefit from already written code.
Can you help me, please?
We solved this in the following way:
We created a listener that:
Creates a ServiceTracker that tracks the BlueprintContainer service attached to the same bundle
Puts the servicetracker into the ServletContext attributes
We created an ELResolver that uses this ServiceTracker and if there is a BlueprintContainer available it uses the getComponentInstance of that to get the value
The listener opens the servicetracer during application initialization and closes it during application destroy
Our listener class: https://source.everit.biz/svn/everit-util/trunk/core/src/main/java/org/everit/util/core/servlet/ServiceLoaderListener.java
Our EL resolver class: https://source.everit.biz/svn/everit-util/trunk/core/src/main/java/org/everit/util/core/el/OsgiELResolver.java
User/pass: guest/guest
After you registered your custom el-resolver all el-expressions will be evaluated in the way that id-s of component instances will be searched inside the blueprint container. In case you say that you have a bean-property in your faces-config.xml with the value #{myComponent} it will be searched inside the BlueprintContainer.

Resources