However, I wouldn't kludge up your service locator - sure make it so you can manipulate it, but I would keep focused - just a service locator and nothing more. You could split hairs about where the manipulation logic lives. I happen to like using model locators and using binding.
Hi Jeff - I can be as pragmatic as the next developer but if you're interested here's a sketch of the hair splitting version :-).
As you can see you can still use binding. The business delegates responsible for setting up your channels can use the accessor we've added to our subclass.
I always feel there's a particular danger that the ModelLocator can become a sort of global variable dumping ground (read Rod Johnson on why he doesn't like singletons) so as a defence I try to stick very closely to the intent of the model in MVC - that is, stuff that the view is displaying like VOs, or sources of binding for currentState. I think channel sets are internal to the business layer and it's services, and the ServiceLocator is the closest thing we have to a model for the business layer. I wouldn't stop at channel sets either - I think that the ServiceLocator is a natural place for validators and other instances of shared business services, not just remote services.
RocketBoots Pty Ltd Level 11 189 Kent Street Sydney NSW 2001 Australia Phone +61 2 9323 2507 Facsimile +61 2 9323 2501 Mobile +61 418 414 341 www.rocketboots.com.au
On 02/04/2008, at 9:08 PM, Jeffrey Battershall wrote:
Gareth,
I'm a little late to this discussion, but I thought I through in my two cents. In your service locator you can bind the channelSet attribute to a dynamically created channelSet that is stored in your model locator. You create functions/ui to manipulate that model and the service locator, as a binding destination, will "know" about the model. However, I wouldn't kludge up your service locator - sure make it so you can manipulate it, but I would keep focused - just a service locator and nothing more. You could split hairs about where the manipulation logic lives. I happen to like using model locators and using binding.
However, I wouldn't kludge up your service locator - sure make it so you can manipulate it, but I would keep focused - just a service locator and nothing more. You could split hairs about where the manipulation logic lives. I happen to like using model locators and using binding.
Hi Jeff - I can be as pragmatic as the next developer but here's a sketch of the hair splitting version for your enjoyment :-).
As you can see you can still use binding. The business delegates responsible for setting up your channels can use the accessor we've added to our subclass.
I always feel there's a particular danger that the ModelLocator can become a sort of global variable dumping ground (read Rod Johnson on why he doesn't like singletons) so as a defence I try to stick very closely to the intent of the model in MVC - that is, stuff that the view is displaying like VOs, or sources of binding for currentState. I think channel sets are internal to the business layer and it's services, and the ServiceLocator is the closest thing we have to a model for the business layer. I wouldn't stop at channel sets either - I think that the ServiceLocator is a natural place for validators and other instances of shared business services, not just remote services.
RocketBoots Pty Ltd Level 11 189 Kent Street Sydney NSW 2001 Australia Phone +61 2 9323 2507 Facsimile +61 2 9323 2501 Mobile +61 418 414 341 www.rocketboots.com.au
On 02/04/2008, at 9:08 PM, Jeffrey Battershall wrote:
Gareth,
I'm a little late to this discussion, but I thought I through in my two cents. In your service locator you can bind the channelSet attribute to a dynamically created channelSet that is stored in your model locator. You create functions/ui to manipulate that model and the service locator, as a binding destination, will "know" about the model. However, I wouldn't kludge up your service locator - sure make it so you can manipulate it, but I would keep focused - just a service locator and nothing more. You could split hairs about where the manipulation logic lives. I happen to like using model locators and using binding.
My last couple of applications have followed the same kind of workflow, as well.
I haven't stored channelsets, but generally, if you have any kind of data items that need to be accessed in more than one spot, the Model is the place to look. Manipulating the model is delegated to the Controller, which in the case of Cairgorm is generally a Command. ;)
On Wed, Apr 2, 2008 at 5:08 AM, Jeffrey Battershall <jbattershall@...> wrote:
Gareth,
I'm a little late to this discussion, but I thought I through in my two cents. In your service locator you can bind the channelSet attribute to a dynamically created channelSet that is stored in your model locator. You create functions/ui to manipulate that model and the service locator, as a binding destination, will "know" about the model. However, I wouldn't kludge up your service locator - sure make it so you can manipulate it, but I would keep focused - just a service locator and nothing more. You could split hairs about where the manipulation logic lives. I happen to like using model locators and using binding.
As far as your logic to test the various services, I'd definitely create a command class and delegates to do that. There's absolutely no reason why your Command class can't recursively check for status on a number of services and and when complete, modify your model locator, which in turn will notify the user of the results via the view. I've had good luck with using application states and binding the state to my model locator. This allows me to drive any number of transitions, property settings and functions when the application enters a state such as "SERVICES_INITTED".
Jeff
On Apr 1, 2008, at 6:05 PM, Gareth Edwards wrote:
Robin,
Thanks for your response, I understand MVC most of the time, but I was a little unsure because of the nature of the service locator.
So is o.k for my view to know about the service locator?
To add methods to my service locator I will have to modify the Cairngorm EnterpriseServiceLocator, is this correct? I have already modified it to work with BlazeDS (Messaging, without LC) so I don't have a big issue doing this if it is what is required.
Cheers Gareth.
Robin Hilliard wrote:
Hi Gareth,
Here's some answers assuming you subscribe to the gist of the MVC presentation I gave at WebDU last year
I have created a some what complicated services.as
(EnterpriseServiceLocator) and I'm trying to give some limited control
back to the end user, and allow them to select from a list of available
AMFChannels. I almost have it all working, but have a couple of
questions before I continue to finish the work in this area.
- Is it o.k for my Service Locator to access the Model locator?
Strictly speaking no, because the ServiceLocator is part of the business layer, and this would introduce a dependency on a particular model from your business layer (you could imagine the business layer being useful to many distinct Flex apps with different models). That said the model changes the least out of the MVC players so in some situations where the model and service were very closely interdependent you could argue that this wasn't too great a loss.
- Is it o.k for my Service Locator to modify the values in the Model?
See above.
- How would you best manage your application to "WAIT" until various
checks on the AMFChannels are done before doing anything further ?
I'd queue the requests, going with the philosophy that like DAOs on the server you are trying to hide the complexity of how the services work from the rest of the application. As far as the command knows, it makes the asynchronous call and it just takes a while to come back while some tests are done. In fact something like this happens anyway when Flash tests for the appropriate cross domain file on the server before making an RPC call.
- Would it be better to create an Event / Command to do the required
logic to determine the AMFChannels and then use this to set the Model, then have the service locator access the Model for read only?
I would be inclined to keep the details of the selected channel in the Service Locator or a service in the Service Locator and not in the model.
- When the user selects an available AMFChannel, the system needs to
move the selected Channel to the TOP of the ChannelSet - I'm doing this by creating an array of AMFChannels, storing these in the Model, then reading them into the service locator and ChannelSet when required.
- How do I ensure no further actions take place until this update is done.
I'd add methods to the service to get lists of channel set names and select the channel - the rest of the app doesn't need to know that they're channel sets, just choices like "unsecure", "secure" or whatever you have.
You could queue the calls - the neatest way (maybe gold-plating, but cute and useful) to do this would be to create a Proxy subclass that decorated your service and queued up function calls that it would play back when you set an enabled property to true. This is like the access control proxy pattern. There might be something in the SDK that does this already.
I'm a little late to this discussion, but I thought I through in my two cents. In your service locator you can bind the channelSet attribute to a dynamically created channelSet that is stored in your model locator. You create functions/ui to manipulate that model and the service locator, as a binding destination, will "know" about the model. However, I wouldn't kludge up your service locator - sure make it so you can manipulate it, but I would keep focused - just a service locator and nothing more. You could split hairs about where the manipulation logic lives. I happen to like using model locators and using binding.
As far as your logic to test the various services, I'd definitely create a command class and delegates to do that. There's absolutely no reason why your Command class can't recursively check for status on a number of services and and when complete, modify your model locator, which in turn will notify the user of the results via the view. I've had good luck with using application states and binding the state to my model locator. This allows me to drive any number of transitions, property settings and functions when the application enters a state such as "SERVICES_INITTED".
Jeff
On Apr 1, 2008, at 6:05 PM, Gareth Edwards wrote:
Robin,
Thanks for your response, I understand MVC most of the time, but I was a little unsure because of the nature of the service locator. So is o.k for my view to know about the service locator?
To add methods to my service locator I will have to modify the Cairngorm EnterpriseServiceLocator, is this correct? I have already modified it to work with BlazeDS (Messaging, without LC) so I don't have a big issue doing this if it is what is required.
Cheers Gareth.
Robin Hilliard wrote:
Hi Gareth,
Here's some answers assuming you subscribe to the gist of the MVC presentation I gave at WebDU last year
I have created a some what complicated services.as
(EnterpriseServiceLocator) and I'm trying to give some limited control
back to the end user, and allow them to select from a list of available
AMFChannels. I almost have it all working, but have a couple of
questions before I continue to finish the work in this area.
- Is it o.k for my Service Locator to access the Model locator?
Strictly speaking no, because the ServiceLocator is part of the business layer, and this would introduce a dependency on a particular model from your business layer (you could imagine the business layer being useful to many distinct Flex apps with different models). That said the model changes the least out of the MVC players so in some situations where the model and service were very closely interdependent you could argue that this wasn't too great a loss.
- Is it o.k for my Service Locator to modify the values in the Model?
See above.
- How would you best manage your application to "WAIT" until various checks on the AMFChannels are done before doing anything further ?
I'd queue the requests, going with the philosophy that like DAOs on the server you are trying to hide the complexity of how the services work from the rest of the application. As far as the command knows, it makes the asynchronous call and it just takes a while to come back while some tests are done. In fact something like this happens anyway when Flash tests for the appropriate cross domain file on the server before making an RPC call.
- Would it be better to create an Event / Command to do the required logic to determine the AMFChannels and then use this to set the Model, then have the service locator access the Model for read only?
I would be inclined to keep the details of the selected channel in the Service Locator or a service in the Service Locator and not in the model.
- When the user selects an available AMFChannel, the system needs to move the selected Channel to the TOP of the ChannelSet - I'm doing this by creating an array of AMFChannels, storing these in the Model, then reading them into the service locator and ChannelSet when required. - How do I ensure no further actions take place until this update is done.
I'd add methods to the service to get lists of channel set names and select the channel - the rest of the app doesn't need to know that they're channel sets, just choices like "unsecure", "secure" or whatever you have.
You could queue the calls - the neatest way (maybe gold-plating, but cute and useful) to do this would be to create a Proxy subclass that decorated your service and queued up function calls that it would play back when you set an enabled property to true. This is like the access control proxy pattern. There might be something in the SDK that does this already.
Thanks for your response, I understand MVC most of the time, but I was
a little unsure because of the nature of the service locator.
So is o.k for my view to know about the service locator?
To add methods to my service locator I will have to modify the
Cairngorm EnterpriseServiceLocator, is this correct?
I have already modified it to work with BlazeDS (Messaging, without LC)
so I don't have a big issue doing this if it is what is required.
Cheers
Gareth.
Robin Hilliard wrote:
Hi Gareth,
Here's some answers assuming you subscribe to the gist of the
MVC presentation I gave at WebDU last year
I have created a some what complicated services.as
(EnterpriseServiceLocator) and I'm trying to give some
limited control
back to the end user, and allow them to select from a list of
available
AMFChannels. I almost have it all working, but have a couple
of
questions before I continue to finish the work in this area.
- Is it o.k for my Service Locator to access the Model locator?
Strictly speaking no, because the ServiceLocator is part of the
business layer, and this would introduce a dependency on a particular
model from your business layer (you could imagine the business layer
being useful to many distinct Flex apps with different models). That
said the model changes the least out of the MVC players so in some
situations where the model and service were very closely interdependent you
could argue that this wasn't too great a loss.
- Is it o.k for my Service Locator to modify the values in the Model?
See above.
- How would you best manage your application to "WAIT" until
various
checks on the AMFChannels are done before doing anything further ?
I'd queue the requests, going with the philosophy that like DAOs on the
server you are trying to hide the complexity of how the services work
from the rest of the application. As far as the command knows, it
makes the asynchronous call and it just takes a while to come back
while some tests are done. In fact something like this happens anyway
when Flash tests for the appropriate cross domain file on the server
before making an RPC call.
- Would it be better to create an Event / Command to do the required
logic to determine the AMFChannels and then use this to set the Model,
then have the service locator access the Model for read only?
I would be inclined to keep the details of the selected channel in the
Service Locator or a service in the Service Locator and not in the
model.
- When the user selects an available AMFChannel, the system needs to
move the selected Channel to the TOP of the ChannelSet
- I'm doing this by creating an array of AMFChannels, storing these
in the Model, then reading them into the service locator and ChannelSet
when required.
- How do I ensure no further actions take place until this update is
done.
I'd add methods to the service to get lists of channel set names and
select the channel - the rest of the app doesn't need to know that
they're channel sets, just choices like "unsecure", "secure" or
whatever you have.
You could queue the calls - the neatest way (maybe gold-plating,
but cute and useful) to do this would be to create a Proxy subclass
that decorated your service and queued up function calls that it would
play back when you set an enabled property to true. This is like the
access control proxy pattern. There might be something in the SDK that
does this already.
I have created a some what complicated services.as
(EnterpriseServiceLocator) and I'm trying to give some limited control
back to the end user, and allow them to select from a list of available
AMFChannels. I almost have it all working, but have a couple of
questions before I continue to finish the work in this area.
- Is it o.k for my Service Locator to access the Model locator?
Strictly speaking no, because the ServiceLocator is part of the business layer, and this would introduce a dependency on a particular model from your business layer (you could imagine the business layer being useful to many distinct Flex apps with different models). That said the model changes the least out of the MVC players so in some situations where the model and service were very closely interdependent you could argue that this wasn't too great a loss.
- Is it o.k for my Service Locator to modify the values in the Model?
See above.
- How would you best manage your application to "WAIT" until various checks on the AMFChannels are done before doing anything further ?
I'd queue the requests, going with the philosophy that like DAOs on the server you are trying to hide the complexity of how the services work from the rest of the application. As far as the command knows, it makes the asynchronous call and it just takes a while to come back while some tests are done. In fact something like this happens anyway when Flash tests for the appropriate cross domain file on the server before making an RPC call.
- Would it be better to create an Event / Command to do the required logic to determine the AMFChannels and then use this to set the Model, then have the service locator access the Model for read only?
I would be inclined to keep the details of the selected channel in the Service Locator or a service in the Service Locator and not in the model.
- When the user selects an available AMFChannel, the system needs to move the selected Channel to the TOP of the ChannelSet - I'm doing this by creating an array of AMFChannels, storing these in the Model, then reading them into the service locator and ChannelSet when required. - How do I ensure no further actions take place until this update is done.
I'd add methods to the service to get lists of channel set names and select the channel - the rest of the app doesn't need to know that they're channel sets, just choices like "unsecure", "secure" or whatever you have.
You could queue the calls - the neatest way (maybe gold-plating, but cute and useful) to do this would be to create a Proxy subclass that decorated your service and queued up function calls that it would play back when you set an enabled property to true. This is like the access control proxy pattern. There might be something in the SDK that does this already.
I have created a some what complicated services.as
(EnterpriseServiceLocator) and I'm trying to give some limited control
back to the end user, and allow them to select from a list of available
AMFChannels. I almost have it all working, but have a couple of
questions before I continue to finish the work in this area.
- Is it o.k for my Service Locator to access the Model locator?
- Is it o.k for my Service Locator to modify the values in the Model?
- How would you best manage your application to "WAIT" until various
checks on the AMFChannels are done before doing anything further ?
- Would it be better to create an Event / Command to do the required
logic to determine the AMFChannels and then use this to set the Model,
then have the service locator access the Model for read only?
- When the user selects an available AMFChannel, the system needs to
move the selected Channel to the TOP of the ChannelSet
- I'm doing this by creating an array of AMFChannels, storing these
in the Model, then reading them into the service locator and ChannelSet
when required.
- How do I ensure no further actions take place until this update is
done.
I know that I can achieve what I need one way or another, but would like
more opinions on the best way to do this.
Cheers
Gareth.
Can any one guide me on how to fetch values from the "additionalCompilerArguments" property from the "compiler" tag in ".actionScriptProperties" on the fly, i.e.) via programming or by using any inbuilt action script to fetch the value programmatically..
Actually my requirement is to populate the compiler argument's -locale value dynamically on the fly without placing these locale values during compile time.
Do a search for Observe / Observer. Was created as wrapper to control binding logic.
Was created by an Adobe Consulting guy...
On Mon, Mar 10, 2008 at 9:07 AM, Muhammad Ahmed Ullah <ahmedullah2k@...> wrote:
Hi,
Senario:
1) view-1 dispatches an event.
2) model properyt-1 gets modified within the command's execute method
3) now due to the data binding, all the views will be updated which
have used data binding with model property-1.
I want to control that view-1 don't receive the binding call because
this view itself dispatched the event.
Hi,
Senario:
1) view-1 dispatches an event.
2) model properyt-1 gets modified within the command's execute method
3) now due to the data binding, all the views will be updated which
have used data binding with model property-1.
I want to control that view-1 don't receive the binding call because
this view itself dispatched the event.
Regards,
Ahmed
Could any one please help me with some good study materials or tutorial links describing about
all the configuration files like services-config.xml, remoting-config.xml, proxy-config.xml, messaging-config.xml,
data-management-config.xml, etc in a Flex project (implementing Cairngorm framework) when deploying it as a web application.
Thanks in advance for your time and help.
Cheers,
Madhu K Please do not print this email unless it is absolutely necessary. Spread environmental awareness.
I’d recommend reading Paul Williams (of Adobe Consulting) blog – he has a series of posts about presentation models, which are a very good pattern to apply in situations such as this:
In general in Cairngorm you maintain state in the model and have the
view listen to changes to the state and react accordingly. So add a
variable to your model locator loggedIn:Boolean. Then have your login
screen listen to changes in the variable either via a ChangeWatcher
or Binding, and clear the controls when it goes false.
--- In cairngorm-devel@yahoogroups.com <mailto:cairngorm-devel%40yahoogroups.com> , "malik_robinson"
<Malik_Robinson@...> wrote:
>
> Hi,
>
> I have a class called LogoutCommand.as, code snippet below:
>
> public class LogoutCommand implements ICommand {
>
> public var modelLocator:ViewModelLocator =
> ViewModelLocator.getInstance();
>
> public function LogoutCommand() {
>
> }
>
> public function execute(event:CairngormEvent):void {
>
> modelLocator.workflowState = ViewModelLocator.LOGIN_SCREEN;
> modelLocator.loginBoxMessage = "You have been logged out!";
>
> }
>
>
>
> }
>
> The above code works fine, but when the screen changes back to the login
> screen, the username and password fields are still filled in with the
> users' original entries.
>
> On logout, I would like those fields to be cleared. I am unsure
on how
> I would access the fields from my Command Class. The syntax should be
> simple, I think I am struggling with "accessibility" and knowing how to
> interact with an object in a different file or whatever...
>
> On my "LoginScreen.mxml" file I have this control: <mx:TextInput
> id="username" width="180"/> I should be able to set its text or value
> property to empty string or something, just not sure how to do that from
> the Command Class if that makes sense.
>
> Any help appreciated...
>
> -
>
In general in Cairngorm you maintain state in the model and have the
view listen to changes to the state and react accordingly. So add a
variable to your model locator loggedIn:Boolean. Then have your login
screen listen to changes in the variable either via a ChangeWatcher
or Binding, and clear the controls when it goes false.
--- In cairngorm-devel@yahoogroups.com, "malik_robinson"
<Malik_Robinson@...> wrote:
>
> Hi,
>
> I have a class called LogoutCommand.as, code snippet below:
>
> public class LogoutCommand implements ICommand {
>
> public var modelLocator:ViewModelLocator =
> ViewModelLocator.getInstance();
>
> public function LogoutCommand() {
>
> }
>
> public function execute(event:CairngormEvent):void {
>
> modelLocator.workflowState = ViewModelLocator.LOGIN_SCREEN;
> modelLocator.loginBoxMessage = "You have been logged out!";
>
> }
>
>
>
> }
>
> The above code works fine, but when the screen changes back to the login
> screen, the username and password fields are still filled in with the
> users' original entries.
>
> On logout, I would like those fields to be cleared. I am unsure
on how
> I would access the fields from my Command Class. The syntax should be
> simple, I think I am struggling with "accessibility" and knowing how to
> interact with an object in a different file or whatever...
>
> On my "LoginScreen.mxml" file I have this control: <mx:TextInput
> id="username" width="180"/> I should be able to set its text or value
> property to empty string or something, just not sure how to do that from
> the Command Class if that makes sense.
>
> Any help appreciated...
>
> -
>
What I've done is to have a LoginVO class that has the default values for the login screen and the login form text inputs are bound to it. The LoginVO instance is in my ModelLocator and when the logout occurs you simply create a new instance.
modelLocator.loginVO = new LoginVO();
Jeff
On Nov 24, 2007, at 3:57 PM, malik_robinson wrote:
Hi,
I have a class called LogoutCommand.as, code snippet below:
public class LogoutCommand implements ICommand { public var modelLocator:ViewModelLocator = ViewModelLocator.getInstance(); public function LogoutCommand() { } public function execute(event:CairngormEvent):void { modelLocator.workflowState = ViewModelLocator.LOGIN_SCREEN; modelLocator.loginBoxMessage = "You have been logged out!"; } }
The above code works fine, but when the screen changes back to the login screen, the username and password fields are still filled in with the users' original entries.
On logout, I would like those fields to be cleared. I am unsure on how I would access the fields from my Command Class. The syntax should be simple, I think I am struggling with "accessibility" and knowing how to interact with an object in a different file or whatever...
On my "LoginScreen.mxml" file I have this control: <mx:TextInput id="username" width="180"/> I should be able to set its text or value property to empty string or something, just not sure how to do that from the Command Class if that makes sense.
I have a class called LogoutCommand.as, code snippet below:
public class LogoutCommand implements ICommand {
public var modelLocator:ViewModelLocator = ViewModelLocator.getInstance();
public function LogoutCommand() {
}
public function execute(event:CairngormEvent):void {
modelLocator.workflowState = ViewModelLocator.LOGIN_SCREEN; modelLocator.loginBoxMessage = "You have been logged out!";
}
}
The above code works fine, but when the screen changes back to the login screen, the username and password fields are still filled in with the users' original entries.
On logout, I would like those fields to be cleared. I am unsure on how I would access the fields from my Command Class. The syntax should be simple, I think I am struggling with "accessibility" and knowing how to interact with an object in a different file or whatever...
On my "LoginScreen.mxml" file I have this control: <mx:TextInput id="username" width="180"/> I should be able to set its text or value property to empty string or something, just not sure how to do that from the Command Class if that makes sense.
I've been working on an alternative approach to chaining commands. If you have the time, please check out the post I wrote at http://www.herrodius.com/blog/?p=80
. I'd like to hear your comments and thoughts.
I've been doing database/Flash/Flex integration for a long time and
have never seen anything that can create actionscript VO stub code of
database records. I created a tool a few years ago at an old job where
you could essentially do that, give it a comma separated list of
columns and it would create the stub code. Maybe it's time to rebuild
the app in AIR.
Derrick
--------------
Derrick Grigg
www.dgrigg.com
+1. Excellent approach. That is having a core Cairngorm
framework and modules/extensions like cairngorm-air.swc. I
believe that the precedent for this has already been established with CairngormEnterprise.swc.
Any others have thoughts pro or con or suggestions regarding possible alternate approaches?
Keeping all various Cairngorm implementations under a single
organizational umbrella is helpful. Helpful so that the Cairngorm
community can go to a single authoritative destination for information
and downloads. And helpful for knowing that each implementation
is under a consistent review and governance model.
Also, in your MAX 2006 Cairngorm presentation
you had suggested that other Cairngorm implementations might evolve
over time. Cairngorm for Flash. Cairngorm for Mobile
(FlashLite). Should these evolve it will be helpful to have a way
of making them available under the same organizational umbrella.
btw, with Flex going open source, is there any chance of Cairngorm being added to the Flex Jira (aka Bug and Issue Management System, including feature requests)? Or otherwise getting one of its own?
So
rather than push changes like this into the core cairngorm framework,
we should look to create modules/extensions like cairngorm-apollo.swc;
thoughts ?
How can we get updates into the core Cairngorm code base? I am
asking most immediately regarding updates along the lines of the
extensions that Eric has developed and made available at the link above
for working with the new Adobe AIR services.
So rather than push changes like this into the core cairngorm framework, we should look to create modules/extensions like cairngorm-apollo.swc; thoughts ?
Steven
On 11/10/2007 11:50, "greg h" <framework.lists@...> wrote:
How can we get updates into the core Cairngorm code base? I am asking most immediately regarding updates along the lines of the extensions that Eric has developed and made available at the link above for working with the new Adobe AIR services.
hi folks.
Just wondering, does anyone know of an eclipse (or anything else in
fact) tool for automatically creating VOs from MySQL tables?
It's just such a pain of a jop having to copy it all by hand, and also
another place where errors can creep in.
In fact it wouldn't even need to creat propper actionScript code, just
something like it that I could then change into the propper format.
The project I'm currentl;y working on is a recoding of a system that
was originally written in access and SQL. so the Database is already
there (since converted in MySQL) and there are loads of tables and
making all the VOs is becomming a real pain.
any ideas anyone?
cheers
glenn.
How can we get updates into the core Cairngorm code base? I am
asking most immediately regarding updates along the lines of the
extensions that Eric has developed and made available at the link above
for working with the new Adobe AIR services.
Hi,
Wonder if anyone might be able to help me...
I've recently started using LCDS2.5 and managed to get a demo app
working, connecting to our app database etc.
I then tried to port our existing app into LCDS, which is a Cairngorm
app, and tried to translate one of the existing web services to a
remoteObject instead - coincidentally (well not really!) the
remoteObject I managed to get working in my 'demo'.
The problem is, however, that the remoteObject never seems to get invoked.
The Services.mxml contains:
<mx:RemoteObject
id="dbService"
destination="database"
showBusyCursor="true">
<mx:method name="executeSQL"/>
</mx:RemoteObject>
And the delegate looks like this:
package com.db.storage.business
{
import mx.rpc.IResponder;
import com.adobe.cairngorm.business.ServiceLocator;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.AbstractOperation;
import mx.rpc.AsyncToken;
public class DSDelegate
{
private var responder:IResponder;
private var service:Object;
public function DSDelegate(responder:IResponder)
{
this.service = ServiceLocator.getInstance().getRemoteObject(
"dbService" );
this.responder = responder;
}
public function executeSQL(query:String):void {
var call:AsyncToken = service.executeSQL( query.toUpperCase() );
call.addResponder( responder );
}
}
}
In debug, the DSDelegate function is invoked and the executeSQL is
also invoked but nothing ever seems to get fired (or, of course,
returned). I don't think the remoteObject is being fired at all since
there's no console message indicating that it is (I have the log set
to show all activity).
The remoting-config.xml is identical to the non-cairngorm demo that
works as is all of the java side code - the only thing that's changed
is that I've tried to introduce Cairngorm to the equation.
I know this is hard to comment on without being closer to the codeline
but I was just hoping someone here would have a suggestion - we
basically have until friday to get this working properly or else we're
going to most likely abandon using LiveCycle Data Services entirely -
our experience so far with the product has been pretty miserable -
this is pretty much the final straw. I'd like to push on with it
because it *should* offer us some nice new functionality, particularly
the ability to produce PDF files displaying flex charts in them - but
there's a limit to how long you can try to keep the flame burning!
So anyway, all help, comments, suggestions etc gratefully received!
Thanks,
Jamie.
No, this syntax error was made in cut&paste process.
Well, the problem is - as soon as I reference my first web service
from the delegate (and SURE, this web service is already wsdl-loaded!)
the other services are trying to connect to their WSDL-s (which are
empty strings at that time).
If I reference this service from some ASMX, the whole thing doesn't
happen.
No, this syntax error was made in cut&paste process.
Well, the problem is - as soon as I reference my first web service
from the delegate (and SURE, this web service is already wsdl-loaded!)
the other services are trying to connect to their WSDL-s (which are
empty strings at that time).
If I reference this service from some ASMX, the whole thing doesn't
happen.
Hi Danko,
Are you sure its trying to load up the other WSDLs?
service = ServiceLocator.getInstance
> ().getWebService"publicWebService") as WebService; // this is the
> line which brings up error
has an error, as its missing a ( I have updated it below
service = ServiceLocator.getInstance
> ().getWebService("publicWebService") as WebService; // this is the
> line which brings up error
Not sure if this is a cut and paste error on your behalf... or your
problem...
Regards
Mark
--- In cairngorm-devel@yahoogroups.com, "Danko Kozar"
<danko_kozar@...> wrote:
>
> I've got a problem with ServiceLocator, and that problem didn't
> exist until my today's Flex & Cairngorm upgrade (to Hotfix 2 +
> Cairngorm 2.2).
>
> Context:
> --------
> In my <mx:ServiceLocator> I've got 3 web services defined, one of
> which is a public one (the others are protected). "Public" means
> it's not secured on the server and contains only "login(user, pass)"
> method (and it has a known URL in the application start). After the
> successfull login, the login method returns WSDL URLs of all other
> web services.
>
> Problem:
> --------
> The problem is that a service locator IMMEDIATE LOADS ALL WSDL-s of
> it's (web service) children. But: this happens only when the
> ServiceLocator is referenced FROM THE DELEGATE CLASS (using 'service
> = ServiceLocator.getInstance().getWebService("publicWebService") as
> WebService;'). When it is referenced from the main page, this
> problem doesn't exist. Of course, these other web services doesn't
> have proper WSDL-s assigned yet, so I got an error.
>
> Note: I HAVE TO reference the web service from the delegates since I
> have to invoke web service methods from that delegates.
>
> Since I didn't quite understand what's going on here, please give me
> some advice. Thanks!
>
> Code:
> -----
>
> public class LoginDelegate
> {
> private var responder: IResponder;
> private var service: WebService;
>
> public function LoginDelegate(responder: IResponder)
> {
> service = ServiceLocator.getInstance
> ().getWebService"publicWebService") as WebService; // this is the
> line which brings up error
> this.responder = responder;
> }
>
> public function login(user:String, pass:String):void
> {
> var token:AsyncToken = service.Login(user, pass);
> token.resultHandler = this.onResult;
> token.faultHandler = this.onFault;
> }
>
> //-----------------------
> protected function onResult(event:ResultEvent):void
> {
> responder.result(event);
> }
> protected function onFault(event:FaultEvent):void
> {
> responder.fault(event);
> }
> }
>
> Error Detail:
> -------------
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
> at business::Services/__mainWebService_fault()
> at
> flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE
> ventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at mx.rpc::AbstractService/dispatchEvent()
> at mx.rpc.soap.mxml::WebService/dispatchEvent()
> at mx.rpc.soap::WebService/loadWSDL()
> at com.adobe.cairngorm.business::WebServices/register()
> at
> com.adobe.cairngorm.business::ServiceLocator/get ::webServices()
> at com.adobe.cairngorm.business::ServiceLocator/getWebService
> ()
> at business::LoginDelegate$iinit()
> at command::LoginCommand/execute()
> at
> com.adobe.cairngorm.control::FrontController/com.adobe.cairngorm.cont
> rol:FrontController::executeCommand()
> at
> flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE
> ventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at
> com.adobe.cairngorm.control::CairngormEventDispatcher/dispatchEvent()
> at component.form::LoginForm/::login()
> at component.form::LoginForm/::validateMe()
> at component.form::LoginForm/__loginButton_click()
>
I've got a problem with ServiceLocator, and that problem didn't
exist until my today's Flex & Cairngorm upgrade (to Hotfix 2 +
Cairngorm 2.2).
Context:
--------
In my <mx:ServiceLocator> I've got 3 web services defined, one of
which is a public one (the others are protected). "Public" means
it's not secured on the server and contains only "login(user, pass)"
method (and it has a known URL in the application start). After the
successfull login, the login method returns WSDL URLs of all other
web services.
Problem:
--------
The problem is that a service locator IMMEDIATE LOADS ALL WSDL-s of
it's (web service) children. But: this happens only when the
ServiceLocator is referenced FROM THE DELEGATE CLASS (using 'service
= ServiceLocator.getInstance().getWebService("publicWebService") as
WebService;'). When it is referenced from the main page, this
problem doesn't exist. Of course, these other web services doesn't
have proper WSDL-s assigned yet, so I got an error.
Note: I HAVE TO reference the web service from the delegates since I
have to invoke web service methods from that delegates.
Since I didn't quite understand what's going on here, please give me
some advice. Thanks!
Code:
-----
public class LoginDelegate
{
private var responder: IResponder;
private var service: WebService;
public function LoginDelegate(responder: IResponder)
{
service = ServiceLocator.getInstance
().getWebService"publicWebService") as WebService; // this is the
line which brings up error
this.responder = responder;
}
public function login(user:String, pass:String):void
{
var token:AsyncToken = service.Login(user, pass);
token.resultHandler = this.onResult;
token.faultHandler = this.onFault;
}
//-----------------------
protected function onResult(event:ResultEvent):void
{
responder.result(event);
}
protected function onFault(event:FaultEvent):void
{
responder.fault(event);
}
}
Error Detail:
-------------
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at business::Services/__mainWebService_fault()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE
ventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractService/dispatchEvent()
at mx.rpc.soap.mxml::WebService/dispatchEvent()
at mx.rpc.soap::WebService/loadWSDL()
at com.adobe.cairngorm.business::WebServices/register()
at
com.adobe.cairngorm.business::ServiceLocator/get ::webServices()
at com.adobe.cairngorm.business::ServiceLocator/getWebService
()
at business::LoginDelegate$iinit()
at command::LoginCommand/execute()
at
com.adobe.cairngorm.control::FrontController/com.adobe.cairngorm.cont
rol:FrontController::executeCommand()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE
ventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
com.adobe.cairngorm.control::CairngormEventDispatcher/dispatchEvent()
at component.form::LoginForm/::login()
at component.form::LoginForm/::validateMe()
at component.form::LoginForm/__loginButton_click()
Robin, just a question with your chaining solution.
On 18/07/2007, at 5:42 PM, Robin Hilliard wrote:
A Command represents a user action and a Delegate represents a service call
Are you using 1 command as the responder to multiple delegates (service calls)?
On 12/07/2007, at 11:10 PM, mark_j_ellul wrote:
I agree the chainable events are quite useful, however its not that useful if you have 2 buttons, like a save and refresh, which both trigger Cairngorm Events... If the user in their wisdom presses one directly after the other the call on the delegate causes issue...
The logical solution for this to me would be disable all user gestures while the service call is waiting for a result.
Here's an alternative approach to chaining commands together - we've always gone with state machines in our commands - I took the description of Commands and Delegates very literally from the old Flex book i.e. A Command represents a user action and a Delegate represents a service call, so creating chains of Commands only* because we need to make a sequence of calls seemed to be (respectfully) a case of the tail wagging the dog.
We have used this on many projects (the most complex had around 15 states with a reasonably involved state diagram), it's easy to work with once the pattern is established.
Here's some pseudo-code:
public class SomeCommand implements ICommand, IResponder {
private const START_STATE : Number = 0;
private const LOGIN_REQUEST : Number = 1;
private const GET_DATA_REQUEST : Number = 1;
// More states...
private var state : Number = START_STATE;
// usual constructor
public function execute (event : CairngormEvent) : void {
result();
}
public function result(event : * = null) : void {
switch(state) {
case START_STATE:
// make login request;
break;
case LOGIN_REQUEST:
// do something with results
// can decide which way to go on state di
// make another request
state = GET_DATA_REQUEST;
break;
case GET_DATA_REQUEST:
// and so on...
}
}
}
I don't feel there's much advantage in breaking this up further as the processing for each state is highly dependant on the others, and it's easier this way to hold the state diagram in your hand and match it up with the case statements.
HTH,
Robin
*sometimes we do fire off new events in a result handler to chain commands together, usually in cases where the subsequest commands in the chain can also be invoked in isolation.
Robin Hilliard
CEO - RocketBoots Pty Limited
Consulting .Recruitment . Software Licensing . Training
I agree the chainable events are quite useful, however its not that useful if you have 2 buttons, like a save and refresh, which both trigger Cairngorm Events... If the user in their wisdom presses one directly after the other the call on the delegate causes issue...