From 254ee6f47eebfc00462c10756a92066e82cc1a96 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 21 Jun 2011 15:46:02 +0200 Subject: Initial commit --- source/com/c2kernel/property/Property.java | 82 ++++++++++++++++++++ .../com/c2kernel/property/PropertyArrayList.java | 29 ++++++++ .../com/c2kernel/property/PropertyDescription.java | 77 +++++++++++++++++++ .../c2kernel/property/PropertyDescriptionList.java | 53 +++++++++++++ source/com/c2kernel/property/PropertyUtility.java | 87 ++++++++++++++++++++++ 5 files changed, 328 insertions(+) create mode 100755 source/com/c2kernel/property/Property.java create mode 100755 source/com/c2kernel/property/PropertyArrayList.java create mode 100755 source/com/c2kernel/property/PropertyDescription.java create mode 100755 source/com/c2kernel/property/PropertyDescriptionList.java create mode 100755 source/com/c2kernel/property/PropertyUtility.java (limited to 'source/com/c2kernel/property') diff --git a/source/com/c2kernel/property/Property.java b/source/com/c2kernel/property/Property.java new file mode 100755 index 0000000..2374c1b --- /dev/null +++ b/source/com/c2kernel/property/Property.java @@ -0,0 +1,82 @@ +/************************************************************************** + * + * $Revision: 1.3 $ + * $Date: 2003/10/03 12:31:28 $ + * + * Copyright (C) 2001 CERN - European Organization for Nuclear Research + * All rights reserved. + **************************************************************************/ + +package com.c2kernel.property; + +import com.c2kernel.entity.C2KLocalObject; +import com.c2kernel.persistency.ClusterStorage; + + +public class Property implements C2KLocalObject +{ + private String mName; + private String mValue; + + + /************************************************************************** + * + **************************************************************************/ + public Property() + { + setName( "" ); + setValue( "" ); + } + + + /************************************************************************** + * + **************************************************************************/ + public Property( String name, String value ) + { + setName( name ); + setValue( value ); + } + + /************************************************************************** + * + **************************************************************************/ + public void setName(String name) + { + mName = name; + } + + + /************************************************************************** + * + **************************************************************************/ + public String getName() + { + return mName; + } + + + /************************************************************************** + * + **************************************************************************/ + public void setValue( String value ) + { + mValue = value; + } + + + /************************************************************************** + * + **************************************************************************/ + public String getValue() + { + return mValue; + } + /** + * @see com.c2kernel.entity.C2KLocalObject#getClusterType() + */ + public String getClusterType() { + return ClusterStorage.PROPERTY; + } + +} diff --git a/source/com/c2kernel/property/PropertyArrayList.java b/source/com/c2kernel/property/PropertyArrayList.java new file mode 100755 index 0000000..71fc9b7 --- /dev/null +++ b/source/com/c2kernel/property/PropertyArrayList.java @@ -0,0 +1,29 @@ +/************************************************************************** + * + * $Revision: 1.2 $ + * $Date: 2003/06/20 11:44:30 $ + * + * Copyright (C) 2001 CERN - European Organization for Nuclear Research + * All rights reserved. + **************************************************************************/ + +package com.c2kernel.property; + +import java.util.ArrayList; + +import com.c2kernel.utils.CastorArrayList; + +public class PropertyArrayList extends CastorArrayList +{ + public PropertyArrayList() + { + super(); + } + + public PropertyArrayList(ArrayList aList) + { + super(aList); + } + + +} diff --git a/source/com/c2kernel/property/PropertyDescription.java b/source/com/c2kernel/property/PropertyDescription.java new file mode 100755 index 0000000..dbbd6b9 --- /dev/null +++ b/source/com/c2kernel/property/PropertyDescription.java @@ -0,0 +1,77 @@ +/************************************************************************** + * + * $Revision: 1.5 $ + * $Date: 2003/05/16 11:36:47 $ + * + * Copyright (C) 2001 CERN - European Organization for Nuclear Research + * All rights reserved. + **************************************************************************/ + +package com.c2kernel.property; + +public class PropertyDescription +{ + private String mName=null; + private String mDefaultValue=null; + private boolean mIsClassIdentifier=false; + private boolean mIsMutable=false; + + + public PropertyDescription() + { + } + + public PropertyDescription(String name, String defaultValue, boolean isClassIdentifier, boolean isMutable ) + { + setName(name); + setDefaultValue(defaultValue); + setIsClassIdentifier(isClassIdentifier); + setIsMutable(isMutable); + } + + public void setName(String name) + { + mName = name; + } + + public void setIsClassIdentifier(boolean classId) + { + mIsClassIdentifier = classId; + } + + public void setDefaultValue(String defaultValue) + { + mDefaultValue = defaultValue; + } + + public void setIsMutable(boolean mutable) + { + mIsMutable = mutable; + } + + public String getName() + { + return mName; + } + + public boolean getIsClassIdentifier() + { + return mIsClassIdentifier; + } + + public String getDefaultValue() + { + return mDefaultValue; + } + + public boolean getIsMutable() + { + return mIsMutable; + } + + public Property getProperty() + { + return new Property(mName,mDefaultValue); + } + +} diff --git a/source/com/c2kernel/property/PropertyDescriptionList.java b/source/com/c2kernel/property/PropertyDescriptionList.java new file mode 100755 index 0000000..596aa52 --- /dev/null +++ b/source/com/c2kernel/property/PropertyDescriptionList.java @@ -0,0 +1,53 @@ +/************************************************************************** + * + * $Revision: 1.3 $ + * $Date: 2003/07/18 12:43:53 $ + * + * Copyright (C) 2001 CERN - European Organization for Nuclear Research + * All rights reserved. + **************************************************************************/ + +package com.c2kernel.property; + +import java.util.ArrayList; +import java.util.Iterator; + +import com.c2kernel.utils.CastorArrayList; + +public class PropertyDescriptionList extends CastorArrayList +{ + public PropertyDescriptionList() + { + super(); + } + + public PropertyDescriptionList(ArrayList aList) + { + super(aList); + } + + public String getClassProps() { + StringBuffer props = new StringBuffer(); + for (Iterator iter = list.iterator(); iter.hasNext();) { + PropertyDescription element = (PropertyDescription)iter.next(); + if (element.getIsClassIdentifier()) { + if (props.length()>0) + props.append(","); + props.append(element.getName()); + } + } + return props.toString(); + } + + public boolean setDefaultValue(String name, String value) { + for (Iterator iter = list.iterator(); iter.hasNext();) { + PropertyDescription element = (PropertyDescription)iter.next(); + if (element.getName().equals(name)) { + element.setDefaultValue(value); + return true; + } + } + return false; + } + +} diff --git a/source/com/c2kernel/property/PropertyUtility.java b/source/com/c2kernel/property/PropertyUtility.java new file mode 100755 index 0000000..9c65598 --- /dev/null +++ b/source/com/c2kernel/property/PropertyUtility.java @@ -0,0 +1,87 @@ +/************************************************************************** + * + * $Revision: 1.4 $ + * $Date: 2004/10/21 08:02:26 $ + * + * Copyright (C) 2001 CERN - European Organization for Nuclear Research + * All rights reserved. + **************************************************************************/ + +package com.c2kernel.property; + +import java.util.ArrayList; + +import com.c2kernel.persistency.ClusterStorage; +import com.c2kernel.persistency.outcome.Outcome; +import com.c2kernel.process.Gateway; +import com.c2kernel.utils.CastorHashMap; +import com.c2kernel.utils.CastorXMLUtility; +import com.c2kernel.utils.Logger; + + +public class PropertyUtility +{ + static public String getValue(ArrayList pdlist, String name) + { + Object[] values = pdlist.toArray(); + for (int i=0;i