Revision 17705 branches/v10/extensions/extPublish/src/org/gvsig/publish/infoproject/ProjectInfoFactory.java

View differences:

ProjectInfoFactory.java
42 42

  
43 43

  
44 44
import com.iver.cit.gvsig.project.Project;
45

  
45
import com.iver.utiles.XMLEntity;
46
/**
47
 * Factory to get the interfaces which have information about the project to publish 
48
 * 
49
 * @author jvhigon
50
 *
51
 */
46 52
public class ProjectInfoFactory {
47
//	private static Project project=null;
53
	private static IProjectInfo project=null;
54
	/**
55
	 * 
56
	 * @return the latest Iprojectinfo created. It can be null if getProjectInfo(xxx) was not called before
57
	 */
58
	public static IProjectInfo getProjectInfo(){
59
		return project;
60
	}
61
	/**
62
	 * 
63
	 * @param gvProj gvSIG project
64
	 * @return IProjectInfo created from a gvSIg project
65
	 */
48 66
	public static IProjectInfo getProjectInfo(Project gvProj){
49
	//	project=gvProj;
50
		return new ProjectInfo(gvProj);
67
		project=new ProjectInfo(gvProj);
68
		return project;
51 69
	}
52 70
//	public static ILayerInfo getLayerInfo(String layerName){
53 71
////		Project project=((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject();
......
63 81
//		}
64 82
//		return null;
65 83
//	}
84
	/**
85
	 * Creates an interface from a xml. It uses the latest getProjectInfo used. 
86
	 * @return Object that represents and interface (ILayerInfo, for example). It will be null if getProjectInfo(xxx) has not been called. 
87
	 */
88
	public static Object createFromXML(XMLEntity xml){
89
		if (getProjectInfo() == null){
90
			return null;
91
		}
92
		String classname = xml.getStringProperty("className");
93
		if (classname.equals(LayerInfo.VERSION)){
94
			String layername = xml.getStringProperty(LayerInfo.LAYERNAME);
95
			ILayerInfo l = getProjectInfo().findLayer(layername);
96
			return l;
97
		}
98
		
99
		return null;
100
	}
66 101
}

Also available in: Unified diff