From 482b98e869d07802310e249d09d784c63f9a86b6 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 19 Sep 2014 15:40:50 +0200 Subject: Introduced static method ItemPath.fromUUIDString and made the UUID constructor protected to better handle ItemPath and AgentPath construction with String UUIDs, throwing the right exceptions. --- src/main/java/com/c2kernel/process/Bootstrap.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/main/java/com/c2kernel/process/Bootstrap.java') diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index e269e09..d5fcaa0 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -23,6 +23,7 @@ import com.c2kernel.lifecycle.instance.predefined.server.ServerPredefinedStepCon import com.c2kernel.lifecycle.instance.stateMachine.Transition; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; +import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.lookup.LookupManager; import com.c2kernel.lookup.Path; @@ -98,14 +99,14 @@ public class Bootstrap Logger.msg(1, "Boot data items complete"); } - private static void verifyBootDataItems(String bootList, String ns, boolean reset) { + private static void verifyBootDataItems(String bootList, String ns, boolean reset) throws InvalidItemPathException { StringTokenizer str = new StringTokenizer(bootList, "\n\r"); while (str.hasMoreTokens()) { String thisItem = str.nextToken(); ItemPath itemPath = null; String[] itemParts = thisItem.split("/"); if (itemParts.length == 3) { // includes UUID - itemPath = new ItemPath(UUID.fromString(itemParts[2])); + itemPath = ItemPath.fromUUIDString(itemParts[2]); } String itemType = itemParts[0]; String itemName = itemParts[1]; @@ -281,7 +282,7 @@ public class Bootstrap /************************************************************************** * Checks for the existence of the admin users so you can use Cristal **************************************************************************/ - private static void checkAgent(String name, String pass, RolePath rolePath, UUID uuid) throws Exception { + private static void checkAgent(String name, String pass, RolePath rolePath, String uuid) throws Exception { Logger.msg(1, "Bootstrap.checkAgent() - Checking for existence of '"+name+"' user."); LookupManager lookup = Gateway.getLookupManager(); @@ -294,7 +295,7 @@ public class Bootstrap Logger.msg("Bootstrap.checkAgent() - User '"+name+"' not found. Creating."); try { - AgentPath agentPath = new AgentPath(new ItemPath(uuid), name); + AgentPath agentPath = new AgentPath(ItemPath.fromUUIDString(uuid), name); agentPath.setPassword(pass); Gateway.getCorbaServer().createAgent(agentPath); lookup.add(agentPath); @@ -324,14 +325,14 @@ public class Bootstrap if (!adminRole.exists()) Gateway.getLookupManager().createRole(adminRole); // check for import user - checkAgent("system", adminPassword, adminRole, new UUID(0, 0)); + checkAgent("system", adminPassword, adminRole, new UUID(0, 0).toString()); - checkAgent("admin", adminPassword, adminRole, new UUID(0, 1)); + checkAgent("admin", adminPassword, adminRole, new UUID(0, 1).toString()); // check for local usercode user & role RolePath usercodeRole = new RolePath(rootRole, "UserCode", true); if (!usercodeRole.exists()) Gateway.getLookupManager().createRole(usercodeRole); - checkAgent(InetAddress.getLocalHost().getHostName(), "uc", usercodeRole, UUID.randomUUID()); + checkAgent(InetAddress.getLocalHost().getHostName(), "uc", usercodeRole, UUID.randomUUID().toString()); } public static void createServerItem() throws Exception { -- cgit v1.2.3