use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class Activity method getTypeName.
public String getTypeName() {
if (mType == null)
return null;
if (mTypeName == null) {
try {
ItemPath actType = new ItemPath(mType);
Property nameProp = (Property) Gateway.getStorage().get(actType, ClusterType.PROPERTY + "/" + NAME, null);
mTypeName = nameProp.getValue();
} catch (Exception e) {
mTypeName = mType;
}
}
return mTypeName;
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class WriteProperty method write.
public static void write(ItemPath item, String name, String value, Object locker) throws PersistencyException, ObjectCannotBeUpdated, ObjectNotFoundException {
Property prop = (Property) Gateway.getStorage().get(item, ClusterType.PROPERTY + "/" + name, locker);
if (!prop.isMutable() && !value.equals(prop.getValue()))
throw new ObjectCannotBeUpdated("WriteProperty: Property '" + name + "' is not mutable.");
prop.setValue(value);
Gateway.getStorage().put(item, prop, locker);
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class ImportAgent method create.
@Override
public Path create(AgentPath agentPath, boolean reset) throws ObjectNotFoundException, ObjectCannotBeUpdated, CannotManageException, ObjectAlreadyExistsException {
if (roles.isEmpty())
throw new ObjectNotFoundException("Agent '" + name + "' must declare at least one Role ");
AgentPath newAgent = new AgentPath(getItemPath(), name);
ActiveEntity newAgentEnt = Gateway.getCorbaServer().createAgent(newAgent);
Gateway.getLookupManager().add(newAgent);
// assemble properties
properties.add(new Property(NAME, name, true));
properties.add(new Property(TYPE, "Agent", false));
try {
if (StringUtils.isNotBlank(password))
Gateway.getLookupManager().setAgentPassword(newAgent, password);
newAgentEnt.initialise(agentPath.getSystemKey(), Gateway.getMarshaller().marshall(new PropertyArrayList(properties)), null, null);
} catch (Exception ex) {
Logger.error(ex);
throw new CannotManageException("Error initialising new agent name:" + name);
}
for (ImportRole role : roles) {
RolePath thisRole = (RolePath) role.create(agentPath, reset);
Gateway.getLookupManager().addRole(newAgent, thisRole);
}
return newAgent;
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class ItemProxy method getProperty.
/**
* Retrieves the values of a named property
*
* @param name of the Item Property
* @return the value of the property
* @throws ObjectNotFoundException property was not found
*/
public String getProperty(String name) throws ObjectNotFoundException {
Logger.msg(5, "ItemProxy.getProperty() - " + name + " from item " + mItemPath);
Property prop = (Property) getObject(ClusterType.PROPERTY + "/" + name);
if (prop != null)
return prop.getValue();
else
throw new ObjectNotFoundException("ItemProxy.getProperty() - COULD not find property " + name + " from item " + mItemPath);
}
use of org.cristalise.kernel.property.Property in project kernel by cristal-ise.
the class Bootstrap method createServerItem.
public static void createServerItem() throws Exception {
LookupManager lookupManager = Gateway.getLookupManager();
String serverName = Gateway.getProperties().getString("ItemServer.name", InetAddress.getLocalHost().getHostName());
thisServerPath = new DomainPath("/servers/" + serverName);
ItemPath serverItem;
try {
serverItem = thisServerPath.getItemPath();
} catch (ObjectNotFoundException ex) {
Logger.msg("Creating server item " + thisServerPath);
serverItem = new ItemPath();
Gateway.getCorbaServer().createItem(serverItem);
lookupManager.add(serverItem);
thisServerPath.setItemPath(serverItem);
lookupManager.add(thisServerPath);
}
int proxyPort = Gateway.getProperties().getInt("ItemServer.Proxy.port", 1553);
Gateway.getStorage().put(serverItem, new Property(NAME, serverName, false), null);
Gateway.getStorage().put(serverItem, new Property(TYPE, "Server", false), null);
Gateway.getStorage().put(serverItem, new Property(KERNEL_VERSION, Gateway.getKernelVersion(), true), null);
Gateway.getStorage().put(serverItem, new Property("ProxyPort", String.valueOf(proxyPort), false), null);
Gateway.getStorage().put(serverItem, new Property("ConsolePort", String.valueOf(Logger.getConsolePort()), true), null);
Gateway.getProxyManager().connectToProxyServer(serverName, proxyPort);
}
Aggregations