source: MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/CollectionProxyAction.java

Last change on this file was 1496, checked in by gaba, 13 years ago

repoaction created ,
options + repositories moved to workspaceprofile

File size: 1.6 KB
RevLine 
[524]1package eu.clarin.cmdi.mdservice.action;
2
3import java.io.IOException;
[849]4import java.net.MalformedURLException;
[524]5import java.net.URL;
6
[1496]7import eu.clarin.cmdi.mdservice.model.WorkspaceProfile;
8
[676]9import net.sf.json.JSONObject;
10import net.sf.json.xml.XMLSerializer;
11
[524]12/**
13 *
14 *
15 */
16public class CollectionProxyAction extends GenericProxyAction {
17
18        private static final long serialVersionUID = 1L;
19       
20        private String proxy_key = "collections";
21
[1085]22         protected void  initialize(){
23                 // default ;
24                 setMaxdepth(2);
25         }
[524]26        @Override 
27        public String getFullFormat() {
28                return "collection2" + getFormat();
29        }
30       
31        @Override
32        public String getProxyKey() {
33                return proxy_key;
34        }
35       
36       
37        public URL getTargetRequest() throws IOException {
[676]38               
[524]39                URL targetURL = null;
[1108]40                //targetURL =new URL( getBaseURL(), getActionkey());
41                //FIXME: get maxdepth-constant out of here !!
42                String params = "";
43                params = "&maxdepth=" + getMaxdepth();
44                params = params + "&collection=";
45                if (getCollection() != null){
46                        params = params + getCollection();
47                }
48                targetURL = new URL(getBaseURL(), "?operation=getCollections" + params);
[524]49                //Admin.notifyUser("CollectionProxy.targetURL:" + targetURL);
50
51            return targetURL;
52        }
53       
54       
[849]55        @Override
56        public URL getBaseURL() throws MalformedURLException {         
57                if (base_url == null) {
58                        //base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri"));
[1496]59                        base_url = new URL(WorkspaceProfile.getRepositoryPath(getRepository()));
[849]60                                                //Admin.notifyUser("TEST-URLnew:" + base_url.toString());
61                       
62                }
63                return base_url;
64        }
[524]65
[849]66
[524]67}
Note: See TracBrowser for help on using the repository browser.