API documentation probably wrong or type changed with version??
hi 2 days ago i asked for a simple sample sourcecode how to get all
shared obect names
i posted a sourcecode and the only answhere whrere about my other
question regarding missing
external classes, anyway i did go on and tried now for 3 day, somehow 30
hours to
bring a java 5 liner with only one error in one line to run and as i
imagine no one else that was
reading the list was able too, else i suggest somone would have had time
to help on a 5 liner.
well anyway...
the probably WRONG API description:
~~~~~~~~~~~~~~~~~~~~~~~~
[API]
getSharedObjectNames
public Set<String> getSharedObjectNames(IScope scope)
Description copied from interface: ISharedObjectService
Get a set of the shared object names.
Specified by:
getSharedObjectNames in interface ISharedObjectService
Parameters:
scope - the scope to return the shared object names from
Returns:
set containing the shared object names
[/API]
~~~~~~~~~~~~~~~~~~~~~~~~
the way it DOES NOT work and that i tried for the whole while:
[code]
Set <String> mySet = getSharedObjectNames(scope);
[/code]
result is a typemissmatch
eg.:
[log]
INFO | jvm 1 | 2006/08/15 20:09:55 | Caused by: java.lang.Error:
Unresolved compilation problem:
INFO | jvm 1 | 2006/08/15 20:09:55 | Type mismatch: cannot convert from
Iterator<String> to Set<String>
INFO | jvm 1 | 2006/08/15 20:09:55 |
INFO | jvm 1 | 2006/08/15 20:09:55 | at
demo.Application.getSOList(Application.java:33)
INFO | jvm 1 | 2006/08/15 20:09:55 | ... 17 more
[/log]
~~~~~~~~~~~~~~~~~~~~~~~~
what also would NOT work is trying to cast to the described "returns set
of..." from Iterator to Set type
[log]
INFO | jvm 1 | 2006/08/15 20:04:04 | Caused by:
java.lang.ClassCastException:
org.red5.server.Scope$PrefixFilteringStringIterator
INFO | jvm 1 | 2006/08/15 20:04:04 | at
demo.Application.getSOList(Application.java:33)
INFO | jvm 1 | 2006/08/15 20:04:04 | ... 17 more
[/log]
~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> but what will work is...:
[code]
Iterator<String> mySet = getSharedObjectNames(scope);
[/code]
so the API should be corrected, because it returns an Iterator not a Set:
my suggestion:
[API]
getSharedObjectNames
public Iterator<String> getSharedObjectNames(IScope scope)
Description copied from interface: ISharedObjectService
Get a iterator of the shared object names.
Specified by:
getSharedObjectNames in interface ISharedObjectService
Parameters:
scope - the scope to return the shared object names from
Returns:
Iterator containing the shared object names
Example[Java):
package demo;
import org.red5.server.api.Red5;
import java.util.Iterator;
import java.lang.String;
import org.red5.server.api.IScope;
import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.adapter.ApplicationAdapter;
public class Application extends ApplicationAdapter {
public String getSOList()
{
String elementList = "Elements: ";
IConnection conn = Red5.getConnectionLocal();
IClient client = conn.getClient();
IScope scope = conn.getScope();
Iterator<String> Iterator = getSharedObjectNames(scope);
while (myIterator.hasNext()) {
Object element = myIterator.next();
elementList = elementList + "" + element;
}
return "Output from Server : iam " + client + " and running
with scope " + scope + ". i require the following SharedObjects: " +
elementList;
}
}
Example(Flash):
main_nc.onResult = function(obj){
trace(obj);
};
main_nc.connect("rtmp:/demo");
};
main_nc.call("getSOList", main_nc);
[/API]
~~~~~~~~~~~~~~~~~~~~~~~~
in that case i also discovered a strange behavour.
while all my testing with several ways to understand why this one dammed
line would not like to work
i also tried with the demoprogramm from the migrationguide where i first
create these SOSampleObject
well it may has been created but gets not listed the only listed object
are those my client had made.
Is that a default behavour shouldent the created SO been listed also??
if u need more informations pls ask.
best regards
Sascha
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org