Revision 22616 branches/v10/extensions/extPublish/src/org/gvsig/publish/serversmodel/Publication.java

View differences:

Publication.java
41 41
package org.gvsig.publish.serversmodel;
42 42

  
43 43
import java.io.File;
44
import java.util.ArrayList;
44 45
import java.util.Observable;
45 46
import java.util.Observer;
46 47

  
......
48 49
import org.gvsig.publish.PublishLogger;
49 50
import org.gvsig.publish.PublishRegister;
50 51
import org.gvsig.publish.infoproject.IDataSourceInfo;
52
import org.gvsig.publish.infoproject.ILayerInfo;
51 53
import org.gvsig.publish.infoproject.IProjectInfo;
52 54
import org.gvsig.publish.infoproject.datasources.IFileInfo;
53 55

  
......
75 77
	private int accessFileMethod = LOCAL_ACCESS;
76 78
	private String localMountPoint;
77 79
	private String remoteMountPoint;
78
	
80

  
79 81
	/**
80 82
	 * Sets the name of the publication
81 83
	 * @param name
......
128 130
	}
129 131

  
130 132
	/**
131
	 * Sets the information about the project to publish
133
	 * Sets the information about the project to publish.
134
	 * If a remote resource hasn't layerinfo it will be 
135
	 * removed from the publication
136
	 * 
132 137
	 * @param projectInfo
138
	 * @return an array of strings with the name of the layers 
139
	 * that have been renamed or deleted
133 140
	 */
134
	public void setProjectInfo(IProjectInfo projectInfo) {
135
		iproject = projectInfo;		
141
	public ArrayList setProjectInfo(IProjectInfo projectInfo) {
142
		iproject = projectInfo;
143
		ArrayList aux = new ArrayList();
144
		Server s = getServer();
145
		if (s !=null){
146
			for (int i = 0; i < s.getServicesCount(); i++){
147
				Service ss = s.getService(i);
148
				for (int j = 0; j < ss.getRemoteResourcesCount(); j++ ){
149
					RemoteResource rr = ss.getRemoteResource(j);
150
					ILayerInfo ilayerinfo=null;				
151
					ilayerinfo = projectInfo.findLayer(rr.getId());				
152
					if (ilayerinfo == null){						
153
						aux.add(rr.getId());
154
						rr.remove();
155
						PublishLogger.getLog().error("Cannot find the layer with name " + rr.getId());
156
					}
157
				}
158
			}
159
		}
160
		return aux;
136 161
	}
137 162
	/**
138 163
	 * 
......
168 193
		xml.putProperty("accessfilemethod", getAccessFileMethod());
169 194
		xml.putProperty("localmountpoint", getLocalMountPoint());
170 195
		xml.putProperty("remotemountpoint", getRemoteMountPoint());
171
		
196

  
172 197
		if (getServer() != null){
173 198
			xml.addChild(getServer().getXMLEntity());
174 199
		}
......
202 227
				setServer(s);
203 228
			}	
204 229
		}
205
						
230

  
206 231
	}
207 232
	/*
208 233
	 * (non-Javadoc)
......
238 263
	public void setAccessFileMethod(int accessFileMethod) {		
239 264
		this.accessFileMethod = accessFileMethod;
240 265
//		if (accessFileMethod == LOCAL_ACCESS){
241
//			setLocalMountPoint(null);
242
//			setRemoteMountPoint(null);
266
//		setLocalMountPoint(null);
267
//		setRemoteMountPoint(null);
243 268
//		}
244 269
		setChanged();
245 270
	}
246
	
271

  
247 272
	/**
248 273
	 * If the publication uses a REMOTE_MOUNT_POINT_ACCESS, this method change the path to a file in order
249 274
	 * to be accessible by a server. 
......
270 295
		}	
271 296
		return  path;		
272 297
	}
273
	
298

  
274 299
	/**
275 300
	 * @param localMountPoint the localMountPoint to set
276 301
	 */

Also available in: Unified diff