use of org.cristalise.kernel.lookup.ItemPath in project kernel by cristal-ise.
the class ProxyManager method resubscribe.
protected void resubscribe(ProxyServerConnection conn) {
synchronized (proxyPool) {
for (ItemPath key : proxyPool.keySet()) {
ProxyMessage sub = new ProxyMessage(key, ProxyMessage.ADDPATH, false);
Logger.msg(5, "ProxyManager.resubscribe() - item:" + key);
conn.sendMessage(sub);
}
}
}
use of org.cristalise.kernel.lookup.ItemPath 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);
}
use of org.cristalise.kernel.lookup.ItemPath in project kernel by cristal-ise.
the class Bootstrap method checkAgent.
/**
* Checks for the existence of a agents so it can be used
*
* @param name
* @param pass
* @param rolePath
* @param uuid
* @return the Proxy representing the Agent
* @throws Exception
*/
private static AgentProxy checkAgent(String name, String pass, RolePath rolePath, String uuid) throws Exception {
Logger.msg(1, "Bootstrap.checkAgent() - Checking for existence of '" + name + "' agent.");
LookupManager lookup = Gateway.getLookupManager();
try {
AgentProxy agentProxy = Gateway.getProxyManager().getAgentProxy(lookup.getAgentPath(name));
systemAgents.put(name, agentProxy);
Logger.msg(3, "Bootstrap.checkAgent() - Agent '" + name + "' found.");
return agentProxy;
} catch (ObjectNotFoundException ex) {
}
Logger.msg("Bootstrap.checkAgent() - Agent '" + name + "' not found. Creating.");
try {
AgentPath agentPath = new AgentPath(new ItemPath(uuid), name);
Gateway.getCorbaServer().createAgent(agentPath);
lookup.add(agentPath);
if (StringUtils.isNotBlank(pass))
lookup.setAgentPassword(agentPath, pass);
// assign admin role
Logger.msg("Bootstrap.checkAgent() - Assigning role '" + rolePath.getName() + "'");
Gateway.getLookupManager().addRole(agentPath, rolePath);
Gateway.getStorage().put(agentPath, new Property(NAME, name, true), null);
Gateway.getStorage().put(agentPath, new Property(TYPE, "Agent", false), null);
AgentProxy agentProxy = Gateway.getProxyManager().getAgentProxy(agentPath);
// TODO: properly init agent here with wf, props and colls
// agentProxy.initialise(agentId, itemProps, workflow, colls);
systemAgents.put(name, agentProxy);
return agentProxy;
} catch (Exception ex) {
Logger.error("Unable to create '" + name + "' Agent.");
throw ex;
}
}
use of org.cristalise.kernel.lookup.ItemPath in project kernel by cristal-ise.
the class BulkImport method importItemPath.
public ItemPath importItemPath(ItemPath item, Object locker) throws PersistencyException {
try {
ItemPath itemPath = (ItemPath) importCluster.get(item, PATH + "/Item");
Gateway.getLookupManager().add(itemPath);
return itemPath;
} catch (ObjectCannotBeUpdated | ObjectAlreadyExistsException | CannotManageException e) {
Logger.error(e);
throw new PersistencyException(e.getMessage());
}
}
use of org.cristalise.kernel.lookup.ItemPath in project kernel by cristal-ise.
the class ClusterStorageManager method dumpCacheContents.
public void dumpCacheContents(int logLevel) {
if (!Logger.doLog(logLevel))
return;
synchronized (memoryCache) {
for (ItemPath itemPath : memoryCache.keySet()) {
Logger.msg(logLevel, "Cached Objects of Item " + itemPath);
Map<String, C2KLocalObject> sysKeyMemCache = memoryCache.get(itemPath);
try {
synchronized (sysKeyMemCache) {
for (Object name : sysKeyMemCache.keySet()) {
String path = (String) name;
try {
Logger.msg(logLevel, " Path " + path + ": " + sysKeyMemCache.get(path).getClass().getName());
} catch (NullPointerException e) {
Logger.msg(logLevel, " Path " + path + ": reaped");
}
}
}
} catch (ConcurrentModificationException ex) {
Logger.msg(logLevel, "Cache modified - aborting");
}
}
Logger.msg(logLevel, "Total number of cached entities: " + memoryCache.size());
}
}
Aggregations