You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2006/11/02 23:07:24 UTC

svn commit: r470544 [1/4] - in /portals/jetspeed-2/trunk/components/serializer: ./ src/java/org/apache/jetspeed/serializer/ src/java/org/apache/jetspeed/serializer/objects/ test/assembly/ test/assembly/boot/

Author: taylor
Date: Thu Nov  2 14:07:22 2006
New Revision: 470544

URL: http://svn.apache.org/viewvc?view=rev&rev=470544
Log:
http://issues.apache.org/jira/browse/JS2-461 - Serializer component
patch from Hajo Birthelmer (hajo@bluesunrise.com)
phase 1 of 2 patches

* Serializer new implementation with Javalution
* data export mostly implemented, data import in next phase


Added:
    portals/jetspeed-2/trunk/components/serializer/dataModel-new.xsd
    portals/jetspeed-2/trunk/components/serializer/dataModel.xsd
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSCapabilities.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSCapability.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSClient.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSClientCapabilities.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSClientMimeTypes.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSClients.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSGroup.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSGroups.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSMediaType.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSMediaTypes.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSMimeType.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSMimeTypes.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSNameValuePairs.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSPermissions.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSPrincipalRule.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSPrincipalRules.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSProfilingRules.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSRole.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSRoles.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSRuleCriterion.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSRuleCriterions.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSSimpleIDName.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSUserAttributes.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSUserGroups.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSUserRoles.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSUserUsers.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSUsers.java
    portals/jetspeed-2/trunk/components/serializer/test/assembly/profiler.xml
    portals/jetspeed-2/trunk/components/serializer/test/assembly/security-atn.xml
    portals/jetspeed-2/trunk/components/serializer/test/assembly/security-atz.xml
    portals/jetspeed-2/trunk/components/serializer/test/assembly/security-managers.xml
    portals/jetspeed-2/trunk/components/serializer/test/assembly/security-providers.xml
    portals/jetspeed-2/trunk/components/serializer/test/assembly/security-spi-atn.xml
    portals/jetspeed-2/trunk/components/serializer/test/assembly/security-spi-atz.xml
    portals/jetspeed-2/trunk/components/serializer/test/assembly/security-spi.xml
Removed:
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JSImportData.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedImporter.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSCriterion.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSNameValuePair.java
Modified:
    portals/jetspeed-2/trunk/components/serializer/pom.xml
    portals/jetspeed-2/trunk/components/serializer/project.xml
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSPermission.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSProfilingRule.java
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/objects/JSUser.java
    portals/jetspeed-2/trunk/components/serializer/test/assembly/boot/datasource.xml

Added: portals/jetspeed-2/trunk/components/serializer/dataModel-new.xsd
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/dataModel-new.xsd?view=auto&rev=470544
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/dataModel-new.xsd (added)
+++ portals/jetspeed-2/trunk/components/serializer/dataModel-new.xsd Thu Nov  2 14:07:22 2006
@@ -0,0 +1,367 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema 	xmlns="http://www.w3.org/2001/XMLSchema" 
+			targetNamespace="http://portals.apache.org" 
+			xmlns:pa="http://portals.apache.org" 
+			elementFormDefault="qualified" 
+			version="1.0">
+	<annotation>
+		<documentation xml:lang="en">Schema for data serialization of JetSpeed 2 DataModel
+      Copyright 2006 The Apache Software Foundation. 
+	  Licensed under the Apache License, Version 2.0 (the "License");
+		you may not use this file except in compliance with the License.
+		You may obtain a copy of the License at
+		http://www.apache.org/licenses/LICENSE-2.0
+		Unless required by applicable law or agreed to in writing, software 
+		distributed under the License is distributed on an "AS IS" BASIS, 
+		WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+		See the License for the specific language governing permissions and 
+		limitations under the License.
+	  </documentation>
+	</annotation>
+	
+	<element name="DataModel">
+		<annotation>
+			<documentation xml:lang="en">The DataModel consists of a list of 
+		domain objects that are valid for this version. Each domain object holds the data of a given component. 
+		</documentation>
+		</annotation>
+
+		<complexType>
+			<sequence>
+				<element name="schemaVersion" type="string" minOccurs="1" maxOccurs="1">
+				<annotation>
+						<documentation xml:lang="en">The schemaVersion denotes the backward compatibility 
+						of this schema. The optional version attribute of the schema above denotes the version of this schema and
+						the schemaVersion element here declares the latest schema version with which the instance is compatible
+						With this approach, an application could compare the schema version (captured in the 
+						schema file) with the version to which the instance reports that it is compatible.
+						</documentation>
+				</annotation>
+				</element>
+				<element name="Domain" minOccurs="1" maxOccurs="1">
+					<annotation>
+						<documentation xml:lang="en">The Domain is the collection of 
+						all relevant data objects for this portal. 
+						</documentation>
+					</annotation>
+					<complexType>
+						<sequence>
+							<element name="PortalName" type="string" minOccurs="1" maxOccurs="1">
+								<annotation>
+									<documentation xml:lang="en">
+									The PortalName allows to identify the source of the data.
+									</documentation>
+								</annotation>
+								</element>
+							<element name="DateCreated" type="date" minOccurs="1" maxOccurs="1">
+								<annotation>
+									<documentation xml:lang="en">
+									Always helpful to recognize when it was created.
+									</documentation>
+								</annotation>
+								</element>
+							<element name="Roles" minOccurs="0" maxOccurs="1">
+								<annotation>
+									<documentation xml:lang="en">
+									Roles
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:Role" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+
+								</element>
+							<element name="Groups" minOccurs="0" maxOccurs="1">
+								<annotation>
+									<documentation xml:lang="en">
+									Groups
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:Group" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+								</element>
+							<element name="Permissions" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Permissions
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:Permission" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+								</element>
+							<element name="Capabilities" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Capabilities
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:Capability" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+
+								</element>
+							<element name="MimeTypes" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Mime Types
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:MimeType" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+								</element>
+							<element name="Clients" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Clients
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:Client" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+								</element>
+							<element name="MediaTypes" minOccurs="0" maxOccurs="1">
+								<annotation>
+									<documentation xml:lang="en">
+									Media Types
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:MediaType" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+								</element>
+
+	<!--  Associations -->
+
+
+							<element name="ClientToCapabilities" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Client to Capabilities
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:ClientCapability" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+
+								</element>
+							<element name="ClientToMimeTypes" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Client To MimeTypes
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:ClientMimeTypes" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+								</element>
+							<element name="MediaToMimeTypes" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Media To MimeTypes
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:MediaMimeTypes" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+							</element>
+						<element name="ProfilingRules" minOccurs="0" maxOccurs="1" >
+								<annotation>
+									<documentation xml:lang="en">
+									Profiling Rule
+									</documentation>
+								</annotation>
+								<complexType>
+					            	<sequence>
+                						<element ref="pa:ProfilingRule" minOccurs="1" maxOccurs="unbounded"/>
+									</sequence>
+								</complexType>
+						</element>
+						</sequence>
+		
+					</complexType>
+				</element>
+			</sequence>
+		</complexType>
+		<key name="UniqueDomain">
+			<selector xpath="Domain"/>
+			<field xpath="@PortalName"/>
+		</key>
+	</element>
+	<element name="Role">
+	<complexType >
+		<annotation>
+			<documentation xml:lang="en">Role ....
+						</documentation>
+		</annotation>
+		<sequence>
+			<element name="name" type="string" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+
+	<element name="Group">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">Group ....
+						</documentation>
+		</annotation>
+		<sequence>
+			<element name="name" type="string" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+	</element>
+
+	<element name="Permission">
+		<complexType>
+		<annotation>
+			<documentation xml:lang="en">Permission ....
+						</documentation>
+		</annotation>
+		<sequence>
+			<element name="name" type="string" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+	<element name="Capability">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">Capability ....
+						</documentation>
+		</annotation>
+		<sequence>
+			<element name="capability_id" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="capability" type="string" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+	<element name="MimeType">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">Mimetype ....
+						</documentation>
+		</annotation>
+		<sequence>
+			<element name="mimetype_id" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="name" type="string" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+	<element name="Client">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">Client ....
+						</documentation>
+		</annotation>
+		<sequence>
+			<element name="client_id" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="eval_order" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="name" type="string" minOccurs="1" maxOccurs="1"/>
+			<element name="user_agent_pattern" type="string" minOccurs="0" maxOccurs="1"/>
+				<element name="manufacturer" type="string" minOccurs="0" maxOccurs="1"/>
+			<element name="model" type="string" minOccurs="0" maxOccurs="1"/>
+			<element name="version" type="string" minOccurs="0" maxOccurs="1"/>
+			<element name="preferred_mimetype_id" type="integer" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+	<element name="MediaType">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">MediaType ....
+						</documentation>
+		</annotation>
+		<sequence>
+			<element name="mediatype_id" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="name" type="string" minOccurs="1" maxOccurs="1"/>
+			<element name="character_set" type="string" minOccurs="0" maxOccurs="1"/>
+			<element name="title" type="string" minOccurs="0" maxOccurs="1"/>
+			<element name="description" type="string" minOccurs="0" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+	<element name="ClientCapability">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">
+			Associate clients with capabilities
+			 </documentation>
+		</annotation>
+		<sequence>
+			<element name="clientID" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="capabilityID" type="integer" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+	<element name="ClientMimeTypes">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">
+			Associate clients with mime types
+			 </documentation>
+		</annotation>
+		<sequence>
+			<element name="clientID" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="mimetypeID" type="integer" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+	<element name="MediaMimeTypes">
+	<complexType>
+		<annotation>
+			<documentation xml:lang="en">
+			Associate media types with mime types 
+			 </documentation>
+		</annotation>
+		<sequence>
+			<element name="mediatypeID" type="integer" minOccurs="1" maxOccurs="1"/>
+			<element name="mimetypeID" type="integer" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+	</element>
+
+	<element name="ProfilingRule">
+	<complexType>
+
+		<annotation>
+			<documentation xml:lang="en">
+			Profiling Rule
+			 </documentation>
+		</annotation>
+		<sequence>
+			<element name="tbd" type="string" minOccurs="1" maxOccurs="1"/>
+		</sequence>
+	</complexType>
+</element>
+
+</schema>

Added: portals/jetspeed-2/trunk/components/serializer/dataModel.xsd
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/dataModel.xsd?view=auto&rev=470544
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/dataModel.xsd (added)
+++ portals/jetspeed-2/trunk/components/serializer/dataModel.xsd Thu Nov  2 14:07:22 2006
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema 	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+			targetNamespace="http://portals.apache.org" 
+			xmlns="http://portals.apache.org" 
+			elementFormDefault="qualified" 
+			version="1.0">
+	<xs:annotation>
+		<xs:documentation xml:lang="en">Schema for data serialization of JetSpeed 2 DataModel
+      Copyright 2006 The Apache Software Foundation. 
+	  Licensed under the Apache License, Version 2.0 (the "License");
+		you may not use this file except in compliance with the License.
+		You may obtain a copy of the License at
+		http://www.apache.org/licenses/LICENSE-2.0
+		Unless required by applicable law or agreed to in writing, software 
+		distributed under the License is distributed on an "AS IS" BASIS, 
+		WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+		See the License for the specific language governing permissions and 
+		limitations under the License.
+	  </xs:documentation>
+	</xs:annotation>
+	
+	<xs:element name="DataModel">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">The DataModel consists of a list of 
+		domain objects that are valid for this version. Each domain object holds the data of a given component. 
+		</xs:documentation>
+		</xs:annotation>
+
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="schemaVersion" type="xs:string" minOccurs="1" maxOccurs="1">
+				<xs:annotation>
+						<xs:documentation xml:lang="en">The schemaVersion denotes the backward compatibility 
+						of this schema. The optional version attribute of the schema above denotes the version of this schema and
+						the schemaVersion element here declares the latest schema version with which the instance is compatible
+						With this approach, an application could compare the schema version (captured in the 
+						schema file) with the version to which the instance reports that it is compatible.
+						</xs:documentation>
+				</xs:annotation>
+				</xs:element>
+				<xs:element name="Domain" maxOccurs="unbounded">
+					<xs:annotation>
+						<xs:documentation xml:lang="en">The Domain is the collection of 
+						all relevant data objects for this portal. 
+						</xs:documentation>
+					</xs:annotation>
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="PortalName" type="xs:string" minOccurs="0" maxOccurs="1">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									The PortalName allows to identify the source of the data.
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="DateCreated" type="xs:date" minOccurs="0" maxOccurs="1">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Always helpful to recognize when it was created.
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="Roles" minOccurs="0" maxOccurs="1">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Roles
+									</xs:documentation>
+								</xs:annotation>
+								<xs:complexType>
+					            <xs:sequence>
+                					<xs:element ref="Role" minOccurs="0" maxOccurs="unbounded"/>
+</xs:sequence>
+</xs:complexType>
+
+								</xs:element>
+							<xs:element name="Groups" maxOccurs="unbounded" type="Group">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Groups
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="Permissions" maxOccurs="unbounded" type="Permission">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Permissions
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="Capabilities" maxOccurs="unbounded" type="Capability">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Capabilities
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="MimeTypes" maxOccurs="unbounded" type="MimeType">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Mime Types
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="Clients" maxOccurs="unbounded" type="Client">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Clients
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="MediaTypes" maxOccurs="unbounded" type="MediaType">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Media Types
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+
+	<!--  Associations -->
+
+
+							<xs:element name="ClientToCapabilities" maxOccurs="unbounded" type="ClientCapability">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Client to Capabilities
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="ClientToMimeTypes" maxOccurs="unbounded" type="ClientMimeTypes">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Client To MimeTypes
+									</xs:documentation>
+								</xs:annotation>
+								</xs:element>
+							<xs:element name="MediaToMimeTypes" maxOccurs="unbounded" type="MediaMimeTypes">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Media To MimeTypes
+									</xs:documentation>
+								</xs:annotation>
+	</xs:element>
+						<xs:element name="ProfilingRules" maxOccurs="unbounded" type="ProfilingRule">
+								<xs:annotation>
+									<xs:documentation xml:lang="en">
+									Profiling Rule
+									</xs:documentation>
+								</xs:annotation>
+		</xs:element>
+						</xs:sequence>
+		
+					</xs:complexType>
+				</xs:element>
+			</xs:sequence>
+		</xs:complexType>
+		<xs:key name="UniqueDomain">
+			<xs:selector xpath="Domain"/>
+			<xs:field xpath="@PortalName"/>
+		</xs:key>
+	</xs:element>
+	
+	<xs:complexType name="Role">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">Role ....
+						</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+
+	<xs:complexType name="Group">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">Group ....
+						</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="Permission">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">Permission ....
+						</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="Capability">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">Capability ....
+						</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="capability_id" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="capability" type="xs:string" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="MimeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">Mimetype ....
+						</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="mimetype_id" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="Client">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">Client ....
+						</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="client_id" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="eval_order" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="user_agent_pattern" type="xs:string" minOccurs="0" maxOccurs="1"/>
+				<xs:element name="manufacturer" type="xs:string" minOccurs="0" maxOccurs="1"/>
+			<xs:element name="model" type="xs:string" minOccurs="0" maxOccurs="1"/>
+			<xs:element name="version" type="xs:string" minOccurs="0" maxOccurs="1"/>
+			<xs:element name="preferred_mimetype_id" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="MediaType">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">MediaType ....
+						</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="mediatype_id" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="character_set" type="xs:string" minOccurs="0" maxOccurs="1"/>
+			<xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1"/>
+			<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="ClientCapability">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">
+			Associate clients with capabilities
+			 </xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="clientID" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="capabilityID" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="ClientMimeTypes">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">
+			Associate clients with mime types
+			 </xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="clientID" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="mimetypeID" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+	<xs:complexType name="MediaMimeTypes">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">
+			Associate media types with mime types 
+			 </xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="mediatypeID" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+			<xs:element name="mimetypeID" type="xs:integer" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProfilingRule">
+		<xs:annotation>
+			<xs:documentation xml:lang="en">
+			Profiling Rule
+			 </xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="tbd" type="xs:string" minOccurs="1" maxOccurs="1"/>
+		</xs:sequence>
+	</xs:complexType>
+
+</xs:schema>

Modified: portals/jetspeed-2/trunk/components/serializer/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/pom.xml?view=diff&rev=470544&r1=470543&r2=470544
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/pom.xml (original)
+++ portals/jetspeed-2/trunk/components/serializer/pom.xml Thu Nov  2 14:07:22 2006
@@ -1,132 +1,133 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright 2006 The Apache Software Foundation
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-  $Id:$
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-    <prerequisites>
-        <maven>2.0.4</maven>
-    </prerequisites>
-
-    <!-- POM Identification -->
-
-    <artifactId>jetspeed-serializer</artifactId>
-    <parent>
-        <groupId>org.apache.portals.jetspeed-2</groupId>
-        <artifactId>components</artifactId>
-        <version>2.1-dev</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <packaging>jar</packaging>
-    <name>Jetspeed-2 Serializer</name>
-    <description>
-        Jetspeed Serializer
-    </description>
-
-    <!-- Dependencies -->
-
-    <dependencies>
-
-        <!-- Build Dependencies -->
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>xstream</groupId>
-            <artifactId>xstream</artifactId>
-        </dependency>
-
-        <!-- Runtime Dependencies -->
-        <dependency>
-            <groupId>xml-apis</groupId>
-            <artifactId>xml-apis</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>xerces</groupId>
-            <artifactId>xercesImpl</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-          <groupId>${pom.groupId}</groupId>
-          <artifactId>jetspeed-cm</artifactId>
-        </dependency>            
-        <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>jetspeed-api</artifactId>
-        </dependency>
-    </dependencies>
-
-    <!-- Build Configuration -->
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>hot-deploy-component</id>
-                        <phase>install</phase>
-                        <configuration>
-                            <tasks>
-                                <ant target="hot-deploy-jar" antfile="build.xml" dir="${basedir}/../../app-servers" inheritall="off">
-                                    <property name="org.apache.jetspeed.deploy.enable"
-                                              value="${org.apache.jetspeed.env.hotdeploy}"/>
-                                    <property name="org.apache.jetspeed.deploy.target"
-                                              value="${org.apache.jetspeed.env.deploy.target}"/>
-                                    <property name="org.apache.jetspeed.server.home"
-                                              value="${org.apache.jetspeed.server.home}"/>
-                                    <property name="org.apache.jetspeed.deploy.groupid"
-                                              value="${pom.groupId}"/>
-                                    <property name="org.apache.jetspeed.deploy.artifactid"
-                                              value="${pom.artifactId}"/>
-                                    <property name="org.apache.jetspeed.deploy.version"
-                                              value="${pom.version}"/>
-                                </ant>
-                            </tasks>
-                        </configuration>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <!-- Project Information -->
-
-    <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/portals/jetspeed-2/trunk/components/serializer</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/portals/jetspeed-2/trunk/components/serializer</developerConnection>
-        <url>http://svn.apache.org/viewcvs.cgi/portals/jetspeed-2/trunk/components/serializer/</url>
-    </scm>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2006 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+  $Id:$
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <prerequisites>
+        <maven>2.0.4</maven>
+    </prerequisites>
+
+    <!-- POM Identification -->
+
+    <artifactId>jetspeed-serializer</artifactId>
+    <parent>
+        <groupId>org.apache.portals.jetspeed-2</groupId>
+        <artifactId>components</artifactId>
+        <version>2.1-dev</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <packaging>jar</packaging>
+    <name>Jetspeed-2 Serializer</name>
+    <description>
+        Jetspeed Serializer
+    </description>
+
+    <!-- Dependencies -->
+
+    <dependencies>
+
+        <!-- Build Dependencies -->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-configuration</groupId>
+            <artifactId>commons-configuration</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javolution</groupId>
+            <artifactId>javolution</artifactId>
+            <version>4.0.2</version>
+        </dependency>
+
+        <!-- Runtime Dependencies -->
+        <dependency>
+            <groupId>xml-apis</groupId>
+            <artifactId>xml-apis</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+          <groupId>${pom.groupId}</groupId>
+          <artifactId>jetspeed-cm</artifactId>
+        </dependency>            
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-api</artifactId>
+        </dependency>
+    </dependencies>
+
+    <!-- Build Configuration -->
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>hot-deploy-component</id>
+                        <phase>install</phase>
+                        <configuration>
+                            <tasks>
+                                <ant target="hot-deploy-jar" antfile="build.xml" dir="${basedir}/../../app-servers" inheritall="off">
+                                    <property name="org.apache.jetspeed.deploy.enable"
+                                              value="${org.apache.jetspeed.env.hotdeploy}"/>
+                                    <property name="org.apache.jetspeed.deploy.target"
+                                              value="${org.apache.jetspeed.env.deploy.target}"/>
+                                    <property name="org.apache.jetspeed.server.home"
+                                              value="${org.apache.jetspeed.server.home}"/>
+                                    <property name="org.apache.jetspeed.deploy.groupid"
+                                              value="${pom.groupId}"/>
+                                    <property name="org.apache.jetspeed.deploy.artifactid"
+                                              value="${pom.artifactId}"/>
+                                    <property name="org.apache.jetspeed.deploy.version"
+                                              value="${pom.version}"/>
+                                </ant>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <!-- Project Information -->
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/portals/jetspeed-2/trunk/components/serializer</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/portals/jetspeed-2/trunk/components/serializer</developerConnection>
+        <url>http://svn.apache.org/viewcvs.cgi/portals/jetspeed-2/trunk/components/serializer/</url>
+    </scm>
+
+</project>

Modified: portals/jetspeed-2/trunk/components/serializer/project.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/project.xml?view=diff&rev=470544&r1=470543&r2=470544
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/project.xml (original)
+++ portals/jetspeed-2/trunk/components/serializer/project.xml Thu Nov  2 14:07:22 2006
@@ -38,8 +38,8 @@
 
   <dependencies>
   	<dependency>
-      <id>xstream</id>
-      <version>1.1.2</version>
+      <id>javolution</id>
+      <version>4.0.2</version>
       <properties>
          <war.bundle>true</war.bundle>
       </properties>          

Added: portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java?view=auto&rev=470544
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java (added)
+++ portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java Thu Nov  2 14:07:22 2006
@@ -0,0 +1,308 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.jetspeed.serializer;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.prefs.Preferences;
+
+import javax.security.auth.Subject;
+
+import javolution.xml.XMLBinding;
+import javolution.xml.XMLObjectWriter;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.capabilities.Capabilities;
+import org.apache.jetspeed.capabilities.Capability;
+import org.apache.jetspeed.capabilities.Client;
+import org.apache.jetspeed.capabilities.MediaType;
+import org.apache.jetspeed.capabilities.MimeType;
+import org.apache.jetspeed.components.ComponentManager;
+import org.apache.jetspeed.components.SpringComponentManager;
+import org.apache.jetspeed.engine.JetspeedEngineConstants;
+import org.apache.jetspeed.profiler.Profiler;
+import org.apache.jetspeed.profiler.rules.PrincipalRule;
+import org.apache.jetspeed.profiler.rules.ProfilingRule;
+import org.apache.jetspeed.profiler.rules.RuleCriterion;
+import org.apache.jetspeed.security.BasePrincipal;
+import org.apache.jetspeed.security.Group;
+import org.apache.jetspeed.security.GroupManager;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.PermissionManager;
+import org.apache.jetspeed.security.Role;
+import org.apache.jetspeed.security.RoleManager;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.om.InternalPermission;
+import org.apache.jetspeed.security.om.InternalPrincipal;
+import org.apache.jetspeed.security.spi.PasswordCredentialProvider;
+import org.apache.jetspeed.serializer.objects.JSCapabilities;
+import org.apache.jetspeed.serializer.objects.JSCapability;
+import org.apache.jetspeed.serializer.objects.JSClient;
+import org.apache.jetspeed.serializer.objects.JSClientCapabilities;
+import org.apache.jetspeed.serializer.objects.JSClientMimeTypes;
+import org.apache.jetspeed.serializer.objects.JSClients;
+import org.apache.jetspeed.serializer.objects.JSGroup;
+import org.apache.jetspeed.serializer.objects.JSGroups;
+import org.apache.jetspeed.serializer.objects.JSMediaType;
+import org.apache.jetspeed.serializer.objects.JSMediaTypes;
+import org.apache.jetspeed.serializer.objects.JSMimeType;
+import org.apache.jetspeed.serializer.objects.JSMimeTypes;
+import org.apache.jetspeed.serializer.objects.JSNameValuePairs;
+import org.apache.jetspeed.serializer.objects.JSPermission;
+import org.apache.jetspeed.serializer.objects.JSPermissions;
+import org.apache.jetspeed.serializer.objects.JSPrincipalRule;
+import org.apache.jetspeed.serializer.objects.JSPrincipalRules;
+import org.apache.jetspeed.serializer.objects.JSProfilingRule;
+import org.apache.jetspeed.serializer.objects.JSProfilingRules;
+import org.apache.jetspeed.serializer.objects.JSRole;
+import org.apache.jetspeed.serializer.objects.JSRoles;
+import org.apache.jetspeed.serializer.objects.JSRuleCriterion;
+import org.apache.jetspeed.serializer.objects.JSRuleCriterions;
+import org.apache.jetspeed.serializer.objects.JSSnapshot;
+import org.apache.jetspeed.serializer.objects.JSUser;
+import org.apache.jetspeed.serializer.objects.JSUserAttributes;
+import org.apache.jetspeed.serializer.objects.JSUserGroups;
+import org.apache.jetspeed.serializer.objects.JSUserRoles;
+import org.apache.jetspeed.serializer.objects.JSUserUsers;
+import org.apache.jetspeed.serializer.objects.JSUsers;
+
+/**
+ * Jetspeed Serializer Application
+ * 
+ * invoke with mandatory 
+ * <p>-E filename or -I filename to denote the export or the import file
+ *   
+ * invoke with (optional) parameters as
+ * <p>-p propertyFilename : overwrite the default filename defined in System.getProperty JetSpeed.Serializer.Configuration 
+ * <p>-a ApplicationPath : overwrite the default ./ or ApplicationPath property in properties file)
+ * <p>-b bootPath : one or more file filer statements (seperated by , ) overwrite the default assembly/boot/*.xml or bootPath  property in properties file)  
+ * <p>-c configPath : one or more file filer statements (seperated by , ) overwrite the default assembly/*.xml or configPath property in properties file)
+ * 
+ * <p>-o optionstring : overwrite defrault "ALL,REPLACE"
+ * <p>optionstring: 
+ *      ALL - extract/import all 
+ *      USER - extract/import users
+ *      USERPREFS - extract/import user preferences (for export requires USER)
+ *      CAPABILITIES - extract/import capabilities
+ *      PROFILE = extract/import profile settings (for export requires USER) 
+ *      NOOVERWRITE = don't overwrite existing file (for export)
+ *      BACKUP = backup before process
+ *       
+ * The overall XML file needs to indicate whether passwords used in credentials
+ * are plain text or whether they are encoded. The export algoritm can determine -
+ * prior to reading users - which encode/decode scheme was used and if <none> or
+ * <implements PasswordEncodingService> then we store plain passwords (Note that
+ * that alone requires the resulting XML to be encoded!!!!!)
+ * 
+ * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
+ * @version $Id: $
+ */
+public class JetspeedSerializerApplication
+{
+    
+    
+    public static void main(String[] args)
+    {
+        String propertyFileName = null;
+        
+        String fileName = null; // XML filename - mandatory on command line
+        
+        String applicationPath = null; // configuration.getProperties("applicationPath");
+        String bootConfigFiles = null; // configuration.getProperties("bootConfigFiles");
+        String configFiles = null; // configuration.getProperties("configFiles");
+
+        String name = null;
+        
+        String options = null;
+        
+        PropertiesConfiguration configuration = null;
+        
+        String defaultIndent = null;
+
+        boolean doImport = false;
+        boolean doExport = false;
+ 
+        if (args == null)
+            throw new IllegalArgumentException("Either import or export have to be defined (-I or -E follwoed by the filename");
+
+        
+        // Parse all the command-line arguments
+        for(int n = 0; n < args.length; n++) 
+        {
+          if (args[n].equals("-p")) propertyFileName = args[++n];
+          else if (args[n].equals("-a")) applicationPath = args[++n];
+          else if (args[n].equals("-b")) bootConfigFiles = args[++n];
+          else if (args[n].equals("-c")) configFiles = args[++n];
+          else if (args[n].equals("-E")) { doExport = true; fileName = args[++n];}
+          else if (args[n].equals("-I")) { doImport = true; fileName = args[++n];}
+          else if (args[n].equals("-N")) name = args[++n];
+          else if (args[n].equals("-O")) options = args[++n];
+          else throw new IllegalArgumentException("Unknown argument.");
+        }
+
+        
+        /** The only required argument is the filename for either export or import*/
+        if ((!doImport) && (!doExport))
+          throw new IllegalArgumentException("Either import or export have to be defined (-I or -E follwoed by the filename");
+
+        /** But not both*/
+        if ((doImport) && (doExport))
+            throw new IllegalArgumentException("Only one - either import or export - can be requested");
+
+        if (name == null) name = fileName;
+        
+        /** get system property definition */
+        if (propertyFileName == null)
+            propertyFileName = System.getProperty(
+                "org.apache.jetspeed.xml.importer.configuration",
+                null);
+ 
+        if (propertyFileName != null)
+        {    
+            try
+            {
+                configuration = new PropertiesConfiguration(propertyFileName);
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+                System.exit(1);
+            }
+            if (configuration != null)
+            {
+                /** only read what was not defined on the command line */
+            
+                if (applicationPath == null) applicationPath = configuration.getString("applicationPath");
+                if (bootConfigFiles == null) applicationPath = configuration.getString("bootConfigFiles");
+                if (configFiles == null) applicationPath = configuration.getString("configFiles");
+                if (options == null) applicationPath = configuration.getString("options");
+                if (defaultIndent == null) applicationPath = configuration.getString("defaultIndent");
+                
+            }
+        }
+
+        // if we still miss some settings, use hardoced defaults
+        if (applicationPath == null) applicationPath = "./";
+        if (bootConfigFiles == null) bootConfigFiles = "assembly/boot/*.xml";
+        if (configFiles == null) configFiles = "assembly/*.xml";
+
+        
+        // ok - we are ready to rumble....
+        
+        /** create the instruction map */
+        
+        Map settings = null;
+        if (options != null)
+        {
+            settings = new HashMap();
+            settings.put(JetspeedSerializer.KEY_PROCESS_USERS, Boolean.FALSE);
+            settings.put(JetspeedSerializer.KEY_PROCESS_CAPABILITIES, Boolean.FALSE);
+            settings.put(JetspeedSerializer.KEY_PROCESS_PROFILER, Boolean.FALSE);
+            settings.put(JetspeedSerializer.KEY_PROCESS_USER_PREFERENCES, Boolean.FALSE);
+            settings.put(JetspeedSerializer.KEY_OVERWRITE_EXISTING, Boolean.TRUE);
+            settings.put(JetspeedSerializer.KEY_BACKUP_BEFORE_PROCESS, Boolean.FALSE);            
+            String[] optionSet = getTokens(options);
+            
+            
+            for (int i = 0; i < optionSet.length; i++)
+            {
+                String o = optionSet[i];
+                if (o.equalsIgnoreCase("all"))
+                {
+                    settings.put(JetspeedSerializer.KEY_PROCESS_USERS, Boolean.TRUE);
+                    settings.put(JetspeedSerializer.KEY_PROCESS_CAPABILITIES, Boolean.TRUE);
+                    settings.put(JetspeedSerializer.KEY_PROCESS_PROFILER, Boolean.TRUE);
+                    settings.put(JetspeedSerializer.KEY_PROCESS_USER_PREFERENCES, Boolean.TRUE);
+                }
+                else
+                if (o.equalsIgnoreCase("user"))
+                    settings.put(JetspeedSerializer.KEY_PROCESS_USERS, Boolean.TRUE);
+                else 
+                    if (o.equalsIgnoreCase("USERPREFS"))
+                        settings.put(JetspeedSerializer.KEY_PROCESS_USER_PREFERENCES, Boolean.TRUE);
+                    else 
+                        if (o.equalsIgnoreCase("CAPABILITIES"))
+                            settings.put(JetspeedSerializer.KEY_PROCESS_CAPABILITIES, Boolean.TRUE);
+                        else 
+                            if (o.equalsIgnoreCase("PROFILE"))
+                                settings.put(JetspeedSerializer.KEY_PROCESS_PROFILER, Boolean.TRUE);
+                            else 
+                                if (o.equalsIgnoreCase("NOOVERWRITE"))
+                                    settings.put(JetspeedSerializer.KEY_OVERWRITE_EXISTING, Boolean.FALSE);
+                                else 
+                                    if (o.equalsIgnoreCase("BACKUP"))
+                                        settings.put(JetspeedSerializer.KEY_BACKUP_BEFORE_PROCESS, Boolean.TRUE);
+                
+            }
+        }
+        JetspeedSerializer serializer = null;
+        try
+        {
+            if (applicationPath == null) applicationPath = "./";
+            if (bootConfigFiles == null) bootConfigFiles = "assembly/boot/*.xml";
+            if (configFiles == null) configFiles = configuration.getString("assembly/*.xml");
+
+            serializer = new JetspeedSerializerImpl(applicationPath,getTokens(bootConfigFiles),getTokens(configFiles));
+            if (doExport)
+                serializer.exportData(name, fileName, settings);
+            else
+                serializer.importData(fileName, settings);
+        } catch (Exception e)
+        {
+            System.err.println("Failed to process XML " + (doExport?"export":"import")+ ":" + e);
+            e.printStackTrace();
+        }
+        finally
+        {
+            if (serializer != null)
+                serializer.closeUp();
+            System.out.println("DONE performing " + (doExport?"export":"import")+ " with " + fileName);
+        }
+
+    }
+        
+        
+        private static  String[] getTokens(String _line)
+        {
+            if ((_line == null) || (_line.length() == 0))
+                return null;
+            
+            StringTokenizer st = new StringTokenizer(_line, ",");
+            ArrayList list = new ArrayList();
+
+            while (st.hasMoreTokens())
+                list.add(st.nextToken());
+            String[] s = new String[list.size()];
+            for (int i=0; i<list.size(); i++)
+                s[i] = (String)list.get(i);
+            return s;
+        }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org