"You have to trust in something—your gut, destiny, life, karma, whatever—because believing that the dots will connect down the road will give you the confidence to follow your heart, even when it leads you off the well-worn path, and that will make all the difference."
— Steve Jobs, 1955 - 2011
"Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma, which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice, heart and intuition. They somehow already know what you truly want to become. Everything else is secondary."
— Steve Jobs, 1955 - 2011
"My friends, love is better than anger. Hope is better than fear. Optimism is better than despair. So let us be loving, hopeful and optimistic. And we’ll change the world."
— Jack Layton, 1950-2011
In SAP PI 7.0, if you are using Java mapping, you would have to copy PI 7.0 aii_map_api.jar into your prefered JAVA IDE and start your mapping code. The skeleton code should look something like this:
package com.objectbiz.pi.mymapping;
import com.sap.aii.mapping.api.*;
import java.io.*
public class MyJavaMapping implements StreamTransformation {
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
// Add your code here
}
}
When you upgrade to SAP PI 7.1, the Java StreamTransformation class has been deprecated and the new JAR com.sap.xpi.ib.mapping.lib.jar is located in usr/sap/<SID>/DVEBMGS<nr>/j2ee/cluster/bin/: ext/com.sap.xi.mapping.api.lib/lib:com.sap.xpi.ib.mapping.lib.jar and to make your code backward compatible, you would:
package com.objectbiz.pi.mymapping;
import com.sap.aii.mapping.api.*;
import java.io.*;
public class MyJavaMapping extends AbstractTransformation{
public void transform(TransformationInput arg0, TransformationOutput arg1)
throws StreamTransformationException {
this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
}
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
// Add your PI 7.0 code here
}
}
Notes:
- In PI 7.1 Java mapping program must extends the abstract class AbstractTransformation.
- Each JAVA Mapping using program 7.1 API must implement the method transform(TransformationInput input, TransformationOutput output).
- In the JAVA Mapping using program 7.1 API trace Object (AbstractTrace) is obtained using getTrace() Method of AbstractTransformation class.
- One of the most useful features of the 7.1 JAVA API is now it supports parameters in the mapping (inline with parameterized message mapping).
- A DynamicConfiguration is a map containing adapter specific message attributes. It associates DynamicConfigurationKeys with string values. The DynamicConfiguration object is obtained using method getDynamicConfiguration()of class com.sap.aii.mapping.api.TransformationInput.
Enjoy!
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations -q MyImage.png MyImage-out.png
In Spring 3.0 the AnnotationMethodHandlerAdapter is extended to support the @RequestBody and has the following HttpMessageConverters registered by default:
-
ByteArrayHttpMessageConverter converts byte arrays.
StringHttpMessageConverter converts strings.
FormHttpMessageConverter converts form data to/from a MultiValueMap<String,String>.
SourceHttpMessageConverter converts to/from a javax.xml.transform.Source.
MarshallingHttpMessageConverter converts to/from an object using the org.springframework.oxm package.
In-order to support JavaScript Object Notation - JSON response, you will need to create an AnnotationMethodHandlerAdapter bean in your spring configuration with a MappingJacksonHttpMessageConverter and annotate your Controller service method with the @RequestBody annotation.
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="order" value="1" />
<property name="messageConverters">
<list>
<!-- Message converters -->
<bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
<bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
<bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"/>
<bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter"/>
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
</list>
</property>
</bean>
The above configuration instruct Spring to iterate over message converters sequentially until it find one that matches the object you are returning.
Listing 1.
@Controller
public class MovieController {
@RequestMapping(value="/movie/{id}", method=RequestMethod.GET)
@ResponseBody
public Movie getMovie(@PathVariable Integer id)
{
return MovieService.findMovie(id);
}
}
In the listing 1 example above, the getMovie method returns a Movie object, Spring iterate through the message converters in the AnnotationMethodHandlerAdapter list for a suitable message converter and because Movie class is not handled by others, it fall back to MappingJacksonHttpMessageConverter hence returned as JSON.
Innovator: engaging others’ innovative ideas
Director: effective goal and expectation setting
Motivator: inspiring and motivating others
Enabler: supporting performance and removing roadblocks
Coach: developing individuals and building teams
"I have never for one instant seen clearly within myself; how then would you have me judge the deeds of others."
— Maurice Maeterlinck (1862-1949), Belgian writer and Nobel laureate