Revision: 16420
Author: brainslog
Date: Thu Jan 13 21:33:55 2011
Log: Adding Example application for IMS User Profile Enabler

Update Issue 2124
Added example



http://code.google.com/p/mobicents/source/detail?r=16420

Added:
 /trunk/servers/jain-slee/enablers/ims-user-profile/example
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/README.TXT
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/du
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/du/pom.xml
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/du/src
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/du/src/main
/trunk/servers/jain-slee/enablers/ims-user-profile/example/du/src/main/resources /trunk/servers/jain-slee/enablers/ims-user-profile/example/du/src/main/resources/services /trunk/servers/jain-slee/enablers/ims-user-profile/example/du/src/main/resources/services/IMSUserProfileExampleService-service.xml
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/pom.xml
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/pom.xml
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main
/trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents/slee /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents/slee/enabler /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents/slee/enabler/ims /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents/slee/enabler/ims/userprofile /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents/slee/enabler/ims/userprofile/example /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents/slee/enabler/ims/userprofile/example/IMSUserProfileParentSbb.java /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/resources /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/resources/META-INF /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/resources/META-INF/sbb-jar.xml
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/script
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/script/run.bat
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/script/run.sh
 /trunk/servers/jain-slee/enablers/ims-user-profile/example/script/uas.xml

=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/README.TXT Thu Jan 13 21:33:55 2011
@@ -0,0 +1,4 @@
+ ==============================================
+= Mobicents JAIN SLEE IMS User Profile Enabler =
+ ==============================================
+
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/du/pom.xml Thu Jan 13 21:33:55 2011
@@ -0,0 +1,68 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.mobicents.servers.jainslee.enablers</groupId>
+               <artifactId>ims-user-profile-example</artifactId>
+               <version>1.0.0-SNAPSHOT</version>
+       </parent>
+
+       <artifactId>ims-user-profile-example-DU</artifactId>
+
+       <dependencies>
+               <dependency>
+                       <groupId>${pom.groupId}</groupId>
+                       <artifactId>ims-user-profile-example-sbb</artifactId>
+                       <version>${pom.version}</version>
+               </dependency>
+       </dependencies>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.mobicents.tools</groupId>
+                               <artifactId>maven-du-plugin</artifactId>
+                               <extensions>true</extensions>
+                               <configuration />
+                               <executions>
+                                       <execution>
+                                               
<phase>generate-resources</phase>
+                                               <goals>
+                                                       <goal>create</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <artifactId>maven-antrun-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>deploy-DU</id>
+                                               <phase>install</phase>
+                                               <goals>
+                                                       <goal>run</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <tasks>
+ <copy overwrite="true" file="target/${project.build.finalName}.jar" todir="${jboss.home}/server/${node}/deploy" />
+                                                       </tasks>
+                                               </configuration>
+                                       </execution>
+                                       <execution>
+                                               <id>undeploy-DU</id>
+                                               <phase>clean</phase>
+                                               <goals>
+                                                       <goal>run</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <tasks>
+ <delete file="${jboss.home}/server/${node}/deploy/${project.build.finalName}.jar" />
+                                                       </tasks>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+
+</project>
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/du/src/main/resources/services/IMSUserProfileExampleService-service.xml Thu Jan 13 21:33:55 2011
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE service-xml PUBLIC "-//Sun Microsystems, Inc.//DTD JAIN SLEE Service 1.0//EN"
+                             "http://java.sun.com/dtd/slee-service_1_0.dtd";>
+<service-xml>
+    <service>
+        <description/>
+        <service-name>IMSUserProfileExampleService</service-name>
+        <service-vendor>org.mobicents</service-vendor>
+        <service-version>0.1</service-version>
+        <root-sbb>
+            <description/>
+            <sbb-name>IMSUserProfileParentSbb</sbb-name>
+                       <sbb-vendor>org.mobicents</sbb-vendor>
+                       <sbb-version>1.0</sbb-version>
+        </root-sbb>
+        <default-priority>100</default-priority>
+    </service>
+</service-xml>
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/pom.xml Thu Jan 13 21:33:55 2011
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+
+       <packaging>pom</packaging>
+
+       <parent>
+               <groupId>org.mobicents.servers.jainslee.enablers</groupId>
+               <artifactId>ims-user-profile</artifactId>
+               <version>1.0.0-SNAPSHOT</version>
+       </parent>
+
+       <groupId>org.mobicents.servers.jainslee.enablers</groupId>
+       <artifactId>ims-user-profile-example</artifactId>
+       <version>1.0.0-SNAPSHOT</version>
+
+       <modules>
+               <module>sbb</module>
+               <module>du</module>
+       </modules>
+
+</project>
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/pom.xml Thu Jan 13 21:33:55 2011
@@ -0,0 +1,23 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.mobicents.servers.jainslee.enablers</groupId>
+               <artifactId>ims-user-profile-example</artifactId>
+               <version>1.0.0-SNAPSHOT</version>
+       </parent>
+
+       <artifactId>ims-user-profile-example-sbb</artifactId>
+
+       <dependencies>
+               <dependency>
+                       <artifactId>ims-user-profile-sbb</artifactId>
+                       
<groupId>org.mobicents.servers.jainslee.enablers</groupId>
+                       <version>1.0.0-SNAPSHOT</version>
+                       <scope>compile</scope>
+               </dependency>
+
+       </dependencies>
+
+</project>
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/java/org/mobicents/slee/enabler/ims/userprofile/example/IMSUserProfileParentSbb.java Thu Jan 13 21:33:55 2011
@@ -0,0 +1,403 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.mobicents.slee.enabler.ims.userprofile.example;
+
+import java.io.IOException;
+
+import javax.slee.ActivityContextInterface;
+import javax.slee.ChildRelation;
+import javax.slee.CreateException;
+import javax.slee.RolledBackContext;
+import javax.slee.Sbb;
+import javax.slee.SbbContext;
+import javax.slee.facilities.Tracer;
+import javax.slee.serviceactivity.ServiceActivity;
+
+import org.mobicents.slee.enabler.ims.userprofile.IMSUserProfileChildSbbLocalObject;
+import org.mobicents.slee.enabler.ims.userprofile.IMSUserProfileParent;
+import org.mobicents.slee.enabler.ims.userprofile.IMSUserProfileParentSbbLocalObject;
+
+/**
+ *
+ * @author <a href=mailto:[email protected]> Alexandre Mendonca </a>
+ */
+public abstract class IMSUserProfileParentSbb implements Sbb, IMSUserProfileParent {
+
+  private static Tracer tracer;
+
+ private static final String PUBLIC_IDENTITY_PSI = "sip:[email protected]"; + private static final String PUBLIC_IDENTITY_IMS_USER_STATE = "sip:[email protected]";
+
+  private static final String DESTINATION_HOST = null;
+  private static final String DESTINATION_REALM = "open-ims.test";
+
+  protected SbbContext sbbContext;
+
+ // SBB Object Lifecycle Methods ---------------------------------------------
+
+  public void sbbActivate() {
+  }
+
+  public void sbbCreate() throws CreateException {
+  }
+
+ public void sbbExceptionThrown(Exception exception, Object event, ActivityContextInterface activity) {
+  }
+
+  public void sbbLoad() {
+  }
+
+  public void sbbPassivate() {
+  }
+
+  public void sbbPostCreate() throws CreateException {
+  }
+
+  public void sbbRemove() {
+  }
+
+  public void sbbRolledBack(RolledBackContext arg0) {
+  }
+
+  public void sbbStore() {
+  }
+
+  public void setSbbContext(SbbContext sbbContext) {
+    this.sbbContext = sbbContext;
+    if (tracer == null) {
+ tracer = sbbContext.getTracer(IMSUserProfileParentSbb.class.getSimpleName());
+    }
+  }
+
+  public void unsetSbbContext() {
+    this.sbbContext = null;
+  }
+
+  public abstract void setNotifyCount(int b);
+
+  public abstract int getNotifyCount();
+
+  public abstract ChildRelation getIMSUserProfileChildSbbChildRelation();
+
+ public void onStartServiceEvent(javax.slee.serviceactivity.ServiceStartedEvent event, ActivityContextInterface aci) {
+    IMSUserProfileChildSbbLocalObject child;
+
+    try {
+ child = (IMSUserProfileChildSbbLocalObject) this.getIMSUserProfileChildSbbChildRelation().create(); + child.setParentSbbCMP((IMSUserProfileParentSbbLocalObject) this.sbbContext.getSbbLocalObject());
+
+      try {
+        // Request alice PSI Activation
+ child.getPSIActivation(PUBLIC_IDENTITY_PSI, DESTINATION_REALM, DESTINATION_HOST); + // child.getIMSPublicIdentity(PUBLIC_IDENTITY, null, 0, DESTINATION_REALM, DESTINATION_HOST);
+        if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 1 # Sent User-Data-Request to HSS for '" + PUBLIC_IDENTITY_PSI + "'");
+        }
+      }
+      catch (IOException ioe) {
+        tracer.severe("Unable to send UDR.", ioe);
+      }
+    }
+    catch (CreateException ce) {
+      tracer.severe("Failed to create Child Relation.", ce);
+    }
+  }
+
+ public void onActivityEndEvent(javax.slee.ActivityEndEvent event, ActivityContextInterface aci) {
+    if (tracer.isFineEnabled()) {
+      tracer.fine("Received Activtiy End: " + aci.getActivity());
+    }
+
+    if (aci.getActivity() instanceof ServiceActivity) {
+      ServiceActivity sa = (ServiceActivity) aci.getActivity();
+      if (sa.getService().equals(this.sbbContext.getService())) {
+        // TODO: terminate
+      }
+    }
+  }
+
+ // Parent Interface implementation ------------------------------------------
+
+  @Override
+ public void deliverRepositoryData(String publicIdentity, byte[][] serviceIndications, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "Repository Data";
+      String serviceIndicationsString = "";
+      for(byte[] serviceIndication : serviceIndications) {
+        serviceIndicationsString += new String(serviceIndication);
+      }
+ tracer.info(publicIdentity + "/" + serviceIndicationsString + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverIMSPublicIdentity(String publicIdentity, byte[] msisdn, int identitySet, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "IMS Public Identity";
+ tracer.info((publicIdentity != null ? publicIdentity : new String(msisdn)) + "/" + identitySet + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverIMSUserState(String publicIdentity, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "IMS User State";
+ tracer.info(publicIdentity + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverSCSCFName(String publicIdentity, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "S-CSCF Name";
+ tracer.info(publicIdentity + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverInitialFilterCriteria(String publicIdentity, String serverName, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "S-CSCF Name";
+ tracer.info(publicIdentity + "/" + serverName + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverLocationInformation(byte[] msisdn, int requestedDomain, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "Location Information";
+ tracer.info(new String(msisdn) + "/" + requestedDomain + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverUserState(byte[] msisdn, int requestedDomain, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "User State";
+ tracer.info(new String(msisdn) + "/" + requestedDomain + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverChargingInformation(String publicIdentity, byte[] msisdn, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "Charging Information";
+ tracer.info((publicIdentity != null ? publicIdentity : new String(msisdn)) + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverMSISDN(String publicIdentity, byte[] msisdn, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "MSISDN";
+ tracer.info((publicIdentity != null ? publicIdentity : new String(msisdn)) + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+  }
+
+  @Override
+ public void deliverPSIActivation(String publicIdentity, long resultCode, String data) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "S-CSCF Name";
+ tracer.info(publicIdentity + " '" + dataType + "' delivery: Result-Code = '" + resultCode + "'");
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+
+    if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 2 # Received User-Data-Answer from HSS for '" + PUBLIC_IDENTITY_PSI + "'");
+    }
+
+    // Now we try to update PSI-Activation data
+    try {
+ IMSUserProfileChildSbbLocalObject child = (IMSUserProfileChildSbbLocalObject) this.getIMSUserProfileChildSbbChildRelation().create(); + child.setParentSbbCMP((IMSUserProfileParentSbbLocalObject) this.sbbContext.getSbbLocalObject());
+
+      try {
+        if (data.contains("<PSIActivation>0</PSIActivation>")) {
+          if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 3 # Setting PSI Activation from INACTIVE to ACTIVE in User-Data ...");
+          }
+ data = data.replaceAll("<PSIActivation>0</PSIActivation>", "<PSIActivation>1</PSIActivation>");
+        }
+        else {
+          if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 3 # Setting PSI Activation from ACTIVE to INACTIVE in User-Data ...");
+          }
+ data = data.replaceAll("<PSIActivation>1</PSIActivation>", "<PSIActivation>0</PSIActivation>");
+        }
+ child.updatePSIActivation(PUBLIC_IDENTITY_PSI, data, DESTINATION_REALM, DESTINATION_HOST);
+        if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 4 # Sent Profile-Update-Request to HSS for '" + PUBLIC_IDENTITY_PSI + "'");
+        }
+      }
+      catch (IOException ioe) {
+        tracer.severe("Unable to send PUR.", ioe);
+      }
+    }
+    catch (CreateException ce) {
+      tracer.severe("Failed to create Child Relation.", ce);
+    }
+  }
+
+  @Override
+ public void updateRepositoryDataResponse(String publicIdentity, long resultCode) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "Repository Data";
+ tracer.info("Update to " + publicIdentity + "'s '" + dataType + "' response: Result-Code = '" + resultCode + "'");
+    }
+  }
+
+  @Override
+ public void updatePSIActivationResponse(String publicIdentity, long resultCode) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "PSI Activation";
+ tracer.info("Update to " + publicIdentity + "'s '" + dataType + "' response: Result-Code = '" + resultCode + "'");
+    }
+
+    if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 5 # Received Profile-Update-Answer from HSS for '" + PUBLIC_IDENTITY_PSI + "'");
+    }
+
+    // Now we try to subscribe to alice's IMS User State
+    try {
+ IMSUserProfileChildSbbLocalObject child = (IMSUserProfileChildSbbLocalObject) this.getIMSUserProfileChildSbbChildRelation().create(); + child.setParentSbbCMP((IMSUserProfileParentSbbLocalObject) this.sbbContext.getSbbLocalObject());
+
+      try {
+        if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 6 # Subscribing to IMS User State for '" + PUBLIC_IDENTITY_IMS_USER_STATE + "'");
+        }
+ child.subscribeIMSUserState(PUBLIC_IDENTITY_IMS_USER_STATE, 0, DESTINATION_REALM, DESTINATION_HOST);
+      }
+      catch (IOException ioe) {
+        tracer.severe("Unable to send SNR.", ioe);
+      }
+    }
+    catch (CreateException ce) {
+      tracer.severe("Failed to create Child Relation.", ce);
+    }
+  }
+
+  @Override
+ public void subscribeRepositoryDataResponse(String publicIdentity, byte[][] serviceIndications, int subscriptionRequestType, long resultCode) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "Repository Data";
+ String reqType = subscriptionRequestType == 0 ? "SUBSCRIBE" : "UNSUBSCRIBE";
+      String serviceIndicationsString = "";
+      for(byte[] serviceIndication : serviceIndications) {
+        serviceIndicationsString += new String(serviceIndication);
+      }
+ tracer.info(publicIdentity + "/" + serviceIndicationsString + " answer to " + reqType + " '" + dataType + "': Result-Code = '" + resultCode + "'");
+    }
+  }
+
+  @Override
+ public void subscribeIMSUserStateResponse(String publicIdentity, int subscriptionRequestType, long resultCode) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "User State";
+ String reqType = subscriptionRequestType == 0 ? "SUBSCRIBE" : "UNSUBSCRIBE"; + tracer.info(publicIdentity + " answer to " + reqType + " '" + dataType + "': Result-Code = '" + resultCode + "'");
+    }
+
+    // If it's good, we are subscribed
+    if (resultCode == 2001) {
+      if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 7 # Subscribed successfuly to IMS User State for '" + PUBLIC_IDENTITY_IMS_USER_STATE + "'"); + tracer.info("###### STEP 8 # !USER ACTION NEEDED! Please change (register or unregister) the SIP client for '" + PUBLIC_IDENTITY_IMS_USER_STATE + "'...");
+      }
+    }
+    else {
+ tracer.severe("Failed to Subscribe to User Profile/IMS User State for '" + PUBLIC_IDENTITY_IMS_USER_STATE + "'.");
+    }
+  }
+
+  @Override
+ public void subscribeSCSCFNameResponse(String publicIdentity, int subscriptionRequestType, long resultCode) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "S-CSCF Name";
+ String reqType = subscriptionRequestType == 0 ? "SUBSCRIBE" : "UNSUBSCRIBE"; + tracer.info(publicIdentity + " answer to " + reqType + " '" + dataType + "': Result-Code = '" + resultCode + "'");
+    }
+  }
+
+  @Override
+ public void subscribeInitialFilterCriteriaResponse(String publicIdentity, String serverName, int subscriptionRequestType, long resultCode) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "Initial Filter Criteria";
+ String reqType = subscriptionRequestType == 0 ? "SUBSCRIBE" : "UNSUBSCRIBE"; + tracer.info(publicIdentity + "/" + serverName + " answer to " + reqType + " '" + dataType + "': Result-Code = '" + resultCode + "'");
+    }
+  }
+
+  @Override
+ public void subscribePSIActivationResponse(String publicIdentity, int subscriptionRequestType, long resultCode) {
+    if (tracer.isInfoEnabled()) {
+      String dataType = "PSI Activation";
+ String reqType = subscriptionRequestType == 0 ? "SUBSCRIBE" : "UNSUBSCRIBE"; + tracer.info(publicIdentity + " answer to " + reqType + " '" + dataType + "': Result-Code = '" + resultCode + "'");
+    }
+  }
+
+  @Override
+ public void receivedProfileUpdate(String userIdentity, byte[] msisdn, String data, String originRealm, String originHost) {
+    if (tracer.isInfoEnabled()) {
+ tracer.info("Received updated User Profile for " + (userIdentity != null ? userIdentity : new String(msisdn)) + " from " + originRealm + "/" + originHost);
+      if (data != null) {
+        tracer.info("User-Data: " + data);
+      }
+    }
+
+    if (tracer.isInfoEnabled()) {
+ tracer.info("###### STEP 9 # Received profile update for '" + PUBLIC_IDENTITY_IMS_USER_STATE + "'. EXAMPLE COMPLETED SUCCESSFULY!");
+    }
+  }
+
+}
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/sbb/src/main/resources/META-INF/sbb-jar.xml Thu Jan 13 21:33:55 2011
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sbb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD JAIN SLEE SBB 1.1//EN"
+                         "http://java.sun.com/dtd/slee-sbb-jar_1_1.dtd";>
+<sbb-jar>
+
+       <sbb>
+
+               <description />
+
+               <sbb-name>IMSUserProfileParentSbb</sbb-name>
+               <sbb-vendor>org.mobicents</sbb-vendor>
+               <sbb-version>1.0</sbb-version>
+
+               <!-- Delegate to this child SBB if we need to do registrations 
-->
+               <sbb-ref>
+                       <sbb-name>IMSUserProfileChildSbb</sbb-name>
+                       <sbb-vendor>org.mobicents</sbb-vendor>
+                       <sbb-version>1.0</sbb-version>
+                       <sbb-alias>IMSUserProfileChildSbb</sbb-alias>
+               </sbb-ref>
+
+               <sbb-classes>
+                       <sbb-abstract-class reentrant="True">
+ <sbb-abstract-class-name>org.mobicents.slee.enabler.ims.userprofile.example.IMSUserProfileParentSbb</sbb-abstract-class-name>
+                               <cmp-field>
+                                       
<cmp-field-name>notifyCount</cmp-field-name>
+                               </cmp-field>
+                               <get-child-relation-method>
+                                       
<sbb-alias-ref>IMSUserProfileChildSbb</sbb-alias-ref>
+                                       <get-child-relation-method-name>
+                                               
getIMSUserProfileChildSbbChildRelation
+                                       </get-child-relation-method-name>
+                                       <default-priority>0</default-priority>
+                               </get-child-relation-method>
+                       </sbb-abstract-class>
+                       <sbb-local-interface>
+ <sbb-local-interface-name>org.mobicents.slee.enabler.ims.userprofile.IMSUserProfileParentSbbLocalObject</sbb-local-interface-name>
+                       </sbb-local-interface>
+
+               </sbb-classes>
+               <event event-direction="Receive" initial-event="True">
+                       <event-name>StartServiceEvent</event-name>
+                       <event-type-ref>
+                               <event-type-name>
+                                       
javax.slee.serviceactivity.ServiceStartedEvent
+                               </event-type-name>
+                               
<event-type-vendor>javax.slee</event-type-vendor>
+                               <event-type-version>1.1</event-type-version>
+                       </event-type-ref>
+                       <initial-event-select variable="ActivityContext" />
+               </event>
+
+               <event event-direction="Receive" initial-event="False">
+                       <event-name>ActivityEndEvent</event-name>
+                       <event-type-ref>
+                               <event-type-name>
+                                       javax.slee.ActivityEndEvent
+                               </event-type-name>
+                               
<event-type-vendor>javax.slee</event-type-vendor>
+                               <event-type-version>1.0</event-type-version>
+                       </event-type-ref>
+               </event>
+       </sbb>
+</sbb-jar>
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/script/run.bat Thu Jan 13 21:33:55 2011
@@ -0,0 +1,1 @@
+sipp -trace_err -sf uas_DIALOG.xml -i 127.0.0.1 -p 5090 -r 1 -m 100000000000
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/script/run.sh Thu Jan 13 21:33:55 2011
@@ -0,0 +1,1 @@
+sipp -trace_err -sf uas.xml -i 127.0.0.1 -p 5090 -r 1 -m 100000000000000
=======================================
--- /dev/null
+++ /trunk/servers/jain-slee/enablers/ims-user-profile/example/script/uas.xml Thu Jan 13 21:33:55 2011
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+  <!DOCTYPE scenario SYSTEM "sipp.dtd">
+   <!-- Basic UAS subs response, no race between initial notify and 2xx -->
+  <scenario name="Basic UAS subs response">
+
+       <!-- initial, lets store some data -->
+    <recv request="SUBSCRIBE">
+       <action>
+                       <ereg regexp=".*" search_in="hdr" header="From:" 
assign_to="1" />
+                       <ereg regexp=".*" search_in="hdr" header="To:" 
assign_to="2" />
+ <ereg regexp="sip:.*[^>]" search_in="hdr" header="Contact:" assign_to="3" />
+                       <ereg regexp=".*" search_in="hdr" header="Accept:" 
assign_to="4" />
+                       <ereg regexp=".*" search_in="hdr" header="Event:" 
assign_to="5" />
+ <ereg regexp=".*" search_in="hdr" header="Expires:" assign_to="6" /> <!-- Store, will be used to check for zero -->
+                       <todouble assign_to="7" variable="6" />
+               </action>
+    </recv>
+
+
+    <send>
+      <![CDATA[
+
+        SIP/2.0 200 OK
+        [last_Via:]
+        [last_From:]
+        [last_To:];tag=[call_number]
+        [last_Call-ID:]
+        [last_CSeq:]
+               Expires: 61
+        Content-Length: 0
+
+      ]]>
+    </send>
+
+
+       <pause milliseconds="400"/>
+
+       <send>
+      <![CDATA[
+
+        NOTIFY [$3] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK-[branch]
+        From: [$2];tag=[call_number]
+        To: [$1]
+        [last_Call-ID:]
+        CSeq: [cseq] NOTIFY
+               Subscription-State: active;expires=61
+               Content-Type: [$4]
+               Event: [$5]
+        Content-Length: [len]
+
+        1
+
+      ]]>
+    </send>
+
+       <recv response="200" crlf="true" />
+
+
+
+       <!-- now depending on Expires, we do different things -->
+       <label id="loop_begin" />
+       <!-- fetch all required data, to check if msg contains everything -->
+       <recv request="SUBSCRIBE">
+       <action>
+                       <ereg regexp=".*" search_in="hdr" header="From:" 
assign_to="1" />
+                       <ereg regexp=".*" search_in="hdr" header="To:" 
assign_to="2" />
+ <ereg regexp="sip:.*[^>]" search_in="hdr" header="Contact:" assign_to="3" />
+                       <ereg regexp=".*" search_in="hdr" header="Accept:" 
assign_to="4" />
+                       <ereg regexp=".*" search_in="hdr" header="Event:" 
assign_to="5" />
+ <ereg regexp=".*" search_in="hdr" header="Expires:" assign_to="6" /> <!-- Store, will be used to check for zero -->
+                       <todouble assign_to="7" variable="6" />
+               </action>
+    </recv>
+
+
+    <send  crlf="true">
+      <![CDATA[
+
+        SIP/2.0 200 OK
+        [last_Via:]
+        [last_From:]
+        [last_To:];tag=[call_number]
+        [last_Call-ID:]
+        [last_CSeq:]
+               Expires: 61
+        Content-Length: 0
+
+      ]]>
+    </send>
+
+       <!-- check expires, if zero, send notify with term, else, active -->
+    <nop>
+       <action>
+               <test assign_to="empty" variable="7" compare="equal" value="0"/>
+ <test assign_to="not_empty" variable="7" compare="greater_than" value="0"/>
+       </action>
+       </nop>
+
+    <nop test="empty" next="loop_send_notify_terminated" />
+    <nop test="not_empty" next="loop_send_notify_active" />
+
+    <label id="loop_send_notify_active" />
+    <!-- one cant pass variable here.... ech -->
+       <pause milliseconds="30000"/>
+
+       <send>
+      <![CDATA[
+
+        NOTIFY [$3] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK-[branch]
+        From: [$2];tag=[call_number]
+        To: [$1]
+        [last_Call-ID:]
+        CSeq: [cseq] NOTIFY
+               Subscription-State: active;expires=61
+               Content-Type: [$4]
+               Event: [$5]
+        Content-Length: [len]
+
+        1
+
+      ]]>
+    </send>
+
+       <recv response="200" crlf="true" />
+
+
+       <!-- back to loop start, wait for subs -->
+        <nop test="not_empty" next="loop_begin" />
+
+
+       <label id="loop_send_notify_terminated" />
+
+       <pause milliseconds="400"/>
+
+       <send>
+      <![CDATA[
+
+        NOTIFY [$3] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=z9hG4bK-[branch]
+        From: [$2];tag=[call_number]
+        To: [$1]
+        [last_Call-ID:]
+        CSeq: [cseq] NOTIFY
+               Subscription-State: terminated;reason=deactivated
+               Content-Type: [$4]
+               Event: [$5]
+        Content-Length: [len]
+
+        1
+
+      ]]>
+    </send>
+
+       <recv response="200" crlf="true" />
+
+
+ <!-- Keep the call open for a while in case the 200 is lost to be --> + <!-- able to retransmit it if we receive the BYE again. -->
+   <pause milliseconds="4000"/>
+
+
+ <!-- definition of the response time repartition table (unit is ms) -->
+   <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <!-- definition of the call length repartition table (unit is ms) -->
+   <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+ </scenario>
+

Reply via email to