Package org.geoserver.config

Examples of org.geoserver.config.ServiceInfo


        final String serviceId = service.getId();
        if (serviceId == null) {
            throw new NullPointerException("service id must not be null");
        }

        ServiceInfo existing = getService(serviceId);

        if (existing != null) {
            throw new IllegalArgumentException("service with id '" + serviceId + "' already exists");
        }
View Full Code Here


        // persist services
        Collection<? extends ServiceInfo> services = geoserver.getServices();
        List<ServiceLoader> loaders = GeoServerExtensions.extensions(ServiceLoader.class);

        for (Iterator<? extends ServiceInfo> s = services.iterator(); s.hasNext();) {
            ServiceInfo service = (ServiceInfo) s.next();
            for (ServiceLoader loader : loaders) {
                if (loader.getServiceClass().equals(service.getClass())) { // TODO ETJ FIXMEEEEEEE
                    try {
                        loader.save(service, geoserver);
                        break;
                    } catch (Throwable t) {
                        LOGGER.warning("Error persisting service: " + service.getId());
                        LOGGER.log(Level.INFO, "", t);
                    }
                }
            }
        }
View Full Code Here

        GeoServerInfo config = geoServer.getFactory().createGlobal();
        geoServer.setGlobal(config);

        removeServices();

        ServiceInfo info = geoServer.getFactory().createService();
        info.setName("foo");
        ((ServiceInfoImpl) info).setId("foo");
        info.setMetadataLink(catalog.getFactory().createMetadataLink());
        info.getMetadataLink().setAbout("about");
        geoServer.add(info);

        info = geoServer.getFactory().createService();
        ((ServiceInfoImpl) info).setId("bar");
        info.setName("bar");
        info.setMetadataLink(catalog.getFactory().createMetadataLink());
        info.getMetadataLink().setAbout("about");
        geoServer.add(info);

        endTransaction();

        startNewTransaction();
        Collection services = geoServer.getServices();
        assertEquals(2, services.size());

        Iterator i = services.iterator();
        info = (ServiceInfo) i.next();
        assertEquals("foo", info.getName());
        assertNotNull(info.getGeoServer());

        info = (ServiceInfo) i.next();
        assertEquals("bar", info.getName());
        assertNotNull(info.getGeoServer());
    }
View Full Code Here

        GeoServerInfo g2 = geoServer.getGlobal();
        assertEquals("newAdminPassword", g2.getAdminPassword());
    }

    public void testAddService() throws Exception {
        ServiceInfo service = geoServer.getFactory().createService();
        service.setName("testAddService");

        try {
            geoServer.add(service);
            fail("adding without id should throw exception");
        } catch (Exception e) {
            assertTrue(true);
        }

        ((ServiceInfoImpl) service).setId("id");
        geoServer.add(service);

        ServiceInfo s2 = geoServer.getFactory().createService();
        ((ServiceInfoImpl) s2).setId("id");
        s2.setName("testAddService2");

        try {
            geoServer.add(s2);
            fail("adding service with duplicate id should throw exception");
        } catch (Exception e) {
            assertTrue(true);
        }

        ServiceInfo s = geoServer.getServiceByName("testAddService", ServiceInfo.class);
        assertNotNull(s);
        assertEquals(service, s);
    }
View Full Code Here

        assertNotNull(s);
        assertEquals(service, s);
    }

    public void testModifyService() throws Exception {
        ServiceInfo service = geoServer.getFactory().createService();
        ((ServiceInfoImpl) service).setId("testModifyServiceID");
        service.setName("testModifyService");
        service.setTitle("bar");

        geoServer.add(service);

        ServiceInfo s1 = geoServer.getServiceByName("testModifyService", ServiceInfo.class);
        assertEquals("bar", s1.getTitle());

        s1.setTitle("changed");
        geoServer.save(s1);

        ServiceInfo s2 = geoServer.getServiceByName("testModifyService", ServiceInfo.class);

        assertEquals("changed", s2.getTitle());
    }
View Full Code Here

        // when hacking this service listing code please refer to
        // http://jira.codehaus.org/browse/GEOS-2114
        ListView view = new ListView("services", getServices()) {
            @Override
            protected void populateItem(ListItem item) {
                ServiceInfo service = (ServiceInfo) item.getModelObject();
                final String serviceId = service.getId();
                item.add( new Label("service", service.getId().toUpperCase()) );
                item.add( new ListView( "versions", service.getVersions()) {
                    @Override
                    protected void populateItem(ListItem item) {
                        Version version = (Version) item.getModelObject();
                        ExternalLink link = new ExternalLink("link", "../ows?service=" + serviceId
                                + "&version=" + version.toString() + "&request=GetCapabilities");
View Full Code Here

        // read services
        for ( LegacyServiceLoader sl : GeoServerExtensions.extensions( LegacyServiceLoader.class ) ) {
            try {
                sl.setReader(reader);
               
                ServiceInfo service = sl.load( geoServer );
                if ( service != null ) {
                    LOGGER.info( "Loading service '" + service.getId()  + "'");
                    geoServer.add( service );
                }
            }
            catch( Exception e ) {
                String msg = "Error occured loading service: " + sl.getServiceClass().getSimpleName();
View Full Code Here

            return false;
        if (!( obj instanceof ServiceInfo ) ) {
            return false;
        }
       
        final ServiceInfo other = (ServiceInfo) obj;
        if (abstrct == null) {
            if (other.getAbstract() != null)
                return false;
        } else if (!abstrct.equals(other.getAbstract()))
            return false;
        if (accessConstraints == null) {
            if (other.getAccessConstraints() != null)
                return false;
        } else if (!accessConstraints.equals(other.getAccessConstraints()))
            return false;
        if (citeCompliant != other.isCiteCompliant())
            return false;
        if (enabled != other.isEnabled())
            return false;
        if (exceptionFormats == null) {
            if (other.getExceptionFormats() != null)
                return false;
        } else if (!exceptionFormats.equals(other.getExceptionFormats()))
            return false;
        if (fees == null) {
            if (other.getFees() != null)
                return false;
        } else if (!fees.equals(other.getFees()))
            return false;
        if (id == null) {
            if (other.getId() != null)
                return false;
        } else if (!id.equals(other.getId()))
            return false;
        if (keywords == null) {
            if (other.getKeywords() != null)
                return false;
        } else if (!keywords.equals(other.getKeywords()))
            return false;
        if (maintainer == null) {
            if (other.getMaintainer() != null)
                return false;
        } else if (!maintainer.equals(other.getMaintainer()))
            return false;
        if (metadataLink == null) {
            if (other.getMetadataLink() != null)
                return false;
        } else if (!metadataLink.equals(other.getMetadataLink()))
            return false;
        if (name == null) {
            if (other.getName() != null)
                return false;
        } else if (!name.equals(other.getName()))
            return false;
        if (onlineResource == null) {
            if (other.getOnlineResource() != null)
                return false;
        } else if (!onlineResource.equals(other.getOnlineResource()))
            return false;
        if (outputStrategy == null) {
            if (other.getOutputStrategy() != null)
                return false;
        } else if (!outputStrategy.equals(other.getOutputStrategy()))
            return false;
        if (schemaBaseURL == null) {
            if (other.getSchemaBaseURL() != null)
                return false;
        } else if (!schemaBaseURL.equals(other.getSchemaBaseURL()))
            return false;
        if (title == null) {
            if (other.getTitle() != null)
                return false;
        } else if (!title.equals(other.getTitle()))
            return false;
        if (verbose != other.isVerbose())
            return false;
        if (versions == null) {
            if (other.getVersions() != null)
                return false;
        } else if (!versions.equals(other.getVersions()))
            return false;
        return true;
    }
View Full Code Here

   
    @Test
    public void testAddService() throws Exception {
        assertEquals(0, dao.getServices().size());
       
        ServiceInfo service = dao.getGeoServer().getFactory().createService();
        ((ServiceInfoImpl)service).setId("someService");
        service.setName("someName");
       
        dao.add(service);
        assertEquals(1, dao.getServices().size());
       
        assertEquals(service, dao.getServices().iterator().next());
View Full Code Here

   
    @Test
    public void testModifyService() throws Exception {
        testAddService();
       
        ServiceInfo service = dao.getServiceByName("someName", ServiceInfo.class);
        service.setName("someOtherName");
        dao.save(service);
       
        assertNull(dao.getServiceByName("someName", ServiceInfo.class));
        assertNotNull(dao.getServiceByName("someOtherName", ServiceInfo.class));
    }
View Full Code Here

TOP

Related Classes of org.geoserver.config.ServiceInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.