Suggestions

I plan to wrote mostly about BlazeDS/LCDS and how to integrate them both from the client perspective (Flex/HTML) and from the server one (Spring, EJB, various java frameworks).

If someone is interested by a particular subject please post a comment and I will try to answer or to write an tutorial about it, I’m always interested about technology related problems.

15 thoughts on “Suggestions

  1. -> About using different database urls with destinations in the hibernate assembler in LCDS.

    Hi Cornel,

    I have a question that I could not find any information in the web. I thought this might be familiar to you. I am having a flex app which uses data service destinations using hibernate assembler. But since all the destinations (whether runtime or xml for application scope) gets loaded on startup, I am unable to change hibernate configuration especially the database name based on the user logged in.

    For example. Consider a flex app with hibernate in backend.
    Company XYZ should use XYZ database
    Company ABC should use ABC database.

    Note: Both xyz and abc have same tables or data model.

    Also changing the Original hibernate configuration (using programmatic API like Configuration()) has no effect. Also note the data service destinations once created
    on server startup, cannot accept a new hibernatconfiguration as well, even if it would
    it will apply the same changes for both XYZ and ABC users.

    Any help on this would be appreciated. Thanks.

  2. Hi Rajesh,

    I’m assuming that you have N companies and this N is dynamic, otherwise it is not so hard (N configs, N destinations etc). Also I suppose that you cannot change this way of storing the data (by Oracle VPD or other ways)

    Yes it does not work to change the original hibernate Configuration – the SessionFactory is created on the initialize method – does not matter if you will change after that the Configuration.

    Also from what I know you can create destinations only on server startup – so you can not create them taking into account the company where the user belongs. So unfortunately I do not see a solution for your problem, at least not by manipulating LCDS/Hibernate.

  3. Hi,

    We are currently experiencing some problems with the LCDS2.6 Data Management using direct RTMP. I’m looking everywhere for some articles about performance issues or configuration-settings to ensure real-time performance using LCDS.
    Some explanation on possible bottlenecks and client- of server-side configuration would be more than welcome.

    Greetings,
    Rogier

  4. Hi Cornel,

    I try to get a managed association working for a few weeks now. I posted in several forums and wrote to adobe, but now answer recieved.

    I declared a trad. one-to-many relationship in the data-management.xml.
    I have assemblers for the parent and the child object, and a editable DataGrid to edit the children properties. This DataGrid gets filled properly, but if I change a value, this change is sent to the server, but NOT to other connected clients (neither their dataService nor DataStore recieve any events or errors).

    The Adobe lcds_dev_guide.pdf Includes an example:
    “Analyzing a managed association example”
    And that is just what I need, but in the examples-part of the LCDS_26 they DO NOT use this approach.
    Instead they use two differen DataServices one for the Parent and one for the Child, as you can see in \lcds-samples\WEB-INF\flex-src\crm\src\companyapp.mxml
    on line 210 – 218.

    But isn’t this some kind of cheating?

    My application will have about 40-classes with arbitrary relations, so I have to use the managed assoc. approach and cannot define seperate DataServices for each.

    COULD YOU PLEASE tell me where to find a working example? I searched the web and asked adobe, but recieved no answer as yet….

    Thanks ahead, Max

  5. Hi Max,

    Unfortunately you will need 2 data services if you perform all the operations with your relation – delete on cascade for example is not implemented yet, I wrote a little post about a workaround some time ago

    I can send you a working example of a 1-n associations (a flex builder project + sql files to create the database), let me know if you need it.

    Personally I like to map the 1-n relation only one way, from the child to the parent, especially if the number of children is large (I do that also in Hibernate)

  6. Hi Cornel,

    first thanks for your answer!

    In the first step, i don’t need a db, but thats beside the point, because the problem is the same with or without, right?

    I won’t need your project because it’s already fine with two dataservices but thanks a lot for the offer.

    But I’m interested in your opinion about the LCDS_26 dev-guide:
    -Is ist wrong documented?
    -Is there any hint about that not-yet-implemented features?
    -Why do they introduce “the managed associaction approach” and things if it doesn’t work?

    Hi Max,

    Yes, you do not need a db, I just created several weeks bellow a mini example (with db connectivity, hibernate annotations etc) for testing managed associations. I will post it on my blog after all the details (conflict management etc) are solved.

    Regarding the documentation: I think that the information is very dense, that we lack more examples, and some details are missing (like delete-on-cascade). However I’m optimistic, compared with the documentation from the previous version the actual one is better – so there is an improvement.
    Being a developer myself I understand your frustrations :) about things not working as it should be…however there is no software without bugs (I was working several years before with one of the most important RDBMS and I was discovering about one bug (or not so well documented feature) once per week. I will pass your questions to the product management anyway – thanks for your feedback.

    Let me know if you have other questions or suggestions.

    Hi Cornel,

    you’re right of course, and I’m sort of glad to know at least that it is a bug, so no further research is needed from my side.
    Beside that I’m”moaning on a high level” as we say in german,
    that means all the LCDS and Flex stuff is pretty cool indeed and bugs are little compared to the features.

    thanks a lot for being the first that replied at all :)
    Max

    Hi Max,

    I believe it’s ok to “moan on a high level”, unfortunately from my experience you are not taken seriously if you don’t :)

    I’ve talked with our tech writers and I have two news:
    a)I think you are looking on the old version of the developer guide (the one from the beta version – Analyzing a managed association example chapter does not exist in the current documentation). The new one is located on http://www.adobe.com/support/documentation/en/livecycledataservices/
    b)We plan to improve the documentation regarding managed associations – but I do not have an exact date. I will write on my blog when it will happen.

    Cornel.

    Hi Cornel,

    I already added your rss to my reader ;)
    I thought looking at the final release, because the “BETA” – label on the pages disappeared.
    Now I have the right PDF – only about 300 pages compared to the 600 of the beta Version – dont’t know if it’s a good or a bad sign ;)

    Thanks a lot,
    Max

  7. Hi,

    I apologize that I give a question here, but I have not any answer on my question on official forums.

    I have small ideological problem :) I have a login form in my application. So, each user has his own login and password. As serverside is used LCDS with secured destinations.

    And here are two possible approaches:
    1) I use server side auth. mechanism (Tomcat realm) to check users credentials. I have custom auth. class, which check username and password (set using setCredentials() function). In the next step, I try to get more information about the user. Server check if is user valid. If yes, i load requested data. If no, then I win fail() event with “Channel.Authentication.Error” and I know that, user etered wrong username or password.
    This works, but, i have some problems in logout operation and if user enter wrong username or password.

    2) Second way is this. I will have only one user (which is hardcoded in app or loaded from config). This user is authenticated to server at the start (using setCredentials() ). I need this, because all destinations are secured. And the “real user” is verified against the services that will bring the information if that user is verified or not.

    So, i don’t know which approach is better. Now, I using the first method.

    What do You think about this ? Which way is the best ?

    Petr

  8. Hi Peter,

    I would choose first variant..on the other hand I’m not quite sure that I understood what is the issue – what problems do you have when the user types a wrong password/username?

    Your English is ok btw :)

  9. Hi Cornel,

    ok, i will try to explain my problem.

    I have an application, which uses Cairngorm framework and LCDS services.
    When the application starts, a login screen appears. There are two boxes on this screen, one with username/password

    fields, second box contains news/information for users. These informations are loaded from LCDS and they are not

    secured, because I need to load them before the users is authorized.

    After the user types his username and password I set credentials using setCredentials() method. There is something like this in Cairngorm:

    > EnterpriseServiceLocator.getInstance().setCredentials( evnt.username, evnt.password );

    After the credentials are set, I need to check if user is valid or not. So, I will try to load some informations about the user. If I get resultEvent and all user informations are valid, then user is successfuly logged in. But, if I get faultEvent with “Channel.Authentication” message, so I know, that the user probably entered wrong username or password.

    There are two problems if the login fails:
    First. I will lose all data in the news/information container. I know why, because Cairngorm sets credientials to

    all deffined channels (both secured and unsecured) and if the user is not validated, all loaded data into application are discarded. The Solution in this case is to call releaseCollection() after i get news/informations data. But, if I do this, new news/informations will not be automaticaly updated into the application.

    Second problem is worse. If first login attempt fails, second login attempt throws exception in Cairngorm, and it does not matter whether the data are correct or not. Every second login attempt fails with this exception:

    Error message: “Error: Credentials cannot be set while authenticating or logging out.”

    Error trace:
    at mx.messaging::Channel/setCredentials()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\messaging\Channel.as:898]
    at mx.messaging::ChannelSet/setCredentials()

    E:\dev\3.1.\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1234]
    at mx.messaging::MessageAgent/setCredentials()[E:\dev\3.1.0

    \frameworks\projects\rpc\src\mx\messaging\MessageAgent.as:897]
    at mx.data::DataStore/setCredentials()

    [C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\DataStore.as:705]
    at mx.data::ConcreteDataService/setCredentials()

    [C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\ConcreteDataService.as:1795]
    at mx.data.mxml::DataService/setCredentials()

    [C:\depot\flex\branches\enterprise_corfu_rc\frameworks\projects\data\src\mx\data\mxml\DataService.as:643]
    at DataServices/setCredentials()

    [C:\dev\swat\projects\ac_emea\CairngormEnterprise\com\adobe\cairngorm\enterprise\business\DataServices.as:100]
    ….

    I found where the source of the problem is. If I remove news/information box in the login screen, it is all running ok. So, the problem is in Data Service destination, but I don’t know, how to solve this problem.

    Best regards,
    Peter

  10. In this case I will define 2 security constraints (one for the destination related to news, the second one for the others). The custom login command will check in doAuthorization if you are allowed or not to do the operation. The first security constraint will have the role ALL and your login command will return true always. If you don’t receive the role ALL (second security constraint) you will perform your business logic in order to establish if the access is allowed.
    That’s my first idea…the other one is to overrride Cairngorm servicelocator and to use different channels for the destinations..but it is possible to run into different kind of problems.
    I will let you know if something else come into my mind the following days.

  11. Ok, we will try the first approach with two security constraints. I will let you know how this works.

    Peter.

  12. Thanks for your comment on my blog, yes you’re right, (I updated my blog) James Ward informed me yesterday about this issue regarding issue dealing with server sessions on messaging
    flex.messaging.endpoints.BaseHTTPEndpoint class detects a
    REQUEST_ATTR_DUPLICATE_SESSION_FLAG and throws
    “flex.messaging.request.DuplicateSessionDetected”, as for now I’d like BlazeDS to be almost stateless as far as sessions on server side, perhaps one could add to config file a no session management parameter.
    So for now on flex.messaging.endpoints.BaseHTTPEndpoint class I
    basically removed the duplicateSessionDetected (temporarily) till this gets figured out.

    Anyways, if you run my sample on a tab, close tab and reopen it
    (sending same session_id) now it won’t bark at you no more (this is temporarily).

    Question for you, I wonder who will seriously consider accommodating middle ware into GAEs restrictive runtime, there are certain things in the white list
    which do not make sense as to why they put restrictions ( I could be wrong ).

    Finally, why does BlazeDS depend on server sessions?, most people I talk in J2EE arena just want the AMF serializer only, and it should be totally stateless and non-dependant on server sessions.

    More fun stuff….. ;-) , keep me updated, thanks again.

    Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>