KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > j2ee > PluginProperties


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.sun.ide.j2ee;
21
22 import java.io.File JavaDoc;
23 import java.io.IOException JavaDoc;
24 import java.io.FileInputStream JavaDoc;
25 import java.util.Collection JavaDoc;
26 import java.util.Enumeration JavaDoc;
27 import java.util.Properties JavaDoc;
28 import java.util.logging.Level JavaDoc;
29
30 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
31 import org.netbeans.modules.j2ee.sun.api.Asenv;
32 import org.netbeans.modules.j2ee.sun.ide.Installer;
33 import org.netbeans.modules.j2ee.sun.api.ServerLocationManager;
34 import org.netbeans.modules.j2ee.sun.api.SunURIManager;
35 import org.netbeans.modules.j2ee.sun.ide.editors.CharsetDisplayPreferenceEditor;
36 import org.netbeans.modules.j2ee.sun.ide.j2ee.ui.Util;
37 import org.netbeans.modules.j2ee.sun.share.SecurityMasterListModel;
38 import org.netbeans.modules.j2ee.sun.share.CharsetMapping;
39 import org.openide.ErrorManager;
40 import org.openide.filesystems.FileLock;
41 import org.openide.filesystems.FileObject;
42 import org.openide.filesystems.FileSystem;
43 import org.openide.filesystems.FileUtil;
44 import org.openide.filesystems.Repository;
45 import org.openide.util.Lookup;
46 import org.openide.util.NbBundle;
47
48 /**
49  *
50  * @author ludo
51  */

52 public class PluginProperties {
53     
54     java.util.logging.Logger JavaDoc jsr88Logger =
55         java.util.logging.Logger.getLogger("com.sun.enterprise.tools.jsr88.spi");
56     
57     private String JavaDoc logLevel = null;
58     private boolean incrementalDeployPossible = true; //now on by default
59

60     private FileObject propertiesFile = null;
61     /* for handling import issues between 5.0 and 5.5. Now we know which IDE the options are from in import.
62      **/

63     private static final String JavaDoc PLUGIN_PROPERTIES_VERSION = "version"; // NOI18N
64

65     /* this will need to be bumped for 6.0. Needed from import setting between versions, and pre-regsitered App Server(8.2, 9. or later 9.x)
66      *
67      **/

68     private static final String JavaDoc PLUGIN_CURRENT_VERSION = "5.5"; // NOI18N
69
private static final String JavaDoc INCREMENTAL = "incrementalDeploy"; // NOI18N
70
private static final String JavaDoc PRINCIPAL_PREFIX = "principalEntry."; // NOI18N
71
private static final String JavaDoc GROUP_PREFIX = "groupEntry."; // NOI18N
72
private static final String JavaDoc LOG_LEVEL_KEY = "logLevel"; // NOI18N
73
private static final String JavaDoc CHARSET_DISP_PREF_KEY = "charsetDisplayPreference"; // NOI18N
74
public static final String JavaDoc INSTALL_ROOT_PROP_NAME = "com.sun.aas.installRoot"; //NOI18N
75

76     public static final String JavaDoc COBUNDLE_DEFAULT_INSTALL_PATH ="AS9.0"; //NOI18N
77
public static final String JavaDoc COBUNDLE_DEFAULT_INSTALL_PATH2 ="AS8.2"; //NOI18N
78

79
80     
81     static private PluginProperties thePluginProperties=null;
82
83     public static PluginProperties getDefault(){
84         if (thePluginProperties==null) {
85             thePluginProperties= new PluginProperties();
86         }
87         return thePluginProperties;
88     }
89     
90     
91     
92     private PluginProperties(){
93         java.io.InputStream JavaDoc inStream = null;
94         try {
95             try {
96                 propertiesFile = getPropertiesFile();
97                 if (null != propertiesFile){
98                     inStream = propertiesFile.getInputStream();
99                 }
100             } catch (java.io.FileNotFoundException JavaDoc fnfe) {
101                 Constants.pluginLogger.info(NbBundle.getMessage(PluginProperties.class, "INFO_NO_PROPERTY_FILE")); //NOI18N
102
} catch (java.io.IOException JavaDoc ioe) {
103                 Constants.pluginLogger.info(NbBundle.getMessage(PluginProperties.class, "ERR_READING_PROPERTIES")); //NOI18N
104
Constants.pluginLogger.throwing(PluginProperties.class.getName(), "<init>", //NOI18N
105
ioe);
106             } finally {
107                 Properties JavaDoc inProps = new Properties JavaDoc();
108                 if (null != inStream){
109                     inProps.load(inStream);
110                     inStream.close();
111                 }
112                 loadPluginProperties(inProps);
113             }
114         } catch (java.io.IOException JavaDoc ioe) {
115             ErrorManager.getDefault().notify(ErrorManager.WARNING,ioe);
116         }
117         
118     }
119     
120     private FileObject getPropertiesFile() throws java.io.IOException JavaDoc {
121         FileSystem fs = Repository.getDefault().getDefaultFileSystem();
122         FileObject dir = fs.findResource("J2EE");
123         FileObject retVal = null;
124         if (null != dir) {
125             retVal = dir.getFileObject("platform","properties"); // NOI18N
126
if (null == retVal) {
127                 retVal = dir.createData("platform","properties"); //NOI18N
128

129             }
130         }
131         return retVal;
132     }
133     
134     
135     void loadPluginProperties(Properties JavaDoc inProps) {
136         
137         logLevel = inProps.getProperty(LOG_LEVEL_KEY, java.util.logging.Level.OFF.toString());
138         String JavaDoc[] inputUsers = getArrayPropertyValue(inProps, PRINCIPAL_PREFIX);
139         String JavaDoc[] inputGroups = getArrayPropertyValue(inProps, GROUP_PREFIX);
140         
141         setCharsetDisplayPreferenceStatic(Integer.valueOf(inProps.getProperty(CHARSET_DISP_PREF_KEY, "1")));
142         String JavaDoc b= inProps.getProperty(INCREMENTAL,"true");//true by default
143
incrementalDeployPossible = b.equals("true");
144         String JavaDoc version = inProps.getProperty(PLUGIN_PROPERTIES_VERSION);//old style 5.0: we need to import and refresh
145
boolean needToRegisterDefaultServer = false;
146
147         if ((version==null)||(version!=PLUGIN_CURRENT_VERSION)){ //we are currently on a 5.5
148
needToRegisterDefaultServer = true;
149         }
150               
151         if (needToRegisterDefaultServer){
152             final File JavaDoc platformRoot = new File JavaDoc(getDefaultInstallRoot());
153             
154             if (isGoodAppServerLocation(platformRoot)){
155                 registerDefaultDomain(platformRoot);
156                 saveProperties();
157             }
158             
159         }
160     
161  
162         
163         // note these operations trigger a property change, so we probably want
164
// them to fire AFTER all the values have been read into place....
165
setUserListStatic(inputUsers);
166         setGroupListStatic(inputGroups);
167         Constants.pluginLogger.setLevel(Level.ALL);
168         jsr88Logger.setLevel(Level.ALL);
169         Level JavaDoc parsed = null;
170         try {
171             parsed = Level.parse(logLevel);
172             jsr88Logger.setLevel(parsed);
173             Constants.pluginLogger.setLevel(parsed);
174             Constants.pluginLogger.log(parsed, logLevel);
175             jsr88Logger.log(parsed, logLevel);
176         } catch (IllegalArgumentException JavaDoc iae) {
177             logLevel = Level.ALL.toString();
178             Constants.pluginLogger.severe(NbBundle.getMessage(PluginProperties.class, "ERR_ILLEGAL_LEVEL_VALUE")); // NOI18N
179
}
180         
181     }
182     
183     static public void configureDefaultServerInstance(){
184         PluginProperties.getDefault();//call needed for init for this
185

186     }
187     
188     public void setIncrementalDeploy(Boolean JavaDoc b){
189         
190         incrementalDeployPossible = b.booleanValue();
191         saveProperties();
192         
193     }
194     public Boolean JavaDoc getIncrementalDeploy(){
195         return Boolean.valueOf(incrementalDeployPossible);
196         
197     }
198     
199     public boolean isIncrementalDeploy(){
200         return incrementalDeployPossible;
201         
202     }
203     
204     
205     /** Getter for property userList.
206      * @return Value of property userList.
207      *
208      */

209     public String JavaDoc[] getUserList() {
210         SecurityMasterListModel pModel =
211                 SecurityMasterListModel.getPrincipalMasterModel();
212         String JavaDoc[] ss=masterListToStringArray(pModel);
213         return ss;
214         //return new String[0];
215
}
216     
217     public String JavaDoc[] getGroupList() {
218         SecurityMasterListModel pModel =
219                 SecurityMasterListModel.getGroupMasterModel();
220         
221         return masterListToStringArray(pModel);
222         // return new String[0];
223
}
224     
225     private String JavaDoc[] masterListToStringArray(SecurityMasterListModel pModel) {
226         int len = pModel.getRowCount();
227         String JavaDoc retVal[] = new String JavaDoc[len];
228         for (int i = 0; i < len; i++) {
229             String JavaDoc foo = pModel.getRow(i).toString();
230             retVal[i] = foo;
231         }
232         return retVal;
233     }
234     
235     public boolean setUserListStatic(String JavaDoc [] list) {
236         SecurityMasterListModel pModel =
237                 SecurityMasterListModel.getPrincipalMasterModel();
238         boolean retVal = false;
239         if (!containsSameElements(pModel, list)) {
240             
241             fillMasterList(pModel, list);
242             retVal = true;
243         }
244         return retVal;
245     }
246     
247     public void setUserList(String JavaDoc [] list) {
248         if (setUserListStatic(list)) {
249             saveProperties();
250         }
251     }
252     
253     public boolean setGroupListStatic(String JavaDoc [] list) {
254         SecurityMasterListModel pModel =
255                 SecurityMasterListModel.getGroupMasterModel();
256         boolean retVal = false;
257         if (!containsSameElements(pModel, list)) {
258             fillMasterList(pModel, list);
259             retVal = true;
260         }
261         return retVal;
262     }
263     
264     public void setGroupList(String JavaDoc [] list) {
265         if (setGroupListStatic(list)) {
266             saveProperties();
267         }
268     }
269     
270     
271     boolean containsSameElements(SecurityMasterListModel pModel, String JavaDoc[] list) {
272         int len = pModel.getRowCount();
273         if (len != list.length)
274             return false;
275         else
276             for (int i = 0; i < len; i++) {
277                 if (!pModel.contains(list[i])) {
278                     return false;
279                 }
280             }
281         return true;
282     }
283     
284     
285     
286     private void fillMasterList(SecurityMasterListModel pModel, String JavaDoc[] values) {
287         int len = values.length;
288         for (int i = pModel.getRowCount() - 1; i >= 0; i--) {
289             pModel.removeElementAt(i);
290         }
291         for (int i = 0; i < len; i++) {
292             if (!pModel.contains(values[i])) {
293                 pModel.addElement(values[i]);
294             }
295         }
296     }
297     
298     public String JavaDoc getLogLevel() {
299         return logLevel;
300     }
301     
302     public void setLogLevel(String JavaDoc ll) {
303         String JavaDoc oll = logLevel;
304         if (!oll.equals(ll)) {
305             Level JavaDoc parsed = null;
306             try {
307                 parsed = Level.parse(ll);
308                 jsr88Logger.setLevel(parsed);
309                 Constants.pluginLogger.setLevel(parsed);
310                 Constants.pluginLogger.log(parsed, ll);
311                 jsr88Logger.log(parsed, ll);
312                 
313                 logLevel = ll;
314                 saveProperties();
315             } catch (IllegalArgumentException JavaDoc iae) {
316                 //logLevel = Level.ALL.toString();
317
Constants.pluginLogger.severe(
318                         NbBundle.getMessage(PluginProperties.class, "ERR_ILLEGAL_LEVEL_VALUE")); //NOI18N
319
}
320         }
321     }
322     
323     
324     
325     public Integer JavaDoc getCharsetDisplayPreferenceStatic() {
326         return CharsetMapping.getDisplayOption();
327     }
328     
329     public void setCharsetDisplayPreferenceStatic(Integer JavaDoc displayPreference) {
330         CharsetMapping.setDisplayOption(displayPreference);
331     }
332     
333     /** Getter for property charsetDisplayPreference.
334      * @return Value of property charsetDisplayPreference.
335      *
336      */

337     public Integer JavaDoc getCharsetDisplayPreference() {
338         return getCharsetDisplayPreferenceStatic();
339     }
340     
341     /** Setter for property charsetDisplayPreference.
342      * @param displayPreference New value of property charsetDisplayPreference.
343      *
344      */

345     public void setCharsetDisplayPreference(Integer JavaDoc displayPreference) {
346         Integer JavaDoc oldDisplayPreference = getCharsetDisplayPreferenceStatic();
347         if(!displayPreference.equals(oldDisplayPreference)) {
348             setCharsetDisplayPreferenceStatic(displayPreference);
349             saveProperties();
350         }
351     }
352     
353     
354     private void saveProperties(){
355         Properties JavaDoc outProp = new Properties JavaDoc();
356       
357         // we store our current version
358
outProp.setProperty(PLUGIN_PROPERTIES_VERSION, PLUGIN_CURRENT_VERSION);
359         
360         setArrayPropertyValue(outProp, PRINCIPAL_PREFIX, getUserList());
361         
362         setArrayPropertyValue(outProp, GROUP_PREFIX, getGroupList());
363         outProp.setProperty(INCREMENTAL, ""+incrementalDeployPossible);
364         
365         if (!logLevel.equals(Level.OFF.toString())){
366             outProp.setProperty(LOG_LEVEL_KEY, logLevel);
367         }
368         if (!getCharsetDisplayPreferenceStatic().equals(CharsetDisplayPreferenceEditor.DEFAULT_PREF_VAL)){
369         outProp.setProperty(CHARSET_DISP_PREF_KEY, getCharsetDisplayPreferenceStatic().toString());
370         }
371
372         FileLock l = null;
373         java.io.OutputStream JavaDoc outStream = null;
374         try {
375             if (null != propertiesFile) {
376                 try {
377                     l = propertiesFile.lock();
378                     outStream = propertiesFile.getOutputStream(l);
379                     if (null != outStream){
380                         outProp.store(outStream, "");
381                     }
382                 } catch (java.io.IOException JavaDoc ioe) {
383                     Constants.pluginLogger.severe(
384                             NbBundle.getMessage(PluginProperties.class, "ERR_SAVING_PROPERTIES") // NOI18N
385
);
386                     Constants.pluginLogger.throwing(PluginProperties.class.toString(), "saveChange", //NOI18N
387
ioe);
388                 } finally {
389                     if (null != outStream){
390                         outStream.close();
391                     }
392                     if (null != l){
393                         l.releaseLock();
394                     }
395                 }
396             }
397         } catch (java.io.IOException JavaDoc ioe) {
398             Constants.pluginLogger.throwing(PluginProperties.class.toString(), "saveChange",ioe);
399         }
400         
401         
402     }
403     
404
405
406
407     
408     public static String JavaDoc getDefaultInstallRoot() {
409         String JavaDoc candidate = System.getProperty(INSTALL_ROOT_PROP_NAME); //NOI18N
410
if (null != candidate){
411             
412             File JavaDoc f = new File JavaDoc(candidate);
413             if (f.exists()){
414                 return candidate;
415             }
416             
417         }
418         
419         File JavaDoc ff = new File JavaDoc(System.getProperty("netbeans.home"));
420         
421         File JavaDoc f3 = new File JavaDoc(ff.getParentFile(),COBUNDLE_DEFAULT_INSTALL_PATH);
422         if ((f3!=null)&&(f3.exists())){
423             return f3.getAbsolutePath();
424         }
425         f3 = new File JavaDoc(ff.getParentFile(),COBUNDLE_DEFAULT_INSTALL_PATH2);
426         if ((f3!=null)&&(f3.exists())){
427             return f3.getAbsolutePath();
428         }
429         
430         
431         return "";
432     }
433     
434     
435     
436     static boolean hasRequiredChildren(File JavaDoc candidate, Collection JavaDoc requiredChildren) {
437         if (null == candidate) {
438             return false;
439         }
440         String JavaDoc[] children = candidate.list();
441         if (null == children) {
442             return false;
443         }
444         if (null == requiredChildren) {
445             return true;
446         }
447         java.util.List JavaDoc kidsList = java.util.Arrays.asList(children);
448         return kidsList.containsAll(requiredChildren);
449     }
450     
451     private static Collection JavaDoc fileColl = new java.util.ArrayList JavaDoc();
452     
453     static {
454         fileColl.add("bin");//NOI18N
455
fileColl.add("lib");//NOI18N
456
fileColl.add("config");//NOI18N
457
}
458     
459
460     
461     private static boolean isGoodAppServerLocation(File JavaDoc candidate){
462         if (null == candidate || !candidate.exists() || !candidate.canRead() ||
463                 !candidate.isDirectory() || !hasRequiredChildren(candidate, fileColl)) {
464            
465             return false;
466         }
467         //now test for AS 9 (J2EE 5.0) which should work for this plugin
468
if(ServerLocationManager.isGlassFish(candidate)){
469            return true;//we are as9
470
}
471         
472         //one extra test to detect 8.0 versus 8.1: dom.jar has to be in lib not endorsed anymore:
473
// File f = new File(candidate.getAbsolutePath()+"/lib/dom.jar");
474
// return f.exists();
475
return true;
476     }
477
478     
479     private static void registerDefaultDomain(File JavaDoc platformRoot){
480         String JavaDoc username ="admin";//default//NOI18N
481
String JavaDoc password ="adminadmin";//default//NOI18N
482

483         //try to read real password default:
484
File JavaDoc f = new File JavaDoc(System.getProperty("user.home")+"/.asadminprefs"); //NOI18N
485
FileInputStream JavaDoc fis = null;
486         if (f.exists()) {
487             try{
488                 
489                 Properties JavaDoc p = new Properties JavaDoc();
490                 fis = new FileInputStream JavaDoc(f);
491                 p.load(fis);
492                 
493                 Enumeration JavaDoc e = p.propertyNames() ;
494                 for ( ; e.hasMoreElements() ;) {
495                     String JavaDoc v = (String JavaDoc)e.nextElement();
496                     if (v.equals("AS_ADMIN_USER"))//admin user//NOI18N
497
username = p.getProperty(v );
498                     else if (v.equals("AS_ADMIN_PASSWORD")){ // admin password//NOI18N
499
password = p.getProperty(v );
500                     }
501                 }
502                 
503             } catch (Exception JavaDoc e){
504                 //either the file does not exist or not available. No big deal, we continue ands NB will popup the request dialog.
505
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,e);
506             } finally {
507                 if (null != fis) {
508                     try {
509                         fis.close();
510                     } catch (IOException JavaDoc e) {
511                         ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,e);
512                     }
513                 }
514             }
515             
516         }
517         // Go to the conf dir
518
String JavaDoc ext = (File.separatorChar == '/' ? "conf" : "bat"); // NOI18N
519
File JavaDoc asenv = new File JavaDoc(platformRoot,"config/asenv."+ext); // NOI18N
520
Asenv asenvContent = new Asenv(asenv);
521         String JavaDoc defDomainsDirName = asenvContent.get(Asenv.AS_DEF_DOMAINS_PATH);
522         File JavaDoc domains = new File JavaDoc(defDomainsDirName);//NOI18N
523
if (domains.exists() && domains.isDirectory() ) {
524             File JavaDoc[] domainsList= domains.listFiles();
525             if(domainsList==null) {
526                 return;
527             }
528             for (int i=0;i<domainsList.length;i++){
529                 
530                 try {
531                     
532                     File JavaDoc confDir = new File JavaDoc(domainsList[i].getAbsolutePath()+"/config");//NOI18N
533
// if it is writable
534
if (confDir.exists() && confDir.isDirectory() && confDir.canWrite()) {
535                         // try to get the host/port data
536
String JavaDoc hp = Util.getHostPort(domainsList[i],platformRoot);
537                         if (hp!=null){
538                             
539                             
540                             String JavaDoc dmUrl = "["+platformRoot.getAbsolutePath()+"]" +SunURIManager.SUNSERVERSURI+hp; //NOI18N
541
String JavaDoc displayName = NbBundle.getMessage(PluginProperties.class, "OpenIDE-Module-Name") ;//NOI18N
542
if (ServerLocationManager.isGlassFish(platformRoot)){
543                                 displayName+=" 9";//NOI18N for new name
544
}
545                             if (i!=0) {//not the first one, but other possible domains
546
displayName = domainsList[i].getName();
547                             }
548                             Repository rep = (Repository)Lookup.getDefault().lookup(Repository.class);
549                             FileObject dir = rep.getDefaultFileSystem().findResource("/J2EE/InstalledServers"); // NOI18N
550
FileObject instanceFOs[] = dir.getChildren();
551                             FileObject instanceFO = null;
552                             for (int j = 0; j < instanceFOs.length; j++) {
553                                 if (dmUrl.equals(instanceFOs[j].getAttribute(InstanceProperties.URL_ATTR))) {
554                                     instanceFO = instanceFOs[j];
555                                 }
556                             }
557                             if (instanceFO == null) {
558                                 String JavaDoc name = FileUtil.findFreeFileName(dir, "instance", null); // NOI18N
559
instanceFO = dir.createData(name);
560                             }
561                             instanceFO.setAttribute(InstanceProperties.URL_ATTR, dmUrl);
562                             instanceFO.setAttribute(InstanceProperties.USERNAME_ATTR, username);
563                             instanceFO.setAttribute(InstanceProperties.PASSWORD_ATTR, password);
564                             instanceFO.setAttribute(InstanceProperties.DISPLAY_NAME_ATTR, displayName);
565                             instanceFO.setAttribute("DOMAIN", domainsList[i].getName()); // NOI18N
566
// The LOCATION is the domains directory, not the install root now...
567
instanceFO.setAttribute("LOCATION", asenvContent.get(Asenv.AS_DEF_DOMAINS_PATH)); // NOI18N
568
}
569                     }
570                 } catch (IOException JavaDoc ioe){
571                     ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioe);
572                     /// Util.showInformation(e.getLocalizedMessage(), NbBundle.getMessage(RegisterServerAction.class, "LBL_RegServerFailed"));
573
}
574             }
575         }
576             
577             
578         }
579
580     /** Extract a String[] from a Properties
581      *
582      * The prefix identifies the root property name. Elements of
583      * the array are represented in the Properties object as
584      * keys that share a common prefix and are numbered, consecutively,
585      * starting at zero.
586      *
587      * This method always returns a String[] object. It will never
588      * return null;
589      * @param inProps Properties object the hosts the array.
590      * @param prefix The prefix of the key values to identify elements
591      * @return The value of properties found with the prefix
592      */

593     private static String JavaDoc[] getArrayPropertyValue(Properties JavaDoc inProps, String JavaDoc prefix) {
594         String JavaDoc prototype[] = new String JavaDoc[0];
595         java.util.List JavaDoc l = new java.util.ArrayList JavaDoc();
596             int index = 0;
597             String JavaDoc entry = null;
598             do {
599                 entry = inProps.getProperty(prefix+index);
600                 index++;
601                 if (null != entry) {
602                     l.add(entry);
603                 }
604             }
605             while (null != entry);
606             Object JavaDoc [] retVal = l.toArray(prototype);
607         return (String JavaDoc[]) retVal;
608     }
609     
610     /** Inter a String[] into a Properties object
611      *
612      * Values are store as properties so they can be extracted
613      * from the array by getArrayPropertyValue.
614      * @param props Propeties object that will hold the array values.
615      * @param prefix The prefix used for creating the property key
616      *
617      * @param values The array of values to be interred.
618      */

619     private static void setArrayPropertyValue(Properties JavaDoc props, String JavaDoc prefix, String JavaDoc[] values) {
620         int len = 0;
621         if (null != values) {
622             len = values.length;
623         }
624         int index = 0;
625         for (int i = 0; i < len; i++) {
626             if (null != values[i]) {
627                 props.setProperty(prefix+index,values[i]);
628                 index++;
629             }
630         }
631     }}
632
Popular Tags