Package org.vfny.geoserver.config

Examples of org.vfny.geoserver.config.FeatureTypeConfig


     *
     * @return
     */
    private ActionForward executeSubmit(ActionMapping mapping,
        TypesEditorForm form, UserContainer user, HttpServletRequest request) {
        FeatureTypeConfig config = user.getFeatureTypeConfig();
        sync(form, config, request);

        DataConfig dataConfig = (DataConfig) getDataConfig();
        dataConfig.addFeatureType(config.getDataStoreId() + ":"
            + config.getName(), config);

        // Don't think reset is needed (as me have moved on to new page)
        // form.reset(mapping, request);
        getApplicationState().notifyConfigChanged();

View Full Code Here


        DataConfig config = ConfigRequests.getDataConfig(request);

        UserContainer user = Requests.getUserContainer(request);

        // Richard can we please use this to store stuff?
        FeatureTypeConfig ftConfig; //= user.getFeatureTypeConfig();

        ftConfig = (FeatureTypeConfig) request.getSession().getAttribute(DataConfig.SELECTED_FEATURE_TYPE);

        _abstract = ftConfig.getAbstract();

        Envelope bounds = ftConfig.getLatLongBBox();

        if (bounds.isNull()) {
            latLonBoundingBoxMinX = "";
        } else {
            latLonBoundingBoxMinX = Double.toString(bounds.getMinX());
            latLonBoundingBoxMinY = Double.toString(bounds.getMinY());
            latLonBoundingBoxMaxX = Double.toString(bounds.getMaxX());
            latLonBoundingBoxMaxY = Double.toString(bounds.getMaxY());
        }

        name = ftConfig.getName();
        SRS = Integer.toString(ftConfig.getSRS());
        title = ftConfig.getTitle();
        _default = (ftConfig.getSchemaAttributes() == null)
            || (ftConfig.getSchemaAttributes().isEmpty());
        defaultChecked = false;

        StringBuffer buf = new StringBuffer();

        for (Iterator i = ftConfig.getKeywords().iterator(); i.hasNext();) {
            String keyword = (String) i.next();
            buf.append(keyword);

            if (i.hasNext()) {
                buf.append(" ");
View Full Code Here

        ServletContext context = getServlet().getServletContext();

        DataConfig config = ConfigRequests.getDataConfig(request);
        UserContainer user = Requests.getUserContainer(request);

        FeatureTypeConfig type = user.getFeatureTypeConfig();

        if (type == null) {
            System.out.println("Type is not there");

            // Not sure what to do, user must have bookmarked?
            return; // Action should redirect to Select screen?
        }

        this.dataStoreId = type.getDataStoreId();
        this.styleId = type.getDefaultStyle();

        description = type.getAbstract();

        Envelope bounds = type.getLatLongBBox();

        if ((bounds == null) || bounds.isNull()) {
            minX = "";
            minY = "";
            maxY = "";
            maxX = "";
        } else {
            minX = Double.toString(bounds.getMinX());
            minY = Double.toString(bounds.getMinY());
            maxX = Double.toString(bounds.getMaxX());
            maxY = Double.toString(bounds.getMaxY());
        }

        typeName = type.getName();
        setSRS(Integer.toString(type.getSRS())); // doing it this way also sets SRSWKT

       
        title = type.getTitle();

        System.out.println("rest based on schemaBase: " + type.getSchemaBase());

        // Generate ReadOnly list of Attributes
        //
        DataStoreConfig dataStoreConfig = config.getDataStore(dataStoreId);
        FeatureType featureType = null;

        try {
            DataStore dataStore = dataStoreConfig.findDataStore(getServlet()
                                                                    .getServletContext());
            featureType = dataStore.getSchema(typeName);
        } catch (IOException e) {
            // DataStore unavailable!
        }

        if (((type.getSchemaBase() == null)
                || "--".equals(type.getSchemaBase()))
                || (type.getSchemaAttributes() == null)) {
            //We are using the generated attributes
            this.schemaBase = "--";
            this.schemaName = typeName + "_Type";
            this.attributes = new LinkedList();

            // Generate ReadOnly list of Attributes
            //
            List generated = DataTransferObjectFactory.generateAttributes(featureType);
            this.attributes = attributesDisplayList(generated);
            addList = Collections.EMPTY_LIST;
        } else {
            this.schemaBase = type.getSchemaBase();
            this.schemaName = type.getSchemaName();
            this.attributes = new LinkedList();

            //
            // Need to add read only AttributeDisplay for each required attribute
            // defined by schemaBase
            //
            List schemaAttributes = DataTransferObjectFactory
                .generateRequiredAttributes(schemaBase);
            attributes.addAll(attributesDisplayList(schemaAttributes));
            attributes.addAll(attributesFormList(type.getSchemaAttributes(),
                    featureType));
            addList = new ArrayList(featureType.getAttributeCount());

            for (int i = 0; i < featureType.getAttributeCount(); i++) {
                String attributeName = featureType.getAttributeType(i).getName();

                if (lookUpAttribute(attributeName) == null) {
                    addList.add(attributeName);
                }
            }
        }

        StringBuffer buf = new StringBuffer();

        for (Iterator i = type.getKeywords().iterator(); i.hasNext();) {
            String keyword = (String) i.next();
            buf.append(keyword);

            if (i.hasNext()) {
                buf.append(" ");
View Full Code Here

                + DataConfig.SEPARATOR.length());

        DataStoreConfig dsConfig = dataConfig.getDataStore(dataStoreID);
        DataStore dataStore = dsConfig.findDataStore(request.getSession().getServletContext());

        FeatureTypeConfig ftConfig;
        //JD: GEOS-399, wrap rest of method in try catch block in order to
        // report back nicely to app
    try {
      FeatureType featureType = dataStore.getSchema(featureTypeName);

      ftConfig = new FeatureTypeConfig(dataStoreID,
              featureType, false);

      // DJB: this comment looks old - SRS support is much better now. 
      //     TODO: delete this comment (but wait a bit)
      // What is the Spatial Reference System for this FeatureType?
      //
      // getDefaultGeometry().getCoordinateSystem() should help but is null
      // getDefaultGeometry().getGeometryFactory() could help, with getSRID(), but it is null
      //
      // So we will use 0 which means Cartisian Coordinates aka don't know
      //
      // Only other thing we could do is ask for a geometry and see what it's
      // SRID number is?
      //
     
      ftConfig.setSRS(0);
     
      // attempt to get a better SRS
      try {
        CoordinateReferenceSystem crs = featureType.getDefaultGeometry().getCoordinateSystem();
        Set idents = crs.getIdentifiers();
        Iterator it = idents.iterator();
        while (it.hasNext())
        {
          Identifier id = (Identifier) it.next();
          if (id.toString().indexOf("EPSG:") != -1)    // this should probably use the Citation, but this is easier!
          {
            //we have an EPSG #, so lets use it!
            String str_num = id.toString().substring(id.toString().indexOf(':')+1);
            int num = Integer.parseInt(str_num);
            ftConfig.setSRS(num);
            break// take the first EPSG
          }
        }
      }catch(Exception e)
      {
View Full Code Here

        String buttonAction = form.getButtonAction();

        DataConfig dataConfig = (DataConfig) getServlet().getServletContext()
                                                 .getAttribute(DataConfig.CONFIG_KEY);
       
        FeatureTypeConfig ftConfig = dataConfig.getFeatureTypeConfig(selectedFeatureType);
        request.getSession().removeAttribute(DataConfig.SELECTED_ATTRIBUTE_TYPE);
       
        Locale locale = (Locale) request.getLocale();
        MessageResources messages = servlet.getResources();
        String edit = messages.getMessage(locale, "label.edit");
View Full Code Here

            UserContainer user,
            HttpServletRequest request,
            HttpServletResponse response)
    throws IOException, ServletException {

        FeatureTypeConfig ftConfig = (FeatureTypeConfig) request.getSession().getAttribute(DataConfig.SELECTED_FEATURE_TYPE);
        DataConfig dataConfig = getDataConfig();
        DataStoreConfig dsConfig = dataConfig.getDataStore(ftConfig.getDataStoreId());
        DataStore dataStore = dsConfig.findDataStore(request.getSession().getServletContext());
        FeatureType featureType = dataStore.getSchema(ftConfig.getName());
        FeatureSource fs = dataStore.getFeatureSource(featureType.getTypeName());
       
        ftConfig.setLatLongBBox(DataStoreUtils.getBoundingBoxEnvelope(fs));
        request.getSession().setAttribute(DataConfig.SELECTED_FEATURE_TYPE, ftConfig);
       
        return mapping.findForward("config.data.type.editor");
    }
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.config.FeatureTypeConfig

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.