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
Line 
1package eu.clarin.cmdi.mdservice.action;
2
3import java.io.IOException;
4import java.net.MalformedURLException;
5import java.net.URL;
6
7import eu.clarin.cmdi.mdservice.model.WorkspaceProfile;
8
9import net.sf.json.JSONObject;
10import net.sf.json.xml.XMLSerializer;
11
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
22         protected void  initialize(){
23                 // default ;
24                 setMaxdepth(2);
25         }
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 {
38               
39                URL targetURL = null;
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);
49                //Admin.notifyUser("CollectionProxy.targetURL:" + targetURL);
50
51            return targetURL;
52        }
53       
54       
55        @Override
56        public URL getBaseURL() throws MalformedURLException {         
57                if (base_url == null) {
58                        //base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri"));
59                        base_url = new URL(WorkspaceProfile.getRepositoryPath(getRepository()));
60                                                //Admin.notifyUser("TEST-URLnew:" + base_url.toString());
61                       
62                }
63                return base_url;
64        }
65
66
67}
Note: See TracBrowser for help on using the repository browser.