1
/* Copyright (c) 2007 SNAP Innovation GmbH
3
* BLOB Streaming for MySQL
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
package org.blobstreaming.www;
31
import java.util.Vector;
38
public Property(String k, String v)
50
properties = new Vector();
54
* Removes all the properties from the list.
56
public void removeAll()
62
* Returns the number of properties in the list.
66
return(properties.size());
70
* Find a property with the given key. If the key
71
* is an int then it is used as an index.
72
* null will be returned if the property is not
75
protected Property findProperty(String key)
80
for (i=0; i<properties.size(); i++) {
81
p = (Property) properties.get(i);
82
if (p.key.equalsIgnoreCase(key))
89
protected Property findProperty(int i)
93
if (i < properties.size())
94
p = (Property) properties.get(i);
99
* Set a property with the given key to a specified
101
* is an int then it is used as an index.
103
public void setProperty(String key, String value)
107
if ((p = findProperty(key)) != null)
110
properties.add(new Property(key, value));
113
public void setProperty(String key, int value)
115
setProperty(key, Integer.toString(value));
118
public void setProperty(String key, long value)
120
setProperty(key, Long.toString(value));
124
* Get a property with the given key. If the key
125
* is an int then it is used as an index.
127
public String getProperty(String key)
131
if ((p = findProperty(key)) != null)
136
public String getProperty(int i)
140
if ((p = findProperty(i)) != null)
145
public String getPropertyKey(int i)
149
if ((p = findProperty(i)) != null)