Index: main/plugin-web/src/org/ametys/web/cache/monitoring/ui/PageElementCacheStatsGenerator.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/ui/PageElementCacheStatsGenerator.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/ui/PageElementCacheStatsGenerator.java (working copy) @@ -185,8 +185,8 @@ sb.append(" SELECT p.Page_Id, p.Rendering_Context, p.Workspace_JCR, p.Cacheable AS \"P_Cacheable\", p.Hits AS \"P_Hits\","); sb.append(" pe.Page_Element_Id, pe.Cacheable AS \"PE_Cacheable\", pe.Hits AS \"PE_Hits\", pe.Cache_Hits AS \"PE_Cache_Hits\""); - sb.append(" FROM ").append(Constants.__SQL_TABLE_NAME_PAGE_STATISTICS).append(" p"); - sb.append(" INNER JOIN ").append(Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS).append(" pe"); + sb.append(" FROM ").append(Constants.SQL_TABLE_NAME_PAGE_STATISTICS).append(" p"); + sb.append(" INNER JOIN ").append(Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS).append(" pe"); sb.append(" ON p.Page_Id = pe.Page_Id AND p.Rendering_Context = pe.Rendering_Context AND p.Workspace_JCR = pe.Workspace_JCR"); return sb.toString(); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/ui/ServersCacheStatsGenerator.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/ui/ServersCacheStatsGenerator.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/ui/ServersCacheStatsGenerator.java (working copy) @@ -220,8 +220,8 @@ sb.append(" SELECT F.Server_Site, F.Server_Path, F.Server_Hits, F.Server_Cache_Hits,"); sb.append(" F.Front_Site, F.Front_Path, F.Front_Cacheable, F.Front_Hits, F.Front_Cache_Hits_1, F.Front_Cache_Hits_2,"); sb.append(" B.Page_Id, B.Page_Path, B.Cacheable, B.Hits"); - sb.append(" FROM ").append(Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS).append(" F"); - sb.append(" LEFT OUTER JOIN ").append(Constants.__SQL_TABLE_NAME_PAGE_STATISTICS).append(" B"); + sb.append(" FROM ").append(Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS).append(" F"); + sb.append(" LEFT OUTER JOIN ").append(Constants.SQL_TABLE_NAME_PAGE_STATISTICS).append(" B"); sb.append(" ON F.Front_Path_Hash = B.Page_Path_Hash AND B.Rendering_Context = 'front'"); sb.append(" WHERE (F.Server_Site = ? OR F.Server_Site = '-' OR F.Front_Site = ? OR F.Front_Site = '-')"); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontFromHTTPServerResourceStatistics.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontFromHTTPServerResourceStatistics.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontFromHTTPServerResourceStatistics.java (working copy) @@ -79,7 +79,7 @@ @Override public PreparedStatement getFindStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " WHERE Server_Site = ? AND Server_Path_Hash = ?"); + PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " WHERE Server_Site = ? AND Server_Path_Hash = ?"); stmt.setString(1, _httpserverSite); stmt.setString(2, _httpserverPathHash); @@ -90,7 +90,7 @@ @Override public PreparedStatement getInsertStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " (Server_Site, Server_Path_Hash, Server_Path, Server_Hits, Server_Cache_Hits, Front_Site, Front_Path_Hash, Front_Path, Front_Cacheable, Front_Hits, Front_Cache_Hits_1, Front_Cache_Hits_2, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " (Server_Site, Server_Path_Hash, Server_Path, Server_Hits, Server_Cache_Hits, Front_Site, Front_Path_Hash, Front_Path, Front_Cacheable, Front_Hits, Front_Cache_Hits_1, Front_Cache_Hits_2, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, _httpserverSite); stmt.setString(2, _httpserverPathHash); @@ -116,7 +116,7 @@ @Override public PreparedStatement getUpdateStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " SET Server_Hits = Server_Hits + ?, Server_Cache_Hits = Server_Cache_Hits + ?, Front_Site = ?, Front_Path_Hash = ?, Front_Path = ?, Front_Cacheable = ?, Front_Hits = Front_Hits + ?, Front_Cache_Hits_1 = Front_Cache_Hits_1 + ?, Front_Cache_Hits_2 = Front_Cache_Hits_2 + ?, Updated_At = ? WHERE Server_Site = ? AND Server_Path_Hash = ?"); + PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " SET Server_Hits = Server_Hits + ?, Server_Cache_Hits = Server_Cache_Hits + ?, Front_Site = ?, Front_Path_Hash = ?, Front_Path = ?, Front_Cacheable = ?, Front_Hits = Front_Hits + ?, Front_Cache_Hits_1 = Front_Cache_Hits_1 + ?, Front_Cache_Hits_2 = Front_Cache_Hits_2 + ?, Updated_At = ? WHERE Server_Site = ? AND Server_Path_Hash = ?"); stmt.setInt(1, _newHits); stmt.setInt(2, _getServerCacheHits()); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/HTTPServerOnlyResourceStatistics.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/HTTPServerOnlyResourceStatistics.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/HTTPServerOnlyResourceStatistics.java (working copy) @@ -56,7 +56,7 @@ @Override public PreparedStatement getFindStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " WHERE Server_Site = ? AND Server_Path_Hash = ?"); + PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " WHERE Server_Site = ? AND Server_Path_Hash = ?"); stmt.setString(1, _site); stmt.setString(2, _hashPath); @@ -67,7 +67,7 @@ @Override public PreparedStatement getInsertStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " (Server_Site, Server_Path_Hash, Server_Path, Server_Hits, Server_Cache_Hits, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?)"); + PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " (Server_Site, Server_Path_Hash, Server_Path, Server_Hits, Server_Cache_Hits, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, _site); stmt.setString(2, _hashPath); @@ -85,7 +85,7 @@ @Override public PreparedStatement getUpdateStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " SET Server_Hits = Server_Hits + ?, Server_Cache_Hits = Server_Cache_Hits + ?, Updated_At = ? WHERE Server_Site = ? AND Server_Path_Hash = ?"); + PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " SET Server_Hits = Server_Hits + ?, Server_Cache_Hits = Server_Cache_Hits + ?, Updated_At = ? WHERE Server_Site = ? AND Server_Path_Hash = ?"); stmt.setInt(1, _newHits); stmt.setInt(2, _getCacheHits()); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/HTTPServerOnlyResourceStatisticsFactory.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/HTTPServerOnlyResourceStatisticsFactory.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/HTTPServerOnlyResourceStatisticsFactory.java (working copy) @@ -74,7 +74,7 @@ connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); // First query. - stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Site, Path_Hash, Cache_Hit FROM " + Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS + " WHERE PROCESSED = 0 AND Cache_Hit = 1 AND (Ori_Status_Code = '200' OR Ori_Status_Code = '304') GROUP BY Site, Path_Hash, Cache_Hit"); + stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Site, Path_Hash, Cache_Hit FROM " + Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS + " WHERE PROCESSED = 0 AND Cache_Hit = 1 AND (Ori_Status_Code = '200' OR Ori_Status_Code = '304') GROUP BY Site, Path_Hash, Cache_Hit"); resultSet = stmt.executeQuery(); while (resultSet.next()) @@ -93,7 +93,7 @@ ConnectionHelper.cleanup(resultSet); ConnectionHelper.cleanup(stmt); - stmt = connection.prepareStatement("SELECT Path, Path_Hash FROM " + Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS + " WHERE PROCESSED = 0 AND Cache_Hit = 1 AND (Ori_Status_Code = '200' OR Ori_Status_Code = '304') ORDER BY Created_At DESC"); + stmt = connection.prepareStatement("SELECT Path, Path_Hash FROM " + Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS + " WHERE PROCESSED = 0 AND Cache_Hit = 1 AND (Ori_Status_Code = '200' OR Ori_Status_Code = '304') ORDER BY Created_At DESC"); resultSet = stmt.executeQuery(); Map pathMap = new HashMap(); @@ -140,7 +140,7 @@ { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); stmt = connection.createStatement(); - return stmt.executeUpdate("UPDATE " + Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS + " SET Processed = 1 WHERE Processed = 0 AND Cache_Hit = 1 AND (Ori_Status_Code = '200' OR Ori_Status_Code = '304')"); + return stmt.executeUpdate("UPDATE " + Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS + " SET Processed = 1 WHERE Processed = 0 AND Cache_Hit = 1 AND (Ori_Status_Code = '200' OR Ori_Status_Code = '304')"); } finally { @@ -157,7 +157,7 @@ try { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); - stmt = connection.prepareStatement("DELETE FROM " + Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); + stmt = connection.prepareStatement("DELETE FROM " + Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); Timestamp purgeThreshold = new Timestamp(System.currentTimeMillis() - 24 * 60 * 60 * 1000); stmt.setTimestamp(1, purgeThreshold); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageElementResourceStatisticsFactory.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageElementResourceStatisticsFactory.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageElementResourceStatisticsFactory.java (working copy) @@ -64,7 +64,7 @@ try { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); - stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Page_Element_Id, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Cache_Hit FROM " + Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " WHERE PROCESSED = 0 GROUP BY Page_Element_Id, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Cache_Hit"); + stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Page_Element_Id, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Cache_Hit FROM " + Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " WHERE PROCESSED = 0 GROUP BY Page_Element_Id, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Cache_Hit"); resultSet = stmt.executeQuery(); while (resultSet.next()) @@ -99,7 +99,7 @@ { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); stmt = connection.createStatement(); - return stmt.executeUpdate("UPDATE " + Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " SET PROCESSED = 1 WHERE Processed = 0"); + return stmt.executeUpdate("UPDATE " + Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " SET PROCESSED = 1 WHERE Processed = 0"); } finally { @@ -116,7 +116,7 @@ try { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); - stmt = connection.prepareStatement("DELETE FROM " + Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); + stmt = connection.prepareStatement("DELETE FROM " + Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); Timestamp purgeThreshold = new Timestamp(System.currentTimeMillis() - 24 * 60 * 60 * 1000); stmt.setTimestamp(1, purgeThreshold); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageElementResourceStatistics.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageElementResourceStatistics.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageElementResourceStatistics.java (working copy) @@ -64,7 +64,7 @@ @Override public PreparedStatement getFindStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS + " WHERE Page_Element_Id = ? AND Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); + PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS + " WHERE Page_Element_Id = ? AND Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); stmt.setString(1, _pageElementId); stmt.setString(2, _pageId); @@ -77,7 +77,7 @@ @Override public PreparedStatement getInsertStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS + " (Page_Element_Id, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Hits, Cache_Hits, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS + " (Page_Element_Id, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Hits, Cache_Hits, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, _pageElementId); stmt.setString(2, _pageId); @@ -97,7 +97,7 @@ @Override public PreparedStatement getUpdateStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS + " SET Cacheable = ?, Hits = Hits + ?, Cache_Hits = Cache_Hits + ?, Updated_At = ? WHERE Page_Element_Id = ? AND Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); + PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS + " SET Cacheable = ?, Hits = Hits + ?, Cache_Hits = Cache_Hits + ?, Updated_At = ? WHERE Page_Element_Id = ? AND Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); stmt.setInt(1, BooleanUtils.toInteger(_cacheable)); stmt.setInt(2, _newHits); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageResourceStatisticsFactory.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageResourceStatisticsFactory.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageResourceStatisticsFactory.java (working copy) @@ -74,7 +74,7 @@ connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); // First query. - stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Page_Id, Rendering_Context, Workspace_JCR, Cacheable FROM " + Constants.__SQL_TABLE_NAME_PAGE_ACCESS + " WHERE PROCESSED = 0 GROUP BY Page_Id, Rendering_Context, Workspace_JCR, Cacheable"); + stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Page_Id, Rendering_Context, Workspace_JCR, Cacheable FROM " + Constants.SQL_TABLE_NAME_PAGE_ACCESS + " WHERE PROCESSED = 0 GROUP BY Page_Id, Rendering_Context, Workspace_JCR, Cacheable"); resultSet = stmt.executeQuery(); while (resultSet.next()) @@ -94,7 +94,7 @@ ConnectionHelper.cleanup(resultSet); ConnectionHelper.cleanup(stmt); - stmt = connection.prepareStatement("SELECT Page_Path, Page_Path_Hash, Page_Id FROM " + Constants.__SQL_TABLE_NAME_PAGE_ACCESS + " WHERE PROCESSED = 0 ORDER BY Created_At DESC"); + stmt = connection.prepareStatement("SELECT Page_Path, Page_Path_Hash, Page_Id FROM " + Constants.SQL_TABLE_NAME_PAGE_ACCESS + " WHERE PROCESSED = 0 ORDER BY Created_At DESC"); resultSet = stmt.executeQuery(); Map pathMap = new HashMap(); @@ -146,7 +146,7 @@ { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); stmt = connection.createStatement(); - return stmt.executeUpdate("UPDATE " + Constants.__SQL_TABLE_NAME_PAGE_ACCESS + " SET PROCESSED = 1 WHERE Processed = 0"); + return stmt.executeUpdate("UPDATE " + Constants.SQL_TABLE_NAME_PAGE_ACCESS + " SET PROCESSED = 1 WHERE Processed = 0"); } finally { @@ -163,7 +163,7 @@ try { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); - stmt = connection.prepareStatement("DELETE FROM " + Constants.__SQL_TABLE_NAME_PAGE_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); + stmt = connection.prepareStatement("DELETE FROM " + Constants.SQL_TABLE_NAME_PAGE_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); Timestamp purgeThreshold = new Timestamp(System.currentTimeMillis() - 24 * 60 * 60 * 1000); stmt.setTimestamp(1, purgeThreshold); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontFromHTTPServerResourceStatisticsFactory.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontFromHTTPServerResourceStatisticsFactory.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontFromHTTPServerResourceStatisticsFactory.java (working copy) @@ -79,8 +79,8 @@ // First query. stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", S.Site AS \"S_Site\", S.Path_Hash AS \"S_Path_Hash\", S.Cache_Hit AS \"S_Cache_Hit\"," + " F.Site AS \"F_Site\", F.Ametys_Path_Hash AS \"F_Ametys_Path_Hash\", F.Cacheable AS \"F_Cacheable\", F.Cache_Hit_1 AS \"F_Cache_Hit_1\", F.Cache_Hit_2 AS \"F_Cache_Hit_2\"" - + " FROM " + Constants.__SQL_TABLE_NAME_FRONT_ACCESS + " F" - + " INNER JOIN " + Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS + " S ON F.Unique_Id = S.Unique_Id AND F.Processed = 0 AND (S.Ori_Status_Code = '200' OR S.Ori_Status_Code = '304')" + + " FROM " + Constants.SQL_TABLE_NAME_FRONT_ACCESS + " F" + + " INNER JOIN " + Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS + " S ON F.Unique_Id = S.Unique_Id AND F.Processed = 0 AND (S.Ori_Status_Code = '200' OR S.Ori_Status_Code = '304')" + " GROUP BY S.Site, S.Path_Hash, S.Cache_Hit, F.Site, F.Ametys_Path_Hash, F.Cacheable, F.Cache_Hit_1, F.Cache_Hit_2"); resultSet = stmt.executeQuery(); @@ -106,8 +106,8 @@ ConnectionHelper.cleanup(stmt); stmt = connection.prepareStatement("SELECT S.Path AS \"S_Path\", S.Path_Hash AS \"S_Path_Hash\", F.Ametys_Path AS \"F_Ametys_Path\", F.Ametys_Path_Hash AS \"F_Ametys_Path_Hash\"" - + " FROM " + Constants.__SQL_TABLE_NAME_FRONT_ACCESS + " F" - + " INNER JOIN " + Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS + " S ON F.Unique_Id = S.Unique_Id AND F.Processed = 0 AND (S.Ori_Status_Code = '200' OR S.Ori_Status_Code = '304')" + + " FROM " + Constants.SQL_TABLE_NAME_FRONT_ACCESS + " F" + + " INNER JOIN " + Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS + " S ON F.Unique_Id = S.Unique_Id AND F.Processed = 0 AND (S.Ori_Status_Code = '200' OR S.Ori_Status_Code = '304')" + " ORDER BY S.Request_Date DESC"); resultSet = stmt.executeQuery(); @@ -173,21 +173,21 @@ connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); StringBuilder sql = new StringBuilder(); - sql.append("UPDATE ").append(Constants.__SQL_TABLE_NAME_FRONT_ACCESS).append(" "); + sql.append("UPDATE ").append(Constants.SQL_TABLE_NAME_FRONT_ACCESS).append(" "); sql.append("SET Processed = 1 "); sql.append("WHERE Processed = 0 "); sql.append("AND Unique_Id IN "); - sql.append(" (SELECT Unique_Id FROM ").append(Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS).append(" WHERE (Ori_Status_Code = '200' OR Ori_Status_Code = '304'))"); + sql.append(" (SELECT Unique_Id FROM ").append(Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS).append(" WHERE (Ori_Status_Code = '200' OR Ori_Status_Code = '304'))"); stmt = connection.createStatement(); int processed = stmt.executeUpdate(sql.toString()); StringBuilder sql2 = new StringBuilder(); - sql2.append("UPDATE ").append(Constants.__SQL_TABLE_NAME_HTTPSERVER_ACCESS).append(" "); + sql2.append("UPDATE ").append(Constants.SQL_TABLE_NAME_HTTPSERVER_ACCESS).append(" "); sql2.append("SET Processed = 1 "); sql2.append("WHERE Processed = 0 "); sql2.append("AND (Ori_Status_Code = '200' OR Ori_Status_Code = '304') "); sql2.append("AND Unique_Id IN "); - sql2.append(" (SELECT DISTINCT Unique_Id FROM ").append(Constants.__SQL_TABLE_NAME_FRONT_ACCESS).append(")"); + sql2.append(" (SELECT DISTINCT Unique_Id FROM ").append(Constants.SQL_TABLE_NAME_FRONT_ACCESS).append(")"); stmt2 = connection.createStatement(); int processed2 = stmt2.executeUpdate(sql2.toString()); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontOnlyResourceStatistics.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontOnlyResourceStatistics.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontOnlyResourceStatistics.java (working copy) @@ -63,7 +63,7 @@ @Override public PreparedStatement getFindStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " WHERE Front_Site = ? AND Front_Path_Hash = ? AND Server_Path_Hash = '-'"); + PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " WHERE Front_Site = ? AND Front_Path_Hash = ? AND Server_Path_Hash = '-'"); stmt.setString(1, _site); stmt.setString(2, _hashPath); @@ -74,7 +74,7 @@ @Override public PreparedStatement getInsertStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " (Front_Site, Front_Path_Hash, Front_Path, Front_Cacheable, Front_Hits, Front_Cache_Hits_1, Front_Cache_Hits_2, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " (Front_Site, Front_Path_Hash, Front_Path, Front_Cacheable, Front_Hits, Front_Cache_Hits_1, Front_Cache_Hits_2, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, _site); stmt.setString(2, _hashPath); @@ -94,7 +94,7 @@ @Override public PreparedStatement getUpdateStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.__SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " SET Front_Cacheable = ?, Front_Hits = Front_Hits + ?, Front_Cache_Hits_1 = Front_Cache_Hits_1 + ?, Front_Cache_Hits_2 = Front_Cache_Hits_2 + ?, Updated_At = ? WHERE Front_Site = ? AND Front_Path_Hash = ? AND Server_Path_Hash = '-'"); + PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS + " SET Front_Cacheable = ?, Front_Hits = Front_Hits + ?, Front_Cache_Hits_1 = Front_Cache_Hits_1 + ?, Front_Cache_Hits_2 = Front_Cache_Hits_2 + ?, Updated_At = ? WHERE Front_Site = ? AND Front_Path_Hash = ? AND Server_Path_Hash = '-'"); stmt.setInt(1, BooleanUtils.toInteger(_cacheable)); stmt.setInt(2, _newHits); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontOnlyResourceStatisticsFactory.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontOnlyResourceStatisticsFactory.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/FrontOnlyResourceStatisticsFactory.java (working copy) @@ -74,7 +74,7 @@ connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); // First query. - stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Site, Ametys_Path_Hash, Cacheable, Cache_Hit_1, Cache_Hit_2 FROM " + Constants.__SQL_TABLE_NAME_FRONT_ACCESS + " WHERE PROCESSED = 0 AND Unique_Id = '-' GROUP BY Site, Ametys_Path_Hash, Cacheable, Cache_Hit_1, Cache_Hit_2"); + stmt = connection.prepareStatement("SELECT count(*) AS \"increment\", Site, Ametys_Path_Hash, Cacheable, Cache_Hit_1, Cache_Hit_2 FROM " + Constants.SQL_TABLE_NAME_FRONT_ACCESS + " WHERE PROCESSED = 0 AND Unique_Id = '-' GROUP BY Site, Ametys_Path_Hash, Cacheable, Cache_Hit_1, Cache_Hit_2"); resultSet = stmt.executeQuery(); while (resultSet.next()) @@ -95,7 +95,7 @@ ConnectionHelper.cleanup(resultSet); ConnectionHelper.cleanup(stmt); - stmt = connection.prepareStatement("SELECT Ametys_Path, Ametys_Path_Hash FROM " + Constants.__SQL_TABLE_NAME_FRONT_ACCESS + " WHERE PROCESSED = 0 AND Unique_Id = '-' ORDER BY Created_At DESC"); + stmt = connection.prepareStatement("SELECT Ametys_Path, Ametys_Path_Hash FROM " + Constants.SQL_TABLE_NAME_FRONT_ACCESS + " WHERE PROCESSED = 0 AND Unique_Id = '-' ORDER BY Created_At DESC"); resultSet = stmt.executeQuery(); Map pathMap = new HashMap(); @@ -144,7 +144,7 @@ { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); stmt = connection.createStatement(); - return stmt.executeUpdate("UPDATE " + Constants.__SQL_TABLE_NAME_FRONT_ACCESS + " SET PROCESSED = 1 WHERE Processed = 0 AND Unique_Id = '-'"); + return stmt.executeUpdate("UPDATE " + Constants.SQL_TABLE_NAME_FRONT_ACCESS + " SET PROCESSED = 1 WHERE Processed = 0 AND Unique_Id = '-'"); } finally { @@ -161,7 +161,7 @@ try { connection = ConnectionHelper.getConnection(Constants.MONITORING_DATASOURCE_POOLNAME); - stmt = connection.prepareStatement("DELETE FROM " + Constants.__SQL_TABLE_NAME_FRONT_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); + stmt = connection.prepareStatement("DELETE FROM " + Constants.SQL_TABLE_NAME_FRONT_ACCESS + " WHERE PROCESSED = 1 OR Created_At < ?"); Timestamp purgeThreshold = new Timestamp(System.currentTimeMillis() - 24 * 60 * 60 * 1000); stmt.setTimestamp(1, purgeThreshold); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageResourceStatistics.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageResourceStatistics.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/statistics/impl/PageResourceStatistics.java (working copy) @@ -64,7 +64,7 @@ @Override public PreparedStatement getFindStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.__SQL_TABLE_NAME_PAGE_STATISTICS + " WHERE Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); + PreparedStatement stmt = connection.prepareStatement("SELECT count(1) FROM " + Constants.SQL_TABLE_NAME_PAGE_STATISTICS + " WHERE Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); stmt.setString(1, _pageId); stmt.setString(2, _renderingContext); @@ -76,7 +76,7 @@ @Override public PreparedStatement getInsertStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.__SQL_TABLE_NAME_PAGE_STATISTICS + " (Page_Id, Page_Path_Hash, Page_Path, Rendering_Context, Workspace_JCR, Cacheable, Hits, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + PreparedStatement stmt = connection.prepareStatement("INSERT INTO " + Constants.SQL_TABLE_NAME_PAGE_STATISTICS + " (Page_Id, Page_Path_Hash, Page_Path, Rendering_Context, Workspace_JCR, Cacheable, Hits, Created_At, Updated_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, _pageId); stmt.setString(2, _hashPath); @@ -96,7 +96,7 @@ @Override public PreparedStatement getUpdateStatement(Connection connection) throws SQLException { - PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.__SQL_TABLE_NAME_PAGE_STATISTICS + " SET Page_Path = ?, Page_Path_Hash = ?, Cacheable = ?, Hits = Hits + ?, Updated_At = ? WHERE Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); + PreparedStatement stmt = connection.prepareStatement("UPDATE " + Constants.SQL_TABLE_NAME_PAGE_STATISTICS + " SET Page_Path = ?, Page_Path_Hash = ?, Cacheable = ?, Hits = Hits + ?, Updated_At = ? WHERE Page_Id = ? AND Rendering_Context = ? AND Workspace_JCR = ?"); stmt.setString(1, _path); stmt.setString(2, _hashPath); Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/ResourceAccessComponent.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/ResourceAccessComponent.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/ResourceAccessComponent.java (working copy) @@ -61,7 +61,7 @@ */ public void addAccessRecord(ResourceAccess ra) { - if (!_enabled) + if (!_enabled || ra == null) { return; } Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/impl/PageResourceAccess.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/impl/PageResourceAccess.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/impl/PageResourceAccess.java (working copy) @@ -64,7 +64,7 @@ @Override public PreparedStatement getInsertStatement(Connection connection) throws SQLException { - return connection.prepareStatement("INSERT INTO " + Constants.__SQL_TABLE_NAME_PAGE_ACCESS + " (Internal_Uuid, Page_Id, Page_Path_Hash, Page_Path, Rendering_Context, Workspace_JCR, Cacheable, Created_At) values (?, ?, ?, ?, ?, ?, ?, ?)"); + return connection.prepareStatement("INSERT INTO " + Constants.SQL_TABLE_NAME_PAGE_ACCESS + " (Internal_Uuid, Page_Id, Page_Path_Hash, Page_Path, Rendering_Context, Workspace_JCR, Cacheable, Created_At) values (?, ?, ?, ?, ?, ?, ?, ?)"); } @Override Index: main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/impl/PageElementResourceAccess.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/impl/PageElementResourceAccess.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/process/access/impl/PageElementResourceAccess.java (working copy) @@ -100,7 +100,7 @@ @Override public PreparedStatement getInsertStatement(Connection connection) throws SQLException { - return connection.prepareStatement("INSERT INTO " + Constants.__SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " (Internal_Uuid, Page_Element_Id, Page_Element_Type, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Cache_Hit, Created_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); + return connection.prepareStatement("INSERT INTO " + Constants.SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS + " (Internal_Uuid, Page_Element_Id, Page_Element_Type, Page_Id, Rendering_Context, Workspace_JCR, Cacheable, Cache_Hit, Created_At) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"); } @Override Index: main/plugin-web/src/org/ametys/web/cache/monitoring/Constants.java =================================================================== --- main/plugin-web/src/org/ametys/web/cache/monitoring/Constants.java (revision 21290) +++ main/plugin-web/src/org/ametys/web/cache/monitoring/Constants.java (working copy) @@ -25,18 +25,21 @@ public static final String MONITORING_DATASOURCE_POOLNAME = "cache.monitoring.datasource"; /** The name of the table for page resource access */ - public static final String __SQL_TABLE_NAME_PAGE_ACCESS = "Cache_RA_Back"; + public static final String SQL_TABLE_NAME_PAGE_ACCESS = "Cache_RA_Back"; /** The name of the table for page elements resource access */ - public static final String __SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS = "Cache_RA_Back_Page_Element"; + public static final String SQL_TABLE_NAME_PAGE_ELEMENTS_ACCESS = "Cache_RA_Back_Page_Element"; /** The name of the table for front resource access */ - public static final String __SQL_TABLE_NAME_FRONT_ACCESS = "Cache_RA_Front"; + public static final String SQL_TABLE_NAME_FRONT_ACCESS = "Cache_RA_Front"; /** The name of the table for httpserver resource access */ - public static final String __SQL_TABLE_NAME_HTTPSERVER_ACCESS = "Cache_RA_HTTPServer"; + public static final String SQL_TABLE_NAME_HTTPSERVER_ACCESS = "Cache_RA_HTTPServer"; /** The name of the table for back statictics */ - public static final String __SQL_TABLE_NAME_PAGE_STATISTICS = "Cache_Stats_Back"; + public static final String SQL_TABLE_NAME_PAGE_STATISTICS = "Cache_Stats_Back"; /** The name of the table for back statictics for page elements*/ - public static final String __SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS = "Cache_Stats_Back_Page_Element"; + public static final String SQL_TABLE_NAME_PAGE_ELEMENTS_STATISTICS = "Cache_Stats_Back_Page_Element"; /** The name of the table for front statictics */ - public static final String __SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS = "Cache_Stats_Front"; + public static final String SQL_TABLE_NAME_HTTPSERVER_AND_FRONT_STATISTICS = "Cache_Stats_Front"; + + /** The request attribute to transmit the page access object */ + public static final String REQUEST_ATTRIBUTE_PAGEACCESS = "MONITORING_PAGE_ACCESS"; } Index: main/workspace-web/src/org/ametys/web/repository/IsPageCacheableAction.java =================================================================== --- main/workspace-web/src/org/ametys/web/repository/IsPageCacheableAction.java (revision 21290) +++ main/workspace-web/src/org/ametys/web/repository/IsPageCacheableAction.java (working copy) @@ -32,6 +32,7 @@ import org.apache.cocoon.environment.SourceResolver; import org.ametys.plugins.repository.AmetysObjectIterable; +import org.ametys.web.cache.monitoring.Constants; import org.ametys.web.cache.monitoring.process.access.impl.PageResourceAccess; import org.ametys.web.inputdata.InputData; import org.ametys.web.inputdata.InputDataExtensionPoint; @@ -80,7 +81,7 @@ String uuid = request.getHeader("X-Ametys-FO-UUID"); PageResourceAccess pageAccess = new PageResourceAccess(uuid, page.getId(), "/" + page.getSiteName() + "/" + page.getSitemapName() + "/" + page.getPathInSitemap() + ".html"); pageAccess.setCacheable(isCacheable); - request.setAttribute("PAGE_ACCESS", pageAccess); + request.setAttribute(Constants.REQUEST_ATTRIBUTE_PAGEACCESS, pageAccess); return EMPTY_MAP; } Index: main/workspace-web/src/org/ametys/web/repository/PageGenerator.java =================================================================== --- main/workspace-web/src/org/ametys/web/repository/PageGenerator.java (revision 21290) +++ main/workspace-web/src/org/ametys/web/repository/PageGenerator.java (working copy) @@ -51,6 +51,7 @@ import org.ametys.runtime.authentication.AccessDeniedException; import org.ametys.runtime.authentication.AuthorizationRequiredException; import org.ametys.runtime.util.IgnoreRootHandler; +import org.ametys.web.cache.monitoring.Constants; import org.ametys.web.cache.monitoring.process.access.ResourceAccessComponent; import org.ametys.web.cache.monitoring.process.access.impl.PageElementResourceAccess; import org.ametys.web.cache.monitoring.process.access.impl.PageElementResourceAccess.PageElementType; @@ -161,10 +162,14 @@ } // Monitor the access to this page. - _pageAccess = (PageResourceAccess) request.getAttribute("PAGE_ACCESS"); - _pageAccess.setRenderingContext(renderingContext); - _pageAccess.setWorkspaceJCR(workspace); - _resourceAccessMonitor.addAccessRecord(_pageAccess); + _pageAccess = (PageResourceAccess) request.getAttribute(Constants.REQUEST_ATTRIBUTE_PAGEACCESS); + + if (_pageAccess != null) + { + _pageAccess.setRenderingContext(renderingContext); + _pageAccess.setWorkspaceJCR(workspace); + _resourceAccessMonitor.addAccessRecord(_pageAccess); + } contentHandler.startDocument(); AttributesImpl attrs = new AttributesImpl(); @@ -388,16 +393,20 @@ AttributesImpl zoneItemAttrs = new AttributesImpl(); zoneItemAttrs.addCDATAAttribute("id", id); - PageElementResourceAccess zoneAccess = _pageAccess.createPageElementAccess(id, PageElementType.fromZoneItemType(type)); + PageElementResourceAccess zoneAccess = _pageAccess != null ? _pageAccess.createPageElementAccess(id, PageElementType.fromZoneItemType(type)) : null; // try to get content from cache SaxBuffer cachedContent = _zoneItemCache.getPageElement(workspace, site, _getType(zoneItem), id, page.getId(), renderingContext); if (cachedContent != null) { + if (zoneAccess != null) + { + zoneAccess.setCacheable(true); + zoneAccess.setCacheHit(true); + } + _zoneItemsInCache++; - zoneAccess.setCacheable(true); - zoneAccess.setCacheHit(true); cachedContent.toSAX(contentHandler); } @@ -421,8 +430,11 @@ // if service is null, an exception will be thrown later } - zoneAccess.setCacheable(isCacheable); - zoneAccess.setCacheHit(false); + if (zoneAccess != null) + { + zoneAccess.setCacheable(isCacheable); + zoneAccess.setCacheHit(false); + } SaxBuffer buffer = null; ContentHandler handler; // the actual ContentHandler, either the real one, or a buffer Index: main/workspace-web/src/org/ametys/web/inputdata/InputDataGenerator.java =================================================================== --- main/workspace-web/src/org/ametys/web/inputdata/InputDataGenerator.java (revision 21290) +++ main/workspace-web/src/org/ametys/web/inputdata/InputDataGenerator.java (working copy) @@ -27,10 +27,11 @@ import org.xml.sax.SAXException; import org.ametys.plugins.repository.provider.WorkspaceSelector; +import org.ametys.web.cache.monitoring.Constants; import org.ametys.web.cache.monitoring.process.access.ResourceAccessComponent; import org.ametys.web.cache.monitoring.process.access.impl.PageElementResourceAccess; -import org.ametys.web.cache.monitoring.process.access.impl.PageResourceAccess; import org.ametys.web.cache.monitoring.process.access.impl.PageElementResourceAccess.PageElementType; +import org.ametys.web.cache.monitoring.process.access.impl.PageResourceAccess; import org.ametys.web.cache.pageelement.PageElementCache; import org.ametys.web.renderingcontext.RenderingContext; import org.ametys.web.renderingcontext.RenderingContextHandler; @@ -92,7 +93,7 @@ RenderingContext renderingContext = _renderingconContextHandler.getRenderingContext(); // Access monitoring - PageResourceAccess pageAccess = (PageResourceAccess) request.getAttribute("PAGE_ACCESS"); + PageResourceAccess pageAccess = (PageResourceAccess) request.getAttribute(Constants.REQUEST_ATTRIBUTE_PAGEACCESS); contentHandler.startDocument(); XMLUtils.startElement(contentHandler, "inputData"); @@ -101,15 +102,18 @@ { InputData inputData = _inputDataExtensionPoint.getExtension(id); - PageElementResourceAccess inputDataAccess = pageAccess.createPageElementAccess(id, PageElementType.INPUTDATA); + PageElementResourceAccess inputDataAccess = pageAccess != null ? pageAccess.createPageElementAccess(id, PageElementType.INPUTDATA) : null; // lookup cached content SaxBuffer cachedContent = _inputDataCache.getPageElement(workspace, siteName, id, pageId, renderingContext); if (cachedContent != null) { - inputDataAccess.setCacheable(true); - inputDataAccess.setCacheHit(true); + if (inputDataAccess != null) + { + inputDataAccess.setCacheable(true); + inputDataAccess.setCacheHit(true); + } cachedContent.toSAX(contentHandler); } @@ -117,8 +121,11 @@ { boolean isCacheable = inputData.isCacheable(site, page); - inputDataAccess.setCacheable(isCacheable); - inputDataAccess.setCacheHit(false); + if (inputDataAccess != null) + { + inputDataAccess.setCacheable(isCacheable); + inputDataAccess.setCacheHit(false); + } SaxBuffer buffer = null; ContentHandler handler; // the actual ContentHandler, either the real one, or a buffer