gatein SVN: r1672 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-02-14 12:21:13 -0500 (Sun, 14 Feb 2010)
New Revision: 1672
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
Log:
- Fixed didRefreshHappen implementation.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2010-02-14 15:58:04 UTC (rev 1671)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2010-02-14 17:21:13 UTC (rev 1672)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, 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.
@@ -23,9 +23,11 @@
package org.gatein.wsrp.consumer;
-import static org.gatein.wsrp.consumer.RefreshResult.Status.*;
import org.oasis.wsrp.v1.ServiceDescription;
+import static org.gatein.wsrp.consumer.RefreshResult.Status.BYPASSED;
+import static org.gatein.wsrp.consumer.RefreshResult.Status.SUCCESS;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision: 11575 $
@@ -75,7 +77,7 @@
public boolean didRefreshHappen()
{
- return SUCCESS.equals(status) || FAILURE.equals(status);
+ return !BYPASSED.equals(status);
}
public boolean hasIssues()
14 years, 11 months
gatein SVN: r1671 - components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-02-14 10:58:04 -0500 (Sun, 14 Feb 2010)
New Revision: 1671
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/RegistrationEndpoint.java
Log:
- Check for null after modifyRegistration as we might not have a resulting RegistrationState.
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/RegistrationEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/RegistrationEndpoint.java 2010-02-14 15:55:04 UTC (rev 1670)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/RegistrationEndpoint.java 2010-02-14 15:58:04 UTC (rev 1671)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, 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.
@@ -100,8 +100,12 @@
RegistrationState result = producer.modifyRegistration(modifyRegistration);
- registrationState.value = result.getRegistrationState();
- extensions.value = result.getExtensions();
+ // it is possible (if not likely) that result of modifyRegistration be null
+ if (result != null)
+ {
+ registrationState.value = result.getRegistrationState();
+ extensions.value = result.getExtensions();
+ }
}
public List<Extension> deregister(
14 years, 11 months
gatein SVN: r1670 - in components/wsrp/trunk: admin-gui/src/main/java/org/gatein/wsrp/admin/ui and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-02-14 10:55:04 -0500 (Sun, 14 Feb 2010)
New Revision: 1670
Modified:
components/wsrp/trunk/admin-gui/pom.xml
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/editConsumer.xhtml
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java
Log:
- Cleaned-up state management on ConsumerBean:
+ Let RegistrationInfo handle more dirty state management instead of relying on a JSF value change listener.
+ Let ProducerInfo handle expected RegistrationInfo.
+ Removed now unneeded expectedRegistrationInfo and registrationLocallyModified fields.
+ Renamed isRegistrationModified to isDisplayExpectedNeeded to be more explicit.
+ Renamed isRegistrationPropertiesEmpty and isExpectedRegistrationPropertiesEmpty to is*Existing as the logic was
checking that properties were present, not empty.
+ Cleaned-up editConsumer.xhtml.
- Use SL4J in ManagedBean instead of Log4J and adapted logging code appropriately.
Modified: components/wsrp/trunk/admin-gui/pom.xml
===================================================================
--- components/wsrp/trunk/admin-gui/pom.xml 2010-02-13 11:18:05 UTC (rev 1669)
+++ components/wsrp/trunk/admin-gui/pom.xml 2010-02-14 15:55:04 UTC (rev 1670)
@@ -89,4 +89,19 @@
</dependency>
</dependencies>
+ <!-- Disable some tests for now until we can find some time to work on migrating them -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>org/gatein/wsrp/other/*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
\ No newline at end of file
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2010-02-13 11:18:05 UTC (rev 1669)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2010-02-14 15:55:04 UTC (rev 1670)
@@ -31,7 +31,6 @@
import org.gatein.wsrp.consumer.RegistrationProperty;
import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
-import javax.faces.event.ValueChangeEvent;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
@@ -49,11 +48,8 @@
private ConsumerRegistry registry;
private ConsumerManagerBean manager;
private boolean modified;
- private boolean registrationLocallyModified;
-
private String wsdl;
- private transient RegistrationInfo expectedRegistrationInfo;
private static final String CANNOT_FIND_CONSUMER = "bean_consumer_cannot_find_consumer";
private static final String CANNOT_UPDATE_CONSUMER = "bean_consumer_cannot_update_consumer";
private static final String CANNOT_REFRESH_CONSUMER = "bean_consumer_cannot_refresh_consumer";
@@ -210,14 +206,17 @@
}
}
- public boolean isRegistrationModified()
+ public boolean isDisplayExpectedNeeded()
{
- return getProducerInfo().isModifyRegistrationRequired();
+ ProducerInfo producerInfo = getProducerInfo();
+
+ // only show expected registration info if it is different from the one we currently have
+ return producerInfo.isModifyRegistrationRequired() && producerInfo.getRegistrationInfo() != producerInfo.getExpectedRegistrationInfo();
}
public boolean isRegistrationLocallyModified()
{
- return isRegistered() && registrationLocallyModified;
+ return isRegistered() && getProducerInfo().getRegistrationInfo().isModifiedSinceLastRefresh();
}
public boolean isRegistrationChecked()
@@ -244,33 +243,21 @@
return getProducerInfo().hasLocalRegistrationInfo();
}
- public boolean isRegistrationPropertiesEmpty()
+ public boolean isRegistrationPropertiesExisting()
{
RegistrationInfo regInfo = getProducerInfo().getRegistrationInfo();
- return regInfo == null || regInfo.isRegistrationPropertiesEmpty();
+ return regInfo == null || regInfo.isRegistrationPropertiesExisting();
}
- public boolean isExpectedRegistrationPropertiesEmpty()
+ public boolean isExpectedRegistrationPropertiesExisting()
{
RegistrationInfo info = getExpectedRegistrationInfo();
- if (info != null)
- {
- return info.isRegistrationPropertiesEmpty();
- }
- else
- {
- return true;
- }
+ return info != null && info.isRegistrationPropertiesExisting();
}
private RegistrationInfo getExpectedRegistrationInfo()
{
- if (expectedRegistrationInfo == null)
- {
- expectedRegistrationInfo = beanContext.getFromSession(ConsumerManagerBean.EXPECTED_REG_INFO_KEY, RegistrationInfo.class);
- }
-
- return expectedRegistrationInfo;
+ return getProducerInfo().getExpectedRegistrationInfo();
}
public List<RegistrationProperty> getRegistrationProperties()
@@ -405,7 +392,7 @@
{
IllegalStateException e =
new IllegalStateException("Registration not locally modified: there should be expected registration from producer!");
- log.debug(e);
+ log.debug("Couldn't modify registration", e);
throw e;
}
}
@@ -419,8 +406,6 @@
info.modifyRegistration();
newReg.setModifiedSinceLastRefresh(false);
- registrationLocallyModified = false;
-
beanContext.createInfoMessage(MODIFY_REG_SUCCESS);
}
catch (Exception e)
@@ -481,23 +466,6 @@
return oldValue;
}
- // Listeners
-
- // todo: valueChangeListener not needed anymore when events on RegistrationProperties work
-
- public void regPropListener(ValueChangeEvent event)
- {
- if (!registrationLocallyModified)
- {
- // only mark as locally modified if we had a previous value
- Object oldValue = normalizeStringIfNeeded(event.getOldValue());
- if (oldValue != null)
- {
- registrationLocallyModified = isOldAndNewDifferent(oldValue, event.getNewValue());
- }
- }
- }
-
protected String getObjectTypeName()
{
return CONSUMER_TYPE;
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java 2010-02-13 11:18:05 UTC (rev 1669)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java 2010-02-14 15:55:04 UTC (rev 1670)
@@ -23,8 +23,9 @@
package org.gatein.wsrp.admin.ui;
-import org.apache.log4j.Logger;
import org.gatein.common.util.ParameterValidation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.regex.Pattern;
@@ -36,7 +37,7 @@
*/
public abstract class ManagedBean
{
- protected Logger log = Logger.getLogger(getClass());
+ protected Logger log = LoggerFactory.getLogger(getClass());
protected BeanContext beanContext;
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2010-02-13 11:18:05 UTC (rev 1669)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2010-02-14 15:55:04 UTC (rev 1670)
@@ -185,7 +185,7 @@
}
catch (Exception e)
{
- log.debug(e);
+ log.debug("Couldn't save producer", e);
beanContext.createErrorMessage("bean_producer_cannot_save", e.getLocalizedMessage());
}
return PRODUCER;
@@ -200,7 +200,7 @@
}
catch (Exception e)
{
- log.debug(e);
+ log.debug("Couldn't reload producer configuration", e);
beanContext.createErrorMessage("bean_producer_cannot_reload", e.getLocalizedMessage());
}
return PRODUCER;
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/editConsumer.xhtml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/editConsumer.xhtml 2010-02-13 11:18:05 UTC (rev 1669)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/jsf/consumers/editConsumer.xhtml 2010-02-14 15:55:04 UTC (rev 1670)
@@ -28,263 +28,258 @@
xmlns:c="http://java.sun.com/jstl/core"
xmlns:webui="http://jboss.org/gatein">
- <ui:define name="content">
+<ui:define name="content">
- <hr/>
+<hr/>
- <h:form id="edit-cons-form">
- <table width="100%" class="portlet-table-body #{consumer.active ? 'active' : 'inactive'}">
- <tr>
- <th>#{i18n.edit_consumer_producer}</th>
- <td>
- <h:inputText id="id" value="#{consumer.id}"/>
- <h:message styleClass="portlet-msg-error" for="id"/>
- </td>
- </tr>
- <tr>
- <th>#{i18n.edit_consumer_cache}</th>
- <td>
- <h:inputText id="cache" value="#{consumer.cache}"/>
- #{i18n.edit_consumer_cache_seconds}
- <h:message styleClass="portlet-msg-error" for="cache"/>
- </td>
- </tr>
- <tr>
- <th>#{i18n.edit_consumer_timeout}</th>
- <td>
- <h:inputText id="timeout" value="#{consumer.timeout}"/>
- #{i18n.edit_consumer_timeout_milliseconds}
- <h:message styleClass="portlet-msg-error" for="timeout"/>
- </td>
- </tr>
- <tr>
- <th>#{i18n.edit_consumer_endpoint}</th>
- <td>
- <h:inputText id="wsdl" size="70" value="#{consumer.wsdl}"/>
- <h:message styleClass="portlet-msg-error" for="wsdl"/>
- </td>
- </tr>
- <c:if test="#{consumer.localInfoPresent}">
- <tr>
- <th>#{i18n.edit_consumer_registration}</th>
- <td>
- <c:choose>
- <c:when test="#{consumer.localInfoPresent}">
- <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_current}</h3>
- <h:panelGroup styleClass="portlet-area-body">
- <c:choose>
- <c:when test="#{consumer.registrationPropertiesEmpty}">
- <h:dataTable id="existingProps"
- value="#{consumer.registrationProperties}" var="prop"
- rowClasses="portlet-section-body,portlet-section-alternate"
- columnClasses="nameColumn,descColumn,"
- headerClass="portlet-section-header #{consumer.active ? 'active' : 'inactive'}"
- styleClass="registration-prop-table #{consumer.active ? 'active' : 'inactive'}"
- width="100%">
- <h:column>
- <f:facet name="header">#{i18n.edit_consumer_prop_name}</f:facet>
- #{prop.name}
- </h:column>
- <h:column>
- <f:facet name="header">#{i18n.edit_consumer_prop_desc}</f:facet>
- #{prop.description.label.value}
- </h:column>
- <h:column>
- <f:facet name="header">#{i18n.edit_consumer_prop_value}</f:facet>
- <!-- todo: valueChangeListener not needed anymore when events on RegistrationProperties work -->
- <h:inputText id="prop-value-input" value="#{prop.value}" size="50"
- valueChangeListener="#{consumer.regPropListener}"
- disabled="#{consumer.registrationModified}"/>
- <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
- rendered="#{prop.determinedInvalid}"
- converter="faces.convert.RegistrationProperty.Status"/>
- </h:column>
- </h:dataTable>
+<h:form id="edit-cons-form">
+<table width="100%" class="portlet-table-body #{consumer.active ? 'active' : 'inactive'}">
+<tr>
+ <th>#{i18n.edit_consumer_producer}</th>
+ <td>
+ <h:inputText id="id" value="#{consumer.id}"/>
+ <h:message styleClass="portlet-msg-error" for="id"/>
+ </td>
+</tr>
+<tr>
+ <th>#{i18n.edit_consumer_cache}</th>
+ <td>
+ <h:inputText id="cache" value="#{consumer.cache}"/>
+ #{i18n.edit_consumer_cache_seconds}
+ <h:message styleClass="portlet-msg-error" for="cache"/>
+ </td>
+</tr>
+<tr>
+ <th>#{i18n.edit_consumer_timeout}</th>
+ <td>
+ <h:inputText id="timeout" value="#{consumer.timeout}"/>
+ #{i18n.edit_consumer_timeout_milliseconds}
+ <h:message styleClass="portlet-msg-error" for="timeout"/>
+ </td>
+</tr>
+<tr>
+ <th>#{i18n.edit_consumer_endpoint}</th>
+ <td>
+ <h:inputText id="wsdl" size="70" value="#{consumer.wsdl}"/>
+ <h:message styleClass="portlet-msg-error" for="wsdl"/>
+ </td>
+</tr>
+<c:if test="#{consumer.localInfoPresent}">
+ <tr>
+ <th>#{i18n.edit_consumer_registration}</th>
+ <td>
+ <c:choose>
+ <c:when test="#{consumer.registrationChecked and !consumer.registrationRequired}">
+ #{i18n.edit_consumer_no_registration}
+ </c:when>
+ <c:otherwise>
+ <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_current}</h3>
+ <h:panelGroup styleClass="portlet-area-body">
+ <c:choose>
+ <c:when test="#{consumer.registrationPropertiesExisting}">
+ <h:dataTable id="existingProps"
+ value="#{consumer.registrationProperties}" var="prop"
+ rowClasses="portlet-section-body,portlet-section-alternate"
+ columnClasses="nameColumn,descColumn,"
+ headerClass="portlet-section-header #{consumer.active ? 'active' : 'inactive'}"
+ styleClass="registration-prop-table #{consumer.active ? 'active' : 'inactive'}"
+ width="100%">
+ <h:column>
+ <f:facet name="header">#{i18n.edit_consumer_prop_name}</f:facet>
+ #{prop.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">#{i18n.edit_consumer_prop_desc}</f:facet>
+ #{prop.description.label.value}
+ </h:column>
+ <h:column>
+ <f:facet name="header">#{i18n.edit_consumer_prop_value}</f:facet>
+ <h:inputText id="prop-value-input" value="#{prop.value}" size="50"
+ disabled="#{consumer.displayExpectedNeeded}"/>
+ <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
+ rendered="#{prop.determinedInvalid}"
+ converter="faces.convert.RegistrationProperty.Status"/>
+ </h:column>
+ </h:dataTable>
- <table class="ActionContainer">
- <tr>
- <td>
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <h:commandLink id="cons-update-link" action="#{consumer.update}"
- value="#{i18n.edit_consumer_registration_update_props}"
- rendered="#{consumer.registered}"/>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
-
- <ui:remove><webui:commandButton action="update"
- backingBean="#{consumer}"
- id="cons-update-link"
- value="#{i18n.edit_consumer_registration_update_props}"
- rendered="registered"/></ui:remove>
- </c:when>
- <c:otherwise>
- #{i18n.edit_consumer_registration_no_props}
- </c:otherwise>
- </c:choose>
- <table class="ActionContainer">
- <tr>
- <td>
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <h:commandLink id="modify-reg-link"
- action="#{consumer.modifyRegistration}"
- value="#{i18n.edit_consumer_registration_modify}"
- title="#{i18n.edit_consumer_registration_modify_title}"
- rendered="#{consumer.registrationLocallyModified}"/>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- <ui:remove><webui:commandButton action="modifyRegistration"
- backingBean="#{consumer}"
- id="modify-reg-link"
- rendered="registrationLocallyModified"
- value="#{i18n.edit_consumer_registration_modify}"
- title="#{i18n.edit_consumer_registration_modify_title}"/>
- </ui:remove>
- <br style="clear:both;"/>
- </h:panelGroup>
-
- <br/>
-
- <c:if test="#{consumer.registrationModified}">
- <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_expected}</h3>
- <h:panelGroup styleClass="portlet-area-body">
- <c:choose>
- <c:when test="#{consumer.expectedRegistrationPropertiesEmpty}">
- <h:dataTable id="expectedProps"
- value="#{consumer.expectedRegistrationProperties}" var="prop"
- rowClasses="portlet-section-body,portlet-section-alternate"
- columnClasses="nameColumn,descColumn,"
- headerClass="portlet-section-header #{consumer.active ? 'active' : 'inactive'}"
- styleClass="registration-prop-table #{consumer.active ? 'active' : 'inactive'}"
- width="100%">
- <h:column>
- <f:facet name="header">#{i18n.edit_consumer_prop_name}</f:facet>
- #{prop.name}
- </h:column>
- <h:column>
- <f:facet name="header">#{i18n.edit_consumer_prop_desc}</f:facet>
- #{prop.description.label.value}
- </h:column>
- <h:column>
- <f:facet name="header">#{i18n.edit_consumer_prop_value}</f:facet>
- <h:inputText id="prop-value-input" value="#{prop.value}" size="50"/>
- <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
- rendered="#{prop.determinedInvalid}"
- converter="faces.convert.RegistrationProperty.Status"/>
- </h:column>
- </h:dataTable>
- </c:when>
- <c:otherwise>
- #{i18n.edit_consumer_registration_no_props}
- </c:otherwise>
- </c:choose>
-
- <table class="ActionContainer">
- <tr>
- <td>
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <h:commandLink id="edit-reg-link"
- action="#{consumer.modifyRegistration}"
- value="#{i18n.edit_consumer_registration_modify}"
- title="#{i18n.edit_consumer_registration_modify_title}"/>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- <ui:remove><webui:commandButton action="modifyRegistration"
- backingBean="#{consumer}"
- id="edit-reg-link"
- value="#{i18n.edit_consumer_registration_modify}"
- title="#{i18n.edit_consumer_registration_modify_title}"/></ui:remove>
-
- <br style="clear:both;"/>
- </h:panelGroup>
- </c:if>
- </c:when>
- <c:when test="#{consumer.registrationChecked and !consumer.registrationRequired}">
- #{i18n.edit_consumer_no_registration}
- </c:when>
- </c:choose>
- </td>
- </tr>
- <c:if test="#{!empty consumer.producerInfo.registrationInfo.registrationHandle}">
- <tr>
- <th>#{i18n.edit_consumer_registration_context}</th>
- <td id="handle">
- #{i18n.edit_consumer_registration_context_handle}
- <h:outputText value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
-
<table class="ActionContainer">
<tr>
<td>
<div class="ButtonLeft">
<div class="ButtonRight">
<div class="ButtonMiddle">
- <h:commandLink id="erase-cons-link" action="confirmEraseRegistration"
- value="#{i18n.edit_consumer_registration_context_erase}"
- title="#{i18n.edit_consumer_registration_context_erase_title}"/>
+ <h:commandLink id="cons-update-link" action="#{consumer.update}"
+ value="#{i18n.edit_consumer_registration_update_props}"
+ rendered="#{consumer.registered}"/>
</div>
</div>
</div>
</td>
+ <td>
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <h:commandLink id="modify-reg-link"
+ action="#{consumer.modifyRegistration}"
+ value="#{i18n.edit_consumer_registration_modify}"
+ title="#{i18n.edit_consumer_registration_modify_title}"
+ rendered="#{consumer.registrationLocallyModified}"/>
+ </div>
+ </div>
+ </div>
+ </td>
</tr>
</table>
- <ui:remove><webui:commandButton id="erase-cons-link" action="confirmEraseRegistration"
- backingBean="#{consumer}"
- value="#{i18n.edit_consumer_registration_context_erase}"
- title="#{i18n.edit_consumer_registration_context_erase_title}"/></ui:remove>
- </td>
- </tr>
- </c:if>
- </c:if>
- <tr>
- <th/>
- <td class="portlet-section-buttonrow">
- <table class="ActionContainer">
- <tr>
- <td>
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <h:commandLink id="refresh-cons-link" action="#{consumer.refreshConsumer}"
- value="#{i18n.edit_consumer_refresh}"
- title="#{i18n.edit_consumer_refresh_title}"/>
+ <ui:remove><webui:commandButton action="update"
+ backingBean="#{consumer}"
+ id="cons-update-link"
+ value="#{i18n.edit_consumer_registration_update_props}"
+ rendered="registered"/></ui:remove>
+ </c:when>
+ <c:otherwise>
+ #{i18n.edit_consumer_registration_no_props}
+ </c:otherwise>
+ </c:choose>
+ <ui:remove>
+ <webui:commandButton action="modifyRegistration"
+ backingBean="#{consumer}"
+ id="modify-reg-link"
+ rendered="registrationLocallyModified"
+ value="#{i18n.edit_consumer_registration_modify}"
+ title="#{i18n.edit_consumer_registration_modify_title}"/>
+ </ui:remove>
+ <br style="clear:both;"/>
+ </h:panelGroup>
+
+ <br/>
+
+ <c:if test="#{consumer.displayExpectedNeeded}">
+ <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_expected}</h3>
+ <h:panelGroup styleClass="portlet-area-body">
+ <c:choose>
+ <c:when test="#{consumer.expectedRegistrationPropertiesExisting}">
+ <h:dataTable id="expectedProps"
+ value="#{consumer.expectedRegistrationProperties}" var="prop"
+ rowClasses="portlet-section-body,portlet-section-alternate"
+ columnClasses="nameColumn,descColumn,"
+ headerClass="portlet-section-header #{consumer.active ? 'active' : 'inactive'}"
+ styleClass="registration-prop-table #{consumer.active ? 'active' : 'inactive'}"
+ width="100%">
+ <h:column>
+ <f:facet name="header">#{i18n.edit_consumer_prop_name}</f:facet>
+ #{prop.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">#{i18n.edit_consumer_prop_desc}</f:facet>
+ #{prop.description.label.value}
+ </h:column>
+ <h:column>
+ <f:facet name="header">#{i18n.edit_consumer_prop_value}</f:facet>
+ <h:inputText id="prop-value-input" value="#{prop.value}" size="50"/>
+ <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
+ rendered="#{prop.determinedInvalid}"
+ converter="faces.convert.RegistrationProperty.Status"/>
+ </h:column>
+ </h:dataTable>
+ </c:when>
+ <c:otherwise>
+ #{i18n.edit_consumer_registration_no_props}
+ </c:otherwise>
+ </c:choose>
+
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <h:commandLink id="edit-reg-link"
+ action="#{consumer.modifyRegistration}"
+ value="#{i18n.edit_consumer_registration_modify}"
+ title="#{i18n.edit_consumer_registration_modify_title}"/>
+ </div>
</div>
</div>
+ </td>
+ </tr>
+ </table>
+ <ui:remove><webui:commandButton action="modifyRegistration"
+ backingBean="#{consumer}"
+ id="edit-reg-link"
+ value="#{i18n.edit_consumer_registration_modify}"
+ title="#{i18n.edit_consumer_registration_modify_title}"/></ui:remove>
+
+ <br style="clear:both;"/>
+ </h:panelGroup>
+ </c:if>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ <c:if test="#{!empty consumer.producerInfo.registrationInfo.registrationHandle}">
+ <tr>
+ <th>#{i18n.edit_consumer_registration_context}</th>
+ <td id="handle">
+ #{i18n.edit_consumer_registration_context_handle}
+ <h:outputText value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
+
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <h:commandLink id="erase-cons-link" action="confirmEraseRegistration"
+ value="#{i18n.edit_consumer_registration_context_erase}"
+ title="#{i18n.edit_consumer_registration_context_erase_title}"/>
</div>
- </td>
- <td>
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <h:commandLink id="list-cons-link" action="#{consumersMgr.listConsumers}"
- value="#{i18n.edit_consumer_cancel}"/>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </h:form>
- </ui:define>
+ </div>
+ </div>
+ </td>
+ </tr>
+ </table>
+ <ui:remove><webui:commandButton id="erase-cons-link" action="confirmEraseRegistration"
+ backingBean="#{consumer}"
+ value="#{i18n.edit_consumer_registration_context_erase}"
+ title="#{i18n.edit_consumer_registration_context_erase_title}"/></ui:remove>
+
+ </td>
+ </tr>
+ </c:if>
+</c:if>
+<tr>
+ <th/>
+ <td class="portlet-section-buttonrow">
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <h:commandLink id="refresh-cons-link" action="#{consumer.refreshConsumer}"
+ value="#{i18n.edit_consumer_refresh}"
+ title="#{i18n.edit_consumer_refresh_title}"/>
+ </div>
+ </div>
+ </div>
+ </td>
+ <td>
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <h:commandLink id="list-cons-link" action="#{consumersMgr.listConsumers}"
+ value="#{i18n.edit_consumer_cancel}"/>
+ </div>
+ </div>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr>
+</table>
+</h:form>
+</ui:define>
</ui:decorate>
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java 2010-02-13 11:18:05 UTC (rev 1669)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java 2010-02-14 15:55:04 UTC (rev 1670)
@@ -249,10 +249,10 @@
public boolean hasLocalInfo()
{
- return persistentRegistrationHandle != null || isRegistrationPropertiesEmpty();
+ return persistentRegistrationHandle != null || isRegistrationPropertiesExisting();
}
- public boolean isRegistrationPropertiesEmpty()
+ public boolean isRegistrationPropertiesExisting()
{
return persistentRegistrationProperties != null && !persistentRegistrationProperties.isEmpty();
}
14 years, 11 months
gatein SVN: r1669 - in components/wsrp/trunk/consumer/src: test/java/org/gatein/wsrp/consumer and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-02-13 06:18:05 -0500 (Sat, 13 Feb 2010)
New Revision: 1669
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationProperty.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java
Log:
- Moved isRegistered to RegistrationInfo.
- Only modifyRegistration if we need to.
- Fixed propertyValueChanged so that it doesn't trigger a need to modify the registration if the property that has changed didn't exist or was unchecked.
- Added and fixed test cases.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-02-13 03:41:18 UTC (rev 1668)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-02-13 11:18:05 UTC (rev 1669)
@@ -241,15 +241,7 @@
public boolean isRegistered()
{
- Boolean valid = persistentRegistrationInfo.isRegistrationValid();
- if (valid == null)
- {
- return persistentRegistrationInfo.getRegistrationHandle() != null;
- }
- else
- {
- return valid;
- }
+ return persistentRegistrationInfo.isRegistered();
}
public boolean isRegistrationRequired()
@@ -1074,40 +1066,43 @@
{
persistentEndpointInfo.refresh();
- try
+ if (isModifyRegistrationRequired())
{
- RegistrationContext registrationContext = getRegistrationContext();
- Holder<byte[]> registrationState = new Holder<byte[]>();
+ try
+ {
+ RegistrationContext registrationContext = getRegistrationContext();
+ Holder<byte[]> registrationState = new Holder<byte[]>();
- // invocation
- persistentEndpointInfo.getRegistrationService().modifyRegistration(
- registrationContext,
- persistentRegistrationInfo.getRegistrationData(),
- registrationState,
- new Holder<List<Extension>>());
+ // invocation
+ persistentEndpointInfo.getRegistrationService().modifyRegistration(
+ registrationContext,
+ persistentRegistrationInfo.getRegistrationData(),
+ registrationState,
+ new Holder<List<Extension>>());
- // force refresh of internal RegistrationInfo state
- persistentRegistrationInfo.setRegistrationValidInternalState();
+ // force refresh of internal RegistrationInfo state
+ persistentRegistrationInfo.setRegistrationValidInternalState();
- // registration is not modified anymore :)
- setModifyRegistrationRequired(false);
+ // registration is not modified anymore :)
+ setModifyRegistrationRequired(false);
- // update state
- persistentRegistrationInfo.setRegistrationState(registrationState.value);
+ // update state
+ persistentRegistrationInfo.setRegistrationState(registrationState.value);
- log.info("Consumer with id '" + persistentId + "' sucessfully modified its registration.");
+ log.info("Consumer with id '" + persistentId + "' sucessfully modified its registration.");
- // reset cache to be able to see new offered portlets on the next refresh
- invalidateCache();
+ // reset cache to be able to see new offered portlets on the next refresh
+ invalidateCache();
+ }
+ catch (Exception e)
+ {
+ throw new PortletInvokerException("Couldn't modify registration with producer '" + persistentId + "'", e);
+ }
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
}
- catch (Exception e)
- {
- throw new PortletInvokerException("Couldn't modify registration with producer '" + persistentId + "'", e);
- }
- finally
- {
- registry.updateProducerInfo(this);
- }
}
else
{
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java 2010-02-13 03:41:18 UTC (rev 1668)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationInfo.java 2010-02-13 11:18:05 UTC (rev 1669)
@@ -316,8 +316,6 @@
// todo: deal with language more appropriately
prop = new RegistrationProperty(name, value, WSRPUtils.toString(Locale.getDefault()), this);
getOrCreateRegistrationPropertiesMap(false).put(name, prop);
- setModifiedSinceLastRefresh(true);
- setModifyRegistrationNeeded(true);
}
return prop;
@@ -689,7 +687,7 @@
public boolean isModifyRegistrationNeeded()
{
- return modifyRegistrationNeeded || isModifiedSinceLastRefresh();
+ return modifyRegistrationNeeded;
}
public boolean isModifiedSinceLastRefresh()
@@ -702,11 +700,14 @@
this.modifiedSinceLastRefresh = modifiedSinceLastRefresh;
}
- /** todo: Should be package-only, public for tests... */
- public void propertyValueChanged(RegistrationProperty property, Object oldValue, Object newValue)
+ public void propertyValueChanged(RegistrationProperty property, RegistrationProperty.Status previousStatus, Object oldValue, Object newValue)
{
setModifiedSinceLastRefresh(true);
- setModifyRegistrationNeeded(true);
+
+ if (previousStatus != null && !RegistrationProperty.Status.MISSING_VALUE.equals(previousStatus) && !RegistrationProperty.Status.UNCHECKED_VALUE.equals(previousStatus))
+ {
+ setModifyRegistrationNeeded(true);
+ }
}
private void setModifyRegistrationNeeded(boolean modifyRegistrationNeeded)
@@ -714,6 +715,19 @@
this.modifyRegistrationNeeded = modifyRegistrationNeeded;
}
+ public boolean isRegistered()
+ {
+ Boolean valid = isRegistrationValid();
+ if (valid == null)
+ {
+ return getRegistrationHandle() != null;
+ }
+ else
+ {
+ return valid;
+ }
+ }
+
public class RegistrationRefreshResult extends RefreshResult
{
private Map<String, RegistrationProperty> registrationProperties;
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationProperty.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationProperty.java 2010-02-13 03:41:18 UTC (rev 1668)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationProperty.java 2010-02-13 11:18:05 UTC (rev 1669)
@@ -181,6 +181,7 @@
if ((persistentValue != null && !persistentValue.equals(stringValue)) || (persistentValue == null && stringValue != null))
{
String oldValue = persistentValue;
+ Status oldStatus = status;
persistentValue = stringValue;
if (persistentValue == null)
{
@@ -192,7 +193,7 @@
}
// notify listeners
- notifyListener(oldValue, persistentValue);
+ notifyListener(oldValue, persistentValue, oldStatus);
}
}
@@ -217,13 +218,10 @@
this.status = status;
}
- private void notifyListener(String oldValue, String newValue)
+ private void notifyListener(String oldValue, String newValue, Status oldStatus)
{
- // listener can be null, especially when props are unfrozen from Hibernate
- if (listener != null)
- {
- listener.propertyValueChanged(this, oldValue, newValue);
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener, "PropertyChangeListener");
+ listener.propertyValueChanged(this, oldStatus, oldValue, newValue);
}
public void setListener(PropertyChangeListener listener)
@@ -233,6 +231,14 @@
static interface PropertyChangeListener
{
- void propertyValueChanged(RegistrationProperty property, Object oldValue, Object newValue);
+ /**
+ * Only called if an actual change occurred, i.e. oldvalue is guaranteed to be different from newValue
+ *
+ * @param property
+ * @param previousStatus
+ * @param oldValue
+ * @param newValue
+ */
+ void propertyValueChanged(RegistrationProperty property, Status previousStatus, Object oldValue, Object newValue);
}
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java 2010-02-13 03:41:18 UTC (rev 1668)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java 2010-02-13 11:18:05 UTC (rev 1669)
@@ -24,6 +24,7 @@
package org.gatein.wsrp.consumer;
import junit.framework.TestCase;
+import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.test.protocol.v1.ServiceDescriptionBehavior;
import org.oasis.wsrp.v1.Property;
@@ -44,6 +45,7 @@
{
private RegistrationInfo info;
private static final String producerId = "test";
+ private static final RegistrationContext FAKE_REGISTRATION_CONTEXT = WSRPTypeFactory.createRegistrationContext("handle");
protected void setUp() throws Exception
{
@@ -67,6 +69,8 @@
assertNull(info.isRegistrationRequired());
// and we don't know if the registration is valid
assertNull(info.isRegistrationValid());
+ // and we are not registered
+ assertFalse(info.isRegistered());
assertFalse(info.isModifiedSinceLastRefresh());
assertFalse(info.isModifyRegistrationNeeded());
@@ -90,6 +94,56 @@
}
}
+ public void testRegistration()
+ {
+ register();
+
+ assertEquals(FAKE_REGISTRATION_CONTEXT.getRegistrationHandle(), info.getRegistrationHandle());
+ assertEquals(FAKE_REGISTRATION_CONTEXT.getRegistrationState(), info.getRegistrationState());
+
+ assertTrue(info.isRegistered());
+ assertFalse(info.isModifiedSinceLastRefresh());
+ assertFalse(info.isModifyRegistrationNeeded());
+ assertTrue(info.isConsistentWithProducerExpectations());
+
+ assertFalse(info.isRefreshNeeded());
+
+ assertTrue(info.isRegistrationRequired());
+ assertTrue(info.isRegistrationValid());
+ assertFalse(info.isRegistrationDeterminedNotRequired());
+ assertTrue(info.isRegistrationDeterminedRequired());
+ assertFalse(info.isUndetermined());
+ }
+
+ public void testIsModifyRegistrationNeeded()
+ {
+ String key = "foo";
+
+ // if we're not registered, then modifying registration is never needed
+ assertFalse(info.isRegistered());
+ info.setRegistrationPropertyValue(key, "bar");
+ assertFalse(info.isModifyRegistrationNeeded());
+
+ register();
+
+ // if we try to set the property to the same value, nothing should change
+ info.setRegistrationPropertyValue(key, "bar");
+ assertFalse(info.isModifiedSinceLastRefresh());
+ assertFalse(info.isModifyRegistrationNeeded());
+
+ // but if we set the property to a different value, then we need to modify the registration
+ info.setRegistrationPropertyValue(key, "new");
+ assertTrue(info.isModifiedSinceLastRefresh());
+ assertTrue(info.isModifyRegistrationNeeded());
+ }
+
+ private void register()
+ {
+ // setting a registration context should simulate a successful registration
+ info.setRegistrationContext(FAKE_REGISTRATION_CONTEXT);
+ info.setConsumerName(WSRPConstants.DEFAULT_CONSUMER_NAME);
+ }
+
public void testSimpleSetGetRegistrationProperty()
{
String key = "foo";
@@ -98,7 +152,7 @@
// check status
assertNull(info.isConsistentWithProducerExpectations());
assertTrue(info.isModifiedSinceLastRefresh());
- assertTrue(info.isModifyRegistrationNeeded());
+ assertFalse(info.isModifyRegistrationNeeded()); // since we were not registered, modification of registration shouldn't be needed
Map properties = info.getRegistrationProperties();
assertFalse(properties.isEmpty());
@@ -133,6 +187,8 @@
assertNull("Property value has changed since last refresh, status should be unknown", prop.isInvalid());
assertEquals("Property value has changed since last refresh, status should be unknown",
RegistrationProperty.Status.UNCHECKED_VALUE, prop.getStatus());
+ assertTrue(info.isModifiedSinceLastRefresh());
+ assertTrue(info.isModifyRegistrationNeeded());
}
public void testRefreshNoRegistration()
@@ -203,12 +259,11 @@
public void testRefreshRegistrationDefaultRegistrationExtraLocalInfoWhileRegistered()
{
+ register();
+
// set a registration property
info.setRegistrationPropertyValue("foo", "bar");
- // simulate being registered
- info.setRegistrationHandle("blah");
-
// we were registered so we need to call modifyRegistration, force check of extra props
RegistrationInfo.RegistrationRefreshResult result = info.refresh(
createServiceDescription(true, 0), producerId, false, false, true);
@@ -257,13 +312,12 @@
public void testRefreshRegistrationRegistrationNoLocalInfoWhileRegistered()
{
+ register();
+
// producer requests 2 registration properties
ServiceDescription sd = createServiceDescription(true, 2);
- // simulate registration
- info.setRegistrationHandle("blah");
-
- RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, false, false);
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, true, false);
assertNotNull(result);
assertTrue(result.hasIssues());
assertEquals(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED, result.getStatus());
@@ -368,15 +422,18 @@
info.setRegistrationPropertyValue("prop0", "value0");
assertTrue(info.isModifiedSinceLastRefresh());
- assertTrue(info.isModifyRegistrationNeeded());
+ assertFalse(info.isModifyRegistrationNeeded()); // not registered, so modifying registration is not needed
+
RegistrationData registrationData = info.getRegistrationData();
checkRegistrationData(registrationData, "value0");
// check that setRegistrationValidInternalState properly updates RegistrationData if required
info.setRegistrationPropertyValue("prop0", "value1");
assertTrue(info.isModifiedSinceLastRefresh());
- assertTrue(info.isModifyRegistrationNeeded());
- info.setRegistrationValidInternalState();
+ assertFalse(info.isModifyRegistrationNeeded());
+
+ register();
+
assertFalse(info.isModifiedSinceLastRefresh());
assertFalse(info.isModifyRegistrationNeeded());
List<Property> properties = info.getRegistrationData().getRegistrationProperties();
@@ -401,7 +458,7 @@
info.refresh(createServiceDescription(true, 1), producerId, true, true, false);
// simulate successful registration
- info.setRegistrationContext(WSRPTypeFactory.createRegistrationContext("handle"));
+ info.setRegistrationContext(FAKE_REGISTRATION_CONTEXT);
assertTrue(info.isRegistrationRequired());
assertTrue(info.isRegistrationValid());
@@ -422,7 +479,7 @@
public void testRefreshRegisteredWithoutPropsAndProducerNowSendsProps()
{
// simulate successful registration
- info.setRegistrationContext(WSRPTypeFactory.createRegistrationContext("handle"));
+ info.setRegistrationContext(FAKE_REGISTRATION_CONTEXT);
assertTrue(info.isRegistrationRequired());
assertTrue(info.isRegistrationValid());
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java 2010-02-13 03:41:18 UTC (rev 1668)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationPropertyTestCase.java 2010-02-13 11:18:05 UTC (rev 1669)
@@ -43,7 +43,7 @@
{
boolean called;
- public void propertyValueChanged(RegistrationProperty property, Object oldValue, Object newValue)
+ public void propertyValueChanged(RegistrationProperty property, RegistrationProperty.Status previousStatus, Object oldValue, Object newValue)
{
called = (prop == property) && VALUE.equals(oldValue) && NEW_VALUE.equals(newValue);
}
14 years, 11 months
gatein SVN: r1668 - in portal/trunk: component/scripting/src/test/java/org/exoplatform/groovyscript and 5 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-02-12 22:41:18 -0500 (Fri, 12 Feb 2010)
New Revision: 1668
Modified:
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/WriterGroovyPrinter.java
portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
portal/trunk/component/scripting/src/test/resources/UIPortalApplication.gtmpl
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/JavascriptManager.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplicationChildren.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
rewrite the inner of the JavascriptManager to use a List<String> instead of a StringBuilder providing less serialization and less object creation as the stream model can be optimized here
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/GroovyPrinter.java 2010-02-13 03:41:18 UTC (rev 1668)
@@ -104,6 +104,8 @@
}
}
+ protected abstract Writer getWriter();
+
protected abstract void write(char c) throws IOException;
protected abstract void write(String s) throws IOException;
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/OutputStreamWriterGroovyPrinter.java 2010-02-13 03:41:18 UTC (rev 1668)
@@ -23,6 +23,7 @@
import org.exoplatform.commons.utils.Text;
import java.io.IOException;
+import java.io.Writer;
import java.nio.charset.Charset;
/**
@@ -45,6 +46,12 @@
}
@Override
+ protected Writer getWriter()
+ {
+ return out;
+ }
+
+ @Override
protected void write(char c) throws IOException
{
out.write(c);
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/WriterGroovyPrinter.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/WriterGroovyPrinter.java 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/WriterGroovyPrinter.java 2010-02-13 03:41:18 UTC (rev 1668)
@@ -43,6 +43,12 @@
}
@Override
+ protected Writer getWriter()
+ {
+ return writer;
+ }
+
+ @Override
protected void write(char c) throws IOException
{
writer.write(c);
Modified: portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
===================================================================
--- portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-02-13 03:41:18 UTC (rev 1668)
@@ -23,9 +23,7 @@
import org.exoplatform.commons.utils.OutputStreamPrinter;
import java.awt.*;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.util.EmptyStackException;
import java.util.HashMap;
import java.util.Map;
@@ -245,6 +243,17 @@
assertLineNumber(1, "throw new Exception('d')", "<%;%>foo" + prolog + "throw new Exception('d')%>");
}
+ public static Object out;
+
+ public void testWriterAccess() throws Exception
+ {
+ out = null;
+ Writer writer = new StringWriter();
+ GroovyTemplate template = new GroovyTemplate("<% " + TestTemplateRendering.class.getName() + ".out = out; %>");
+ template.render(writer);
+ assertNotNull(out);
+ }
+
private void assertLineNumber(int expectedLineNumber, String expectedText, String script) throws TemplateCompilationException, IOException
{
GroovyTemplate template = new GroovyTemplate(script);
Modified: portal/trunk/component/scripting/src/test/resources/UIPortalApplication.gtmpl
===================================================================
--- portal/trunk/component/scripting/src/test/resources/UIPortalApplication.gtmpl 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/component/scripting/src/test/resources/UIPortalApplication.gtmpl 2010-02-13 03:41:18 UTC (rev 1668)
@@ -125,9 +125,9 @@
<script type="text/javascript">
- <%=rcontext.getJavascriptManager().getJavascript()%>
+ <% rcontext.getJavascriptManager().writeJavascript(out.writer) %>
eXo.core.Browser.onLoad();
- <%=rcontext.getJavascriptManager().getCustomizedOnLoadScript();%>
+ <% rcontext.getJavascriptManager().writeCustomizedOnLoadScript(out.writer); %>
<%if(canKeepState && uicomponent.isSessionOpen) {%> eXo.session.itvInit() ;<%}%>
</script>
</body>
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/application/JavascriptManager.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/application/JavascriptManager.java 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/application/JavascriptManager.java 2010-02-13 03:41:18 UTC (rev 1668)
@@ -23,6 +23,10 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.web.application.javascript.JavascriptConfigService;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+
/**
* Created by The eXo Platform SAS
* Mar 27, 2007
@@ -30,10 +34,13 @@
public class JavascriptManager
{
- private StringBuilder javascript = new StringBuilder(1000);
+ /** . */
+ private ArrayList<String> data = new ArrayList<String>(100);
- private StringBuilder customizedOnloadJavascript;
+ /** . */
+ private ArrayList<String> customizedOnloadJavascript = null;
+ /** . */
private JavascriptConfigService jsSrevice_;
public JavascriptManager()
@@ -45,61 +52,115 @@
public void addJavascript(CharSequence s)
{
- javascript.append(s).append(" \n");
+ if (s != null)
+ {
+ data.add(s instanceof String ? (String)s : s.toString());
+ data.add(" \n");
+ }
}
public void importJavascript(CharSequence s)
{
- if (!jsSrevice_.isModuleLoaded(s) || PropertyManager.isDevelopping())
+ if (s != null)
{
- javascript.append("eXo.require('").append(s).append("'); \n");
+ if (!jsSrevice_.isModuleLoaded(s) || PropertyManager.isDevelopping())
+ {
+ data.add("eXo.require('");
+ data.add(s instanceof String ? (String)s : s.toString());
+ data.add("'); \n");
+ }
}
}
public void importJavascript(String s, String location)
{
- if (!location.endsWith("/"))
- location = location + '/';
- if (!jsSrevice_.isModuleLoaded(s) || PropertyManager.isDevelopping())
+ if (s != null && location != null)
{
- javascript.append("eXo.require('").append(s).append("', '").append(location).append("'); \n");
+ if (!jsSrevice_.isModuleLoaded(s) || PropertyManager.isDevelopping())
+ {
+ data.add("eXo.require('");
+ data.add(s);
+ data.add("', '");
+ data.add(location);
+ if (!location.endsWith("/"))
+ {
+ data.add("/");
+ }
+ data.add("', '");
+ }
}
}
public void addOnLoadJavascript(CharSequence s)
{
- String id = Integer.toString(Math.abs(s.hashCode()));
- javascript.append("eXo.core.Browser.addOnLoadCallback('mid").append(id).append("',").append(s).append("); \n");
+ if (s != null)
+ {
+ String id = Integer.toString(Math.abs(s.hashCode()));
+ data.add("eXo.core.Browser.addOnLoadCallback('mid");
+ data.add(id);
+ data.add("',");
+ data.add(s instanceof String ? (String)s : s.toString());
+ data.add("); \n");
+ }
}
public void addOnResizeJavascript(CharSequence s)
{
- String id = Integer.toString(Math.abs(s.hashCode()));
- javascript.append("eXo.core.Browser.addOnResizeCallback('mid").append(id).append("',").append(s).append("); \n");
+ if (s != null)
+ {
+ String id = Integer.toString(Math.abs(s.hashCode()));
+ data.add("eXo.core.Browser.addOnResizeCallback('mid");
+ data.add(id);
+ data.add("',");
+ data.add(s instanceof String ? (String)s : s.toString());
+ data.add("); \n");
+ }
}
public void addOnScrollJavascript(CharSequence s)
{
- String id = Integer.toString(Math.abs(s.hashCode()));
- javascript.append("eXo.core.Browser.addOnScrollCallback('mid").append(id).append("',").append(s).append("); \n");
+ if (s != null)
+ {
+ String id = Integer.toString(Math.abs(s.hashCode()));
+ data.add("eXo.core.Browser.addOnScrollCallback('mid");
+ data.add(id);
+ data.add("',");
+ data.add(s instanceof String ? (String)s : s.toString());
+ data.add("); \n");
+ }
}
- public String getJavascript()
+ public void writeJavascript(Writer writer) throws IOException
{
- return javascript.toString();
+ for (int i = 0;i < data.size();i++)
+ {
+ String s = data.get(i);
+ writer.write(s);
+ }
}
public void addCustomizedOnLoadScript(CharSequence s)
{
- if (customizedOnloadJavascript == null)
- customizedOnloadJavascript = new StringBuilder();
- customizedOnloadJavascript.append(s).append("\n");
+ if (s != null)
+ {
+ if (customizedOnloadJavascript == null)
+ {
+ customizedOnloadJavascript = new ArrayList<String>(30);
+ }
+ customizedOnloadJavascript.add(s instanceof String ? (String)s : s.toString());
+ customizedOnloadJavascript.add("\n");
+ }
}
- public String getCustomizedOnLoadScript()
+ public void writeCustomizedOnLoadScript(Writer writer) throws IOException
{
- if (customizedOnloadJavascript == null)
- return "";
- return customizedOnloadJavascript.toString();
+ if (customizedOnloadJavascript != null)
+ {
+ for (int i = 0;i < customizedOnloadJavascript.size();i++)
+ {
+ String s = customizedOnloadJavascript.get(i);
+ writer.write(s);
+ }
+ }
}
}
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-02-13 03:41:18 UTC (rev 1668)
@@ -230,12 +230,13 @@
{
allJavascript.append(script);
}
+ String s = allJavascript.toString();
// Get bytes
byte[] bytes;
try
{
- bytes = allJavascript.toString().getBytes("UTF-8");
+ bytes = s.getBytes("UTF-8");
}
catch (UnsupportedEncodingException e)
{
Modified: portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplicationChildren.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplicationChildren.gtmpl 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplicationChildren.gtmpl 2010-02-13 03:41:18 UTC (rev 1668)
@@ -25,9 +25,11 @@
<%uicomponent.renderChildren();%>
</div>
<script type="text/javascript">
- <%=rcontext.getJavascriptManager().getJavascript()%>
+
+ <%rcontext.getJavascriptManager().writeJavascript(out.writer)%>
+
eXo.core.Browser.onLoad();
- <%=rcontext.getJavascriptManager().getCustomizedOnLoadScript();%>
+ <% rcontext.getJavascriptManager().writeCustomizedOnLoadScript(out.writer); %>
<%if(canKeepState && uicomponent.isSessionOpen) {%> eXo.session.itvInit() ;<%}%>
</script>
</body>
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-02-13 03:23:56 UTC (rev 1667)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-02-13 03:41:18 UTC (rev 1668)
@@ -602,9 +602,9 @@
}
w.write("<div class=\"PortalResponseScript\">");
- w.write(pcontext.getJavascriptManager().getJavascript());
+ pcontext.getJavascriptManager().writeJavascript(w);
w.write("eXo.core.Browser.onLoad();\n");
- w.write(pcontext.getJavascriptManager().getCustomizedOnLoadScript());
+ pcontext.getJavascriptManager().writeCustomizedOnLoadScript(w);
String skin = getAddSkinScript(list);
if (skin != null)
{
14 years, 11 months
gatein SVN: r1667 - portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-02-12 22:23:56 -0500 (Fri, 12 Feb 2010)
New Revision: 1667
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIForm.js
Log:
fix bad char (that seems like a whitespace) data that cause javascript runtime issue
Modified: portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIForm.js
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIForm.js 2010-02-13 01:41:02 UTC (rev 1666)
+++ portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIForm.js 2010-02-13 03:23:56 UTC (rev 1667)
@@ -151,7 +151,7 @@
break;
case "select-multiple":
for(var j = 0; j < element.options.length; j++) {
- if(element.options[j].selected) this.addField(element.name, element.options[j].value);
+ if(element.options[j].selected) this.addField(element.name, element.options[j].value);
}
break;
} // switch
14 years, 11 months
gatein SVN: r1666 - in portal/trunk/component/resources/src: main/java/org/exoplatform/services/resources/impl and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-02-12 20:41:02 -0500 (Fri, 12 Feb 2010)
New Revision: 1666
Modified:
portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java
portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java
portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java
portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java
Log:
move the code from ExoResourceBundle to ResourceBundleData as the RBD is cached in order to avoid the same computation to happen again and again and create object and consume CPU cycle contributing to global warmup
Modified: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java 2010-02-13 00:59:26 UTC (rev 1665)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java 2010-02-13 01:41:02 UTC (rev 1666)
@@ -40,36 +40,26 @@
public class ExoResourceBundle extends ListResourceBundle implements Serializable
{
- private static Pattern LINE_SEPARATOR = Pattern.compile("[\\r]?\\n");
+ /** . */
+ private final ResourceBundleData data;
- private static Pattern UNICODE_CHARACTER = Pattern.compile("\\\\u[\\p{XDigit}]{4}+");
-
- private Object[][] contents;
-
public ExoResourceBundle(String data)
{
- String[] tokens = LINE_SEPARATOR.split(data);
- List<String[]> properties = new ArrayList<String[]>();
- for (String token : tokens)
+ this.data = new ResourceBundleData(data);
+ }
+
+ public ExoResourceBundle(ResourceBundleData data)
+ {
+ if (data == null)
{
- int idx = token.indexOf('=');
- if (idx < 0 || idx >= token.length() - 1)
- {
- continue;
- }
- String key = token.substring(0, idx);
- if (key.trim().startsWith("#"))
- {
- continue;
- }
- String value = convert(token.substring(idx + 1, token.length()));
- properties.add(new String[]{key, value});
+ throw new NullPointerException();
}
- String[][] aProperties = new String[properties.size()][2];
- contents = (String[][])properties.toArray(aProperties);
+
+ //
+ this.data = data;
}
- public ExoResourceBundle(String data, ResourceBundle parent)
+ public ExoResourceBundle(ResourceBundleData data, ResourceBundle parent)
{
this(data);
setParent(parent);
@@ -77,7 +67,7 @@
public Object[][] getContents()
{
- return contents;
+ return data.contents;
}
public void putAll(Map<? super Object, ? super Object> map)
@@ -93,69 +83,4 @@
}
}
- static String convert(String content)
- {
- Matcher matcher = UNICODE_CHARACTER.matcher(content);
- StringBuilder buffer = new StringBuilder(content.length());
- int start = 0;
- while (matcher.find(start))
- {
- buffer.append(content.substring(start, matcher.start()));
- buffer.append(unicode2Char(matcher.group()));
- start = matcher.end();
- }
- if (start >= 0 && start < content.length())
- {
- buffer.append(content.substring(start));
- }
- return buffer.toString();
- }
-
- static char unicode2Char(String unicodeChar)
- {
- int value = 0;
- char aChar;
- for (int i = 0; i < 4; i++)
- {
- aChar = unicodeChar.charAt(i + 2);
- switch (aChar)
- {
- case '0' :
- case '1' :
- case '2' :
- case '3' :
- case '4' :
- case '5' :
- case '6' :
- case '7' :
- case '8' :
- case '9' : {
- value = (value << 4) + aChar - '0';
- break;
- }
- case 'a' :
- case 'b' :
- case 'c' :
- case 'd' :
- case 'e' :
- case 'f' : {
- value = (value << 4) + 10 + aChar - 'a';
- break;
- }
- case 'A' :
- case 'B' :
- case 'C' :
- case 'D' :
- case 'E' :
- case 'F' : {
- value = (value << 4) + 10 + aChar - 'A';
- break;
- }
- default : {
- throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
- }
- }
- }
- return (char)value;
- }
}
Modified: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java 2010-02-13 00:59:26 UTC (rev 1665)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java 2010-02-13 01:41:02 UTC (rev 1666)
@@ -20,6 +20,10 @@
package org.exoplatform.services.resources;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Created by The eXo Platform SAS . Author : Tuan Nguyen
@@ -29,25 +33,131 @@
public class ResourceBundleData extends ResourceBundleDescription implements Serializable
{
- private String data_;
+ /** . */
+ private static Pattern LINE_SEPARATOR = Pattern.compile("[\\r]?\\n");
- public ResourceBundleData()
+ /** . */
+ private static Pattern UNICODE_CHARACTER = Pattern.compile("\\\\u[\\p{XDigit}]{4}+");
+
+ /** . */
+ private String data;
+
+ /** . */
+ Object[][] contents;
+
+ public ResourceBundleData(String data)
{
+ setData(data);
setResourceType("-");
setLanguage(DEFAULT_LANGUAGE);
}
- /**
- * @hibernate.property length="65535"
- * type="org.exoplatform.services.database.impl.TextClobType"
- **/
+ public ResourceBundleData()
+ {
+ this(null);
+ }
+
public String getData()
{
- return data_;
+ return data;
}
public void setData(String data)
{
- data_ = data;
+ this.data = data;
+
+ if (data != null)
+ {
+ String[] tokens = LINE_SEPARATOR.split(data);
+ List<String[]> properties = new ArrayList<String[]>();
+ for (String token : tokens)
+ {
+ int idx = token.indexOf('=');
+ if (idx < 0 || idx >= token.length() - 1)
+ {
+ continue;
+ }
+ String key = token.substring(0, idx);
+ if (key.trim().startsWith("#"))
+ {
+ continue;
+ }
+ String value = convert(token.substring(idx + 1, token.length()));
+ properties.add(new String[]{key, value});
+ }
+ String[][] aProperties = new String[properties.size()][2];
+ contents = properties.toArray(aProperties);
+ }
+ else
+ {
+ contents = new Object[0][];
+ }
+
}
+
+ static String convert(String content)
+ {
+ Matcher matcher = UNICODE_CHARACTER.matcher(content);
+ StringBuilder buffer = new StringBuilder(content.length());
+ int start = 0;
+ while (matcher.find(start))
+ {
+ buffer.append(content.substring(start, matcher.start()));
+ buffer.append(unicode2Char(matcher.group()));
+ start = matcher.end();
+ }
+ if (start >= 0 && start < content.length())
+ {
+ buffer.append(content.substring(start));
+ }
+ return buffer.toString();
+ }
+
+ static char unicode2Char(String unicodeChar)
+ {
+ int value = 0;
+ char aChar;
+ for (int i = 0; i < 4; i++)
+ {
+ aChar = unicodeChar.charAt(i + 2);
+ switch (aChar)
+ {
+ case '0' :
+ case '1' :
+ case '2' :
+ case '3' :
+ case '4' :
+ case '5' :
+ case '6' :
+ case '7' :
+ case '8' :
+ case '9' : {
+ value = (value << 4) + aChar - '0';
+ break;
+ }
+ case 'a' :
+ case 'b' :
+ case 'c' :
+ case 'd' :
+ case 'e' :
+ case 'f' : {
+ value = (value << 4) + 10 + aChar - 'a';
+ break;
+ }
+ case 'A' :
+ case 'B' :
+ case 'C' :
+ case 'D' :
+ case 'E' :
+ case 'F' : {
+ value = (value << 4) + 10 + aChar - 'A';
+ break;
+ }
+ default : {
+ throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
+ }
+ }
+ }
+ return (char)value;
+ }
}
Modified: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java 2010-02-13 00:59:26 UTC (rev 1665)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java 2010-02-13 01:41:02 UTC (rev 1666)
@@ -30,7 +30,6 @@
import org.exoplatform.services.resources.LocaleConfigService;
import org.exoplatform.services.resources.Query;
import org.exoplatform.services.resources.ResourceBundleData;
-import org.exoplatform.services.resources.impl.BaseResourceBundleService;
import java.util.ArrayList;
import java.util.Collections;
@@ -141,6 +140,6 @@
{
return null;
}
- return new MapResourceBundle(new ExoResourceBundle(data.getData(), parent), locale);
+ return new MapResourceBundle(new ExoResourceBundle(data, parent), locale);
}
}
\ No newline at end of file
Modified: portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java
===================================================================
--- portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java 2010-02-13 00:59:26 UTC (rev 1665)
+++ portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java 2010-02-13 01:41:02 UTC (rev 1666)
@@ -65,20 +65,20 @@
{
value = "0" + value;
}
- assertEquals((char)i, ExoResourceBundle.unicode2Char("\\u" + value));
+ assertEquals((char)i, ResourceBundleData.unicode2Char("\\u" + value));
}
}
public void testConvert()
{
- assertEquals("Normal Value", ExoResourceBundle.convert("Normal Value"));
- assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ExoResourceBundle
+ assertEquals("Normal Value", ResourceBundleData.convert("Normal Value"));
+ assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ResourceBundleData
.convert("\\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5"));
- assertEquals("before \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ExoResourceBundle
+ assertEquals("before \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ResourceBundleData
.convert("before \\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5"));
- assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5 after", ExoResourceBundle
+ assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5 after", ResourceBundleData
.convert("\\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5 after"));
- assertEquals("before \u00E9\u00E7\u00E0 between \u00F9\u0194\u0BF5 after", ExoResourceBundle
+ assertEquals("before \u00E9\u00E7\u00E0 between \u00F9\u0194\u0BF5 after", ResourceBundleData
.convert("before \\u00E9\\u00E7\\u00E0 between \\u00F9\\u0194\\u0BF5 after"));
}
}
14 years, 11 months
gatein SVN: r1665 - in portal/trunk: webui/portal/src/main/java/org/exoplatform/portal/webui/javascript and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-02-12 19:59:26 -0500 (Fri, 12 Feb 2010)
New Revision: 1665
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java
Log:
- DO NOT CALL ByteArrayOutputStream#toByteArray() on every call to JavascriptConfigService.getMergedJavascript() as this is non sense, basically it does:
public synchronized byte toByteArray()[] {
return Arrays.copyOf(buf, count);
}
which means:
1/ unecessary contention
2/ unecessary serialization
3/ unecessary memory allocation (and thus unecessary garbage collector activity)
- added a reminder for later
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-02-12 22:48:43 UTC (rev 1664)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-02-13 00:59:26 UTC (rev 1665)
@@ -21,12 +21,12 @@
import org.exoplatform.commons.utils.Safe;
import org.exoplatform.container.ExoContainerContext;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.gatein.wci.impl.DefaultServletContainerFactory;
import org.picocontainer.Startable;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import java.io.*;
import java.util.*;
import javax.servlet.ServletContext;
@@ -34,6 +34,9 @@
public class JavascriptConfigService implements Startable
{
+ /** Our logger. */
+ private final Logger log = LoggerFactory.getLogger(JavascriptConfigService.class);
+
private Collection<String> availableScripts_;
private Collection<String> availableScriptsPaths_;
@@ -44,7 +47,7 @@
private HashMap<String, String> extendedJavascripts;
- private ByteArrayOutputStream jsStream_ = null;
+ private byte[] jsBytes = null;
/** . */
private JavascriptDeployer deployer;
@@ -210,29 +213,53 @@
mergedJavascript = buffer.toString();
}
- public byte[] getMergedJavascript()
+ /**
+ * Write the merged javascript in a provided output stream.
+ *
+ * @param out the output stream
+ * @throws IOException any io exception
+ */
+ public void writeMergedJavascript(OutputStream out) throws IOException
{
- if (jsStream_ == null)
+ if (jsBytes == null)
{
- jsStream_ = new ByteArrayOutputStream();
+ // Generate javascript in a buffer
StringBuffer allJavascript = new StringBuffer();
allJavascript.append(mergedJavascript);
for (String script : extendedJavascripts.values())
{
allJavascript.append(script);
}
- ByteArrayInputStream input = new ByteArrayInputStream(allJavascript.toString().getBytes());
- JSMin jsMin = new JSMin(input, jsStream_);
+
+ // Get bytes
+ byte[] bytes;
try
{
+ bytes = allJavascript.toString().getBytes("UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new AssertionError("No access to UTF-8, e");
+ }
+
+ // Minify
+ try
+ {
+ ByteArrayInputStream input = new ByteArrayInputStream(bytes);
+ ByteArrayOutputStream jsStream = new ByteArrayOutputStream();
+ JSMin jsMin = new JSMin(input, jsStream);
jsMin.jsmin();
+ jsBytes = jsStream.toByteArray();
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error("Error when generating minified javascript, will use normal javascript instead", e);
+ jsBytes = bytes;
}
}
- return jsStream_.toByteArray();
+
+ //
+ out.write(jsBytes);
}
public boolean isModuleLoaded(CharSequence module)
@@ -247,7 +274,7 @@
String path = "/" + servletContextName + scriptPath;
availableScriptsPaths_.remove(path);
extendedJavascripts.remove(path);
- jsStream_ = null;
+ jsBytes = null;
}
public void start()
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java 2010-02-12 22:48:43 UTC (rev 1664)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/javascript/JavascriptServlet.java 2010-02-13 00:59:26 UTC (rev 1665)
@@ -58,9 +58,11 @@
JavascriptConfigService service =
(JavascriptConfigService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
JavascriptConfigService.class);
+
+ // Julien: should we also set charset along with the content type ?
response.setContentType("application/x-javascript");
ServletOutputStream stream = response.getOutputStream();
- stream.write(service.getMergedJavascript());
+ service.writeMergedJavascript(stream);
}
}
14 years, 11 months
gatein SVN: r1664 - in portal/trunk: web/portal/src/main/webapp/WEB-INF/conf/organization and 2 other directories.
by do-not-reply@jboss.org
Author: bdaw
Date: 2010-02-12 17:48:43 -0500 (Fri, 12 Feb 2010)
New Revision: 1664
Added:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml
Removed:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-ldap-config.xml
Modified:
portal/trunk/pom.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
Log:
- PLIDM 1.1.0.Beta5
- another active directory sample configuration
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2010-02-12 16:25:26 UTC (rev 1663)
+++ portal/trunk/pom.xml 2010-02-12 22:48:43 UTC (rev 1664)
@@ -47,7 +47,7 @@
<org.gatein.common.version>2.0.0-CR03</org.gatein.common.version>
<org.gatein.wci.version>2.0.0-CR02</org.gatein.wci.version>
<org.gatein.pc.version>2.1.0-CR02</org.gatein.pc.version>
- <org.picketlink.idm>1.1.0.Beta4</org.picketlink.idm>
+ <org.picketlink.idm>1.1.0.Beta5</org.picketlink.idm>
<org.gatein.wsrp.version>1.0.0-Beta06</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.0-Beta16</org.gatein.mop.version>
<org.slf4j.version>1.5.6</org.slf4j.version>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2010-02-12 16:25:26 UTC (rev 1663)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2010-02-12 22:48:43 UTC (rev 1664)
@@ -56,13 +56,17 @@
<value>war:/conf/organization/picketlink-idm/picketlink-idm-config.xml</value>
<!--Sample LDAP config-->
- <!--<value>war:/conf/organization/picketlink-idm/picketlink-idm-ldap-config.xml</value>-->
+ <!--<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml</value>-->
<!--ACME LDAP Example-->
<!--<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-acme-config.xml</value>-->
+ <!--MSAD LDAP Example-->
+ <!--<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml</value>-->
+
<!--MSAD Read Only LDAP Example-->
<!--<value>war:/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml</value>-->
+
</value-param>
<value-param>
<name>portalRealm</name>
Copied: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml (from rev 1655, portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-ldap-config.xml)
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml (rev 0)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-ldap-config.xml 2010-02-12 22:48:43 UTC (rev 1664)
@@ -0,0 +1,299 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ 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.
+
+-->
+
+<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_ga"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_ga identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm</id>
+ <repository-id-ref>PortalRepository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm_portal</id>
+ <repository-id-ref>PortalRepository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm_sample-portal</id>
+ <repository-id-ref>SamplePortalRepository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>PortalRepository</id>
+ <class>org.picketlink.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>HibernateStore</default-identity-store-id>
+ <default-attribute-store-id>HibernateStore</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>PortalLDAPStore</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>platform_type</identity-object-type>
+ <identity-object-type>organization_type</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>SamplePortalRepository</id>
+ <class>org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>HibernateStore</default-identity-store-id>
+ <default-attribute-store-id>HibernateStore</default-attribute-store-id>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>HibernateStore</id>
+ <class>org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ <relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>hibernateSessionFactoryRegistryName</name>
+ <value>hibernateSessionFactory</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowNotDefinedIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>isRealmAware</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>PortalLDAPStore</id>
+ <class>org.picketlink.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>passwordAttributeName</name>
+ <value>userPassword</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=portal,o=gatein,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>platform_type</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>platform_type</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Platform,o=portal,o=gatein,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>parentMembershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isParentMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>organization_type</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>organization_type</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Organization,o=portal,o=gatein,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>parentMembershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isParentMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:1389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ <option>
+ <name>createMissingContexts</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Copied: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml (from rev 1656, portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-readonly-config.xml)
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml (rev 0)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/examples/picketlink-idm-msad-config.xml 2010-02-12 22:48:43 UTC (rev 1664)
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ 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.
+
+-->
+
+<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_ga"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_ga identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm</id>
+ <repository-id-ref>PortalRepository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm_portal</id>
+ <repository-id-ref>PortalRepository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ <realm>
+ <id>realm_sample-portal</id>
+ <repository-id-ref>SamplePortalRepository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>PortalRepository</id>
+ <class>org.picketlink.idm.impl.repository.FallbackIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>HibernateStore</default-identity-store-id>
+ <default-attribute-store-id>HibernateStore</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>PortalLDAPStore</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>USER</identity-object-type>
+ <identity-object-type>platform_type</identity-object-type>
+ <identity-object-type>organization_type</identity-object-type>
+ </identity-object-types>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id>SamplePortalRepository</id>
+ <class>org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>HibernateStore</default-identity-store-id>
+ <default-attribute-store-id>HibernateStore</default-attribute-store-id>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>HibernateStore</id>
+ <class>org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ <relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>hibernateSessionFactoryRegistryName</name>
+ <value>hibernateSessionFactory</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowNotDefinedIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>isRealmAware</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>PortalLDAPStore</id>
+ <class>org.picketlink.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>firstName</name>
+ <mapping>givenName</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>lastName</name>
+ <mapping>sn</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ <attribute>
+ <name>email</name>
+ <mapping>mail</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ <isUnique>true</isUnique>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>entrySearchFilter</name>
+ <value><![CDATA[(&(cn={0})(objectClass=User))]]></value>
+ </option>
+ <option>
+ <name>passwordAttributeName</name>
+ <value>unicodePwd</value>
+ </option>
+ <option>
+ <name>enclosePasswordWith</name>
+ <value>"</value>
+ </option>
+ <option>
+ <name>passwordEncoding</name>
+ <value>UTF-16LE</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=gatein,dc=test,dc=domain</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>userAccountControl=514</value>
+ </option>
+ <option>
+ <name>passwordUpdateAttributeValues</name>
+ <value>userAccountControl=512</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>platform_type</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>platform_type</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Platform,o=gatein,dc=test,dc=domain</value>
+ </option>
+ <option>
+ <name>entrySearchFilter</name>
+ <value><![CDATA[(&(cn={0})(objectClass=group))]]></value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>parentMembershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isParentMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=group</value>
+ <value>groupType=8</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>organization_type</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>organization_type</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Organization,o=gatein,dc=test,dc=domain</value>
+ </option>
+ <option>
+ <name>entrySearchFilter</name>
+ <value><![CDATA[(&(cn={0})(objectClass=group))]]></value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>parentMembershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isParentMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=group</value>
+ <value>groupType=8</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldaps://192.168.0.12:636</value>
+ </option>
+ <!--<option>-->
+ <!--<name>providerURL</name>-->
+ <!--<value>ldaps://msad-host:636</value>-->
+ <!--</option>-->
+ <option>
+ <name>adminDN</name>
+ <value>TEST\Administrator</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>!Q@W3e4r</value>
+ </option>
+ <option>
+ <name>authenticationMethod</name>
+ <value>simple</value>
+ </option>
+ <option>
+ <name>customSystemProperties</name>
+ <value>javax.net.ssl.trustStore=/Users/bdaw/Workshop/msad.truststore</value>
+ <value>javax.net.ssl.trustStorePassword=password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ <option>
+ <name>createMissingContexts</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Deleted: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-ldap-config.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-ldap-config.xml 2010-02-12 16:25:26 UTC (rev 1663)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-ldap-config.xml 2010-02-12 22:48:43 UTC (rev 1664)
@@ -1,299 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2009 eXo Platform SAS.
-
- 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.
-
--->
-
-<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_ga"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_ga identity-config.xsd">
- <realms>
- <realm>
- <id>realm</id>
- <repository-id-ref>PortalRepository</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm_portal</id>
- <repository-id-ref>PortalRepository</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- <realm>
- <id>realm_sample-portal</id>
- <repository-id-ref>SamplePortalRepository</repository-id-ref>
- <identity-type-mappings>
- <user-mapping>USER</user-mapping>
- </identity-type-mappings>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id>PortalRepository</id>
- <class>org.picketlink.idm.impl.repository.FallbackIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>HibernateStore</default-identity-store-id>
- <default-attribute-store-id>HibernateStore</default-attribute-store-id>
- <identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>PortalLDAPStore</identity-store-id>
- <identity-object-types>
- <identity-object-type>USER</identity-object-type>
- <identity-object-type>platform_type</identity-object-type>
- <identity-object-type>organization_type</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- </options>
- </repository>
- <repository>
- <id>SamplePortalRepository</id>
- <class>org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository</class>
- <external-config/>
- <default-identity-store-id>HibernateStore</default-identity-store-id>
- <default-attribute-store-id>HibernateStore</default-attribute-store-id>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>HibernateStore</id>
- <class>org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
- <external-config/>
- <supported-relationship-types>
- <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
- <relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>USER</name>
- <relationships/>
- <credentials>
- <credential-type>PASSWORD</credential-type>
- </credentials>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>hibernateSessionFactoryRegistryName</name>
- <value>hibernateSessionFactory</value>
- </option>
- <option>
- <name>populateRelationshipTypes</name>
- <value>true</value>
- </option>
- <option>
- <name>populateIdentityObjectTypes</name>
- <value>true</value>
- </option>
- <option>
- <name>allowNotDefinedIdentityObjectTypes</name>
- <value>true</value>
- </option>
- <option>
- <name>allowNotDefinedAttributes</name>
- <value>true</value>
- </option>
- <option>
- <name>isRealmAware</name>
- <value>true</value>
- </option>
- </options>
- </identity-store>
- <identity-store>
- <id>PortalLDAPStore</id>
- <class>org.picketlink.idm.impl.store.ldap.LDAPIdentityStoreImpl</class>
- <external-config/>
- <supported-relationship-types>
- <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>USER</name>
- <relationships/>
- <credentials>
- <credential-type>PASSWORD</credential-type>
- </credentials>
- <attributes>
- </attributes>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>uid</value>
- </option>
- <option>
- <name>passwordAttributeName</name>
- <value>userPassword</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=People,o=portal,o=gatein,dc=example,dc=com</value>
- </option>
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=inetOrgPerson</value>
- <value>sn= </value>
- <value>cn= </value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>platform_type</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>platform_type</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Platform,o=portal,o=gatein,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>parentMembershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isParentMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>organization_type</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>USER</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>organization_type</identity-object-type-ref>
- </relationship>
- </relationships>
- <credentials/>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Organization,o=portal,o=gatein,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>parentMembershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isParentMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>providerURL</name>
- <value>ldap://localhost:1389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>password</value>
- </option>
- <option>
- <name>searchTimeLimit</name>
- <value>10000</value>
- </option>
- <option>
- <name>createMissingContexts</name>
- <value>true</value>
- </option>
- </options>
- </identity-store>
- </identity-stores>
- </stores>
-</jboss-identity>
\ No newline at end of file
14 years, 11 months
gatein SVN: r1663 - portal/trunk/testsuite/selenium-snifftests.
by do-not-reply@jboss.org
Author: dbaeli
Date: 2010-02-12 11:25:26 -0500 (Fri, 12 Feb 2010)
New Revision: 1663
Modified:
portal/trunk/testsuite/selenium-snifftests/Readme.txt
portal/trunk/testsuite/selenium-snifftests/pom.xml
Log:
GTNPORTAL-548 allow selenium.port and selenium.browser properties to change the communication port, and the client browser
Modified: portal/trunk/testsuite/selenium-snifftests/Readme.txt
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/Readme.txt 2010-02-12 14:47:27 UTC (rev 1662)
+++ portal/trunk/testsuite/selenium-snifftests/Readme.txt 2010-02-12 16:25:26 UTC (rev 1663)
@@ -8,6 +8,12 @@
* Launch the tests:
** mvn install -Pselenium to run the html recorded Scripts generated in Java during the process
+Changing the port (JBoss is using 4444 in default config):
+** mvn install -Pselenium -Dselenium.port=6666
+
+Changing the browser (firefox, safari, iexplorer, opera):
+** mvn install -Pselenium -Dselenium.browser=safari
+
From Eclipse:
* Start a GateIn server (Tomcat or JBoss)
* Start the Selenium server ( GateIn server (Tomcat or JBoss)
@@ -63,3 +69,4 @@
Then in this project you can force the use of those versions:
* mvn install -Pselenium -Denforcer.skip=true -Dorg.selenium.maven-plugin.version=1.1-SNAPSHOT -Dorg.selenium.server.version=1.0.2-SNAPSHOT
* mvn eclipse:eclipse -Pselenium -Denforcer.skip=true -Dorg.selenium.maven-plugin.version=1.1-SNAPSHOT -Dorg.selenium.server.version=1.0.2-SNAPSHOT
+
Modified: portal/trunk/testsuite/selenium-snifftests/pom.xml
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/pom.xml 2010-02-12 14:47:27 UTC (rev 1662)
+++ portal/trunk/testsuite/selenium-snifftests/pom.xml 2010-02-12 16:25:26 UTC (rev 1663)
@@ -14,9 +14,11 @@
<properties>
<org.selenium.server.version>1.0.1</org.selenium.server.version>
+ <selenium.port>4444</selenium.port>
+ <selenium.browser>firefox</selenium.browser>
<org.selenium.maven-plugin.version>1.0</org.selenium.maven-plugin.version>
</properties>
-
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -106,6 +108,7 @@
<logFile>${project.build.directory}/server.log</logFile>
<logOutput>true</logOutput>
<userExtensions>${pom.basedir}/src/suite/user-extensions.js</userExtensions>
+ <port>${selenium.port}</port>
</configuration>
</execution>
</executions>
@@ -123,8 +126,20 @@
<configuration>
<skip>false</skip>
<!--
- <includes><include>**/Test_SNF_PRL_26.java</include></includes>
-->
+ <includes>
+ <include>**/Test_UserExtensions.java</include>
+ </includes>
+ <systemProperties>
+ <property>
+ <name>selenium.port</name>
+ <value>${selenium.port}</value>
+ </property>
+ <property>
+ <name>selenium.browser</name>
+ <value>${selenium.browser}</value>
+ </property>
+ </systemProperties>
</configuration>
</execution>
</executions>
14 years, 11 months