Ignore:
Timestamp:
11/06/10 21:59:50 (14 years ago)
Author:
gaba
Message:
 
Location:
MDService2/trunk/MDService2/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/CollectionProxyAction.java

    r676 r849  
    22
    33import java.io.IOException;
     4import java.net.MalformedURLException;
    45import java.net.URL;
    56
     
    3233                URL targetURL = null;
    3334                //targetURL =new URL( getBaseURL(), getActionkey());
    34                 targetURL = new URL(getBaseURL(), "");
     35                targetURL = new URL(getBaseURL(), "?operation=getCollections&collection=");
    3536                //Admin.notifyUser("CollectionProxy.targetURL:" + targetURL);
    3637
     
    3940       
    4041       
     42        @Override
     43        public URL getBaseURL() throws MalformedURLException {         
     44                if (base_url == null) {
     45                        //base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri"));
     46                        base_url = new URL(getRepository());
     47                                                //Admin.notifyUser("TEST-URLnew:" + base_url.toString());
     48                       
     49                }
     50                return base_url;
     51        }
     52
    4153
    4254}
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/CompRegistryProxyAction.java

    r795 r849  
    9292                                        Admin.notifyUser("CCCRPA." + getFullFormat());
    9393                                        MDTransformer.getMDTransformer().setSrcFile(getTargetRequest());
    94                                         _sourceStream = MDTransformer.getMDTransformer().transformXML(__sourceStream, getFullFormat(),null,null,null,null,null);
     94                                        _sourceStream = MDTransformer.getMDTransformer().transformXML(__sourceStream, getFullFormat(),null,null,null,null,null,null);
    9595                                        Admin.notifyUser("CRPA.- elements");
    9696                                        setActionkey("elements");
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java

    r832 r849  
    44import java.io.InputStream;
    55import java.net.MalformedURLException;
     6import java.net.URISyntaxException;
    67import java.net.URL;
    78
     
    119120        }
    120121       
    121         public String getRepostory() {
     122        public String getRepository() {
    122123                return repository;
    123124        }
     
    214215        public URL getBaseURL() throws MalformedURLException {         
    215216                if (base_url == null) {
    216                         base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri"));
     217                        base_url = new URL(getBaseURI());//Admin.getConfig().getProperty(getProxyKey() + ".uri"));
    217218                }
    218219                return base_url;
    219220        }
    220 
     221       
    221222        public String getBaseURI() {           
    222223                String uri =Admin.getConfig().getProperty(getProxyKey() + ".uri");             
     
    232233        }
    233234       
     235        /*
    234236        public String getRequestKey() {
    235237                String key="";
     
    246248                return key;
    247249        }
    248 
     250*/
     251
     252         public String getRequestKey() {
     253                        String key="";
     254                        if (getActionkey()!=null) {
     255                                key += getActionkey() + "//-" ;
     256                        }else {
     257                                key +="//-" ;
     258                        }
     259                        if (getQ()!=null) {
     260                                key += getQ() + "//-" ;
     261                        } else {
     262                                key +="//-" ;
     263                        }
     264                        if (getCollection()!=null) {
     265                                key += getCollection() + "//-";
     266                        } else {
     267                                key +="//-" ;
     268                        }
     269                        if (getSquery()!=null) {
     270                                key += getSquery() + "//-" ;
     271                        } else {
     272                                key +="//-" ;
     273                        }
     274                        if (getStartRecord()!=null) {
     275                                key += getStartRecord() + "//-";
     276                        }
     277                                else{
     278                                        key +="//-" ;
     279                        }
     280                        if (getMaximumRecords()!=null) {
     281                                key += getMaximumRecords() + "//-";
     282                        }
     283                        else{
     284                                key +="//-" ;
     285                        }
     286                        if (getRepository()!=null) {
     287                                key += getRepository()  + "//-";
     288                        }else{
     289                                key +="//-" ;
     290                        }
     291                       
     292                        key += getMaxdepth()  + "//-";
     293                       
     294                        if (getLang()!=null) {
     295                                key += getLang();
     296                        }
     297                         
     298                        return key;
     299        }
    249300        public InputStream getSourceStream() throws IOException {               
    250301                return getTargetRequest().openStream();
     
    289340                        MDTransformer.getMDTransformer().setSrcFile(getTargetRequest());
    290341                        // getColumns
    291                         resultStream = MDTransformer.getMDTransformer().transformXML(sourceStream, getFullFormat(), getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ());
     342                        resultStream = MDTransformer.getMDTransformer().transformXML(sourceStream, getFullFormat(), getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ(),getRepository());
    292343                }
    293344                       
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDRepoProxyAction.java

    r832 r849  
    77import java.io.StringWriter;
    88import java.net.MalformedURLException;
     9import java.net.URISyntaxException;
    910import java.net.URL;
    1011import java.util.HashMap;
     
    5253       
    5354        @Override
     55        public String getBaseURI() {           
     56                Admin.notifyUser("MDREPO-property:" + Admin.getConfig().getProperty(getProxyKey() + ".uri"));
     57                Admin.notifyUser("MDREPO-profile:" + getRepository());
     58                String uri = getRepository();//Admin.getConfig().getProperty(getProxyKey() + ".uri");           
     59                return uri;
     60        }
     61       
     62        @Override
    5463        public void setFormat(String format) {
    5564                super.setFormat(format);
     
    7483                 urls.put("record", "?operation=searchRetrieve&query=");
    7584         }
    76        
     85        /*
    7786         @Override
    78          public String getRequestKey() {
    79                         String key="";
    80                         if (getActionkey()!=null) {
    81                                 key += getActionkey() + "//-" ;
     87         public URL getBaseURL() throws MalformedURLException {         
     88                        if (base_url == null) {
     89                                base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri"));
     90                                try {
     91                                        Admin.notifyUser("TEST-URLold:" + base_url.toURI());
     92                                } catch (URISyntaxException e) {
     93                                        // TODO Auto-generated catch block
     94                                        e.printStackTrace();
     95                                }
     96                                base_url = new URL(getRepository());
     97                                try {
     98                                        Admin.notifyUser("TEST-URLnew:" + base_url.toURI());
     99                                } catch (URISyntaxException e) {
     100                                        // TODO Auto-generated catch block
     101                                        e.printStackTrace();
     102                                }
    82103                        }
    83                         if (getQ()!=null) {
    84                                 key += getQ() + "//-" ;
    85                         } else {
    86                                 key +="//-" ;
    87                         }
    88                         if (getCollection()!=null) {
    89                                 key += getCollection() + "//-";
    90                         } else {
    91                                 key +="//-" ;
    92                         }
    93                         if (getSquery()!=null) {
    94                                 key += getSquery() + "//-" ;
    95                         } else {
    96                                 key +="//-" ;
    97                         }
    98                         if (getStartRecord()!=null) {
    99                                 key += getStartRecord() + "//-";
    100                         }
    101                         if (getMaximumRecords()!=null) {
    102                                 key += getMaximumRecords();
    103                         }
    104                          
    105                         return key;
    106         }
     104                        return base_url;
     105                }
     106         */
     107         
    107108        /**
    108109         * uses base_url + url_pattern (parametrized by actionkey) to form a url
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDTransformer.java

    r795 r849  
    165165         * @throws IOException
    166166         */             
    167         public void transformXML (InputStream in, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, OutputStream out ) throws TransformerException, IOException {
     167        public void transformXML (InputStream in, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, String repositoryURI, OutputStream out ) throws TransformerException, IOException {
    168168       
    169169                // Create a transform factory instance.
     
    185185                        transformer.setParameter("startRecord", startRecord);
    186186                        transformer.setParameter("maximumRecords", maximumRecords);
     187                }
     188                if (repositoryURI != null) {
     189
     190                        transformer.setParameter("repository_uri", repositoryURI);
    187191                }
    188192                /*       transformer.setParameter("cols", "<col label='id'>Id</col>" +
     
    204208                                xsrcfile = "file:///" + f.getPath().replace('\\', '/');
    205209                        }
     210                        // TODO repository-path -removed, bad formating
     211                        String[] xsrcfiles = xsrcfile.split("&repository=");
     212                        String[] root_uris = root_uri.split("&repository=");
     213                        xsrcfile = xsrcfiles[0];
     214                        root_uri = root_uris[0];
     215                        ///
     216                       
    206217                        Admin.notifyUser("root_uri:" +  root_uri );
    207218                        Admin.notifyUser("xsrcfile:" +  xsrcfile );
     
    227238         * @throws TransformerException
    228239         */
    229         public InputStream transformXML ( InputStream xmlStream, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q) throws IOException, InterruptedException, TransformerException {
     240        public InputStream transformXML ( InputStream xmlStream, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, String repositoryURI) throws IOException, InterruptedException, TransformerException {
    230241               
    231242                ByteArrayOutputStream out = new ByteArrayOutputStream();
    232                 transformXML(xmlStream, transkey, cols, startRecord, maximumRecords, lang, q, out);             
     243                transformXML(xmlStream, transkey, cols, startRecord, maximumRecords, lang, q, repositoryURI, out);             
    233244            InputStream transformedStream = new ByteArrayInputStream(out.toByteArray());
    234245            //Admin.notifyUser("transformedStream:" + transformedStream.toString());
     
    248259               
    249260                ByteArrayOutputStream out = new ByteArrayOutputStream();
    250                 transformXML(xmlStream, transkey, "", "", "","","", out);               
     261                transformXML(xmlStream, transkey, "", "", "","","", "", out);           
    251262            InputStream transformedStream = new ByteArrayInputStream(out.toByteArray());
    252263            //Admin.notifyUser("transformedStream:" + transformedStream.toString());
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/TermsProxyAction.java

    r795 r849  
    3838        }
    3939       
    40        
     40        /*
    4141         @Override
    4242         public String getRequestKey() {
     
    6969                        return key;
    7070        }
    71          
     71         */
    7272        public Termset getTermset() {           
    7373                String ts_id="";
     
    8585                 return val;
    8686        }
    87 
    88 
     87       
    8988        public URL getBaseURL() throws MalformedURLException {
    9089                       
     
    9594                return base_url;
    9695        }
     96       
    9797       
    9898         /**
     
    107107                URL targetURL = null;
    108108                //targetURL = new URL(getBaseURI() + getQ());
    109                 Admin.notifyUser("TPA.q: " + getQ());           
    110                 targetURL = new URL(getBaseURI() + getQ());
     109                Admin.notifyUser("TPA.q: " + getBaseURI() + getQ() + getRepository());         
     110                targetURL = new URL(getBaseURI() + getQ() + "&repository=" + getRepository());
    111111                // TPA.targetURL:http://localhost:8080/MDService2/model/matrix/?q=all
    112112            return targetURL;
     
    119119                        // if dcr|rr call model/matrix/all: http://localhost:8080/MDService2/model/matrix/?q=all
    120120                        // + run through terms2extract transform (parametrized with getQ()-param!!), to serve the subset = appropriate Termset
    121                         URL matrix_all_URL = new URL(getBaseURI() + ALL);
     121                        URL matrix_all_URL = new URL(getBaseURI() + ALL + "&repository="+ getRepository());
     122                        //URL matrix_all_URL = new URL(getBaseURI() + ALL );
     123                        Admin.notifyUser("TPA.getSourceStream: " + getBaseURI() + ALL);
    122124                        InputStream stream_matrix_all = matrix_all_URL.openStream();
    123125                        InputStream resultStream=null;
    124126                        try {
    125                                 resultStream = MDTransformer.getMDTransformer().transformXML(stream_matrix_all, "terms2extract", getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ());
     127                                resultStream = MDTransformer.getMDTransformer().transformXML(stream_matrix_all, "terms2extract", getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ(), getRepository());
    126128                        } catch (InterruptedException e) {                             
    127129                                Admin.notifyUser("TPA.getSourceStream(): "+ e.getMessage());
  • MDService2/trunk/MDService2/src/struts.xml

    r832 r849  
    178178                </action>
    179179               
    180                 <action name="workspaceprofilesave/" class="eu.clarin.cmdi.mdservice.action.WorkspaceAction" method="save">             
     180                <action name="workspaceprofilesave/*" class="eu.clarin.cmdi.mdservice.action.WorkspaceAction" method="save">           
    181181                           <param name="format">JSON</param>
    182                            <param name="type">USER</param>
     182                           <param name="type">{1}</param>
    183183                           <!-- <param name="data">{1}</param> 
    184184                           <param name="actionkey"></param>     
  • MDService2/trunk/MDService2/src/xsl/model2matrix.xsl

    r799 r849  
    3535        <xsl:variable name="termset_name" select="if (not(Term/@name='')) then Term/@name else replace(Term/@path,'/','')"></xsl:variable>
    3636
    37         <xsl:message>processing model-term: <xsl:value-of select="termset_name" /> </xsl:message>
     37        <xsl:message>processing model-term: <xsl:value-of select="$termset_name" /> </xsl:message>
    3838       
    3939        <xsl:choose>
     
    4242        </xsl:when>     
    4343        <xsl:when test="$termset_name='Components'" >
    44 
     44                <xsl:message>processing model-term: 1  <xsl:value-of select="$repository_uri" /></xsl:message>
    4545                <!--  get the whole Termset for every root-node (teiHeader, TCP, ...) -->
    4646                <Termsets>
    4747                <xsl:for-each select="Term/Term" >
    4848                        <xsl:variable name="termset_name" select="@name" />                     
    49                         <xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name)" />
    50                        
     49                        <xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name,'&amp;repository=',$repository_uri)" />
     50                        <xsl:message>processing model-term($resolved_termset_uri): <xsl:value-of select="$resolved_termset_uri" /> </xsl:message>
    5151                        <xsl:variable name="termset" select="document($resolved_termset_uri)" />
    5252
     
    6767        </xsl:when>
    6868        <xsl:otherwise>
    69        
    7069                <xsl:variable name="termset_name" select="Term/@name" />
    7170                <xsl:variable name="profile" select="my:profilematrix($termset_name)" />
     
    114113<xsl:template name="full-matrix" >
    115114<!--  collect all model termMatrix -->
    116 
    117                 <xsl:variable name="model_termsets_uri" select="concat($model_matrix_uri,'Components')" />
     115                <xsl:variable name="model_termsets_uri" select="concat($model_matrix_uri,'Components', '&amp;repository=',$repository_uri)" />         
    118116                <xsl:variable name="model_termsets" select="document($model_termsets_uri)" />
     117
    119118
    120119                <!--  collect all datcat terms -->
     
    135134                                </xsl:apply-templates>
    136135                </xsl:variable>
    137                
    138                                
     136                                               
    139137        <Termsets>
    140138                <xsl:copy-of select="$model_termsets/Termsets/*" />
  • MDService2/trunk/MDService2/src/xsl/params.xsl

    r823 r849  
    2323       
    2424                       
     25        <xsl:param name="repository_uri" select="''" />
     26       
    2527        <!--  for resolving components by suffixing with @ComponentId -->
    2628        <!-- <xsl:param name="components_uri" select="'http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/'" /> -->
Note: See TracChangeset for help on using the changeset viewer.