State management

Can anyone suggest me any method to maintain state in a java application
other than stuff like making variables or objects as members of the class?
A design pattern or an example would be very helpful.
Thanks

It depends on what type of 'state' you need to keep. If you need 'in memory' state to be held and restored at some later point in time, the Momento Design Pattern can be used.
See the GOF's Design Patterns.
This relies on Friend functions (a C++ facility), but I think you can implement the pattern in Java pretty easily using inner classes.

Similar Messages

  • Issue with : Stateful BSP Applications: New State Management Option

    Reference:weblog by Thomas Jung -  /people/thomas.jung3/blog/2004/11/09/updated-stateful-bsp-applications-new-state-management-option
    I see a comment by one user to send the complete code... I am not sure what else can be sent   - try it out rather than getting spoon-fed. - getting offline - sorry...
    I had two issues with this ITSM way of session handling.
    First - if you are using an SP42 environment, check CL_BSP_RUNTIME=>ON_SESSION_CMD() to see if CANCEL is defined as an option. If not make sure that you use &sap-sessioncmd=CLOSE" instead of the &sap-sessioncmd=CANCEL" . If CANCEL is not defined , it will give you shortdumps...
    Second - when I closed the window, the session was not terminated. I used onbeforeUnLoad="exitBSPApplication(); instead of onUnLoad="exitBSPApplication(); and it worked fine. Not sure if it has any other issues.
    But now I am facing a new issue... all but one application is not ending... I have no clue on why this is happening.. I am still checking..
    Thanks Thomas, you are the best, as always...

    Thanks for checking the code in your system.
    After some investigation, I found the behavior as explained below.
    If the actual url has any fields passed as parameters, e.g.. /default.htm?var1=a&var2=2 ...
    - if I use CANCEL as the option, a shortdump is created and the session is not closed. if I use CLOSE, Session is terminated and no shortdump happens.
    If the actual url does not have any parameters, e.g.. /default.htm ...
    - CANCEL does the work, but CLOSE does not exit the session.
    In my applications I used request->get_form_fields to see if there are any parameters, and if there are, then I use CLOSE as the option and else, I use CANCEL. So now, the session
    management works beautifully...
    There is a good chance that I am doing something wrong here too.

  • Information about adf data model's state management in JSF/ADF faces?

    Dear All,
    i am developing an application with JSF/ADF faces + using
    adf data model (EJB, not adf bc)...
    i want to know more about state management of adf data model..
    1. under what condition, will the data in the binding context
    (methodIterator, variableIterator, accessorIterator..etc) be maintained accross
    http requests? say browse pageA.jspx, pageB.jspx, pageC.jspx..then do data
    in the corresponding pages saved somewhere else until session timeout?
    2. how do the binding context data be saved ?? http session?
    i can't find detail information in the adf bc dev guide and the adf dev guide..
    could anyone give me more information about this?? any better document??
    i have asked these question several times...but seem nobody can give me a
    full picture about the adf data model's state management....it is quite important
    in order to develop good application using adf data model.
    my company have brought oracle's support service...can i get these information
    through metalink (open a SR) ?? or actually no such information available ??
    btw, after playing with adf data model for a few weeks, i do find it is very
    hard to learn it... no complete document, information is just by providing example...
    adf data model do make:
    1. simple logic, supported by adf, more simple in coding
    2. simple logic, not supported by adf, more complex in coding
    3. complex logic, much more complex in coding...brain damage..
    lsp

    Hi,
    actually, these pages don't explain the state management about the adf data model's iterators?
    i want to know the state management of the iterators...for some iterators..it's
    state is maintained across requests...
    please see my previous post: ADF JSF data binding: why state maintained between requests? that Frank Nimphius said:
    "in this case its the iterator that survives the page navigation"...
    in the adf dev guide..section 5.5.5..it says: "Upon each request, the iterator bindings are refreshed to rebind them to the
    underlying RowSetIterator objects. By default, the rowset iterator state and the
    data caches are maintained between requests."
    in dev guide, it seems state is maintained for request for the same page, but not
    accross different pages. but in fact, the rowset iterator do survive...
    any detail document that write down the actual behavior of the iterators?
    thank you.
    lsp

  • Multi-page units of work with automatic state management

    Hi Jhs team:
    When my applications need to support an end-user task requiring data entry on many different web pages to complete,
    how to building multi-page units of work with automatic state management ? please give some instruction .

    Ting Rung,
    You can do this in two ways:
    - use a Struts form bean to collect all the values over the requests
    - submit the changes of each request to bc4j, but do not post and commit the changes to the database.
    The latter is easiest. For this to work, you must set the doCommit property of all your save actions in the stuts-condig to false, except for the last save action in the chain of requests.
    In addition, in your application module class, you need to overwrite method postChanges as follows:
    * DO NOT post the changes to the database
    public void postChanges() throws Exception
    // do not post here
    // posting will happen when the commitChanges
    // method on the handler is invoked
    Steven Davelaar,
    Jheadstart Team.

  • Oracle9iAS State Management

    Does anyone have any information regarding how the 9iAS tackles the issue of state managment?

    Does anyone have any information regarding how the 9iAS tackles the issue of state managment?

  • Use State Management for Savepoints

    Hello
    i read a topic in the oracle adf 11.1.2 developer guid about Use State Management for Savepoints the Topic index is 43.9.1 How to Use State Management for Savepoints
    have any one try a sample based on it plz
    regads mohammad j.b.yaseen

    Hi,
    have a look at page 6 of http://www.oracle.com/technetwork/developer-tools/adf/learnmore/007-cancelform-savepoint-169126.pdf
    "Explicit ADFm Savepoints in ADF Task Flow"
    Frank

  • Cookie + State Management

    Hi Friends,
    Could you someone point me to RFC's or other useful information for state management using cookies.
    I DO NOT want to know how I can use cookies for state management, but I want to know how it is done behind the screen....
    For e.g
    Difference between persistent cookies and memory retained cookies.
    How cookie data is communicated between browser and server.
    How closing a browser during a session affect the cookie create etc etc...
    Hopefully I described clearly what I am looking for....
    Appreciate you guys time.
    Kumar.

    Difference between persistent cookies and
    memory retained cookies. If a cookie does not have it's expires attribute set, it expires when the user closes their browser. Otherwise, the cookie expires when the specified date and time is reached.
    How cookie data is communicated between browser and server.Through "http requests" and "http responses". A browser sends an http request to a server to request a page. The http request automatically includes all cookies that the server previously set. A server can set a cookie by adding a cookie in the "http response" that is sent back to the browser in response to the browser's request.
    How closing a browser during a session affect the cookieA session cookie expires and it is destroyed. A cookie with an expires attribute that has been set persists until its expiration date.
    Could you someone point me to RFC's
    or other useful information for state management
    using cookies.www.google.com. Type in 'cookies' and pick any of the thousands of hits and start reading. Then maybe try "java sessions" or "java cookies". And even "http request response".
    You might also consider the book Head First Servlets & JSP.

  • State Management for SubTabs

    Hi,
    I need to enable state management for the tabbed regions. I need to limit the scope of the VO till the user is navigating in that sub tab. If an event is raised outside this tab with any pending changes in the selected tab, i need to raise a warning. I went through the dev guide and it seems i can handle this at page level. Any pointers how i can do the same setup at aub tab level.
    Also,
    when i navigate between the tabs, the changes which i do not commit are retained. Can you please guide me if there is a way to override this default functionality.
    Thanks,
    Ankit

    Ankit,
    Thanks for the input. Actually i had the same understanding on the subject after reading the text on the save data changes in the dev guide. I did try setting the "Warn about Changes" option = True at page level. In fact i set this option =True where ever i could find :). But when i leave the tab and go to the next tab it still doesn't display any warning.
    I assume this to be true :)Just to mention that i have one AM and one CO for the entire page. So i guess the warning is not displayed as i remain in the same page and navigate in the sub components of the page only. Is there any easy way of enabling this . My code however is giving the required functionality. But you are right to say that if framework offers the same feature we should definitely use that instead of coding.
    Take an example... if you redirect to same page retaining the AM, the save data change property logic would work, so even in subtablayout, when u click another region... what happens, process request is called again, so this logic should work.If it doesn't then could be a possible bug in framework. In what mode r u running subtablayout tabs?--Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to set  state-manager ? need to help!

    In my App I use Myfaces1.2.6 + RichFaces3.3.0, the <state-manager> setting in faces-config.xml which is right?
    NO.1:
    <state-manager>org.apache.myfaces.application.jsp.JspStateManagerImpl</state-manager>NO.2:
    <state-manager>org.ajax4jsf.application.AjaxStateManager</state-manager>And what is different between NO.1 and NO.2 , and do not set anything in <state-manager>?
    Edited by: ben_gan on Mar 12, 2009 3:18 AM

    1 will use MyFaces' state manager.
    2 will use Ajax4jsf's state manager.
    No setting will likely pick up the default setting, which is most probably the MyFaces state manager.

  • JAR Files with KM State Management API

    Hi all,
    Can you please tell me where can i find the JARs that have KM State Management API classes, such as IState or IStatemanagementManager? I have run JarClassFinder on my NWDS directory and they haven't been found, neither i have access to look for them in PCD on server. Does anyone know the name of these JAR Files?
    Thanks in advance
    Thiago

    Hi!
    Please correct me if I'm wrong, but it is
    km.shared.repository.service.statemanagement_api.jar
    However I am on EP6 SP2 with Eclipse 2.1.3 so I don't know if it is different from NWDS to find it. Try a search in the usr directory .

  • BUG?  Application Module State Management

    I have 2 read-only view objects VO1 & VO2 with a View Link that links them by a primary key field. VO1 (master) is on the first .jspx page and VO2 (detail) is on the 2nd .jspx page. VO1 has a SQL query, but is populated programmatically in an App Module Service method that sets the where clause parameters. VO2 is on a separate .jspx page. VO2 has one bind variable in its SQL query that is populated when the user clicks a commandLink on a row within VO1 - this takes the user to the 2nd .jspx page to view VO2 table results.
    The issue is that when the user navigates back to the first .jspx page containing VO1, a duplicate row is added to the end the data table (or as the first record on the second page of results if there are multiple pages.) If I re-query VO1, re-sort the data using the column headings, or passivate the data (see below), the duplicate row goes away. Note I have tried using the same iterator on both pages and this same issue occurs.
    Ok - after 5 days of troubleshooting, here is the potential bug. If Application Pooling is enabled on the Application Module, I experience the issue above. If I don't enale Application Pooling, and Passivate state for the App Module, this issue does not occur (see below):
    Application Module Settings - Error Occurs if Pooling is enabled
    (unchecked) Failover Transaction State Upon Managed Release
    (unchecked) Disconnect Application Module Upon Release
    (checked) Support Dynamic JDBC Credentials
    (checked) Reset Non-Transcational State Upon Unmanaged Release
    (checked) Enable Application Module Pooing
    If I un-check Enable Application Module Pooling the error does NOT occur. Note I've experimented with many combinations, and its only the Application Module Pooling that affects the behavior.
    Note both view objects are set to Passivate state (but not for transient values, though tested passivating those as well and there was no difference.)
    Can someone please advise? This is a showstopper for implementing our application to production. See the threads below for more information. Finally note that I have not yet been able to replicate this in a simple test case, but there is some specific characteristics about my current application causing this behavior (and it appears others have experienced as well.)
    Duplicate rows displayed in list
    Need help  - Duplicate Rows being added to View Object?
    Thanks.
    Here is the code on the AM service method to populate the rows for VO1 (no insert or create rows - only executing the query):
    ViewObject vo1 = findViewObject("VO1");
    vo1.setMaxFetchSize(250); // set max fetch size 250
    vo1.setWhereClauseParam(0, x0);
    vo1.setWhereClauseParam(1, x1);
    vo1.setWhereClauseParam(2, x2);
    vo1.setWhereClauseParam(3, x3);
    vo1.setWhereClauseParam(4, x4);
    vo1.setWhereClauseParam(5, x5);
    vo1.setWhereClauseParam(6, x6);
    vo1.setWhereClauseParam(7, x7);
    vo1.setWhereClauseParam(8, x8);
    vo1.setWhereClauseParam(9, x9);
    vo1.setWhereClauseParam(10, x10);
    vo1.executeQuery();
    Message was edited by:
    javaX

    More information on this issue:
    After further testing, I discovered that the 'Disconnect Application Module Upon Release' also plays a factor with this issue.
    If 'Enable Application Module Pooling' is unchecked the issue does not occur because the view object is passivated.
    If 'Enable Application Module Pooling' is checked (jbo.ampool.doampooling=true), then the issue occurs UNLESS I also set 'Disconnect Application Module Upon Release' (jbo.doconnnectionpooling=true). If I set the latter to true, then I do not experience the duplicate row issue. I would rather not have to enable jbo.doconnectionpooling=true because of the performance impacts as recommended in the dev guide. Any Suggestions?
    -- updated on 10/1/06 ----
    Setting jbo.doconnectionpooling=true only fixes this issue when I use a ViewLink as the mechanism to pass the row Id from VO1 (master on .jspx page #1) to VO2 (detail on page #2.) If I use an actionListener to pass the value from page #1 to page #2, setting jbo.doconnectionpooling=true does not fix the issue.
    <af:commandLink actionListener="#{bindings.setCurrentRowWithKey.execute}"
    action="page2" text="#{row.Name}">
    <af:setActionListener from="#{row.Id}" to="#{backing_bean_page2.rowid}"/>
    </af:commandLink>
    Message was edited by:
    javaX

  • State management and session management

    Hi
    Can anyone tell me a good way to maintain state without using EJB?
    and is there a way to manage sessions without cookies and URL rewriting.
    Thanks

    Can anyone tell me a good way to maintain state
    without using EJB?Of course. Depends on what sort of state you are looking to maintain... if you are looking for alternatives to stateless session beans, you can simply use the servlet session i.e., via HttpSession.set/getAttribute().
    and is there a way to manage sessions without cookies
    and URL rewriting.Not really, cookies and URL rewriting are the only reasonable solutions. I suppose one could design an alternative approach. The bottom line is http is a stateless protocol -- to maintain state across requests a session id must be associated with the client.

  • Bank Statement management in SAP B1 on a VMWare Windows 2008 server

    Hi everybody,
    One of our customer is using a VMWare Windows 2008 server with SAP B1.
    Actual version of Business One is SBO 2007A PL 00 PL 15 (SQL Server 2005).
    Since the installation of this server using VMWare, we encouter problems using the SAP B1 Integration Platform for the process of the bank statements.
    Everything including bank statements transfer was working very fine on a "real" server before new implementation.
    When trying to open the Integration Platform Control Center on the server, we now receive the following message regarding JAVA.
    "JAVA Virtual Machine Launcher : could not find the main class : program will exit."
    JAVA is well installed on the VMWare server.
    We have searched for a solution on the Web and it seems that JAVA and VMWare are not compatible. Does anybody have any information about that ?
    Does anybody already have this problem with Integration Platfom on VMWare server ?
    Is there a solution to our problem ?
    Thanks for all your contributions.
    Best regards.
    Michel

    Hi Michel,
    First of all, your PL is too low.  AFAIK, the first supported PL for 2007A SP00 is PL30.  You may upgrade your PL first to see if that is a bug or not.
    Thanks,
    Gordon

  • Trying to Understand Login and State Management

    Hi,
    I'm relatively new to Flex 3.  I'm using the builder.
    Here's my core problem.  I'm coming from a ColdFusion background, where users run to the server for any type of authentication and sessions rule until they're timed out.
    My goal is to understand how ColdFusion (with a SQL Server backend) and Flex work together to help a user login and helps that same user maintain it's state.
    I understand so far that Flex can use a RemoteObject to go back and use ColdFusion services to authenticate a user.  I'd like to go this route.
    My problem is understanding how does Flex maintains information about the particular logged in user.  Am I correct in thinking that once I return information from ColdFusion about the user, I create a global object in Flex that keeps the user's information that I can refer to as I transition between the View States (states) in my Flex application?  And I can just refer to that local user object if I need to make sure I'm still dealing with the same user? 
    Is it really that simple?  Also, I've had been trying to review COUNTLESS articles on the Login/Authentication process.  One that I came across suggested placing a UUID on the server for a particular logged in user, and then I just return that back to Flex.  Does anyone recommend that?  I know that when I used sessions in ColdFusion, the server did this, so I'm not sure which routes to take. 
    By the way, I'm designing an Intranet that's only accessible from our internal network, but I want my colleagues to be able to login securely.  And like I said before, I'm using  ColdFusion (and CF services), SQL Server, and Flex 3. 
    I'm teaching myself Flex through the Video Training - Flex 3, but haven't seen much on this yet.  If someone could provide a good outline of the Best Practices to Login, Authenticate, and Maintain Session State throughout a Flex Application (using a ColdFusion and SQL Server backend), I'd be highly appreciative. 
    Thanks!
    mfho

    Hi,
    Thanks for responding.
    Here's one solution I found located on http://www.blogna.org/blog/adobe-flash/flex-and-flash-rias-authentication-sessions-scalabi lity/#comment-843
    A user submits their username and password inside a Flex form.
    ColdFusion Server receives the username and password and verifies them against the users in a database.
    If the user is valid, A KEY IS CREATED, stored in the database with a time stamp, then sent back to the user.
    The key is stored in a local variable inside the Flex application.
    Now, any time the application needs to retrieve data from a service that requires the user to be logged in, it will pass the key with the request. So, instead of a method like getUserInfo(), now it will look like getUserInfo(key).
    The service will use the key to determine if the user is authenticated, and if they are, it will send back the appropriate data.
    Here are my questions:
    1.  Do I have to have a key sent back to Flex?  Can't I just pull all of the data for that particular user at the time and send it back to Flex?
    I guess I'm not understanding first why I need a key or session id from ColdFusion, but if I do, I guess I could create it using the CreateUUID() in ColdFusion, send it back to Flex, store it in a local var and then reference that each time I needed to do something that's user sensitive.
    Would that work?
    I guess I'd prefer not to use a session ID if I don't have to.
    Thanks!
    mfho1

  • JSF Spec - State management

    Any reason why the spec chose to use the visitor pattern with saving state versus leveraging serialization/externalizable?

    Serialization imposes a lot of things we didn't want to require:
    - The structure has to remain stable across releases
    - You must save the entire object's state (which we do today, but with improvements in the JSP spec, may not need to).
    - There's no real guarantees about when serialization will be called or what state your object might be in or what you'll have access to; StateHolder offers just that, as you'll have access to a FacesContext and know when you'll be called.

Maybe you are looking for

  • Reinstall adobe acrobat 8.0 standard

    Dear Adobe, I need to reinstall Adobe acrobat 8.0 standard after formatting. Unofrtunately I have not a backup. I have the serials but not the original install files. Is there anyway to download somewhere the files? Many thanks

  • Setting Isolate Report/Page sections and Isolate Group sections using SDK

    Hi all, Has anyone exported the report to CSV format, by setting Isolate Report/Page sections and Isolate Group sections programmatically. If so, to which object should i set, and what are the methods to do this ? The CSV exported report contains lot

  • Unique constraint error but key when inserting unique keys!

    Hi, I am tring to update an existing database with some older data, I am getting an error which complains about a unique constraint being violated although there is no voilation evident after testing. I am puzzled by this and was wondering if someone

  • EA2:Error on Export to Reporting Schema

    While i was trying to export the created desing to the reporting schema, found the below error in the log. 2010-11-29 16:01:26,741 [Thread-56] ERROR ReportsHandler - Error Exporting to Reporting Schema: java.sql.SQLException: ORA-12704: character set

  • G/L account change for existing VAX trans event key(601 movement type)

    Hi experts, My client wants to post the sales(VAX transaction event key for movement type 601) of a material into new G/L account than the existing one. They dont want to create a new Material type & Valuation class for the same. I suggested to creat