Examples of MapRequest


Examples of gistoolkit.server.MapRequest

    public static final String FEATURE_COUNT="FEATURE_COUNT";
    public static final String FILTER = "Filter";
   
    /** Create a map request given the web request. */
    public MapRequest getMapRequest(Request inRequest) throws Exception{
        MapRequest tempRequest = new MapRequest();
       
        // the request
        tempRequest.setRequest(getRequest(inRequest.getParameter(REQUEST)));
       
        if (tempRequest.getRequest() == MapRequest.REQUEST_GET_MAP){
            // the layers
            String tempString = inRequest.getParameter(LAYERS);
            if (tempString == null) throw new Exception("The parameter "+LAYERS+" is required, it is a comma delimited list of layer names.");
            tempRequest.setLayers(getListFromString(tempString));

            // the Styles
            tempRequest.setStyles(getListFromString(inRequest.getParameter(STYLES)));

            // the SRS
            setSRS(tempRequest, inRequest.getParameter(SRS));

            // the Bounding Box
            tempString = inRequest.getParameter(BBOX);
            if (tempString == null) throw new Exception("Error Parsing "+BBOX+" minx,miny,maxx,maxy is required for request type "+inRequest.getParameter(REQUEST));
            setBoundingBox(tempRequest, inRequest.getParameter(BBOX));

            // the width
            tempString = inRequest.getParameter(WIDTH);
            if (tempString == null) throw new Exception("A value is required for "+WIDTH);
            try{
                tempRequest.setWidth(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception ("Error Parsing "+WIDTH+" Value="+tempString);}

            // the Height
            tempString = inRequest.getParameter(HEIGHT);
            if (tempString == null) throw new Exception("A value is required for "+HEIGHT);
            try{
                tempRequest.setHeight(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception ("Error Parsing "+HEIGHT+" Value="+tempString);}

            // the Format
            tempRequest.setFormat(getFormat(inRequest.getParameter(FORMAT)));

            // the transparency of the background.
            tempString = inRequest.getParameter(TRANSPARENT);
            if (tempString != null){
                tempRequest.setTransparent(Boolean.getBoolean(tempString));
            }
            else tempRequest.setTransparent(false);

            // the Background Color
            tempString = inRequest.getParameter(BGCOLOR);
            if (tempString != null){
                try{
                    Color tempColor = new Color(Integer.parseInt(tempString));
                    tempRequest.setBackgroundColor(tempColor);
                }
                catch (Exception e){ throw new Exception("Error Parsing "+BGCOLOR+" Value="+tempString);}
            }
            else tempRequest.setBackgroundColor(Color.white);
           
            // and filters that may be present. (Proprietary Parameter)
            String tempFilters = inRequest.getParameter(FILTER);
            if (tempFilters != null){
                tempRequest.setFilters(getFilters(tempFilters));
            }
               
        }
        // parse a capabilities request.
        if (tempRequest.getRequest() == MapRequest.REQUEST_GET_CAPABILITIES){
            // service parameter.
            String tempString = inRequest.getParameter(SERVICE);
            if (tempString == null) throw new Exception("Error Parsing "+SERVICE+" This parameter must be present and set to the value \"WMS\"");
            if (!tempString.equals("WMS")) throw new Exception("Error "+SERVICE+" parameter must equal WMS");
        }
        // parse a feature info request.
        if (tempRequest.getRequest() == MapRequest.REQUEST_GET_FEATURE_INFO){
            // the layers
            String tempString = inRequest.getParameter(QUERY_LAYERS);
            if (tempString == null) throw new Exception("The parameter "+QUERY_LAYERS+" is required, it is a comma delimited list of layer names.");
            tempRequest.setLayers(getListFromString(tempString));

            // the SRS
            setSRS(tempRequest, inRequest.getParameter(SRS));

            // the Bounding Box
            tempString = inRequest.getParameter(BBOX);
            if (tempString == null) throw new Exception("Error Parsing "+BBOX+" minx,miny,maxx,maxy is required for request type "+inRequest.getParameter(REQUEST));
            setBoundingBox(tempRequest, inRequest.getParameter(BBOX));

            // the width
            tempString = inRequest.getParameter(WIDTH);
            if (tempString == null) throw new Exception("A value is required for "+WIDTH);
            try{
                tempRequest.setWidth(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception ("Error Parsing "+WIDTH+" Value="+tempString);}

            // the Height
            tempString = inRequest.getParameter(HEIGHT);
            if (tempString == null) throw new Exception("A value is required for "+HEIGHT);
            try{
                tempRequest.setHeight(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception ("Error Parsing "+HEIGHT+" Value="+tempString);}
           
            // The Info Format.
            tempString = inRequest.getParameter(INFO_FORMAT);
            tempRequest.setFormat(tempString);

            // The Number of features to return information about, default is 1.
            tempString = inRequest.getParameter(FEATURE_COUNT);
            if (tempString != null){
                try{
                    tempRequest.setFeatureCount(Integer.parseInt(tempString));
                }
                catch(Exception e){
                    throw new Exception("Error Parsing "+FEATURE_COUNT+" Must be an integer, value = "+tempString);
                }
            }
           
            // The X coordinate
            tempString = inRequest.getParameter(X_POINT);
            if (tempString == null) throw new Exception("Error Parsing "+X_POINT+" A value is required.");
            int tempXPoint = 0;
            try{tempXPoint = Integer.parseInt(tempString);}catch (Exception e){throw new Exception("Error parsing "+X_POINT+" Not a valid integer Value="+tempString);}
            tempRequest.setXPoint(tempXPoint);
           
            // the Y coordinate
            tempString = inRequest.getParameter(Y_POINT);
            if (tempString == null) throw new Exception("Error Parsing "+Y_POINT+" A value is required.");
            int tempYPoint = 0;
            try{tempYPoint = Integer.parseInt(tempString);}catch (Exception e){throw new Exception("Error parsing "+Y_POINT+" Not a valid integer Value="+tempString);}
            tempRequest.setYPoint(tempYPoint);
        }
      
        return tempRequest;
    }
View Full Code Here

Examples of gistoolkit.server.MapRequest

    public static final String FEATURE_COUNT="FEATURE_COUNT";
    public static final String FILTER = "Filter";
   
    /** Create a map request given the web request. */
    public MapRequest getMapRequest(Request inRequest) throws Exception{
        MapRequest tempRequest = new MapRequest();
       
        // the request
        tempRequest.setRequest(getRequest(inRequest.getParameter(REQUEST)));
       
        // parse a map request.
        if (tempRequest.getRequest() == MapRequest.REQUEST_GET_MAP){
            // the layers
            String tempString = inRequest.getParameter(LAYERS);
            if (tempString == null) throw new Exception("The parameter "+LAYERS+" is required, it is a comma delimited list of layer names.");
            tempRequest.setLayers(getListFromString(inRequest.getParameter(LAYERS)));

            // the Styles
            tempRequest.setStyles(getListFromString(inRequest.getParameter(STYLES)));

            // the SRS
            setSRS(tempRequest, inRequest.getParameter(SRS));

            // the Bounding Box
            tempString = inRequest.getParameter(BBOX);
            if (tempString == null) throw new Exception("Error Parsing "+BBOX+" minx,miny,maxx,maxy is required for request type "+inRequest.getParameter(REQUEST));
            setBoundingBox(tempRequest, inRequest.getParameter(BBOX));

            // the width
            tempString = inRequest.getParameter(WIDTH);
            if (tempString == null) throw new Exception("A value is required for "+WIDTH);
            try{
                tempRequest.setWidth(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception("Error Parsing "+WIDTH+" Value="+tempString);}

            // the Height
            tempString = inRequest.getParameter(HEIGHT);
            if (tempString == null) throw new Exception("A value is required for "+HEIGHT);
            try{
                tempRequest.setHeight(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception("Error Parsing "+HEIGHT+" Value="+tempString);}

            // the Format
            tempRequest.setFormat(getFormat(inRequest.getParameter(FORMAT)));

            // the transparency of the background.
            tempString = inRequest.getParameter(TRANSPARENT);
            if (tempString != null){
                tempRequest.setTransparent(Boolean.getBoolean(tempString));
            }
            else tempRequest.setTransparent(false);

            // the Background Color
            tempString = inRequest.getParameter(BGCOLOR);
            if (tempString != null){
                try{
                    Color tempColor = new Color(Integer.parseInt(tempString));
                    tempRequest.setBackgroundColor(tempColor);
                }
                catch (Exception e){ throw new Exception("Error Parsing "+BGCOLOR+" Value="+tempString);}
            }
            else tempRequest.setBackgroundColor(Color.white);
           
            // and filters that may be present. (Proprietary Parameter)
            String tempFilters = inRequest.getParameter(FILTER);
            if (tempFilters != null){
                tempRequest.setFilters(getFilters(tempFilters));
            }
               
        }
        // parse a capabilities request.
        if (tempRequest.getRequest() == MapRequest.REQUEST_GET_CAPABILITIES){
            // There are no other parameters for a 1.0.0 get capabilities request.
        }
        // parse a feature info request.
        if (tempRequest.getRequest() == MapRequest.REQUEST_GET_FEATURE_INFO){
            // the layers
            String tempString = inRequest.getParameter(QUERY_LAYERS);
            if (tempString == null) throw new Exception("The parameter "+QUERY_LAYERS+" is required, it is a comma delimited list of layer names.");
            tempRequest.setLayers(getListFromString(tempString));

            // the SRS
            setSRS(tempRequest, inRequest.getParameter(SRS));

            // the Bounding Box
            tempString = inRequest.getParameter(BBOX);
            if (tempString == null) throw new Exception("Error Parsing "+BBOX+" minx,miny,maxx,maxy is required for request type "+inRequest.getParameter(REQUEST));
            setBoundingBox(tempRequest, inRequest.getParameter(BBOX));

            // the width
            tempString = inRequest.getParameter(WIDTH);
            if (tempString == null) throw new Exception("A value is required for "+WIDTH);
            try{
                tempRequest.setWidth(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception ("Error Parsing "+WIDTH+" Value="+tempString);}

            // the Height
            tempString = inRequest.getParameter(HEIGHT);
            if (tempString == null) throw new Exception("A value is required for "+HEIGHT);
            try{
                tempRequest.setHeight(Integer.parseInt(tempString));
            }
            catch (Exception e){throw new Exception ("Error Parsing "+HEIGHT+" Value="+tempString);}
           
            // The Info Format.
            tempString = inRequest.getParameter(INFO_FORMAT);
            tempRequest.setFormat(tempString);

            // The Number of features to return information about, default is 1.
            tempString = inRequest.getParameter(FEATURE_COUNT);
            if (tempString != null){
                try{
                    tempRequest.setFeatureCount(Integer.parseInt(tempString));
                }
                catch(Exception e){
                    throw new Exception("Error Parsing "+FEATURE_COUNT+" Must be an integer, value = "+tempString);
                }
            }

            // The X coordinate
            tempString = inRequest.getParameter(X_POINT);
            int tempXPoint = 0;
            try{tempXPoint = Integer.parseInt(tempString);}catch (Exception e){throw new Exception("Error parsing "+X_POINT+" Not a valid integer Value="+tempString);}
            tempRequest.setXPoint(tempXPoint);
           
            // the Y coordinate
            tempString = inRequest.getParameter(Y_POINT);
            int tempYPoint = 0;
            try{tempYPoint = Integer.parseInt(tempString);}catch (Exception e){throw new Exception("Error parsing "+Y_POINT+" Not a valid integer Value="+tempString);}
            tempRequest.setYPoint(tempYPoint);
        }
       
        return tempRequest;
    }
View Full Code Here

Examples of gistoolkit.server.MapRequest

    public static MapRequest getMapRequest(Request inRequest) throws Exception{
        // find the version
        String tempVersion = inRequest.getParameter("VERSION");
        if (tempVersion == null) tempVersion = inRequest.getParameter("WMTVER");
       
        MapRequest tempRequest = null;
       
        // check for the 1.1.1 version
        if ((tempVersion == null) || (tempVersion.equalsIgnoreCase("1.1.1"))){
            OGCParser tempParser = new OGC1_1_1Parser();
            tempRequest = tempParser.getMapRequest(inRequest);
View Full Code Here

Examples of org.apache.activegroups.command.MapRequest

     */
    public Serializable broadcastMessageRequest(Object message, long timeout)
            throws JMSException {
        checkStatus();
        Object result = null;
        MapRequest request = new MapRequest();
        String id = this.idGenerator.generateId();
        synchronized (this.messageRequests) {
            this.messageRequests.put(id, request);
        }
        ObjectMessage objMsg = this.stateSession
                .createObjectMessage((Serializable) message);
        objMsg.setJMSReplyTo(this.inboxTopic);
        objMsg.setJMSCorrelationID(id);
        objMsg.setJMSType(MESSAGE_TYPE);
        objMsg.setStringProperty(MEMBER_ID_PROPERTY, this.local.getId());
        this.messageProducer.send(this.messageQueue, objMsg);
        result = request.get(timeout);
        return (Serializable) result;
    }
View Full Code Here

Examples of org.apache.activegroups.command.MapRequest

     */
    public Object sendMessageRequest(Member member, Object message, long timeout)
            throws JMSException {
        checkStatus();
        Object result = null;
        MapRequest request = new MapRequest();
        String id = this.idGenerator.generateId();
        synchronized (this.messageRequests) {
            this.messageRequests.put(id, request);
        }
        ObjectMessage objMsg = this.stateSession
                .createObjectMessage((Serializable) message);
        objMsg.setJMSReplyTo(this.inboxTopic);
        objMsg.setJMSCorrelationID(id);
        objMsg.setJMSType(MESSAGE_TYPE);
        objMsg.setStringProperty(MEMBER_ID_PROPERTY, this.local.getId());
        this.messageProducer.send(member.getInBoxDestination(), objMsg);
        result = request.get(timeout);
        return result;
    }
View Full Code Here

Examples of org.apache.activegroups.command.MapRequest

        return list;
    }

    Object sendStateRequest(Member member, Serializable payload) {
        Object result = null;
        MapRequest request = new MapRequest();
        String id = this.idGenerator.generateId();
        synchronized (this.stateRequests) {
            this.stateRequests.put(id, request);
        }
        try {
            ObjectMessage objMsg = this.stateSession
                    .createObjectMessage(payload);
            objMsg.setJMSReplyTo(this.inboxTopic);
            objMsg.setJMSCorrelationID(id);
            objMsg.setJMSType(STATE_TYPE);
            this.stateProducer.send(member.getInBoxDestination(), objMsg);
            result = request.get(getHeartBeatInterval());
        } catch (JMSException e) {
            if (this.started.get()) {
                LOG.error("Failed to send request " + payload, e);
            }
        }
View Full Code Here

Examples of org.apache.activegroups.command.MapRequest

        return result;
    }

    void sendAsyncStateRequest(AsyncMapRequest asyncRequest, Member member,
            Serializable payload) {
        MapRequest request = new MapRequest();
        String id = this.idGenerator.generateId();
        asyncRequest.add(id, request);
        synchronized (this.stateRequests) {
            this.stateRequests.put(id, request);
        }
View Full Code Here

Examples of org.apache.activegroups.command.MapRequest

        }
    }

    void processRequest(String id, Object value) {
        if (id != null) {
            MapRequest result = null;
            synchronized (this.stateRequests) {
                result = this.stateRequests.remove(id);
            }
            if (result != null) {
                result.put(id, value);
            }
        }
    }
View Full Code Here

Examples of org.apache.activegroups.command.MapRequest

        Member member = this.members.get(memberId);
        if (member != null) {
            fireMemberMessage(member, replyId, payload);
        }
        if (replyId != null) {
            MapRequest result = null;
            synchronized (this.messageRequests) {
                result = this.messageRequests.remove(replyId);
            }
            if (result != null) {
                result.put(replyId, payload);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.