use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class AggregationMember method assignItem.
@Override
public void assignItem(ItemPath itemPath) throws InvalidCollectionModification {
if (itemPath != null) {
if (mClassProps == null || getProperties() == null)
throw new InvalidCollectionModification("ClassProps not yet set. Cannot check membership validity.");
// for each mandatory prop check if its in the member property and has the matching value
StringTokenizer sub = new StringTokenizer(mClassProps, ",");
while (sub.hasMoreTokens()) {
String aClassProp = sub.nextToken();
try {
String memberValue = (String) getProperties().get(aClassProp);
Property ItemProperty = (Property) Gateway.getStorage().get(itemPath, ClusterType.PROPERTY + "/" + aClassProp, null);
if (ItemProperty == null)
throw new InvalidCollectionModification("Property " + aClassProp + " does not exist for item " + itemPath);
if (ItemProperty.getValue() == null || !ItemProperty.getValue().equalsIgnoreCase(memberValue))
throw new InvalidCollectionModification("Value of mandatory prop " + aClassProp + " does not match: " + ItemProperty.getValue() + "!=" + memberValue);
} catch (InvalidCollectionModification ex) {
throw ex;
} catch (Exception ex) {
Logger.error(ex);
throw new InvalidCollectionModification("Error checking properties");
}
}
}
mItemPath = itemPath;
mItem = null;
mItemName = null;
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class Bootstrap method createResourceItem.
/**
* @param impHandler
* @param itemName
* @param ns
* @param itemPath
* @return the ItemProxy representing the newly create Item
* @throws Exception
*/
private static ItemProxy createResourceItem(ResourceImportHandler impHandler, String itemName, String ns, ItemPath itemPath) throws Exception {
// create props
PropertyDescriptionList pdList = impHandler.getPropDesc();
PropertyArrayList props = new PropertyArrayList();
LookupManager lookupManager = Gateway.getLookupManager();
for (int i = 0; i < pdList.list.size(); i++) {
PropertyDescription pd = pdList.list.get(i);
String propName = pd.getName();
String propVal = pd.getDefaultValue();
if (propName.equals(NAME.toString()))
propVal = itemName;
else if (propName.equals(MODULE.toString()))
propVal = (ns == null) ? "kernel" : ns;
props.list.add(new Property(propName, propVal, pd.getIsMutable()));
}
CompositeActivity ca = new CompositeActivity();
try {
ca = (CompositeActivity) ((CompositeActivityDef) LocalObjectLoader.getActDef(impHandler.getWorkflowName(), 0)).instantiate();
} catch (ObjectNotFoundException ex) {
Logger.error(ex);
Logger.error("Module resource workflow " + impHandler.getWorkflowName() + " not found. Using empty.");
}
Gateway.getCorbaServer().createItem(itemPath);
lookupManager.add(itemPath);
DomainPath newDomPath = impHandler.getPath(itemName, ns);
newDomPath.setItemPath(itemPath);
lookupManager.add(newDomPath);
ItemProxy newItemProxy = Gateway.getProxyManager().getProxy(itemPath);
newItemProxy.initialise(systemAgents.get("system").getPath(), props, ca, null);
return newItemProxy;
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class Module method setInfo.
public void setInfo(ModuleInfo info) {
this.info = info;
replaceProp(new Property(VERSION, info.version, true));
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class Module method setNamespace.
@Override
public void setNamespace(String ns) {
super.setNamespace(ns);
replaceProp(new Property(NAMESPACE, ns, false));
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class Module method setName.
@Override
public void setName(String name) {
super.setName(name);
replaceProp(new Property(NAME, name, false));
}
Aggregations