/[svn]/jlscp/trunk/src/org/linuxsampler/lscp/ServerInfo.java
ViewVC logotype

Contents of /jlscp/trunk/src/org/linuxsampler/lscp/ServerInfo.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2190 - (show annotations) (download)
Fri Jun 24 20:18:03 2011 UTC (12 years, 9 months ago) by iliev
File size: 2942 byte(s)
* Added support for send effects

1 /*
2 * jlscp - a java LinuxSampler control protocol API
3 *
4 * Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com>
5 *
6 * This file is part of jlscp.
7 *
8 * jlscp is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * jlscp is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with jlscp; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 package org.linuxsampler.lscp;
24
25 /**
26 * Provides general information about LinuxSampler instance.
27 * @author Grigor Iliev
28 */
29 public final class ServerInfo implements Parseable {
30 private String desc = null;
31 private String ver = null;
32 private String protoVer = null;
33 private boolean instrumentsDbSupport = false;
34
35 /** Creates a new instance of <code>ServerInfo</code>. */
36 public
37 ServerInfo() { }
38
39 /**
40 * Creates a new instance of <code>ServerInfo</code> and parses the information
41 * described by <code>resultSet</code>.
42 * @param resultSet An array with information categories about a sampler.
43 */
44 public
45 ServerInfo(String[] resultSet) {
46 for(String s : resultSet)
47 if(!parse(s)) Client.getLogger().info(LscpI18n.getLogMsg("unknownLine", s));
48 }
49
50 /**
51 * Gets description about the sampler.
52 * @return Description about the sampler.
53 */
54 public String
55 getDescription() { return desc; }
56
57 /**
58 * Gets the version of the sampler.
59 * @return The version of the sampler.
60 */
61 public String
62 getVersion() { return ver; }
63
64 /**
65 * Gets the version of the LSCP protocol.
66 * @return The version of the LSCP protocol.
67 */
68 public String
69 getProtocolVersion() { return protoVer; }
70
71 /**
72 * Determines whether the backend is
73 * build with instruments database support.
74 */
75 public boolean
76 hasInstrumentsDbSupport() { return instrumentsDbSupport; }
77
78 /**
79 * Parses a line of text.
80 * @param s The string to be parsed.
81 * @return <code>true</code> if the line has been processed, <code>false</code> otherwise.
82 */
83 public boolean
84 parse(String s) {
85 if(s.startsWith("DESCRIPTION: ")) {
86 desc = s.substring("DESCRIPTION: ".length());
87 desc = Parser.toNonEscapedString(desc);
88 } else if(s.startsWith("VERSION: ")) {
89 ver = s.substring("VERSION: ".length());
90 } else if(s.startsWith("PROTOCOL_VERSION: ")) {
91 protoVer = s.substring("PROTOCOL_VERSION: ".length());
92 } else if(s.startsWith("INSTRUMENTS_DB_SUPPORT: ")) {
93 s = s.substring("INSTRUMENTS_DB_SUPPORT: ".length());
94 if(s.equalsIgnoreCase("yes")) instrumentsDbSupport = true;
95 } else return false;
96
97 return true;
98 }
99 }

  ViewVC Help
Powered by ViewVC