New audit config using 3.2 XSD

- Added helper classes for auto-generating code (core project)
 - Audit configuration is loaded using a separate bean and unmarshalled using JAXB
 - First cut of data extractors and generators that will be required


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15842 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-08-20 16:06:31 +00:00
parent a96352a781
commit dd54579244
28 changed files with 1866 additions and 48 deletions

View File

@@ -25,7 +25,7 @@
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Repository"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Repository"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:Repository}"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:Repository}"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Repository/build.xml}"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Repository/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>

View File

@@ -72,5 +72,18 @@
</property> </property>
</bean> </bean>
<!-- -->
<!-- Audit V3.2 implementation -->
<!-- -->
<bean id="auditConfiguration.registry" class="org.alfresco.repo.audit.model.AuditModelRegistry">
</bean>
<bean id="auditConfiguration.repository" class="org.alfresco.repo.audit.model.AuditModelReader">
<property name="configUrl">
<value>classpath:alfresco/audit/alfresco-audit-repository.xml</value>
</property>
<property name="auditModelRegistry" ref="auditConfiguration.registry"/>
</bean>
</beans> </beans>

View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.alfresco.org/repo/audit/model/3.2" elementFormDefault="qualified" xml:lang="EN" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:a="http://www.alfresco.org/repo/audit/model/3.2">
<xs:annotation>
<xs:documentation xml:lang="EN"> Schema to define audit configuration (V3.2). </xs:documentation>
</xs:annotation>
<!-- Root element is the Audit element -->
<xs:element name="Audit" type="a:Audit"/>
<!-- -->
<!-- Define Elements -->
<!-- -->
<xs:complexType name="Audit">
<xs:sequence>
<xs:element name="DataExtractors" type="a:DataExtractors" minOccurs="0" maxOccurs="1"/>
<xs:element name="DataGenerators" type="a:DataGenerators" minOccurs="0" maxOccurs="1"/>
<xs:element name="Application" type="a:Application" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DataExtractors">
<xs:sequence>
<xs:element name="DataExtractor" type="a:DataExtractor" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DataExtractor">
<xs:attribute name="name" type="a:NameAttribute"/>
<xs:attribute name="class" type="a:ClassAttribute"/>
</xs:complexType>
<xs:complexType name="DataGenerators">
<xs:sequence>
<xs:element name="DataGenerator" type="a:DataGenerator" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DataGenerator">
<xs:attribute name="name" type="a:NameAttribute"/>
<xs:attribute name="class" type="a:ClassAttribute"/>
</xs:complexType>
<xs:complexType name="Application">
<xs:complexContent>
<xs:extension base="a:AuditPath">
<xs:attribute name="name" type="a:NameAttribute" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="AuditPath">
<xs:complexContent>
<xs:extension base="a:KeyedAuditDefinition">
<xs:sequence>
<xs:element name="AuditSession" type="a:AuditSession" minOccurs="0" maxOccurs="1"/>
<xs:element name="RecordValue" type="a:RecordValue" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GenerateValue" type="a:GenerateValue" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="AuditPath" type="a:AuditPath" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="AuditSession">
<xs:sequence>
<xs:element name="GenerateValue" type="a:GenerateValue" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RecordValue">
<xs:complexContent>
<xs:extension base="a:KeyedAuditDefinition">
<xs:attribute name="dataExtractor" type="a:NameAttribute" use="required" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="GenerateValue">
<xs:complexContent>
<xs:extension base="a:KeyedAuditDefinition">
<xs:attribute name="dataGenerator" type="a:NameAttribute" use="required" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- -->
<!-- Define types -->
<!-- -->
<xs:complexType name="KeyedAuditDefinition">
<xs:attribute name="key" type="a:KeyAttribute" use="required"/>
</xs:complexType>
<xs:simpleType name="NameAttribute">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="128"/>
<xs:pattern value="([a-z]|[A-Z]|[0-9]|\ |\-)*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="KeyAttribute">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="128"/>
<xs:pattern value="([a-z]|\-)*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ClassAttribute">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,52 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Default Audit Configuration -->
<Audit
xmlns="http://www.alfresco.org/repo/audit/model/3.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.alfresco.org/repo/audit/model/3.2 alfresco-audit-3.2.xsd"
>
<DataExtractors>
<DataExtractor name="simpleValue" class="org.alfresco.repo.audit.extractor.SimpleValueDataExtractor"/>
<!--
<DataExtractor name="stackTrace" class="org.alfresco.repo.audit.extractor.StackTraceDataExtractor"/>
<DataExtractor name="storeRootNode" class="org.alfresco.repo.audit.extractor.StoreRootNodeDataExtractor"/>
-->
</DataExtractors>
<DataGenerators>
<DataGenerator name="authenticatedUser" class="org.alfresco.repo.audit.generator.AuthenticatedUserDataGenerator"/>
<DataGenerator name="systemTime" class="org.alfresco.repo.audit.generator.SystemTimeDataGenerator"/>
<DataGenerator name="transactionId" class="org.alfresco.repo.audit.generator.TransactionIdDataGenerator"/>
</DataGenerators>
<Application name="Alfresco Repository" key="repository">
<AuditSession>
<GenerateValue key="user" dataGenerator="authenticatedUser"/>
<GenerateValue key="time" dataGenerator="systemTime"/>
</AuditSession>
<AuditPath key="services">
<GenerateValue key="txn" dataGenerator="transactionId"/>
<AuditPath key="nodeservice">
<AuditPath key="createstore">
<AuditPath key="protocol">
<RecordValue key="value" dataExtractor="simpleValue"/>
</AuditPath>
<AuditPath key="identifier">
<RecordValue key="value" dataExtractor="simpleValue"/>
</AuditPath>
<AuditPath key="return">
<RecordValue key="value" dataExtractor="simpleValue"/>
<RecordValue key="root-node" dataExtractor="storeRootNode"/>
</AuditPath>
<AuditPath key="error">
<RecordValue key="value" dataExtractor="stackTrace"/>
</AuditPath>
</AuditPath>
</AuditPath>
</AuditPath>
</Application>
</Audit>

View File

@@ -25,24 +25,30 @@
package org.alfresco.repo.audit; package org.alfresco.repo.audit;
import java.util.List; import java.util.List;
import java.util.Map;
import org.alfresco.repo.audit.model._3.AuditPath;
import org.alfresco.service.cmr.audit.AuditInfo; import org.alfresco.service.cmr.audit.AuditInfo;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
/** /**
* The audit component. Used by the AuditService and AuditMethodInterceptor to insert audit entries. * The audit component. Used by the AuditService and AuditMethodInterceptor to insert audit entries.
* <p/>
* The V3.2 audit functionality is contained within the same component. When the newer audit
* implementation has been tested and approved, then older ones will be deprecated as necessary.
* *
* @author Andy Hind * @author Andy Hind
* @author Derek Hulley
*/ */
public interface AuditComponent public interface AuditComponent
{ {
/** /**
* Audit entry point for method interceptors. * Audit entry point for method interceptors.
* *
* @param methodInvocation
* @return - the return onbject from the normal invocation of the audited method. * @return - the return onbject from the normal invocation of the audited method.
* @throws Throwable *
* @since 2.1
*/ */
public Object audit(MethodInvocation methodInvocation) throws Throwable; public Object audit(MethodInvocation methodInvocation) throws Throwable;
@@ -55,6 +61,8 @@ public interface AuditComponent
* a node ref to use as the key for filtering etc * a node ref to use as the key for filtering etc
* @param args - * @param args -
* an arbitrary list of parameters * an arbitrary list of parameters
*
* @since 2.1
*/ */
public void audit(String source, String description, NodeRef key, Object... args); public void audit(String source, String description, NodeRef key, Object... args);
@@ -64,7 +72,30 @@ public interface AuditComponent
* @param nodeRef - * @param nodeRef -
* the node ref for which we want the audit trail * the node ref for which we want the audit trail
* @return - a list of AuditInfo objects that represent the audit trail for the given node reference. * @return - a list of AuditInfo objects that represent the audit trail for the given node reference.
*
* @since 2.1
*/ */
public List<AuditInfo> getAuditTrail(NodeRef nodeRef); public List<AuditInfo> getAuditTrail(NodeRef nodeRef);
/**
* Start an audit session for the given root path. All later audit operations on the resulting
* session will be relative to this root path.
*
* @param rootPath a base path of {@link AuditPath} key entries concatenated with <b>.</b> (period)
* @return Returns the unique session identifier
*/
public Long startAuditSession(String rootPath);
/**
* Record a set of values against the given session.
*
* @param sessionId a pre-existing audit session to continue with
* @param values the values to audit mapped by {@link AuditPath} key relative to the session
* root path
*
* @see #startAuditSession()
*
* @since 3.2
*/
public void audit(Long sessionId, Map<String, Object> values);
} }

View File

@@ -30,6 +30,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import org.alfresco.repo.audit.model.AuditEntry; import org.alfresco.repo.audit.model.AuditEntry;
import org.alfresco.repo.audit.model.TrueFalseUnset; import org.alfresco.repo.audit.model.TrueFalseUnset;
@@ -56,8 +57,12 @@ import org.apache.commons.logging.LogFactory;
/** /**
* The default audit component implementation. TODO: Implement before, after and exception filtering. At the moment * The default audit component implementation. TODO: Implement before, after and exception filtering. At the moment
* these filters are ignored. TODO: Respect audit internal - at the moment audit internal is fixed to false. * these filters are ignored. TODO: Respect audit internal - at the moment audit internal is fixed to false.
* <p/>
* The V3.2 audit functionality is contained within the same component. When the newer audit
* implementation has been tested and approved, then older ones will be deprecated as necessary.
* *
* @author Andy Hind * @author Andy Hind
* @author Derek Hulley
*/ */
public class AuditComponentImpl implements AuditComponent public class AuditComponentImpl implements AuditComponent
{ {
@@ -752,4 +757,17 @@ public class AuditComponentImpl implements AuditComponent
return result; return result;
} }
/*
* V3.2 from here on. Put all fixes to the older audit code before this point, please.
*/
public Long startAuditSession(String rootPath)
{
throw new UnsupportedOperationException();
}
public void audit(Long sessionId, Map<String, Object> values)
{
throw new UnsupportedOperationException();
}
} }

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.extractor;
/**
* Interface for Audit data value extractors. These are used to extract auditable values
* from those arguments, return values, exceptions and any other value passed into the audit
* components for recording.
* <p/>
* The framework will first determine if data passed into the instance is {@link #isSupported(Object) supported}
* and will then pass it in for {@link #convert(Object) conversion} to the type that will be
* recorded.
*
* @author Derek Hulley
* @since 3.2
*/
public interface DataExtractor
{
/**
* Determines if the extractor will be able to pull any data from the given value.
*
* @param data the data that might be useful to this extractor (could be <tt>null</tt>)
* @return Returns <tt>true</tt> if the data is meaningful to this extractor
*/
public boolean isSupported(Object data);
/**
* Convert an value passed into the audit components into a value to be recorded.
*
* @param value the value to convert
* @return the (potentially) converted value
* @throws Throwable All errors will be handled by the calling framework
*/
public Object convert(Object value) throws Throwable;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.extractor;
/**
* An extractor that supports all values and does not conversion.
* This implementation can be used as a base class, although there is little
* abstraction necessary for the converters in general.
*
* @author Derek Hulley
* @since 3.2
*/
public class SimpleValueDataExtractor implements DataExtractor
{
/**
* @return Returns <tt>true</tt> always
*/
public boolean isSupported(Object data)
{
return true;
}
/**
* Just returns the value unchanged
*/
public Object convert(Object in) throws Throwable
{
return in;
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.generator;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
/**
* Gives back the currently-authenticated user.
*
* @author Derek Hulley
* @since 3.2
*/
public class AuthenticatedUserDataGenerator implements DataGenerator
{
/**
* @return Returns the currently-authenticated user
*/
public Object getData() throws Throwable
{
return AuthenticationUtil.getFullyAuthenticatedUser();
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.generator;
/**
* Interface for Audit data value generators.These are used to produce auditable data values
* extract auditable values from nothing; typically these values are derived from the system
* state or from the thread context.
* <p/>
* <tt>null</tt> values will be ignored by the audit framework.
*
* @author Derek Hulley
* @since 3.2
*/
public interface DataGenerator
{
/**
* Get the data generated by the instance.
*
* @return Returns the generated data
* @throws Throwable All exceptions are handled by the framework
*/
public Object getData() throws Throwable;
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.generator;
import java.util.Date;
/**
* Gives back the currently time.
*
* @author Derek Hulley
* @since 3.2
*/
public class SystemTimeDataGenerator implements DataGenerator
{
/**
* @return Returns the current time
*/
public Object getData() throws Throwable
{
return new Date();
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.generator;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
/**
* Gives back the currently transaction ID.
*
* @author Derek Hulley
* @since 3.2
*/
public class TransactionIdDataGenerator implements DataGenerator
{
/**
* @return Returns the current transaction ID (<tt>null</tt> if not in a transction)
*/
public Object getData() throws Throwable
{
return AlfrescoTransactionSupport.getTransactionId();
}
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.model;
import java.io.File;
import java.net.URL;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.UnmarshalException;
import javax.xml.bind.Unmarshaller;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.audit.model._3.Audit;
import org.alfresco.util.PropertyCheck;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.ResourceUtils;
/**
* A component used to load Audit configuration XML documents.
*
* @author Derek Hulley
* @since 3.2
*/
public class AuditModelReader implements InitializingBean
{
private URL configUrl;
private AuditModelRegistry auditModelRegistry;
/**
* Set the XML location using <b>file:</b>, <b>classpath:</b> or any of the
* {@link ResourceUtils Spring-supported} formats.
*
* @param configUrl the location of the XML file
*/
public void setConfigUrl(URL configUrl)
{
this.configUrl = configUrl;
}
/**
*
* @param auditModelRegistry the registry that combines all loaded models
*/
public void setAuditModelRegistry(AuditModelRegistry auditModelRegistry)
{
this.auditModelRegistry = auditModelRegistry;
}
/**
* Pulls in the configuration and registers it
*/
public void afterPropertiesSet() throws Exception
{
PropertyCheck.mandatory(this, "configUrl", configUrl);
PropertyCheck.mandatory(this, "auditModelRegistry", auditModelRegistry);
File file = new File(configUrl.getFile());
if (!file.exists())
{
throw new AlfrescoRuntimeException("The Audit configuration XML was not found: " + configUrl);
}
// Load it
JAXBContext jaxbCtx = JAXBContext.newInstance("org.alfresco.repo.audit.model._3");
Unmarshaller jaxbUnmarshaller = jaxbCtx.createUnmarshaller();
try
{
@SuppressWarnings("unchecked")
JAXBElement<Audit> auditElement = (JAXBElement<Audit>) jaxbUnmarshaller.unmarshal(configUrl);
Audit audit = auditElement.getValue();
// Now register it
auditModelRegistry.registerModel(configUrl, audit);
}
catch (UnmarshalException e)
{
throw new AlfrescoRuntimeException(
"Failed to read Audit configuration XML: \n" +
" URL: " + configUrl + "\n" +
" Error: " + e.getMessage());
}
}
}

View File

@@ -0,0 +1,141 @@
/*
* Copyright (C) 2005-2009 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.audit.model;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.repo.audit.extractor.DataExtractor;
import org.alfresco.repo.audit.generator.DataGenerator;
import org.alfresco.repo.audit.model._3.Application;
import org.alfresco.repo.audit.model._3.Audit;
import org.alfresco.repo.audit.model._3.DataExtractors;
import org.alfresco.repo.audit.model._3.DataGenerators;
/**
* Component used to store audit model definitions. It ensures that duplicate application and converter
* definitions are detected and provides a single lookup for code using the Audit model.
*
* @author Derek Hulley
* @since 3.2
*/
public class AuditModelRegistry
{
private final Map<URL, Audit> auditModelsByUrl;
private final Map<String, DataExtractor> dataExtractorsByName;
private final Map<String, DataGenerator> dataGeneratorsByName;
private final Map<String, Application> auditApplicationsByName;
public AuditModelRegistry()
{
auditModelsByUrl = new HashMap<URL, Audit>(7);
dataExtractorsByName = new HashMap<String, DataExtractor>(13);
dataGeneratorsByName = new HashMap<String, DataGenerator>(13);
auditApplicationsByName = new HashMap<String, Application>(7);
}
/**
* Register an audit model.
*
* @param configurationUrl the source of the configuration
* @param audit the unmarshalled instance tree
*/
public void registerModel(URL configurationUrl, Audit audit)
{
// Get the data extractors and check for duplicates
DataExtractors extractorsElement = audit.getDataExtractors();
List<org.alfresco.repo.audit.model._3.DataExtractor> converterElements = extractorsElement.getDataExtractor();
for (org.alfresco.repo.audit.model._3.DataExtractor converterElement : converterElements)
{
String name = converterElement.getName();
if (dataExtractorsByName.containsKey(name))
{
throw new AuditModelException("Audit data extractor '" + name + "' has already been defined.");
}
// Construct the converter
final DataExtractor dataExtractor;
try
{
Class<?> dataExtractorClazz = Class.forName(converterElement.getClazz());
dataExtractor = (DataExtractor) dataExtractorClazz.newInstance();
}
catch (ClassNotFoundException e)
{
throw new AuditModelException(
"Audit data extractor '" + name + "' class not found: " + converterElement.getClazz());
}
catch (Exception e)
{
throw new AuditModelException(
"Audit data extractor '" + name + "' could not be constructed: " + converterElement.getClazz());
}
dataExtractorsByName.put(name, dataExtractor);
}
// Get the data generators and check for duplicates
DataGenerators generatorsElement = audit.getDataGenerators();
List<org.alfresco.repo.audit.model._3.DataGenerator> generatorElements = generatorsElement.getDataGenerator();
for (org.alfresco.repo.audit.model._3.DataGenerator generatorElement : generatorElements)
{
String name = generatorElement.getName();
if (dataGeneratorsByName.containsKey(name))
{
throw new AuditModelException("Audit data generator '" + name + "' has already been defined.");
}
// Construct the converter
final DataGenerator dataGenerator;
try
{
Class<?> dataExtractorClazz = Class.forName(generatorElement.getClazz());
dataGenerator = (DataGenerator) dataExtractorClazz.newInstance();
}
catch (ClassNotFoundException e)
{
throw new AuditModelException(
"Audit data generator '" + name + "' class not found: " + generatorElement.getClazz());
}
catch (Exception e)
{
throw new AuditModelException(
"Audit data generator '" + name + "' could not be constructed: " + generatorElement.getClazz());
}
dataGeneratorsByName.put(name, dataGenerator);
}
// Get the application and check for duplicates
List<Application> applications = audit.getApplication();
for (Application application : applications)
{
String name = application.getName();
if (auditApplicationsByName.containsKey(name))
{
throw new AuditModelException("Audit application '" + name + "' has already been defined.");
}
auditApplicationsByName.put(name, application);
}
// Store the model
auditModelsByUrl.put(configurationUrl, audit);
}
}

View File

@@ -0,0 +1,60 @@
package org.alfresco.repo.audit.model._3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Application complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="Application">
* &lt;complexContent>
* &lt;extension base="{http://www.alfresco.org/repo/audit/model/3.2}AuditPath">
* &lt;attribute name="name" use="required" type="{http://www.alfresco.org/repo/audit/model/3.2}NameAttribute" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Application")
public class Application
extends AuditPath
{
@XmlAttribute(required = true)
protected String name;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
}

View File

@@ -0,0 +1,125 @@
package org.alfresco.repo.audit.model._3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Audit complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="Audit">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="DataExtractors" type="{http://www.alfresco.org/repo/audit/model/3.2}DataExtractors" minOccurs="0"/>
* &lt;element name="DataGenerators" type="{http://www.alfresco.org/repo/audit/model/3.2}DataGenerators" minOccurs="0"/>
* &lt;element name="Application" type="{http://www.alfresco.org/repo/audit/model/3.2}Application" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Audit", propOrder = {
"dataExtractors",
"dataGenerators",
"application"
})
public class Audit {
@XmlElement(name = "DataExtractors")
protected DataExtractors dataExtractors;
@XmlElement(name = "DataGenerators")
protected DataGenerators dataGenerators;
@XmlElement(name = "Application")
protected List<Application> application;
/**
* Gets the value of the dataExtractors property.
*
* @return
* possible object is
* {@link DataExtractors }
*
*/
public DataExtractors getDataExtractors() {
return dataExtractors;
}
/**
* Sets the value of the dataExtractors property.
*
* @param value
* allowed object is
* {@link DataExtractors }
*
*/
public void setDataExtractors(DataExtractors value) {
this.dataExtractors = value;
}
/**
* Gets the value of the dataGenerators property.
*
* @return
* possible object is
* {@link DataGenerators }
*
*/
public DataGenerators getDataGenerators() {
return dataGenerators;
}
/**
* Sets the value of the dataGenerators property.
*
* @param value
* allowed object is
* {@link DataGenerators }
*
*/
public void setDataGenerators(DataGenerators value) {
this.dataGenerators = value;
}
/**
* Gets the value of the application property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the application property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getApplication().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Application }
*
*
*/
public List<Application> getApplication() {
if (application == null) {
application = new ArrayList<Application>();
}
return this.application;
}
}

View File

@@ -0,0 +1,169 @@
package org.alfresco.repo.audit.model._3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AuditPath complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="AuditPath">
* &lt;complexContent>
* &lt;extension base="{http://www.alfresco.org/repo/audit/model/3.2}KeyedAuditDefinition">
* &lt;sequence>
* &lt;element name="AuditSession" type="{http://www.alfresco.org/repo/audit/model/3.2}AuditSession" minOccurs="0"/>
* &lt;element name="RecordValue" type="{http://www.alfresco.org/repo/audit/model/3.2}RecordValue" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element name="GenerateValue" type="{http://www.alfresco.org/repo/audit/model/3.2}GenerateValue" maxOccurs="unbounded" minOccurs="0"/>
* &lt;element name="AuditPath" type="{http://www.alfresco.org/repo/audit/model/3.2}AuditPath" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AuditPath", propOrder = {
"auditSession",
"recordValue",
"generateValue",
"auditPath"
})
@XmlSeeAlso({
Application.class
})
public class AuditPath
extends KeyedAuditDefinition
{
@XmlElement(name = "AuditSession")
protected AuditSession auditSession;
@XmlElement(name = "RecordValue")
protected List<RecordValue> recordValue;
@XmlElement(name = "GenerateValue")
protected List<GenerateValue> generateValue;
@XmlElement(name = "AuditPath")
protected List<AuditPath> auditPath;
/**
* Gets the value of the auditSession property.
*
* @return
* possible object is
* {@link AuditSession }
*
*/
public AuditSession getAuditSession() {
return auditSession;
}
/**
* Sets the value of the auditSession property.
*
* @param value
* allowed object is
* {@link AuditSession }
*
*/
public void setAuditSession(AuditSession value) {
this.auditSession = value;
}
/**
* Gets the value of the recordValue property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the recordValue property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRecordValue().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link RecordValue }
*
*
*/
public List<RecordValue> getRecordValue() {
if (recordValue == null) {
recordValue = new ArrayList<RecordValue>();
}
return this.recordValue;
}
/**
* Gets the value of the generateValue property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the generateValue property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getGenerateValue().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link GenerateValue }
*
*
*/
public List<GenerateValue> getGenerateValue() {
if (generateValue == null) {
generateValue = new ArrayList<GenerateValue>();
}
return this.generateValue;
}
/**
* Gets the value of the auditPath property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the auditPath property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAuditPath().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AuditPath }
*
*
*/
public List<AuditPath> getAuditPath() {
if (auditPath == null) {
auditPath = new ArrayList<AuditPath>();
}
return this.auditPath;
}
}

View File

@@ -0,0 +1,69 @@
package org.alfresco.repo.audit.model._3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AuditSession complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="AuditSession">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="GenerateValue" type="{http://www.alfresco.org/repo/audit/model/3.2}GenerateValue" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AuditSession", propOrder = {
"generateValue"
})
public class AuditSession {
@XmlElement(name = "GenerateValue")
protected List<GenerateValue> generateValue;
/**
* Gets the value of the generateValue property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the generateValue property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getGenerateValue().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link GenerateValue }
*
*
*/
public List<GenerateValue> getGenerateValue() {
if (generateValue == null) {
generateValue = new ArrayList<GenerateValue>();
}
return this.generateValue;
}
}

View File

@@ -0,0 +1,85 @@
package org.alfresco.repo.audit.model._3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for DataExtractor complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DataExtractor">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="name" type="{http://www.alfresco.org/repo/audit/model/3.2}NameAttribute" />
* &lt;attribute name="class" type="{http://www.alfresco.org/repo/audit/model/3.2}ClassAttribute" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DataExtractor")
public class DataExtractor {
@XmlAttribute
protected String name;
@XmlAttribute(name = "class")
protected String clazz;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the clazz property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getClazz() {
return clazz;
}
/**
* Sets the value of the clazz property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setClazz(String value) {
this.clazz = value;
}
}

View File

@@ -0,0 +1,69 @@
package org.alfresco.repo.audit.model._3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for DataExtractors complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DataExtractors">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="DataExtractor" type="{http://www.alfresco.org/repo/audit/model/3.2}DataExtractor" maxOccurs="unbounded"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DataExtractors", propOrder = {
"dataExtractor"
})
public class DataExtractors {
@XmlElement(name = "DataExtractor", required = true)
protected List<DataExtractor> dataExtractor;
/**
* Gets the value of the dataExtractor property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the dataExtractor property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDataExtractor().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DataExtractor }
*
*
*/
public List<DataExtractor> getDataExtractor() {
if (dataExtractor == null) {
dataExtractor = new ArrayList<DataExtractor>();
}
return this.dataExtractor;
}
}

View File

@@ -0,0 +1,85 @@
package org.alfresco.repo.audit.model._3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for DataGenerator complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DataGenerator">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="name" type="{http://www.alfresco.org/repo/audit/model/3.2}NameAttribute" />
* &lt;attribute name="class" type="{http://www.alfresco.org/repo/audit/model/3.2}ClassAttribute" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DataGenerator")
public class DataGenerator {
@XmlAttribute
protected String name;
@XmlAttribute(name = "class")
protected String clazz;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the clazz property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getClazz() {
return clazz;
}
/**
* Sets the value of the clazz property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setClazz(String value) {
this.clazz = value;
}
}

View File

@@ -0,0 +1,69 @@
package org.alfresco.repo.audit.model._3;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for DataGenerators complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DataGenerators">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="DataGenerator" type="{http://www.alfresco.org/repo/audit/model/3.2}DataGenerator" maxOccurs="unbounded"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DataGenerators", propOrder = {
"dataGenerator"
})
public class DataGenerators {
@XmlElement(name = "DataGenerator", required = true)
protected List<DataGenerator> dataGenerator;
/**
* Gets the value of the dataGenerator property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the dataGenerator property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDataGenerator().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DataGenerator }
*
*
*/
public List<DataGenerator> getDataGenerator() {
if (dataGenerator == null) {
dataGenerator = new ArrayList<DataGenerator>();
}
return this.dataGenerator;
}
}

View File

@@ -0,0 +1,60 @@
package org.alfresco.repo.audit.model._3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for GenerateValue complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="GenerateValue">
* &lt;complexContent>
* &lt;extension base="{http://www.alfresco.org/repo/audit/model/3.2}KeyedAuditDefinition">
* &lt;attribute name="dataGenerator" use="required" type="{http://www.alfresco.org/repo/audit/model/3.2}NameAttribute" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GenerateValue")
public class GenerateValue
extends KeyedAuditDefinition
{
@XmlAttribute(required = true)
protected String dataGenerator;
/**
* Gets the value of the dataGenerator property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDataGenerator() {
return dataGenerator;
}
/**
* Sets the value of the dataGenerator property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDataGenerator(String value) {
this.dataGenerator = value;
}
}

View File

@@ -0,0 +1,64 @@
package org.alfresco.repo.audit.model._3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for KeyedAuditDefinition complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="KeyedAuditDefinition">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;attribute name="key" use="required" type="{http://www.alfresco.org/repo/audit/model/3.2}KeyAttribute" />
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "KeyedAuditDefinition")
@XmlSeeAlso({
GenerateValue.class,
AuditPath.class,
RecordValue.class
})
public class KeyedAuditDefinition {
@XmlAttribute(required = true)
protected String key;
/**
* Gets the value of the key property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKey() {
return key;
}
/**
* Sets the value of the key property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKey(String value) {
this.key = value;
}
}

View File

@@ -0,0 +1,133 @@
package org.alfresco.repo.audit.model._3;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the org.alfresco.repo.audit.model._3 package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _Audit_QNAME = new QName("http://www.alfresco.org/repo/audit/model/3.2", "Audit");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.alfresco.repo.audit.model._3
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link DataExtractors }
*
*/
public DataExtractors createDataExtractors() {
return new DataExtractors();
}
/**
* Create an instance of {@link AuditPath }
*
*/
public AuditPath createAuditPath() {
return new AuditPath();
}
/**
* Create an instance of {@link DataGenerators }
*
*/
public DataGenerators createDataGenerators() {
return new DataGenerators();
}
/**
* Create an instance of {@link KeyedAuditDefinition }
*
*/
public KeyedAuditDefinition createKeyedAuditDefinition() {
return new KeyedAuditDefinition();
}
/**
* Create an instance of {@link RecordValue }
*
*/
public RecordValue createRecordValue() {
return new RecordValue();
}
/**
* Create an instance of {@link DataGenerator }
*
*/
public DataGenerator createDataGenerator() {
return new DataGenerator();
}
/**
* Create an instance of {@link AuditSession }
*
*/
public AuditSession createAuditSession() {
return new AuditSession();
}
/**
* Create an instance of {@link GenerateValue }
*
*/
public GenerateValue createGenerateValue() {
return new GenerateValue();
}
/**
* Create an instance of {@link DataExtractor }
*
*/
public DataExtractor createDataExtractor() {
return new DataExtractor();
}
/**
* Create an instance of {@link Application }
*
*/
public Application createApplication() {
return new Application();
}
/**
* Create an instance of {@link Audit }
*
*/
public Audit createAudit() {
return new Audit();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Audit }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.alfresco.org/repo/audit/model/3.2", name = "Audit")
public JAXBElement<Audit> createAudit(Audit value) {
return new JAXBElement<Audit>(_Audit_QNAME, Audit.class, null, value);
}
}

View File

@@ -0,0 +1,60 @@
package org.alfresco.repo.audit.model._3;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for RecordValue complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="RecordValue">
* &lt;complexContent>
* &lt;extension base="{http://www.alfresco.org/repo/audit/model/3.2}KeyedAuditDefinition">
* &lt;attribute name="dataExtractor" use="required" type="{http://www.alfresco.org/repo/audit/model/3.2}NameAttribute" />
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RecordValue")
public class RecordValue
extends KeyedAuditDefinition
{
@XmlAttribute(required = true)
protected String dataExtractor;
/**
* Gets the value of the dataExtractor property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDataExtractor() {
return dataExtractor;
}
/**
* Sets the value of the dataExtractor property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDataExtractor(String value) {
this.dataExtractor = value;
}
}

View File

@@ -0,0 +1,2 @@
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.alfresco.org/repo/audit/model/3.2", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.alfresco.repo.audit.model._3;