Revision 32

View differences:

org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
    <dependencySet>
27
      <useProjectArtifact>false</useProjectArtifact>
28
      <useTransitiveDependencies>false</useTransitiveDependencies>
29
      <outputDirectory>lib</outputDirectory>
30
      <includes>
31
      
32
           		<include>org.gvsig:org.gvsig.catalog.lib</include>
33
           		<!--
34
        		<include>org.gvsig:org.gvsig.remoteclient</include>
35
        		-->
36
        		<include>org.jzkit:a2j-runtime</include>
37
        		<include>org.jzkit:a2j</include>
38
        		<include>commons-beanutils:commons-beanutils</include>
39
        		<include>commons-httpclient:commons-httpclient</include>
40
        		<include>commons-logging:commons-logging</include>
41
        		<include>org.dspace:cql-java</include>
42
        		<include>jdom:jdom</include>
43
        		<include>org.jzkit:jzkit2-core</include>
44
        		<include>org.jzkit:jzkit2-z3950</include>
45
        		<include>org.jzkit:jzkit2-origin</include>
46
        		<include>soap:soap</include>
47
        		<include>net.swing:amic-util</include>
48
        		<include>org.springframework:spring</include> 
49

  
50
      </includes>
51
    </dependencySet>
52
  </dependencySets>
53

  
54
</assembly>
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ShowTreeDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog.gui;
42

  
43
import javax.swing.JDialog;
44

  
45
import org.gvsig.andami.PluginServices;
46
import org.gvsig.andami.ui.mdiManager.IWindow;
47
import org.gvsig.andami.ui.mdiManager.WindowInfo;
48
import org.gvsig.catalog.metadataxml.XMLNode;
49
import org.gvsig.catalog.ui.showtree.ShowTreeDialogPanel;
50

  
51

  
52

  
53
/**
54
 * DOCUMENT ME!
55
 *
56
 * @author jorpiell TODO To change the template for this generated type comment
57
 *         go to Window - Preferences - Java - Code Style - Code Templates
58
 */
59
public class ShowTreeDialog extends ShowTreeDialogPanel implements IWindow {
60
	 private JDialog frame = null;
61
	/**
62
     * DOCUMENT ME!
63
     *
64
     * @param node
65
     */
66
    public ShowTreeDialog(JDialog frame,XMLNode node) {
67
        super(node);
68
        this.frame = frame;
69
        //8 --> Modal window
70
        PluginServices.getMDIManager().getWindowInfo(this).setWindowInfo(new WindowInfo(
71
                8));
72
    }
73

  
74
    /**
75
     * DOCUMENT ME!
76
     */
77
    public void closeButtonActionPerformed() {
78
        closeJDialog();
79
    }
80

  
81
    /**
82
     * DOCUMENT ME!
83
     */
84
    public void closeJDialog() {
85
    	frame.setVisible(false);
86
    }
87

  
88
    /**
89
     * DOCUMENT ME!
90
     *
91
     * @return DOCUMENT ME!
92
     */
93
    public WindowInfo getWindowInfo() {
94
        WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
95
        m_viewinfo.setTitle(getName());
96

  
97
        return m_viewinfo;
98
    }
99
    public Object getWindowProfile(){
100
		return WindowInfo.DIALOG_PROFILE;
101
	}
102
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ShowResultsDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog.gui;
42

  
43
import java.awt.Frame;
44
import java.util.Collection;
45

  
46
import javax.swing.JDialog;
47
import javax.swing.JOptionPane;
48

  
49
import org.gvsig.andami.PluginServices;
50
import org.gvsig.andami.ui.mdiManager.IWindow;
51
import org.gvsig.andami.ui.mdiManager.WindowInfo;
52
import org.gvsig.catalog.CatalogClient;
53
import org.gvsig.catalog.drivers.GetRecordsReply;
54
import org.gvsig.catalog.metadataxml.XMLNode;
55
import org.gvsig.catalog.schemas.Record;
56
import org.gvsig.catalog.schemas.Resource;
57
import org.gvsig.catalog.ui.showresults.ShowResultsDialogPanel;
58
import org.gvsig.catalog.utils.Frames;
59
import org.gvsig.i18n.Messages;
60

  
61

  
62

  
63
/**
64
 * DOCUMENT ME!
65
 *
66
 * @author luisw
67
 */
68
public class ShowResultsDialog extends ShowResultsDialogPanel implements IWindow {
69
    private JDialog frame = null;
70
    /**
71
     * DOCUMENT ME!
72
     *
73
     * @param client
74
     * @param nodes
75
     * @param currentRecord
76
     */
77
    public ShowResultsDialog(JDialog frame,CatalogClient client, GetRecordsReply recordsReply,
78
        int currentRecord) {
79
        super(client, recordsReply, currentRecord);
80
        this.frame = frame;
81
    }
82

  
83
    /**
84
     * DOCUMENT ME!
85
     */
86
    public void descriptionButtonActionPerformed() {
87
    	Record record = recordsReply.getRecordAt(getCurrentNode());
88
    	if (record == null){
89
    		return;
90
    	}
91
    	XMLNode node = record.getNode();
92
    	if (node == null){
93
    		JOptionPane.showMessageDialog(this,Messages.getText("Error_accediendo_a_los_datos"));
94
    	}else{
95
    		
96
    		JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
97
    		Frames.centerFrame(panel, 796, 675);
98
    		//panel.setBounds(0, 0, 796, 675);
99
    		panel.setTitle(Messages.getText("metadata_tree"));
100
    		panel.setResizable(false);
101
    		
102
    		ShowTreeDialog dialog = new ShowTreeDialog(panel,node);
103
    		
104
    		panel.getContentPane().add(dialog);
105
    		panel.show();
106
    	}
107
        
108
//        PluginServices.getMDIManager().addView(dialog);
109
    }
110

  
111
    /**
112
     * DOCUMENT ME!
113
     */
114
    public void mapButtonActionPerformed() {
115
        Resource[] resources = controlsPanel.getRecord().getResources();
116
        Collection col = new java.util.ArrayList();
117
        for (int i=0 ; i<resources.length ;i++){
118
            col.add(resources[i]);
119
        }
120
        ChooseResourceDialog dialog = new ChooseResourceDialog(col);
121
        dialog.setBounds(0, 0, 586, 145);
122
        dialog.setName(Messages.getText("Recursos Disponibles"));
123
        dialog.setVisible(true);
124
        PluginServices.getMDIManager().addWindow(dialog);
125
    }
126

  
127
    /**
128
     * DOCUMENT ME!
129
     */
130
    public void closeButtonActionPerformed() {
131
        closeJDialog();
132
    }
133

  
134
    /**
135
     * Cierra el Dialog
136
     */
137
    public void closeJDialog() {
138
        frame.setVisible(false);
139
    }
140

  
141
    /* (non-Javadoc)
142
     * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
143
     */
144
    public WindowInfo getWindowInfo() {
145
        WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
146
        m_viewinfo.setTitle(getName());
147

  
148
        return m_viewinfo;
149
    }
150
    public Object getWindowProfile(){
151
		return WindowInfo.DIALOG_PROFILE;
152
	}
153
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ServerPropertiesDialog.java
1
package org.gvsig.catalog.gui;
2

  
3
import org.gvsig.andami.PluginServices;
4
import org.gvsig.andami.ui.mdiManager.IWindow;
5
import org.gvsig.andami.ui.mdiManager.WindowInfo;
6
import org.gvsig.catalog.CatalogClient;
7
import org.gvsig.catalog.drivers.profiles.IProfile;
8
import org.gvsig.catalog.ui.serverproperties.ServerPropertiesDialogPanel;
9
import org.gvsig.i18n.Messages;
10
import org.gvsig.utils.swing.jcomboServer.ServerData;
11

  
12

  
13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
14
 *
15
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
16
 *
17
 * This program is free software; you can redistribute it and/or
18
 * modify it under the terms of the GNU General Public License
19
 * as published by the Free Software Foundation; either version 2
20
 * of the License, or (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
30
 *
31
 * For more information, contact:
32
 *
33
 *  Generalitat Valenciana
34
 *   Conselleria d'Infraestructures i Transport
35
 *   Av. Blasco Ib??ez, 50
36
 *   46010 VALENCIA
37
 *   SPAIN
38
 *
39
 *      +34 963862235
40
 *   gvsig@gva.es
41
 *      www.gvsig.gva.es
42
 *
43
 *    or
44
 *
45
 *   IVER T.I. S.A
46
 *   Salamanca 50
47
 *   46005 Valencia
48
 *   Spain
49
 *
50
 *   +34 963163400
51
 *   dac@iver.es
52
 */
53
/* CVS MESSAGES:
54
 *
55
 * $Id$
56
 * $Log$
57
 *
58
 */
59
/**
60
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
61
 */
62
public class ServerPropertiesDialog extends ServerPropertiesDialogPanel implements IWindow {
63
	private WindowInfo m_windowinfo = null;
64
	
65
	public ServerPropertiesDialog(ServerData serverData, CatalogClient client, 
66
			IProfile profile, Object parentFrame) {
67
		super(serverData, client, profile, parentFrame);		
68
	}
69

  
70
	/*
71
	 * (non-Javadoc)
72
	 * @see es.gva.cit.catalog.ui.serverproperties.ServerPropertiesDialogPanel#closeButtonActionPerformed()
73
	 */
74
	protected void closeButtonActionPerformed() {        
75
		client.setServerData(updateServerData());
76
		PluginServices.getMDIManager().closeWindow(this);
77
	} 
78
	
79
	/*
80
	 * (non-Javadoc)
81
	 * @see es.gva.cit.catalog.ui.serverproperties.ServerPropertiesDialogPanel#cancelButtonActionPerformed()
82
	 */
83
	protected void cancelButtonActionPerformed() {        
84
		PluginServices.getMDIManager().closeWindow(this);
85
	} 
86

  
87
	
88
	/*
89
	 * (non-Javadoc)
90
	 * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
91
	 */
92
	public WindowInfo getWindowInfo() {
93
		if (m_windowinfo == null){
94
			m_windowinfo = new WindowInfo(WindowInfo.MODALDIALOG);
95
			m_windowinfo.setTitle(Messages.getText("propertiesNameWindow"));
96
			m_windowinfo.setWidth(500);
97
			m_windowinfo.setHeight(280);
98
		}
99
		return m_windowinfo;
100
	}
101
	public Object getWindowProfile(){
102
		return WindowInfo.DIALOG_PROFILE;
103
	}
104

  
105
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/SearchDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog.gui;
42

  
43
import java.awt.Frame;
44
import java.awt.geom.Rectangle2D;
45

  
46
import javax.swing.Icon;
47
import javax.swing.JDialog;
48

  
49
import org.gvsig.andami.IconThemeHelper;
50
import org.gvsig.andami.PluginServices;
51
import org.gvsig.andami.ui.mdiManager.IWindow;
52
import org.gvsig.andami.ui.mdiManager.WindowInfo;
53
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
54
import org.gvsig.catalog.CatalogClient;
55
import org.gvsig.catalog.drivers.GetRecordsReply;
56
import org.gvsig.catalog.querys.Coordinates;
57
import org.gvsig.catalog.ui.search.SearchDialogPanel;
58
import org.gvsig.catalog.utils.Frames;
59
import org.gvsig.fmap.mapcontext.events.ColorEvent;
60
import org.gvsig.fmap.mapcontext.events.ExtentEvent;
61
import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
62
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener;
63
import org.gvsig.i18n.Messages;
64

  
65

  
66
/**
67
 * This class is used to search a record using the catalog client
68
 * @author luisw
69
 * @modified by Jorge Piera
70
 */
71
public class SearchDialog extends SearchDialogPanel implements
72
IWindow,ViewPortListener {    
73
	public WindowInfo m_windowInfo = null;
74
	public ConnectDialog parentDialog = null;
75
	public JDialog frame = null;
76

  
77
	public SearchDialog(CatalogClient client, Object serverConnectFrame) {
78
		super(client,serverConnectFrame);
79
		parentDialog = (ConnectDialog)serverConnectFrame;
80
		setViewChangeListener();		
81
		loadViewPortCoordinates();
82
	}
83

  
84
	/* (non-Javadoc)
85
	 * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
86
	 */
87
	public WindowInfo getWindowInfo() {
88
		if (m_windowInfo == null){
89
			m_windowInfo = new WindowInfo(WindowInfo.PALETTE);
90
			m_windowInfo.setTitle(Messages.getText("gazetteer_search") + " [" +
91
					getCurrentServer() + "]");		
92
			m_windowInfo.setHeight(80);
93
			m_windowInfo.setWidth(525);
94
		}
95
		return m_windowInfo;
96

  
97
	}
98
	public Object getWindowProfile(){
99
		return WindowInfo.TOOL_PROFILE;
100
	}
101

  
102
	protected void showResultsActionPerformed(GetRecordsReply recordsReply) {
103
		JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
104
		Frames.centerFrame(panel,620,420);
105
		panel.setTitle(Messages.getText( "search_results")); 
106
		panel.setResizable(false);
107
		ShowResultsDialog dialog = new ShowResultsDialog(panel,
108
				client,
109
				recordsReply,
110
				1);
111
		panel.getContentPane().add(dialog);
112
		panel.setVisible(true); 
113
	}
114

  
115
	protected void closeButtonActionPerformed() {
116
		closeJDialog();
117
	}
118

  
119
	/**
120
	 * Size button action performed
121
	 */	 
122
	protected void resizeButtonActionPerformed(){
123
		if (isMinimized){
124
			frame.setSize(frame.getWidth(),495);
125
			getLowerPanel().setVisible(true);
126
			getUpperPanel().setIcon(getUpIcon());
127
		}else{
128
			frame.setSize(frame.getWidth(),165);
129
			getLowerPanel().setVisible(false);	 			
130
			getUpperPanel().setIcon(getDownIcon());
131
		}
132
		isMinimized = !isMinimized;
133
	}
134
	
135
	/*
136
	 * (non-Javadoc)
137
	 * @see org.gvsig.catalog.ui.search.SearchDialogPanel#getUpIcon()
138
	 */
139
	protected Icon getUpIcon(){
140
	    // catalog-move-down
141
        // catalog-move-up
142
        // catalog-server-properties
143
        return IconThemeHelper.getImageIcon("catalog-move-up");
144
	}
145
	
146
	/*
147
	 * (non-Javadoc)
148
	 * @see org.gvsig.catalog.ui.search.SearchDialogPanel#getDownIcon()
149
	 */
150
	protected Icon getDownIcon() {
151
        // catalog-move-down
152
        // catalog-move-up
153
        // catalog-server-properties
154
        return IconThemeHelper.getImageIcon("catalog-move-down");
155
	}
156
	
157
	/**
158
	 * Return button action
159
	 */
160
	protected void lastButtonActionPerformed() {  
161
		closeJDialog();
162
		ConnectDialog serverConnect = (ConnectDialog)serverConnectFrame;
163
		serverConnect.setVisible(true);
164
		serverConnect.getControlsPanel().enableSearchButton(false);
165
		PluginServices.getMDIManager().addWindow(serverConnect);
166
	} 
167

  
168
	public void closeJDialog() {
169
		frame.setVisible(false);
170
	}
171

  
172
	/**
173
	 * This method loads the view coordinates to the catalog search dialog
174
	 *
175
	 */
176
	private void loadViewPortCoordinates(){
177
		AbstractViewPanel activeView = 
178
			(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
179

  
180
		Rectangle2D r2d= activeView.getMapControl().getViewPort().getExtent();
181

  
182
		try{
183
			getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(),
184
					r2d.getMaxY(),
185
					r2d.getMaxX(),
186
					r2d.getMinY()));
187
		}catch(NullPointerException E){
188
			//We cant retrieve the coordinates if it doesn't 
189
			//exist a loaded layer
190
		}
191
	}
192
	/*
193
	 * This method joins the viewPort event to the listener
194
	 */
195
	private void setViewChangeListener(){
196
		AbstractViewPanel activeView = 
197
			(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
198

  
199
		activeView.getMapControl().getViewPort().addViewPortListener(this);
200

  
201
	}
202

  
203
	public void extentChanged(ExtentEvent e) {
204
		loadViewPortCoordinates();   
205

  
206
	}
207

  
208
	public void backColorChanged(ColorEvent e) {
209
		// TODO Auto-generated method stub
210

  
211
	}
212

  
213
	public void projectionChanged(ProjectionEvent e) {
214
		loadViewPortCoordinates();		
215
	}
216

  
217
	public void setFrame(JDialog frame) {
218
		this.frame = frame;
219
	} 	 	    
220
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ChooseResourceDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog.gui;
42

  
43
import java.lang.reflect.InvocationTargetException;
44
import java.util.Collection;
45

  
46
import javax.swing.JOptionPane;
47

  
48
import org.gvsig.andami.PluginServices;
49
import org.gvsig.andami.ui.mdiManager.IWindow;
50
import org.gvsig.andami.ui.mdiManager.WindowInfo;
51
import org.gvsig.catalog.CatalogLocator;
52
import org.gvsig.catalog.CatalogManager;
53
import org.gvsig.catalog.loaders.LayerLoader;
54
import org.gvsig.catalog.loaders.LayerLoaderException;
55
import org.gvsig.catalog.schemas.Resource;
56
import org.gvsig.catalog.ui.chooseresource.ChooseResourceDialogPanel;
57
import org.gvsig.i18n.Messages;
58

  
59

  
60

  
61
/**
62
 * This class implements the resources list view.
63
 * 
64
 * @author Jorge Piera Llodra (piera_jor@gva.es)
65
 */
66
public class ChooseResourceDialog extends ChooseResourceDialogPanel
67
implements IWindow {
68
	private static final CatalogManager catalogManager = CatalogLocator.getCatalogManager();
69
	/**
70
	 * @param resources
71
	 * Found resources array
72
	 */
73
	public ChooseResourceDialog(Collection resources) {
74
		super(resources);
75
	}   
76
	
77
	public WindowInfo getWindowInfo() {
78
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
79
		m_viewinfo.setTitle(getName());
80
		return m_viewinfo;
81
	}
82
	
83
	
84
	public Object getWindowProfile(){
85
		return WindowInfo.DIALOG_PROFILE;
86
	}
87
	
88
	public void closeButtonActionPerformed() {
89
		closeJDialog();
90
	}
91
	
92
	public void closeJDialog() {
93
		setVisible(true);
94
		PluginServices.getMDIManager().closeWindow(ChooseResourceDialog.this);
95
	}
96
	
97
	/**
98
	 * This method is invocated when a resource button is clicked
99
	 */
100
	public void resourceButtonActionPerformed(Resource resource){
101
		LayerLoader loader = null;
102
		try {
103
			loader = catalogManager.getLayerLoader(resource);
104
			if (loader != null) {
105
				loader.loadLayer();
106
			} else {
107
				JOptionPane.showMessageDialog(this,
108
						Messages.getText("pluginNotFound") ,
109
						Messages.getText("pluginNotFoundTitle"),			
110
						JOptionPane.INFORMATION_MESSAGE);	
111
				return;
112
			}
113
			
114
		} catch (IllegalArgumentException e) {
115
			// TODO Auto-generated catch block
116
			e.printStackTrace();
117
		} catch (SecurityException e) {
118
			// TODO Auto-generated catch block
119
			e.printStackTrace();
120
		} catch (InstantiationException e) {
121
			// TODO Auto-generated catch block
122
			e.printStackTrace();
123
		} catch (IllegalAccessException e) {
124
			// TODO Auto-generated catch block
125
			e.printStackTrace();
126
		} catch (InvocationTargetException e) {
127
			// TODO Auto-generated catch block
128
			e.printStackTrace();
129
		} catch (NoSuchMethodException e) {
130
			// TODO Auto-generated catch block
131
			e.printStackTrace();
132
		} catch (LayerLoaderException e) {
133
			JOptionPane.showMessageDialog(this,
134
					e.getMessage(),
135
					e.getWindowMessage(),			
136
					JOptionPane.ERROR_MESSAGE);	
137
		}		
138
		closeJDialog();
139
	}   
140
}
141

  
142

  
143

  
144

  
145

  
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/gui/ConnectDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog.gui;
42

  
43
import java.awt.Frame;
44

  
45
import javax.swing.Icon;
46
import javax.swing.JDialog;
47

  
48
import org.gvsig.andami.IconThemeHelper;
49
import org.gvsig.andami.PluginServices;
50
import org.gvsig.andami.persistence.serverData.ServerDataPersistence;
51
import org.gvsig.andami.ui.mdiManager.IWindow;
52
import org.gvsig.andami.ui.mdiManager.WindowInfo;
53
import org.gvsig.catalog.drivers.ICatalogServiceDriver;
54
import org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel;
55
import org.gvsig.catalog.utils.Frames;
56
import org.gvsig.i18n.Messages;
57
import org.gvsig.utils.swing.jcomboServer.ServerData;
58

  
59

  
60
/**
61
 * Inicia la consulta de cat?logo de metadatos
62
 *
63
 * @author luisw
64
 */
65
public class ConnectDialog extends ServerConnectDialogPanel implements IWindow {
66
	public WindowInfo m_windowInfo = null;
67

  
68
	/**
69
	 * Constructor de la ventana de dialogo.
70
	 */
71
	public ConnectDialog() {
72
		super(null);
73
		init();
74
	}
75

  
76
	/**
77
	 * Inicializa el Dialog
78
	 */
79
	private void init() {
80
		this.setBounds(0, 0, 597, 238);
81
		setName("connectDialog");
82
	}
83

  
84
	/**
85
	 * Add a server
86
	 *
87
	 * @param server
88
	 */
89
	public static void addServer(ServerData server) {
90
		ServerConnectDialogPanel.addTreeMapServer(server);
91
	}
92

  
93
	/**
94
	 * Search Button action
95
	 */
96
	protected void searchButtonActionPerformed() {
97
		addCurrentHost();
98
		closeJDialog();
99

  
100
		JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false);
101
		Frames.centerFrame(panel,525,165);
102
		panel.setTitle(Messages.getText( "catalog_search")); 
103
		SearchDialog dialog = new SearchDialog(getClient(),this);
104
		dialog.setCurrentServer(getCurrentServer());
105
		dialog.setFrame(panel);
106
		panel.getContentPane().add(dialog);
107
		panel.setVisible(true);   
108
	}
109

  
110
	/**
111
	 * Save the current host (if is neccessary) in a file using the andami
112
	 * persistence
113
	 */
114
	private void addCurrentHost() {
115
		String host = getClient().getSUri();
116
		ServerDataPersistence persistence = new ServerDataPersistence(ServerData.SERVER_TYPE_CATALOG);
117
		ServerData newServerData = new ServerData(host, ServerData.SERVER_TYPE_CATALOG, getClient().getProtocol(),getControlsPanel().getDatabase());
118
		if (client.getServerData() != null){
119
			if ((client.getServerData() .getServerAddress().compareTo(newServerData.getServerAddress()) == 0) &&
120
					(client.getServerData() .getServiceSubType().compareTo(newServerData.getServiceSubType()) == 0)){
121
				newServerData.setProperies(client.getServerData().getProperies());
122
			}
123
		}
124
		persistence.addServerData(newServerData);
125
		// persistence..setPersistent();
126
	}
127

  
128
	/*
129
	 * (non-Javadoc)
130
	 * @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#closeButtonActionPerformed()
131
	 */
132
	protected void closeButtonActionPerformed() {   
133
		closeJDialog();
134
	}
135

  
136
	/*
137
	 * (non-Javadoc)
138
	 * @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#serverPropertiesButtonActionPerformed()
139
	 */
140
	protected void serverPropertiesButtonActionPerformed(){
141
		createClient();
142
		PluginServices.getMDIManager().addWindow(new ServerPropertiesDialog(
143
				getControlsPanel().getServer(),
144
				client,
145
				((ICatalogServiceDriver)getControlsPanel().getDriver()).getProfile(),
146
				null));
147
	}
148

  
149
	/**
150
	 * Close the dialog
151
	 */
152
	public void closeJDialog() {
153
		PluginServices.getMDIManager().closeWindow(ConnectDialog.this);
154
	}
155

  
156
	/* (non-Javadoc)
157
	 * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
158
	 */
159
	public WindowInfo getWindowInfo() {
160
		if (m_windowInfo == null){
161
			m_windowInfo = new WindowInfo(WindowInfo.MODALDIALOG);
162
			m_windowInfo.setTitle(Messages.getText("metadata_catalog"));
163
			m_windowInfo.setHeight(200);
164
			m_windowInfo.setWidth(600);
165
		}
166
		return m_windowInfo;
167
	}
168
	public Object getWindowProfile(){
169
		return WindowInfo.DIALOG_PROFILE;
170
	}
171

  
172
	/* (non-Javadoc)
173
	 * @see org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel#getPropertiesIcon()
174
	 */	
175
	protected Icon getPropertiesIcon() {
176
	    // catalog-move-down
177
	    // catalog-move-up
178
	    // catalog-server-properties
179
	    return IconThemeHelper.getImageIcon("catalog-server-properties");
180
	}	
181
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/CatalogClientExtension.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog;
42

  
43
import java.util.Calendar;
44
import java.util.Date;
45
import java.util.GregorianCalendar;
46

  
47
import org.slf4j.Logger;
48
import org.slf4j.LoggerFactory;
49

  
50
import org.gvsig.andami.IconThemeHelper;
51
import org.gvsig.andami.PluginServices;
52
import org.gvsig.andami.persistence.serverData.ServerDataPersistence;
53
import org.gvsig.andami.plugins.Extension;
54
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
55
import org.gvsig.catalog.gui.ConnectDialog;
56
import org.gvsig.catalog.loaders.ARCIMSLayerLoader;
57
import org.gvsig.catalog.loaders.LinkLoader;
58
import org.gvsig.catalog.loaders.PostgisLayerLoader;
59
import org.gvsig.catalog.loaders.WCSLayerLoader;
60
import org.gvsig.catalog.loaders.WFSLayerLoader;
61
import org.gvsig.catalog.loaders.WMSLayerLoader;
62
import org.gvsig.catalog.schemas.Resource;
63
import org.gvsig.tools.ToolsLocator;
64
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
65
import org.gvsig.utils.swing.jcomboServer.ServerData;
66

  
67

  
68

  
69

  
70
/**
71
 * DOCUMENT ME!
72
 *
73
 * @author Luis W. Sevilla
74
 */
75
public class CatalogClientExtension extends Extension {
76
	private static final Logger LOG = LoggerFactory.getLogger(CatalogClientExtension.class);
77
	private static final String CATALOGLAYERS = "CatalogLayers";
78

  
79
	public void initialize() {
80
		ExtensionPointManager extensionPointManager = ToolsLocator
81
		    .getExtensionPointManager();
82
		extensionPointManager.add(CATALOGLAYERS, "List of possible layers that can be loaded from a catalog");
83
		registerIcons();
84
	}
85

  
86
	private void registerIcons(){
87
        IconThemeHelper.registerIcon("catalog", "catalog-move-down", this);
88
        IconThemeHelper.registerIcon("catalog", "catalog-move-up", this);
89
        IconThemeHelper.registerIcon("catalog", "catalog-server-properties", this);
90
        IconThemeHelper.registerIcon("catalog", "catalog-search", this);
91
	}
92

  
93
	public void postInitialize(){
94
		//Initialazing the layer loaders
95
		CatalogManager catalogManager = CatalogLocator.getCatalogManager();
96
		catalogManager.addLayerLoader(Resource.WMS, WMSLayerLoader.class);
97
		catalogManager.addLayerLoader(Resource.POSTGIS, PostgisLayerLoader.class);
98
		catalogManager.addLayerLoader(Resource.WCS, WCSLayerLoader.class);
99
		catalogManager.addLayerLoader(Resource.WEBSITE, LinkLoader.class);
100
		catalogManager.addLayerLoader(Resource.DOWNLOAD, LinkLoader.class);
101
		catalogManager.addLayerLoader(Resource.WFS, WFSLayerLoader.class);
102
		catalogManager.addLayerLoader(Resource.ARCIMS_IMAGE, ARCIMSLayerLoader.class);
103
		catalogManager.addLayerLoader(Resource.ARCIMS_VECTORIAL, ARCIMSLayerLoader.class);
104
	}
105

  
106
	public void execute(String actionCommand) {
107
		actionConnectDialogStart();
108
	}
109

  
110
	/**
111
	 * DOCUMENT ME!
112
	 */
113
	private void actionConnectDialogStart() {
114
		System.out.println("Bot?n Cliente de metadatos pulsado");
115
		restoreServerList();
116

  
117
		ConnectDialog connectDialog = new ConnectDialog();
118
		PluginServices.getMDIManager().addWindow(connectDialog);
119
	}
120

  
121
	/**
122
	 * It restores a server list. If this list does't exist it create  a server
123
	 * list by default.
124
	 */
125
	private void restoreServerList() {
126
		ServerDataPersistence persistence =
127
				new ServerDataPersistence(ServerData.SERVER_TYPE_CATALOG);
128

  
129
		ServerData[] servers = persistence.getArrayOfServerData();
130

  
131
		boolean found = false;
132
		for (int i=0 ; i<servers.length ; i++){
133
			if (servers[i].getServiceType().equals(ServerData.SERVER_TYPE_CATALOG)){
134
				found = true;
135
			}
136
		}       
137

  
138
		if (!found){
139
			if (servers.length == 0){
140
				servers = getDefaultServers();
141
			}else{
142
				ServerData[] newServers = new ServerData[servers.length + getDefaultServers().length ];
143
				System.arraycopy(servers, 0, newServers, 0, servers.length);
144
				System.arraycopy(getDefaultServers(), 0, newServers, servers.length, getDefaultServers().length);
145
				servers = newServers;
146
			}
147
			persistence.setArrayOfServerData(servers);
148
		}
149

  
150

  
151
		for (int i = 0; i < servers.length; i++) {
152
			if (servers[i].getServiceType().equals(ServerData.SERVER_TYPE_CATALOG)){
153
				ConnectDialog.addServer(servers[i]);
154
			}
155
		}
156

  
157

  
158
	}
159

  
160
	/**
161
	 * It creates a server list by default
162
	 *
163
	 * @return
164
	 */
165
	private ServerData[] getDefaultServers() {
166
		ServerData[] servers = new ServerData[0];
167
		Calendar cal = new GregorianCalendar();
168
		Date date = cal.getTime();
169

  
170
		//servers[0] = new ServerData("http://delta.icc.es/indicio/csw", date, date, ServerData.SERVER_TYPE_CATALOG, ServerData.SERVER_SUBTYPE_CATALOG_CSW);
171
		//servers[1] = new ServerData("mapas.euitto.upm.es:2100", date, date, ServerData.SERVER_TYPE_CATALOG, ServerData.SERVER_SUBTYPE_CATALOG_Z3950);
172
		//servers[2] = new ServerData("193.43.36.137:2100", date, date, ServerData.SERVER_TYPE_CATALOG, ServerData.SERVER_SUBTYPE_CATALOG_Z3950);
173
		//servers[3] = new ServerData("http://idee.unizar.es/SRW/servlet/search/ExplainSOAP",date,date,ServerData.SERVER_TYPE_CATALOG,ServerData.SERVER_SUBTYPE_CATALOG_SRW);
174
		return servers;
175
	}
176

  
177
	public boolean isEnabled() {
178
		return true;
179
	}
180

  
181
	public boolean isVisible() {
182
		org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
183
		.getActiveWindow();
184

  
185
		if (f == null) {
186
			return false;
187
		}
188

  
189
		return (f instanceof AbstractViewPanel);
190
	}
191
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/loaders/PostgisLayerLoader.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog.loaders;
42

  
43
import java.util.StringTokenizer;
44
import java.util.TreeMap;
45

  
46
import org.gvsig.catalog.schemas.Resource;
47
import org.gvsig.catalog.utils.Strings;
48
import org.gvsig.fmap.dal.DataStoreParameters;
49
import org.gvsig.fmap.dal.exception.InitializeException;
50
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
51
import org.gvsig.i18n.Messages;
52

  
53

  
54

  
55
/**
56
 * This class is used to load a POSTGIS resource in gvSIG
57
 * 
58
 * @author Jorge Piera Llodra (piera_jor@gva.es)
59
 */
60

  
61
public class PostgisLayerLoader extends GvSigLayerLoader{
62
        
63
    public PostgisLayerLoader(Resource resource) {
64
        super(resource);
65
    }
66

  
67
    protected boolean hasSpecificLayer() {
68
        return false;
69
    }
70

  
71
    protected String getLayerName() {        
72
        return getResource().getName();
73
    }   
74
    
75
    protected DataStoreParameters createDataStoreParameters()
76
    throws InitializeException, ProviderNotRegisteredException {
77
        String jdbcUrl = getResource().getLinkage();
78
        String table = getResource().getName();
79
        
80
        DataStoreParameters dataStoreParameters = DATA_MANAGER.createStoreParameters("PostgreSQL");
81
        parseParams(dataStoreParameters, jdbcUrl, table);
82
        
83
        return dataStoreParameters;
84
    }
85

  
86
    private void parseParams(DataStoreParameters dataStoreParameters, String jdbcUrl, String table){
87
        StringTokenizer sti = new StringTokenizer(jdbcUrl,"?");
88
        String dbURL = sti.nextToken();
89
        String p = sti.nextToken();
90
        TreeMap map = separateParams(p);
91
        String user = (String) map.get((String) "USER");
92
        String pwd = (String) map.get((String) "PASSWORD");
93
        map = Strings.separateParams(table);
94
        dataStoreParameters.setDynValue("USER", user);
95
        dataStoreParameters.setDynValue("PASSWORD",pwd);        
96
        dataStoreParameters.setDynValue("WHERECLAUSE","");
97
        dataStoreParameters.setDynValue("DBURL",dbURL);        
98
    }
99

  
100
    private TreeMap separateParams(String pairValues){
101
        TreeMap map = new TreeMap(); 
102
        String[] params = pairValues.split("&");
103
        for (int i = 0; i < params.length; i++) {
104
            String[] nameValue = params[i].split("=");
105
            map.put(nameValue[0].toUpperCase(), nameValue[1]);
106
        }
107
        return map;
108
    }
109

  
110
    /*
111
     *  (non-Javadoc)
112
     * @see es.gva.cit.gvsig.catalogClient.loaders.LayerLoader#getErrorMessage()
113
     */
114
    protected String getErrorMessage() {
115
        return Messages.getText("postgisError") + ".\n" +
116
        Messages.getText("server") + ": " + 
117
        getResource().getLinkage() + "\n" +
118
        Messages.getText("parameters") + ": " +
119
        getResource().getName();
120
    }
121

  
122
    /*
123
     *  (non-Javadoc)
124
     * @see es.gva.cit.gvsig.catalogClient.loaders.LayerLoader#getWindowMessage()
125
     */
126
    protected String getWindowMessage() {
127
        return Messages.getText("postgisLoad");
128
    }
129

  
130

  
131
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/loaders/WCSLayerLoader.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.catalog.loaders;
42

  
43
import java.util.HashMap;
44
import java.util.Map;
45
import java.util.TreeMap;
46

  
47
import org.gvsig.andami.PluginServices;
48
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
49
import org.gvsig.catalog.schemas.Resource;
50
import org.gvsig.fmap.dal.DataStoreParameters;
51
import org.gvsig.fmap.dal.exception.InitializeException;
52
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
53
import org.gvsig.i18n.Messages;
54

  
55

  
56
/**
57
 * This class is used to load a WCS  layer in gvSIG
58
 * 
59
 * @author Jorge Piera Llodra (piera_jor@gva.es)
60
 */
61
public class WCSLayerLoader extends GvSigLayerLoader{
62
    private static final String FIELD_FORMAT = "format";
63
    private static final String FIELD_NAME = "name";
64
    private static final String FIELD_SRSSTR = "srsstr";
65
    private static final String FIELD_URI = "uri";
66
    private static final String FIELD_ONLINERESOURC = "onlineresources";
67
    private static final String FIELD_WIDTH = "width";
68
    private static final String FIELD_HEIGHT = "height";
69
    private static final String FIELD_PARAM = "parameter";
70
    
71
    public WCSLayerLoader(Resource resource) {
72
        super(resource);
73
    }	
74

  
75
    protected boolean hasSpecificLayer() {        
76
        return true;
77
    }
78

  
79
    protected String getLayerName() {      
80
        return getResource().getName();
81
    } 
82

  
83
    protected DataStoreParameters createDataStoreParameters()
84
    throws InitializeException, ProviderNotRegisteredException {
85
        DataStoreParameters dataStoreParameters = DATA_MANAGER.createStoreParameters("Wcs Store");
86
        
87
        parseQuery(dataStoreParameters, getResource().getLinkage());        
88
        dataStoreParameters.setDynValue(FIELD_NAME, getLayerName());
89
        dataStoreParameters.setDynValue(FIELD_ONLINERESOURC, createOnlineResources());
90
        return dataStoreParameters;
91
    }
92
    
93
    protected Map createOnlineResources() {
94
        Map args = new HashMap();
95
        args.put("GepCoverage", getResource().getLinkage());      
96
        return args;
97
    }
98

  
99
    protected String extensionPointName() {
100
        return "OGC:WCS";
101
    }
102

  
103
    /**
104
     * Builds a coverage starting from a full GetCoverage URL.
105
     * (Using this is not a regular function)
106
     */
107
    private void parseQuery(DataStoreParameters dataStoreParameters, String link){
108
                
109
        String host = null;
110
        String queryString = null;
111
        int index = link.indexOf("?");
112
        if (index > 0){        
113
            host = link.substring(0, index);
114
            queryString = link.substring(index+1);
115
        }else{
116
            host = link;
117
            queryString = "";
118
        }
119
        
120
        queryString = link.substring(link.indexOf('?')+1);
121
        dataStoreParameters.setDynValue(FIELD_URI, link.substring(0,link.indexOf('?')));
122
               
123
        String[] params = queryString.split("&");
124
        for (int i = 0; i < params.length; i++) {
125
            if (params[i]!= null){
126
                String[] nameValue = params[i].split("=");
127
                if(nameValue.length == 2){
128
                    String param = nameValue[0].toUpperCase();
129
                    if (param.equals("CRS")){
130
                        dataStoreParameters.setDynValue(FIELD_SRSSTR, nameValue[1]);
131
                    }else if (param.equals("FORMAT")){
132
                        dataStoreParameters.setDynValue(FIELD_FORMAT, nameValue[1]);
133
                    }else if (param.equals("WIDTH")){
134
                        dataStoreParameters.setDynValue(FIELD_WIDTH, nameValue[1]);
135
                    }else if (param.equals("HEIGHT")){
136
                        dataStoreParameters.setDynValue(FIELD_HEIGHT, nameValue[1]);
137
                    }else if (param.equals("BANDS")){
138
                        dataStoreParameters.setDynValue(FIELD_PARAM, nameValue[1]);
139
                    }                   
140
                }
141
            }
142
        }  
143
    }	
144

  
145
    protected String getErrorMessage() {
146
        return Messages.getText("wcsError") + ".\n" +
147
        Messages.getText("link") + ": " + 
148
        getResource().getLinkage();		
149
    }
150

  
151
    protected String getWindowMessage() {
152
        return Messages.getText("wcsLoad");
153
    }	
154
}
org.gvsig.catalog/tags/org.gvsig.catalog-2.0.0/org.gvsig.catalog.extension/src/main/java/org/gvsig/catalog/loaders/ARCIMSLayerLoader.java
1
package org.gvsig.catalog.loaders;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import org.gvsig.andami.PluginServices;
7
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
8
import org.gvsig.catalog.schemas.Resource;
9
import org.gvsig.fmap.dal.DataStoreParameters;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff