SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Customizations
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-21-2005, 01:35 PM
drjava drjava is offline
Sage User
 
Join Date: Feb 2005
Location: California
Posts: 6
Sage API RMI Server

I just wanted to say that I have SageTV 4 running on my PVR350 based machine and all the old EOF problems have gone away. Yea! That being said, I also now wanted to start working with Studio and the Sage API.

To become familiar with the API and avoid lots of reloads in the process, I created a small RMI (Remote Method Invocation) server that is loaded at SageTV startup that wraps the sage api method. This allows me to access all the sage internal functionality from external programs, just as though they were running within the SageTV context.

I think this could also open doors for a lot of interesting add on applications. I'd like the Sage folks to comment if this any sort of license violation and whether there is any interest from others before I go ahead and make it more bullet proof.

Mike
Reply With Quote
  #2  
Old 11-21-2005, 01:45 PM
jominor's Avatar
jominor jominor is offline
Sage Expert
 
Join Date: Dec 2003
Posts: 573
Quote:
Originally Posted by avajrd
I just wanted to say that I have SageTV 4 running on my PVR350 based machine and all the old EOF problems have gone away. Yea! That being said, I also now wanted to start working with Studio and the Sage API.

To become familiar with the API and avoid lots of reloads in the process, I created a small RMI (Remote Method Invocation) server that is loaded at SageTV startup that wraps the sage api method. This allows me to access all the sage internal functionality from external programs, just as though they were running within the SageTV context.

I think this could also open doors for a lot of interesting add on applications. I'd like the Sage folks to comment if this any sort of license violation and whether there is any interest from others before I go ahead and make it more bullet proof.

Mike
I'm interested. I was considering creating a wrapper so that Sage's API would more closely mirror my conventions, but the RMI wrapper is an intriguing idea.
[Update] In fact, a little Spring wrapper would make it perfect.
Reply With Quote
  #3  
Old 11-21-2005, 02:34 PM
PGPfan's Avatar
PGPfan PGPfan is offline
Sage Fanatic
 
Join Date: Apr 2003
Location: Oldtown, Idaho USA
Posts: 862
This looks interesting to me, also!

avajrd, would you mind posting a simple usage scenario for those of us that are new to Studio, etc.?

Thanks!

-PGPfan
Reply With Quote
  #4  
Old 11-21-2005, 03:25 PM
drjava drjava is offline
Sage User
 
Join Date: Feb 2005
Location: California
Posts: 6
Quote:
Originally Posted by PGPfan
This looks interesting to me, also!

avajrd, would you mind posting a simple usage scenario for those of us that are new to Studio, etc.?

Thanks!

-PGPfan
This server is not really intended to effect the GUI portion of SageTV. I think is usage would be more along the lines of nielm's webserver and getstatus. (Good stuff by the way neilm!) It would enable other applications that run along side SageTV (or even on another machine) access to the sage internal api.

Right now, as I understand it, to use the api, a program must be created and loaded by SageTV. This can be done with STV, STVi, or the load_at_startup_runnable_classes in sage.properties. All the functionality of the new feature or application runs within the Java VM that is running SageTV. The api server would simply expose the method "Object api( String api, Object[] args )" to external programs.

The simple usage scenario would be:

1. Ensure that rmiregistry is running. This is included with the JRE.
2. Load the server using the load_at_startup_runnable_classes as mentioned above.
3. From an external program, lookup the remote class in the registry and then make calls to it.

The external app could be another Java GUI, a web server, email client, etc. I suppose you could even wrap that so that a VB, C, or Python program could access it. Of course there are some security issues that have to be addressed and I'm looking into those right now.

Does that make any sense?

Mike
Reply With Quote
  #5  
Old 11-21-2005, 03:33 PM
drjava drjava is offline
Sage User
 
Join Date: Feb 2005
Location: California
Posts: 6
Quote:
Originally Posted by jominor
[Update] In fact, a little Spring wrapper would make it perfect.
This is probably very doable. I haven't worked with Spring yet. I've been doing struts and hibernate in my paying gig recently.

What do you have in mind?

Mike
Reply With Quote
  #6  
Old 11-21-2005, 04:24 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Quote:
Originally Posted by avajrd
I think this could also open doors for a lot of interesting add on applications. I'd like the Sage folks to comment if this any sort of license violation and whether there is any interest from others before I go ahead and make it more bullet proof.
No violation at all. In fact we heavily encourage this kind of behavior.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #7  
Old 11-21-2005, 08:36 PM
jominor's Avatar
jominor jominor is offline
Sage Expert
 
Join Date: Dec 2003
Posts: 573
Quote:
Originally Posted by avajrd
This is probably very doable. I haven't worked with Spring yet. I've been doing struts and hibernate in my paying gig recently.

What do you have in mind?

Mike
Cool. I use Struts, Spring, and Hibernate. Basically, we could use Spring(and a couple of interfaces) to wrap the RMI call so it seems local to whomever is using the interface and API. Something like this

Favorite favorite = XmlBeanFactory.getBean("favorite");
favorite = favorite.getFavorite(10);

List airings = new ArrayList();
if (favorite != null)
{
airings = favorite.getAirings(favorite);
}

// Display favorites somehow


Now, with an RMI, we all just use the interface. Should someone wish to not use the RMI server, the just use a different implementation and use Spring to point to the non RMI impl.
Reply With Quote
  #8  
Old 11-22-2005, 09:19 PM
drjava drjava is offline
Sage User
 
Join Date: Feb 2005
Location: California
Posts: 6
OK, finally got my account straightened out avajrd == drjava

Well my simple RMI server turns out to be not so simple. The base sage classes like Channel are not serializable. RMI requires classes to implement java.io.Serializable.

So I guess if I want to progress, I have more work to do to encapsulate the functionality of these classes in classes that do implement java.io.Serializable. I'll poke around at it a bit, but I'm not sure what the scope is going to be. I have a feeling that the rmi api is going to take on a more custom feel.

Any ideas or suggestions?

Mike
Reply With Quote
  #9  
Old 11-23-2005, 12:23 AM
jominor's Avatar
jominor jominor is offline
Sage Expert
 
Join Date: Dec 2003
Posts: 573
Quote:
Originally Posted by drjava
OK, finally got my account straightened out avajrd == drjava

Well my simple RMI server turns out to be not so simple. The base sage classes like Channel are not serializable. RMI requires classes to implement java.io.Serializable.

So I guess if I want to progress, I have more work to do to encapsulate the functionality of these classes in classes that do implement java.io.Serializable. I'll poke around at it a bit, but I'm not sure what the scope is going to be. I have a feeling that the rmi api is going to take on a more custom feel.

Any ideas or suggestions?

Mike

Have an interface called SageChannel which extends Serializable with an AbstractSageChannelImp(just example names). AbstractSageChannelImpl implements SageChannel with methods analogous to Sage's Channel class. A user of the RMI Server would use the SageChannel interface by extending the AbstractSageChannelImpl.

So, CustomChannelImpl would extend AbstractSageChannelImpl and the SageChannel interface would be passed into the RMI Server which would import Sage's library and translate the calls into Sage itself.

I do a variation of this at work. All my objects are serializable becase they ultimately implement an interface that extends Serializable.
Reply With Quote
  #10  
Old 11-23-2005, 01:16 AM
drjava drjava is offline
Sage User
 
Join Date: Feb 2005
Location: California
Posts: 6
Quote:
Originally Posted by jominor
Have an interface called SageChannel which extends Serializable with an AbstractSageChannelImp(just example names). AbstractSageChannelImpl implements SageChannel with methods analogous to Sage's Channel class. A user of the RMI Server would use the SageChannel interface by extending the AbstractSageChannelImpl.

So, CustomChannelImpl would extend AbstractSageChannelImpl and the SageChannel interface would be passed into the RMI Server which would import Sage's library and translate the calls into Sage itself.

I do a variation of this at work. All my objects are serializable becase they ultimately implement an interface that extends Serializable.
That's along the lines I was thinking of, but a lot more involved than a simple api wrapper. Let me knock out a couple like Channel and Airing and let's see how that looks.

I think I have the basic mechanics working that have an embedded web based class server along with the rmi server binding. I might need some help with coming up with a sane java.policy file and its customization tools.

Mike
Reply With Quote
  #11  
Old 11-23-2005, 10:12 AM
jominor's Avatar
jominor jominor is offline
Sage Expert
 
Join Date: Dec 2003
Posts: 573
Quote:
Originally Posted by drjava
That's along the lines I was thinking of, but a lot more involved than a simple api wrapper. Let me knock out a couple like Channel and Airing and let's see how that looks.

I think I have the basic mechanics working that have an embedded web based class server along with the rmi server binding. I might need some help with coming up with a sane java.policy file and its customization tools.

Mike
I'll offer any help I can. I've got a project coming due by Dec 16. After that, I'll upgrade to v4 and start my plunge. I've got a couple of minor ideas I've been toying with.
Reply With Quote
  #12  
Old 11-23-2005, 11:35 AM
drjava drjava is offline
Sage User
 
Join Date: Feb 2005
Location: California
Posts: 6
Quote:
Originally Posted by jominor
I'll offer any help I can. I've got a project coming due by Dec 16. After that, I'll upgrade to v4 and start my plunge. I've got a couple of minor ideas I've been toying with.
Any help would be great. Let me do what I said above and then package it up and send it to you to look at for comments. BTW, if you are not using ShowAnalyzer and DirMon, you might want to look at that.

Mike
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 12:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.