The Source for Java Technology Collaboration


There is new command line tool for running many of the SLEE JMX commands. This tool can be used to automate deployment of resource adaptors and other components.

Command Line Interface (CLI) for invoking Mobicents SLEE JMX commands

The following is the command usage output from the tool:

Usage: java -jar mobicents-cli.jar -<command> <args>
Valid commands:
-startSlee
-stopSlee
-install <url>
-uninstall <Deployment ID>
-uninstall <url>
-getDescriptor <Deployment ID>
-getDeploymentId <file url>
-activateService <Service ID>
-deactivateService <Service ID>
-getServiceState <Service ID>
-setTraceLevel <Component ID> <level>
-getTraceLevel <Component ID>
-createRaEntity <ResourceAdaptor ID> <entity name> <props>
-activateRaEntity <entity name>
-deactivateRaEntity <entity name>
-removeRaEntity <entity name>
-createRaLink <link name> <entity name>
-removeRaLink <link name>
-createProfileTable <ProfileSpecification ID> <profile table name>
-removeProfileTable <profile table name>
-createProfile <profile table name> <profile name>
-removeProfile <profile table name> <profile name>

The code is located in mobicents-examples/mobicents-cli

After running the buil.xml file using Ant you will obtain the following jar file: mobicents-cli.jar.

You can use it in the following way:

One example per type of ID

java -jar mobicents-cli.jar -install "file:/C:/.../mobicents-examples/.../jars/...-DU.jar"

java -jar mobicents-cli.jar -uninstall "file:/C:/.../mobicents-examples/.../jars/...-DU.jar"

or alternatively for uninstall

java -jar mobicents-cli.jar -uninstall "DeployableUnitID[#]"

java -jar mobicents-cli.jar -getDescriptor "DeployableUnitID[#]"

java -jar mobicents-cli.jar -getDeploymentId "file:/C:/.../mobicents-examples/.../jars/...-DU.jar"

java -jar mobicents-cli.jar -activateService "ServiceID[Name#Vendor#Version]"

java -jar mobicents-cli.jar -deactivateService "ServiceID[Name#Vendor#Version]"

java -jar mobicents-cli.jar -getServiceState "ServiceID[Name#Vendor#Version]"

java -jar mobicents-cli.jar -setTraceLevel "<ComponentID>[Name#Vendor#Version]" "<level>"

java -jar mobicents-cli.jar -getTraceLevel "<ComponentID>[Name#Vendor#Version]"

Resource Adaptor MBean

java -jar mobicents-cli.jar -install "file:/C:/.../sip-ra-type.jar"

java -jar mobicents-cli.jar -install "file:/C:/.../sip-local-ra.jar"

java -jar mobicents-cli.jar -createRaEntity "ResourceAdaptorID[jainsip#NIST#1.1]" "SipRA"

java -jar mobicents-cli.jar -activateRaEntity "SipRA"

java -jar mobicents-cli.jar -createRaLink "SipRA" "SipRA"

java -jar mobicents-cli.jar -removeRaLink "SipRA"

java -jar mobicents-cli.jar -deactivateRaEntity "SipRA"

java -jar mobicents-cli.jar -removeRaEntity "SipRA"

Profile Provisioning MBean

java -jar mobicents-cli.jar -createProfileTable "ProfileSpecificationID[Name#Vendor#Version]" "<profile table name>"

java -jar mobicents-cli.jar -removeProfileTable "<profile table name>"

java -jar mobicents-cli.jar -createProfile "<profile table name>" "<profile name>"

java -jar mobicents-cli.jar -removeProfile "<profile table name>" "<profile name>"

Notes:

DeployableUnitID[#]: # is the number that identify that deployable unit.

<ComponentID> can be: ServiceID, SbbID, ResourceAdaptorID, ResourceAdaptorTypeID, ProfileSpecificationID or EventTypeID.

<level> can be: SEVERE (highest value), WARNING, INFO, CONFIG, FINE, FINER, FINEST, OFF (lowest value).

Ant tasks for Mobicents management

In the mobicents-examples/mobicents-cli/etc directory you will find an example.xml file. This is an example where you can see how to use Slee Commands from Ant. You can run the file from Eclipse or from Command Console. Remember that if you run the example.xml file from Command Console you will have to write: ant -f example.xml -<target>

Remote access

You can use mobicents-cli and Ant Tasks to access to a remote SLEE.
By default:
Host = localhost
JNP Port = 1099

Using mobicents-cli.jar you can write the following:

java -jar mobicents-cli.jar -host <Host_Name or IP_Address> -jnpPort <Port_Number> -<command> <args>

For the Ant Tasks you can see a comment at the end of the example.xml file.

NOTE: If you want to deploy a file to a remote SLEE you need to:

  1. Copy the deployment unit file in the file system of the remote host where the SLEE is running.
  2. Provide the url where the deployment unit file is located on the remote host.

Brief Tutorial for Mobicents CLI tool and Ant tasks

Mobicents CLI has been promoted to the Mobicents main project. You can see it in mobicents/tools/mobicents-cli directory. The code of build.xml and slee-management.xml files has been modified according to Mobicents main project.

From now on you will be able to use slee management commands directly from the build.xml file of your mobicents example.

Basic Steps

  1. Create MOBICENTS_HOME environment variable if you haven't created it yet.
    Examples:
    %MOBICENTS_HOME% = C:\workspace\mobicents
    $MOBICENTS = /home/workspace/mobicents
  2. Import slee-management.xml file
       <property environment="system"/>
       <property name="mobicents.home" value="${system.MOBICENTS_HOME}"/>
       <import file="${mobicents.home}/tools/mobicents-cli/slee-management.xml"/>
       
  3. Every slee management task depends on management-init task of the slee-management.xml
       <target name="slee-management-task" depends="management-init">
          <slee-management>      
             ...
          </slee-management>
       </target>
       

Now we will see the different possibilities:

Start and Stop SLEE

   <target name="start-slee" depends="management-init">
      <slee-management>
         <changesleestate state="start"/>
      </slee-management>   
   </target>
   
   <target name="stop-slee" depends="management-init">
      <slee-management>
         <changesleestate state="stop"/>
      </slee-management>   
   </target>

Deploy a Resource Adaptor

   <target name="deployra" depends="management-init">      
      <slee-management>
         <install url="${file_url}<root_of_the_file_in_unix_format>/ra-type.jar"/>
         <install url="${file_url}<root_of_the_file_in_unix_format>/local-ra.jar"/>      
         <createraentity resourceadaptorid="Name#Vendor#Version" entityname="<entity_name>"/>
         <activateraentity entityname="<entity_name>"/>  
         <bindralinkname linkname="<link_name>" entityname="<entity_name>"/> 
   </slee-management>
   </target>

Undeploy a Resource Adaptor

   
   <target name="remove-link-sipra" depends="management-init">
      <slee-management>
         <unbindralinkname linkname="SipRA"/>
         <deactivateraentity entityname="SipRA"/>
         <removeraentity entityname="SipRA"/>
         <uninstall url="${file_url}<root_of_the_file_in_unix_format>/ra-type.jar"/>
         <uninstall url="${file_url}<root_of_the_file_in_unix_format>/local-ra.jar"/>
      </slee-management>
   </target>
 

Deploy a Service

    
   <target name="deploy-service" depends="management-init">
      <slee-management>
         <install url="${file_url}<root_of_the_file_in_unix_format>/service-DU.jar"/>
         <activateservice serviceid="Name#Vendor#Version"/>
      </slee-management>
   </target>

Undeploy Service

       
   <target name="undeploy-service" depends="management-init">
      <slee-management>
         <deactivateservice serviceid="Name#Vendor#Version"/>
         <uninstall url="${file_url}<root_of_the_file_in_unix_format>/service-DU.jar"/>
      </slee-management>
   </target>

Create and Remove Profiles

   
   <target name="create-profile-table" depends="management-init">
      <slee-management>
         <createprofiletable profilespec="Name#Vendor#Version" tablename="<table_name>"/>
      </slee-management>
   </target>
      
   <target name="create-profile" depends="management-init">
      <slee-management>
         <createprofile tablename="<table_name>" profilename="<profile_name>"/>
      </slee-management>
   </target>
      
   <target name="remove-profile" depends="management-init">
      <slee-management>
         <removeprofile tablename="<table_name>" profilename="<profile_name>"/>
      </slee-management>
   </target>
      
   <target name="remove-profile-table" depends="management-init">
      <slee-management>
         <removeprofiletable tablename="<table_name>"/>
      </slee-management>
   </target>

Set Trace Level

   
   <target name="set-trace-level" depends="management-init">
      <slee-management>
            <settracelevel componentid="Name#Vendor#Version" type="<type>" level="<level>"/>
      </slee-management>
   </target>

    <!-- 
    Supported component types are: event, ra, ratype, pspec, service, sbb
    Supported trace levels are: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, OFF
    -->

SBB Configurator

To use this task you can import the current slee-management.xml from tools/mobicents-cli or you may define the task yourself:

   
  <taskdef name="sbbconfigurator" classname="org.mobicents.ant.sbbconfigurator.Task" classpath="${mobicents.home}/tools/ant-tasks/jars/slee-ant-tasks.jar" />

To set an env-entry use the subtask "setenventry". An example:

   
    <sbbconfigurator sbbdescriptor="sbb-jar.xml">
      <setenventry name="domain" newType="java.lang.String" newValue="ptinovacao.pt"/>
    </sbbconfigurator>

This will set the env entry with env-entry-name "domain", in the specified sbb descriptor, with the new type and value (you can set just one of those too). Since you may specify more than one sbb in a descriptor you may use attributes sbbName and/or sbbVendor and/or sbbVersion to narrow the match.

More, you can use the SetEnvEntrySubTask as a start to add new subtasks, that you may need (e.g. polymorphism of sbbs - select a specific sbb-ref, from a set, to be a child sbb).

Related Resources

-- Main.ivelin - 18 Apr 2005
-- VictorHugoRos - 22 Mar 2006

Topic MobicentsCLI . { Edit | Ref-By | Printable | Diffs r30 < r29 < r28 < r27 < r26 | More }
 XML java.net RSS

Revision r30 - 02 Aug 2006 - 13:59:47 - Main.torosvi
Parents: WebHome > MobicentsOpenSLEE