private Map findAttributes(Object args) { List list = InvokerHelper.asList(args); for (Object o : list) { if (o instanceof Map) { return (Map) o; } } return Collections.EMPTY_MAP; }
/** * Tokenize a CharSequence (with a whitespace as the delimiter). * * @param self a CharSequence * @return a List of tokens * @see java.util.StringTokenizer#StringTokenizer(String) * @since 1.8.2 */ @SuppressWarnings("unchecked") public static List<String> tokenize(CharSequence self) { return InvokerHelper.asList(new StringTokenizer(self.toString())); }
/** * Tokenize a CharSequence based on the given CharSequence. Each character in the CharSequence is a separate * delimiter. * * @param self a CharSequence * @param delimiters the delimiters * @return a List of tokens * @see java.util.StringTokenizer#StringTokenizer(String, String) * @since 1.8.2 */ @SuppressWarnings("unchecked") public static List<String> tokenize(CharSequence self, CharSequence delimiters) { return InvokerHelper.asList(new StringTokenizer(self.toString(), delimiters.toString())); }
protected List getRows() { Object value = rowsModel.getValue(); if (value == null) { return Collections.EMPTY_LIST; } return InvokerHelper.asList(value); }
protected Object doInvokeMethod(String methodName, Object name, Object args) { Object node = null; Closure closure = null; List list = InvokerHelper.asList(args);
protected Object dispatchNodeCall(Object name, Object args) { Object node; Closure closure = null; List list = InvokerHelper.asList(args);
@Override protected Object doInvokeMethod(String methodName, Object name, Object args) { if ("eval".equals(name)) { List list = InvokerHelper.asList(args); if (list.size() == 1 && list.get(0) instanceof Closure) { EvalElement element = (EvalElement)super.doInvokeMethod(methodName, name, null); element.closure = (Closure)list.get(0); return element; } else { return super.doInvokeMethod(methodName, name, args); } } else { return super.doInvokeMethod(methodName, name, args); } }
public static APIRemoveMonFromFusionstorBackupStorageMsg __example__() { APIRemoveMonFromFusionstorBackupStorageMsg msg = new APIRemoveMonFromFusionstorBackupStorageMsg(); msg.setUuid(uuid()); msg.setMonHostnames(asList("192.20.12.12")); return msg; }
public static APIRemoveMonFromFusionstorPrimaryStorageMsg __example__() { APIRemoveMonFromFusionstorPrimaryStorageMsg msg = new APIRemoveMonFromFusionstorPrimaryStorageMsg(); msg.setUuid(uuid()); msg.setMonHostnames(asList("192.168.0.100")); return msg; }
public static APIAddMonToFusionstorBackupStorageMsg __example__() { APIAddMonToFusionstorBackupStorageMsg msg = new APIAddMonToFusionstorBackupStorageMsg(); msg.setUuid(uuid()); msg.setMonUrls(asList("root:password@localhost:23")); return msg; }
public static APIRemovePolicyStatementsFromRoleMsg __example__() { APIRemovePolicyStatementsFromRoleMsg msg = new APIRemovePolicyStatementsFromRoleMsg(); msg.setUuid(uuid()); msg.setPolicyStatementUuids(asList(uuid())); return msg; } }
public static APIQueryVmCdRomReply __example__() { APIQueryVmCdRomReply reply = new APIQueryVmCdRomReply(); VmCdRomInventory inventory = new VmCdRomInventory(); inventory.setName("cd-1"); inventory.setUuid(uuid()); inventory.setDescription("desc"); inventory.setIsoUuid(uuid()); inventory.setDeviceId(0); inventory.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date)); inventory.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date)); reply.setInventories(asList(inventory)); return reply; } }
public static APIAddHostRouteToL3NetworkEvent __example__() { APIAddHostRouteToL3NetworkEvent event = new APIAddHostRouteToL3NetworkEvent(); L3NetworkInventory l3 = new L3NetworkInventory(); L3NetworkHostRouteInventory route = new L3NetworkHostRouteInventory(); route.setPrefix("169.254.169.254/32"); route.setPrefix("192.168.1.254"); l3.setName("Test-L3Network"); l3.setL2NetworkUuid(uuid()); l3.setDns(Arrays.asList("8.8.8.8")); l3.setHostRoute(asList(route)); event.setInventory(l3); return event; }
public static APIQueryEipReply __example__() { APIQueryEipReply reply = new APIQueryEipReply(); EipInventory eip = new EipInventory(); eip.setName("Test-EIP"); eip.setVipUuid(uuid()); eip.setVmNicUuid(uuid()); eip.setState(EipState.Enabled.toString()); reply.setInventories(asList(eip)); return reply; }
public static APIChangeRoleStateEvent __example__() { APIChangeRoleStateEvent event = new APIChangeRoleStateEvent(); RoleInventory role = new RoleInventory(); role.setName("role-1"); role.setStatements(asList("statement for test")); role.setDescription("role for test"); role.setUuid(uuid()); role.setState(RoleState.Enabled); role.setType(RoleType.Customized); event.setInventory(role); return event; } }
public static APICreateRoleEvent __example__() { APICreateRoleEvent event = new APICreateRoleEvent(); RoleInventory role = new RoleInventory(); role.setName("role-1"); role.setStatements(asList("statement for test")); role.setDescription("role for test"); role.setUuid(uuid()); role.setState(RoleState.Enabled); role.setType(RoleType.Customized); event.setInventory(role); return event; } }
public static APIUpdateRoleEvent __example__() { APIUpdateRoleEvent event = new APIUpdateRoleEvent(); RoleInventory role = new RoleInventory(); role.setName("role-1"); role.setStatements(asList("statement for test")); role.setDescription("role for test"); role.setUuid(uuid()); role.setState(RoleState.Enabled); role.setType(RoleType.Customized); event.setInventory(role); return event; } }
public static APIGetEipAttachableVmNicsReply __example__() { APIGetEipAttachableVmNicsReply reply = new APIGetEipAttachableVmNicsReply(); VmNicInventory nic = new VmNicInventory(); nic.setVmInstanceUuid(uuid()); nic.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date)); nic.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date)); nic.setDeviceId(0); nic.setGateway("192.168.1.1"); nic.setIp("192.168.1.10"); nic.setL3NetworkUuid(uuid()); nic.setNetmask("255.255.255.0"); nic.setMac("00:0c:29:bd:99:fc"); nic.setHypervisorType("KVM"); nic.setUsedIpUuid(uuid()); nic.setUuid(uuid()); reply.setInventories(asList(nic)); return reply; }
public static APIGetCandidateIsoForAttachingVmReply __example__() { APIGetCandidateIsoForAttachingVmReply reply = new APIGetCandidateIsoForAttachingVmReply(); ImageInventory inv = new ImageInventory(); inv.setUuid(uuid()); ImageBackupStorageRefInventory ref = new ImageBackupStorageRefInventory(); ref.setBackupStorageUuid(uuid()); ref.setImageUuid(inv.getUuid()); ref.setInstallPath("ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd"); ref.setStatus(ImageStatus.Ready.toString()); inv.setName("TinyLinux"); inv.setBackupStorageRefs(Collections.singletonList(ref)); inv.setUrl("http://192.168.1.20/share/images/tinylinux.qcow2"); inv.setFormat(ImageConstant.QCOW2_FORMAT_STRING); inv.setMediaType(ImageConstant.ImageMediaType.RootVolumeTemplate.toString()); inv.setPlatform(ImagePlatform.Linux.toString()); reply.setInventories(asList(inv)); return reply; }