@Override public String toString() { String s = "{version=" + getVersion() + ","; s += "acceptVersions={" + ArrayUtils.join( ",", acceptVersions ) + "},"; s += "sections={" + ArrayUtils.join( ",", sections ) + "},"; s += "acceptFormats={" + ArrayUtils.join( ",", acceptFormats ) + "},"; s += "updateSequence={" + updateSequence + "},"; s += "acceptLanguages={" + ArrayUtils.join( ",", acceptLanguages ) + "}"; s += "}"; return s; } }
/** * Joins a list of objects with given delimiter. * * @param delimiter * the delimiter to put between every string. * @param objects * @return the joined string */ public static String join( String delimiter, Object... objects ) { // call join method for list // Arrays.asList is cheap and only creates a wrapper return join( delimiter, Arrays.asList( objects ) ); }
/** * Joins a list of strings with given delimiter. * * @param delimiter * the delimiter to put between every string. * @param strings * @return the joined string */ public static String join( String delimiter, String... strings ) { // call join method for list // Arrays.asList is cheap and only creates a wrapper return join( delimiter, Arrays.asList( strings ) ); }
private static void exportGMLPos( XMLStreamWriter writer, double... values ) throws XMLStreamException { writer.writeStartElement( GML_NS, "pos" ); writer.writeNamespace( GML_PREFIX, GML_NS ); writer.writeAttribute( "dimension", Integer.toString( values.length ) ); writer.writeCharacters( ArrayUtils.join( " ", values ) ); writer.writeEndElement(); // pos }
/** * Return a String with all element names of the given enum class. * * @param enumClass * @param map * the operator type -> element name map * @return a coma separated list of element names */ private static String elemNames( Class<? extends Enum<?>> enumClass, Map<? extends Enum<?>, QName> map ) { List<String> names = new LinkedList<String>(); for ( Enum<?> e : enumClass.getEnumConstants() ) { QName qname = map.get( e ); if ( qname != null ) { LOG.debug( qname.toString() ); names.add( qname.toString() ); } } return ArrayUtils.join( ", ", names ); } }
/** * Return a String with all element names of the given enum class. * * @param enumClass * @param map * the operator type -> element name map * @return a coma separated list of element names */ private static String elemNames( Class<? extends Enum<?>> enumClass, Map<? extends Enum<?>, QName> map ) { List<String> names = new LinkedList<String>(); for ( Enum<?> e : enumClass.getEnumConstants() ) { QName qname = map.get( e ); if ( qname == null ) { LOG.warn( "No value for " + e ); } else { names.add( qname.toString() ); } } return ArrayUtils.join( ", ", names ); } }
/** * Return a String with all element names of the given enum class. * * @param enumClass * @param map * the operator type -> element name map * @return a coma separated list of element names */ private static String elemNames( Class<? extends Enum<?>> enumClass, Map<? extends Enum<?>, QName> map ) { List<String> names = new LinkedList<String>(); for ( Enum<?> e : enumClass.getEnumConstants() ) { QName qname = map.get( e ); if ( qname != null ) { LOG.debug( qname.toString() ); names.add( qname.toString() ); } } return ArrayUtils.join( ", ", names ); } }
public static void requireStartElement( XMLStreamReader xmlStream, Collection<QName> expectedElements ) throws XMLParsingException { if ( xmlStream.getEventType() != START_ELEMENT ) { String msg = "Found a '" + getEventTypeString( xmlStream.getEventType() ) + "' event, but one of the following elements is required at this position: '" + ArrayUtils.join( ",", expectedElements ) + "'."; throw new XMLParsingException( xmlStream, msg ); } if ( !expectedElements.contains( xmlStream.getName() ) ) { String msg = "Found a '" + xmlStream.getName() + "' element, but one of the following elements is required at this position: '" + ArrayUtils.join( ",", expectedElements ) + "'."; throw new XMLParsingException( xmlStream, msg ); } }
private static MatchAction parseMatchAction( XMLStreamReader xmlStream, String matchAction ) { if ( "All".equals( matchAction ) ) return ALL; if ( "Any".equals( matchAction ) ) return MatchAction.ANY; if ( "One".equals( matchAction ) ) return MatchAction.ONE; String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_VALUE", matchAction, ArrayUtils.join( ",", "All", "Any", "None" ) ); throw new XMLParsingException( xmlStream, msg ); }
/** * @param <T> * @param worker * @param url * @param map * @return some object from the url, null, if url is not valid * @throws IOException * @throws MalformedURLException */ public static <T> T retrieve( Worker<T> worker, String url, Map<String, String> map ) throws MalformedURLException, IOException { if ( !url.endsWith( "?" ) && !url.endsWith( "&" ) ) { url += url.indexOf( "?" ) == -1 ? "?" : "&"; } LinkedList<String> list = new LinkedList<String>(); for ( Entry<String, String> e : map.entrySet() ) { list.add( encode( e.getKey(), "UTF-8" ) + "=" + encode( e.getValue(), "UTF-8" ) ); } url += join( "&", list ); return retrieve( worker, url ); }
+ ".fonts (family, style, bold, size) values (?, ?, ?, ?) returning id" ); stmt.setString( 1, join( ",", font.fontFamily ) ); stmt.setString( 2, font.fontStyle.toString() ); stmt.setBoolean( 3, font.bold );
stmt.setString( 5, join( " ", stroke.dasharray ) ); } else { stmt.setNull( 5, VARCHAR );
@Override protected List<String> getBLOBCreates() { List<String> ddl = new ArrayList<String>(); // create feature_type table TableName ftTable = schema.getBBoxMapping().getTable(); ddl.add( "CREATE TABLE " + ftTable + " (id integer PRIMARY KEY, qname text NOT NULL, bbox GEOMETRY)" ); // populate feature_type table for ( short ftId = 0; ftId < schema.getFts(); ftId++ ) { QName ftName = schema.getFtName( ftId ); ddl.add( "INSERT INTO " + ftTable + " (id,qname) VALUES (" + ftId + ",'" + ftName + "')" ); } // create gml_objects table TableName blobTable = schema.getBlobMapping().getTable(); ddl.add( "CREATE TABLE " + blobTable + " (id integer IDENTITY(1,1) PRIMARY KEY, " + "gml_id varchar(2000) NOT NULL, ft_type integer REFERENCES " + ftTable + " , binary_object varbinary(max), gml_bounded_by GEOMETRY)" ); ddl.add( "ALTER TABLE " + blobTable + " ADD CONSTRAINT gml_objects_geochk CHECK (gml_bounded_by.STIsValid() = 1)" ); double[] dom = schema.getBlobMapping().getCRS().getValidDomain(); ddl.add( "CREATE SPATIAL INDEX gml_objects_sidx ON " + blobTable + "(gml_bounded_by) WITH ( BOUNDING_BOX = ( " + ArrayUtils.join( ",", dom ) + " ) )" ); // ddl.add( "CREATE INDEX gml_objects_sidx ON " + blobTable + " USING GIST (gml_bounded_by GIST_GEOMETRY_OPS)" // ); // ddl.add( "CREATE TABLE gml_names (gml_object_id integer REFERENCES gml_objects," // + "name text NOT NULL,codespace text,prop_idx smallint NOT NULL)" ); return ddl; }
map.put( "version", wmsVersion.toString() ); map.put( "service", "WMS" ); map.put( "layers", join( ",", getMap.getLayers() ) ); map.put( "styles", "" ); LinkedList<StyleRef> styles = new LinkedList<StyleRef>( getMap.getStyles() ); styles.add( new StyleRef( "default" ) ); map.put( "styles", join( ",", styles ) );
map.put( "version", "1.1.1" ); map.put( "service", "WMS" ); map.put( "layers", join( ",", layers ) ); String stylesParam = ""; if ( styles != null && !styles.isEmpty() ) {
params.put( "version", wmsVersion.toString() ); params.put( "service", "WMS" ); String csvLayerNames = join( ",", gfi.getQueryLayers() ); params.put( "layers", csvLayerNames ); params.put( "query_layers", csvLayerNames );
/** * Performs a <code>GetFeatureInfo</code> request and returns the response as a {@link FeatureCollection}. * * @param request * request parameter, must not be <code>null</code> * @param hardParams * raw parameters for augmenting overriding KVPs, must not be <code>null</code> * @return response parsed as feature collection, never <code>null</code> * @throws IOException * @throws OWSExceptionReport * @throws XMLStreamException */ public FeatureCollection doGetFeatureInfo( GetFeatureInfo request, Map<String, String> hardParams ) throws IOException, OWSExceptionReport, XMLStreamException { Map<String, String> params = buildGetFeatureInfoParamMap( request, hardParams ); overrideHardParams( params, hardParams ); OwsHttpResponse response = null; try { URL url = getGetUrl( GetFeatureInfo.name() ); response = httpClient.doGet( url, params, null ); response.assertHttpStatus200(); XMLStreamReader reader = response.getAsXMLStream(); String csvLayerNames = join( ",", request.getQueryLayers() ); return FeatureInfoParser.parseAsFeatureCollection( reader, csvLayerNames ); } finally { closeQuietly( response ); } }
String loc = getHttpGetURL() + "request=GetFeatureInfoSchema&layers=" + join( ",", queryLayers );