Hi Doug, sorry I didnt get a chance to respond to your email earlier.

The Javascript in your feature looks correct to me.  The fact that osapi 
is undefined would probably mean your script tag is not actually loading 
the common container code.  I am unfamiliar if the way your layering your 
features in shindig.properties, I have not one that before.  I am not sure 
if someone else on the list may have some input there.

Have you tried just adding a new folder for your feature under the 
shindig-features project and including your feature that way?  Might be 
something to try to see if that works so you can eliminate your feature 
code from the equation.

-Ryan

Email: [email protected]
Phone: 978-899-3041
developerWorks Profile



From:   "Davies,Douglas" <[email protected]>
To:     <[email protected]>, 
Date:   04/28/2011 04:28 PM
Subject:        Extending common container via features



I'm trying to extend the commoncontainer.  I want to add a couple of new
apis.  I'm trying to do this by introducing a feature that adds the new
functionality.

 

In shindig.properties I have

 

shindig.features.default=res://features/features.txt,res://features/oclc
features.txt

 

referencing my new oclcfeatures.

 

In oclcfeatures.txt I have

 

features/oclccontainer/feature.xml

 

referencing the new feature.

 

In features/oclccontainer/feature.xml I have

 

<?xml version="1.0"?>

<feature>

  <name>oclccontainer</name>

  <dependency>container</dependency>

  <container>

      <script src="oclccontainer.js"/>

  </container>

</feature>

 

And finally in features/oclcontainer/oclccontainer.js I have

 

osapi.container.Container.addMixin("oclc", function(context) {

    return {

        "installGadget" : function() {

            alert('installGadget');

        }

    };

});

 

In my client I'm doing the following (adding the oclccontainer feature)

 

<script type='text/javascript'
src='/opensocial/gadgets/js/container:oclccontainer:rpc.js?c=1&debug=1&n
ocache=1&container=default'>

</script>

 

    var config = {};

    var container = new osapi.container.Container(config);

 

    container.oclc.installGadget('test');

 

However I get osapi undefined.  If I remove the
res://features/oclcfeatures.txt reference from shindig.properties, then
I get past the osapi.container call but then of course container.oclc is
not defined.

 

So two questions.  Am I adding the feature correctly and am I extending
the common container correctly?

 

Any help is appreciated.

 

Thanks,

Doug Davies

OCLC

 




Reply via email to