Moving to root below branch label

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2005-12-08 07:13:07 +00:00
commit e1e6508fec
1095 changed files with 230566 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
/*
* 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.service.cmr.view;
import java.io.InputStream;
import java.io.OutputStream;
import org.alfresco.service.cmr.repository.ContentData;
/**
* Contract for a custom content property exporter.
*
* @author David Caruana
*
*/
public interface ExportPackageHandler
{
/**
* Start the Export
*/
public void startExport();
/**
* Create a stream for accepting the package data
*
* @return the output stream
*/
public OutputStream createDataStream();
/**
* Call-back for handling the export of content stream.
*
* @param content content to export
* @param contentData content descriptor
* @return the URL to the location of the exported content
*/
public ContentData exportContent(InputStream content, ContentData contentData);
/**
* End the Export
*/
public void endExport();
}

View File

@@ -0,0 +1,199 @@
/*
* 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.service.cmr.view;
import java.io.InputStream;
import java.util.Collection;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
/**
* Contract for an exporter. An exporter is responsible for actually exporting
* the content of the Repository to a destination point e.g. file system.
*
* @author David Caruana
*/
public interface Exporter
{
/**
* Start of Export
*/
public void start(ExporterContext context);
/**
* Start export of namespace
*
* @param prefix namespace prefix
* @param uri namespace uri
*/
public void startNamespace(String prefix, String uri);
/**
* End export of namespace
*
* @param prefix namespace prefix
*/
public void endNamespace(String prefix);
/**
* Start export of node
*
* @param nodeRef the node reference
*/
public void startNode(NodeRef nodeRef);
/**
* End export of node
*
* @param nodeRef the node reference
*/
public void endNode(NodeRef nodeRef);
/**
* Start export of aspects
*
* @param nodeRef
*/
public void startAspects(NodeRef nodeRef);
/**
* Start export of aspect
*
* @param nodeRef the node reference
* @param aspect the aspect
*/
public void startAspect(NodeRef nodeRef, QName aspect);
/**
* End export of aspect
*
* @param nodeRef the node reference
* @param aspect the aspect
*/
public void endAspect(NodeRef nodeRef, QName aspect);
/**
* End export of aspects
*
* @param nodeRef
*/
public void endAspects(NodeRef nodeRef);
/**
* Start export of properties
*
* @param nodeRef the node reference
*/
public void startProperties(NodeRef nodeRef);
/**
* Start export of property
*
* @param nodeRef the node reference
* @param property the property name
*/
public void startProperty(NodeRef nodeRef, QName property);
/**
* End export of property
*
* @param nodeRef the node reference
* @param property the property name
*/
public void endProperty(NodeRef nodeRef, QName property);
/**
* End export of properties
*
* @param nodeRef the node reference
*/
public void endProperties(NodeRef nodeRef);
/**
* Export single valued property
*
* @param nodeRef the node reference
* @param property the property name
* @param value the value
*/
public void value(NodeRef nodeRef, QName property, Object value);
/**
* Export multi valued property
*
* @param nodeRef the node reference
* @param property the property name
* @param value the value
*/
public void value(NodeRef nodeRef, QName property, Collection values);
/**
* Export content stream
*
* @param nodeRef the node reference
* @param property the property name
* @param content the content stream
* @param contentData content descriptor
*/
public void content(NodeRef nodeRef, QName property, InputStream content, ContentData contentData);
/**
* Start export of associations
*
* @param nodeRef
*/
public void startAssocs(NodeRef nodeRef);
/**
* Start export of association
*
* @param nodeRef the node reference
* @param assoc the association name
*/
public void startAssoc(NodeRef nodeRef, QName assoc);
/**
* End export of association
*
* @param nodeRef the node reference
* @param assoc the association name
*/
public void endAssoc(NodeRef nodeRef, QName assoc);
/**
* End export of associations
*
* @param nodeRef
*/
public void endAssocs(NodeRef nodeRef);
/**
* Export warning
*
* @param warning the warning message
*/
public void warning(String warning);
/**
* End export
*/
public void end();
}

View File

@@ -0,0 +1,18 @@
package org.alfresco.service.cmr.view;
import java.util.Date;
import org.alfresco.service.cmr.repository.NodeRef;
public interface ExporterContext
{
public String getExportedBy();
public Date getExportedDate();
public String getExporterVersion();
public NodeRef getExportOf();
}

View File

@@ -0,0 +1,160 @@
/*
* 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.service.cmr.view;
import org.alfresco.service.namespace.NamespaceService;
/**
* Exporter Crawler Configuration.
*
* This class is used to specify which Repository items are exported.
*
* @author David Caruana
*/
public class ExporterCrawlerParameters
{
private Location exportFrom = null;
private boolean crawlSelf = false;
private boolean crawlChildNodes = true;
private boolean crawlContent = true;
private boolean crawlNullProperties = true;
private String[] excludeNamespaceURIs = new String[] { NamespaceService.REPOSITORY_VIEW_1_0_URI };
/**
* Crawl and export child nodes
*
* @return true => crawl child nodes
*/
public boolean isCrawlChildNodes()
{
return crawlChildNodes;
}
/**
* Sets whether to crawl child nodes
*
* @param crawlChildNodes
*/
public void setCrawlChildNodes(boolean crawlChildNodes)
{
this.crawlChildNodes = crawlChildNodes;
}
/**
* Crawl and export content properties
*
* @return true => crawl content
*/
public boolean isCrawlContent()
{
return crawlContent;
}
/**
* Sets whether to crawl content
*
* @param crawlContent
*/
public void setCrawlContent(boolean crawlContent)
{
this.crawlContent = crawlContent;
}
/**
* Crawl and export node at export path
*
* @return true => crawl node at export path
*/
public boolean isCrawlSelf()
{
return crawlSelf;
}
/**
* Sets whether to crawl and export node at export path
*
* @param crawlSelf
*/
public void setCrawlSelf(boolean crawlSelf)
{
this.crawlSelf = crawlSelf;
}
/**
* Crawl and export null properties
*
* @return true => export null properties
*/
public boolean isCrawlNullProperties()
{
return crawlNullProperties;
}
/**
* Sets whether to crawl null properties
*
* @param crawlNullProperties
*/
public void setCrawlNullProperties(boolean crawlNullProperties)
{
this.crawlNullProperties = crawlNullProperties;
}
/**
* Gets the list of namespace URIs to exlude from the Export
*
* @return the list of namespace URIs
*/
public String[] getExcludeNamespaceURIs()
{
return excludeNamespaceURIs;
}
/**
* Sets the list of namespace URIs to exclude from the Export
*
* @param excludeNamespaceURIs
*/
public void setExcludeNamespaceURIs(String[] excludeNamespaceURIs)
{
this.excludeNamespaceURIs = excludeNamespaceURIs;
}
/**
* Gets the path to export from
*
* @return the path to export from
*/
public Location getExportFrom()
{
return exportFrom;
}
/**
* Sets the path to export from
*
* @param exportFrom
*/
public void setExportFrom(Location exportFrom)
{
this.exportFrom = exportFrom;
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the GNU Lesser General Public License as
* published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.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.service.cmr.view;
/**
* Base Exception of Export Exceptions.
*
* @author David Caruana
*/
public class ExporterException extends RuntimeException
{
private static final long serialVersionUID = 3257008761007847733L;
public ExporterException(String msg)
{
super(msg);
}
public ExporterException(String msg, Throwable cause)
{
super(msg, cause);
}
}

View File

@@ -0,0 +1,64 @@
/*
* 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.service.cmr.view;
import java.io.OutputStream;
/**
* Exporter Service
*
* @author David Caruana
*/
public interface ExporterService
{
/**
* Export a view of the Repository using the default xml view schema.
*
* All repository information is exported to the single output stream. This means that any
* content properties are base64 encoded.
*
* @param viewWriter the output stream to export to
* @param parameters export parameters
* @param progress exporter callback for tracking progress of export
*/
public void exportView(OutputStream viewWriter, ExporterCrawlerParameters parameters, Exporter progress)
throws ExporterException;
/**
* Export a view of the Repository using the default xml view schema.
*
* This export supports the custom handling of content properties.
*
* @param exportHandler the custom export handler for content properties
* @param parameters export parameters
* @param progress exporter callback for tracking progress of export
*/
public void exportView(ExportPackageHandler exportHandler, ExporterCrawlerParameters parameters, Exporter progress)
throws ExporterException;
/**
* Export a view of the Repository using a custom crawler and exporter.
*
* @param exporter custom exporter
* @param parameters export parameters
* @param progress exporter callback for tracking progress of export
*/
public void exportView(Exporter exporter, ExporterCrawlerParameters parameters, Exporter progress);
}

View File

@@ -0,0 +1,55 @@
/*
* 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.service.cmr.view;
import java.io.InputStream;
import java.io.Reader;
/**
* Contract for a custom import package handler.
*
* @author David Caruana
*/
public interface ImportPackageHandler
{
/**
* Start the Import
*/
public void startImport();
/**
* Get the package data stream
*
* @return the reader
*/
public Reader getDataStream();
/**
* Call-back for handling the import of content stream.
*
* @param content content descriptor
* @return the input stream onto the content
*/
public InputStream importStream(String content);
/**
* End the Import
*/
public void endImport();
}

View File

@@ -0,0 +1,7 @@
package org.alfresco.service.cmr.view;
public interface ImporterBinding
{
public String getValue(String key);
}

View File

@@ -0,0 +1,39 @@
/*
* 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.service.cmr.view;
/**
* Base Exception of Import Exceptions.
*
* @author David Caruana
*/
public class ImporterException extends RuntimeException
{
private static final long serialVersionUID = 3257008761007847733L;
public ImporterException(String msg)
{
super(msg);
}
public ImporterException(String msg, Throwable cause)
{
super(msg, cause);
}
}

View File

@@ -0,0 +1,67 @@
/*
* 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.service.cmr.view;
import java.io.Serializable;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
/**
* Callback interface for monitoring progress of an import.
*
* @author David Caruana
*
*/
public interface ImporterProgress
{
/**
* Report creation of a node.
*
* @param nodeRef the node ref
* @param parentRef the parent ref
* @param assocName the child association type name
* @param childName the child association name
*/
public void nodeCreated(NodeRef nodeRef, NodeRef parentRef, QName assocName, QName childName);
/**
* Report creation of content
*
* @param nodeRef the node ref
* @param sourceUrl the source location of the content
*/
public void contentCreated(NodeRef nodeRef, String sourceUrl);
/**
* Report setting of a property
*
* @param nodeRef the node ref
* @param property the property name
* @param value the property value
*/
public void propertySet(NodeRef nodeRef, QName property, Serializable value);
/**
* Report addition of an aspect
*
* @param nodeRef the node ref
* @param aspect the aspect
*/
public void aspectAdded(NodeRef nodeRef, QName aspect);
}

View File

@@ -0,0 +1,56 @@
/*
* 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.service.cmr.view;
import java.io.Reader;
/**
* Importer Service. Entry point for importing xml data sources into the Repository.
*
* @author David Caruana
*
*/
public interface ImporterService
{
/**
* Import a Repository view into the specified location
*
* @param viewReader input stream containing the xml view to parse
* @param location the location to import under
* @param binding property values used for binding property place holders in import stream
* @param progress progress monitor (optional)
*/
public void importView(Reader viewReader, Location location, ImporterBinding binding, ImporterProgress progress)
throws ImporterException;
/**
* Import a Repository view into the specified location
*
* This import allows for a custom content importer.
*
* @param importHandler custom content importer
* @param location the location to import under
* @param binding property values used for binding property place holders in import stream
* @param progress progress monitor (optional)
*/
public void importView(ImportPackageHandler importHandler, Location location, ImporterBinding binding, ImporterProgress progress)
throws ImporterException;
}

View File

@@ -0,0 +1,111 @@
/*
* 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.service.cmr.view;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck;
/**
* Importer / Exporter Location
*
* @author David Caruana
*/
public class Location
{
private StoreRef storeRef = null;
private NodeRef nodeRef = null;
private String path = null;
private QName childAssocType = null;
/**
* Construct
*
* @param nodeRef
*/
public Location(NodeRef nodeRef)
{
ParameterCheck.mandatory("Node Ref", nodeRef);
this.storeRef = nodeRef.getStoreRef();
this.nodeRef = nodeRef;
}
/**
* Construct
*
* @param storeRef
*/
public Location(StoreRef storeRef)
{
ParameterCheck.mandatory("Store Ref", storeRef);
this.storeRef = storeRef;
}
/**
* @return the store ref
*/
public StoreRef getStoreRef()
{
return storeRef;
}
/**
* @return the node ref
*/
public NodeRef getNodeRef()
{
return nodeRef;
}
/**
* Sets the location to the specified path
*
* @param path path relative to store or node reference
*/
public void setPath(String path)
{
this.path = path;
}
/**
* @return the location
*/
public String getPath()
{
return path;
}
/**
* Sets the child association type
*
* @param childAssocType child association type
*/
public void setChildAssocType(QName childAssocType)
{
this.childAssocType = childAssocType;
}
/**
* @return the child association type
*/
public QName getChildAssocType()
{
return childAssocType;
}
}