List of usage examples for org.apache.commons.lang.builder ToStringStyle MULTI_LINE_STYLE
ToStringStyle MULTI_LINE_STYLE
To view the source code for org.apache.commons.lang.builder ToStringStyle MULTI_LINE_STYLE.
Click Source Link
From source file:com.gemini.provision.network.openstack.NetworkProviderOpenStackImpl.java
@Override public List<GeminiNetwork> getExternalGateways(GeminiTenant tenant, GeminiEnvironment env) { //authenticate the session with the OpenStack installation OSClient os = OSFactory.builder().endpoint(env.getEndPoint()) .credentials(env.getAdminUserName(), env.getAdminPassword()).tenantName(tenant.getName()) .authenticate();/* w w w .j av a2 s.c om*/ if (os == null) { Logger.error("Failed to authenticate Tenant: {}", ToStringBuilder.reflectionToString(tenant, ToStringStyle.MULTI_LINE_STYLE)); return null; } List<? extends Network> networks = os.networking().network().list(); List<GeminiNetwork> gateways = new ArrayList(); //map the list of network gateways and their subnets to gemini equivalents networks.stream().filter(osn -> osn.isRouterExternal()).forEach(osn -> { GeminiNetwork gn = null; try { gn = env.getOrphanNetworks().stream().filter(n -> n.getCloudID().equals(osn.getId())) //filter on the OpenStack network object cloud id .findFirst().get(); } catch (NoSuchElementException ex) { //not an error, just log the event. the network object will be created below Logger.debug("Gateway {} not mapped in Gemini models, creating one...", osn.getName()); } if (gn == null) { //the network has not created in gemini data model - create and it's subnets, etc GeminiNetwork newGn = new GeminiNetwork(); newGn.setName(osn.getName()); newGn.setCloudID(osn.getId()); if (osn.getNetworkType() != null) { newGn.setNetworkType(osn.getNetworkType().name()); } //add the subnets to the new network. List all subnets and filter by the parent network id List<? extends Subnet> osSubnets = os.networking().subnet().list(); osSubnets.stream().filter(osSubnet -> osSubnet != null) .filter(osSubnet -> osSubnet.getNetworkId().equals(osn.getId())).forEach(osSubnet -> { GeminiSubnet gs = new GeminiSubnet(); gs.setCloudID(osSubnet.getId()); gs.setParent(newGn); gs.setCidr(osSubnet.getCidr()); osSubnet.getAllocationPools().stream().forEach(ap -> { GeminiSubnetAllocationPool geminiAp = new GeminiSubnetAllocationPool( InetAddresses.forString(ap.getStart()), InetAddresses.forString(ap.getEnd())); geminiAp.setParent(gs); gs.addAllocationPool(geminiAp); }); gs.setParent(newGn); newGn.addSubnet(gs); }); gn = newGn; env.addGateway(newGn); } //TODO: When gn != null, do we need to check if subnet objects are correctly captured // in the Gemini data model gateways.add(gn); }); return gateways; }
From source file:com.jeefuse.system.param.model.GsysParameter.java
/** @generated */ @Override/*from w ww . j a va2 s. c o m*/ public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()) .append("value", value).append("descript", descript).toString(); }
From source file:com.jeefuse.system.security.model.GsysRelRoleFunction.java
/** @generated */ @Override/*from w ww . j a va 2 s . c om*/ public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) // .append("id",id).append("gsysRole",gsysRole).append("gsysFunction",gsysFunction) .toString(); }
From source file:com.jeefuse.system.security.model.GsysRelRoleResource.java
/** @generated */ @Override/*www . j a va 2 s .co m*/ public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) // .append("id",id).append("gsysRole",gsysRole).append("gsysResource",gsysResource) .toString(); }
From source file:com.gemini.domain.model.GeminiNetwork.java
public boolean deleteServer(GeminiServer s) { if (servers.contains(s)) { if (!servers.remove(s)) { Logger.error("Failed to delete server: {}", ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE)); return false; } else {/*from ww w.jav a 2 s.c om*/ //remove the connection between this network and the server //s.setNetwork(null); Logger.debug("Successfully deleted server: {}", ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE)); return true; } } else { Logger.info("Did not delete server, server does not exist in networkserver: {} network: {}", ToStringBuilder.reflectionToString(s, ToStringStyle.MULTI_LINE_STYLE), ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE)); return false; } }
From source file:com.change_vision.astah.extension.plugin.cplusreverse.reverser.DoxygenXmlParser.java
public static String parser(String path) throws LicenseNotFoundException, ProjectLockedException, IndexXmlNotFoundException, Throwable { long totalTime = System.currentTimeMillis(); ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor(); File indexFile;/*from www .j a v a 2s.c om*/ if ((indexFile = findFile(path, "index.xml")) == null) { throw new IndexXmlNotFoundException(); } // check template project String astahModelPath = getTempAstahModelPath(); InputStream stream = DoxygenXmlParser.class.getResourceAsStream("C++.asta"); prjAccessor.open(stream); logger.info("Importing... please wait.."); // get current jude project's root IModel project = ProjectAccessorFactory.getProjectAccessor().getProject(); DoxygenXmlParser doxygenXmlParser = new DoxygenXmlParser(); // begin transaction TransactionManager.beginTransaction(); // get the availability the concourse long thestart = System.currentTimeMillis(); CompoundDef[] compounddefes = null; { List<CompoundDef> theComs = doxygenXmlParser.parserIndexXml(indexFile); compounddefes = theComs.toArray(new CompoundDef[theComs.size()]); } logger.trace(String.format("xml parse:%d", System.currentTimeMillis() - thestart)); logger.trace(String.format("first deal namespace")); int length = compounddefes.length; for (int i = 0; i < length; ++i) { long start = System.currentTimeMillis(); // first deal namespace CompoundDef compounddef = compounddefes[i]; try { if (CompoundDef.KIND_NAMESPACE.equals(compounddef.getCompounddefKind()) || CompoundDef.KIND_INTERFACE.equals(compounddef.getCompounddefKind())) { // #205 #219 // (compounddef).convertToJudeModel(project, // indexFile.getParentFile().listFiles()); lastCompoundDef = compounddef; compounddef.convertToJudeModel(project, indexFile.getParentFile().listFiles()); // } } catch (Exception e) { logger.error(ToStringBuilder.reflectionToString(compounddef, ToStringStyle.MULTI_LINE_STYLE)); throw e; } logger.trace(String.format("%d", System.currentTimeMillis() - start)); } logger.trace(String.format("second deal all the compound")); for (int i = 0; i < length; ++i) { // second deal all the compound long start = System.currentTimeMillis(); CompoundDef compounddef = compounddefes[i]; lastCompoundDef = compounddef; try { compounddef.convertToJudeModel(project, indexFile.getParentFile().listFiles()); } catch (Exception e) { logger.error(ToStringBuilder.reflectionToString(compounddef, ToStringStyle.MULTI_LINE_STYLE)); throw e; } logger.trace(String.format("%d", System.currentTimeMillis() - start)); // } logger.trace(String.format("third convert all children")); for (int i = 0; i < length; ++i) { // third convert all children long start = System.currentTimeMillis(); CompoundDef compounddef = compounddefes[i]; lastCompoundDef = compounddef; try { compounddef.convertChildren(indexFile.getParentFile().listFiles()); } catch (Exception e) { logger.error(ToStringBuilder.reflectionToString(compounddef, ToStringStyle.MULTI_LINE_STYLE)); throw e; } logger.trace(String.format("%d", System.currentTimeMillis() - start)); // } CompoundDef.compounddef.clear(); // end transaction TransactionManager.endTransaction(); // save the project prjAccessor.saveAs(astahModelPath); prjAccessor.close(); logger.info("Import Done."); logger.debug(String.format("%d", System.currentTimeMillis() - totalTime)); return astahModelPath; }
From source file:com.likethecolor.alchemy.api.entity.AbstractAlchemyEntityTest.java
@Test public void testToString_Formatted() { final ToStringStyle style = ToStringStyle.MULTI_LINE_STYLE; final Double score = 12321.123131D; final AbstractAlchemyEntity entity = new MockAbstractAlchemyEntity(score); final String expectedString = new ToStringBuilder(entity, style).append("score", score).toString(); final String actualString = entity.toString(style); assertEquals(expectedString, actualString); }
From source file:com.gemini.provision.security.openstack.SecurityProviderOpenStackImpl.java
/** * * @param tenant/* ww w. j a v a 2s. c om*/ * @param env * @return * * List all the security groups. */ @Override public List<GeminiSecurityGroup> listAllSecurityGroups(GeminiTenant tenant, GeminiEnvironment env) { List<GeminiSecurityGroup> listSecGrps = Collections.synchronizedList(new ArrayList()); //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 the list from OpenStack List<? extends SecurityGroup> osSecGrps = os.networking().securitygroup().list(); osSecGrps.stream().forEach(osSecGrp -> { //see if this security group already exists in the environment GeminiSecurityGroup tmpSecGrp = null; GeminiSecurityGroup newGemSecGrp = null; try { tmpSecGrp = env.getSecurityGroups().stream().filter(s -> s.getName().equals(osSecGrp.getName())) .findFirst().get(); tmpSecGrp.setProvisioned(true); tmpSecGrp.setCloudID(osSecGrp.getId()); } catch (NoSuchElementException | NullPointerException ex) { //The OpenStack security group hasn't been mapped to an object on the Gemini side, so create it and add to the environment newGemSecGrp = new GeminiSecurityGroup(); newGemSecGrp.setCloudID(osSecGrp.getId()); newGemSecGrp.setProvisioned(true); newGemSecGrp.setName(osSecGrp.getName()); newGemSecGrp.setDescription(osSecGrp.getDescription()); env.addSecurityGroup(newGemSecGrp); } //check to see if this group's rules are mapped on the Gemini side List<? extends SecurityGroupRule> osSecGrpRules = osSecGrp.getRules(); final GeminiSecurityGroup gemSecGrp = tmpSecGrp == null ? newGemSecGrp : tmpSecGrp; osSecGrpRules.stream().filter(osSecGrpRule -> osSecGrpRule != null).forEach(osSecGrpRule -> { GeminiSecurityGroupRule gemSecGrpRule = null; try { gemSecGrpRule = gemSecGrp.getSecurityRules().stream() .filter(sr -> sr.getCloudID().equals(osSecGrpRule.getId())).findFirst().get(); } catch (NoSuchElementException | NullPointerException ex) { //not an error or even log worthy ... just signifies that the rule //on Gemini Side needs to be created } if (gemSecGrpRule == null) { //the rule has not been mapped on the Gemini side, so create it gemSecGrpRule = new GeminiSecurityGroupRule(); } gemSecGrpRule.setCloudID(osSecGrpRule.getId()); gemSecGrpRule.setProvisioned(true); gemSecGrpRule.setPortRangeMin(osSecGrpRule.getPortRangeMin()); gemSecGrpRule.setPortRangeMax(osSecGrpRule.getPortRangeMax()); gemSecGrpRule.setProtocol(Protocol.fromString(osSecGrpRule.getProtocol())); gemSecGrpRule.setDirection( GeminiSecurityGroupRuleDirection.valueOf(osSecGrpRule.getDirection().toUpperCase())); gemSecGrpRule.setRemoteGroupId(osSecGrpRule.getRemoteGroupId()); gemSecGrpRule.setRemoteIpPrefix(osSecGrpRule.getRemoteIpPrefix()); gemSecGrpRule.setIpAddressType(IPAddressType.valueOf(osSecGrpRule.getEtherType())); //gemSecGrpRule.setCidr(osSecGrpRule.getRange().getCidr()); gemSecGrpRule.setParent(gemSecGrp); gemSecGrp.addSecurityRule(gemSecGrpRule); }); listSecGrps.add(gemSecGrp); }); Logger.debug("Successfully retrieved all security groups Tenant: {} Env: {}", tenant.getName(), env.getName()); return listSecGrps; }
From source file:com.jeefuse.system.security.web.rto.GsysRelUserRoleRTO.java
/** @generated */ @Override/* w ww . j ava 2s . c o m*/ public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", id) .append("gsysRole", gsysRole).append("gsysUser", gsysUser).toString(); }
From source file:com.jeefuse.system.security.web.rto.GsysRelRoleFunctionRTO.java
/** @generated */ @Override/* w w w . j a v a 2 s. c om*/ public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", id) .append("gsysRole", gsysRole).append("gsysFunction", gsysFunction).toString(); }