cancel
Showing results for 
Search instead for 
Did you mean: 

Developing EJB module for PI

Amey-Mogare
Contributor
0 Kudos

Hi,

I am a JEE, EJB developer who is developing a EJB module for PI.

I have implemented "Module" interface in Stateless Session Bean.

The task is to remove "LineFeed" characters from Input file and return modified file.

Here is the extract of my session bean code:-



	public ModuleData process(ModuleContext moduleContext,
			ModuleData inputModuleData) throws ModuleException {
		
		Message l_msg = null;
		String l_action = null;
		
		try {

			//1. Get Message Object
			l_msg = (Message)inputModuleData.getPrincipalData();
			
			//3. Reading InputStream and actionName from input moduleContext and inputModuleData
			l_action = (String) moduleContext.getContextData("actionName");
			category.fatalT(location, "RemoveLineFeedCharBean.process(): actionName = "+l_action);
			
			XMLPayload xmlpayload =	l_msg.getDocument();
			InputStream l_inputStream = (InputStream) xmlpayload.getInputStream();
			
			if(l_inputStream != null){

				category.fatalT(location, "RemoveLineFeedCharBean.process(): InputStream isn't NULL");
				//4. Calling method removeLineFeedFromFile()
				byte[] l_byteContent = removeLineFeeds(l_inputStream);
				
				//5. Set the modified content
				xmlpayload.setContent(l_byteContent);
				inputModuleData.setPrincipalData(l_msg);

			}else{
				category.fatalT(location, "RemoveLineFeedCharBean.process(): InputStream is NULL");
			}
			
		} 
		catch (Exception e) {

			category.fatalT(location, "Exception in RemoveLineFeedCharBean.process(): "+e.toString());
		}

		return inputModuleData;	
	}

I have two questions.

1. Would I get InputStream of file at line?

XMLPayload xmlpayload = l_msg.getDocument();

InputStream l_inputStream = (InputStream) xmlpayload.getInputStream();

If not, how would i get it?

2. Where on PI 7.1 system, i could see the logs?

I mean the log statements reported by category.fatalT() method.

Thanks and regards,

Amey

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e674...

have a look into that document.

Also for viewing the logs, after message processing go to the communication channel logs in the adapter for which you are developing the module.

Amey-Mogare
Contributor
0 Kudos

Hi Shabarish,

I have referred to this document while implementing EJB.

I haven't yet tested it in PI7.1 system.

Thanks for mentioning location to view logs.

With regards,

Amey

Answers (0)