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

@@ -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();
}
}