Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing param processing when no value was set
improving remote query executer.
- Loading branch information
Showing
8 changed files
with
223 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...-impl/src/main/java/com/evolveum/midpoint/report/ds/impl/MidPointClientConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.evolveum.midpoint.report.ds.impl; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import javax.xml.ws.BindingProvider; | ||
|
||
import org.apache.cxf.frontend.ClientProxy; | ||
import org.apache.cxf.interceptor.LoggingInInterceptor; | ||
import org.apache.cxf.interceptor.LoggingOutInterceptor; | ||
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; | ||
import org.apache.wss4j.dom.WSConstants; | ||
import org.apache.wss4j.dom.handler.WSHandlerConstants; | ||
|
||
import com.evolveum.midpoint.xml.ns._public.report.report_3.ReportPortType; | ||
import com.evolveum.midpoint.xml.ns._public.report.report_3.ReportService; | ||
|
||
public class MidPointClientConfiguration { | ||
|
||
private String username; | ||
private String password; | ||
private String endpoint; | ||
|
||
public MidPointClientConfiguration() { | ||
System.out.println("client configuration init"); | ||
} | ||
|
||
|
||
public ReportPortType createReportPort() { | ||
System.out.println("creating endpoint with credentials " + username + ": " + password); | ||
System.out.println("Endpoint URL: "+ endpoint); | ||
ClientPasswordHandler.setPassword(password); | ||
|
||
// uncomment this if you want to use Fiddler or any other proxy | ||
//ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888)); | ||
|
||
ReportService reportService = new ReportService(); | ||
ReportPortType reportPort = reportService.getReportPort(); | ||
BindingProvider bp = (BindingProvider)reportPort; | ||
Map<String, Object> requestContext = bp.getRequestContext(); | ||
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint); | ||
|
||
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(reportPort); | ||
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint(); | ||
|
||
Map<String,Object> outProps = new HashMap<String,Object>(); | ||
|
||
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN); | ||
outProps.put(WSHandlerConstants.USER, username); | ||
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST); | ||
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName()); | ||
|
||
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps); | ||
cxfEndpoint.getOutInterceptors().add(wssOut); | ||
// enable the following to get client-side logging of outgoing requests and incoming responses | ||
cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor()); | ||
cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor()); | ||
|
||
return reportPort; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public String getEndpoint() { | ||
return endpoint; | ||
} | ||
|
||
public void setEndpoint(String endpoint) { | ||
this.endpoint = endpoint; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#client configuration for jasper remote query executer | ||
service.endpoint=http://localhost:8080/midpoint/ws/report-3 | ||
|
||
auth.username=administrator | ||
auht.password=5ecr3t |
48 changes: 48 additions & 0 deletions
48
model/report-ds-impl/src/main/resources/ctx-report-ds-context.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2010-2013 Evolveum | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:p="http://www.springframework.org/schema/p" | ||
xmlns:jaxws="http://cxf.apache.org/jaxws" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xmlns:util="http://www.springframework.org/schema/util" | ||
xsi:schemaLocation=" | ||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd | ||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd | ||
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd" | ||
default-lazy-init="false" default-autowire="byName"> | ||
|
||
<import resource="classpath:META-INF/cxf/cxf.xml"/> | ||
<!-- <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"> --> | ||
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> | ||
|
||
<!-- <context:component-scan base-package="com.evolveum.midpoint.report.ds.impl" /> --> | ||
<!-- <context:spring-configured/> --> | ||
|
||
<util:properties id="clientProperties" location="classpath:client.properties" /> | ||
|
||
<context:property-placeholder properties-ref="clientProperties" /> | ||
|
||
<bean id="clientConfig" class="com.evolveum.midpoint.report.ds.impl.MidPointClientConfiguration" | ||
p:username="${auth.username}" | ||
p:password="${auht.password}" | ||
p:endpoint="${service.endpoint}"/> | ||
|
||
|
||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.