Merged V1.3 to HEAD(3161:3179)

svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3161 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3179 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3406 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-07-26 10:49:21 +00:00
parent 36f219edf1
commit 595556f3c5
39 changed files with 1924 additions and 1602 deletions

View File

@@ -90,11 +90,7 @@
<bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection" />
<!-- Metadata Extraction Regisitry -->
<bean id="metadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" >
<property name="mimetypeMap">
<ref bean="mimetypeService" />
</property>
</bean>
<bean id="metadataExtracterRegistry" class="org.alfresco.repo.content.metadata.MetadataExtracterRegistry" />
<!-- Abstract bean definition defining base definition for all metadata extracters -->
<bean id="baseMetadataExtracter"
@@ -124,11 +120,7 @@
<!-- Content Transformation Regisitry -->
<bean id="contentTransformerRegistry" class="org.alfresco.repo.content.transform.ContentTransformerRegistry" >
<constructor-arg>
<ref bean="mimetypeService" />
</constructor-arg>
</bean>
<bean id="contentTransformerRegistry" class="org.alfresco.repo.content.transform.ContentTransformerRegistry" />
<!-- Abstract bean definition defining base definition for all transformers -->
<bean id="baseContentTransformer"

View File

@@ -629,6 +629,13 @@
</property>
</bean>
<!-- Temporary Aspect -->
<bean id="temporaryAspect" class="org.alfresco.repo.node.TemporaryAspect" init-method="init">
<property name="policyComponent">
<ref bean="policyComponent" />
</property>
</bean>
<!-- Configurable service -->
<bean id="configurableService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">

View File

@@ -1 +1,2 @@
permissions.err_access_denied=Access Denied. You do not have the appropriate permissions to perform this operation.
permissions.err_read_only=Access Denied. The system is currently in read-only mode.

View File

@@ -45,11 +45,6 @@
<title>Folder</title>
<parent>cm:cmobject</parent>
<archive>true</archive>
<properties>
<property name="cm:orderedchildren">
<type>d:boolean</type>
</property>
</properties>
<associations>
<child-association name="cm:contains">
<source>

View File

@@ -127,6 +127,11 @@
<title>Incomplete</title>
</aspect>
<!-- aspect to tag temporary nodes -->
<aspect name="sys:temporary">
<title>Temporary</title>
</aspect>
<!-- details stored on archived nodes -->
<aspect name="sys:archived">
<title>Archived</title>

View File

@@ -2,210 +2,155 @@
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0">
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:doc_info.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:45.906Z</cm:modified>
<cm:description>Displays basic information about the current document</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/doc_info.ftl|mimetype=text/plain|size=636|encoding=UTF-8</cm:content>
<cm:title>doc_info.ftl</cm:title>
<cm:name>doc_info.ftl</cm:name>
<cm:created>2005-10-21T15:11:00.446+01:00</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:localizable.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:50.390Z</cm:modified>
<cm:description>Calculates if the document has the localizable aspect applied</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/localizable.ftl|mimetype=text/plain|size=380|encoding=UTF-8</cm:content>
<cm:title>localizable.ftl</cm:title>
<cm:name>localizable.ftl</cm:name>
<cm:created>2005-10-21T15:11:02.181+01:00</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:my_docs.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:51.937Z</cm:modified>
<cm:description>Displays a list of the documents in the current user Home Space</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/my_docs.ftl|mimetype=text/plain|size=750|encoding=UTF-8</cm:content>
<cm:title>my_docs.ftl</cm:title>
<cm:name>my_docs.ftl</cm:name>
<cm:created>2005-10-21T15:11:03.118+01:00</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:my_spaces.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:57.890Z</cm:modified>
<cm:description>Displays a list of spaces in the current user Home Space</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/my_spaces.ftl|mimetype=text/plain|size=682|encoding=UTF-8</cm:content>
<cm:title>my_spaces.ftl</cm:title>
<cm:name>my_spaces.ftl</cm:name>
<cm:created>2005-10-21T15:11:04.665+01:00</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:my_summary.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:59.421Z</cm:modified>
<cm:description>Shows a simple summary page about the current user and their Home Space</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/my_summary.ftl|mimetype=text/plain|size=537|encoding=UTF-8</cm:content>
<cm:title>my_summary.ftl</cm:title>
<cm:name>my_summary.ftl</cm:name>
<cm:created>2005-10-21T15:11:05.509+01:00</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:translatable.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:11:04.953Z</cm:modified>
<cm:description>Calculates if the document has the translatable aspect applied</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/translatable.ftl|mimetype=text/plain|size=415|encoding=UTF-8</cm:content>
<cm:title>translatable.ftl</cm:title>
<cm:name>translatable.ftl</cm:name>
<cm:created>2005-10-21T15:11:06.306+01:00</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:RSS_2.0_recent_docs.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:41.656Z</cm:modified>
<cm:description>Renders a valid RSS2.0 XML document showing the documents in the current space created or modified in the last 7 days. The template should be configured to use the appropriate server and port before use.</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/RSS_2.0_recent_docs.ftl|mimetype=text/plain|size=1917|encoding=UTF-8</cm:content>
<cm:title>RSS_2.0_recent_docs.ftl</cm:title>
<cm:name>RSS_2.0_recent_docs.ftl</cm:name>
<cm:created>2006-01-13T15:49:50.695Z</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:recent_docs.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:11:00.953Z</cm:modified>
<cm:description>Displays a list of the documents in the current space created or modified in the last 7 days</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/recent_docs.ftl|mimetype=text/plain|size=968|encoding=UTF-8</cm:content>
<cm:title>recent_docs.ftl</cm:title>
<cm:name>recent_docs.ftl</cm:name>
<cm:created>2006-01-13T15:50:02.164Z</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:general_example.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:48.062Z</cm:modified>
<cm:description>Example of various lists of documents, spaces and summary information about the current user</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/general_example.ftl|mimetype=text/plain|size=1608|encoding=UTF-8</cm:content>
<cm:title>general_example.ftl</cm:title>
<cm:name>general_example.ftl</cm:name>
<cm:created>2006-02-10T09:10:47.796Z</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:my_docs_inline.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:10:53.531Z</cm:modified>
<cm:description>Displays a list of the documents in the current user Home Space. Text document content is shown inline, as is JPG content as small thumbnail images.</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/my_docs_inline.ftl|mimetype=text/plain|size=652|encoding=UTF-8</cm:content>
<cm:title>my_docs_inline.ftl</cm:title>
<cm:name>my_docs_inline.ftl</cm:name>
<cm:created>2006-02-10T09:10:53.281Z</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>
<cm:content xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="" view:childName="cm:xpath_search.ftl">
<view:aspects>
<cm:auditable></cm:auditable>
<app:uifacets></app:uifacets>
<app:inlineeditable></app:inlineeditable>
</view:aspects>
<view:properties>
<app:editInline>true</app:editInline>
<cm:modifier>admin</cm:modifier>
<cm:modified>2006-02-10T09:11:07.031Z</cm:modified>
<cm:description>Example of using XPath and Lucene searches within a template.</cm:description>
<cm:creator>admin</cm:creator>
<cm:content>contentUrl=classpath:alfresco/templates/content/examples/xpath_search.ftl|mimetype=text/plain|size=1109|encoding=UTF-8</cm:content>
<cm:title>xpath_search.ftl</cm:title>
<cm:name>xpath_search.ftl</cm:name>
<cm:created>2006-02-10T09:11:06.750Z</cm:created>
</view:properties>
<view:associations></view:associations>
</cm:content>

View File

@@ -20,6 +20,7 @@ import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -1486,6 +1487,54 @@ public class NetBIOSNameServer extends NetworkServer implements Runnable
ipList.add(addrs[i].getAddress());
}
// Check if the address list is empty, use the network interface list to get the local IP addresses
if ( ipList.size() == 0)
{
// Enumerate the network adapter list
Enumeration<NetworkInterface> niEnum = NetworkInterface.getNetworkInterfaces();
if ( niEnum != null)
{
while ( niEnum.hasMoreElements())
{
// Get the current network interface
NetworkInterface ni = niEnum.nextElement();
// Enumerate the addresses for the network adapter
Enumeration<InetAddress> niAddrs = ni.getInetAddresses();
if ( niAddrs != null)
{
// Check for any valid addresses
while ( niAddrs.hasMoreElements())
{
InetAddress curAddr = niAddrs.nextElement();
if ( curAddr.getHostAddress().equals("127.0.0.1") == false &&
curAddr.getHostAddress().equals("0.0.0.0") == false)
ipList.add( curAddr.getAddress());
}
}
}
// DEBUG
if ( ipList.size() > 0 && logger.isDebugEnabled())
logger.debug("Found " + ipList.size() + " addresses using interface list");
}
}
else
{
// DBEUG
if ( logger.isDebugEnabled())
logger.debug("Found " + ipList.size() + " addresses using host name lookup");
}
// Check if any addresses were added to the list
if ( ipList.size() == 0)

View File

@@ -19,7 +19,9 @@ package org.alfresco.filesys.server.config;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.security.Provider;
import java.security.Security;
@@ -811,15 +813,19 @@ public class ServerConfiguration implements ApplicationListener
platformOK = true;
}
// Enable the NetBIOS SMB support, if enabled for this platform
setNetBIOSSMB(platformOK);
// Parse/check NetBIOS settings, if enabled
if ( hasNetBIOSSMB())
{
// Check if the broadcast mask has been specified
if (getBroadcastMask() == null)
throw new AlfrescoRuntimeException("Network broadcast mask not specified");
// Enable the NetBIOS SMB support, if enabled for this platform
setNetBIOSSMB(platformOK);
// Check for a bind address
String bindto = elem.getAttribute("bindto");
@@ -887,6 +893,54 @@ public class ServerConfiguration implements ApplicationListener
// Check if any addresses were found
if ( addrCnt == 0)
{
// Enumerate the network adapter list
Enumeration<NetworkInterface> niEnum = null;
try
{
niEnum = NetworkInterface.getNetworkInterfaces();
}
catch (SocketException ex)
{
}
if ( niEnum != null)
{
while ( niEnum.hasMoreElements())
{
// Get the current network interface
NetworkInterface ni = niEnum.nextElement();
// Enumerate the addresses for the network adapter
Enumeration<InetAddress> niAddrs = ni.getInetAddresses();
if ( niAddrs != null)
{
// Check for any valid addresses
while ( niAddrs.hasMoreElements())
{
InetAddress curAddr = niAddrs.nextElement();
if ( curAddr.getHostAddress().equals("127.0.0.1") == false &&
curAddr.getHostAddress().equals("0.0.0.0") == false)
addrCnt++;
}
}
}
// DEBUG
if ( addrCnt > 0 && logger.isDebugEnabled())
logger.debug("Found valid IP address from interface list");
}
// Check if we found any valid network addresses
if ( addrCnt == 0)
{
// Log the available IP addresses
@@ -908,6 +962,7 @@ public class ServerConfiguration implements ApplicationListener
throw new AlfrescoRuntimeException( "Failed to get IP address(es) for the local server, check hosts file and/or DNS setup");
}
}
}
// Check if the session port has been specified
@@ -951,6 +1006,7 @@ public class ServerConfiguration implements ApplicationListener
}
}
}
}
else
{

View File

@@ -40,6 +40,9 @@ public interface ContentModel
// tag for incomplete nodes
static final QName ASPECT_INCOMPLETE = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "incomplete");
// tag for temporary nodes
static final QName ASPECT_TEMPORARY = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "temporary");
// archived nodes aspect constants
static final QName ASPECT_ARCHIVED = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "archived");
static final QName PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "archivedOriginalParentAssoc");

View File

@@ -244,7 +244,11 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
workingCopyProperties.put(ContentModel.PROP_WORKING_COPY_OWNER, userName);
this.nodeService.addAspect(workingCopy, ContentModel.ASPECT_WORKING_COPY, workingCopyProperties);
// Lock the original node
// Apply the sys:temporary aspect to tag the working copy as a temporary node
// so it doesn't get archived when checked in
this.nodeService.addAspect(workingCopy, ContentModel.ASPECT_TEMPORARY, null);
// Lock the origional node
this.lockService.lock(nodeRef, LockType.READ_ONLY_LOCK);
// Return the working copy
@@ -454,6 +458,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
// Do a search to find the working copy document
ResultSet resultSet = null;
try
{
resultSet = this.searchService.query(

View File

@@ -150,14 +150,6 @@ public abstract class AbstractContentAccessor implements ContentAccessor
}
}
/**
* Derived classes must implement this to help determine if the underlying
* IO Channel is still open.
*
* @return Returns true if the underlying IO Channel is open
*/
protected abstract boolean isChannelOpen();
public String getContentUrl()
{
return contentUrl;

View File

@@ -141,8 +141,7 @@ public abstract class AbstractContentReader extends AbstractContentAccessor impl
}
}
/** helper implementation for base class */
protected boolean isChannelOpen()
public synchronized boolean isChannelOpen()
{
if (channel != null)
{

View File

@@ -156,8 +156,7 @@ public abstract class AbstractContentWriter extends AbstractContentAccessor impl
}
}
/** helper implementation for base class */
protected boolean isChannelOpen()
public synchronized boolean isChannelOpen()
{
if (channel != null)
{

View File

@@ -23,6 +23,8 @@ import java.io.OutputStream;
import javax.transaction.RollbackException;
import javax.transaction.UserTransaction;
import junit.framework.TestCase;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.filestore.FileContentWriter;
import org.alfresco.repo.content.transform.ContentTransformer;
@@ -43,18 +45,21 @@ import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.BaseSpringTest;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.GUID;
import org.alfresco.util.PropertyMap;
import org.alfresco.util.TempFileProvider;
import org.springframework.context.ApplicationContext;
/**
* @see org.alfresco.repo.content.RoutingContentService
*
* @author Derek Hulley
*/
public class RoutingContentServiceTest extends BaseSpringTest
public class RoutingContentServiceTest extends TestCase
{
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
private static final String SOME_CONTENT = "ABC";
private static final String TEST_NAMESPACE = "http://www.alfresco.org/test/RoutingContentServiceTest";
@@ -62,24 +67,30 @@ public class RoutingContentServiceTest extends BaseSpringTest
private ContentService contentService;
private PolicyComponent policyComponent;
private NodeService nodeService;
private AuthenticationComponent authenticationComponent;
private UserTransaction txn;
private NodeRef rootNodeRef;
private NodeRef contentNodeRef;
private AuthenticationComponent authenticationComponent;
public RoutingContentServiceTest()
{
}
@Override
public void onSetUpInTransaction() throws Exception
public void setUp() throws Exception
{
super.onSetUpInTransaction();
nodeService = (NodeService) applicationContext.getBean("dbNodeService");
contentService = (ContentService) applicationContext.getBean(ServiceRegistry.CONTENT_SERVICE.getLocalName());
this.policyComponent = (PolicyComponent)this.applicationContext.getBean("policyComponent");
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
nodeService = (NodeService) ctx.getBean("dbNodeService");
contentService = (ContentService) ctx.getBean(ServiceRegistry.CONTENT_SERVICE.getLocalName());
this.policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
// authenticate
this.authenticationComponent.setSystemUserAsCurrentUser();
// start the transaction
txn = getUserTransaction();
txn.begin();
// create a store and get the root node
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, getName());
if (!nodeService.exists(storeRef))
@@ -103,7 +114,7 @@ public class RoutingContentServiceTest extends BaseSpringTest
}
@Override
protected void onTearDownInTransaction() throws Exception
public void tearDown() throws Exception
{
try
{
@@ -113,12 +124,22 @@ public class RoutingContentServiceTest extends BaseSpringTest
{
// ignore
}
super.onTearDownInTransaction();
try
{
if (txn != null)
{
txn.rollback();
}
}
catch (Throwable e)
{
// ignore
}
}
private UserTransaction getUserTransaction()
{
TransactionService transactionService = (TransactionService)applicationContext.getBean("transactionComponent");
TransactionService transactionService = (TransactionService) ctx.getBean("transactionComponent");
return (UserTransaction) transactionService.getUserTransaction();
}
@@ -236,8 +257,8 @@ public class RoutingContentServiceTest extends BaseSpringTest
assertFalse("Reader should indicate that content is missing", reader.exists());
// check the indexing doesn't spank everthing
setComplete();
endTransaction();
txn.commit();
txn = null;
}
/**
@@ -405,8 +426,8 @@ public class RoutingContentServiceTest extends BaseSpringTest
public void testConcurrentWritesNoTxn() throws Exception
{
// ensure that the transaction is ended - ofcourse, we need to force a commit
setComplete();
endTransaction();
txn.commit();
txn = null;
ContentWriter writer1 = contentService.getWriter(contentNodeRef, ContentModel.PROP_CONTENT, true);
ContentWriter writer2 = contentService.getWriter(contentNodeRef, ContentModel.PROP_CONTENT, true);
@@ -425,8 +446,8 @@ public class RoutingContentServiceTest extends BaseSpringTest
public void testConcurrentWritesWithSingleTxn() throws Exception
{
// want to operate in a user transaction
setComplete();
endTransaction();
txn.commit();
txn = null;
UserTransaction txn = getUserTransaction();
txn.begin();
@@ -472,8 +493,8 @@ public class RoutingContentServiceTest extends BaseSpringTest
public synchronized void testConcurrentWritesWithMultipleTxns() throws Exception
{
// commit node so that threads can see node
setComplete();
endTransaction();
txn.commit();
txn = null;
UserTransaction txn = getUserTransaction();
txn.begin();
@@ -527,8 +548,8 @@ public class RoutingContentServiceTest extends BaseSpringTest
public void testTransformation() throws Exception
{
// commit node so that threads can see node
setComplete();
endTransaction();
txn.commit();
txn = null;
UserTransaction txn = getUserTransaction();
txn.begin();
@@ -655,4 +676,27 @@ public class RoutingContentServiceTest extends BaseSpringTest
}
}
}
/**
* Check that the system is able to handle the uploading of content with an unknown mimetype.
* The unknown mimetype should be preserved, but treated just like an octet stream.
*/
public void testUnknownMimetype() throws Exception
{
String bogusMimetype = "text/bamboozle";
// get a writer onto the node
ContentWriter writer = contentService.getWriter(contentNodeRef, ContentModel.PROP_CONTENT, true);
writer.setMimetype(bogusMimetype);
// write something in
writer.putContent(SOME_CONTENT);
// commit the transaction to ensure that it goes in OK
txn.commit();
// so far, so good
ContentReader reader = contentService.getReader(contentNodeRef, ContentModel.PROP_CONTENT);
assertNotNull("Should be able to get reader", reader);
assertEquals("Unknown mimetype was changed", bogusMimetype, reader.getMimetype());
}
}

View File

@@ -24,8 +24,6 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.content.MimetypeMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,7 +43,6 @@ public class MetadataExtracterRegistry
private List<MetadataExtracter> extracters;
private Map<String, MetadataExtracter> extracterCache;
private MimetypeMap mimetypeMap;
/** Controls read access to the cache */
private Lock extracterCacheReadLock;
/** controls write access to the cache */
@@ -63,16 +60,6 @@ public class MetadataExtracterRegistry
extracterCacheWriteLock = extractionCacheLock.writeLock();
}
/**
* The mimetype map that will be used to check requests against
*
* @param mimetypeMap a map of mimetypes
*/
public void setMimetypeMap(MimetypeMap mimetypeMap)
{
this.mimetypeMap = mimetypeMap;
}
/**
* Register an instance of an extracter for use
*
@@ -109,12 +96,6 @@ public class MetadataExtracterRegistry
*/
public MetadataExtracter getExtracter(String sourceMimetype)
{
// check that the mimetypes are valid
if (!mimetypeMap.getMimetypes().contains(sourceMimetype))
{
throw new AlfrescoRuntimeException("Unknown extraction source mimetype: " + sourceMimetype);
}
MetadataExtracter extracter = null;
extracterCacheReadLock.lock();
try

View File

@@ -252,13 +252,13 @@ public abstract class AbstractContentTransformer implements ContentTransformer
finally
{
// check that the reader and writer are both closed
if (!reader.isClosed())
if (reader.isChannelOpen())
{
logger.error("Content reader not closed by transformer: \n" +
" reader: " + reader + "\n" +
" transformer: " + this);
}
if (!writer.isClosed())
if (writer.isChannelOpen())
{
logger.error("Content writer not closed by transformer: \n" +
" writer: " + writer + "\n" +

View File

@@ -25,11 +25,8 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.content.MimetypeMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.Assert;
/**
* Holds and provides the most appropriate content transformer for
@@ -47,7 +44,6 @@ public class ContentTransformerRegistry
private static final Log logger = LogFactory.getLog(ContentTransformerRegistry.class);
private List<ContentTransformer> transformers;
private MimetypeMap mimetypeMap;
/** Cache of previously used transactions */
private Map<TransformationKey, List<ContentTransformer>> transformationCache;
/** Controls read access to the transformation cache */
@@ -58,11 +54,8 @@ public class ContentTransformerRegistry
/**
* @param mimetypeMap all the mimetypes available to the system
*/
public ContentTransformerRegistry(MimetypeMap mimetypeMap)
public ContentTransformerRegistry()
{
Assert.notNull(mimetypeMap, "The MimetypeMap is mandatory");
this.mimetypeMap = mimetypeMap;
this.transformers = new ArrayList<ContentTransformer>(10);
transformationCache = new HashMap<TransformationKey, List<ContentTransformer>>(17);
@@ -143,16 +136,6 @@ public class ContentTransformerRegistry
*/
public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype)
{
// check that the mimetypes are valid
if (!mimetypeMap.getMimetypes().contains(sourceMimetype))
{
throw new AlfrescoRuntimeException("Unknown source mimetype: " + sourceMimetype);
}
if (!mimetypeMap.getMimetypes().contains(targetMimetype))
{
throw new AlfrescoRuntimeException("Unknown target mimetype: " + targetMimetype);
}
TransformationKey key = new TransformationKey(sourceMimetype, targetMimetype);
List<ContentTransformer> transformers = null;
transformationCacheReadLock.lock();

View File

@@ -69,7 +69,7 @@ public class ContentTransformerRegistryTest extends AbstractContentTransformerTe
bytes[i] = (byte)i;
}
// create the dummyRegistry
dummyRegistry = new ContentTransformerRegistry(mimetypeMap);
dummyRegistry = new ContentTransformerRegistry();
// create some dummy transformers for reliability tests
new DummyTransformer(mimetypeMap, dummyRegistry, A, B, 0.3, 10L);
new DummyTransformer(mimetypeMap, dummyRegistry, A, B, 0.6, 10L);

View File

@@ -536,6 +536,12 @@ public class CopyServiceImpl implements CopyService
ClassDefinition classDefinition = this.dictionaryService.getClass(classRef);
if (classDefinition != null)
{
if (classDefinition.isAspect() == true)
{
// make sure any aspects without any properties or associations are copied
copyDetails.addAspect(classRef);
}
// Copy the properties
Map<QName,PropertyDefinition> propertyDefinitions = classDefinition.getProperties();
for (QName propertyName : propertyDefinitions.keySet())

View File

@@ -18,7 +18,9 @@ package org.alfresco.repo.dictionary;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
@@ -52,8 +54,8 @@ public class DictionaryDAOImpl implements DictionaryDAO
// Namespace Data Access
private NamespaceDAO namespaceDAO;
// Map of namespace to model name
private Map<String,QName> namespaceToModel = new HashMap<String,QName>();
// Map of Namespace URI usages to Models
private Map<String, List<CompiledModel>> uriToModels = new HashMap<String, List<CompiledModel>>();
// Map of model name to compiled model
private Map<QName,CompiledModel> compiledModels = new HashMap<QName,CompiledModel>();
@@ -90,7 +92,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
{
namespaceDAO.removePrefix(namespace.getPrefix());
namespaceDAO.removeURI(namespace.getUri());
namespaceToModel.remove(namespace.getUri());
unmapUriToModel(namespace.getUri(), previousVersion);
}
for (M2Namespace importNamespace : previousVersion.getM2Model().getImports())
{
unmapUriToModel(importNamespace.getUri(), previousVersion);
}
}
@@ -99,7 +105,11 @@ public class DictionaryDAOImpl implements DictionaryDAO
{
namespaceDAO.addURI(namespace.getUri());
namespaceDAO.addPrefix(namespace.getPrefix(), namespace.getUri());
namespaceToModel.put(namespace.getUri(), modelName);
mapUriToModel(namespace.getUri(), compiledModel);
}
for (M2Namespace importNamespace : model.getImports())
{
mapUriToModel(importNamespace.getUri(), compiledModel);
}
// Publish new Model Definition
@@ -115,6 +125,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
}
}
/**
* @see org.alfresco.repo.dictionary.DictionaryDAO#removeModel(org.alfresco.service.namespace.QName)
*/
@@ -129,7 +140,7 @@ public class DictionaryDAOImpl implements DictionaryDAO
{
namespaceDAO.removePrefix(namespace.getPrefix());
namespaceDAO.removeURI(namespace.getUri());
namespaceToModel.remove(namespace.getUri());
unmapUriToModel(namespace.getUri(), compiledModel);
}
// Remove the model from the list
@@ -139,13 +150,56 @@ public class DictionaryDAOImpl implements DictionaryDAO
/**
* @param uri the namespace uri
* @return the compiled model which defines the specified namespace
* Map Namespace URI to Model
*
* @param uri namespace uri
* @param model model
*/
private CompiledModel getCompiledModelForNamespace(String uri)
private void mapUriToModel(String uri, CompiledModel model)
{
QName modelName = namespaceToModel.get(uri);
return (modelName == null) ? null : getCompiledModel(modelName);
List<CompiledModel> models = uriToModels.get(uri);
if (models == null)
{
models = new ArrayList<CompiledModel>();
uriToModels.put(uri, models);
}
if (!models.contains(model))
{
models.add(model);
}
}
/**
* Unmap Namespace URI from Model
*
* @param uri namespace uri
* @param model model
*/
private void unmapUriToModel(String uri, CompiledModel model)
{
List<CompiledModel> models = uriToModels.get(uri);
if (models != null)
{
models.remove(model);
}
}
/**
* Get Models mapped to Namespace Uri
*
* @param uri namespace uri
* @return mapped models
*/
private List<CompiledModel> getModelsForUri(String uri)
{
List<CompiledModel> models = uriToModels.get(uri);
if (models == null)
{
models = Collections.emptyList();
}
return models;
}
@@ -170,8 +224,16 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/
public DataTypeDefinition getDataType(QName typeName)
{
CompiledModel model = getCompiledModelForNamespace(typeName.getNamespaceURI());
return (model == null) ? null : model.getDataType(typeName);
List<CompiledModel> models = getModelsForUri(typeName.getNamespaceURI());
for (CompiledModel model : models)
{
DataTypeDefinition dataType = model.getDataType(typeName);
if (dataType != null)
{
return dataType;
}
}
return null;
}
@@ -207,8 +269,16 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/
public TypeDefinition getType(QName typeName)
{
CompiledModel model = getCompiledModelForNamespace(typeName.getNamespaceURI());
return (model == null) ? null : model.getType(typeName);
List<CompiledModel> models = getModelsForUri(typeName.getNamespaceURI());
for (CompiledModel model : models)
{
TypeDefinition type = model.getType(typeName);
if (type != null)
{
return type;
}
}
return null;
}
@@ -217,8 +287,16 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/
public AspectDefinition getAspect(QName aspectName)
{
CompiledModel model = getCompiledModelForNamespace(aspectName.getNamespaceURI());
return (model == null) ? null : model.getAspect(aspectName);
List<CompiledModel> models = getModelsForUri(aspectName.getNamespaceURI());
for (CompiledModel model : models)
{
AspectDefinition aspect = model.getAspect(aspectName);
if (aspect != null)
{
return aspect;
}
}
return null;
}
@@ -227,8 +305,16 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/
public ClassDefinition getClass(QName className)
{
CompiledModel model = getCompiledModelForNamespace(className.getNamespaceURI());
return (model == null) ? null : model.getClass(className);
List<CompiledModel> models = getModelsForUri(className.getNamespaceURI());
for (CompiledModel model : models)
{
ClassDefinition classDef = model.getClass(className);
if (classDef != null)
{
return classDef;
}
}
return null;
}
@@ -237,23 +323,52 @@ public class DictionaryDAOImpl implements DictionaryDAO
*/
public PropertyDefinition getProperty(QName propertyName)
{
CompiledModel model = getCompiledModelForNamespace(propertyName.getNamespaceURI());
return (model == null) ? null : model.getProperty(propertyName);
List<CompiledModel> models = getModelsForUri(propertyName.getNamespaceURI());
for (CompiledModel model : models)
{
PropertyDefinition propDef = model.getProperty(propertyName);
if (propDef != null)
{
return propDef;
}
}
return null;
}
/* (non-Javadoc)
* @see org.alfresco.repo.dictionary.ModelQuery#getConstraint(org.alfresco.service.namespace.QName)
*/
public ConstraintDefinition getConstraint(QName constraintQName)
{
CompiledModel model = getCompiledModelForNamespace(constraintQName.getNamespaceURI());
return (model == null) ? null : model.getConstraint(constraintQName);
List<CompiledModel> models = getModelsForUri(constraintQName.getNamespaceURI());
for (CompiledModel model : models)
{
ConstraintDefinition constraintDef = model.getConstraint(constraintQName);
if (constraintDef != null)
{
return constraintDef;
}
}
return null;
}
/* (non-Javadoc)
* @see org.alfresco.repo.dictionary.impl.ModelQuery#getAssociation(org.alfresco.repo.ref.QName)
*/
public AssociationDefinition getAssociation(QName assocName)
{
CompiledModel model = getCompiledModelForNamespace(assocName.getNamespaceURI());
return (model == null) ? null : model.getAssociation(assocName);
List<CompiledModel> models = getModelsForUri(assocName.getNamespaceURI());
for (CompiledModel model : models)
{
AssociationDefinition assocDef = model.getAssociation(assocName);
if (assocDef != null)
{
return assocDef;
}
}
return null;
}

View File

@@ -36,7 +36,6 @@ import org.alfresco.service.cmr.dictionary.ModelDefinition;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
public class DictionaryDAOTest extends TestCase
@@ -186,6 +185,15 @@ public class DictionaryDAOTest extends TestCase
ClassDefinition fileClassDef = service.getClass(testFileQName);
assertTrue("File type should have the archive flag", fileClassDef.isArchive());
QName testFileDerivedQName = QName.createQName(TEST_URL, "file-derived");
ClassDefinition fileDerivedClassDef = service.getClass(testFileDerivedQName);
assertTrue("Direct derived File type should have the archive flag", fileDerivedClassDef.isArchive());
QName testFileDerivedNoArchiveQName = QName.createQName(TEST_URL, "file-derived-no-archive");
ClassDefinition fileDerivedNoArchiveClassDef = service.getClass(testFileDerivedNoArchiveQName);
assertFalse("Derived File with archive override type should NOT have the archive flag",
fileDerivedNoArchiveClassDef.isArchive());
QName testFolderQName = QName.createQName(TEST_URL, "folder");
ClassDefinition folderClassDef = service.getClass(testFolderQName);
assertFalse("Folder type should not have the archive flag", folderClassDef.isArchive());

View File

@@ -32,7 +32,7 @@ public abstract class M2Class
private String title = null;
private String description = null;
private String parentName = null;
private boolean archive = false;
private Boolean archive = null;
private List<M2Property> properties = new ArrayList<M2Property>();
private List<M2PropertyOverride> propertyOverrides = new ArrayList<M2PropertyOverride>();
@@ -92,14 +92,14 @@ public abstract class M2Class
}
public boolean isArchive()
public Boolean getArchive()
{
return archive;
}
public void setArchive(boolean archive)
{
this.archive = archive;
this.archive = Boolean.valueOf(archive);
}
public M2Property createProperty(String name)

View File

@@ -46,7 +46,6 @@ import org.alfresco.service.namespace.QName;
protected M2Class m2Class;
protected QName name;
protected QName parentName = null;
protected boolean archive = false;
private Map<QName, M2PropertyOverride> propertyOverrides = new HashMap<QName, M2PropertyOverride>();
private Map<QName, PropertyDefinition> properties = new HashMap<QName, PropertyDefinition>();
@@ -57,7 +56,8 @@ import org.alfresco.service.namespace.QName;
private List<AspectDefinition> defaultAspects = new ArrayList<AspectDefinition>();
private List<QName> defaultAspectNames = new ArrayList<QName>();
private List<AspectDefinition> inheritedDefaultAspects = new ArrayList<AspectDefinition>();
private Boolean archive = null;
private Boolean inheritedArchive = null;
/**
* Construct
@@ -74,7 +74,7 @@ import org.alfresco.service.namespace.QName;
// Resolve Names
this.name = QName.createQName(m2Class.getName(), resolver);
this.archive = m2Class.isArchive();
this.archive = m2Class.getArchive();
if (m2Class.getParentName() != null && m2Class.getParentName().length() > 0)
{
this.parentName = QName.createQName(m2Class.getParentName(), resolver);
@@ -280,6 +280,13 @@ import org.alfresco.service.namespace.QName;
inheritedDefaultAspects.add(def);
}
}
// resolve archive inheritance
if (parentClass != null && archive == null)
{
// archive not explicitly set on this class and there is a parent class
inheritedArchive = ((M2ClassDefinition)parentClass).isArchive();
}
}
/* (non-Javadoc)
@@ -340,8 +347,23 @@ import org.alfresco.service.namespace.QName;
return (m2Class instanceof M2Aspect);
}
/**
* @return Returns the archive flag, which defaults to <tt>false</tt>
*/
public boolean isArchive()
{
if (archive == null)
{
if (inheritedArchive != null)
{
return inheritedArchive.booleanValue();
}
else
{
// default to false
return false;
}
}
return archive;
}

View File

@@ -150,6 +150,15 @@
</overrides>
</type>
<type name="test:file-derived">
<parent>test:file</parent>
</type>
<type name="test:file-derived-no-archive">
<parent>test:file</parent>
<archive>false</archive>
</type>
<type name="test:folder">
<parent>test:base</parent>
<properties>

View File

@@ -15,7 +15,6 @@
<cm:systemfolder view:childName="system" view:id="the root system folder">
<cm:name>System</cm:name>
<cm:orderedchildren>true</cm:orderedchildren>
<cm:contains>
<cm:systemfolder view:childName="cm:people folder">

View File

@@ -70,7 +70,7 @@ public class FileFolderServiceImpl implements FileFolderService
"[not (subtypeOf('" + ContentModel.TYPE_SYSTEM_FOLDER + "'))" +
" and (subtypeOf('" + ContentModel.TYPE_FOLDER + "'))]";
/** Shallow search for all files and folders */
/** Shallow search for files and folders with a name pattern */
private static final String XPATH_QUERY_SHALLOW_ALL =
"./*" +
"[like(@cm:name, $cm:name, false)" +

View File

@@ -0,0 +1,82 @@
/*
* 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.node;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.copy.CopyServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.PolicyScope;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
/**
* Registers and contains the behaviour specific to the
* {@link org.alfresco.model.ContentModel#ASPECT_TEMPORARY temporary aspect}.
*
* @author gavinc
*/
public class TemporaryAspect implements CopyServicePolicies.OnCopyNodePolicy
{
// Dependencies
private PolicyComponent policyComponent;
/**
* @param policyComponent the policy component to register behaviour with
*/
public void setPolicyComponent(PolicyComponent policyComponent)
{
this.policyComponent = policyComponent;
}
/**
* Initialise the Temporary Aspect
* <p>
* Ensures that the {@link ContentModel#ASPECT_TEMPORARY temporary aspect}
* copy behaviour is disabled when update copies are performed.
*/
public void init()
{
// disable copy for referencable aspect
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyNode"),
ContentModel.ASPECT_TEMPORARY,
new JavaBehaviour(this, "onCopyNode"));
}
/**
* Does nothing
*/
public void onCopyNode(
QName classRef,
NodeRef sourceNodeRef,
StoreRef destinationStoreRef,
boolean copyToNewNode,
PolicyScope copyDetails)
{
if (copyToNewNode)
{
copyDetails.addAspect(ContentModel.ASPECT_TEMPORARY);
}
else
{
// don't copy if this is an update operation
}
}
}

View File

@@ -646,6 +646,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
public void deleteNode(NodeRef nodeRef)
{
boolean isArchivedNode = false;
boolean requiresDelete = false;
// Invoke policy behaviours
invokeBeforeDeleteNode(nodeRef);
@@ -659,11 +660,27 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
Set<QName> nodeAspectQNames = node.getAspects();
// check if we need to archive the node
StoreRef archiveStoreRef = null;
if (nodeAspectQNames.contains(ContentModel.ASPECT_TEMPORARY))
{
// the node has the temporary aspect meaning
// it can not be archived
requiresDelete = true;
isArchivedNode = false;
}
else
{
StoreRef storeRef = nodeRef.getStoreRef();
StoreRef archiveStoreRef = storeArchiveMap.getArchiveMap().get(storeRef);
archiveStoreRef = storeArchiveMap.getArchiveMap().get(storeRef);
// get the type and check if we need archiving
TypeDefinition typeDef = dictionaryService.getType(node.getTypeQName());
if (typeDef == null || !typeDef.isArchive() || archiveStoreRef == null)
{
requiresDelete = true;
}
}
if (requiresDelete)
{
// perform a normal deletion
nodeDaoService.deleteNode(node, true);

View File

@@ -27,6 +27,7 @@ import org.springframework.dao.InvalidDataAccessApiUsageException;
public class ExceptionTranslatorMethodInterceptor implements MethodInterceptor
{
private static final String MSG_ACCESS_DENIED = "permissions.err_access_denied";
private static final String MSG_READ_ONLY = "permissions.err_read_only";
public ExceptionTranslatorMethodInterceptor()
{
@@ -46,7 +47,7 @@ public class ExceptionTranslatorMethodInterceptor implements MethodInterceptor
catch (InvalidDataAccessApiUsageException e)
{
// this usually occurs when the server is in read-only mode
throw new AccessDeniedException(MSG_ACCESS_DENIED, e);
throw new AccessDeniedException(MSG_READ_ONLY, e);
}
}
}

View File

@@ -25,6 +25,13 @@ import org.alfresco.service.transaction.TransactionService;
*/
public interface ContentAccessor
{
/**
* Gets the open/close state of the underlying IO Channel.
*
* @return Returns true if the underlying IO Channel is open
*/
public boolean isChannelOpen();
/**
* Use this method to register any interest in events against underlying
* content streams.