1 9 package org.jboss.portal.server; 10 11 import org.jboss.portal.common.FQN; 12 import org.jboss.portal.server.kernel.ServiceID; 13 14 20 public class ServerObjectID 21 extends FQN 22 implements ServiceID 23 { 24 25 private String desc = null; 26 27 public ServerObjectID(String [] names) throws IllegalArgumentException 28 { 29 super(names); 30 } 31 32 public String toString() 33 { 34 if (desc == null) 35 { 36 StringBuffer buffer = new StringBuffer (); 37 buffer.append(names[0]); 38 for (int i = 1;i < names.length;i++) 39 { 40 buffer.append('.').append(names[i]); 41 } 42 desc = buffer.toString(); 43 } 44 return desc; 45 } 46 47 50 public static ServerObjectID createPortalContainerID() throws IllegalArgumentException 51 { 52 53 return new ServerObjectID(new String []{"container"}); 54 } 55 56 59 public static ServerObjectID createPortalID(String name) throws IllegalArgumentException 60 { 61 return new ServerObjectID(new String []{"portal", name}); 62 } 63 64 67 public static ServerObjectID createPortalID(ServerObjectID id, String portalName) throws IllegalArgumentException 68 { 69 return createPortalID(portalName); 70 } 71 72 75 public static ServerObjectID createInstanceID(String applicationName, String componentName, String instanceName) throws IllegalArgumentException 76 { 77 return new ServerObjectID(new String []{"instance", applicationName, componentName, instanceName}); 78 } 79 80 83 public static ServerObjectID createInstanceID(ServerObjectID id, String name) throws IllegalArgumentException 84 { 85 return createInstanceID((String )id.getName(1), (String )id.getName(2), name); 86 } 87 88 91 public static ServerObjectID createWindowID(String portalName, String windowName) throws IllegalArgumentException 92 { 93 return new ServerObjectID(new String []{"window", portalName, windowName}); 94 } 95 96 99 public static ServerObjectID createWindowID(ServerObjectID id, String name) throws IllegalArgumentException 100 { 101 return createWindowID((String )id.getName(1), name); 102 } 103 104 107 public static ServerObjectID createApplicationID(String applicationName) throws IllegalArgumentException 108 { 109 return new ServerObjectID(new String []{"application", applicationName}); 110 } 111 112 115 public static ServerObjectID createApplicationID(ServerObjectID id, String name) throws IllegalArgumentException 116 { 117 return createApplicationID(name); 118 } 119 120 123 public static ServerObjectID createComponentID(String applicationName, String componentName) throws IllegalArgumentException 124 { 125 return new ServerObjectID(new String []{"component", applicationName, componentName}); 126 } 127 128 131 public static ServerObjectID createComponentID(ServerObjectID id, String name) throws IllegalArgumentException 132 { 133 return createComponentID((String )id.getName(1), name); 134 } 135 } 136 | Popular Tags |