Package org.geoserver.catalog

Examples of org.geoserver.catalog.Catalog


     *             DOCUMENT ME!
     * @throws IOException
     *             DOCUMENT ME!
     */
    public void testBlueLake() throws IOException, IllegalFilterException, Exception {
        final Catalog catalog = getCatalog();
        org.geoserver.catalog.FeatureTypeInfo typeInfo = catalog.getFeatureTypeByName(MockData.LAKES.getNamespaceURI(), MockData.LAKES.getLocalPart());
        Envelope env = typeInfo.getFeatureSource(null, null).getBounds();
        double shift = env.getWidth() / 6;

        env = new Envelope(env.getMinX() - shift, env.getMaxX() + shift, env.getMinY() - shift, env
                .getMaxY()
View Full Code Here


     *
     * @throws Exception
     *             DOCUMENT ME!
     */
    private void testDefaultStyle(FeatureSource fSource) throws Exception {
        Catalog catalog = getCatalog();
        Style style = catalog.getStyleByName("Default").getStyle();

        FeatureTypeInfo typeInfo = catalog.getFeatureTypeByName(MockData.LAKES.getNamespaceURI(), MockData.LAKES.getLocalPart());
        Envelope env = typeInfo.getFeatureSource(null, null).getBounds();
        env.expandToInclude(fSource.getBounds());

        int w = 400;
        int h = (int) Math.round((env.getHeight() * w) / env.getWidth());
View Full Code Here

     * @return A new map layer.
     */
    protected MapLayer createMapLayer(QName layerName, String styleName)
        throws IOException {
        //TODO: support coverages
        Catalog catalog = getCatalog();
        org.geoserver.catalog.FeatureTypeInfo info = catalog.getFeatureTypeByName(layerName.getNamespaceURI(), layerName.getLocalPart());
        LayerInfo layerInfo = catalog.getLayerByName(layerName.getLocalPart());
        Style style = layerInfo.getDefaultStyle().getStyle();
        if(styleName != null){
            style = catalog.getStyleByName(styleName).getStyle();
        }
       
        FeatureSource<? extends FeatureType, ? extends Feature> featureSource;
        featureSource = info.getFeatureSource(null, null);
       
View Full Code Here

        return mapContext.getRequest().getServiceConfig().getGeoServer().getCatalog();
    }
   
    public Dimension findOptimalSize(Graphics2D g2d, WMSMapContext mapContext){
        int x = 0, y = 0;
        Catalog catalog = findCatalog(mapContext);
        FontMetrics metrics = g2d.getFontMetrics(g2d.getFont().deriveFont(Font.BOLD));
        double scaleDenominator = RendererUtilities.calculateOGCScale(
                mapContext.getAreaOfInterest(),
                mapContext.getRequest().getWidth(),
                null
View Full Code Here

        return new Dimension(x, y);
    }

    public void paint(Graphics2D g2d, Rectangle paintArea, WMSMapContext mapContext)
    throws Exception {
      Catalog catalog = mapContext.getRequest().getServiceConfig().getGeoServer().getCatalog();
        Dimension d = findOptimalSize(g2d, mapContext);
        Rectangle bgRect = new Rectangle(0, 0, d.width, d.height);
        double scaleDenominator = RendererUtilities.calculateOGCScale(
            mapContext.getAreaOfInterest(),
            mapContext.getRequest().getWidth(),
View Full Code Here

                new ParamResourceModel("rollback", this),
                new ParamResourceModel("confirmRollback", this)) {
           
            @Override
            protected void onClick(AjaxRequestTarget target) {
                Catalog catalog = getCatalog();
                CascadeDeleteVisitor deleteVisitor = new CascadeDeleteVisitor(catalog);
                String project = summary.getProject();
                if(summary.isWorkspaceNew()) {
                    WorkspaceInfo ws = catalog.getWorkspaceByName(project);
                    if(ws != null)
                        ws.accept(deleteVisitor);
                } else if(summary.isStoreNew()) {
                    StoreInfo si = catalog.getStoreByName(project, project, StoreInfo.class);
                    if(si != null)
                        si.accept(deleteVisitor);
                } else {
                    // just remove the layers we created
                    for (LayerSummary layer : summary.getLayers()) {
                        catalog.remove(layer.getLayer());
                        catalog.remove(layer.getLayer().getResource());
                    }
                }
                setResponsePage(ImportPage.class, new PageParameters("afterCleanup=true"));
            }
        });
View Full Code Here

        }
       
        Authentication auth = getSession().getAuthentication();
        if(isAdmin(auth)) {
            Fragment f = new Fragment("catalogLinks", "catalogLinksFragment", this);
            Catalog catalog = getCatalog();
            f.add(new BookmarkablePageLink("layersLink", LayerPage.class)
                .add(new Label( "nlayers", ""+catalog.getLayers().size())));
            f.add(new BookmarkablePageLink("addLayerLink", NewLayerPage.class));
           
            f.add(new BookmarkablePageLink("storesLink",StorePage.class)
                .add(new Label( "nstores", ""+catalog.getStores(StoreInfo.class).size())));
            f.add(new BookmarkablePageLink("addStoreLink", NewDataPage.class));
           
            f.add(new BookmarkablePageLink("workspacesLink",WorkspacePage.class)
                .add(new Label( "nworkspaces", ""+catalog.getWorkspaces().size())));
            f.add(new BookmarkablePageLink("addWorkspaceLink", WorkspaceNewPage.class));
            add(f);
        } else {
            Label placeHolder = new Label("catalogLinks");
            placeHolder.setVisible(false);
View Full Code Here

    /**
     * Make sure in case the DataStore has a "namespace" parameter, its value is initialized to the
     * NameSpaceInfo one that matches the workspace
     */
    public void testInitCreateNewDataStoreSetsNamespaceParam() {
        final Catalog catalog = getGeoServerApplication().getCatalog();

        final AbstractDataAccessPage page = startPage();

        page.get(null);
        // final NamespaceInfo assignedNamespace = (NamespaceInfo) page.parametersMap
View Full Code Here

     */
    public ResourceReference getStoreIcon(final StoreInfo storeInfo) {
       
        Class<?> factoryClass = null;

        Catalog catalog = storeInfo.getCatalog();
        final ResourcePool resourcePool = catalog.getResourcePool();

        if (storeInfo instanceof DataStoreInfo) {
            DataAccessFactory dataStoreFactory = null;
            try {
                dataStoreFactory = resourcePool.getDataStoreFactory((DataStoreInfo) storeInfo);
View Full Code Here

        print(tester.getLastRenderedPage(), true, true);
        final String wsDropdownPath = "dataStoreForm:workspacePanel:border:paramValue";
        final String namespaceParamPath = "dataStoreForm:parametersPanel:parameters:1:parameterPanel:paramValue";
        final String directoryParamPath = "dataStoreForm:parametersPanel:parameters:0:parameterPanel:border:paramValue";

        final Catalog catalog = getCatalog();
        tester.assertModelValue(wsDropdownPath, catalog.getWorkspaceByName(MockData.CITE_PREFIX));
        // tester.assertModelValue(namespaceParamPath, getCatalog().getNamespaceByPrefix(
        // MockData.CITE_PREFIX));
        tester.assertModelValue(namespaceParamPath, catalog.getNamespaceByPrefix(
                MockData.CITE_PREFIX).getURI());

        Serializable directory = store.getConnectionParameters().get("directory");
        tester.assertModelValue(directoryParamPath, directory);

        WorkspaceInfo expectedWorkspace = catalog.getWorkspaceByName(MockData.CDF_PREFIX);
        NamespaceInfo expectedNamespace = catalog.getNamespaceByPrefix(MockData.CDF_PREFIX);

        // select the fifth item in the drop down, which is the cdf workspace
        formTester.select("workspacePanel:border:paramValue", 4);
        Component wsDropDown = tester.getComponentFromLastRenderedPage(wsDropdownPath);
        tester.executeAjaxEvent(wsDropDown, "onchange");

        // final String namespaceParamPath =
        // "dataStoreForm:parameters:1:parameterPanel:border:paramValue";

        // did the workspace change?
        tester.assertModelValue(wsDropdownPath, expectedWorkspace);
        // did the namespace change accordingly?
        // tester.assertModelValue(namespaceParamPath, expectedNamespace);
        tester.assertModelValue(namespaceParamPath, expectedNamespace.getURI());
        tester.assertModelValue(directoryParamPath, directory);

        // use clickLink to simulate hitting the save button instead of calling
        // formTester.submit(). Otherwise the save action is not called at all
        // print(tester.getLastRenderedPage(), true, true);
        final boolean isAjax = true;
        tester.clickLink("dataStoreForm:save", isAjax);

        // did the save finish normally?
        tester.assertRenderedPage(StorePage.class);

        // was the namespace datastore parameter updated?
        DataStoreInfo dataStore = catalog.getDataStore(store.getId());
        Serializable namespace = dataStore.getConnectionParameters().get("namespace");
        assertEquals(expectedNamespace.getURI(), namespace);

        // was the namespace for the datastore resources updated?
        List<FeatureTypeInfo> resourcesByStore = catalog.getResourcesByStore(dataStore,
                FeatureTypeInfo.class);
        for (FeatureTypeInfo ft : resourcesByStore) {
            assertEquals("Namespace for " + ft.getName() + " was not updated", expectedNamespace,
                    ft.getNamespace());
        }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.Catalog

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.