Skip to main content

Profile table creation at run-time

17 replies [Last post]
stefanogamma
Offline
Joined: 2005-10-18

Hi,
i need to create and populate an AddressProfile Table at run time when my service is started.

The specs 1.0 are clear and the thread http://forums.java.net/jive/thread.jspa?threadID=1740&tstart=0 confirm that this can't be done directly with an SBB.

So i've two choise :
1 - Implement the specs 1.1 so an SBB can edit a profile
2 - Use JMX to access management MBean

First choise is a task too long for now and i don't like the second choise, so i'm searching another solution.

If i can use beanshell script to deploy and activate RA and service, i suppose that i can write a script to read data from DB and than create the profile table and populate it.

Is a task that i can do?
if someone knows better solution please tell me.

Thanks
Stefano

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
stefanogamma
Offline
Joined: 2005-10-18

Finally the implementation is started and the SleeCacheLoader class is born :)

SleeCacheLoader extend the org.jboss.cache.loader.CacheLoade
Provisionally the cache loader will load only one profile spec.
The CacheLoader is configured with this mandatory property :

cache.profile.specification.name (spec name)
cache.profile.specification.vendor (spec vendor)
cache.profile.specification.version (spec version)
cache.profile.loader (class to witch demand the specific cache load)

and an optional property :
slee.management.mbean.name
with default value = slee:service=SleeManagement

Here comes the some question:

- How can i specify more than one profile spec with a property file?
A solution could be to create an "array" of property key in example
cache.profile.specification.name.1=specName.A
cache.profile.specification.vendor.1=specVendor.A
cache.profile.specification.version.1=specVersion.A
cache.profile.loader.1=cacheLoader.A
cache.profile.specification.name.2=specName.B
cache.profile.specification.vendor.2=specVendor.B
cache.profile.specification.version.2=specVersion.B
cache.profile.loader.2=cacheLoader.B

I don't like much this solution so, if someone has a better and more elegant idea please tell me.

- How can i retrieve the profileTableNames defined by every service or every single sbb deployed?
I'm still digging in the mobicents source code.

- When the cacheloader service start i get some management MBean like DeploymentMBean and ProfileProvisioningMBean, but when i try to use some methods i got this:
ERROR [SleeContainer] Unexpected error: Cannot retrieve SLEE Container!
javax.naming.NameNotFoundException: slee not bound

I suppose Mobicents is not yet started.
How can i manage this?

Thanks
Stefano

stefanogamma
Offline
Joined: 2005-10-18

i've partially resolved my doubt
The cacheloader read this properties :

cache.profile.specification.name
cache.profile.specification.version
cache.profile.specification.vendor
cache.profile.tablename

(initially the cacheloader will manage only one profiletable)

What sleecacheloader has to do is intercept cache request of cache.profile.tablename create the profile and return it to the treecache.

When the treecache has to retrieve something the cacheloader method exist(Fqn fqn) is invoked where fqn is the tree cache node.
Mobicents identify profile node with /profile:
and the profile index with /profileIndexes:
so is not difficult to intercept the request and return true if the tablename is equals to the tablename specified in the properties.

Now treecache will invoke the method get(Fqn fqn) so the cacheloader has to create and return the node content.

If the node is /profile:
cacheloader has to create a profileTableName object with the right profile specs and if the profile specs declares some indexes the next cache request will be /profileIndexes:

For this task i'd like to use the org.mobicents.slee.container.profile.SleeProfileManager, but no one method return what i need ... the addProfileTable method perform all the operation : profileTable and profileIndexes creation and finally the post in the treecache.

So, finally, my request :
can someone refactor the SleeProfileManager to extract two methods (createProfileTableMap and createIndexesMap) from the too complex addProfileTable?
SleeCacheeLoader will benefit using the two new method and SleeProfileManager code will be at least more readable.

Obviously i'd be glad to modify the SleeProfileManager.
Stefano

stefanogamma
Offline
Joined: 2005-10-18

I've relased a first SleeCacheLoader release.
Is really simple for now.

If someone is interested in the code i've created an issue
https://mobicents.dev.java.net/issues/show_bug.cgi?id=60

Critics, tips and comments are well-appreciated.

Stefano

ivelin
Offline
Joined: 2003-07-13

This discussion shifted to the bugzilla issue.

ivelin
Offline
Joined: 2003-07-13

In regard to this discussion I was pointed to the JDBC-LDAP Bridge Driver hosted at the Open LDAP Project. It was originally contributed by OctetString. They were recently acquired by Oracle. It seems like the driver is maintained by the OpenLDAP community.
http://www.openldap.org/jdbcldap/

Ivelin

stefanogamma
Offline
Joined: 2005-10-18

Ivelin,
i've started to code the SleeCacheLoader.
I need some general info :
- the package name for this class org.mobicents.xxx ?
- mobicents use jbosscache 1.2.3 right?

Thanks
Stefano

ivelin
Offline
Joined: 2003-07-13

Great to hear!

package org.mobicents.slee.runtime.cache

yes, we now use jboss cache 1.2.3

We can consider jb cache 1.2.4 sp2, which has a lot of bug fixes and performance enhancements.
http://www.jboss.org/products/jbosscache/downloads

We can also start thinking about migrating to JBoss AS 4.0.4, which uses jboss cache 1.2.4. Not a high priority task. If you don't have a lot of time, don't worry about it.

Ivelin

stefanogamma
Offline
Joined: 2005-10-18

Ivelin,
i'm thinking to use the SleeProfileManager for all the operation (create, insert, etc) or u think i've to operate directly on the treecache?

I've to extend the JDBCCacheLoader or i write the SleeCacheLoader from scratch?

Stefano

ivelin
Offline
Joined: 2003-07-13

Stefano,

> Ivelin,
> i'm thinking to use the SleeProfileManager for all
> the operation (create, insert, etc)

That's the aproach that I'd try first.

> I've to extend the JDBCCacheLoader or i write the
> SleeCacheLoader from scratch?

I would say you need to write one from scratch, because the idea of your SleeCacheLoader will be to dispatch the work to concrete Cache Loaders based on a mapping - (profile spec <-> cache loader mbean mapping). The JdbcCacheLoader would be one of the more frequently used once but it will not be the only one. For example I can imagine that an Ldap Cache loader would be also a popular choice.

Have you made any progress yet? Any code I can look at?

Ivelin

>
> Stefano

stefanogamma
Offline
Joined: 2005-10-18

Ivelin,
thanks for the usefull tips.
Unfortunately i was really busy to respect a work deadline.
I hope to write some code this week.
I've many question about this topic, can we use another way to communicate faster (email, google Talk, ...)?

Stefano

ivelin
Offline
Joined: 2003-07-13

How many profiles do you expect to have in the AddressProfile Table?

stefanogamma
Offline
Joined: 2005-10-18

The default is one profile address for service.

I need this for setting the initial filter criteria for service.
Pratically i've to map

service <--> telephon number

serviceA <--> 48445
serviceB <--> 48446
serviceC <--> 48447

So when i receive a SIP INVITE to 48445@mydomain.com only serviceA will be instantiated.

stefanogamma
Offline
Joined: 2005-10-18

I've do it with a beanshell.
If someone is interested i can post the code.

Stefano

ivelin
Offline
Joined: 2003-07-13

BSH is an acceptable aproach for a small number of records. Its great for demos and examples.
Please upload the code in a bugzilla issue and point to it.

For a more general case we need to allow custom persistence mechanism per profile specification. One way to do it is via custom SleeCacheLoader for JBossCache, which can be configured with a set of pairs (profile specification, specific cache loader). It will delegate profile table queries to specific persistence mechanisms (cache loaders), given their profile specification mapping. Some reference docs:
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossCacheCacheLoaders
http://www.jboss.com/products/jbosscache/docs
http://www.jboss.com/wiki/Wiki.jsp?page=JBossCache

Let me know if you are interested to work on this?

Ivelin

stefanogamma
Offline
Joined: 2005-10-18

Here come the link for my example code :
https://mobicents.dev.java.net/issues/show_bug.cgi?id=51

For the SleeCacheLoader task, i'm really interested.
I'm going to read the reference docs, i've never worked with jbosscache before.

Thanks
Stefano

Message was edited by: stefanogamma

barbeauxj
Offline
Joined: 2006-02-08

Hi,

I want to learn more about Profile.
How does it work ?
How using your code ?
Where do you write profile ?

Please help me

Thanks

Joffrey

stefanogamma
Offline
Joined: 2005-10-18

Hi Joffrey,
first of all u have to read JSLEE spec 1.0 Chapter 10 for Profile.

For better understanding my code read JSLEE spec 1.0 Chapter 13 for Facilities

BSH script activate a service specified in the variable demoURL then create a ProfileTable of type AddressProfile and insert a profile in the ProfileTable.
Profile operation are performed using the ProfileProvisioningMBean.

If u have deployed Mobicents, u can simulate all this operation using jboss jmx console.

Stefano