org.cristalise.kernel.entity.C2KLocalObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cristalise-kernel Show documentation
Show all versions of cristalise-kernel Show documentation
Cristal-ise is a description-driven software platform originally developed to track the construction of
the CMS ECAL detector of the LHC at CERN. This is its core library, known as the kernel, which manages
business objects called Items. Items are entirely configured from data, called descriptions, held in other Items.
Every change of a state in an Item is a consequence of an execution of an activity in that Item's lifecycle,
meaning that Cristal-ise applications are completely traceable, even in their design. It also supports extensive
versioning of Item description data, giving the system a high level of flexibility.
/**
* This file is part of the CRISTAL-iSE kernel.
* Copyright (c) 2001-2015 The CRISTAL Consortium. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
* http://www.fsf.org/licensing/licenses/lgpl.html
*/
package org.cristalise.kernel.entity;
import org.cristalise.kernel.persistency.ClusterType;
/**
* Objects that are to be stored by CRISTAL-iSE Items must implement this interface and be
* (un)marshallable by Castor i.e. have a map file properly registered in the kernel.
* Domain implementors shall not create new C2KLocalObjects
*
* @see org.cristalise.kernel.persistency.ClusterStorage
* @see org.cristalise.kernel.persistency.ClusterStorageManager
*/
public interface C2KLocalObject {
/**
* Sets the name of the C2KLocalObject
*
* @param name Name of the C2KLocalObject
*/
public void setName(String name);
/**
* Gets the name of the C2KLocalObject
* @return name of the C2KLocalObject
*/
public String getName();
/**
* Each object belongs to a specific type defined in {@link org.cristalise.kernel.persistency.ClusterStorage}
*
* @return string id of the type
*/
public ClusterType getClusterType();
/**
* Each C2KLocalObject is stored with a path identifier starting with the ClusterType:
*
* - Properties: /Property/Name
*
- Workflow: /LifeCycle/workflow
*
- Collections: /Collection/Name/Version (default Name='last')
*
- Outcomes: /Outcome/SchemaName/SchemaVersion/EventID
*
- Viewpoints: /ViewPoint/SchemaName/Name (default Name='last')
*
- Events: /AuditTrail/EventID
*
- Jobs: /Job/JobID
*
* @return The path identifier (i.e. primary key) of the object
*/
public String getClusterPath();
/**
* Use this method to ensure very strict name policy
*
* @param name to be checked
* @throws IllegalArgumentException name must be alphanumeric with '_-:~' characters
*/
public static void enforceValidName(String name) {
String regex = "^[\\w-:\\~]*$";
if (!name.matches(regex))
throw new IllegalArgumentException("Name='"+name+"' must be alphanumeric with '_-:~' characters");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy