⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resourceobject.java

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JAVA
字号:
package com.esri.solutions.jitk.web.event;

import com.esri.solutions.jitk.web.tasks.resources.ResourceAdder;

/*
To add a service via the URL use the following syntax:

<functionality-type>:<resource-type>:<user>/<password>@<location>.

	Samples:
	========
	1. Map Service(ArcIMS-Internet):			aims@http://foo/mapservice1

	2. Map Service(ArcIMS-Internet, secure): 	aims:user/pass@http://foo/mapservice1

	3. Map Service(ArcIMS-Intranet):			aims@tcp://foo:5300/mapservice1

	4. Map Service(ArcGIS Server-Internet):		ags@http://foo/mapservice1

	5. Map Service(ArcGIS Server-Local):		ags@tcp://foo/mapservice1

	6. Map Service(WMS-Internet):				wms@http://foo/mapservice1

	7. Map Service(WCS-Internet):				wcs@http://foo/mapservice1
*/

public class ResourceObject {
    
	private String DEFAULT_FUNCTIONALITY = "map";
    private String[] SUPPORT_FUNCTIONALITY = { "map", "geop" };
    
    private String functionalityType = null;
    private String resourceType = null;
    private String domain = null;
    private String username = null;
    private String password = null;
    private String location = null;
    
    private boolean encrypted = false;
    private boolean transparent = false;
    private boolean projectMap = false;
    private boolean zoomMap = false;
    

    public ResourceObject() {}

    public ResourceObject(String resource) {
    	
        String[] info = resource.split("@");

        /*if ((AddDataTaskUtil.backgroundTransparentParam != null) && AddDataTaskUtil.backgroundTransparentParam.equalsIgnoreCase("true")) {
            this.transparent = true;
        }*/
        
        if ((ResourceAdder.backgroundTransparentParam != null) && ResourceAdder.backgroundTransparentParam.equalsIgnoreCase("true")) {
            this.transparent = true;
        }

        /*if ((AddDataTaskUtil.projectMapToNewServiceParam != null) && AddDataTaskUtil.projectMapToNewServiceParam.equalsIgnoreCase("true")) {
            this.projectMap = true;
        }*/
        
        if ((ResourceAdder.projectMapToNewServiceParam != null) && ResourceAdder.projectMapToNewServiceParam.equalsIgnoreCase("true")) {
            this.projectMap = true;
        }

        /*if ((AddDataTaskUtil.zoomToNewServiceExtentParam != null) && AddDataTaskUtil.zoomToNewServiceExtentParam.equalsIgnoreCase("true")) {
            this.zoomMap = true;
        }*/
        
        if ((ResourceAdder.zoomToNewServiceExtentParam != null) && ResourceAdder.zoomToNewServiceExtentParam.equalsIgnoreCase("true")) {
            this.zoomMap = true;
        }

        if (info.length > 1) {
        	
            this.location = info[1];

            String[] typeInfo = info[0].split(":");
            String[] userInfo = typeInfo[typeInfo.length - 1].split("/");
            int userInfoPos = -1;
            int funcInfoPos = -1;
            int resInfoPos = -1;

            if (userInfo.length > 1) {
                userInfoPos = typeInfo.length - 1;
                this.username = userInfo[0];

                int domainPos = this.username.indexOf("\\");
                if (domainPos > 0) {
                    this.domain = this.username.substring(0, domainPos);
                    this.username = this.username.substring(domainPos + 1, this.username.length());
                }

                this.password = userInfo[1];
            }

            this.functionalityType = checkFunctionality(typeInfo[0]);

            if (this.functionalityType.equalsIgnoreCase(typeInfo[0])) {
                funcInfoPos = 0;
            }

            if ((funcInfoPos < 0) && (userInfoPos != 0)) {
                resInfoPos = 0;
            }

            if ((funcInfoPos == 0) && ((userInfoPos < 0) || (userInfoPos > 1)) && typeInfo.length > 1) {
                resInfoPos = 1;
            }

            if (resInfoPos >= 0) {
                this.resourceType = typeInfo[resInfoPos];
            }

            if (((resourceType != null) && resourceType.equalsIgnoreCase("ags") && (userInfoPos < 0)) || (resourceType == null)) {
                
            	this.username = ResourceAdder.agsUsernameParam;
                this.password = ResourceAdder.agsPasswordParam;
                this.domain = ResourceAdder.agsDomainParam;

                if ((ResourceAdder.agsPasswordEncryptedParam != null) && ResourceAdder.agsPasswordEncryptedParam.equalsIgnoreCase("true")) {
                    this.encrypted = true;
                }
            }
        
        } else {
            
        	this.functionalityType = DEFAULT_FUNCTIONALITY;
            this.location = resource;
            this.username = ResourceAdder.agsUsernameParam;
            this.password = ResourceAdder.agsPasswordParam;
            this.domain = ResourceAdder.agsDomainParam;

            if ((ResourceAdder.agsPasswordEncryptedParam != null) && ResourceAdder.agsPasswordEncryptedParam.equalsIgnoreCase("true")) {
                this.encrypted = true;
            }
        }
    }

    private String checkFunctionality(String function) {
    	
        for (int i = 0; i < SUPPORT_FUNCTIONALITY.length; i++) {
            
        	if (SUPPORT_FUNCTIONALITY[i].equalsIgnoreCase(function)) {
                return function;
            }
        }

        return DEFAULT_FUNCTIONALITY;
    }

    public String getFunctionalityType() {
        return this.functionalityType;
    }

    public void setFunctionalityType(String functionalityType) {
        this.functionalityType = functionalityType;
    }

    public String getResourceType() {
        return this.resourceType;
    }

    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    public String getDomain() {
        return this.domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getLocation() {
        return this.location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public boolean getEncrypted() {
        return this.encrypted;
    }

    public void setEncrypted(boolean encrypted) {
        this.encrypted = encrypted;
    }

    public boolean getTransparent() {
        return this.transparent;
    }

    public void setTransparent(boolean transparent) {
        this.transparent = transparent;
    }

    public boolean getProjectMap() {
        return this.projectMap;
    }

    public void setProjectMap(boolean projectMap) {
        this.projectMap = projectMap;
    }

    public boolean getZoomMap() {
        return this.zoomMap;
    }

    public void setZoomMap(boolean zoomMap) {
        this.zoomMap = zoomMap;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -