Revision: 22801
Author:   [email protected]
Date:     Fri Aug 17 05:17:36 2012
Log:      MAP RA Thomazs's patch merging
http://code.google.com/p/mobicents/source/detail?r=22801

Modified:
/trunk/servers/jain-slee/resources/map/ra/src/main/java/org/mobicents/slee/resource/map/MAPResourceAdaptor.java

=======================================
--- /trunk/servers/jain-slee/resources/map/ra/src/main/java/org/mobicents/slee/resource/map/MAPResourceAdaptor.java Tue Aug 7 03:50:52 2012 +++ /trunk/servers/jain-slee/resources/map/ra/src/main/java/org/mobicents/slee/resource/map/MAPResourceAdaptor.java Fri Aug 17 05:17:36 2012
@@ -48,6 +48,7 @@

 import org.mobicents.protocols.ss7.map.api.MAPDialog;
 import org.mobicents.protocols.ss7.map.api.MAPDialogListener;
+import org.mobicents.protocols.ss7.map.api.MAPException;
 import org.mobicents.protocols.ss7.map.api.MAPMessage;
 import org.mobicents.protocols.ss7.map.api.MAPProvider;
 import org.mobicents.protocols.ss7.map.api.dialog.MAPAbortProviderReason;
@@ -240,27 +241,34 @@

        }

-       public void administrativeRemove(ActivityHandle arg0) {
-               // TODO Auto-generated method stub
-
+       public void administrativeRemove(ActivityHandle handle) {
+               if (tracer.isFineEnabled())
+                       tracer.fine("administrativeRemove:" + handle);
        }

- public void eventProcessingFailed(ActivityHandle arg0, FireableEventType arg1, Object arg2, Address arg3,
-                       ReceivableService arg4, int arg5, FailureReason arg6) {
-               // TODO Auto-generated method stub
-
+ public void eventProcessingFailed(ActivityHandle handle, FireableEventType eventType, Object event, + Address address, ReceivableService service, int flags, FailureReason reason) {
+               if (tracer.isFineEnabled())
+                       tracer.fine("eventProcessingFailed:" + eventType + ":" 
+ handle);
+               // used to inform the resource adaptor object that the 
specified Event
+               // could not be processed successfully by the SLEE.
        }

- public void eventProcessingSuccessful(ActivityHandle arg0, FireableEventType arg1, Object arg2, Address arg3,
-                       ReceivableService arg4, int arg5) {
-               // TODO Auto-generated method stub
-
+ public void eventProcessingSuccessful(ActivityHandle handle, FireableEventType eventType, Object event,
+                       Address address, ReceivableService service, int flags) {
+               if (tracer.isFineEnabled())
+                       tracer.fine("eventProcessingSuccessful:" + eventType + 
":" + handle);
+               // used to inform the resource adaptor object that the 
specified Event
+               // was processed successfully by the SLEE.
        }

- public void eventUnreferenced(ActivityHandle arg0, FireableEventType arg1, Object arg2, Address arg3,
-                       ReceivableService arg4, int arg5) {
-               // TODO Auto-generated method stub
-
+ public void eventUnreferenced(ActivityHandle handle, FireableEventType eventType, Object event, Address address,
+                       ReceivableService service, int flags) {
+               if (tracer.isFineEnabled())
+                       tracer.fine("eventUnreferenced:" + eventType + ":" + 
handle);
+               // used to inform the Resource Adaptor that the SLEE no longer
+               // references an Event object which was previously fired by the
+               // resource adaptor object.
        }

        public Object getActivity(ActivityHandle handle) {
@@ -283,7 +291,7 @@
                return null;
        }

-       public Object getResourceAdaptorInterface(String arg0) {
+       public Object getResourceAdaptorInterface(String className) {
                return this.mapProvider;
        }

@@ -345,6 +353,12 @@
        }

        public void raInactive() {
+               if (tracer.isFineEnabled())
+                       tracer.fine("raInactive");
+               if (tracer.isFineEnabled()) {
+                       tracer.fine("MAP Resource Adaptor - inactivating");
+               }
+
                this.realProvider.getMAPServiceMobility().deactivate();
                this.realProvider.getMAPServiceCallHandling().deactivate();
                this.realProvider.getMAPServiceOam().deactivate();
@@ -362,15 +376,36 @@
                
this.realProvider.getMAPServiceSms().removeMAPServiceListener(this);

                this.realProvider.removeMAPDialogListener(this);
+
+               if (tracer.isInfoEnabled()) {
+                       tracer.info("MAP Resource Adaptor entity inactive.");
+               }
        }

        public void raStopping() {
-               // TODO Auto-generated method stub
+               if (tracer.isFineEnabled()) {
+                       tracer.fine("raStopping");
+                       tracer.fine("Ending all activities");

+               }
+//             for (CAPDialog a : activities.values()) {
+//                     endActivity(a);
+//             }
+
+               if (tracer.isFineEnabled()) {
+                       tracer.fine("MAP Resource Adaptor entity stopping.");
+               }
        }

        public void raUnconfigure() {
+               if (tracer.isFineEnabled())
+                       tracer.fine("raUnconfigure");
+
                this.mapJndi = null;
+
+               if (tracer.isFineEnabled()) {
+                       tracer.fine("MAP Resource Adaptor unconfigured.");
+               }
        }

public void raVerifyConfiguration(ConfigProperties properties) throws InvalidConfigurationException {
@@ -388,6 +423,10 @@
                } catch (Exception e) {
throw new InvalidConfigurationException("Failed to test configuration options!", e);
                }
+
+               if (tracer.isInfoEnabled()) {
+                       tracer.info("MAP Resource Adaptor configuration 
verified.");
+               }
        }

        public void serviceActive(ReceivableService receivableService) {
@@ -405,6 +444,7 @@
        public void setResourceAdaptorContext(ResourceAdaptorContext raContext) 
{
                this.resourceAdaptorContext = raContext;
this.tracer = resourceAdaptorContext.getTracer(MAPResourceAdaptor.class.getSimpleName());
+               this.sleeEndpoint = raContext.getSleeEndpoint();

                this.eventIdCache = new EventIDCache(this.tracer);
        }
@@ -426,6 +466,31 @@
this.sleeEndpoint.startActivitySuspended(mapDialogWrapper.getActivityHandle(), mapDialogWrapper,
                                ActivityFlags.REQUEST_ENDED_CALLBACK);
        }
+
+       // sending mapDialog.abort() and then endActivity()
+       private void endActivity(MAPDialogWrapper mapDialog) {
+               if (tracer.isFineEnabled())
+                       tracer.fine("endActivity:" + mapDialog);
+
+               MAPDialogActivityHandle mapDialogActHndl = 
mapDialog.getActivityHandle();
+               if (mapDialogActHndl == null) {
+                       if (this.tracer.isWarningEnabled()) {
+ this.tracer.warning("Activity ended but no MAPDialogActivityHandle found for Dialog ID, ignoring "
+                                               + mapDialog.getDialogId());
+                       }
+               } else {
+                       try {
+ MAPUserAbortChoice ach = this.realProvider.getMAPParameterFactory().createMAPUserAbortChoice();
+                               ach.setUserSpecificReason();
+                               mapDialog.abort(ach);
+                       } catch (MAPException e) {
+                               tracer.warning("Cannot abort dialog ", e);
+                       }
+                       this.sleeEndpoint.endActivity(mapDialogActHndl);
+                       if (tracer.isFineEnabled())
+ this.tracer.fine("Activity marked to be ended:" + mapDialog.getDialogId());
+               }
+       }

        /**
         * Private methods

Reply via email to