List of usage examples for org.apache.commons.lang.builder ToStringBuilder reflectionToString
public static String reflectionToString(Object object, ToStringStyle style)
Forwards to ReflectionToStringBuilder
.
From source file:com.travelport.schema.common_v12_0.BookingTraveler.java
/** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * /*from w w w.j a va2s. c om*/ */ @Override @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T12:56:12-04:00", comments = "JAXB RI v2.2.7") public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); }
From source file:com.gemini.provision.network.openstack.NetworkProviderOpenStackImpl.java
@Override public ProvisioningProviderResponseType createSubnet(GeminiTenant tenant, GeminiEnvironment env, GeminiNetwork parent, GeminiSubnet newSubnet) { //authenticate the session with the OpenStack installation OSClient os = OSFactory.builder().endpoint(env.getEndPoint()) .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName()) .authenticate();//from w w w .j a v a 2s.c om if (os == null) { Logger.error("Failed to authenticate Tenant: {}", ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE)); return null; } //check to see if the parenet network exists Network osParent; try { osParent = os.networking().network().list().stream() .filter(osn -> osn.getName().equals(parent.getName())).findFirst().get(); parent.setCloudID(osParent.getId()); //just in case... } catch (NoSuchElementException ex) { Logger.error( "Failed to create subnet - parent network does not exist. Tenant: {} Environment: {} network: {} subnet: {}", tenant.getName(), env.getName(), parent.getName(), newSubnet.getName()); return ProvisioningProviderResponseType.CLOUD_NO_PARENT; } //check to see if this subnet exists if (os.networking().subnet().list().stream().anyMatch(n -> n.getName().equals(newSubnet.getName()))) { Logger.error( "Failed to create subnet - already exists. Tenant: {} Environment: {} network: {} subnet: {}", tenant.getName(), env.getName(), parent.getName(), newSubnet.getName()); return ProvisioningProviderResponseType.OBJECT_EXISTS; } //create the subnet Subnet subnet; try { subnet = os.networking().subnet().create(Builders.subnet().tenantId(tenant.getTenantID()) .gateway(InetAddresses.toAddrString(newSubnet.getGateway())) .enableDHCP(newSubnet.isEnableDHCP()) .ipVersion( newSubnet.getNetworkType() == IPAddressType.IPv6 ? IPVersionType.V6 : IPVersionType.V4) .name(newSubnet.getName()).networkId(parent.getCloudID()).cidr(newSubnet.getCidr()).build()); } catch (ClientResponseException ex) { Logger.error( "Cloud exception: failed to create subnet. status code {} tenant: {} env: {} parent network: {} subnet {} ", ex.getStatusCode(), tenant.getName(), env.getName(), parent.getName(), newSubnet.getName()); return ProvisioningProviderResponseType.CLOUD_EXCEPTION; } //add the list of subnets (this will be an update the subnet just created) List<GeminiSubnetAllocationPool> pools = newSubnet.getAllocationPools(); pools.stream().forEach(p -> { if (os.networking().subnet().update(subnet.toBuilder() .addPool(p.getStart().getHostAddress(), p.getEnd().getHostAddress()).build()) == null) { Logger.error( "Failed to create subnet allocation pool, Tenant: {} Environment: {} Parent Network: {} Subnet: {} Allocation Pool {} {}", tenant.getName(), env.getName(), parent.getName(), newSubnet.getName(), p.getStart().getHostAddress(), p.getEnd().getHostAddress()); } }); //copy the id to the domain object newSubnet.setCloudID(subnet.getId()); Logger.debug("Successfully added network - tenant: {} env: {} parent network: {} subnet {} ", tenant.getName(), env.getName(), parent.getName(), newSubnet.getName()); return ProvisioningProviderResponseType.SUCCESS; }
From source file:com.gemini.provision.security.openstack.SecurityProviderOpenStackImpl.java
@Override public ProvisioningProviderResponseType deleteSecurityGroup(GeminiTenant tenant, GeminiEnvironment env, GeminiSecurityGroup securityGroup) { //authenticate the session with the OpenStack installation OSClient os = OSFactory.builder().endpoint(env.getEndPoint()) .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName()) .authenticate();// w ww.java 2 s. com if (os == null) { Logger.error("Failed to authenticate Tenant: {}", ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE)); return ProvisioningProviderResponseType.CLOUD_AUTH_FAILURE; } SecurityGroup osSecGrp; try { osSecGrp = os.networking().securitygroup().get(securityGroup.getCloudID()); } catch (NullPointerException | ClientResponseException ex) { Logger.error( "Could not retrieve security group information in OpenStack. tenant: {} env: {} security group: {}", tenant.getName(), env.getName(), securityGroup.getName()); return ProvisioningProviderResponseType.CLOUD_EXCEPTION; } if (osSecGrp == null) { Logger.error("Security Group does not exist: tenant: {} env: {} security group: {}", tenant.getName(), env.getName(), securityGroup.getName()); return ProvisioningProviderResponseType.OBJECT_NOT_FOUND; } //looks like there no way to update a security group, we have to delete and re-create ActionResponse a = os.networking().securitygroup().delete(osSecGrp.getId()); if (!a.isSuccess()) { Logger.error( "Security Group update - could not delete the security group: tenant: {} env: {} security group: {} Error Message: {}", tenant.getName(), env.getName(), securityGroup.getName(), a.getFault()); return ProvisioningProviderResponseType.CLOUD_FAILURE; } //remove this security group from the environment env.deleteSecurityGroup(securityGroup); //now remove the deleted security group's name from the servers that use the deleted security group // env.getApplications() // .stream() // .map(GeminiApplication::getNetworks) // .flatMap(List::stream) // .map(GeminiNetwork::getSubnets) // .flatMap(List::stream) // .map(GeminiSubnet::getAllocationPools) // .flatMap(List::stream) // .map(GeminiSubnetAllocationPool::getServers) // .flatMap(List::stream) // .forEach(s -> s.deleteSecGroupName(securityGroup.getName())); Logger.debug("Successfully deleted security group Tenant: {} Env: {} security group {}", tenant.getName(), env.getName(), securityGroup.getName()); return ProvisioningProviderResponseType.SUCCESS; }
From source file:com.travelport.schema.common_v27_0.BookingTraveler.java
/** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * /* w ww . j av a 2s .c o m*/ */ @Override @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-06-21T04:08:14-04:00", comments = "JAXB RI v2.2.7") public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); }
From source file:com.travelport.schema.common_v32_0.BookingTraveler.java
/** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * //from w w w.j av a 2 s. c o m */ @Override @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-03-02T04:28:25-07:00", comment = "JAXB RI v2.2.11") public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); }
From source file:com.travelport.schema.common_v35_0.BookingTraveler.java
/** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * /*from w ww .j a v a2s .c o m*/ */ @Override @Generated(value = "com.sun.tools.xjc.Driver", date = "2016-05-15T12:41:43-06:00", comment = "JAXB RI v2.2.11") public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); }
From source file:com.jaxio.celerio.model.Attribute.java
@Override public String toString() { return getName() + " " + ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); }
From source file:com.gemini.provision.network.openstack.NetworkProviderOpenStackImpl.java
@Override public ProvisioningProviderResponseType updateSubnet(GeminiTenant tenant, GeminiEnvironment env, GeminiSubnet subnet) {/*w w w .jav a 2s . c o m*/ //authenticate the session with the OpenStack installation OSClient os = OSFactory.builder().endpoint(env.getEndPoint()) .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName()) .authenticate(); if (os == null) { Logger.error("Failed to authenticate Tenant: {}", ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE)); return null; } // Get a subnet by ID Subnet s = os.networking().subnet().get(subnet.getCloudID()); if (s == null) { Logger.error("Failed to update subnet - doesn't exist. Tenant: {} Environment: {} Sbunet: {}", tenant.getName(), env.getName(), ToStringBuilder.reflectionToString(subnet, ToStringStyle.MULTI_LINE_STYLE)); return ProvisioningProviderResponseType.OBJECT_NOT_FOUND; } //update the subnet Subnet updatedSubnet; try { updatedSubnet = os.networking().subnet().update(s.toBuilder().tenantId(tenant.getTenantID()) .cidr(subnet.getCidr()).name(subnet.getName()) .gateway(InetAddresses.toAddrString(subnet.getGateway())) .networkId(subnet.getParent().getCloudID()).enableDHCP(subnet.isEnableDHCP()) .ipVersion(subnet.getNetworkType() == IPAddressType.IPv6 ? IPVersionType.V6 : IPVersionType.V4) .build()); } catch (ClientResponseException ex) { Logger.error("Cloud exception: status code {}", ex.getStatusCode()); return ProvisioningProviderResponseType.CLOUD_EXCEPTION; } //TODO: Need to get detailed error codes for the call above. Research the StatusCode class if (updatedSubnet == null) { Logger.error( "Failed to update subnet, Cloud provider failure. Tenant: {} Environment: {} Parent Network: {} Subnet: {} ", tenant.getName(), env.getName(), subnet.getParent().getName(), subnet.getName()); return ProvisioningProviderResponseType.CLOUD_FAILURE; } //add the list of subnets (this will be an update the subnet just created) List<GeminiSubnetAllocationPool> pools = subnet.getAllocationPools(); pools.stream().forEach(p -> { if (os.networking().subnet().update(updatedSubnet.toBuilder() .addPool(p.getStart().getHostAddress(), p.getEnd().getHostAddress()).build()) == null) { Logger.error( "Failed to create subnet allocation pool, Tenant: {} Environment: {} Parent Network: {} Subnet: {} Allocation Pool {} {}", tenant.getName(), env.getName(), subnet.getParent().getName(), subnet.getName(), p.getStart().getHostAddress(), p.getEnd().getHostAddress()); } }); Logger.debug("Successfully updated the subnet. Tenant: {} Environment: {} Parent Network: {} Subnet: {}", tenant.getName(), env.getName(), subnet.getParent().getName(), subnet.getName()); return ProvisioningProviderResponseType.SUCCESS; }
From source file:com.gemini.provision.security.openstack.SecurityProviderOpenStackImpl.java
/** * Get the security group rule details based on the cloud id provided in the * securityRule object./*from ww w . ja v a 2 s. c om*/ * * @param tenant * @param env * @param securityGroup - the parent security group * @param securityRule - the rule whose information needs to be retrieved, * the cloud ID must be provided. * @return SUCCESS - if all goes well AUTH_FAILURE - if the authentication * failed with the information in the tenant object EXCEPTION - if the cloud * raised an exception OBJECT_NOT_FOUND - if the rule with ID provided is * not found */ @Override public ProvisioningProviderResponseType getSecurityGroupRule(GeminiTenant tenant, GeminiEnvironment env, GeminiSecurityGroup securityGroup, GeminiSecurityGroupRule securityRule) { //authenticate the session with the OpenStack installation OSClient os = OSFactory.builder().endpoint(env.getEndPoint()) .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName()) .authenticate(); if (os == null) { Logger.error("Failed to authenticate Tenant: {}", ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE)); return ProvisioningProviderResponseType.CLOUD_AUTH_FAILURE; } SecurityGroupRule osSecGrpRule; try { osSecGrpRule = os.networking().securityrule().get(securityRule.getCloudID()); } catch (NullPointerException | ClientResponseException ex) { Logger.error( "Cloud Exception: Could not retrieve security group rule information in OpenStack. tenant: {} env: {} security group: {} security rule ID: {}", tenant.getName(), env.getName(), securityGroup.getName(), securityRule.getCloudID()); return ProvisioningProviderResponseType.CLOUD_EXCEPTION; } if (osSecGrpRule == null) { Logger.error( "Security rule not found: Could not find security group rule information in OpenStack. tenant: {} env: {} security group: {} security rule ID: {}", tenant.getName(), env.getName(), securityGroup.getName(), securityRule.getCloudID()); return ProvisioningProviderResponseType.OBJECT_NOT_FOUND; } //now copy the information into the gemini security rule object securityRule.setProvisioned(true); securityRule .setDirection(GeminiSecurityGroupRuleDirection.valueOf(osSecGrpRule.getDirection().toUpperCase())); securityRule.setIpAddressType(IPAddressType.valueOf(osSecGrpRule.getEtherType())); securityRule.setParent(securityGroup); securityRule.setPortRangeMin(osSecGrpRule.getPortRangeMin()); securityRule.setPortRangeMax(osSecGrpRule.getPortRangeMax()); securityRule.setProtocol(Protocol.valueOf(osSecGrpRule.getProtocol())); securityRule.setRemoteGroupId(osSecGrpRule.getRemoteGroupId()); securityRule.setRemoteIpPrefix(osSecGrpRule.getRemoteIpPrefix()); Logger.debug( "Successfully retrieved security groups rule Tenant: {} Env: {} security group {} security rule {}", tenant.getName(), env.getName(), securityGroup.getName(), securityRule.getName()); return ProvisioningProviderResponseType.SUCCESS; }
From source file:com.ah.be.admin.restoredb.AhRestoreDBImpl.java
public static void getVhmEmails() { // only needed for HMOL and single VHM move/upgrade, fix bug 32249 /*/* www.j a va2 s .c o m*/ * before restore user customization settings, check if need to retrieve VHM user emails from Portal * customization settings include data in below 4 tables: * hm_table_column_new * hm_table_size_new * hm_autorefresh_settings_new * hm_user_settings */ // get VHM BO HmDomain domain = AhRestoreNewMapTools.getHmDomainMap().isEmpty() ? null : (AhRestoreNewMapTools.getHmDomainMap().values()).iterator().next(); if (domain != null) { String vhmId = domain.getVhmID(); VHMCustomerInfo vhminfo = getVhmInfos(vhmId); AhRestoreDBTools.logRestoreMsg("Retrieve VHM (" + vhmId + ") info from Portal " + (vhminfo == null ? "failed." : "suceed.") + " (first time retrieval)"); // 3 times retry for (int i = 0; vhminfo == null && i < 3; i++) { vhminfo = getVhmInfos(vhmId); AhRestoreDBTools.logRestoreMsg("Retrieve VHM (" + vhmId + ") info from Portal " + (vhminfo == null ? "failed." : "suceed.") + "(retry retrieval, times:" + (i + 1) + ")"); } AhRestoreDBTools.logRestoreMsg( "VHM info : " + ToStringBuilder.reflectionToString(vhminfo, ToStringStyle.MULTI_LINE_STYLE)); if (vhminfo != null) { // if VHM got CID, use user get from Portal as filter if (!StringUtils.isEmpty(vhminfo.getCustomerId())) { // clear user email AhRestoreNewMapTools.clearVhmEmails(); AhRestoreNewMapTools.addVhmEmails(vhminfo.getPrimaryUsers()); AhRestoreNewMapTools.addVhmEmails(vhminfo.getNonPrimaryUsers()); } else { // got no CID, use email list saved when restore hm_user on HMOL } } else { // make sure restore all customization settings, clear email list saved when restore hm_user AhRestoreNewMapTools.clearVhmEmails(); AhRestoreDBTools.logRestoreErrorMsg("Retrieve VHM (" + vhmId + ") info from Portal failed after 3 times retry. Restore all customization settings from source HMOL."); } } else { // make sure restore all customization settings, clear email list saved when restore hm_user AhRestoreNewMapTools.clearVhmEmails(); AhRestoreDBTools.logRestoreErrorMsg( "Cannot start Retrieving VHM info from Portal due to get VHM record from HMOL DB failed. Restore all customization settings from source HMOL."); } }