JBoss Portal SVN: r13335 - branches/JBoss_Portal_Branch_2_7_AS5/core/src/resources/portal-core-sar/conf/identity.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2009-05-11 08:52:57 -0400 (Mon, 11 May 2009)
New Revision: 13335
Modified:
branches/JBoss_Portal_Branch_2_7_AS5/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml
Log:
this option allows to specify the admin roles and admin users so an external client can know them using RoleModule and UserModule api. See JBPORTAL-2283
Modified: branches/JBoss_Portal_Branch_2_7_AS5/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7_AS5/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml 2009-05-11 12:51:16 UTC (rev 13334)
+++ branches/JBoss_Portal_Branch_2_7_AS5/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml 2009-05-11 12:52:57 UTC (rev 13335)
@@ -325,6 +325,21 @@
<name>defaultAdminRole</name>
<value>Admin</value>
</option>
+
+ <!-- this option allows to specify the admin users so
+ an external client can know them using UserModule api
+ <option>
+ <name>adminUsers</name>
+ <value>admin</value>
+ </option> -->
+
+ <!-- this option allows to specify the admin roles so
+ an external client can know them using RoleModule api
+ <option>
+ <name>adminRoles</name>
+ <value>Admin</value>
+ </option> -->
+
</option-group>
<option-group>
<group-name>userCreateAttibutes</group-name>
16 years, 12 months
JBoss Portal SVN: r13334 - branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/identity.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2009-05-11 08:51:16 -0400 (Mon, 11 May 2009)
New Revision: 13334
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml
Log:
this option allows to specify the admin roles and admin users so an external client can know them using RoleModule and UserModule api. See JBPORTAL-2283
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml 2009-05-11 12:06:26 UTC (rev 13333)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-sar/conf/identity/standardidentity-config.xml 2009-05-11 12:51:16 UTC (rev 13334)
@@ -325,6 +325,21 @@
<name>defaultAdminRole</name>
<value>Admin</value>
</option>
+
+ <!-- this option allows to specify the admin users so
+ an external client can know them using UserModule api
+ <option>
+ <name>adminUsers</name>
+ <value>admin</value>
+ </option> -->
+
+ <!-- this option allows to specify the admin roles so
+ an external client can know them using RoleModule api
+ <option>
+ <name>adminRoles</name>
+ <value>Admin</value>
+ </option> -->
+
</option-group>
<option-group>
<group-name>userCreateAttibutes</group-name>
16 years, 12 months
JBoss Portal SVN: r13333 - branches.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-05-11 08:06:26 -0400 (Mon, 11 May 2009)
New Revision: 13333
Added:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/
Log:
[JBEPP-78] Branch for patch
Copied: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78 (from rev 13332, tags/Enterprise_Portal_Platform_4_3_GA_CP01)
16 years, 12 months
JBoss Portal SVN: r13332 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-05-11 07:03:03 -0400 (Mon, 11 May 2009)
New Revision: 13332
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
Log:
[selenium] - portal admin; page security test case
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-05-09 23:06:21 UTC (rev 13331)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-05-11 11:03:03 UTC (rev 13332)
@@ -22,6 +22,22 @@
/** prefix for locator properties = portal.admin. */
public final String casePfx = "portal.admin.";
+ private final String SUB_SEC_SUBMIT = getLoc(casePfx + "sub.sec.submit","//input[contains(@id,'common-edit-security-form:update')]");
+ private final String SUB_SEC_CANCEL = getLoc(casePfx + "sub.sec.cancel","//input[contains(@id,'common-edit-security-form:cancel')]");
+
+ private final String CHK_SEC_RUN_PR = getLoc(casePfx + "chk.sec.run.pr","//input[contains(@id,'common-edit-security-form:cars_2:3')]");
+ private final String CHK_SEC_RUN_P = getLoc(casePfx + "chk.sec.run.p","//input[contains(@id,'common-edit-security-form:cars_2:2')]");
+ private final String CHK_SEC_RUN_VR = getLoc(casePfx + "chk.sec.run.vr","//input[contains(@id,'common-edit-security-form:cars_2:1')]");
+ private final String CHK_SEC_RUN_V = getLoc(casePfx + "chk.sec.run.v","//input[contains(@id,'common-edit-security-form:cars_2:0')]");
+ private final String CHK_SEC_RU_PR = getLoc(casePfx + "chk.sec.ru.pr","//input[contains(@id,'common-edit-security-form:cars_1:3')]");
+ private final String CHK_SEC_RU_P = getLoc(casePfx + "chk.sec.ru.p","//input[contains(@id,'common-edit-security-form:cars_1:2')]");
+ private final String CHK_SEC_RU_VR = getLoc(casePfx + "chk.sec.ru.vr","//input[contains(@id,'common-edit-security-form:cars_1:1')]");
+ private final String CHK_SEC_RU_V = getLoc(casePfx + "chk.sec.ru.v","//input[contains(@id,'common-edit-security-form:cars_1:0')]");
+ private final String CHK_SEC_RA_PR = getLoc(casePfx + "chk.sec.ra.pr","//input[contains(@id,'common-edit-security-form:cars_0:3')]");
+ private final String CHK_SEC_RA_P = getLoc(casePfx + "chk.sec.ra.p","//input[contains(@id,'common-edit-security-form:cars_0:2')]");
+ private final String CHK_SEC_RA_VR = getLoc(casePfx + "chk.sec.ra.vr","//input[contains(@id,'common-edit-security-form:cars_0:1')]");
+ private final String CHK_SEC_RA_V = getLoc(casePfx + "chk.sec.ra.v","//input[contains(@id,'common-edit-security-form:cars_0:0')]");
+
private final String MES_P1 = getMess(casePfx + "p1", "Who's online portlet");
private final String MES_P2 = getMess(casePfx + "p1", "CharsetPortletInstance");
private final String MES_P3 = getMess(casePfx + "p1", "Coordination Map Portlet");
@@ -655,7 +671,7 @@
String pageName = "PageToRename";
String pageNewName = "PageWasRenamed";
- createPage("TestPortal", "PageToRename");
+ createPage(portalName, pageName);
openAndWait("/portal");
clickAndWait("link=Admin");
@@ -709,13 +725,144 @@
Assert.assertTrue(r < 0, "Renamed page was found with the old name.");
}
-
- // TODO TEST CODE IS MISSING!
+
/**
- * TEST CODE IS MISSING!
+ * Page security testing. New page "PageToSecure" is created in "TestPortal". The security page for the page is opened. It is asserted that all checkboxes are off by
+ * default. All checkboxes are set to "checked" and cancel is clicked. The security page is loaded again and it is asserted that all checkboxes are off after cancel.
+ * All checkboxes are then set to "checked" and update button is clicked. The security page is loaded again and it is asserted that all the checkboxes are in the
+ * "checked" state.
*/
- @Test(enabled = false, description = "")
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate", "testAddPage" }, description = "Tests page security")
public void testPageSecurity() {
+
+ String portalName = "TestPortal";
+ String pageName = "PageToSecure";
+
+ createPage(portalName, pageName);
+
+ // cancel
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be checked");
+
+ selenium.click(CHK_SEC_RA_V);
+ selenium.click(CHK_SEC_RA_VR);
+ selenium.click(CHK_SEC_RA_P);
+ selenium.click(CHK_SEC_RA_PR);
+
+ selenium.click(CHK_SEC_RU_V);
+ selenium.click(CHK_SEC_RU_VR);
+ selenium.click(CHK_SEC_RU_P);
+ selenium.click(CHK_SEC_RU_PR);
+
+ selenium.click(CHK_SEC_RUN_V);
+ selenium.click(CHK_SEC_RUN_VR);
+ selenium.click(CHK_SEC_RUN_P);
+ selenium.click(CHK_SEC_RUN_PR);
+
+ selenium.click(SUB_SEC_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // update
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be checked");
+
+ selenium.click(CHK_SEC_RA_V);
+ selenium.click(CHK_SEC_RA_VR);
+ selenium.click(CHK_SEC_RA_P);
+ selenium.click(CHK_SEC_RA_PR);
+
+ selenium.click(CHK_SEC_RU_V);
+ selenium.click(CHK_SEC_RU_VR);
+ selenium.click(CHK_SEC_RU_P);
+ selenium.click(CHK_SEC_RU_PR);
+
+ selenium.click(CHK_SEC_RUN_V);
+ selenium.click(CHK_SEC_RUN_VR);
+ selenium.click(CHK_SEC_RUN_P);
+ selenium.click(CHK_SEC_RUN_PR);
+
+ selenium.click(SUB_SEC_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assert
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
+
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should be checked");
+
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should be checked");
+
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should be checked");
+
}
/**
16 years, 12 months
JBoss Portal SVN: r13331 - branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes.
by portal-commits@lists.jboss.org
Author: jpviragine
Date: 2009-05-09 19:06:21 -0400 (Sat, 09 May 2009)
New Revision: 13331
Modified:
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties
Log:
some minor typo
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties 2009-05-09 18:35:59 UTC (rev 13330)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties 2009-05-09 23:06:21 UTC (rev 13331)
@@ -24,31 +24,31 @@
## WSRP GUI localization
# JBoss Portal display information
-org.jboss.portal.object.name.WSRPConfigurationPortlet = Configura\u00e7\u00e3o WSRP
-org.jboss.portal.instance.name.WSRPConfigurationPortletInstance = Portlet de Configura\u00e7\u00e3o WSRP
+org.jboss.portal.object.name.WSRPConfigurationPortlet = Configura\u00E7\u00E3o WSRP
+org.jboss.portal.instance.name.WSRPConfigurationPortletInstance = Portlet de Configura\u00E7\u00E3o WSRP
# Tabs
-nav_tabs_consumers = Configura\u00e7\u00e3o de Consumidores
-nav_tabs_producer_config = Configura\u00e7\u00e3o de Produtores
+nav_tabs_consumers = Configura\u00E7\u00E3o de Consumidores
+nav_tabs_producer_config = Configura\u00E7\u00E3o de Produtores
nav_tabs_producer_management = Gerenciamento de Produtores
# Object path in consumer template
path_consumers_root = Consumidores
-path_consumers_consumer = Configura\u00e7\u00e3o do Consumidor ''{0}''
+path_consumers_consumer = Configura\u00E7\u00E3o do Consumidor ''{0}''
path_consumers_active = ativo
path_consumers_inactive = inativo
-path_consumers_refreshNeeded = (atualiza\u00e7\u00e3o necess\u00e1ria)
+path_consumers_refreshNeeded = (atualiza\u00E7\u00E3o necess\u00E1ria)
# Confirm deletion of a consumer screen
confirm_delete_consumer_title = Excluir o consumidor ''{0}''?
-confirm_delete_consumer_message = Voc\u00ea est\u00e1 prestes a excluir o consumidor ''{0}''\!
+confirm_delete_consumer_message = Voc\u00EA est\u00E1 prestes a excluir o consumidor ''{0}''\!
confirm_detete_consumer_proceed = Tem certeza de que deseja continuar?
confirm_delete_consumer_submit = Excluir consumidor
confirm_delete_consumer_cancel = Cancelar
# Confirm deletion of local registration information screen
confirm_delete_registration_title = Excluir registro local para o consumidor ''{0}''?
-confirm_delete_registration_message = Voc\u00ea est\u00e1 prestes a eliminar o registro local de informa\u00e7\u00f5es para o consumidor ''{0}'\! \nIsso s\u00f3 \u00e9 necess\u00e1rio se esse consumidor tinha anteriormente se registrado com o produtor remoto, e esse produtor tiver sido modificado para n\u00e3o mais exigir registro. \nApenas apague informa\u00e7\u00f5es locais de registro, se esse produtor apresentar erros devido a essa situa\u00e7\u00e3o particular. Apagar o registro local quando n\u00e3o obrigat\u00f3rio pode conduzir \u00e0 incapacidade de utilizar esse produtor.
+confirm_delete_registration_message = Voc\u00EA est\u00E1 prestes a eliminar o registro local de informa\u00E7\u00F5es para o consumidor ''{0}'\! \nIsso s\u00F3 \u00E9 necess\u00E1rio se esse consumidor tinha anteriormente se registrado com o produtor remoto, e esse produtor tiver sido modificado para n\u00E3o mais exigir registro. \nApenas apague informa\u00E7\u00F5es locais de registro, se esse produtor apresentar erros devido a essa situa\u00E7\u00E3o particular. Apagar o registro local quando n\u00E3o obrigat\u00F3rio pode conduzir \u00E0 incapacidade de utilizar esse produtor.
confirm_delete_registration_proceed = Tem certeza de que deseja continuar?
confirm_delete_registration_submit = Excluir registro local
confirm_delete_registration_cancel = Cancelar
@@ -61,7 +61,7 @@
# Consumers list
consumers_table_column_consumer = Consumidor
consumers_table_column_consumer_status = status:
-consumers_table_column_actions = A\u00e7\u00f5es
+consumers_table_column_actions = A\u00E7\u00F5es
consumers_table_action_configure = Configurar
consumers_table_action_refresh = Atualizar
consumers_table_action_activate = Ativar
@@ -73,55 +73,55 @@
# Consumer editing screen
edit_consumer_producer = Id do produtor\:
-edit_consumer_cache = Expira\u00e7\u00e3o do cache\:
+edit_consumer_cache = Expira\u00E7\u00E3o do cache\:
edit_consumer_cache_seconds = (segundos antes de expirar)
-edit_consumer_endpoint = Configura\u00e7\u00e3o do endpoint\:
-edit_consumer_endpoint_wsdl = Usar WSDL?
+edit_consumer_endpoint = Configura\u00E7\u00E3o do endpoint\:
+edit_consumer_endpoint_wsdl = Utilizar WSDL?
edit_consumer_endpoint_sd = URL do Service Description\:
edit_consumer_endpoint_m = URL do Markup\:
edit_consumer_endpoint_r = URL do Registro\:
edit_consumer_endpoint_pm = URL do Portlet de Gerenciamento\:
-edit_consumer_registration = Informa\u00e7\u00f5es do registro\:
-edit_consumer_registration_current = Informa\u00e7\u00f5es do registro atual\:
+edit_consumer_registration = Informa\u00E7\u00F5es do registro\:
+edit_consumer_registration_current = Informa\u00E7\u00F5es do registro atual\:
edit_consumer_prop_name = Nome
-edit_consumer_prop_desc = Descri\u00e7\u00e3o
+edit_consumer_prop_desc = Descri\u00E7\u00E3o
edit_consumer_prop_value = Valor
edit_consumer_registration_update_props = Atualizar propriedades
-edit_consumer_registration_no_props = O registro \u00e9 indicado como obrigat\u00f3rio sem as propriedades do registro.
+edit_consumer_registration_no_props = O registro \u00E9 indicado como obrigat\u00F3rio sem as propriedades do registro.
edit_consumer_registration_modify = Modificar registro
edit_consumer_registration_modify_title = Modificar o registro realizado com este produtor
-edit_consumer_registration_expected = Informa\u00e7\u00f5es de registro esperadas\:
-edit_consumer_no_registration = O produtor n\u00e3o requer registro.
+edit_consumer_registration_expected = Informa\u00E7\u00F5es de registro esperadas\:
+edit_consumer_no_registration = O produtor n\u00E3o requer registro.
edit_consumer_registration_context = Contexto do registro\:
edit_consumer_registration_context_handle = Handle:
edit_consumer_registration_context_erase = Excluir registro local
-edit_consumer_registration_context_erase_title = Excluir informa\u00e7\u00f5es locais de registro (potencialmente perigoso\!)
+edit_consumer_registration_context_erase_title = Excluir informa\u00E7\u00F5es locais de registro (potencialmente perigoso\!)
edit_consumer_refresh = Atualizar e Gravar
-edit_consumer_refresh_title = Gravar altera\u00e7\u00f5es e atualizar as informa\u00e7\u00f5es do produtor
+edit_consumer_refresh_title = Gravar altera\u00E7\u00F5es e atualizar as informa\u00E7\u00F5es do produtor
edit_consumer_cancel = Cancelar
# Confirm registration property deletion screen
-confirm_delete_reg_property_title = Excluir a descri\u00e7\u00e3o da propriedade de registro ' '(0)''?
-confirm_delete_reg_property_message = Voc\u00ea est\u00e1 prestes a eliminar a descri\u00e7\u00e3o da propriedade de registro ''{0}''\!\n Isso acionar\u00e1 a invalida\u00e7\u00e3o dos registros dos consumidores que ter\u00e3o de modificar suas informa\u00e7\u00e3o de registro.
+confirm_delete_reg_property_title = Excluir a descri\u00E7\u00E3o da propriedade de registro ' '(0)''?
+confirm_delete_reg_property_message = Voc\u00EA est\u00E1 prestes a eliminar a descri\u00E7\u00E3o da propriedade de registro ''{0}''\!\n Isso acionar\u00E1 a invalida\u00E7\u00E3o dos registros dos consumidores que ter\u00E3o de modificar suas informa\u00E7\u00E3o de registro.
confirm_delete_reg_property_proceed = Tem certeza de que deseja continuar?
confirm_delete_reg_property_submit = Excluir propriedade
confirm_delete_reg_property_cancel = Cancelar
# Producer configuration screen
-producer_config_title = Configura\u00e7\u00e3o do Produtor
-producer_config_sd_requires_reg = O acesso \u00e0 descri\u00e7\u00e3o completa do servi\u00e7o exige que os consumidores estejam registados.
-producer_config_strict = Utilize compatibilidade estrita ao WSRP.
-producer_config_requires_reg = Registro obrigat\u00f3rio. Modificar essa informa\u00e7\u00e3o invalidar\u00e1 os registros dos consumidores.
-producer_config_reg_policy = Nome da classe de pol\u00edtica do registro\:
-producer_config_reg_prop_validator = Nome da classe de valida\u00e7\u00e3o da propriedade do registro\:
+producer_config_title = Configura\u00E7\u00E3o do Produtor
+producer_config_sd_requires_reg = O acesso \u00E0 descri\u00E7\u00E3o completa do servi\u00E7o exige que os consumidores estejam registrados.
+producer_config_strict = Utilizar compatibilidade estrita ao WSRP.
+producer_config_requires_reg = Registro obrigat\u00F3rio. Modificar essa informa\u00E7\u00E3o invalidar\u00E1 os registros dos consumidores.
+producer_config_reg_policy = Nome da classe de pol\u00EDtica do registro\:
+producer_config_reg_prop_validator = Nome da classe de valida\u00E7\u00E3o da propriedade do registro\:
producer_config_reg_props = Propriedades do registro
producer_config_reg_prop_name = Nome
producer_config_reg_prop_type = Tipo
-producer_config_reg_prop_label = R\u00f3tulo
+producer_config_reg_prop_label = R\u00F3tulo
producer_config_reg_prop_hint = Dica
-producer_config_reg_prop_action = A\u00e7\u00e3o
+producer_config_reg_prop_action = A\u00E7\u00E3o
producer_config_reg_prop_remove = Excluir
-producer_config_no_reg_props = Propriedades obrigat\u00f3rias do registro n\u00e3o especificadas.
+producer_config_no_reg_props = Propriedades obrigat\u00F3rias do registro n\u00E3o especificadas.
producer_config_add_reg_prop = Adicionar propriedade
producer_config_save = Gravar
producer_config_cancel = Cancelar
@@ -133,41 +133,41 @@
CONSUMER_TYPE = Consumidor
# ConsumerBean
-bean_consumer_cannot_find_consumer = N\u00e3o foi poss\u00edvel encontrar o consumidor ''{0}''\!
-bean_consumer_cannot_update_consumer = N\u00e3o foi poss\u00edvel atualizar o consumidor\!
-bean_consumer_cannot_refresh_consumer = N\u00e3o foi poss\u00edvel atualizar o consumidor\!
+bean_consumer_cannot_find_consumer = N\u00E3o foi poss\u00EDvel encontrar o consumidor ''{0}''\!
+bean_consumer_cannot_update_consumer = N\u00E3o foi poss\u00EDvel atualizar o consumidor\!
+bean_consumer_cannot_refresh_consumer = N\u00E3o foi poss\u00EDvel atualizar o consumidor\!
bean_consumer_modify_reg_success = Registro modificado com sucesso\!
-bean_consumer_invalid_modify = Tentativa inv\u00e1lida de modificar um registro que n\u00e3o foi modificado localmente\!
-bean_consumer_cannot_modify_reg = N\u00e3o foi poss\u00edvel modificar o registro\!
-bean_consumer_cannot_erase_reg = N\u00e3o foi poss\u00edvel excluir o registro local\!
-bean_consumer_malformed_url = ''{0}'' n\u00e3o \u00e9 uma URL v\u00e1lida\: {1}
-bean_consumer_update_success = Atualiza\u00e7\u00e3o do consumidor realizada com sucesso\!
+bean_consumer_invalid_modify = Tentativa inv\u00E1lida de modificar um registro que n\u00E3o foi modificado localmente\!
+bean_consumer_cannot_modify_reg = N\u00E3o foi poss\u00EDvel modificar o registro\!
+bean_consumer_cannot_erase_reg = N\u00E3o foi poss\u00EDvel excluir o registro local\!
+bean_consumer_malformed_url = ''{0}'' n\u00E3o \u00E9 uma URL v\u00E1lida\: {1}
+bean_consumer_update_success = Atualiza\u00E7\u00E3o do consumidor realizada com sucesso\!
# ConsumerManagerBean
-bean_consumermanager_invalid_new_consumer_name = Necessita de um nome n\u00e3o nulo, n\u00e3o vazio para o novo consumidor\!
+bean_consumermanager_invalid_new_consumer_name = Necessita de um nome n\u00E3o nulo, n\u00E3o vazio para o novo consumidor\!
bean_consumermanager_no_consumer = Nenhum consumidor foi selecionado\!
-bean_consumermanager_refresh_bypassed = N\u00e3o \u00e9 necess\u00e1rio atualizar.
-bean_consumermanager_refresh_success = Atualiza\u00e7\u00e3o bem sucedida.
-bean_consumermanager_refresh_failure = A atualiza\u00e7\u00e3o falhou (provavelmente porque a informa\u00e7\u00e3o de registro n\u00e3o era v\u00e1lida).
+bean_consumermanager_refresh_bypassed = N\u00E3o \u00E9 necess\u00E1rio atualizar.
+bean_consumermanager_refresh_success = Atualiza\u00E7\u00E3o bem sucedida.
+bean_consumermanager_refresh_failure = A atualiza\u00E7\u00E3o falhou (provavelmente porque a informa\u00E7\u00E3o de registro n\u00E3o era v\u00E1lida).
bean_consumermanager_refresh_exception = Ocorreu um erro inesperado.
-bean_consumermanager_refresh_modify = Informa\u00e7\u00e3o local ou remota foi alterada. Voc\u00ea deve modificar o registro com o produtor remoto. \\n Os novos locais de informa\u00e7\u00e3o ser\u00e3o salvos, mas o seu atual registro de dados ser\u00e1 usado at\u00e9 que voc\u00ea modifique o registro com o produtor com sucesso.
+bean_consumermanager_refresh_modify = Informa\u00E7\u00E3o local ou remota foi alterada. Voc\u00EA deve modificar o registro com o produtor remoto. \\n Os novos locais de informa\u00E7\u00E3o ser\u00E3o salvos, mas o seu atual registro de dados ser\u00E1 usado at\u00E9 que voc\u00EA modifique o registro com o produtor com sucesso.
# ProducerBean
-bean_producer_regpolicy_unset = RegistrationPolicy n\u00e3o definida
-bean_producer_cannot_save = N\u00e3o foi poss\u00edvel salvar a configura\u00e7\u00e3o do produtor. Motivo\: (0)
-bean_producer_cannot_reload = N\u00e3o foi poss\u00edvel recarregar a configura\u00e7\u00e3o do produtor. Motivo\: {0}
-bean_producer_save_success = Configura\u00e7\u00e3o do producer gravada com sucesso\!
-bean_producer_cancel_success = Todas as modifica\u00e7\u00f5es feitas na configura\u00e7\u00e3o do produtor foram canceladas\!
+bean_producer_regpolicy_unset = RegistrationPolicy n\u00E3o definida
+bean_producer_cannot_save = N\u00E3o foi poss\u00EDvel salvar a configura\u00E7\u00E3o do produtor. Motivo\: (0)
+bean_producer_cannot_reload = N\u00E3o foi poss\u00EDvel recarregar a configura\u00E7\u00E3o do produtor. Motivo\: {0}
+bean_producer_save_success = Configura\u00E7\u00E3o do producer gravada com sucesso\!
+bean_producer_cancel_success = Todas as modifica\u00E7\u00F5es feitas na configura\u00E7\u00E3o do produtor foram canceladas\!
## RegistrationProperty Status localization
registration_property_status_inexistent = Produtor inexistente
-registration_property_status_missing = N\u00e3o est\u00e1 presente
-registration_property_status_missing_value = Valor n\u00e3o est\u00e1 presente
+registration_property_status_missing = N\u00E3o est\u00E1 presente
+registration_property_status_missing_value = Valor n\u00E3o est\u00E1 presente
registration_property_status_unchecked_value = Status indeterminado
-registration_property_status_invalid_value = Valor inv\u00e1lido
-registration_property_status_valid = V\u00e1lido
+registration_property_status_invalid_value = Valor inv\u00E1lido
+registration_property_status_valid = V\u00E1lido
org.jboss.portal.object.name.admin.WSRP=WSRP
-INVALID_NAME_ERROR=''{0}'' \u00e9 um nome inv\u00e1lido para {1}\: n\u00e3o deve ser nulo, vazio ou conter os caracteres '\\', '<', '>', '(', ')', '=' ou '%5c'
-DUPLICATE_ERROR=Um {1} denominado ''{0}'' j\u00e1 existe\!
\ No newline at end of file
+INVALID_NAME_ERROR=''{0}'' \u00E9 um nome inv\u00E1lido para {1}\: n\u00E3o deve ser nulo, vazio ou conter os caracteres '\\', '<', '>', '(', ')', '\=' ou '%5c'
+DUPLICATE_ERROR=Um {1} denominado ''{0}'' j\u00E1 existe\!
\ No newline at end of file
17 years
JBoss Portal SVN: r13330 - in modules/authorization/trunk: policy-server/src/main/java/org/jboss/security/authz/policy/server/decision and 1 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2009-05-09 14:35:59 -0400 (Sat, 09 May 2009)
New Revision: 13330
Added:
modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java
Modified:
modules/authorization/trunk/enforcement/src/main/java/org/jboss/security/authz/enforcement/Request.java
modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java
Log:
first successful pass at recursive access for hierarchial objects
Modified: modules/authorization/trunk/enforcement/src/main/java/org/jboss/security/authz/enforcement/Request.java
===================================================================
--- modules/authorization/trunk/enforcement/src/main/java/org/jboss/security/authz/enforcement/Request.java 2009-05-08 19:18:25 UTC (rev 13329)
+++ modules/authorization/trunk/enforcement/src/main/java/org/jboss/security/authz/enforcement/Request.java 2009-05-09 18:35:59 UTC (rev 13330)
@@ -45,6 +45,11 @@
private Action action;
private Environment environment;
+ /**
+ * Used to indicate if this request should go through access check based on the tree hierarchy of resources represented by its unique resource URI
+ */
+ private boolean activateHierarchialEnforcement;
+
public Request()
{
this.resources = new HashSet<Resource>();
@@ -101,6 +106,17 @@
this.subjects.add(subject);
}
+
+ public boolean isActivateHierarchialEnforcement()
+ {
+ return activateHierarchialEnforcement;
+ }
+
+ public void setActivateHierarchialEnforcement(boolean activateHierarchialEnforcement)
+ {
+ this.activateHierarchialEnforcement = activateHierarchialEnforcement;
+ }
+
public RequestType encode()
{
RequestType jaxbObject = new RequestType();
Modified: modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java
===================================================================
--- modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java 2009-05-08 19:18:25 UTC (rev 13329)
+++ modules/authorization/trunk/policy-server/src/main/java/org/jboss/security/authz/policy/server/decision/PolicyDecisionPoint.java 2009-05-09 18:35:59 UTC (rev 13330)
@@ -26,6 +26,7 @@
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.StringTokenizer;
import org.apache.log4j.Logger;
@@ -33,7 +34,10 @@
import org.jboss.security.authz.enforcement.Request;
import org.jboss.security.authz.enforcement.Response;
import org.jboss.security.authz.policy.server.PolicyServerException;
+import org.jboss.security.authz.model.Resource;
+import org.jboss.security.authz.model.Attribute;
+
import org.jboss.security.xacml.factories.RequestResponseContextFactory;
import org.jboss.security.xacml.interfaces.RequestContext;
import org.jboss.security.xacml.interfaces.ResponseContext;
@@ -43,6 +47,7 @@
import org.jboss.security.xacml.sunxacml.PDPConfig;
import org.jboss.security.xacml.sunxacml.ctx.RequestCtx;
import org.jboss.security.xacml.sunxacml.ctx.ResponseCtx;
+import org.jboss.security.xacml.core.model.context.RequestType;
/**
* This component processes all incoming Authorization requests and responds with a response
@@ -137,41 +142,13 @@
{
try
{
- Response response = new Response();
- RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
- requestContext.setRequest(request.encode());
-
- requestContext.marshall(System.out);
-
- RequestCtx xacmlRequestCtx = (RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX);
- ResponseCtx xacmlResponseCtx = this.policyDecisionPoint.evaluate(xacmlRequestCtx);
-
- ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
- responseContext.set(XACMLConstants.RESPONSE_CTX, xacmlResponseCtx);
-
- responseContext.marshall(System.out);
-
- if(responseContext.getDecision() == XACMLConstants.DECISION_PERMIT)
- {
- response.setAccessGranted(true);
- response.setMessage("permit");
- }
- else if(responseContext.getDecision() == XACMLConstants.DECISION_DENY)
- {
- response.setAccessGranted(false);
- response.setMessage("deny");
- }
- else if(responseContext.getDecision() == XACMLConstants.DECISION_INDETERMINATE)
- {
- response.setAccessGranted(false);
- response.setMessage("indeterminate");
- }
- else if(responseContext.getDecision() == XACMLConstants.DECISION_NOT_APPLICABLE)
- {
- response.setAccessGranted(false);
- response.setMessage("notapplicable");
- }
+ if(request.isActivateHierarchialEnforcement())
+ {
+ return this.checkHierarchialAccess(request);
+ }
+
+ Response response = this.check(request.encode());
return response;
}
@@ -213,4 +190,98 @@
{
return this.policyDecisionPoint;
}
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ private Response checkHierarchialAccess(Request request) throws Exception
+ {
+ Response response = new Response();
+
+ //Check for explicit access control
+ response = this.check(request.encode());
+
+ if(response.isNotApplicable())
+ {
+ //Need to go into snapshot mode
+ Resource resource = request.getResources().iterator().next();
+ Attribute uri = resource.getAttributes().iterator().next();
+ String fullResourceURI = uri.getValue();
+
+ StringBuilder buffer = new StringBuilder("/");
+ StringTokenizer tokenizer = new StringTokenizer(fullResourceURI, "/");
+ Response permitResponse = null;
+ while(tokenizer.hasMoreTokens())
+ {
+ buffer.append(tokenizer.nextToken());
+ uri.setValue(buffer.toString());
+
+ response = this.check(request.encode());
+
+ if(response.getMessage().equalsIgnoreCase("deny"))
+ {
+ permitResponse = null;
+ break;
+ }
+
+ if(response.isAccessGranted())
+ {
+ permitResponse = response;
+ }
+
+ buffer.append("/");
+ }
+
+ if(permitResponse == null)
+ {
+ response = new Response();
+ response.setAccessGranted(false);
+ response.setMessage("deny");
+ }
+ else
+ {
+ response = permitResponse;
+ }
+ }
+
+ return response;
+ }
+
+ private Response check(RequestType xacmlRequest) throws Exception
+ {
+ Response response = new Response();
+
+ //Check for explicit access control
+ RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();
+ requestContext.setRequest(xacmlRequest);
+ requestContext.marshall(System.out);
+
+ RequestCtx xacmlRequestCtx = (RequestCtx)requestContext.get(XACMLConstants.REQUEST_CTX);
+ ResponseCtx xacmlResponseCtx = this.policyDecisionPoint.evaluate(xacmlRequestCtx);
+
+ ResponseContext responseContext = RequestResponseContextFactory.createResponseContext();
+ responseContext.set(XACMLConstants.RESPONSE_CTX, xacmlResponseCtx);
+
+ responseContext.marshall(System.out);
+
+ if(responseContext.getDecision() == XACMLConstants.DECISION_PERMIT)
+ {
+ response.setAccessGranted(true);
+ response.setMessage("permit");
+ }
+ else if(responseContext.getDecision() == XACMLConstants.DECISION_DENY)
+ {
+ response.setAccessGranted(false);
+ response.setMessage("deny");
+ }
+ else if(responseContext.getDecision() == XACMLConstants.DECISION_INDETERMINATE)
+ {
+ response.setAccessGranted(false);
+ response.setMessage("indeterminate");
+ }
+ else if(responseContext.getDecision() == XACMLConstants.DECISION_NOT_APPLICABLE)
+ {
+ response.setAccessGranted(false);
+ response.setMessage("notapplicable");
+ }
+
+ return response;
+ }
}
Added: modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java
===================================================================
--- modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java (rev 0)
+++ modules/authorization/trunk/policy-server/src/test/java/org/jboss/security/authz/policy/server/TestHierarchialPropagation.java 2009-05-09 18:35:59 UTC (rev 13330)
@@ -0,0 +1,250 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.security.authz.policy.server;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+
+import org.jboss.security.authz.model.Policy;
+import org.jboss.security.authz.model.PolicyMetaData;
+import org.jboss.security.authz.model.Resource;
+
+import org.jboss.security.authz.components.resource.URIResource;
+import org.jboss.security.authz.components.subject.Roles;
+import org.jboss.security.authz.components.action.Operation;
+import org.jboss.security.authz.components.action.Read;
+import org.jboss.security.authz.components.action.Write;
+import org.jboss.security.authz.components.action.Manage;
+
+import org.jboss.security.authz.enforcement.Request;
+import org.jboss.security.authz.enforcement.Response;
+import org.jboss.security.authz.policy.server.PolicyServer;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public class TestHierarchialPropagation extends TestCase
+{
+ private static Logger log = Logger.getLogger(TestHierarchialPropagation.class);
+
+ private PolicyServer policyServer;
+
+ public void setUp() throws Exception
+ {
+ Server.bootstrap();
+ this.policyServer = (PolicyServer)Server.lookup("/policy-server/PolicyServer");
+ }
+
+ public void tearDown() throws Exception
+ {
+ }
+
+ public void testExplicitPermit() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/root/level1/level2/index.html"));
+ resource.setOperation(new Read());
+ resource.addAllowed("user");
+
+ //Provision the new policy
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+ policyServer.newPolicy(metadata);
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ URIResource contextResource = new URIResource();
+ contextResource.setUri(new URI("/root/level1/level2/index.html"));
+ contextResource.setOperation(new Read());
+
+ //Perform enforcement
+ this.enforce(this.createRequest(contextResource), true);
+ }
+
+ public void testExplicitDeny() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/root/level1/level2/index.html"));
+ resource.setOperation(new Read());
+ resource.addDenied("user");
+
+ //Provision the new policy
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+ policyServer.newPolicy(metadata);
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ URIResource contextResource = new URIResource();
+ contextResource.setUri(new URI("/root/level1/level2/index.html"));
+ contextResource.setOperation(new Read());
+
+ //Perform enforcement
+ this.enforce(this.createRequest(contextResource), false);
+ }
+
+ public void testPermitInheritance() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/root/level1"));
+ resource.setOperation(new Read());
+ resource.addAllowed("user");
+
+ //Provision the new policy
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+ policyServer.newPolicy(metadata);
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ URIResource contextResource = new URIResource();
+ contextResource.setUri(new URI("/root/level1/level2/index.html"));
+ contextResource.setOperation(new Read());
+
+ //Perform enforcement
+ this.enforce(this.createRequest(contextResource), true);
+ }
+
+ public void testDenyInheritance() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/root/level1"));
+ resource.setOperation(new Read());
+ resource.addDenied("user");
+
+ //Provision the new policy
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+ policyServer.newPolicy(metadata);
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ URIResource contextResource = new URIResource();
+ contextResource.setUri(new URI("/root/level1/level2/index.html"));
+ contextResource.setOperation(new Read());
+
+ //Perform enforcement
+ this.enforce(this.createRequest(contextResource), false);
+ }
+
+ public void testDenyOverridesPermitInheritance() throws Exception
+ {
+ //SetUp Permit policy
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/root/level1"));
+ resource.setOperation(new Read());
+ resource.addAllowed("user");
+
+ //Provision the new policy
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+ policyServer.newPolicy(metadata);
+
+ //Setup denied policy
+ resource = new URIResource();
+ resource.setUri(new URI("/root/level1/level2"));
+ resource.setOperation(new Read());
+ resource.addDenied("user");
+
+ //Provision the new policy
+ metadata = resource.getPolicyMetaData();
+ policyServer.newPolicy(metadata);
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ URIResource contextResource = new URIResource();
+ contextResource.setUri(new URI("/root/level1/level2/index.html"));
+ contextResource.setOperation(new Read());
+
+ //Perform enforcement
+ this.enforce(this.createRequest(contextResource), false);
+ }
+
+ public void testNotApplicable() throws Exception
+ {
+ //SetUp Resource
+ URIResource resource = new URIResource();
+ resource.setUri(new URI("/root2"));
+ resource.setOperation(new Read());
+ resource.addAllowed("user");
+
+ //Provision the new policy
+ PolicyMetaData metadata = resource.getPolicyMetaData();
+ policyServer.newPolicy(metadata);
+
+ //Go ahead and produce a RequestContext for a "Permit" Enforcement
+ URIResource contextResource = new URIResource();
+ contextResource.setUri(new URI("/root/level1/level2/index.html"));
+ contextResource.setOperation(new Read());
+
+ //Perform enforcement
+ this.enforce(this.createRequest(contextResource), false);
+ }
+ //------------------------------------------------------------------------------------------------------------------------------------------------------
+ private Request createRequest(URIResource uriResource) throws Exception
+ {
+ //Create a RequestType
+ Request request = new Request();
+
+ //Enable Hierarchial Enforcement
+ request.setActivateHierarchialEnforcement(true);
+
+ //Create Resource
+ Resource urlResource = uriResource.getResource();
+ request.addResource(urlResource);
+
+ //Create Subjects
+ Roles roles = new Roles();
+ roles.addName("user");
+ request.addSubject(roles.getSubject());
+
+ //Create Action
+ request.setAction(uriResource.getOperation().getAction());
+
+ return request;
+ }
+
+ private void enforce(Request request, boolean mustBePermitted) throws Exception
+ {
+
+ Response response = this.policyServer.evaluate(request);
+
+ assertNotNull(response);
+ log.info("-----------------------------------");
+ log.info("Decision="+response.getMessage());
+
+ if(mustBePermitted)
+ {
+ assertTrue("Access must be granted!!!", response.isAccessGranted());
+ }
+ else
+ {
+ assertFalse("Access must be denied!!!", response.isAccessGranted());
+ }
+ }
+
+ private void assertServerState() throws Exception
+ {
+ //Assert Policy State of the Server
+ Policy[] policies = policyServer.readAllPolicies();
+
+ assertTrue("Policy Store must not be empty!!", (policies != null && policies.length == 1));
+ log.info("------------------------------------------------------------------------------");
+ log.info(policies[0].generateXACMLPolicy());
+ }
+}
17 years
JBoss Portal SVN: r13327 - modules/cms/branches.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-05-08 15:16:18 -0400 (Fri, 08 May 2009)
New Revision: 13327
Added:
modules/cms/branches/JBP_CMS_1_2_5_DB2/
Log:
Initial import.
17 years
JBoss Portal SVN: r13325 - in modules/jopr-plugin/trunk: plugin/src/main/resources/META-INF and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-05-08 11:23:03 -0400 (Fri, 08 May 2009)
New Revision: 13325
Added:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerComponent.java
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerDiscovery.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvoker.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvokerImpl.java
Modified:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletComponent.java
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletDiscovery.java
modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
Log:
- Separated portlets per invokers which makes things clearer and will allow metrics/operations to be done on an invoker-basis.
- Improved display of portlet metadata by using the portlet name instead of the id and using the context name as version.
- Started better handling of portlets (they should be now removed when they are undeployed).
- Still needs quite a bit of cleaning up and testing.
Added: modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerComponent.java
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerComponent.java (rev 0)
+++ modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerComponent.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.jopr;
+
+import org.jboss.portal.management.ManagedPortletInvoker;
+import org.jboss.portal.management.Portal;
+import org.jboss.portal.management.PortalServer;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class InvokerComponent implements ResourceComponent, MeasurementFacet, OperationFacet
+{
+ private ManagedPortletInvoker invoker;
+ private final static Portal portal;
+
+ static
+ {
+ portal = PortalServer.getPortalManagement();
+ }
+
+ public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception
+ {
+ invoker = portal.getManagedPortletInvokers().get(resourceContext.getResourceKey());
+ }
+
+ public void stop()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public AvailabilityType getAvailability()
+ {
+ return invoker.isAvailable() ? AvailabilityType.UP : AvailabilityType.DOWN;
+ }
+
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception
+ {
+ for (MeasurementScheduleRequest req : metrics)
+ {
+ if (req.getName().equals("portletNumber"))
+ {
+ MeasurementDataNumeric res = new MeasurementDataNumeric(req, (double)invoker.getPortletNumber());
+ report.addData(res);
+ }
+ }
+ }
+
+ public OperationResult invokeOperation(String name, Configuration configuration) throws InterruptedException, Exception
+ {
+ OperationResult res = new OperationResult();
+ if ("refreshPortletList".equals(name))
+ {
+ invoker.refreshPortlets();
+ }
+ return res;
+ }
+
+ public ManagedPortletInvoker getInvoker()
+ {
+ return invoker;
+ }
+}
Added: modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerDiscovery.java
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerDiscovery.java (rev 0)
+++ modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/InvokerDiscovery.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.jopr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.portal.management.ManagedPortletInvoker;
+import org.jboss.portal.management.PortalServer;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class InvokerDiscovery implements ResourceDiscoveryComponent
+{
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ public Set discoverResources(ResourceDiscoveryContext discoveryContext) throws InvalidPluginConfigurationException, Exception
+ {
+ if (PortalServer.isRunning())
+ {
+
+ Map<String, ManagedPortletInvoker> invokers = PortalServer.getPortalManagement().getManagedPortletInvokers();
+
+
+ if (invokers.isEmpty())
+ {
+ return Collections.emptySet();
+ }
+
+ Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(invokers.size());
+
+ for (String invokerName : invokers.keySet())
+ {
+
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(discoveryContext.getResourceType(), invokerName,
+ invokerName, "N/A", "Monitoring of Portlet Invoker " + invokerName, null, null);
+
+
+ // Add to return values
+ discoveredResources.add(detail);
+ log.info("Discovered new portlet invoker: " + invokerName);
+ }
+
+ return discoveredResources;
+ }
+
+ return Collections.emptySet();
+ }
+}
Modified: modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -110,10 +110,9 @@
*/
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception
{
-
for (MeasurementScheduleRequest req : metrics)
{
- if (req.getName().equals("portletNumber"))
+ if (req.getName().equals("portletInstances"))
{
MeasurementDataNumeric res = new MeasurementDataNumeric(req, (double)portal.getNbInstances());
report.addData(res);
@@ -137,13 +136,13 @@
*/
public OperationResult invokeOperation(String name, Configuration params) throws Exception
{
-
OperationResult res = new OperationResult();
if ("refreshPortletList".equals(name))
{
System.out.println("refreshPortletList called res = " + res);
}
return res;
+
}
Modified: modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletComponent.java
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletComponent.java 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletComponent.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -53,7 +53,8 @@
public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception
{
- portlet = portal.getRegisteredPortletManagements().get(resourceContext.getResourceKey());
+ InvokerComponent invoker = (InvokerComponent)resourceContext.getParentResourceComponent();
+ portlet = invoker.getInvoker().getRegisteredPortlets().get(resourceContext.getResourceKey());
}
public void stop()
Modified: modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletDiscovery.java
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletDiscovery.java 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortletDiscovery.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -50,9 +50,11 @@
if (PortalServer.isRunning())
{
- Map<String, LocalPortletManagementMBean> portlets = PortalServer.getPortalManagement().getRegisteredPortletManagements();
+ String invokerName = discoveryContext.getParentResourceContext().getResourceKey();
+ Map<String, LocalPortletManagementMBean> portlets = PortalServer.getPortalManagement().getManagedPortletInvokers().get(invokerName).getRegisteredPortlets();
+
if (portlets.isEmpty())
{
return Collections.emptySet();
@@ -60,16 +62,15 @@
Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(portlets.size());
- for (String portletName : portlets.keySet())
+ for (String portletId : portlets.keySet())
{
+ String name = getPortletNameFromId(portletId);
+ DiscoveredResourceDetails detail = new DiscoveredResourceDetails(discoveryContext.getResourceType(), portletId,
+ name, getPortletVersionFromId(portletId), "Monitoring of Portlet " + name, null, null);
- DiscoveredResourceDetails detail = new DiscoveredResourceDetails(discoveryContext.getResourceType(), portletName,
- portletName, "N/A", "Monitoring of Portlet " + portletName, null, null);
-
-
// Add to return values
discoveredResources.add(detail);
- log.info("Discovered new portlet: " + portletName);
+ log.info("Discovered new portlet: " + portletId);
}
return discoveredResources;
@@ -77,4 +78,14 @@
return Collections.emptySet();
}
+
+ private String getPortletVersionFromId(String id)
+ {
+ return id.substring(id.indexOf('.') + 1, id.lastIndexOf('.')) + " (deployment context)";
+ }
+
+ private String getPortletNameFromId(String id)
+ {
+ return id.substring(id.lastIndexOf('.') + 1);
+ }
}
Modified: modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml 2009-05-08 15:23:03 UTC (rev 13325)
@@ -30,40 +30,29 @@
xmlns:c="urn:xmlns:rhq-configuration">
- <server name="JBoss Portal"
- discovery="PortalDiscovery"
- class="PortalComponent"
- singleton="true">
+ <server name="JBoss Portal" discovery="PortalDiscovery" class="PortalComponent" singleton="true">
- <!--<plugin-configuration>
- --><!-- TODO add your own here --><!--
- </plugin-configuration>-->
+ <metric property="instanceNumber" displayName="Display the number of portlet instances"/>
- <operation name="refreshPortletList" displayName="Refresh portlet list"
- description="Refreshes the list of deployed portlets"/>
+ <server name="Portlet Invoker" class="InvokerComponent" discovery="InvokerDiscovery">
+ <operation name="refreshPortletList" displayName="Refresh portlet list"
+ description="Refreshes the list of deployed portlets"/>
- <metric property="portletNumber" displayName="Display the number of currently deployed portlets"/>
- <service name="Portlet" class="PortletComponent" discovery="PortletDiscovery">
- <metric property="averageRenderTime" displayName="Average render time" units="milliseconds"/>
- <metric property="averageActionTime" displayName="Average action time" units="milliseconds"/>
- <metric property="maxRenderTime" displayName="Maximum render time" units="milliseconds"/>
- <metric property="maxActionTime" displayName="Maximum action time" units="milliseconds"/>
- <metric property="renderRequestCount" displayName="Number of render requests" measurementType="trendsup"
- units="none"/>
- <metric property="actionRequestCount" displayName="Number of action requests" measurementType="trendsup"
- units="none"/>
- <metric property="renderErrorCount" displayName="Number of render errors" measurementType="trendsup"
- units="none"/>
- <metric property="actionErrorCount" displayName="Number of action errors" measurementType="trendsup"
- units="none"/>
- </service>
-
-
- <!--<event name="portal-jopr-pluginDummyEvent"/>-->
-
- <!--<resource-configuration>
- --><!-- TODO supply your configuration parameters --><!--
- </resource-configuration>-->
+ <service name="Portlet" class="PortletComponent" discovery="PortletDiscovery">
+ <metric property="averageRenderTime" displayName="Average render time" units="milliseconds"/>
+ <metric property="averageActionTime" displayName="Average action time" units="milliseconds"/>
+ <metric property="maxRenderTime" displayName="Maximum render time" units="milliseconds"/>
+ <metric property="maxActionTime" displayName="Maximum action time" units="milliseconds"/>
+ <metric property="renderRequestCount" displayName="Number of render requests" measurementType="trendsup"
+ units="none"/>
+ <metric property="actionRequestCount" displayName="Number of action requests" measurementType="trendsup"
+ units="none"/>
+ <metric property="renderErrorCount" displayName="Number of render errors" measurementType="trendsup"
+ units="none"/>
+ <metric property="actionErrorCount" displayName="Number of action errors" measurementType="trendsup"
+ units="none"/>
+ </service>
+ </server>
</server>
</plugin>
\ No newline at end of file
Added: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvoker.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvoker.java (rev 0)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvoker.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.management;
+
+import org.jboss.portal.portlet.management.LocalPortletManagementMBean;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public interface ManagedPortletInvoker
+{
+ boolean isWSRP();
+
+ boolean isAvailable();
+
+ Map<String, LocalPortletManagementMBean> getRegisteredPortlets();
+
+ int getPortletNumber();
+
+ void refreshPortlets();
+}
Added: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvokerImpl.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvokerImpl.java (rev 0)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/ManagedPortletInvokerImpl.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.management;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.portal.portlet.InvokerUnavailableException;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
+import org.jboss.portal.portlet.management.LocalPortletManagementMBean;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ManagedPortletInvokerImpl implements ManagedPortletInvoker
+{
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ private PortletDiscoveryService discoveryService;
+
+ private FederatedPortletInvoker invoker;
+ private Map<String, LocalPortletManagementMBean> registeredPortlets = new HashMap<String, LocalPortletManagementMBean>();
+ private boolean available = true;
+
+ public ManagedPortletInvokerImpl(PortletDiscoveryService discoveryService, FederatedPortletInvoker invoker)
+ {
+ this.discoveryService = discoveryService;
+ this.invoker = invoker;
+ }
+
+ public boolean isWSRP()
+ {
+ return "local".equals(invoker.getId());
+ }
+
+ public boolean isAvailable()
+ {
+ return available;
+ }
+
+ public Map<String, LocalPortletManagementMBean> getRegisteredPortlets()
+ {
+ return registeredPortlets;
+ }
+
+ public int getPortletNumber()
+ {
+ return registeredPortlets.size();
+ }
+
+ public void refreshPortlets()
+ {
+ Set<Portlet> portlets = Collections.emptySet();
+ try
+ {
+ portlets = invoker.getPortlets();
+ available = true;
+ }
+ catch (PortletInvokerException e)
+ {
+ if (e instanceof InvokerUnavailableException)
+ {
+ log.info("Couldn't access portlets from invoker " + invoker.getId() + ". Cause: " + e.getLocalizedMessage());
+ available = false;
+ }
+ log.debug(e);
+ }
+
+ boolean wsrp = isWSRP();
+
+ // remove portlets that have been undeployed...
+ Set<String> previous = new HashSet<String>(registeredPortlets.keySet());
+ previous.removeAll(portlets);
+ for (String portlet : previous)
+ {
+ discoveryService.unregisterPortlet(portlet);
+ registeredPortlets.remove(portlet);
+ }
+
+ for (Portlet portlet : portlets)
+ {
+ String portletId = portlet.getContext().getId();
+
+ if (!registeredPortlets.containsKey(portletId))
+ {
+ registeredPortlets.put(portletId, discoveryService.registerPortlet(portlet, wsrp));
+ }
+ }
+ }
+}
Modified: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -20,10 +20,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
+
package org.jboss.portal.management;
-import org.jboss.portal.portlet.management.LocalPortletManagementMBean;
-
import java.util.Map;
/**
@@ -35,5 +34,5 @@
public int getNbInstances();
- Map<String, LocalPortletManagementMBean> getRegisteredPortletManagements();
+ Map<String, ManagedPortletInvoker> getManagedPortletInvokers();
}
Modified: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -25,7 +25,6 @@
import org.jboss.portal.core.impl.model.instance.InstanceContainerContext;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.portlet.management.LocalPortletManagementMBean;
import javax.naming.InitialContext;
import javax.transaction.UserTransaction;
@@ -61,7 +60,7 @@
return nbInstances;
}
- public Map<String, LocalPortletManagementMBean> getRegisteredPortletManagements()
+ public Map<String, ManagedPortletInvoker> getManagedPortletInvokers()
{
try
{
@@ -72,7 +71,7 @@
log.debug(e);
log.info("Could not refresh list of portlets: " + e.getLocalizedMessage());
}
- return discoveryService.getRegisteredPortlets();
+ return discoveryService.getManagedPortletInvokers();
}
public void setContainerContext(InstanceContainerContext containerContext)
Modified: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscovery.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -36,4 +36,6 @@
void processPortletDiscovery() throws Exception;
Map<String, LocalPortletManagementMBean> getRegisteredPortlets();
+
+ Map<String, ManagedPortletInvoker> getManagedPortletInvokers();
}
Modified: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java 2009-05-08 15:23:03 UTC (rev 13325)
@@ -48,6 +48,7 @@
private Map<String, ObjectName> registeredPortletsNames = new HashMap<String, ObjectName>();
private Map<String, LocalPortletManagementMBean> registeredPortlets = new HashMap<String, LocalPortletManagementMBean>();
+ private Map<String, ManagedPortletInvoker> invokers = new HashMap<String, ManagedPortletInvoker>();
public void start()
{
@@ -63,16 +64,9 @@
public void stop()
{
- for (ObjectName objectName : registeredPortletsNames.values())
+ for (String portlet : registeredPortletsNames.keySet())
{
- try
- {
- getServer().unregisterMBean(objectName);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ unregisterPortlet(portlet);
}
if (registeredPortletsNames.size() != 0)
{
@@ -97,17 +91,20 @@
public void processPortletDiscovery() throws Exception
{
+ //todo: should deal with removal of invokers...
Collection<FederatedPortletInvoker> federatedInvokers = federatingPortletInvoker.getFederatedInvokers();
- for (FederatedPortletInvoker federatedPortletInvoker : federatedInvokers)
+ for (FederatedPortletInvoker invoker : federatedInvokers)
{
- if (federatedPortletInvoker.getId().equals("local"))
+ String id = invoker.getId();
+
+ ManagedPortletInvoker managed = invokers.get(id);
+ if (managed == null)
{
- registerPortlets(federatedPortletInvoker.getPortlets(), false);
+ managed = new ManagedPortletInvokerImpl(this, invoker);
+ invokers.put(id, managed);
}
- else
- {
- registerPortlets(federatedPortletInvoker.getPortlets(), true);
- }
+
+ managed.refreshPortlets();
}
}
@@ -116,40 +113,55 @@
return Collections.unmodifiableMap(registeredPortlets);
}
- private void registerPortlets(Collection<Portlet> portlets, boolean wsrp)
+ public Map<String, ManagedPortletInvoker> getManagedPortletInvokers()
{
- for (Portlet portlet : portlets)
+ return Collections.unmodifiableMap(invokers);
+ }
+
+ LocalPortletManagementMBean registerPortlet(Portlet portlet, boolean wsrp)
+ {
+ String portletId = portlet.getContext().getId();
+
+ LocalPortletManagementMBean management = new LocalPortletManagement(portlet, interceptor);
+
+ // attempt to register MBean with server
+ try
{
- String portletId = portlet.getContext().getId();
+ ObjectName objectName = new ObjectName(getMBeanName(portletId, wsrp));
+ getServer().registerMBean(management, objectName);
- if (!registeredPortletsNames.containsKey(portletId))
- {
- try
- {
- registerPortlet(portlet, wsrp);
- }
- catch (Exception e)
- {
- log.info("Couldn't register " + (wsrp ? "WSRP " : "") + portletId + " portlet. Cause: " + e.getLocalizedMessage());
- log.debug(e);
- }
- }
+ registeredPortletsNames.put(portletId, objectName);
+
+ log.debug("Registered Management MBean for: " + portletId);
}
+ catch (Exception e)
+ {
+ log.info("Couldn't register " + (wsrp ? "WSRP " : "") + portletId + " portlet. Cause: " + e.getLocalizedMessage());
+ log.debug(e);
+ }
+
+ return management;
}
- private ObjectName registerPortlet(Portlet portlet, boolean wsrp) throws Exception
+ void unregisterPortlet(String portlet)
{
- LocalPortletManagementMBean management;
- management = new LocalPortletManagement(portlet, interceptor);
- String id = portlet.getContext().getId();
- ObjectName objectName = new ObjectName(getMBeanName(id, wsrp));
- getServer().registerMBean(management, objectName);
+ ObjectName objectName = registeredPortletsNames.get(portlet);
- registeredPortletsNames.put(id, objectName);
- registeredPortlets.put(id, management);
+ if (objectName == null)
+ {
+ log.debug("No known MBean associated with portlet " + portlet);
+ return;
+ }
- log.debug("Registered Management MBean for: " + id);
- return objectName;
+ try
+ {
+ getServer().unregisterMBean(objectName);
+ }
+ catch (Exception e)
+ {
+ log.info("Couldn't unregister MBean associated with portlet " + portlet + ". Cause: " + e.getLocalizedMessage());
+ log.debug(e);
+ }
}
private String getMBeanName(String id, boolean wsrp)
@@ -163,5 +175,4 @@
return LOCAL_JMX_PREFIX + id;
}
}
-
}
Modified: modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml
===================================================================
--- modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml 2009-05-07 21:58:57 UTC (rev 13324)
+++ modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml 2009-05-08 15:23:03 UTC (rev 13325)
@@ -24,8 +24,8 @@
<server>
- <!-- Portlet discovery executed every 30 seconds -->
- <mbean
+ <!-- Portlet discovery executed every 30 seconds only needed if you want to use the JMX beans directly -->
+ <!--<mbean
code="org.jboss.varia.scheduler.Scheduler"
name="portal:service=Management,type=Scheduler">
<attribute
@@ -36,7 +36,7 @@
<attribute name="SchedulePeriod">30000</attribute>
<attribute name="InitialRepetitions">-1</attribute>
<attribute name="StartAtStartup">true</attribute>
- </mbean>
+ </mbean>-->
<mbean
code="org.jboss.portal.management.PortalImpl"
17 years