gatein SVN: r1322 - in components/wsrp/trunk: admin-gui and 7 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-01-15 17:05:56 -0500 (Fri, 15 Jan 2010)
New Revision: 1322
Modified:
components/wsrp/trunk/admin-gui/pom.xml
components/wsrp/trunk/api/pom.xml
components/wsrp/trunk/common/pom.xml
components/wsrp/trunk/consumer/pom.xml
components/wsrp/trunk/pom.xml
components/wsrp/trunk/producer/pom.xml
components/wsrp/trunk/test/pom.xml
components/wsrp/trunk/wsrp-producer-war/pom.xml
components/wsrp/trunk/wsrp1-ws/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: components/wsrp/trunk/admin-gui/pom.xml
===================================================================
--- components/wsrp/trunk/admin-gui/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/admin-gui/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-admin-gui</artifactId>
Modified: components/wsrp/trunk/api/pom.xml
===================================================================
--- components/wsrp/trunk/api/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/api/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-integration-api</artifactId>
Modified: components/wsrp/trunk/common/pom.xml
===================================================================
--- components/wsrp/trunk/common/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/common/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-common</artifactId>
Modified: components/wsrp/trunk/consumer/pom.xml
===================================================================
--- components/wsrp/trunk/consumer/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/consumer/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-consumer</artifactId>
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -29,7 +29,7 @@
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
<packaging>pom</packaging>
@@ -40,9 +40,9 @@
</parent>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/tags/1.0.0-...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/tags/1.0.0-Beta05</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/tags/1.0.0-Beta05</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/trunk/</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/trunk/</url>
</scm>
<properties>
Modified: components/wsrp/trunk/producer/pom.xml
===================================================================
--- components/wsrp/trunk/producer/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/producer/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-producer-lib</artifactId>
Modified: components/wsrp/trunk/test/pom.xml
===================================================================
--- components/wsrp/trunk/test/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/test/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: components/wsrp/trunk/wsrp-producer-war/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: components/wsrp/trunk/wsrp1-ws/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp1-ws/pom.xml 2010-01-15 22:05:32 UTC (rev 1321)
+++ components/wsrp/trunk/wsrp1-ws/pom.xml 2010-01-15 22:05:56 UTC (rev 1322)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05</version>
+ <version>1.0.0-Beta06-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-wsrp1-ws</artifactId>
15 years
gatein SVN: r1321 - components/wsrp/tags.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-01-15 17:05:32 -0500 (Fri, 15 Jan 2010)
New Revision: 1321
Added:
components/wsrp/tags/1.0.0-Beta05/
Log:
[maven-scm] copy for tag 1.0.0-Beta05
Copied: components/wsrp/tags/1.0.0-Beta05 (from rev 1320, components/wsrp/trunk)
15 years
gatein SVN: r1320 - in components/wsrp/trunk: admin-gui and 7 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-01-15 17:05:01 -0500 (Fri, 15 Jan 2010)
New Revision: 1320
Modified:
components/wsrp/trunk/admin-gui/pom.xml
components/wsrp/trunk/api/pom.xml
components/wsrp/trunk/common/pom.xml
components/wsrp/trunk/consumer/pom.xml
components/wsrp/trunk/pom.xml
components/wsrp/trunk/producer/pom.xml
components/wsrp/trunk/test/pom.xml
components/wsrp/trunk/wsrp-producer-war/pom.xml
components/wsrp/trunk/wsrp1-ws/pom.xml
Log:
[maven-release-plugin] prepare release 1.0.0-Beta05
Modified: components/wsrp/trunk/admin-gui/pom.xml
===================================================================
--- components/wsrp/trunk/admin-gui/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/admin-gui/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-admin-gui</artifactId>
Modified: components/wsrp/trunk/api/pom.xml
===================================================================
--- components/wsrp/trunk/api/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/api/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-integration-api</artifactId>
Modified: components/wsrp/trunk/common/pom.xml
===================================================================
--- components/wsrp/trunk/common/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/common/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-common</artifactId>
Modified: components/wsrp/trunk/consumer/pom.xml
===================================================================
--- components/wsrp/trunk/consumer/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/consumer/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-consumer</artifactId>
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -29,7 +29,7 @@
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
<packaging>pom</packaging>
@@ -40,9 +40,9 @@
</parent>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/trunk/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/trunk/</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/trunk/</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/wsrp/tags/1.0.0-...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/wsrp/tags/1.0.0-Beta05</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/wsrp/tags/1.0.0-Beta05</url>
</scm>
<properties>
Modified: components/wsrp/trunk/producer/pom.xml
===================================================================
--- components/wsrp/trunk/producer/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/producer/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-producer-lib</artifactId>
Modified: components/wsrp/trunk/test/pom.xml
===================================================================
--- components/wsrp/trunk/test/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/test/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: components/wsrp/trunk/wsrp-producer-war/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/wsrp-producer-war/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: components/wsrp/trunk/wsrp1-ws/pom.xml
===================================================================
--- components/wsrp/trunk/wsrp1-ws/pom.xml 2010-01-15 18:46:42 UTC (rev 1319)
+++ components/wsrp/trunk/wsrp1-ws/pom.xml 2010-01-15 22:05:01 UTC (rev 1320)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
- <version>1.0.0-Beta05-SNAPSHOT</version>
+ <version>1.0.0-Beta05</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wsrp-wsrp1-ws</artifactId>
15 years
gatein SVN: r1319 - in portal/trunk: component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/mapping and 3 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-15 13:46:42 -0500 (Fri, 15 Jan 2010)
New Revision: 1319
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/mapping/RegistrationRequirementsMapping.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml
Log:
- Properly set the persistent key on RegistrationPropertyDescription.
- Added persistence of policy and validator class names and fixed persistence of registration properties on RegistrationRequirementsMapping.
- Removed non-working management of registration properties from producer configuration UI. :(
- Fixed mapping errors in nodetypes for producer configuration.
Modified: portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java
===================================================================
--- portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java 2010-01-15 16:27:37 UTC (rev 1318)
+++ portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java 2010-01-15 18:46:42 UTC (rev 1319)
@@ -23,6 +23,7 @@
package org.gatein.portal.wsrp.state.mapping;
+import org.chromattic.api.annotations.Id;
import org.chromattic.api.annotations.PrimaryType;
import org.chromattic.api.annotations.Property;
import org.gatein.common.util.ParameterValidation;
@@ -40,6 +41,9 @@
{
public static final String NODE_NAME = "wsrp:registrationpropertydescription";
+ @Id
+ public abstract String getPersistentKey();
+
@Property(name = "name")
public abstract String getName(); // todo: this should really be a QName
@@ -92,6 +96,8 @@
public RegistrationPropertyDescription toRegistrationPropertyDescription()
{
RegistrationPropertyDescription desc = new RegistrationPropertyDescription(getName(), QName.valueOf(getType()));
+ desc.setPersistentKey(getPersistentKey());
+
String description = getDescription();
if (!ParameterValidation.isNullOrEmpty(description))
{
Modified: portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/mapping/RegistrationRequirementsMapping.java
===================================================================
--- portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/mapping/RegistrationRequirementsMapping.java 2010-01-15 16:27:37 UTC (rev 1318)
+++ portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/mapping/RegistrationRequirementsMapping.java 2010-01-15 18:46:42 UTC (rev 1319)
@@ -23,10 +23,13 @@
package org.gatein.portal.wsrp.state.producer.configuration.mapping;
import org.chromattic.api.annotations.Create;
+import org.chromattic.api.annotations.FindById;
+import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.PrimaryType;
-import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.Property;
import org.gatein.portal.wsrp.state.mapping.RegistrationPropertyDescriptionMapping;
+import org.gatein.registration.RegistrationPolicy;
+import org.gatein.registration.policies.DefaultRegistrationPolicy;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.producer.config.impl.ProducerRegistrationRequirementsImpl;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
@@ -52,18 +55,42 @@
public abstract void setRegistrationRequiredForFullDescription(boolean fullServiceDescriptionRequiresRegistration);
+ @Property(name = "policyclassname")
+ public abstract String getPolicyClassName();
+
+ public abstract void setPolicyClassName(String policyClassName);
+
+ @Property(name = "validatorclassname")
+ public abstract String getValidatorClassName();
+
+ public abstract void setValidatorClassName(String validatorClassName);
+
@OneToMany
public abstract List<RegistrationPropertyDescriptionMapping> getRegistrationPropertyDescriptions();
@Create
public abstract RegistrationPropertyDescriptionMapping createRegistrationPropertyDescription(String propertyName);
+ @FindById
+ public abstract RegistrationPropertyDescriptionMapping findRegistrationPropertyDescriptionById(String id);
+
public void initFrom(ProducerRegistrationRequirements registrationRequirements)
{
setRegistrationRequired(registrationRequirements.isRegistrationRequired());
setRegistrationRequiredForFullDescription(registrationRequirements.isRegistrationRequiredForFullDescription());
+ RegistrationPolicy policy = registrationRequirements.getPolicy();
+ setPolicyClassName(policy.getClass().getName());
+ if (policy instanceof DefaultRegistrationPolicy)
+ {
+ DefaultRegistrationPolicy drp = (DefaultRegistrationPolicy)policy;
+ setValidatorClassName(drp.getValidator().getClass().getName());
+ }
+ // first clear persisted properties
List<RegistrationPropertyDescriptionMapping> rpdms = getRegistrationPropertyDescriptions();
+ rpdms.clear();
+
+ // then add the new ones if any
for (RegistrationPropertyDescription desc : registrationRequirements.getRegistrationProperties().values())
{
RegistrationPropertyDescriptionMapping rpdm = createRegistrationPropertyDescription(desc.getNameAsString());
@@ -80,6 +107,7 @@
req.setRegistrationRequired(getRegistrationRequired());
req.setRegistrationRequiredForFullDescription(getRegistrationRequiredForFullDescription());
+ req.reloadPolicyFrom(getPolicyClassName(), getValidatorClassName());
for (RegistrationPropertyDescriptionMapping rpdm : getRegistrationPropertyDescriptions())
{
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2010-01-15 16:27:37 UTC (rev 1318)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2010-01-15 18:46:42 UTC (rev 1319)
@@ -26,9 +26,6 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -292,7 +289,7 @@
}
catch (Exception e)
{
- uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.grid.action.activate.fail" , new String[]{e.getCause().toString()}, ApplicationMessage.ERROR));
+ uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.grid.action.activate.fail", new String[]{e.getCause().toString()}, ApplicationMessage.ERROR));
e.printStackTrace();
}
}
@@ -324,7 +321,8 @@
// refresh had issues, we should deactivate this consumer
registry.deactivateConsumerWith(consumer.getProducerId());
- uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.grid.action.refresh.fail", null, ApplicationMessage.ERROR));
+ uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.grid.action.refresh.fail",
+ new Object[]{result.getStatus()}, ApplicationMessage.ERROR));
}
else
{
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-15 16:27:37 UTC (rev 1318)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-15 18:46:42 UTC (rev 1319)
@@ -80,7 +80,7 @@
// registration details
// form set to gather registration information
- registrationDetails = addChild(UIWsrpRegistrationDetails.class, null, null);
+ registrationDetails = addChild(UIWsrpRegistrationDetails.class, null, REGISTRATION_DETAILS);
init(false);
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-15 16:27:37 UTC (rev 1318)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-15 18:46:42 UTC (rev 1319)
@@ -81,11 +81,12 @@
private UIGrid registrationProperties;
private static final String NAME = "name";
static String[] FIELDS = {NAME, "description", "label", "hint"};
- static String[] PROPERTIES_ACTIONS = {"EditProperty", "DeleteProperty"};
+// static String[] PROPERTIES_ACTIONS = {"EditProperty", "DeleteProperty"};
+ static String[] PROPERTIES_ACTIONS = {};
static final String POLICY_CLASS = "policyClassName";
static final String VALIDATOR_CLASS = "validatorClassName";
- static final String REGISTRATION_PROPERTIES = "RegistrationPropertySelector";
- static final String REGISTRATION_PROPERTIES_ITERATOR = "ProducerPropPageIterator";
+ static final String REGISTRATION_PROPERTIES = "registrationproperties";
+ static final String REGISTRATION_PROPERTIES_ITERATOR = "registrationpropertiesiterator";
public UIWsrpRegistrationDetails() throws Exception
{
@@ -256,8 +257,6 @@
public void updateRegistrationDetailsFromForm(ProducerRegistrationRequirements registrationRequirements)
{
registrationRequirements.reloadPolicyFrom(policy.getValue(), validator.getValue());
-
- // todo: deal with registration properties
}
static public class EditPropertyActionListener extends EventListener<UIWsrpRegistrationDetails>
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-15 16:27:37 UTC (rev 1318)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-15 18:46:42 UTC (rev 1319)
@@ -1,29 +1,18 @@
<%
- import org.exoplatform.wsrp.webui.component.UIWsrpProducerEditor;
- import org.exoplatform.wsrp.webui.component.UIWsrpRegistrationDetails;
+ import org.exoplatform.wsrp.webui.component.UIWsrpProducerEditor;
+ import org.exoplatform.wsrp.webui.component.UIWsrpRegistrationDetails;
%>
<div class="<%=uicomponent.getId()%>" id="<%=uicomponent.getId()%>">
<% uicomponent.renderChildren(); %>
- <div class="FloatRight">
+ <div class="FloatRight">
<div class="UIAction">
<table class="ActionContainer">
<tr>
<td>
- <div onclick="<%=uicomponent.getChild(UIWsrpProducerEditor.class).getChild(UIWsrpRegistrationDetails.class).event("AddProperty")%>" class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getChild(UIWsrpProducerEditor.class).getChild(UIWsrpRegistrationDetails.class).getId() + ".action.AddProperty")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- <td>
<div onclick="<%=uicomponent.getChild(UIWsrpProducerEditor.class).event("Save")%>" class="ActionButton LightBlueStyle">
<div class="ButtonLeft">
<div class="ButtonRight">
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml 2010-01-15 16:27:37 UTC (rev 1318)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/wsrp/producer-configuration-nodetypes.xml 2010-01-15 18:46:42 UTC (rev 1319)
@@ -63,10 +63,14 @@
onParentVersion="COPY" protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>
- <propertyDefinition name="state" requiredType="Binary" autoCreated="false" mandatory="false"
+ <propertyDefinition name="policyclassname" requiredType="String" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>
+ <propertyDefinition name="validatorclassname" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
</propertyDefinitions>
<childNodeDefinitions>
<childNodeDefinition name="*" defaultPrimaryType="wsrp:registrationpropertydescription" autoCreated="false"
@@ -89,7 +93,7 @@
onParentVersion="COPY" protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>
- <propertyDefinition name="status" requiredType="Integer" autoCreated="false" mandatory="false"
+ <propertyDefinition name="status" requiredType="String" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>
15 years
gatein SVN: r1318 - portal/trunk/web/portal/src/main/webapp/WEB-INF.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-15 11:27:37 -0500 (Fri, 15 Jan 2010)
New Revision: 1318
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
Log:
revert that commit
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2010-01-15 16:26:23 UTC (rev 1317)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2010-01-15 16:27:37 UTC (rev 1318)
@@ -29,8 +29,8 @@
</init-params>
<ui-component-root>org.exoplatform.portal.webui.workspace.UIPortalApplication</ui-component-root>
- <!--<state-manager>org.exoplatform.portal.application.PortalStateManager</state-manager>-->
- <state-manager>org.exoplatform.portal.application.ReplicatingStateManager</state-manager>
+ <state-manager>org.exoplatform.portal.application.PortalStateManager</state-manager>
+ <!--<state-manager>org.exoplatform.portal.application.ReplicatingStateManager</state-manager>-->
<application-lifecycle-listeners>
<listener>org.exoplatform.portal.application.PortalStatisticLifecycle</listener>
15 years
gatein SVN: r1317 - in portal/trunk: webui/core/src/main/java/org/exoplatform/webui/application/replication/model and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-15 11:26:23 -0500 (Fri, 15 Jan 2010)
New Revision: 1317
Added:
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/G.java
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
Log:
support for transient fields in serialization
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2010-01-15 14:47:57 UTC (rev 1316)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/webui-configuration.xml 2010-01-15 16:26:23 UTC (rev 1317)
@@ -29,8 +29,9 @@
</init-params>
<ui-component-root>org.exoplatform.portal.webui.workspace.UIPortalApplication</ui-component-root>
- <state-manager>org.exoplatform.portal.application.PortalStateManager</state-manager>
-
+ <!--<state-manager>org.exoplatform.portal.application.PortalStateManager</state-manager>-->
+ <state-manager>org.exoplatform.portal.application.ReplicatingStateManager</state-manager>
+
<application-lifecycle-listeners>
<listener>org.exoplatform.portal.application.PortalStatisticLifecycle</listener>
<listener>org.exoplatform.portal.application.PortalApplicationLifecycle</listener>
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java 2010-01-15 14:47:57 UTC (rev 1316)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java 2010-01-15 16:26:23 UTC (rev 1317)
@@ -20,6 +20,7 @@
package org.exoplatform.webui.application.replication.model;
import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -34,10 +35,14 @@
/** . */
private final TypeModel type;
+ /** . */
+ private boolean _transient;
+
FieldModel(Field field, TypeModel type)
{
this.field = field;
this.type = type;
+ this._transient = Modifier.isTransient(field.getModifiers());
}
public String getName()
@@ -45,6 +50,11 @@
return field.getName();
}
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+
public TypeModel getType()
{
return type;
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java 2010-01-15 14:47:57 UTC (rev 1316)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java 2010-01-15 16:26:23 UTC (rev 1317)
@@ -109,28 +109,31 @@
{
for (FieldModel fieldModel : currentTypeModel.getFields())
{
- switch (container.readInt())
+ if (!fieldModel.isTransient())
{
- case DataKind.NULL_VALUE:
- state.put(fieldModel, null);
- break;
- case DataKind.OBJECT_REF:
- int refId = container.readInt();
- Object refO = idToObject.get(refId);
- if (refO != null)
- {
- state.put(fieldModel, refO);
- }
- else
- {
- biltos.add(new Bilto(refId, fieldModel));
- }
- break;
- case DataKind.OBJECT:
- Object o = container.readObject();
- state.put(fieldModel, o);
- break;
+ switch (container.readInt())
+ {
+ case DataKind.NULL_VALUE:
+ state.put(fieldModel, null);
+ break;
+ case DataKind.OBJECT_REF:
+ int refId = container.readInt();
+ Object refO = idToObject.get(refId);
+ if (refO != null)
+ {
+ state.put(fieldModel, refO);
+ }
+ else
+ {
+ biltos.add(new Bilto(refId, fieldModel));
+ }
+ break;
+ case DataKind.OBJECT:
+ Object o = container.readObject();
+ state.put(fieldModel, o);
+ break;
+ }
}
}
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 14:47:57 UTC (rev 1316)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 16:26:23 UTC (rev 1317)
@@ -105,23 +105,26 @@
{
for (FieldModel fieldModel : currentTypeModel.getFields())
{
- Object fieldValue = fieldModel.getValue(obj);
- if (fieldValue == null)
+ if (!fieldModel.isTransient())
{
- output.writeObject(DataKind.NULL_VALUE);
- }
- else
- {
- Integer fieldValueId = objectToId.get(fieldValue);
- if (fieldValueId != null)
+ Object fieldValue = fieldModel.getValue(obj);
+ if (fieldValue == null)
{
- output.writeObject(DataKind.OBJECT_REF);
- output.writeInt(fieldValueId);
+ output.writeObject(DataKind.NULL_VALUE);
}
else
{
- output.writeObject(DataKind.OBJECT);
- output.writeObject(fieldValue);
+ Integer fieldValueId = objectToId.get(fieldValue);
+ if (fieldValueId != null)
+ {
+ output.writeObject(DataKind.OBJECT_REF);
+ output.writeInt(fieldValueId);
+ }
+ else
+ {
+ output.writeObject(DataKind.OBJECT);
+ output.writeObject(fieldValue);
+ }
}
}
}
Added: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/G.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/G.java (rev 0)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/G.java 2010-01-15 16:26:23 UTC (rev 1317)
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package org.exoplatform.webui.replication;
+
+import org.exoplatform.webui.application.replication.annotations.ReplicatedType;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@ReplicatedType
+public class G
+{
+
+ String a;
+ transient Thread b;
+
+}
Modified: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-15 14:47:57 UTC (rev 1316)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-15 16:26:23 UTC (rev 1317)
@@ -130,4 +130,17 @@
{
}
}
+
+ public void testTransientField() throws Exception
+ {
+ TypeDomain domain = new TypeDomain();
+ domain.add(G.class);
+ SerializationContext context = new SerializationContext(domain);
+ G g = new G();
+ g.a = "foo";
+ g.b = new Thread();
+ g = context.clone(g);
+ assertEquals("foo", g.a);
+ assertEquals(null, g.b);
+ }
}
15 years
gatein SVN: r1316 - in portal/trunk/webui/core/src: main/java/org/exoplatform/webui/application/replication/serial and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-15 09:47:57 -0500 (Fri, 15 Jan 2010)
New Revision: 1316
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java
Log:
better support for serialization status detection
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -19,14 +19,16 @@
package org.exoplatform.webui.application.replication.model;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public final class ClassTypeModel extends TypeModel
+public final class ClassTypeModel<O> extends TypeModel
{
- ClassTypeModel(Class<?> type, TypeModel superType)
+ ClassTypeModel(Class<?> type, TypeModel superType, Map<String, FieldModel> fields)
{
- super(type, superType);
+ super(type, superType, fields);
}
}
\ No newline at end of file
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -19,8 +19,6 @@
package org.exoplatform.webui.application.replication.model;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Map;
/**
@@ -33,37 +31,20 @@
/** . */
private final Class<O> objectType;
- /** . */
- private final Map<String, FieldModel> fields;
-
- /** . */
- private final Map<String, FieldModel> immutableFields;
-
ReplicatableTypeModel(
Class<O> javaType,
TypeModel superType,
Map<String, FieldModel> fields)
{
- super(javaType, superType);
+ super(javaType, superType, fields);
//
this.objectType = javaType;
- this.fields = fields;
- this.immutableFields = Collections.unmodifiableMap(fields);
}
- public Class<O> getObjectType()
+ @Override
+ public Class<O> getJavaType()
{
return objectType;
}
-
- public Collection<FieldModel> getFields()
- {
- return immutableFields.values();
- }
-
- public Map<String, FieldModel> getFieldMap()
- {
- return immutableFields;
- }
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -21,7 +21,6 @@
import org.exoplatform.webui.application.replication.annotations.ReplicatedType;
-import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.*;
@@ -105,24 +104,16 @@
return typeModelMap.size();
}
- private TypeModel build(Class<?> javaType, Map<String, TypeModel> addedTypeModels)
+ private <O> TypeModel build(Class<O> javaType, Map<String, TypeModel> addedTypeModels)
{
- ReplicatedType replicatedType = javaType.getAnnotation(ReplicatedType.class);
- if (replicatedType != null)
- {
- return buildReplicatableTypeModel(javaType, addedTypeModels);
- }
- else
- {
- return buildClassTypeModel(javaType, addedTypeModels);
- }
- }
+ TypeModel typeModel = get(javaType, addedTypeModels);
- private <O> ReplicatableTypeModel<O> buildReplicatableTypeModel(Class<O> javaType, Map<String, TypeModel> addedTypeModels)
- {
- ReplicatableTypeModel typeModel = (ReplicatableTypeModel) get(javaType, addedTypeModels);
+ //
if (typeModel == null)
{
+ boolean replicated = javaType.getAnnotation(ReplicatedType.class) != null;
+
+ //
TypeModel superTypeModel = null;
for (Class<?> ancestor = javaType.getSuperclass();ancestor != null;ancestor = ancestor.getSuperclass())
{
@@ -137,7 +128,14 @@
TreeMap<String, FieldModel> fieldModels = new TreeMap<String, FieldModel>();
//
- typeModel = new ReplicatableTypeModel<O>(javaType, superTypeModel, fieldModels);
+ if (replicated)
+ {
+ typeModel = new ReplicatableTypeModel<O>(javaType, superTypeModel, fieldModels);
+ }
+ else
+ {
+ typeModel = new ClassTypeModel(javaType, superTypeModel, fieldModels);
+ }
//
addedTypeModels.put(javaType.getName(), typeModel);
@@ -158,23 +156,7 @@
}
}
- // It must be good
- return (ReplicatableTypeModel<O>)typeModel;
- }
-
- private ClassTypeModel buildClassTypeModel(Class<?> javaType, Map<String, TypeModel> addedTypeModels)
- {
- ClassTypeModel typeModel = (ClassTypeModel) get(javaType, addedTypeModels);
- if (typeModel == null)
- {
- TypeModel superTypeModel = null;
- if (javaType.getSuperclass() != null)
- {
- superTypeModel = build(javaType.getSuperclass(), addedTypeModels);
- }
- typeModel = new ClassTypeModel(javaType, superTypeModel);
- addedTypeModels.put(javaType.getName(), typeModel);
- }
+ //
return typeModel;
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -19,6 +19,10 @@
package org.exoplatform.webui.application.replication.model;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -32,12 +36,30 @@
/** . */
private final TypeModel superType;
- TypeModel(Class<?> javaType, TypeModel superType)
+ /** . */
+ private final Map<String, FieldModel> fields;
+
+ /** . */
+ private final Map<String, FieldModel> immutableFields;
+
+ TypeModel(Class<?> javaType, TypeModel superType, Map<String, FieldModel> fields)
{
this.javaType = javaType;
this.superType = superType;
+ this.fields = fields;
+ this.immutableFields = Collections.unmodifiableMap(fields);
}
+ public Collection<FieldModel> getFields()
+ {
+ return immutableFields.values();
+ }
+
+ public Map<String, FieldModel> getFieldMap()
+ {
+ return immutableFields;
+ }
+
public String getName()
{
return javaType.getName();
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -61,14 +61,14 @@
{
try
{
- ObjectFactory<? super O> factory = context.getFactory(typeModel.getObjectType());
+ ObjectFactory<? super O> factory = context.getFactory(typeModel.getJavaType());
//
- return factory.create(typeModel.getObjectType(), state);
+ return factory.create(typeModel.getJavaType(), state);
}
catch (Exception e)
{
- InvalidClassException ice = new InvalidClassException("Cannot instantiate object from class " + typeModel.getObjectType().getName());
+ InvalidClassException ice = new InvalidClassException("Cannot instantiate object from class " + typeModel.getJavaType().getName());
ice.initCause(e);
throw ice;
}
@@ -107,7 +107,7 @@
{
if (currentTypeModel instanceof ReplicatableTypeModel)
{
- for (FieldModel fieldModel : ((ReplicatableTypeModel<?>)currentTypeModel).getFields())
+ for (FieldModel fieldModel : currentTypeModel.getFields())
{
switch (container.readInt())
{
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -103,7 +103,7 @@
{
if (currentTypeModel instanceof ReplicatableTypeModel)
{
- for (FieldModel fieldModel : ((ReplicatableTypeModel<?>)currentTypeModel).getFields())
+ for (FieldModel fieldModel : currentTypeModel.getFields())
{
Object fieldValue = fieldModel.getValue(obj);
if (fieldValue == null)
@@ -134,11 +134,14 @@
}
else
{
- switch (status)
+ if (!currentTypeModel.getFields().isEmpty())
{
- case FULL:
- status = SerializationStatus.PARTIAL;
- break;
+ switch (status)
+ {
+ case FULL:
+ status = SerializationStatus.PARTIAL;
+ break;
+ }
}
}
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -23,7 +23,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public enum SerializationStatus
+enum SerializationStatus
{
NONE,
Modified: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java 2010-01-15 14:44:11 UTC (rev 1315)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java 2010-01-15 14:47:57 UTC (rev 1316)
@@ -43,18 +43,26 @@
{
TypeDomain domain = new TypeDomain();
assertType(String.class, domain.add(String.class));
- assertEquals(2, domain.getSize());
+ assertEquals(4, domain.getSize());
assertType(String.class, domain.getTypeModel(String.class));
assertType(Object.class, domain.getTypeModel(Object.class));
+ assertType(int.class, domain.getTypeModel(int.class));
+ assertType(char[].class, domain.getTypeModel(char[].class));
}
public void testJuu()
{
TypeDomain domain = new TypeDomain();
ReplicatableTypeModel aTM = (ReplicatableTypeModel) domain.add(A.class);
- assertEquals(5, domain.getSize());
assertEquals(A.class.getName(), aTM.getName());
- assertEquals(SetBuilder.create(domain.getTypeModel(int.class)).with(aTM).with(domain.getTypeModel(boolean.class)).with(domain.getTypeModel(Object.class)).build(domain.getTypeModel(String.class)), domain.getTypeModels());
+ assertEquals(SetBuilder.
+ create(domain.getTypeModel(Object.class)).
+ with(domain.getTypeModel(int.class)).
+ with(domain.getTypeModel(char[].class)).
+ with(aTM).
+ with(domain.getTypeModel(boolean.class)).
+ build(domain.getTypeModel(String.class))
+ , domain.getTypeModels());
Map<String, FieldModel> fieldMap = aTM.getFieldMap();
assertEquals(3, fieldMap.size());
FieldModel aFM = fieldMap.get("a");
15 years
gatein SVN: r1315 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-15 09:44:11 -0500 (Fri, 15 Jan 2010)
New Revision: 1315
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java
Log:
- Made key a String and renamed accessor methods to *PersistentKey to be consistent with other persistent classes.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java 2010-01-15 13:49:37 UTC (rev 1314)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/registration/RegistrationPropertyDescription.java 2010-01-15 14:44:11 UTC (rev 1315)
@@ -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.
@@ -38,7 +38,7 @@
*/
public class RegistrationPropertyDescription implements PropertyDescription
{
- private Long key;
+ private String key;
private QName name;
private QName type;
private String schemaLocation;
@@ -148,12 +148,12 @@
}
- public Long getKey()
+ public String getPersistentKey()
{
return key;
}
- public void setKey(Long key)
+ public void setPersistentKey(String key)
{
this.key = key;
}
15 years
gatein SVN: r1314 - in portal/trunk/webui/core/src: test/java/org/exoplatform/webui/replication and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-15 08:49:37 -0500 (Fri, 15 Jan 2010)
New Revision: 1314
Added:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
Log:
preliminary support for serialization status detection
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 12:59:40 UTC (rev 1313)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 13:49:37 UTC (rev 1314)
@@ -60,8 +60,12 @@
}
@Override
- protected Object replaceObject(Object obj) throws IOException
+ protected Object replaceObject(final Object obj) throws IOException
{
+ if (obj == null)
+ {
+ return null;
+ }
if (obj instanceof Serializable)
{
return obj;
@@ -79,22 +83,23 @@
}
else
{
- ReplicatableTypeModel<?> typeModel = (ReplicatableTypeModel<?>)context.getTypeDomain().getTypeModel(obj.getClass());
+ Class<? extends Object> objClass = obj.getClass();
+ TypeModel typeModel = context.getTypeDomain().getTypeModel(objClass);
//
if (typeModel == null)
{
- throw new NotSerializableException("Object " + obj + " is not serializable");
+ throw new NotSerializableException("Object " + obj + " does not have its type described");
}
//
output.writeInt(DataKind.OBJECT);
output.writeInt(register(obj));
- output.writeObject(obj.getClass());
+ output.writeObject(objClass);
//
- TypeModel currentTypeModel = typeModel;
- while (currentTypeModel != null)
+ SerializationStatus status = SerializationStatus.NONE;
+ for (TypeModel currentTypeModel = typeModel;currentTypeModel != null;currentTypeModel = currentTypeModel.getSuperType())
{
if (currentTypeModel instanceof ReplicatableTypeModel)
{
@@ -120,10 +125,34 @@
}
}
}
+ switch (status)
+ {
+ case NONE:
+ status = SerializationStatus.FULL;
+ break;
+ }
}
+ else
+ {
+ switch (status)
+ {
+ case FULL:
+ status = SerializationStatus.PARTIAL;
+ break;
+ }
+ }
+ }
- //
- currentTypeModel = currentTypeModel.getSuperType();
+ //
+ switch (status)
+ {
+ case FULL:
+ break;
+ case PARTIAL:
+ System.out.println("Partial serialization of object " + obj);
+ break;
+ case NONE:
+ throw new NotSerializableException("Type " + objClass.getName() + " is not serializable");
}
}
Added: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/SerializationStatus.java 2010-01-15 13:49:37 UTC (rev 1314)
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package org.exoplatform.webui.application.replication.serial;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum SerializationStatus
+{
+
+ NONE,
+
+ PARTIAL,
+
+ FULL
+
+}
Modified: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-15 12:59:40 UTC (rev 1313)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-15 13:49:37 UTC (rev 1314)
@@ -23,6 +23,10 @@
import org.exoplatform.webui.application.replication.SerializationContext;
import org.exoplatform.webui.application.replication.model.TypeDomain;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.NotSerializableException;
+
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
@@ -110,4 +114,20 @@
assertNotNull(f1.children.get(0));
assertSame(f1, f1.children.get(0).parent);
}
+
+ public void testNotSerializable() throws Exception
+ {
+ TypeDomain domain = new TypeDomain();
+ domain.add(ByteArrayInputStream.class);
+
+ SerializationContext context = new SerializationContext(domain);
+ try
+ {
+ context.write(new ByteArrayInputStream(new byte[0]));
+ fail();
+ }
+ catch (NotSerializableException e)
+ {
+ }
+ }
}
15 years
gatein SVN: r1313 - in portal/trunk/webui/core/src: main/java/org/exoplatform/webui/application/replication/serial and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-15 07:59:40 -0500 (Fri, 15 Jan 2010)
New Revision: 1313
Added:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/F.java
Removed:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/SerializableTypeModel.java
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java
Log:
need to add those files for unit test
Copied: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java (from rev 1303, portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/SerializableTypeModel.java)
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ClassTypeModel.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package org.exoplatform.webui.application.replication.model;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public final class ClassTypeModel extends TypeModel
+{
+ ClassTypeModel(Class<?> type, TypeModel superType)
+ {
+ super(type, superType);
+ }
+}
\ No newline at end of file
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/ReplicatableTypeModel.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -34,9 +34,6 @@
private final Class<O> objectType;
/** . */
- private final TypeModel superType;
-
- /** . */
private final Map<String, FieldModel> fields;
/** . */
@@ -47,11 +44,10 @@
TypeModel superType,
Map<String, FieldModel> fields)
{
- super(javaType);
+ super(javaType, superType);
//
this.objectType = javaType;
- this.superType = superType;
this.fields = fields;
this.immutableFields = Collections.unmodifiableMap(fields);
}
@@ -61,11 +57,6 @@
return objectType;
}
- public TypeModel getSuperType()
- {
- return superType;
- }
-
public Collection<FieldModel> getFields()
{
return immutableFields.values();
Deleted: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/SerializableTypeModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/SerializableTypeModel.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/SerializableTypeModel.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-package org.exoplatform.webui.application.replication.model;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public final class SerializableTypeModel extends TypeModel
-{
- SerializableTypeModel(Class<? extends Serializable> serializable)
- {
- super(serializable);
- }
-}
\ No newline at end of file
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -78,7 +78,7 @@
return typeModelMap.get(typeName);
}
- public TypeModel getTypeModel(Class javaType)
+ public TypeModel getTypeModel(Class<?> javaType)
{
if (javaType == null)
{
@@ -110,23 +110,15 @@
ReplicatedType replicatedType = javaType.getAnnotation(ReplicatedType.class);
if (replicatedType != null)
{
- return buildClassTypeModel(javaType, addedTypeModels);
+ return buildReplicatableTypeModel(javaType, addedTypeModels);
}
- else if (javaType.isPrimitive())
- {
- return buildSerializable(javaType, addedTypeModels);
- }
- else if (Serializable.class.isAssignableFrom(javaType))
- {
- return buildSerializable(javaType, addedTypeModels);
- }
else
{
- return null;
+ return buildClassTypeModel(javaType, addedTypeModels);
}
}
- private <O> ReplicatableTypeModel<O> buildClassTypeModel(Class<O> javaType, Map<String, TypeModel> addedTypeModels)
+ private <O> ReplicatableTypeModel<O> buildReplicatableTypeModel(Class<O> javaType, Map<String, TypeModel> addedTypeModels)
{
ReplicatableTypeModel typeModel = (ReplicatableTypeModel) get(javaType, addedTypeModels);
if (typeModel == null)
@@ -170,12 +162,17 @@
return (ReplicatableTypeModel<O>)typeModel;
}
- private SerializableTypeModel buildSerializable(Class<?> javaType, Map<String, TypeModel> addedTypeModels)
+ private ClassTypeModel buildClassTypeModel(Class<?> javaType, Map<String, TypeModel> addedTypeModels)
{
- SerializableTypeModel typeModel = (SerializableTypeModel) get(javaType, addedTypeModels);
+ ClassTypeModel typeModel = (ClassTypeModel) get(javaType, addedTypeModels);
if (typeModel == null)
{
- typeModel = new SerializableTypeModel((Class<Serializable>)javaType);
+ TypeModel superTypeModel = null;
+ if (javaType.getSuperclass() != null)
+ {
+ superTypeModel = build(javaType.getSuperclass(), addedTypeModels);
+ }
+ typeModel = new ClassTypeModel(javaType, superTypeModel);
addedTypeModels.put(javaType.getName(), typeModel);
}
return typeModel;
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeModel.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -29,9 +29,13 @@
/** . */
private final Class<?> javaType;
- TypeModel(Class<?> javaType)
+ /** . */
+ private final TypeModel superType;
+
+ TypeModel(Class<?> javaType, TypeModel superType)
{
this.javaType = javaType;
+ this.superType = superType;
}
public String getName()
@@ -44,6 +48,11 @@
return javaType;
}
+ public TypeModel getSuperType()
+ {
+ return superType;
+ }
+
@Override
public String toString()
{
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -101,49 +101,40 @@
//
Map<FieldModel, Object> state = new HashMap<FieldModel, Object>();
- ReplicatableTypeModel<?> currentTypeModel = typeModel;
+ TypeModel currentTypeModel = typeModel;
List<Bilto> biltos = new ArrayList<Bilto>();
- while (true)
+ while (currentTypeModel != null)
{
- for (FieldModel fieldModel : (currentTypeModel).getFields())
+ if (currentTypeModel instanceof ReplicatableTypeModel)
{
- switch (container.readInt())
+ for (FieldModel fieldModel : ((ReplicatableTypeModel<?>)currentTypeModel).getFields())
{
- case DataKind.NULL_VALUE:
- state.put(fieldModel, null);
- break;
- case DataKind.OBJECT_REF:
- int refId = container.readInt();
- Object refO = idToObject.get(refId);
- if (refO != null)
- {
- state.put(fieldModel, refO);
- }
- else
- {
- biltos.add(new Bilto(refId, fieldModel));
- }
- break;
- case DataKind.OBJECT:
- Object o = container.readObject();
- state.put(fieldModel, o);
- break;
+ switch (container.readInt())
+ {
+ case DataKind.NULL_VALUE:
+ state.put(fieldModel, null);
+ break;
+ case DataKind.OBJECT_REF:
+ int refId = container.readInt();
+ Object refO = idToObject.get(refId);
+ if (refO != null)
+ {
+ state.put(fieldModel, refO);
+ }
+ else
+ {
+ biltos.add(new Bilto(refId, fieldModel));
+ }
+ break;
+ case DataKind.OBJECT:
+ Object o = container.readObject();
+ state.put(fieldModel, o);
+ break;
+ }
}
}
- TypeModel currentSuperTypeModel = currentTypeModel.getSuperType();
- if (currentSuperTypeModel == null)
- {
- break;
- }
- if (currentSuperTypeModel instanceof ReplicatableTypeModel)
- {
- currentTypeModel = (ReplicatableTypeModel)currentSuperTypeModel;
- }
- else
- {
- throw new UnsupportedOperationException();
- }
+ currentTypeModel = currentTypeModel.getSuperType();
}
//
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -93,48 +93,37 @@
output.writeObject(obj.getClass());
//
- ReplicatableTypeModel<?> currentTypeModel = typeModel;
- while (true)
+ TypeModel currentTypeModel = typeModel;
+ while (currentTypeModel != null)
{
- for (FieldModel fieldModel : (currentTypeModel).getFields())
+ if (currentTypeModel instanceof ReplicatableTypeModel)
{
- Object fieldValue = fieldModel.getValue(obj);
- if (fieldValue == null)
+ for (FieldModel fieldModel : ((ReplicatableTypeModel<?>)currentTypeModel).getFields())
{
- output.writeObject(DataKind.NULL_VALUE);
- }
- else
- {
- Integer fieldValueId = objectToId.get(fieldValue);
- if (fieldValueId != null)
+ Object fieldValue = fieldModel.getValue(obj);
+ if (fieldValue == null)
{
- output.writeObject(DataKind.OBJECT_REF);
- output.writeInt(fieldValueId);
+ output.writeObject(DataKind.NULL_VALUE);
}
else
{
- output.writeObject(DataKind.OBJECT);
- output.writeObject(fieldValue);
+ Integer fieldValueId = objectToId.get(fieldValue);
+ if (fieldValueId != null)
+ {
+ output.writeObject(DataKind.OBJECT_REF);
+ output.writeInt(fieldValueId);
+ }
+ else
+ {
+ output.writeObject(DataKind.OBJECT);
+ output.writeObject(fieldValue);
+ }
}
}
}
//
- TypeModel currentSuperTypeModel = currentTypeModel.getSuperType();
- if (currentSuperTypeModel == null)
- {
- break;
- }
-
- //
- if (currentSuperTypeModel instanceof ReplicatableTypeModel)
- {
- currentTypeModel = (ReplicatableTypeModel)currentSuperTypeModel;
- }
- else
- {
- throw new UnsupportedOperationException();
- }
+ currentTypeModel = currentTypeModel.getSuperType();
}
}
Added: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/F.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/F.java (rev 0)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/F.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package org.exoplatform.webui.replication;
+
+import org.exoplatform.webui.application.replication.annotations.ReplicatedType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@ReplicatedType
+public class F
+{
+
+ List<F> children = new ArrayList<F>();
+
+ F parent;
+
+}
Modified: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -30,7 +30,7 @@
public class TestSerialization extends TestCase
{
- public void testBar() throws Exception
+ public void testState() throws Exception
{
TypeDomain domain = new TypeDomain();
domain.add(A.class);
@@ -45,7 +45,7 @@
assertEquals(true, a.c);
}
- public void testFoo() throws Exception
+ public void testMultipleReference1() throws Exception
{
TypeDomain domain = new TypeDomain();
domain.add(B.class);
@@ -71,7 +71,7 @@
assertEquals("bar", d.b);
}
- public void testAAA() throws Exception
+ public void testMultipleReference2() throws Exception
{
TypeDomain domain = new TypeDomain();
domain.add(E2.class);
@@ -88,25 +88,26 @@
assertSame(((E2)e.left).right, ((E2)e.right).right);
}
-/*
public void testListOfReplicatable() throws Exception
{
TypeDomain domain = new TypeDomain();
- domain.add(F1.class);
- domain.add(F2.class);
+ domain.add(F.class);
//
- F1 f1 = new F1();
- F2 f2 = new F2();
- f1.values.add(f2);
+ F f1 = new F();
+ F f2 = new F();
+ f1.children.add(f2);
+ f2.parent = f1;
//
SerializationContext context = new SerializationContext(domain);
f1 = context.clone(f1);
//
- assertNotNull(f1.values);
- assertEquals(1, f1.values.size());
+ assertNotNull(f1.children);
+ assertNull(f1.parent);
+ assertEquals(1, f1.children.size());
+ assertNotNull(f1.children.get(0));
+ assertSame(f1, f1.children.get(0).parent);
}
-*/
}
Modified: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java 2010-01-15 11:42:30 UTC (rev 1312)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestTypeModel.java 2010-01-15 12:59:40 UTC (rev 1313)
@@ -43,17 +43,18 @@
{
TypeDomain domain = new TypeDomain();
assertType(String.class, domain.add(String.class));
- assertEquals(1, domain.getSize());
+ assertEquals(2, domain.getSize());
assertType(String.class, domain.getTypeModel(String.class));
+ assertType(Object.class, domain.getTypeModel(Object.class));
}
public void testJuu()
{
TypeDomain domain = new TypeDomain();
ReplicatableTypeModel aTM = (ReplicatableTypeModel) domain.add(A.class);
- assertEquals(4, domain.getSize());
+ assertEquals(5, domain.getSize());
assertEquals(A.class.getName(), aTM.getName());
- assertEquals(SetBuilder.create(domain.getTypeModel(int.class)).with(aTM).with(domain.getTypeModel(boolean.class)).build(domain.getTypeModel(String.class)), domain.getTypeModels());
+ assertEquals(SetBuilder.create(domain.getTypeModel(int.class)).with(aTM).with(domain.getTypeModel(boolean.class)).with(domain.getTypeModel(Object.class)).build(domain.getTypeModel(String.class)), domain.getTypeModels());
Map<String, FieldModel> fieldMap = aTM.getFieldMap();
assertEquals(3, fieldMap.size());
FieldModel aFM = fieldMap.get("a");
@@ -67,11 +68,10 @@
assertEquals(domain.getTypeModel(boolean.class), cFM.getType());
}
- private void assertType(Class<? extends Serializable> javaType, TypeModel typeModel)
+ private void assertType(Class<?> javaType, TypeModel typeModel)
{
- assertTrue(typeModel instanceof SerializableTypeModel);
- SerializableTypeModel serializableTypeModel = (SerializableTypeModel)typeModel;
+ assertTrue(typeModel instanceof ClassTypeModel);
+ ClassTypeModel serializableTypeModel = (ClassTypeModel)typeModel;
assertEquals(javaType, serializableTypeModel.getJavaType());
}
-
}
15 years