Author: amilas
Date: Thu Jun 25 09:53:08 2009
New Revision: 788308
URL: http://svn.apache.org/viewvc?rev=788308&view=rev
Log:
applied the patch 25-06-2009-sms-transport.patch
Added:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageFormatterImpl.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessage.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageFormatter.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSSender.java
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageBuilderImpl.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/InvalidMessageFormatException.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSImplManager.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSManager.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageBuilder.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageReciever.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportConstents.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportUtils.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPDispatcher.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPImplManager.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPListener.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportInDetails.java
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportOutDetails.java
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageBuilderImpl.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageBuilderImpl.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageBuilderImpl.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageBuilderImpl.java
Thu Jun 25 09:53:08 2009
@@ -21,11 +21,10 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisMessage;
+import org.apache.axis2.description.*;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.util.MultipleEntryHashMap;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -56,12 +55,12 @@
/**
*
* @param message the content of the SMS
- * @param sener senders phone number
+ * @param sender senders phone number
* @param configurationContext axis2 configuration Context
* @return Returns the MessageContext built from the SMS
* @throws InvalidMessageFormatException
*/
- public MessageContext buildMessaage(String message, String sener,
ConfigurationContext configurationContext)
+ public MessageContext buildMessaage(String message, String sender,String
receiver ,ConfigurationContext configurationContext)
throws InvalidMessageFormatException {
String[] parts = message.split(":");
@@ -101,7 +100,17 @@
SOAPEnvelope soapEnvelope =
createSoapEnvelope(messageContext , params);
messageContext.setServerSide(true);
messageContext.setEnvelope(soapEnvelope);
-
+ Parameter sendBack = new Parameter();
+ sendBack.setName(SMSTransportConstents.SEND_TO);
+ sendBack.setValue(sender);
+ Parameter axis2Phone = new Parameter();
+ axis2Phone.setName(SMSTransportConstents.DESTINATION);
+ axis2Phone.setValue(receiver);
+ TransportInDescription in =
configurationContext.getAxisConfiguration().getTransportIn("sms");
+ TransportOutDescription out =
configurationContext.getAxisConfiguration().getTransportOut("sms");
+ out.addParameter(sendBack);
+ messageContext.setTransportIn(in);
+ messageContext.setTransportOut(out);
return messageContext;
}
Added:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageFormatterImpl.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageFormatterImpl.java?rev=788308&view=auto
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageFormatterImpl.java
(added)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/DefaultSMSMessageFormatterImpl.java
Thu Jun 25 09:53:08 2009
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.transport.sms;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.transport.sms.smpp.SMPPTransportOutDetails;
+import org.apache.axis2.description.Parameter;
+import org.apache.axiom.om.OMElement;
+
+public class DefaultSMSMessageFormatterImpl implements SMSMessageFormatter{
+
+
+ public SMSMessage formatSMS(MessageContext messageContext) throws
Exception {
+ String sendTo;
+ //phone number set at the Transport configuration get the precidence
+ String axis2PhoneNumber =
SMPPTransportOutDetails.getInstence().getPhoneNumber() ;
+ Parameter param =
messageContext.getTransportOut().getParameter(SMSTransportConstents.SEND_TO);
+ if (param != null) {
+ sendTo = (String)param.getValue();
+
+ } else {
+ sendTo = SMSTransportUtils.getPhoneNumber(messageContext.getTo());
+ }
+ OMElement elem = messageContext.getEnvelope().getBody();
+ String content = "Empty responce";
+ boolean cont = true;
+ while(cont) {
+
+ content = elem.getFirstElement().getText();
+ if("".equals(content) || content == null) {
+ elem = elem.getFirstElement();
+ if(elem == null) {
+ cont = false;
+ content = "Empty responce";
+ }
+ } else {
+ cont = false;
+ }
+ }
+
+ //if not configured in the Transport configuration
+ if("0000".equals(axis2PhoneNumber)) {
+ Parameter axisPhone =
messageContext.getTransportOut().getParameter(SMSTransportConstents.DESTINATION);
+ if(axisPhone != null) {
+ axis2PhoneNumber = (String)axisPhone.getValue();
+ }
+ }
+
+ return new SMSMessage( axis2PhoneNumber, sendTo , content
,SMSMessage.OUT_MESSAGE);
+
+ }
+
+
+}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/InvalidMessageFormatException.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/InvalidMessageFormatException.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/InvalidMessageFormatException.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/InvalidMessageFormatException.java
Thu Jun 25 09:53:08 2009
@@ -19,7 +19,10 @@
package org.apache.axis2.transport.sms;
public class InvalidMessageFormatException extends Exception{
-
+ /**
+ *
+ * @param message that need to be send back to the sender reporing his
error
+ */
public InvalidMessageFormatException(String message) {
this.messageToSendBack = message;
}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSImplManager.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSImplManager.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSImplManager.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSImplManager.java
Thu Jun 25 09:53:08 2009
@@ -19,6 +19,8 @@
package org.apache.axis2.transport.sms;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.AxisFault;
import java.util.ArrayList;
@@ -39,11 +41,23 @@
public void stop();
/**
- * set the Paramaters needed
- * for the implementation
- * @param params ArrayList of Paramters
+ * set the Transport out details that is needed for the implementation
manager
+ * @param transportOutDetails
+ * @throws AxisFault
*/
- public void setTransportParamters(ArrayList<Parameter> params) throws
AxisFault;
+ public void setTransportOutDetails(TransportOutDescription
transportOutDetails) throws AxisFault;
+ /**
+ * set the Transport in details that is needed for the implementation
manager
+ * @param transportInDetails
+ * @throws AxisFault
+ */
+ public void setTransportInDetails(TransportInDescription
transportInDetails) throws AxisFault;
+ /**
+ * send the SMS that is passed as a parameter using the current
implimentation (To know the Content of the SMSMessage Look in to the
documantaion of
+ * the SMSMessage )
+ * @param sm SMSMessage to be send
+ */
+ public void sendSMS(SMSMessage sm);
}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSManager.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSManager.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSManager.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSManager.java
Thu Jun 25 09:53:08 2009
@@ -19,6 +19,9 @@
package org.apache.axis2.transport.sms;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.ParameterInclude;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.sms.smpp.SMPPImplManager;
@@ -40,6 +43,7 @@
private boolean inited;
private ConfigurationContext configurationContext;
private SMSMessageBuilder messageBuilder;
+ private SMSMessageFormatter messageFormatter;
/** the reference to the actual commons logger to be used for log
messages */
protected Log log = LogFactory.getLog(this.getClass());
@@ -53,70 +57,136 @@
}
+ /**
+ * @return singleton Object of the SMSManager
+ */
public static SMSManager getSMSManager() {
if(ourInstence == null) {
ourInstence = new SMSManager();
}
-
return ourInstence;
}
+ /**
+ * initialize the SMS manager with TransportinDiscription
+ * if Manager is already inited it will only set the TransportInDiscription
+ * in the current Implimentation manager
+ * @param transportInDescription
+ * @param configurationContext
+ * @throws AxisFault
+ */
+ public void init(TransportInDescription transportInDescription
,ConfigurationContext configurationContext) throws
+ AxisFault {
+ if (!inited) {
+ basicInit(transportInDescription , configurationContext);
+ }
- public void init(ArrayList<Parameter> paramters , ConfigurationContext
configurationContext) throws AxisFault {
- this.configurationContext = configurationContext;
- String implClass =
(String)SMSTransportUtils.getParameterValue(paramters ,
- SMSTransportConstents.IMPLIMENTAION_CLASS );
- if(implClass == null ) {
- currentImplimentation = new SMPPImplManager();
+ Parameter builderClass =
transportInDescription.getParameter(SMSTransportConstents.BUILDER_CLASS);
+
+ if(builderClass == null) {
+ messageBuilder = new DefaultSMSMessageBuilderImpl();
} else {
try {
- currentImplimentation =
(SMSImplManager)Class.forName(implClass).newInstance();
+ messageBuilder =
(SMSMessageBuilder)Class.forName((String)builderClass.getValue()).newInstance();
+
} catch (Exception e) {
- throw new AxisFault("Error while instentiating class " +
implClass , e );
+ throw new AxisFault("Error while instentiating class " +
builderClass.getValue() , e );
}
}
+ currentImplimentation.setTransportInDetails(transportInDescription);
+ inited = true;
+ }
- currentImplimentation.setTransportParamters(paramters);
+ /**
+ * Initialize the SMS Maneger with TransportOutDiscription
+ * if the Maneger is already inited it will set the Transport Outdetails
+ * in the Current Implimentation Manage
+ * @param transportOutDescription
+ * @param configurationContext
+ */
+ public void init(TransportOutDescription transportOutDescription ,
ConfigurationContext configurationContext) throws
+ AxisFault {
+ if(!inited) {
+ basicInit(transportOutDescription , configurationContext);
+ }
+ Parameter formatterClass =
transportOutDescription.getParameter(SMSTransportConstents.FORMATTER_CLASS);
- String builderClass =
(String)SMSTransportUtils.getParameterValue(paramters ,
- SMSTransportConstents.BUILDER_CLASS);
+ if(formatterClass == null) {
+ messageFormatter = new DefaultSMSMessageFormatterImpl();
+ }else {
+ try {
+ messageFormatter =
(SMSMessageFormatter)Class.forName((String)formatterClass.getValue()).newInstance();
+ } catch (Exception e) {
+ throw new AxisFault("Error while instentiating the Class: "
+formatterClass.getValue() ,e);
+ }
+ }
+ currentImplimentation.setTransportOutDetails(transportOutDescription);
+ inited = true;
+ }
- if(builderClass == null) {
- messageBuilder = new DefaultSMSMessageBuilderImpl();
+ private void basicInit(ParameterInclude transportDescription,
ConfigurationContext configurationContext) throws
+ AxisFault {
+ this.configurationContext = configurationContext;
+ Parameter p =
transportDescription.getParameter(SMSTransportConstents.IMPLIMENTAION_CLASS);
+
+ if (p == null) {
+ currentImplimentation = new SMPPImplManager();
} else {
+ String implClass = (String) p.getValue();
+
try {
- messageBuilder =
(SMSMessageBuilder)Class.forName(builderClass).newInstance();
+ currentImplimentation = (SMSImplManager)
Class.forName(implClass).newInstance();
} catch (Exception e) {
- throw new AxisFault("Error while instentiating class " +
builderClass , e );
+ throw new AxisFault("Error while instentiating class " +
implClass, e);
}
}
- inited = true;
- }
+ }
/**
* Dispatch the SMS message to Axis2 Engine
* @param message
* @param sender
*/
- public void dispatchToAxis2(String message , String sender) {
+ public void dispatchToAxis2(SMSMessage sms) {
try {
- MessageContext msgctx = messageBuilder.buildMessaage(message ,
sender , configurationContext);
+ MessageContext msgctx =
messageBuilder.buildMessaage(sms.getContent() , sms.getSender()
,sms.getReceiver(),
+ configurationContext);
AxisEngine.receive(msgctx);
} catch (InvalidMessageFormatException e) {
log.debug("Invalid message format " + e);
- //do some thing like send a errror message
+
} catch (AxisFault axisFault) {
- System.out.println("Axis fault " + axisFault);
+ log.debug(axisFault);
} catch (Throwable e) {
- System.out.println("Unknown Exception " + e);
+ log.debug("Unknown Exception " , e);
}
}
-
+ /**
+ * send a SMS form the message comming form the Axis2 Engine
+ * @param messageContext that is comming form the Axis2
+ */
+ public void sendSMS(MessageContext messageContext) {
+ try {
+ SMSMessage sms = messageFormatter.formatSMS(messageContext);
+ currentImplimentation.sendSMS(sms);
+ } catch (Exception e) {
+ log.error("Error while sending the SMS " , e);
+ }
+
+ }
+
+ /**
+ * send the information SMS messages other than messages comming form the
Axis2 Engine
+ * @param sms
+ */
+ public void sentInfo(SMSMessage sms) {
+ currentImplimentation.sendSMS(sms);
+ }
public ArrayList<Parameter> getTransportParameters() {
return transportParameters;
}
Added:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessage.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessage.java?rev=788308&view=auto
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessage.java
(added)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessage.java
Thu Jun 25 09:53:08 2009
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.transport.sms;
+
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * SMS message is a atomic object wich carries a SMS
+ * SMS has can be either a IN message or a OUT message
+ * which will have the details sender , receiver and Content
+ * sender , receiver has a implied meaning with the Message direction
+ * eg:
+ * in a IN_MESSAGE sender : the phone number of the phone that sms has been
sent to axis2
+ * receiver : the phone number given from the SMSC to the Axis2
+ * in a OUT_MESSAGE sender : the phone number given from the SMSC to the Axis2
+ * receiver : the phone number of the phone that sms created
from Axis2 must deliver to
+ */
+public class SMSMessage {
+
+
+ private String sender;
+ private String receiver;
+ private String content;
+ private int direction;
+
+ public static int IN_MESSAGE =1;
+ public static int OUT_MESSAGE =2;
+
+ /**
+ *
+ * @param sender
+ * @param reciever
+ * @param content
+ * @param direction
+ * @throws AxisFault
+ */
+ public SMSMessage(String sender ,String reciever, String content , int
direction) throws AxisFault {
+ this.sender = sender;
+ this.content = content;
+ this.receiver = reciever;
+ if (direction == IN_MESSAGE || direction == OUT_MESSAGE ) {
+ this.direction = direction;
+
+ } else {
+ throw new AxisFault("Message must be in or out");
+ }
+
+ }
+
+ /**
+ * Retuen the Phone Number of the Sender
+ * @return String that contain the senders phone Number
+ */
+ public String getSender() {
+ return sender;
+ }
+
+ /**
+ * Return the phone Number that SMS must be received to
+ * @return String that Contain the receivers phone Number
+ */
+ public String getReceiver() {
+ return receiver;
+ }
+
+ /**
+ * Return The Contect that will be send with the SMS
+ * @return String that contain the content
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * return the Message Direction of the SMSMessage
+ * That should be either SMS_IN_MESSAGE :1
+ * Or SMS_OUT_MESSAGE : 2
+ * @return int that will infer the message direction
+ */
+ public int getDirection() {
+ return direction;
+ }
+}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageBuilder.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageBuilder.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageBuilder.java
Thu Jun 25 09:53:08 2009
@@ -34,10 +34,11 @@
* @param message the content of the SMS
* @param configurationContext axis2 configuration Context
* @param sener senders phone number
+ * @param receiver receivers phone number
* @return the Axis2 Message Context build
* @throws InvalidMessageFormatException if Message is not in correct
format
*/
- public MessageContext buildMessaage(String message ,String sener,
ConfigurationContext configurationContext)
+ public MessageContext buildMessaage(String message ,String sener,String
receiver, ConfigurationContext configurationContext)
throws InvalidMessageFormatException;
}
Added:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageFormatter.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageFormatter.java?rev=788308&view=auto
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageFormatter.java
(added)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageFormatter.java
Thu Jun 25 09:53:08 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.transport.sms;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.AxisFault;
+
+/**
+ * Interface for the Message formatters that build the out going SMSMessage
from th Axis2 Message Context
+ */
+public interface SMSMessageFormatter {
+
+ /**
+ * format the out going SMS message from the MessageContext
+ * @param messageContext
+ * @return SMSMessage thats going to submited to the SMSC
+ */
+ public SMSMessage formatSMS(MessageContext messageContext) throws
Exception;
+
+}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageReciever.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageReciever.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageReciever.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSMessageReciever.java
Thu Jun 25 09:53:08 2009
@@ -29,13 +29,11 @@
public class SMSMessageReciever implements TransportListener {
-
-
private SMSManager smsManeger;
public void init(ConfigurationContext configurationContext,
TransportInDescription transportInDescription) throws AxisFault {
smsManeger = SMSManager.getSMSManager();
- smsManeger.init(transportInDescription.getParameters() ,
configurationContext);
+ smsManeger.init(transportInDescription , configurationContext);
}
Added:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSSender.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSSender.java?rev=788308&view=auto
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSSender.java
(added)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSSender.java
Thu Jun 25 09:53:08 2009
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axis2.transport.sms;
+
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.OutTransportInfo;
+import org.apache.axis2.transport.base.AbstractTransportSender;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.TransportOutDescription;
+
+/**
+ * Transport sender that sends the SMS messages form the Axis2 Engine
+ */
+public class SMSSender extends AbstractTransportSender {
+ private SMSManager smsManager;
+
+
+
+ public void cleanup(MessageContext msgContext) throws AxisFault {
+
+ }
+
+ public void sendMessage(MessageContext msgCtx, String targetEPR,
OutTransportInfo outTransportInfo) throws AxisFault {
+
+ smsManager.sendSMS(msgCtx);
+
+ }
+
+ public void init(ConfigurationContext confContext, TransportOutDescription
transportOut) throws AxisFault {
+ smsManager = SMSManager.getSMSManager();
+ smsManager.init(transportOut, confContext);
+ }
+
+ public void stop() {
+ smsManager.stop();
+ }
+}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportConstents.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportConstents.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportConstents.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportConstents.java
Thu Jun 25 09:53:08 2009
@@ -18,11 +18,29 @@
*/
package org.apache.axis2.transport.sms;
+/**
+ * Keeps the constets that are need for SMS Transport.Currently The code of
the Class is divided in to three sections
+ * for the keep the clarity
+ * 1) SMS Transport Constents : add the constents to this section if you need
to add new constents to the gneric
+ * SMSTransport level.
+ * 2) SMPP Constents : SMPP is one implimentation of SMSTransport.Add
Constents to this section if you need to add
+ * constents related to SMPP section
+ * 3) GSM Constets : This a another implimentation. Add Constents to this
section if you need to add constents related
+ * to GSM section
+ *
+ * if you are going to add a another SMS implimentation add a another section
to this class eg:"XXX Transport Constents"
+ */
public class SMSTransportConstents {
-
+ /**
+ * SMS Transport Constents
+ */
public static String IMPLIMENTAION_CLASS = "smsImplClass";
public static String BUILDER_CLASS = "builderClass";
-
+ public static String FORMATTER_CLASS ="formatterClass";
+ public static String SEND_TO="sms_sender";
+ public static String DESTINATION = "sms_destination";
+ public static String PHONE_NUMBER = "phoneNumber";
+
/**
* SMPP constents
*/
@@ -32,6 +50,8 @@
public static String HOST = "host";
public static String PORT = "port";
-
+ /**
+ * GSM Constents
+ */
}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportUtils.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportUtils.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportUtils.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/SMSTransportUtils.java
Thu Jun 25 09:53:08 2009
@@ -19,21 +19,54 @@
package org.apache.axis2.transport.sms;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.addressing.EndpointReference;
import java.util.ArrayList;
public class SMSTransportUtils {
+ /**
+ * Given the array list of parameters and a name of the parameter
+ * it will return the Value of that Parameter
+ *
+ * @param list
+ * @param name
+ * @return Object that stores the value of that Parameter
+ */
public static Object getParameterValue(ArrayList<Parameter> list, String
name) {
- if(name ==null)
- {
+ if (name == null) {
return null;
}
- for (Parameter p : list) {
- if(name.equals(p.getName())) {
+ for (Parameter p : list) {
+ if (name.equals(p.getName())) {
return p.getValue();
}
}
return null;
}
+
+ /**
+ * given the EPR it will return the phone number that the EPR represents
+ * this assumes a EPR of format
+ * sms://<phone_number>/
+ *
+ * @param epr
+ * @return
+ */
+ public static String getPhoneNumber(EndpointReference epr) throws
Exception {
+
+ String eprAddress = epr.getAddress();
+ String protocal = eprAddress.substring(0, 3);
+ if (protocal != null && protocal.equals("sms")) {
+ String parts[] = eprAddress.split("/");
+ String phoneNumber = parts[2];
+ return phoneNumber;
+ } else {
+ throw new Exception("Invalid Epr for the SMS Transport : Epr must
be of format sms://<phone_number>/");
+ }
+ }
+
+
}
+
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPDispatcher.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPDispatcher.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPDispatcher.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPDispatcher.java
Thu Jun 25 09:53:08 2009
@@ -20,25 +20,22 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.transport.sms.SMSManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.axis2.transport.sms.SMSMessage;
-public class SMPPDispatcher implements Runnable{
-
- SMPPMessage smppMessage;
+/**
+ * Dispatch the SMS message taken frpm the SMPP PDU to the Axis2
+ */
+public class SMPPDispatcher{
- void dispatch(String source , String message) throws AxisFault {
+ SMSMessage smsMessage;
+
+ void dispatch(String source , String receiver,String message) throws
AxisFault {
synchronized (this){
- smppMessage = new SMPPMessage(source , null, message ,
SMPPMessage.IN_MESSAGE);
+ smsMessage = new SMSMessage(source ,receiver, message ,
SMSMessage.IN_MESSAGE);
- }
- new Thread(this).start();
+ }
+ SMSManager.getSMSManager().dispatchToAxis2(smsMessage);
}
- public void run() {
-
- SMSManager.getSMSManager().dispatchToAxis2(smppMessage.getContent() ,
smppMessage.getSender());
-
- }
}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPImplManager.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPImplManager.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPImplManager.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPImplManager.java
Thu Jun 25 09:53:08 2009
@@ -19,47 +19,52 @@
package org.apache.axis2.transport.sms.smpp;
import org.apache.axis2.transport.sms.SMSImplManager;
-import org.apache.axis2.transport.sms.SMSTransportUtils;
import org.apache.axis2.transport.sms.SMSTransportConstents;
-import org.apache.axis2.description.Parameter;
+import org.apache.axis2.transport.sms.SMSMessage;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.AxisFault;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jsmpp.session.SMPPSession;
import org.jsmpp.session.BindParameter;
-import org.jsmpp.bean.BindType;
-import org.jsmpp.bean.TypeOfNumber;
-import org.jsmpp.bean.NumberingPlanIndicator;
+import org.jsmpp.bean.*;
+import org.jsmpp.util.TimeFormatter;
+import org.jsmpp.util.AbsoluteTimeFormatter;
+import org.jsmpp.InvalidResponseException;
+import org.jsmpp.PDUException;
+import org.jsmpp.extra.NegativeResponseException;
+import org.jsmpp.extra.ResponseTimeoutException;
-import java.util.ArrayList;
import java.io.IOException;
+import java.util.Date;
public class SMPPImplManager implements SMSImplManager {
/** the reference to the actual commons logger to be used for log
messages */
protected Log log = LogFactory.getLog(this.getClass());
- private String systemType ="cp";
- private String systemId;
- private String password;
- private String host="127.0.0.1";
- private int port = 2775;
- private volatile boolean stop=true;
+ private SMPPTransportInDetails smppTransportInDetails =
SMPPTransportInDetails.getInstence();
+ private SMPPTransportOutDetails smppTransportOutDetails =
SMPPTransportOutDetails.getInstence();
+ private volatile boolean stop=true;
- private SMPPSession session;
+ private SMPPSession inSession;
+ private SMPPSession outSession;
+ private static TimeFormatter timeFormatter = new AbsoluteTimeFormatter();
public void start() {
- session = new SMPPSession();
+ inSession = new SMPPSession();
try {
- session.connectAndBind(host, port, new
BindParameter(BindType.BIND_RX, systemId,
- password, systemType , TypeOfNumber.UNKNOWN,
NumberingPlanIndicator.UNKNOWN, null));
+ inSession.connectAndBind(smppTransportInDetails.getHost(),
smppTransportInDetails.getPort(), new BindParameter(BindType.BIND_RX,
smppTransportInDetails.getSystemId(),
+ smppTransportInDetails.getPassword(),
smppTransportInDetails.getSystemType() , TypeOfNumber.UNKNOWN,
NumberingPlanIndicator.UNKNOWN, null));
SMPPListener listener = new SMPPListener();
- session.setMessageReceiverListener(listener);
+ inSession.setMessageReceiverListener(listener);
stop = false;
- System.out.println("[Axis2] bind and connect to " + port + "on
SMPP Transport");
-
+ System.out.println(" [Axis2] bind and connect to " +
smppTransportInDetails.getHost()+" : " +
+ smppTransportInDetails.getPort() + " on SMPP Transport");
+
} catch (IOException e) {
log.error("Unable to conncet" + e);
}
@@ -67,46 +72,146 @@
}
public void stop() {
- log.info("Stopping SMPP Transport...");
+ log.info("Stopping SMPP Transport ...");
stop = true;
- session.unbindAndClose();
- }
+ if(inSession != null) {
+ inSession.unbindAndClose();
+ }
- public void setTransportParamters(ArrayList<Parameter> params) throws
AxisFault {
+ if(outSession !=null) {
+ outSession.unbindAndClose();
+ }
+ }
- String tmp = (String) SMSTransportUtils.getParameterValue(params ,
SMSTransportConstents.SYSTEM_TYPE);
- if (tmp != null) {
- systemType = tmp;
+ public void setTransportInDetails(TransportInDescription
transportInDetails) throws AxisFault {
+ if(transportInDetails == null) {
+ throw new AxisFault("No transport in details");
}
- tmp = (String) SMSTransportUtils.getParameterValue(params ,
SMSTransportConstents.SYSTEM_ID);
+ if(transportInDetails.getParameter(SMSTransportConstents.SYSTEM_TYPE)
!= null){
+
smppTransportInDetails.setSystemType((String)transportInDetails.getParameter(
+ SMSTransportConstents.SYSTEM_TYPE).getValue());
+ }
- if (tmp != null) {
- systemId = tmp;
+ if (transportInDetails.getParameter(SMSTransportConstents.SYSTEM_ID)
!= null) {
+
smppTransportInDetails.setSystemId((String)transportInDetails.getParameter(SMSTransportConstents.SYSTEM_ID).
+ getValue());
} else {
throw new AxisFault("System Id not set");
}
- tmp = (String) SMSTransportUtils.getParameterValue(params ,
SMSTransportConstents.PASSWORD);
+ if (transportInDetails.getParameter(SMSTransportConstents.PASSWORD) !=
null) {
+
smppTransportInDetails.setPassword((String)transportInDetails.getParameter(SMSTransportConstents.PASSWORD).
+ getValue());
+ } else {
+ throw new AxisFault("password not set");
+ }
+
+ if(transportInDetails.getParameter(SMSTransportConstents.HOST) !=
null) {
+
smppTransportInDetails.setHost((String)transportInDetails.getParameter(SMSTransportConstents.HOST).
+ getValue());
+ }
- if (tmp != null) {
- password = tmp;
+ if(transportInDetails.getParameter(SMSTransportConstents.PORT) !=
null) {
+
smppTransportInDetails.setPort(Integer.parseInt((String)transportInDetails.getParameter(
+ SMSTransportConstents.PORT).getValue()));
+ }
+
+ if(transportInDetails.getParameter(SMSTransportConstents.PHONE_NUMBER)
!= null) {
+
smppTransportInDetails.setPhoneNumber((String)transportInDetails.getParameter(
+ SMSTransportConstents.PHONE_NUMBER).getValue());
+ }
+ }
+
+ public void setTransportOutDetails(TransportOutDescription
transportOutDetails) throws AxisFault{
+ if(transportOutDetails == null) {
+ throw new AxisFault("No transport in details");
+ }
+
+ if(transportOutDetails.getParameter(SMSTransportConstents.SYSTEM_TYPE)
!= null){
+
smppTransportOutDetails.setSystemType((String)transportOutDetails.getParameter(
+ SMSTransportConstents.SYSTEM_TYPE).getValue());
+ }
+
+ if (transportOutDetails.getParameter(SMSTransportConstents.SYSTEM_ID)
!= null) {
+
smppTransportOutDetails.setSystemId((String)transportOutDetails.getParameter(SMSTransportConstents.SYSTEM_ID).
+ getValue());
+ } else {
+ throw new AxisFault("System Id not set");
+ }
+
+ if (transportOutDetails.getParameter(SMSTransportConstents.PASSWORD)
!= null) {
+
smppTransportOutDetails.setPassword((String)transportOutDetails.getParameter(SMSTransportConstents.PASSWORD).
+ getValue());
} else {
throw new AxisFault("password not set");
}
- tmp = (String) SMSTransportUtils.getParameterValue(params ,
SMSTransportConstents.HOST);
+ if(transportOutDetails.getParameter(SMSTransportConstents.HOST) !=
null) {
+
smppTransportOutDetails.setHost((String)transportOutDetails.getParameter(SMSTransportConstents.HOST).
+ getValue());
+ }
+
+ if(transportOutDetails.getParameter(SMSTransportConstents.PORT) !=
null) {
+
smppTransportOutDetails.setPort(Integer.parseInt((String)transportOutDetails.getParameter(
+ SMSTransportConstents.PORT).getValue()));
+ }
- if (tmp != null) {
- host = tmp;
+
if(transportOutDetails.getParameter(SMSTransportConstents.PHONE_NUMBER) !=
null) {
+
smppTransportOutDetails.setPhoneNumber((String)transportOutDetails.getParameter(
+ SMSTransportConstents.PHONE_NUMBER).getValue());
}
+ }
- tmp = (String) SMSTransportUtils.getParameterValue(params ,
SMSTransportConstents.PORT);
+ public void sendSMS(SMSMessage sm) {
+ try {
+ if (outSession == null) {
+ outSession = new SMPPSession();
+
outSession.setEnquireLinkTimer(smppTransportOutDetails.getEnquireLinkTimer());
+
outSession.setTransactionTimer(smppTransportOutDetails.getTransactionTimer());
+ outSession.connectAndBind(smppTransportOutDetails.getHost(),
smppTransportOutDetails.getPort(),
+ new BindParameter(BindType.BIND_TX,
smppTransportOutDetails.getSystemId(),
+ smppTransportOutDetails.getPassword(),
smppTransportOutDetails.getSystemType(),
+ TypeOfNumber.UNKNOWN,
NumberingPlanIndicator.UNKNOWN, null));
+
+
+ }
+ log.debug("Conected and bind to " +
smppTransportOutDetails.getHost());
+
+ String messageId = outSession.submitShortMessage(
+ "CMT",
+ TypeOfNumber.UNKNOWN,
+ NumberingPlanIndicator.UNKNOWN,
+ sm.getSender(),
+ TypeOfNumber.UNKNOWN,
+ NumberingPlanIndicator.UNKNOWN,
+ sm.getReceiver(),
+ new ESMClass(),
+ (byte) 0,
+ (byte) 1,
+ timeFormatter.format(new Date()),
+ null,
+ new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),
+ (byte) 0,
+ new GeneralDataCoding(false, false,
MessageClass.CLASS1,Alphabet.ALPHA_DEFAULT),
+ (byte) 0,
+ sm.getContent().getBytes()
+ );
- if (tmp != null) {
- port = Integer.parseInt(tmp);
+ log.debug("Message Submited with id" + messageId);
+ } catch (IOException e) {
+ log.error("Unable to Connect ", e);
+ } catch (InvalidResponseException e) {
+ log.debug("Invalid responce Exception", e);
+ } catch (PDUException e) {
+ log.debug("PDU Exception", e);
+ } catch (NegativeResponseException e) {
+ log.debug(e);
+ } catch (ResponseTimeoutException e) {
+ log.debug(e);
}
+
}
}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPListener.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPListener.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPListener.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPListener.java
Thu Jun 25 09:53:08 2009
@@ -28,10 +28,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+/**
+ * Listen for the incomming SMPP messages and Start processing them
+ */
public class SMPPListener implements MessageReceiverListener{
/** the reference to the actual commons logger to be used for log
messages */
protected Log log = LogFactory.getLog(this.getClass());
-
+
public void onAcceptDeliverSm(DeliverSm deliverSm) throws
ProcessRequestException {
@@ -59,7 +62,7 @@
} else {
try {
- new SMPPDispatcher().dispatch(deliverSm.getSourceAddr() , new
String(deliverSm.getShortMessage()));
+ new SMPPDispatcher().dispatch(deliverSm.getSourceAddr()
,deliverSm.getDestAddress() ,new String(deliverSm.getShortMessage()));
} catch (AxisFault axisFault) {
log.debug("Error while dispatching SMPP message" , axisFault);
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportInDetails.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportInDetails.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportInDetails.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportInDetails.java
Thu Jun 25 09:53:08 2009
@@ -18,5 +18,93 @@
*/
package org.apache.axis2.transport.sms.smpp;
+/**
+ * holds the SMPP imlimantations Transport in details
+ */
public class SMPPTransportInDetails {
+ private String systemType ="cp";
+ private String systemId;
+ private String password;
+ private String host="127.0.0.1";
+ private String phoneNumber = "0000";
+ private int port = 2775;
+ private int enquireLinkTimer = 50000;
+ private int transactionTimer = 100000;
+ private static SMPPTransportInDetails smppTransportInDetails;
+
+ private SMPPTransportInDetails(){
+
+ }
+
+ public static SMPPTransportInDetails getInstence() {
+ if(smppTransportInDetails == null) {
+ smppTransportInDetails = new SMPPTransportInDetails();
+ }
+
+ return smppTransportInDetails;
+ }
+
+ public String getSystemType() {
+ return systemType;
+ }
+
+ public void setSystemType(String systemType) {
+ this.systemType = systemType;
+ }
+
+ public String getSystemId() {
+ return systemId;
+ }
+
+ public void setSystemId(String systemId) {
+ this.systemId = systemId;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public int getEnquireLinkTimer() {
+ return enquireLinkTimer;
+ }
+
+ public void setEnquireLinkTimer(int enquireLinkTimer) {
+ this.enquireLinkTimer = enquireLinkTimer;
+ }
+
+ public int getTransactionTimer() {
+ return transactionTimer;
+ }
+
+ public void setTransactionTimer(int transactionTimer) {
+ this.transactionTimer = transactionTimer;
+ }
+
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ public void setPhoneNumber(String phoneNumber) {
+ this.phoneNumber = phoneNumber;
+ }
}
Modified:
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportOutDetails.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportOutDetails.java?rev=788308&r1=788307&r2=788308&view=diff
==============================================================================
---
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportOutDetails.java
(original)
+++
webservices/commons/trunk/modules/transport/modules/sms/src/main/java/org/apache/axis2/transport/sms/smpp/SMPPTransportOutDetails.java
Thu Jun 25 09:53:08 2009
@@ -18,5 +18,106 @@
*/
package org.apache.axis2.transport.sms.smpp;
+/**
+ * Holds the SMPP implimantations transport out details
+ */
public class SMPPTransportOutDetails {
+ //smpp system type
+ private String systemType ="cp";
+ private String systemId;
+ private String password;
+ private String host="127.0.0.1";
+ private String phoneNumber="0000";
+ private int port = 2775;
+ private int enquireLinkTimer = 50000;
+ private int transactionTimer = 100000;
+
+ private static SMPPTransportOutDetails smppTransportOutDetails;
+
+ private SMPPTransportOutDetails(){
+
+ }
+
+ /**
+ * Get the referrence to the Singleton instence of the SMPP Transport Out
details
+ * at the first request it will create a empty object
+ * @return SMPPTransportOutDetails instence
+ */
+ public static SMPPTransportOutDetails getInstence() {
+ if(smppTransportOutDetails ==null) {
+ smppTransportOutDetails = new SMPPTransportOutDetails();
+ }
+ return smppTransportOutDetails;
+ }
+
+ public int getTransactionTimer() {
+ return transactionTimer;
+ }
+
+ public void setTransactionTimer(int transactionTimer) {
+ this.transactionTimer = transactionTimer;
+ }
+
+ public int getEnquireLinkTimer() {
+ return enquireLinkTimer;
+ }
+
+ public void setEnquireLinkTimer(int enquireLinkTimer) {
+ this.enquireLinkTimer = enquireLinkTimer;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getSystemId() {
+ return systemId;
+ }
+
+ public void setSystemId(String systemId) {
+ this.systemId = systemId;
+ }
+
+ public String getSystemType() {
+ return systemType;
+ }
+
+ public void setSystemType(String systemType) {
+ this.systemType = systemType;
+ }
+
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ public void setPhoneNumber(String phoneNumber) {
+ this.phoneNumber = phoneNumber;
+ }
+
+
+ @Override
+ public String toString() {
+ return "TransportOutDetails:: SystemId: " +systemId +" systemType: "+
systemType + " password: "
+ +password+" host: "+host+" port: " +port+" phone NUmber" +
phoneNumber;
+ }
}