public static <K> MultiProperties<K> create( Map<K, Map<String, List<String>>> map ) { MultiProperties<K> multiProperties = new MultiProperties<K>(); multiProperties.setProperties( map ); return multiProperties; }
public void addProtocolProperty( Protocol protocol, String property, List<String> values ) { protocolProperties.addProperty( protocol, property, values ); }
private Map<String, List<String>> getFormatProperties( Format format ) { Map<String, List<String>> result = new LinkedHashMap<String, List<String>>(); if( formatProperties.getValueFor( format ) != null ) result.putAll( formatProperties.getValueFor( format ) ); return result; }
private void findProtocolProperty( Map<Protocol, List<String>> values, String property ) { if( !isRoot() ) getParentSchema().findProtocolProperty( values, property ); for( ProviderDef providerDef : getProviderDefs() ) { MultiProperties<Protocol> providerProperties = MultiProperties.create( providerDef.getProtocolProperties() ); values.putAll( providerProperties.getKeyFor( property ) ); } values.putAll( protocolProperties.getKeyFor( property ) ); }
public Map<Format, List<Protocol>> getFormatProtocols() { Set<Protocol> defaultProtocols = getProviderDef().getProtocolProperties().keySet(); Map<Format, List<Protocol>> result = new HashMap<Format, List<Protocol>>(); MultiProperties<Format> formatProperties = getProperties(); for( Format format : formatProperties.getKeys() ) { Map<String, List<String>> properties = formatProperties.getValueFor( format ); List<Protocol> protocols = resolveProtocols( properties.get( "protocols" ) ); // if no protocols are specified, use those declared in the provider.properties if( protocols.isEmpty() ) result.put( format, new CopyOnWriteArrayList( defaultProtocols ) ); else result.put( format, protocols ); } return result; }
@Override public Collection<? extends Format> getFormats() { return getProperties().getKeys(); }
public void addFormatProperties( Format format, Map<String, List<String>> properties ) { formatProperties.putProperties( format, properties ); }
public Map<String, List<String>> removeProtocolProperties( Protocol protocol ) { return protocolProperties.removeRow( protocol ); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + ( stereotypes != null ? stereotypes.hashCode() : 0 ); result = 31 * result + ( childSchemas != null ? childSchemas.hashCode() : 0 ); result = 31 * result + ( childTables != null ? childTables.hashCode() : 0 ); result = 31 * result + ( protocolProperties != null ? protocolProperties.hashCode() : 0 ); result = 31 * result + ( formatProperties != null ? formatProperties.hashCode() : 0 ); return result; } }
@Override public boolean equals( Object object ) { if( this == object ) return true; if( !( object instanceof SchemaDef ) ) return false; if( !super.equals( object ) ) return false; SchemaDef schemaDef = (SchemaDef) object; if( childSchemas != null ? !childSchemas.equals( schemaDef.childSchemas ) : schemaDef.childSchemas != null ) return false; if( childTables != null ? !childTables.equals( schemaDef.childTables ) : schemaDef.childTables != null ) return false; if( formatProperties != null ? !formatProperties.equals( schemaDef.formatProperties ) : schemaDef.formatProperties != null ) return false; if( protocolProperties != null ? !protocolProperties.equals( schemaDef.protocolProperties ) : schemaDef.protocolProperties != null ) return false; if( stereotypes != null ? !stereotypes.equals( schemaDef.stereotypes ) : schemaDef.stereotypes != null ) return false; return true; }
private void findFormatProperty( Map<Format, List<String>> values, String property ) { if( !isRoot() ) getParentSchema().findFormatProperty( values, property ); for( ProviderDef providerDef : getProviderDefs() ) { MultiProperties<Format> providerProperties = MultiProperties.create( providerDef.getFormatProperties() ); values.putAll( providerProperties.getKeyFor( property ) ); } values.putAll( formatProperties.getKeyFor( property ) ); }
@Override public Collection<? extends Protocol> getProtocols() { return getProperties().getKeys(); }
public void addProtocolProperties( Protocol protocol, Map<String, List<String>> properties ) { protocolProperties.putProperties( protocol, properties ); }
public Map<String, List<String>> removeFormatProperties( Format format ) { return formatProperties.removeRow( format ); }
public void addFormatProperty( Format format, String property, String... values ) { formatProperties.addProperty( format, property, values ); }
private Map<String, List<String>> getProtocolProperties( Protocol protocol ) { Map<String, List<String>> result = new LinkedHashMap<String, List<String>>(); if( protocolProperties.getValueFor( protocol ) != null ) result.putAll( protocolProperties.getValueFor( protocol ) ); return result; }
public Collection<Format> getSchemaDefinedFormats() { Set<Format> formats = new HashSet<Format>(); for( ProviderDef providerDef : providers.values() ) formats.addAll( providerDef.getFormatProperties().keySet() ); formats.addAll( formatProperties.getKeys() ); return formats; }
protected LingualProtocolHandler( ProviderDef providerDef ) { this.providerDef = providerDef; Map<Protocol, Map<String, List<String>>> protocols = providerDef.getProtocolProperties(); for( Protocol protocol : protocols.keySet() ) getProperties().putProperties( protocol, protocols.get( protocol ) ); }
public void addFormatProperty( Format format, String property, List<String> values ) { formatProperties.addProperty( format, property, values ); }
@Override public Map<String, List<String>> getDefaultProperties( Format format ) { return getProperties().getValueFor( format ); } }