private void addExpandedAccess(InvAccessImpl a) { InvService service = a.getService(); if (null == service) { a.check(log, false); // illegal; get error message return; } if (service.getServiceType() == ServiceType.COMPOUND) { // if its a compound service, expand it for (InvService nestedService : service.getServices()) { InvAccessImpl nestedAccess = new InvAccessImpl(this, a.getUrlPath(), nestedService); addExpandedAccess(nestedAccess); // i guess it could recurse } } else { access.add(a); } }
private Element writeAccess(InvAccessImpl access) { Element accessElem = new Element("access", defNS); accessElem.setAttribute("urlPath", access.getUrlPath()); if (access.getServiceName() != null) accessElem.setAttribute("serviceName", access.getServiceName()); if (access.getDataFormatType() != null) accessElem.setAttribute("dataFormat", access.getDataFormatType().toString()); if (access.hasDataSize()) accessElem.addContent(writeDataSize(access.getDataSize())); return accessElem; }
boolean check(StringBuilder out, boolean show) { boolean isValid = true; if (log.length() > 0) { isValid = false; out.append( log); } if (getService() == null) { out.append("**InvAccess in (").append(dataset.getFullName()).append("): with urlPath= (").append(urlPath).append(") has no valid service\n"); isValid = false; } else if (getStandardUrlName() == null) { out.append("**InvAccess in (").append(dataset.getFullName()).append("): with urlPath= (").append(urlPath).append(") has invalid URL\n"); isValid = false; } if (show) System.out.println(" access "+urlPath+" valid = "+isValid); return isValid; }
/** Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (urlPath != null) result = 37*result + urlPath.hashCode(); if (service != null) result = 37*result + service.hashCode(); if (hasDataSize()) result = 37*result + (int) getDataSize(); hashCode = result; } return hashCode; } private volatile int hashCode = 0; // Bloch, item 8
InvAccessImpl a = new InvAccessImpl(this, urlPath, getServiceDefault()); a.setSize(size); a.finish(); addExpandedAccess(a); while (iter.hasNext()) { InvAccessImpl a = (InvAccessImpl) iter.next(); a.finish(); addExpandedAccess(a);
public static InvAccess copyAccess( InvAccess access, InvDataset parentDataset, List<InvService> availableServices ) { if ( parentDataset == null ) throw new IllegalArgumentException( "Parent dataset may not be null."); String serviceName = access.getService().getName(); InvService service = findServiceByName( serviceName, availableServices); if ( service == null ) { logger.warn( "Access service [" + serviceName + "] not in available service list."); return null; // ToDo Support copying service. //service = copyService( access.getService() ); } DataFormatType dataFormatType = access.getDataFormatType(); InvAccessImpl resultAccess = null; if ( dataFormatType == null ) { resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service ); resultAccess.setSize( access.getDataSize() ); } else resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service.getName(), null, dataFormatType.toString(), access.getDataSize() ); return resultAccess; }
protected InvAccessImpl readAccess(InvDatasetImpl dataset, Element accessElem) { String urlPath = accessElem.getAttributeValue("urlPath"); String serviceName = accessElem.getAttributeValue("serviceName"); String dataFormat = accessElem.getAttributeValue("dataFormat"); return new InvAccessImpl(dataset, urlPath, serviceName, null, dataFormat, readDataSize(accessElem)); }
isValid &= a.check(out, show);
InvAccessImpl a = new InvAccessImpl(this, urlPath, getServiceDefault()); a.setSize(size); a.finish(); addExpandedAccess(a); while (iter.hasNext()) { InvAccessImpl a = (InvAccessImpl) iter.next(); a.finish(); addExpandedAccess(a);
public static InvAccess copyAccess( InvAccess access, InvDataset parentDataset, List<InvService> availableServices ) { if ( parentDataset == null ) throw new IllegalArgumentException( "Parent dataset may not be null."); String serviceName = access.getService().getName(); InvService service = findServiceByName( serviceName, availableServices); if ( service == null ) { logger.warn( "Access service [" + serviceName + "] not in available service list."); return null; // ToDo Support copying service. //service = copyService( access.getService() ); } DataFormatType dataFormatType = access.getDataFormatType(); InvAccessImpl resultAccess; if ( dataFormatType == null ) { resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service ); resultAccess.setSize( access.getDataSize() ); } else resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service.getName(), null, dataFormatType.toString(), access.getDataSize() ); return resultAccess; }
protected InvAccessImpl readAccess( InvDatasetImpl dataset, Element accessElem) { String urlPath = accessElem.getAttributeValue("urlPath"); String serviceName = accessElem.getAttributeValue("serviceName"); String dataFormat = accessElem.getAttributeValue("dataFormat"); return new InvAccessImpl( dataset, urlPath, serviceName, null, dataFormat, readDataSize( accessElem)); }
/** Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (urlPath != null) result = 37*result + urlPath.hashCode(); if (service != null) result = 37*result + service.hashCode(); if (hasDataSize()) result = 37*result + (int) getDataSize(); hashCode = result; } return hashCode; } private volatile int hashCode = 0; // Bloch, item 8
isValid &= a.check(out, show);
private Element writeAccess( InvAccessImpl access) { Element accessElem = new Element("access", defNS); accessElem.setAttribute("urlPath", access.getUrlPath()); if (access.getServiceName() != null) accessElem.setAttribute("serviceName", access.getServiceName()); if (access.getDataFormatType() != null) accessElem.setAttribute("dataFormat", access.getDataFormatType().toString()); if (access.hasDataSize()) accessElem.addContent( writeDataSize( access.getDataSize())); return accessElem; }
private void addExpandedAccess(InvAccessImpl a) { InvService service = a.getService(); if (null == service) { a.check(log, false); // illegal; get error message return; } if (service.getServiceType() == ServiceType.COMPOUND) { // if its a compound service, expand it for (InvService nestedService : service.getServices()) { InvAccessImpl nestedAccess = new InvAccessImpl(this, a.getUrlPath(), nestedService); addExpandedAccess(nestedAccess); // i guess it could recurse } } else { access.add(a); } }
InvAccessImpl a = new InvAccessImpl(this, urlPath, getServiceDefault()); a.setSize(size); a.finish(); addExpandedAccess(a); while (iter.hasNext()) { InvAccessImpl a = (InvAccessImpl) iter.next(); a.finish(); addExpandedAccess(a);
public static InvAccess copyAccess( InvAccess access, InvDataset parentDataset, List<InvService> availableServices ) { if ( parentDataset == null ) throw new IllegalArgumentException( "Parent dataset may not be null."); String serviceName = access.getService().getName(); InvService service = findServiceByName( serviceName, availableServices); if ( service == null ) { logger.warn( "Access service [" + serviceName + "] not in available service list."); return null; // ToDo Support copying service. //service = copyService( access.getService() ); } DataFormatType dataFormatType = access.getDataFormatType(); InvAccessImpl resultAccess; if ( dataFormatType == null ) { resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service ); resultAccess.setSize( access.getDataSize() ); } else resultAccess = new InvAccessImpl( parentDataset, access.getUrlPath(), service.getName(), null, dataFormatType.toString(), access.getDataSize() ); return resultAccess; }
protected InvAccessImpl readAccess(InvDatasetImpl dataset, Element accessElem) { String urlPath = accessElem.getAttributeValue("urlPath"); String serviceName = accessElem.getAttributeValue("serviceName"); String dataFormat = accessElem.getAttributeValue("dataFormat"); return new InvAccessImpl(dataset, urlPath, serviceName, null, dataFormat, readDataSize(accessElem)); }
/** Override Object.hashCode() to implement equals. */ public int hashCode() { if (hashCode == 0) { int result = 17; if (urlPath != null) result = 37*result + urlPath.hashCode(); if (service != null) result = 37*result + service.hashCode(); if (hasDataSize()) result = 37*result + (int) getDataSize(); hashCode = result; } return hashCode; } private volatile int hashCode = 0; // Bloch, item 8
boolean check(StringBuilder out, boolean show) { boolean isValid = true; if (log.length() > 0) { isValid = false; out.append( log); } if (getService() == null) { out.append("**InvAccess in (").append(dataset.getFullName()).append("): with urlPath= (").append(urlPath).append(") has no valid service\n"); isValid = false; } else if (getStandardUrlName() == null) { out.append("**InvAccess in (").append(dataset.getFullName()).append("): with urlPath= (").append(urlPath).append(") has invalid URL\n"); isValid = false; } if (show) System.out.println(" access "+urlPath+" valid = "+isValid); return isValid; }