Granite Data Services » Migrating from GraniteDS 3.0.0.M3 to 3.0.0.RC1 (Flex)

Migrating from GraniteDS 3.0.0.M3 to 3.0.0.RC1 (Flex)

The ServiceInitializer API has been removed and replaced by ServerSession and IServerApp. The following code:

Tide.getInstance().getContext().serviceInitializer = new DefaultServiceInitializer('/myapp');

Should be replaced by:

Tide.getInstance().mainServerSession.serverApp = new SimpleServerApp('/myapp');

Why this (apparently) cosmetic change ? The difference is that you can now create other ServerSession objects for other server applications (other context roots, other server urls, …). Implicit service proxies will still be routed to the main ServerSession, if you want to connect to another server, you will have to attach the service proxies to the other ServerSession:

Tide.getInstance().mainServerSession.serverApp = new SimpleServerApp('/myapp');
var appSession2:ServerSession = 
    new ServerSession('/myapp2', false, 'myserver2', '8080');
Tide.getInstance().getContext().appSession2 = appSession2;
Tide.getInstance().getContext().myService2 = new MyService2(appSession2);

// Service proxy for MyService on http://localhost:8080/myapp 
[Inject]
public var myService:MyService;

// Service proxy for MyService2 on http://myserver2:8080/myapp2
[Inject]
public var myService2:MyService2;

The GraniteDS Team.

Author: Franck

Leave a Comment