Revision 19432 branches/v10/extensions/extPublishGeoserver/src/org/gvsig/publish/geoserver/conf/GSFeature.java

View differences:

GSFeature.java
244 244
    }
245 245
	/**
246 246
	 * Serialize the featureType information into a info.xml. 
247
	 * It creates a directory with the same name as the feature and puts the info.xml inside of it. 
247
	 * It creates a directory with the name "datastore_feature" and puts the info.xml inside of it. 
248 248
	 * 
249 249
	 * @param dir directory where are placed all the feature's configurations 
250 250
	 * 
251 251
	 */
252 252
    public void toXML(File dir){
253
    	String aux = getDatastore().getId()+ "_" + getName();
253 254
    	//creates the directory
254
    	File dir_info = new File(dir.getAbsolutePath() + File.separator + getName());
255
    	File dir_info = new File(dir.getAbsolutePath() + File.separator +  aux);
255 256
    	dir_info.mkdirs();
256 257
    	//creates the file
257 258
    	File info_xml = new File(dir_info.getAbsoluteFile() + File.separator + "info.xml");
......
270 271
		}
271 272
		//create the root element <featureType>
272 273
		Element rootEle = dom.createElement("featureType");
274
		rootEle.setAttribute("datastore", this.getDatastore().getId());
273 275
		dom.appendChild(rootEle);
274 276
		//name
275 277
		Element paramEle = dom.createElement("name");
......
319 321
		rootEle.appendChild(paramEle);				
320 322
		//cacheinfo
321 323
		paramEle = dom.createElement("cacheinfo");
322
		paramEle.setAttribute("enabled", new Boolean(this.cacheEnabled).toString());
323
		paramEle.setAttribute("maxage", new Integer(this.cacheMaxage).toString() );
324
		paramEle.setAttribute("enabled", new Boolean(this.isCacheEnabled()).toString());
325
		paramEle.setAttribute("maxage", new Integer(this.getCacheMaxage()).toString() );
324 326
		rootEle.appendChild(paramEle);
325
		//styles
326
		//paramEle = dom.createElement("styles");
327
		//paramEle.setAttribute("default", this.getStyle().getId());
328
		//rootEle.appendChild(paramEle);		
327
		//style default
328
		paramEle = dom.createElement("styles");
329
		paramEle.setAttribute("default", this.getStyle().getId());
330
		rootEle.appendChild(paramEle);		
329 331
		
330
		//write files
332
		//write info.xml
331 333
		try
332 334
		{
333 335
			OutputFormat format = new OutputFormat(dom);
......
338 340
		} catch(IOException ioe) {
339 341
		    PublishLogger.getLog().error("ERROR " + getClass().getName() + ": I can't generate the catlog.xml", ioe);
340 342
		}
343
		
344
		//copy the sld into geoserver_data_dir/styles
345
		//this.getStyle().copySLD(dir.getParentFile());
346
		this.getStyle().writeSLD(dir.getParentFile());
347
		
341 348
    }
349
	/**
350
	 * @return the cacheEnabled
351
	 */
352
	public boolean isCacheEnabled() {
353
		return cacheEnabled;
354
	}
355
	/**
356
	 * @param cacheEnabled the cacheEnabled to set
357
	 */
358
	public void setCacheEnabled(boolean cacheEnabled) {
359
		this.cacheEnabled = cacheEnabled;
360
	}
361
	/**
362
	 * @return the cacheMaxage
363
	 */
364
	public int getCacheMaxage() {
365
		return cacheMaxage;
366
	}
367
	/**
368
	 * @param cacheMaxage the cacheMaxage to set
369
	 */
370
	public void setCacheMaxage(int cacheMaxage) {
371
		this.cacheMaxage = cacheMaxage;
372
	}
342 373
}

Also available in: Unified diff