Search in sources :

Example 6 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class RenderTransformationDialog method populateFunctionList.

/**
 * Populate function list.
 *
 * @param selectedItem the selected item
 */
private void populateFunctionList(String selectedItem) {
    GeoServerConnection connection = connectionMap.get(selectedItem);
    String message = String.format("%s : %s", Localisation.getString(RenderTransformationDialog.class, "RenderTransformationDialog.tryingToConnect"), connection.getUrl().toString());
    showMessage(message, false);
    // Make sure the above messages are displayed by trying to connect to
    // a WPS server in a separate thread.
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            client = new GeoServerWPSClient(connection);
            if (client.getCapabilities()) {
                availableFunctionList = client.getRenderTransformations(DataTypeEnum.E_VECTOR);
                functionListModel.removeAllElements();
                populateBuiltInProcessFunctions();
                for (ProcessBriefType function : availableFunctionList) {
                    functionListModel.addElement(function.getIdentifier().getValue());
                }
                // Clear info field
                showMessage("", false);
            } else {
                // Show error message
                showMessage(Localisation.getString(RenderTransformationDialog.class, "RenderTransformationDialog.errorFailedToConnect"), true);
            }
            // Make ui available again
            updateButtonState(true);
        }
    });
}
Also used : GeoServerWPSClient(com.sldeditor.extension.filesystem.geoserver.client.GeoServerWPSClient) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) ProcessBriefType(net.opengis.wps10.ProcessBriefType)

Example 7 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class RenderTransformationDialog method main.

/**
 * The main method.
 *
 * @param args the arguments
 */
public static void main(String[] args) {
    GeoServerConnectionManagerInterface dummyInterface = new GeoServerConnectionManagerInterface() {

        @Override
        public List<GeoServerConnection> getConnectionList() {
            List<GeoServerConnection> list = new ArrayList<GeoServerConnection>();
            GeoServerConnection connection = new GeoServerConnection();
            connection.setConnectionName("Test");
            try {
                connection.setUrl(new URL("http://localhost:8080/geoserver"));
                connection.setUserName("admin");
                connection.setPassword("geoserver");
                list.add(connection);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
            return list;
        }

        @Override
        public void updateList() {
        }

        @Override
        public GeoServerConnection getConnection(String connectionDataName) {
            return null;
        }

        @Override
        public void readPropertyFile(GeoServerReadProgress progress) {
        }

        @Override
        public Map<GeoServerConnection, GeoServerClientInterface> getConnectionMap() {
            return null;
        }

        @Override
        public void removeConnection(GeoServerConnection connection) {
        }

        @Override
        public void addNewConnection(GeoServerReadProgress progress, GeoServerConnection newConnectionDetails) {
        }
    };
    List<VersionData> vendorOptionList = new ArrayList<VersionData>();
    vendorOptionList.add(VersionData.getLatestVersion(GeoServerVendorOption.class));
    VendorOptionManager.getInstance().setSelectedVendorOptions(vendorOptionList);
    RenderTransformationDialog dlg = new RenderTransformationDialog(dummyInterface);
    dlg.showDialog(null);
}
Also used : MalformedURLException(java.net.MalformedURLException) GeoServerVendorOption(com.sldeditor.common.vendoroption.GeoServerVendorOption) ArrayList(java.util.ArrayList) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) URL(java.net.URL) GeoServerClientInterface(com.sldeditor.extension.filesystem.geoserver.client.GeoServerClientInterface) VersionData(com.sldeditor.common.vendoroption.VersionData) GeoServerConnectionManagerInterface(com.sldeditor.common.connection.GeoServerConnectionManagerInterface) GeoServerReadProgress(com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress)

Example 8 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class RenderTransformationDialog method populateConnectionComboBox.

/**
 * Populate connection combo box.
 */
private void populateConnectionComboBox() {
    connectionComboBox.removeAllItems();
    if (geoServerConnectionManager != null) {
        List<GeoServerConnection> connectionList = geoServerConnectionManager.getConnectionList();
        for (GeoServerConnection connection : connectionList) {
            connectionComboBox.addItem(connection.getConnectionName());
            connectionMap.put(connection.getConnectionName(), connection);
        }
    }
}
Also used : GeoServerConnection(com.sldeditor.common.data.GeoServerConnection)

Example 9 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class ConnectorDetailsPanel method getConnectionDetails.

/**
 * Gets the connection details.
 *
 * @return the connection details
 */
private GeoServerConnection getConnectionDetails() {
    GeoServerConnection newConnectionDetails = new GeoServerConnection();
    newConnectionDetails.setConnectionName(textFieldName.getText());
    newConnectionDetails.setUserName(textFieldUsername.getText());
    URL url = null;
    try {
        url = new URL(textFieldURL.getText());
    } catch (MalformedURLException e) {
    // Do nothing
    }
    newConnectionDetails.setUrl(url);
    newConnectionDetails.setPassword(new String(textFieldPassword.getPassword()));
    return newConnectionDetails;
}
Also used : MalformedURLException(java.net.MalformedURLException) GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) URL(java.net.URL)

Example 10 with GeoServerConnection

use of com.sldeditor.common.data.GeoServerConnection in project sldeditor by robward-scisys.

the class GeoServerConnectionTest method testGetUserName.

/**
 * Test method for {@link com.sldeditor.common.data.GeoServerConnection#getUserName()}.
 * Test method for {@link com.sldeditor.common.data.GeoServerConnection#setUserName(java.lang.String)}.
 */
@Test
public void testGetUserName() {
    GeoServerConnection connection = new GeoServerConnection();
    String userName = "test user name";
    connection.setUserName(userName);
    assertEquals(connection.getUserName(), userName);
}
Also used : GeoServerConnection(com.sldeditor.common.data.GeoServerConnection) Test(org.junit.Test)

Aggregations

GeoServerConnection (com.sldeditor.common.data.GeoServerConnection)50 Test (org.junit.Test)31 URL (java.net.URL)12 ArrayList (java.util.ArrayList)11 StyleWrapper (com.sldeditor.common.data.StyleWrapper)10 GeoServerInput (com.sldeditor.extension.filesystem.geoserver.GeoServerInput)9 SLDFileHandlerTest (com.sldeditor.test.unit.extension.filesystem.file.sld.SLDFileHandlerTest)9 MalformedURLException (java.net.MalformedURLException)9 GeoServerNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerNode)8 SLDData (com.sldeditor.common.data.SLDData)7 GeoServerLayer (com.sldeditor.common.data.GeoServerLayer)5 GeoServerOverallNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerOverallNode)5 GeoServerWorkspaceNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerWorkspaceNode)5 GeoServerReadProgress (com.sldeditor.extension.filesystem.geoserver.GeoServerReadProgress)5 GeoServerClientInterface (com.sldeditor.extension.filesystem.geoserver.client.GeoServerClientInterface)5 HashMap (java.util.HashMap)5 List (java.util.List)5 SLDDataInterface (com.sldeditor.common.SLDDataInterface)4 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4