mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
System View Import
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2013 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,9 +26,10 @@ import org.xml.sax.SAXException;
|
|||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base Import Content Handler
|
* Default Import Content Handler
|
||||||
|
*
|
||||||
|
* Responsible for interacting with an Alfresco Importer.
|
||||||
*/
|
*/
|
||||||
public class DefaultContentHandler
|
public class DefaultContentHandler
|
||||||
implements ImportContentHandler, ErrorHandler
|
implements ImportContentHandler, ErrorHandler
|
||||||
@@ -37,34 +38,59 @@ public class DefaultContentHandler
|
|||||||
private Importer importer = null;
|
private Importer importer = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct
|
||||||
|
*
|
||||||
|
* @param targetHandler
|
||||||
|
*/
|
||||||
public DefaultContentHandler(ImportContentHandler targetHandler)
|
public DefaultContentHandler(ImportContentHandler targetHandler)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("targetHandler", targetHandler);
|
ParameterCheck.mandatory("targetHandler", targetHandler);
|
||||||
this.targetHandler = targetHandler;
|
this.targetHandler = targetHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.importer.ImportContentHandler#setImporter(org.alfresco.repo.importer.Importer)
|
||||||
|
*/
|
||||||
public void setImporter(Importer importer)
|
public void setImporter(Importer importer)
|
||||||
{
|
{
|
||||||
this.importer = importer;
|
this.importer = importer;
|
||||||
this.targetHandler.setImporter(importer);
|
this.targetHandler.setImporter(importer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.alfresco.repo.importer.ImportContentHandler#importStream(java.lang.String)
|
||||||
|
*/
|
||||||
public InputStream importStream(String content)
|
public InputStream importStream(String content)
|
||||||
{
|
{
|
||||||
return targetHandler.importStream(content);
|
return targetHandler.importStream(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
|
||||||
|
*/
|
||||||
public void setDocumentLocator(Locator locator)
|
public void setDocumentLocator(Locator locator)
|
||||||
{
|
{
|
||||||
targetHandler.setDocumentLocator(locator);
|
targetHandler.setDocumentLocator(locator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#startDocument()
|
||||||
|
*/
|
||||||
public void startDocument() throws SAXException
|
public void startDocument() throws SAXException
|
||||||
{
|
{
|
||||||
importer.start();
|
importer.start();
|
||||||
targetHandler.startDocument();
|
targetHandler.startDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#endDocument()
|
||||||
|
*/
|
||||||
public void endDocument() throws SAXException
|
public void endDocument() throws SAXException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -77,47 +103,82 @@ public class DefaultContentHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
public void startPrefixMapping(String prefix, String uri) throws SAXException
|
public void startPrefixMapping(String prefix, String uri) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.startPrefixMapping(prefix, uri);
|
targetHandler.startPrefixMapping(prefix, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
|
||||||
|
*/
|
||||||
public void endPrefixMapping(String prefix) throws SAXException
|
public void endPrefixMapping(String prefix) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.endPrefixMapping(prefix);
|
targetHandler.endPrefixMapping(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
|
||||||
|
*/
|
||||||
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
|
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.startElement(uri, localName, qName, atts);
|
targetHandler.startElement(uri, localName, qName, atts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
public void endElement(String uri, String localName, String qName) throws SAXException
|
public void endElement(String uri, String localName, String qName) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.endElement(uri, localName, qName);
|
targetHandler.endElement(uri, localName, qName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
|
||||||
|
*/
|
||||||
public void characters(char[] ch, int start, int length) throws SAXException
|
public void characters(char[] ch, int start, int length) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.characters(ch, start, length);
|
targetHandler.characters(ch, start, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
|
||||||
|
*/
|
||||||
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
|
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.ignorableWhitespace(ch, start, length);
|
targetHandler.ignorableWhitespace(ch, start, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String)
|
||||||
|
*/
|
||||||
public void processingInstruction(String target, String data) throws SAXException
|
public void processingInstruction(String target, String data) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.processingInstruction(target, data);
|
targetHandler.processingInstruction(target, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String)
|
||||||
|
*/
|
||||||
public void skippedEntity(String name) throws SAXException
|
public void skippedEntity(String name) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.skippedEntity(name);
|
targetHandler.skippedEntity(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
|
||||||
|
*/
|
||||||
public void error(SAXParseException exception) throws SAXException
|
public void error(SAXParseException exception) throws SAXException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -130,7 +191,10 @@ public class DefaultContentHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
|
||||||
|
*/
|
||||||
public void fatalError(SAXParseException exception) throws SAXException
|
public void fatalError(SAXParseException exception) throws SAXException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -143,11 +207,13 @@ public class DefaultContentHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
|
||||||
|
*/
|
||||||
public void warning(SAXParseException exception) throws SAXException
|
public void warning(SAXParseException exception) throws SAXException
|
||||||
{
|
{
|
||||||
targetHandler.warning(exception);
|
targetHandler.warning(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* 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.alfresco.repo.importer;
|
package org.alfresco.repo.importer;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -6,10 +22,25 @@ import org.xml.sax.ContentHandler;
|
|||||||
import org.xml.sax.ErrorHandler;
|
import org.xml.sax.ErrorHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Content Handler that interacts with an Alfresco Importer
|
||||||
|
*
|
||||||
|
* @author David Caruana
|
||||||
|
*/
|
||||||
public interface ImportContentHandler extends ContentHandler, ErrorHandler
|
public interface ImportContentHandler extends ContentHandler, ErrorHandler
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Sets the Importer
|
||||||
|
*
|
||||||
|
* @param importer
|
||||||
|
*/
|
||||||
public void setImporter(Importer importer);
|
public void setImporter(Importer importer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call-back for importing content streams
|
||||||
|
*
|
||||||
|
* @param content content stream identifier
|
||||||
|
* @return the input stream
|
||||||
|
*/
|
||||||
public InputStream importStream(String content);
|
public InputStream importStream(String content);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -278,7 +278,7 @@ public class ImporterComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the actual import
|
* Perform Import via Parser
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference to import under
|
* @param nodeRef node reference to import under
|
||||||
* @param childAssocType the child association type to import under
|
* @param childAssocType the child association type to import under
|
||||||
@@ -306,7 +306,16 @@ public class ImporterComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform import via Content Handler
|
||||||
|
*
|
||||||
|
* @param nodeRef node reference to import under
|
||||||
|
* @param childAssocType the child association type to import under
|
||||||
|
* @param handler the import content handler
|
||||||
|
* @param binding import configuration
|
||||||
|
* @param progress import progress
|
||||||
|
* @return content handler to interact with
|
||||||
|
*/
|
||||||
public ContentHandler handlerImport(NodeRef nodeRef, QName childAssocType, ImportContentHandler handler, ImporterBinding binding, ImporterProgress progress)
|
public ContentHandler handlerImport(NodeRef nodeRef, QName childAssocType, ImportContentHandler handler, ImporterBinding binding, ImporterProgress progress)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("Node Reference", nodeRef);
|
ParameterCheck.mandatory("Node Reference", nodeRef);
|
||||||
@@ -319,7 +328,6 @@ public class ImporterComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Importer strategy
|
* Default Importer strategy
|
||||||
*
|
*
|
||||||
|
@@ -73,7 +73,6 @@ public class ParentContext extends ElementContext
|
|||||||
parentRef = parent.getNodeRef();
|
parentRef = parent.getNodeRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* Construct
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user