portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r533883 [1/3] - in /portals/jetspeed-2/branches/J2-M2-REDUX: components/jetspeed-capability/ components/jetspeed-capability/src/main/java/org/apache/jetspeed/ components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/ comp...
Date Mon, 30 Apr 2007 23:41:10 GMT
Author: ate
Date: Mon Apr 30 16:41:09 2007
New Revision: 533883

URL: http://svn.apache.org/viewvc?view=rev&rev=533883
Log:
Complete refactoring of the JetspeedSerializer!
The JetspeedSerializer was a monolitic component which depended on all other components for which it performed data serialization: capabilities, security, profiler and registry.
This caused setting up a proper test environment without circular dependencies in the build impossible.
Furthermore, extending/improving upon the JetspeedSerializer wouldn't be a trivial task at all.

So, I've "turned it inside out", making it a "normal" Spring component by itself, and breaking out the large serialization code in "pluggable" JetspeedComponentSerializer classes.
No, each component for which serialization is needed, can provide its own (part of the) serialization with a component scoped JetspeedComponentSerializer implementation.

Furthermore, and most important, because the main JetspeedSerializer(Impl) now can be configured with one or more component serializers, and it no longer depends on any of them,
it can be used for seeding test data for a specific component (only).
For the tests, I've also added a deleteData method to the JetspeedComponentSerializer which can be used for cleaning out (component specific) data before/after a test case run.

I've already got the simplest (database related) tests working for the Capabilities component which I will commit shortly hereafter.
For the other (database related) tests, I'll try to adjust en configure them ASAP.

One last important remark:
The original usage of the jetspeedSerializer was command line based through the JetspeedSerializerApplication.
For now, I've temporarily removed the implementation code from this class because the new setup requires a complete rehaul for it.
Once I've got all the tests working properly again, I'll reimplement this class using the new configuration.  

Added:
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java   (with props)
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/serializer/
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java   (with props)
    portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-api/src/main/java/org/apache/jetspeed/serializer/JetspeedComponentSerializer.java   (with props)
    portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-api/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializedData.java   (with props)
Removed:
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerBase.java
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerSecondaryImpl.java
Modified:
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/pom.xml
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/   (props changed)
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-profiler/pom.xml
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-registry/pom.xml
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-security/pom.xml
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/pom.xml
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermission.java
    portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
    portals/jetspeed-2/branches/J2-M2-REDUX/jetspeed-api/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializer.java

Modified: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/pom.xml?view=diff&rev=533883&r1=533882&r2=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/pom.xml (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/pom.xml Mon Apr 30 16:41:09 2007
@@ -51,6 +51,10 @@
       <groupId>${pom.groupId}</groupId>
       <artifactId>jetspeed-rdbms</artifactId>
     </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>jetspeed-serializer</artifactId>
+    </dependency>
     
   </dependencies>
   

Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Apr 30 16:41:09 2007
@@ -1,2 +1,2 @@
-target
+target
 surefire*.properties

Added: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java?view=auto&rev=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java Mon Apr 30 16:41:09 2007
@@ -0,0 +1,610 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+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.serializer.objects.JSCapabilities;
+import org.apache.jetspeed.serializer.objects.JSCapability;
+import org.apache.jetspeed.serializer.objects.JSClient;
+import org.apache.jetspeed.serializer.objects.JSClients;
+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.JSSnapshot;
+
+/**
+ * @version $Id$
+ * 
+ */
+public class JetspeedCapabilitiesSerializer extends AbstractJetspeedComponentSerializer
+{
+    protected Capabilities caps;
+
+    private static class Refs
+    {
+        HashMap mimeMap = new HashMap();
+
+        HashMap mimeMapInt = new HashMap();
+
+        HashMap mediaMap = new HashMap();
+
+        HashMap capabilityMap = new HashMap();
+
+        HashMap capabilityMapInt = new HashMap();
+
+        HashMap clientMap = new HashMap();
+    }
+
+    public JetspeedCapabilitiesSerializer(Capabilities caps)
+    {
+        this.caps = caps;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.serializer.JetspeedComponentSerializer#processImport(org.apache.jetspeed.serializer.objects.JSSnapshot,
+     *      java.util.Map, org.apache.commons.logging.Log)
+     */
+    protected void processImport(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+        if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_CAPABILITIES))
+        {
+            log.info("creating clients, mediatypes and mimetypes");
+            log.debug("importCapabilitiesInfrastructure - processing");
+            recreateCapabilities(snapshot, settings, log);
+            recreateMimeTypes(snapshot, settings, log);
+            recreateMediaTypes(snapshot, settings, log);
+            recreateClients(snapshot, settings, log);
+            log.debug("importCapabilitiesInfrastructure - processing done");
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jetspeed.serializer.JetspeedComponentSerializer#processExport(org.apache.jetspeed.serializer.objects.JSSnapshot,
+     *      java.util.Map, org.apache.commons.logging.Log)
+     */
+    protected void processExport(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+        if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_CAPABILITIES))
+        {
+            log.debug("collecting clients, mediatypes and mimetypes");
+
+            Refs refs = new Refs();
+            
+             //get the clients (which in turn will get the mime types and capabilities)
+            exportClients(refs, snapshot, settings, log);
+            // get the mediatTypes, too
+            exportMediaTypes(refs, snapshot, settings, log);
+        }
+    }
+    
+    protected void deleteData(Map settings, Log log) throws SerializerException
+    {
+        if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_CAPABILITIES))
+        {
+            log.debug("deleting clients, mediatypes and mimetypes");
+            
+            try
+            {
+                Iterator _it = caps.getMediaTypes();
+
+                while (_it != null && _it.hasNext())
+                {
+                    caps.deleteMediaType((MediaType)_it.next());
+                }
+                    
+                _it = caps.getClients();
+                while (_it != null && _it.hasNext())
+                {
+                    caps.deleteClient((Client) _it.next());
+                }
+
+                _it = caps.getCapabilities();
+                while (_it != null && _it.hasNext())
+                {
+                    caps.deleteCapability((Capability) _it.next());
+                }
+                
+                _it = caps.getMimeTypes();
+                while (_it != null && _it.hasNext())
+                {
+                    caps.deleteMimeType((MimeType) _it.next());
+                }
+            }
+            catch (Exception e)
+            {
+                throw new SerializerException(e);
+            }
+        }
+    }
+
+    private void recreateCapabilities(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+        log.debug("recreateCapabilities - processing");
+        JSCapabilities capabilities = snapshot.getCapabilities();
+        if ((capabilities != null) && (capabilities.size() > 0))
+        {
+            Iterator _it = capabilities.iterator();
+            while (_it.hasNext())
+            {
+                JSCapability _c = (JSCapability) _it.next();
+                // create a new Capability
+                try
+                {
+                    Capability capability = caps.createCapability(_c.getName());
+                    /**
+                     * THE KEY_OVERWRITE_EXISTING test is not required for
+                     * capabilites, since they carry no other information than
+                     * the name Used here for consistency, though
+                     */
+                    if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING))
+                            || (capability.getCapabilityId() == 0))
+                    {
+                        caps.storeCapability(capability);
+                    }
+                }
+                catch (Exception e)
+                {
+                    throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(
+                            "org.apache.jetspeed.capabilities.Capabilities", e.getLocalizedMessage()));
+                }
+            }
+        }
+        else
+            log.debug("NO CAPABILITES?????");
+        log.debug("recreateCapabilities - done");
+    }
+
+    private void recreateMimeTypes(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+        log.debug("recreateMimeTypes - processing");
+        JSMimeTypes mimeTypes = snapshot.getMimeTypes();
+        if ((mimeTypes != null) && (mimeTypes.size() > 0))
+        {
+            Iterator _it = mimeTypes.iterator();
+            while (_it.hasNext())
+            {
+                JSMimeType _c = (JSMimeType) _it.next();
+                // create a new Mime Type
+                try
+                {
+                    MimeType mimeType = caps.createMimeType(_c.getName());
+                    /**
+                     * THE KEY_OVERWRITE_EXISTING test is not required for mime
+                     * types, since they carry no other information than the
+                     * name Used here for consistency, though
+                     */
+                    if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING))
+                            || (mimeType.getMimetypeId() == 0))
+                    {
+                        caps.storeMimeType(mimeType);
+                    }
+
+                }
+                catch (Exception e)
+                {
+                    throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(
+                            "org.apache.jetspeed.capabilities.MimeType", e.getLocalizedMessage()));
+                }
+            }
+        }
+        else
+            log.debug("NO MIME TYPES?????");
+        log.debug("recreateMimeTypes - done");
+    }
+
+    private void recreateMediaTypes(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+        String _line;
+
+        log.debug("recreateMediaTypes - processing");
+        JSMediaTypes mediaTypes = snapshot.getMediaTypes();
+        if ((mediaTypes != null) && (mediaTypes.size() > 0))
+        {
+            Iterator _it = mediaTypes.iterator();
+            while (_it.hasNext())
+            {
+                JSMediaType _c = (JSMediaType) _it.next();
+                // create a new Media
+                try
+                {
+                    MediaType mediaType = caps.createMediaType(_c.getName());
+                    /**
+                     * THE KEY_OVERWRITE_EXISTING test IS required for media
+                     * types, since they carry no other information than the
+                     * name Used here for consistency, though
+                     */
+                    if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING))
+                            || (mediaType.getMediatypeId() == 0))
+                    {
+                        // set object fields
+                        mediaType.setCharacterSet(_c.getCharacterSet());
+                        mediaType.setTitle(_c.getTitle());
+                        mediaType.setDescription(_c.getDescription());
+
+                        try
+                        {
+                            _line = _c.getMimeTypesString().toString();
+                            ArrayList list = getTokens(_line);
+                            if ((list != null) && (list.size() > 0))
+                            {
+                                Iterator _it1 = list.iterator();
+                                int added = 0;
+                                while (_it1.hasNext())
+                                {
+                                    MimeType _mt = caps.createMimeType((String) _it1.next());
+                                    if (_mt != null)
+                                        mediaType.addMimetype(_mt);
+                                    added++;
+                                }
+                            }
+                        }
+                        catch (Exception e1)
+                        {
+                            e1.printStackTrace();
+                        }
+                        try
+                        {
+                            _line = _c.getCapabilitiesString().toString();
+                            ArrayList list = getTokens(_line);
+                            if ((list != null) && (list.size() > 0))
+                            {
+                                Iterator _it1 = list.iterator();
+                                if ((list != null) && (list.size() > 0))
+                                {
+                                    int added = 0;
+                                    while (_it1.hasNext())
+                                    {
+                                        Capability _ct = caps.createCapability((String) _it1.next());
+                                        if (_ct != null)
+                                            mediaType.addCapability(_ct);
+                                        added++;
+                                    }
+                                }
+                            }
+                        }
+                        catch (Exception e1)
+                        {
+                            e1.printStackTrace();
+                        }
+                        caps.storeMediaType(mediaType);
+                    }
+                }
+                catch (Exception e)
+                {
+                    throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(
+                            "org.apache.jetspeed.capabilities.MediaType", e.getLocalizedMessage()));
+                }
+            }
+        }
+        else
+            log.debug("NO MEDIA TYPES?????");
+        log.debug("recreateMediaTypes - done");
+    }
+
+    private void recreateClients(JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+        String _line;
+
+        log.debug("recreateClients - processing");
+        JSClients clients = snapshot.getClients();
+        if ((clients != null) && (clients.size() > 0))
+        {
+            Iterator _it = clients.iterator();
+            while (_it.hasNext())
+            {
+                JSClient _c = (JSClient) _it.next();
+                // create a new Media
+                try
+                {
+                    Client client = caps.createClient(_c.getName());
+                    /**
+                     * THE KEY_OVERWRITE_EXISTING test IS required for media
+                     * types, since they carry no other information than the
+                     * name Used here for consistency, though
+                     */
+                    if ((isSettingSet(settings, JetspeedSerializer.KEY_OVERWRITE_EXISTING))
+                            || (client.getClientId() == 0))
+                    {
+                        // set object fields
+                        client.setUserAgentPattern(_c.getUserAgentPattern());
+                        client.setManufacturer(_c.getManufacturer());
+                        client.setModel(_c.getModel());
+                        client.setEvalOrder(_c.getEvalOrder());
+                        String myPrefMimeType = _c.getPreferredMimeTypeID();
+                        client.setVersion(_c.getVersion());
+                        try
+                        {
+                            _line = _c.getMimeTypesString().toString();
+                            ArrayList list = getTokens(_line);
+                            if ((list != null) && (list.size() > 0))
+                            {
+                                Iterator _it1 = list.iterator();
+                                int added = 0;
+                                while (_it1.hasNext())
+                                {
+                                    MimeType _mt = caps.createMimeType((String) _it1.next());
+                                    if (_mt != null)
+                                    {
+                                        client.getMimetypes().add(_mt);
+                                        if (_mt.getMimetypeId() == 0)
+                                        {
+                                            caps.storeMimeType(_mt);
+                                        }
+                                        if (myPrefMimeType.equalsIgnoreCase(_mt.getName()))
+                                            client.setPreferredMimeTypeId(_mt.getMimetypeId());
+
+                                    }
+                                    added++;
+                                }
+                            }
+                        }
+                        catch (Exception e1)
+                        {
+                            e1.printStackTrace();
+                        }
+                        try
+                        {
+                            _line = _c.getCapabilitiesString().toString();
+                            ArrayList list = getTokens(_line);
+                            if ((list != null) && (list.size() > 0))
+                            {
+                                Iterator _it1 = list.iterator();
+                                if ((list != null) && (list.size() > 0))
+                                {
+                                    int added = 0;
+                                    while (_it1.hasNext())
+                                    {
+                                        Capability _ct = caps.createCapability((String) _it1.next());
+                                        if (_ct != null)
+                                            client.getCapabilities().add(_ct);
+                                        added++;
+                                    }
+                                }
+                            }
+                        }
+                        catch (Exception e1)
+                        {
+                            e1.printStackTrace();
+                        }
+                        caps.storeClient(client);
+                    }
+                }
+                catch (Exception e)
+                {
+                    throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(
+                            "org.apache.jetspeed.capabilities.Client", e.getLocalizedMessage()));
+                }
+            }
+        }
+        else
+            log.debug("NO MEDIA TYPES?????");
+        log.debug("recreateClients - done");
+    }
+    
+    /**
+     * extract the capabilities and save in snapshot file
+     * 
+     * @throws SerializerException
+     */
+    private void exportCapabilites(Refs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+
+        Iterator list = caps.getCapabilities();
+
+        while (list.hasNext())
+        {
+            try
+            {
+                Capability _cp = (Capability) list.next();
+                JSCapability _jsC = new JSCapability();
+                _jsC.setName(_cp.getName());
+                refs.capabilityMap.put(_jsC.getName(), _jsC);
+                refs.capabilityMapInt.put(new Integer(_cp.getCapabilityId()), _jsC);
+                snapshot.getCapabilities().add(_jsC);
+            } catch (Exception e)
+            {
+                throw new SerializerException(
+                        SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
+                                .create(new String[]
+                                { "C", e.getMessage()}));
+            }
+        }
+        return;
+
+    }
+
+    /**
+     * exstract the mime types anmd save in snapshot file
+     * 
+     * @throws SerializerException
+     */
+    private void exportMimeTypes(Refs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+
+        Iterator list = caps.getMimeTypes();
+
+        while (list.hasNext())
+        {
+            try
+            {
+                MimeType _mt = (MimeType) list.next();
+                JSMimeType _jsM = new JSMimeType();
+                _jsM.setName(_mt.getName());
+                refs.mimeMap.put(_jsM.getName(), _jsM);
+                refs.mimeMapInt.put(new Integer(_mt.getMimetypeId()), _jsM);
+
+                snapshot.getMimeTypes().add(_jsM);
+            } catch (Exception e)
+            {
+                throw new SerializerException(
+                        SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
+                                .create(new String[]
+                                { "MimeType", e.getMessage()}));
+            }
+        }
+        return;
+
+    }
+
+    /**
+     * create a JS CLient
+     * 
+     * @return
+     * @throws SerializerException
+     */
+
+    private JSClient createJSClient(Refs refs, Client c) throws SerializerException
+    {
+        try
+        {
+            JSClient jsC = new JSClient(c);
+            // find the mimeTypes
+            Iterator _itM = c.getMimetypes().iterator();
+            while (_itM.hasNext())
+            {
+                MimeType _m = (MimeType) _itM.next();
+                JSMimeType _mt = (JSMimeType) refs.mimeMap.get(_m.getName());
+                if (_mt != null) jsC.getMimeTypes().add(_mt);
+            }
+            
+            Integer id = new Integer(c.getPreferredMimeTypeId());
+            JSMimeType _mt = (JSMimeType) refs.mimeMapInt.get(id);
+            if (_mt != null)
+                jsC.setPreferredMimeTypeID(_mt.getName());
+            else
+                jsC.setPreferredMimeTypeID("???");
+
+            // find the capabilities
+            Iterator _itC = c.getCapabilities().iterator();
+            while (_itC.hasNext())
+            {
+                Capability _c = (Capability) _itC.next();
+                JSCapability _ct = (JSCapability) refs.capabilityMap.get(_c
+                        .getName());
+                if (_ct != null) jsC.getCapabilities().add(_ct);
+            }
+
+            return jsC;
+        } catch (Exception e)
+        {
+            throw new SerializerException(
+                    SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
+                            .create(new String[]
+                            { "Client", e.getMessage()}));
+        }
+
+    }
+
+    
+
+    /**
+     * extract the current clients and save in the snapshot file
+     * 
+     * @param list
+     * @param caps
+     * @return
+     * @throws SerializerException
+     */
+    private void exportClients(Refs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+
+        /** first the the mime types */
+        exportMimeTypes(refs, snapshot, settings, log);
+
+        /** second get the capabilities */
+        this.exportCapabilites(refs, snapshot, settings, log);
+
+        /** now get the clients */
+        Iterator _it = caps.getClients();
+        while (_it.hasNext())
+        {
+            Client c = (Client) _it.next();
+            JSClient jsC = createJSClient(refs, c);
+            if (jsC == null)
+                throw new SerializerException(
+                        SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
+                                .create(new String[]
+                                { "Client", "createClient returned NULL"}));
+            refs.clientMap.put(jsC.getName(), jsC);
+            snapshot.getClients().add(jsC);
+        }
+        return;
+    }
+
+    /**
+     * extract the media types and save in snapshot file
+     * 
+     * @param caps
+     *            capabilit container
+     * @throws SerializerException
+     */
+    private void exportMediaTypes(Refs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException
+    {
+        Iterator list = caps.getMediaTypes();
+
+        while (list.hasNext())
+        {
+            try
+            {
+                MediaType _mt = (MediaType) list.next();
+                JSMediaType _jsM = new JSMediaType(_mt);
+                // find the mimeTypes
+                Iterator _itM = _mt.getMimetypes().iterator();
+                while (_itM.hasNext())
+                {
+                    MimeType _m = (MimeType) _itM.next();
+                    JSMimeType _mttype = (JSMimeType) refs.mimeMap.get(_m.getName());
+                    if (_mttype != null) _jsM.getMimeTypes().add(_mttype);
+                }
+                // find the capabilities
+                Iterator _itC = _mt.getCapabilities().iterator();
+                while (_itC.hasNext())
+                {
+                    Capability _c = (Capability) _itC.next();
+                    JSCapability _ct = (JSCapability) refs.capabilityMap.get(_c
+                            .getName());
+                    if (_ct != null) _jsM.getCapabilities().add(_ct);
+                }
+                refs.mediaMap.put(_jsM.getName(), _jsM);
+                snapshot.getMediaTypes().add(_jsM);
+            } catch (Exception e)
+            {
+                // do whatever
+                throw new SerializerException(
+                        SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
+                                .create(new String[]
+                                { "MediaType", e.getMessage()}));
+            }
+        }
+        return;
+    }
+}

Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-capability/src/main/java/org/apache/jetspeed/serializer/JetspeedCapabilitiesSerializer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-profiler/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-profiler/pom.xml?view=diff&rev=533883&r1=533882&r2=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-profiler/pom.xml (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-profiler/pom.xml Mon Apr 30 16:41:09 2007
@@ -57,6 +57,10 @@
             <groupId>${pom.groupId}</groupId>
             <artifactId>jetspeed-security</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-serializer</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

Modified: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-registry/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-registry/pom.xml?view=diff&rev=533883&r1=533882&r2=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-registry/pom.xml (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-registry/pom.xml Mon Apr 30 16:41:09 2007
@@ -62,6 +62,14 @@
             <groupId>${pom.groupId}</groupId>
             <artifactId>jetspeed-prefs</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-search</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-serializer</artifactId>
+        </dependency>
         <!--
             Note: junit is normally required only for test, but 
             in this case, abstract test cases are included in the

Modified: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-security/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-security/pom.xml?view=diff&rev=533883&r1=533882&r2=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-security/pom.xml (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-security/pom.xml Mon Apr 30 16:41:09 2007
@@ -58,6 +58,10 @@
             <groupId>${pom.groupId}</groupId>
             <artifactId>jetspeed-prefs</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>jetspeed-serializer</artifactId>
+        </dependency>
         <dependency>        
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>

Modified: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/pom.xml?view=diff&rev=533883&r1=533882&r2=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/pom.xml (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/pom.xml Mon Apr 30 16:41:09 2007
@@ -51,14 +51,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>jetspeed-rdbms</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>jetspeed-registry</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring</artifactId>
         </dependency>
@@ -84,10 +76,6 @@
         </dependency>
         
         <!-- Runtime Dependencies -->
-        <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>jetspeed-cm</artifactId>
-        </dependency>            
         <dependency>
             <groupId>xml-apis</groupId>
             <artifactId>xml-apis</artifactId>

Added: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java?view=auto&rev=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java (added)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java Mon Apr 30 16:41:09 2007
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.util.ArrayList;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.jetspeed.serializer.objects.JSSnapshot;
+
+/**
+ * @version $Id$
+ * 
+ */
+public abstract class AbstractJetspeedComponentSerializer implements JetspeedComponentSerializer
+{
+    public void deleteData(Map settings) throws SerializerException
+    {
+        deleteData(settings, (Log)settings.get(JetspeedSerializer.KEY_LOGGER));
+    }
+
+    public void processExport(JetspeedSerializedData data, Map settings) throws SerializerException
+    {
+        processExport((JSSnapshot)data, settings, (Log)settings.get(JetspeedSerializer.KEY_LOGGER));
+    }
+
+    public void processImport(JetspeedSerializedData data, Map settings) throws SerializerException
+    {
+        processImport((JSSnapshot)data, settings, (Log)settings.get(JetspeedSerializer.KEY_LOGGER));
+    }
+
+    protected abstract void deleteData(Map settings, Log log) throws SerializerException;
+
+    protected abstract void processExport(JSSnapshot data, Map settings, Log log) throws SerializerException;
+
+    protected abstract void processImport(JSSnapshot data, Map settings, Log log) throws SerializerException;
+    
+    /**
+     * returns if the key for a particular setting is true. False if the key
+     * doesn't exist.
+     * 
+     * @param key
+     * @return
+     */
+    protected static boolean isSettingSet(Map settings, String key)
+    {
+        if ( settings != null )
+        {
+            Object o = settings.get(key);
+            if ( o != null && o instanceof Boolean )
+            {
+                return ((Boolean)o).booleanValue();
+            }
+        }
+        return false;
+    }
+
+    /**
+     * convert a list of elements in a string, seperated by ',' into an
+     * arraylist of strings
+     * 
+     * @param _line
+     *            Strinbg containing one or more elements seperated by ','
+     * @return list of elements of null
+     */
+    protected static final ArrayList 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());
+        return list;
+    }
+}

Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/AbstractJetspeedComponentSerializer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java?view=diff&rev=533883&r1=533882&r2=533883
==============================================================================
--- portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java (original)
+++ portals/jetspeed-2/branches/J2-M2-REDUX/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java Mon Apr 30 16:41:09 2007
@@ -16,17 +16,6 @@
  */
 package org.apache.jetspeed.serializer;
 
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.jetspeed.components.jndi.SpringJNDIStarter;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
 /**
  * Jetspeed Serializer Application
  * 
@@ -74,443 +63,6 @@
  */
 public class JetspeedSerializerApplication
 {
-    public static final String JNDI_DS_NAME = "jetspeed";    
-    
-    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;
-
-    	String driverClass = null; // jdbc driver
-    	String url = null; // jdbc url to database
-    	String user = null; // user
-    	String password = null; // password
-
-        String logLevel = 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("-l"))
-                logLevel = args[++n];
-            else if (args[n].equals("-O"))
-                options = args[++n];
-            else if (args[n].equals("-dc"))
-                driverClass = args[++n];
-            else if (args[n].equals("-ds"))
-                url = args[++n];
-            else if (args[n].equals("-du"))
-            {
-                if (((n + 1) >= args.length) || args[n + 1].startsWith("-d"))
-                {
-                    user = "";
-                } else
-                {
-                    user = args[++n];
-                }
-            } 
-            else if (args[n].equals("-dp"))
-            {
-                if (((n + 1) >= args.length) || args[n + 1].startsWith("-d"))
-                {
-                    password = "";
-                } else
-                {
-                    password = args[++n];
-                }
-            } 
-            else
-            {
-                throw new IllegalArgumentException("Unknown argument: "
-                        + args[n]);
-            }
-        }
-        
-        /** 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)  
-                    bootConfigFiles = configuration.getString("bootConfigFiles");
-                if (configFiles == null) 
-                    configFiles = configuration.getString("configFiles");
-                if (options == null) 
-                    options = configuration.getString("options");
-                if (defaultIndent == null) 
-                    defaultIndent = configuration.getString("defaultIndent");
-
-        		if (driverClass == null)
-    				driverClass = configuration.getString("driverClass");
-    			if (url == null)
-    				url = configuration.getString("url");
-    			if (user == null)
-    				user = configuration.getString("user");
-    			if (password == null)
-    				password = configuration.getString("password");
-    			if (logLevel == null)
-    				logLevel = configuration.getString("loglevel");
-    				
-    	
-            }
-        }
-
-        // if we still miss some settings, use hardoced defaults
-        if (applicationPath == null) 
-            applicationPath = "./";
-        if (bootConfigFiles == null) 
-            bootConfigFiles = "assembly/boot/";
-        if (configFiles == null) 
-            configFiles = "assembly/";
-		if (logLevel == null) 
-            logLevel = "ERROR";
-      
-
-        bootConfigFiles = bootConfigFiles + "*.xml";
-        configFiles = configFiles + "*.xml";
-     
-        // ok - we are ready to rumble....
-        
-        /** create the instruction map */
-        
-        Map settings = null;
-        int processHelper = 1; // default process SEED
-        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);
-            
-            processHelper = 0;
-            
-            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.FALSE);
-                    processHelper = 1;
-                }
-                else
-                if (o.equalsIgnoreCase("user"))
-                {
-                    settings.put(JetspeedSerializer.KEY_PROCESS_USERS, Boolean.TRUE);
-                    processHelper = 1;
-                }
-                else 
-                    if (o.equalsIgnoreCase("PREFS"))
-                    {
-                        settings.put(JetspeedSerializer.KEY_PROCESS_USER_PREFERENCES, Boolean.TRUE);
-                		processHelper = 2;
-                    }
-                    else 
-                        if (o.equalsIgnoreCase("CAPABILITIES"))
-                        {
-                            settings.put(JetspeedSerializer.KEY_PROCESS_CAPABILITIES, Boolean.TRUE);
-                            processHelper = 1;
-                        }
-                        else 
-                            if (o.equalsIgnoreCase("PROFILE"))
-                            {
-                                settings.put(JetspeedSerializer.KEY_PROCESS_PROFILER, Boolean.TRUE);
-                                processHelper = 1;
-                            }
-                            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;
-
-		if (driverClass == null)
-			driverClass = System.getProperty(
-					"org.apache.jetspeed.database.driverClass",
-					"com.mysql.jdbc.Driver");
-		if (url == null)
-			url = System.getProperty("org.apache.jetspeed.database.url",
-					"jdbc:mysql://localhost/j2test");
-		if (user == null)
-			user = System.getProperty("org.apache.jetspeed.database.user",
-					"user");
-		if (password == null)
-			password = System.getProperty(
-					"org.apache.jetspeed.database.password", "password");
-
-		if (driverClass == null)
-			throw new IllegalArgumentException(
-					"Can't proceed without a valid driver");
-		if (url == null)
-			throw new IllegalArgumentException(
-					"Can't proceed without a valid url to the target database");
-		if (user == null)
-			throw new IllegalArgumentException(
-					"Can't proceed without a valid database user");
-
-        
-        
-        HashMap context = new HashMap();
- 
-		context.put(SpringJNDIStarter.DATASOURCE_DRIVER, driverClass);
-		context.put(SpringJNDIStarter.DATASOURCE_URL, url);
-		context.put(SpringJNDIStarter.DATASOURCE_USERNAME, user);
-		context.put(SpringJNDIStarter.DATASOURCE_PASSWORD, password);
-        
-		Logger  logger = Logger.getLogger("org.springframework");
-		Level level = logger.getLevel();
-		if (logLevel.equalsIgnoreCase("INFO"))
-			logger.setLevel(Level.INFO);
-		else
-			if (logLevel.equalsIgnoreCase("WARN"))
-				logger.setLevel(Level.WARN);
-			else
-				logger.setLevel(Level.ERROR);
-				
-/**
- * set the application root
- */
-        System.out.println("APP ROOT is " + applicationPath);
-		System.setProperty("applicationRoot",applicationPath);
-		System.setProperty("portal.name","jetspped");
-        SpringJNDIStarter starter = new SpringJNDIStarter(context,applicationPath,getTokens(bootConfigFiles),getTokens(configFiles));
-        
-        System.out.println("starter framework created " + starter);
-        
-        
-        try
-        {
-            starter.setUp();
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            System.exit(1);
-        }
-        System.out.println("starter framework established " + starter);
-        String[] importList = null;
-
-        if (doImport)
-        	importList = parseFiles(fileName);
-    	
-        if ((doImport) && (importList != null) && (importList.length > 0))
-        {
-			for (int i = 0; i < importList.length; i++)
-			{
-				try
-			    {
-			        System.out.println("processing import  " + importList[i]);
-			        if (processHelper == 2)
-			        {
-			        	serializer = new JetspeedSerializerSecondaryImpl(starter.getComponentManager());
-			        }
-			        else
-			        	serializer = new JetspeedSerializerImpl(starter.getComponentManager());
-			        serializer.importData(importList[i], settings);
-			        System.out.println("processing import  " + importList[i] + " done");
-			        
-			    } 
-			    catch (Exception e)
-			    {
-			        System.err.println("Failed to process XML import for " + importList[i] + ":" + e);
-			        e.printStackTrace();
-			    }
-			    finally
-			    {
-			        if (serializer != null)
-			            serializer.closeUp();
-			    }
-			 }
-        }
-        if (doExport)
-        {
-        	try
-	        {
-		        System.out.println("processing export to  " + fileName);
-		        if (processHelper == 2)
-		        {
-		        	serializer = new JetspeedSerializerSecondaryImpl(starter.getComponentManager());
-		        }
-		        else
-		        	serializer = new JetspeedSerializerImpl(starter.getComponentManager());
-
-		        serializer.exportData(name, fileName, settings);
-	        } 
-	        catch (Exception e)
-	        {
-	            System.err.println("Failed to process XML export of " + fileName + ": " + e);
-	            e.printStackTrace();
-	        }
-	        finally
-	        {
-	            if (serializer != null)
-	                serializer.closeUp();
- 	        }
-
-        }
-        try
-        {
-           starter.tearDown();
-           logger.setLevel(level);;
-        }
-        catch (Exception e1)
-        {
-            System.out.println("starter framework teardown caused exception "  + e1.getLocalizedMessage());
-            e1.printStackTrace();
-            
-        }            
-        System.out.println("DONE performing " + (doExport?"export":"import")+ " with " + fileName);
-    }
-    
-        
-       
-	/**
-	 * process provided filename or directory name
-	 * 
-	 * @return one or more files to be processed
-	 */
-	static private String[] parseFiles(String schemaDirectory)
-	{
-		String[] fileList = null;
-		try
-		{
-			File dir = new File(schemaDirectory);
-			if (!(dir.exists()))
-            {
-				return fileList;
-            }
-			if (!(dir.isDirectory()))
-			{
-				fileList = new String[1];
-				fileList[0] = schemaDirectory;
-				return fileList;
-			}
-			// 	Handling a directory
-			File[] files = dir.listFiles(
-				    new FilenameFilter() {
-				        public boolean accept(File dir, String name) 
-				        			{String n = name.toLowerCase();
-	   								return n.endsWith("seed.xml");
-				        }
-				    });
-			if (files == null)
-				return fileList;
-
-			fileList = new String[files.length];
-			for (int i = 0; i < files.length; i++)
-            {
-				fileList[i] = files[i].getAbsolutePath();
-            }
-			return fileList;
-		} 
-        catch (Exception e)
-		{
-			e.printStackTrace(); 
-			throw new IllegalArgumentException(
-					"Processing the schema-directory " + schemaDirectory
-							+ " caused exception "
-							+ e.getLocalizedMessage());
-		}
-
-		
-	}
-
-    
-        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;
-        }
-
-        
+    // Ate: I've temporarily deleted all content of this class while the JetspeedSerializer is refactored
+    //      Once that is ready, this class will be reimplemented
 }



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


Mime
View raw message