[jboss-cvs] jboss-portal/core/src/main/org/jboss/portal/core/impl/model/portal ...
Julien Viet
julien at jboss.com
Tue Jul 11 16:50:27 EDT 2006
User: julien
Date: 06/07/11 16:50:27
Modified: core/src/main/org/jboss/portal/core/impl/model/portal
PersistentPortalObjectContainer.java
TransientPortalObjectContainer.java
Log:
- make cms cache work
- improve portal object deployment in ha mode
Revision Changes Path
1.39 +36 -64 jboss-portal/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PersistentPortalObjectContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- PersistentPortalObjectContainer.java 24 Jun 2006 04:22:29 -0000 1.38
+++ PersistentPortalObjectContainer.java 11 Jul 2006 20:50:27 -0000 1.39
@@ -57,7 +57,7 @@
/**
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.38 $
+ * @version $Revision: 1.39 $
*/
public class PersistentPortalObjectContainer extends AbstractPortalObjectContainer
implements AuthorizationDomain, DomainConfigurator, PermissionRepository, PermissionFactory
@@ -85,9 +85,6 @@
protected JBossAuthorizationDomainRegistry authorizationDomainRegistry;
/** . */
- protected boolean createRootOnStartup;
-
- /** . */
protected String sessionFactoryJNDIName;
/** . */
@@ -148,16 +145,6 @@
this.portalAuthorizationManagerFactory = pamf;
}
- public boolean isCreateRootOnStartup()
- {
- return createRootOnStartup;
- }
-
- public void setCreateRootOnStartup(boolean createRootOnStartup)
- {
- this.createRootOnStartup = createRootOnStartup;
- }
-
public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
{
this.sessionFactoryJNDIName = sessionFactoryJNDIName;
@@ -181,13 +168,7 @@
authorizationDomainRegistry.addDomain(this);
}
- // Create the root context if it does not exist
- if (createRootOnStartup)
- {
- createContextIfNotExist();
- }
-
- // Now register against the deployment and deploys the default portal-object.xml
+ //
super.startService();
}
@@ -213,6 +194,18 @@
return this;
}
+ public void createContext()
+ {
+ try
+ {
+ createContextIfNotExist();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
public PortalObject getObject(String id)
{
Session session = sessionFactory.getCurrentSession();
@@ -229,8 +222,7 @@
public Context getContext()
{
- Session session = sessionFactory.getCurrentSession();
- return (Context)lookup(session, "").getObject();
+ return (Context)getObject("");
}
public JBossPortalNode getNode(String id)
@@ -246,17 +238,13 @@
}
}
+ /**
+ * todo : use AOP for tx demarcation.
+ */
public void createContextIfNotExist() throws Exception
{
- Session session = null;
- Transaction tx = null;
- try
- {
- session = sessionFactory.openSession();
- tx = session.beginTransaction();
-
- //
log.debug("Detecting the existence of the portal object root context");
+ Session session = sessionFactory.getCurrentSession();
// Create root context if it does not exist
ObjectNode root = lookup(session, "");
@@ -281,22 +269,6 @@
log.debug("Portal object root context has been found");
}
}
- catch (HibernateException e)
- {
- log.error("Cannot check root context existence", e);
- }
- finally
- {
- if (tx != null)
- {
- tx.commit();
- }
- if (session != null && session.isOpen())
- {
- Tools.safeClose(session);
- }
- }
- }
//*******************************************************************
// AuthorizationDomain interface methods
1.10 +2 -5 jboss-portal/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TransientPortalObjectContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- TransientPortalObjectContainer.java 19 Mar 2006 13:17:56 -0000 1.9
+++ TransientPortalObjectContainer.java 11 Jul 2006 20:50:27 -0000 1.10
@@ -32,7 +32,7 @@
/**
*
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class TransientPortalObjectContainer extends AbstractPortalObjectContainer
{
@@ -66,11 +66,8 @@
};
}
- public void startService() throws Exception
+ public void createContext()
{
- super.startService();
-
- //
root = new ObjectNode(ctx, "", "");
ContextImpl ctx = new ContextImpl();
root.setObject(ctx);
More information about the jboss-cvs-commits
mailing list