Dashboard > Magnolia Development > ... > Concept Backup > PersistenceManager based Backup
PersistenceManager based Backup Log In View a printable version of the current page.

Added by Jan Haderka , last edited by Philipp Bracher on May 14, 2008  (view change)
Labels: 
(None)

Rationale

PersistenceManager is the lowest layer of API between Java and backing database. This approach offers possibility of fast backup/restore since it skips all consistency and boundary checks. It is also severely limiting amount of memory used for backup/restore.
The disadvantage of the approach is the fact that current API was not designed with this possibility in mind and is not as easily accessible as necessary for smooth implementation.

Outline

Try to develop functionality to perform backup/restore using ItemState}}s and {{PersistenceManager.load() and PersistenceManager.store() operations.

Obstacles

o This approach tries to tap on low level JR API and biggest problem is thus obtaining references to the current PM instance to execute such operations.
o Other problems are related - dealing with internal structures of JR, version dependency since accessed code is not part of public API

Code snippets

Access PM at runtime:

Method[] ms = getRepo().getClass().getDeclaredMethods();
            Method m = null;
            for (Method x : ms) {
                if (x.getName().equals("getWorkspaceInfo")) {
                    m = x;
                    break;
                }
            }
            m.setAccessible(true);
            Object workspaceInfo = m.invoke(s2.getRepository(), "default");
            ms = workspaceInfo.getClass().getDeclaredMethods();
            m = null;
            for (Method x : ms) {
                if (x.getName().equals("getPersistenceManager")) {
                    m = x;
                    break;
                }
            }
            m.setAccessible(true);
            PersistenceManager pm = (PersistenceManager) m.invoke(workspaceInfo, null);
  • How likely is the lower level PM API to change?
  • Since no consistency checks are performed, how will we be sure what we backup is no broken? Or is its cold backup only?
Powered by a free Atlassian Confluence Open Source Project License granted to Magnolia International. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators