Statistics
| Revision:

svn-gvsig-desktop / tmp / trunk / servidor / WorkSpace_Servidor / wps-plugin-0.4.0-operation-StreetsMap / src / org / tigris / frogs / plugin / wpsint / impl_0_4_0 / operation / streetsmap / LocalizationTextOperation.java @ 26512

History | View | Annotate | Download (16.5 KB)

1
/*
2
 * ============================================================================
3
 * Copyright 2006 Government of Canada
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 * ============================================================================
17
*/
18
/*
19
 $Id: 
20
 $HeadURL: 
21
*/
22

    
23
/*
24
   **    **  *******   *****       *****    **   **     *****  
25
   **    **        ** **   **     **   **   **   **    **   ** 
26
   ** ** **  **    ** **          **  ***   **   **    **  *** 
27
   ** ** **  *******   *****      ** * **   **   **    ** * ** 
28
   ** ** **  **            **     ***  **   *******    ***  ** 
29
   ** ** **  **       **   **     **   ** **     ** ** **   ** 
30
    *******  **        *****       *****  **     ** **  *****  
31
 Generated from WPS 0.4.0 Code Generator Tool version 0.9.0 at Thu Feb 21 12:05:11 GMT+01:00 2008 By PS, RC, MC
32
*/
33

    
34
package org.tigris.frogs.plugin.wpsint.impl_0_4_0.operation.streetsmap;
35

    
36
import org.tigris.frogs.*;
37
import org.tigris.frogs.ows.*;
38
import org.tigris.frogs.plugin.wpsint.Constants;
39

    
40
 /**
41
  * Describe all texts describing this operation meaning the GetCapababilities and DescribeProcess
42
  *
43
  */
44
public class LocalizationTextOperation {
45

    
46
        public final static String SEPARATOR = ".";
47
        public final static String OPERATION_BASED_KEY = "WPS" + SEPARATOR + "0" + SEPARATOR + "4" + SEPARATOR + "0" + SEPARATOR + "Operation" + SEPARATOR;
48
        public final static String OPERATION_NAME = "StreetsMap";
49
        public final static String OPERATION_NAME_KEY = OPERATION_NAME + SEPARATOR;
50
        public final static String ABSTRACT_KEY = "Abstract";
51
        public final static String TITLE_KEY = "Title";
52
        public final static String ERROR_KEY = "Error";
53
        public final static String GETCAPABILITIES_KEY = "GetCapabilities" + SEPARATOR;
54
        public final static String UpdateSequenceAttribute = "1.0.0";
55

    
56
         /**
57
          * To be documented
58
          *
59
          * @return org.tigris.frogs.ows.KeywordsType[]
60
          *
61
          */
62
        public static KeywordsType[] getKeywords() {
63
                org.tigris.frogs.ows.impl_1_0_0.Keywords owsKeywords =
64
                        new org.tigris.frogs.ows.impl_1_0_0.Keywords();
65

    
66
                owsKeywords.setKeywords( new String[] {"FROGS", "WPS", "0.4.0", "StreetsMap", "callejero catastro gml wps wpsint" }  );
67

    
68
                CodeType owsCodeType =
69
                        new org.tigris.frogs.ows.impl_1_0_0.Code();
70

    
71
                owsCodeType.setCodeSpaceAttribute(null);
72
                owsCodeType.setValue("String");
73
                owsKeywords.setTypeCode(owsCodeType);
74

    
75
                return new KeywordsType[] { owsKeywords };
76
        }
77

    
78
         /**
79
          * To be documented
80
          *
81
          * @param langInterface
82
          * @return org.tigris.frogs.ows.ServiceIdentificationType
83
          *
84
          */
85
        public static ServiceIdentificationType getServiceIdentification( String langInterface ) {
86
                ServiceIdentificationType serviceIdentification =
87
                        new org.tigris.frogs.ows.impl_0_3_20.ServiceIdentification();
88

    
89
                serviceIdentification.setKeywords( getKeywords() );
90
                serviceIdentification.setAccessConstraints( getAccessConstraints(langInterface) );
91
                serviceIdentification.setFees( getFees(langInterface) );
92
                serviceIdentification.setOwsAbstract( getAbstract(langInterface) );
93
                serviceIdentification.setServiceTypeVersion(new String[] { getVersion() } );
94
                serviceIdentification.setTitle( getTitle(langInterface) );
95
                serviceIdentification.setServiceTypeCode(
96
                        org.tigris.frogs.plugin.wpsint.RequestFunctions.getCodeType(null,Constants.SERVICE_NAME) );
97

    
98
                return serviceIdentification;
99
        }
100

    
101
         /**
102
          * To be documented
103
          *
104
          * @param langInterface
105
          * @return String[]
106
          *
107
          */
108
        public static String[] getAccessConstraints( String langInterface ) {
109
                return new String[] {getGetCapabilitiesText(langInterface,"None")};
110
        }
111

    
112
         /**
113
          * To be documented
114
          *
115
          * @param langInterface
116
          * @return String
117
          *
118
          */
119
        public static String getFees( String langInterface ) {
120
                return getGetCapabilitiesText(langInterface,"None");
121
        }
122

    
123
         /**
124
          * To be documented
125
          *
126
          * @param langInterface
127
          * @return String
128
          *
129
          */
130
        public static String getAbstract( String langInterface ) {
131
                return (getText( langInterface, OPERATION_NAME_KEY + "General." + ABSTRACT_KEY) );
132
        }
133

    
134

    
135
         /**
136
          * To be documented
137
          *
138
          * @param langInterface
139
          * @return String
140
          *
141
          */
142
        public static String getTitle( String langInterface ) {
143
                return (getText( langInterface, OPERATION_NAME_KEY + "General." + TITLE_KEY) );
144
        }
145

    
146
         /**
147
          * To be documented
148
          *
149
          * @return String
150
          *
151
          */
152
        public static String getVersion() {
153
                return org.tigris.frogs.plugin.wpsint.impl_0_4_0.Version.RELEASE;
154
        }
155

    
156
         /**
157
          * To be documented
158
          *
159
          * @return String
160
          *
161
          */
162
        public static String getUpdateSequence() {
163
                return UpdateSequenceAttribute;
164
        }
165

    
166
         /**
167
          * To be documented
168
          *
169
          * @return String[]
170
          *
171
          */
172
        public static String[] getServiceTypeVersion() {
173
                return new String[] { getVersion() };
174
        }
175

    
176

    
177
         /**
178
          * To be documented
179
          *
180
          * @param langInterface
181
          * @return org.tigris.frogs.ows.ServiceProviderType
182
          *
183
          */
184
        public static ServiceProviderType getServiceProvider( String langInterface) {
185

    
186
                ServiceProviderType serviceProvider =
187
                                new org.tigris.frogs.ows.impl_0_3_20.ServiceProvider();
188

    
189
                ProviderSiteType provider =  new org.tigris.frogs.ows.impl_0_3_20.ProviderSite();
190
                ReferenceAttributeType refAttr = new org.tigris.frogs.ows.impl_0_3_20.ReferenceAttribute();
191
                        refAttr.setHref( getGetCapabilitiesText(langInterface,"WebSite") );
192
                provider.setOnlineResourceAttribute(refAttr);
193
                provider.setValue( getGetCapabilitiesText(langInterface,"Internet") );
194
                serviceProvider.setOnlineResource(provider);
195
                serviceProvider.setProviderName( getGetCapabilitiesText(langInterface,"ProviderName") );
196

    
197
                ServiceContactType contract = new org.tigris.frogs.ows.impl_0_3_20.ServiceContact();
198
                ContactInfoType contact = new org.tigris.frogs.ows.impl_0_3_20.ContactInfo();
199
                AddressType address = new org.tigris.frogs.ows.impl_0_3_20.Address();
200
                                address.setAdministrativeArea( getGetCapabilitiesText(langInterface,"AdministrativeArea") );
201
                                address.setCity( getGetCapabilitiesText(langInterface,"City") );
202
                                address.setCountry( getGetCapabilitiesText(langInterface,"Country") );
203
                                address.setDeliveryPoint(new String[] {getGetCapabilitiesText(langInterface,"DeliveryPoint") } );
204
                                address.setElectronicMailAddress(new String[] { getGetCapabilitiesText(langInterface,"ElectronicMailAddress") } );
205
                                address.setPostalCode(getGetCapabilitiesText(langInterface,"PostalCode") );
206
                        contact.setAddress(address);
207
                        contact.setContactInstructions(getGetCapabilitiesText(langInterface,"None") );
208
                        contact.setHoursOfService(getGetCapabilitiesText(langInterface,"HoursOfService") );
209
                        OnlineResourceType onlineResource = new org.tigris.frogs.ows.impl_0_3_20.OnlineResource();
210
                        ReferenceAttributeType refAttrResource = new org.tigris.frogs.ows.impl_0_3_20.ReferenceAttribute();
211
                                                refAttrResource.setHref(getGetCapabilitiesText(langInterface,"WebSite") );
212
                                onlineResource.setOnlineResourceAttribute(refAttrResource);
213
                                onlineResource.setValue(getGetCapabilitiesText(langInterface,"OnlineResource") );
214
                        contact.setOnlineResource(onlineResource);
215
                        PhoneType phone = new org.tigris.frogs.ows.impl_0_3_20.Phone();
216
                                phone.setFacsimiles(new String[] {getGetCapabilitiesText(langInterface,"Facsimiles") } );
217
                                phone.setVoices(new String[] {getGetCapabilitiesText(langInterface,"Voices") } );
218
                        contact.setPhone(phone);
219
                contract.setContactInfo(contact);
220
                contract.setIndividualName(getGetCapabilitiesText(langInterface,"IndividualName") );
221
                contract.setPositionName(getGetCapabilitiesText(langInterface,"PositionName") );
222
                contract.setRole(org.tigris.frogs.plugin.wpsint.RequestFunctions.getCodeType(null,getGetCapabilitiesText(langInterface,"Role") ));
223

    
224
                serviceProvider.setServiceContact(contract);
225

    
226
                return( serviceProvider );
227
        }
228

    
229
         /**
230
          * To be documented
231
          *
232
          * @param fullServerName
233
          * @return org.tigris.frogs.ows.impl_1_0_0.OperationsMetadataType
234
          *
235
          */
236
        public static org.tigris.frogs.ows.impl_1_0_0.OperationsMetadataType getOperationsMetadata( String fullServerName ) {
237
                org.tigris.frogs.ows.impl_1_0_0.OperationsMetadataType operationsMetadata =
238
                        new org.tigris.frogs.ows.impl_1_0_0.OperationsMetadata();
239

    
240
                operationsMetadata.setConstraint( getConstraints() );
241
                operationsMetadata.setExtendedCapabilities( getExtendedCapabilities() );
242
                operationsMetadata.setParameter( getParameters() );
243
                operationsMetadata.setOperation(new org.tigris.frogs.ows.impl_1_0_0.OperationType[]
244
                                        { getOperation(Kvp.REQUEST_GETCapabilities,fullServerName,true,true),
245
                                      getOperation(Constants.REQUEST_DESCRIBEPROCESS,fullServerName,true,true),
246
                                          getOperation(Constants.REQUEST_EXECUTE,fullServerName,true,true)  } );
247

    
248
                return( operationsMetadata );
249
        }
250

    
251
         /**
252
          * To be documented
253
          *
254
          * @param operationName
255
          * @param fullServerName
256
          * @param isHTTPPostSupported
257
          * @param isHTTPGetSupported
258
          * @return org.tigris.frogs.ows.impl_1_0_0.OperationType
259
          *
260
          */
261
        private static org.tigris.frogs.ows.impl_1_0_0.OperationType getOperation(
262
                                                                                           String operationName,
263
                                                                                           String fullServerName,
264
                                                                                           boolean isHTTPPostSupported,
265
                                                                                           boolean isHTTPGetSupported) {
266
                org.tigris.frogs.ows.impl_1_0_0.OperationType operation =
267
                        new org.tigris.frogs.ows.impl_1_0_0.Operation();
268

    
269
                operation.setConstraint( getConstraints() );
270
                if ( isHTTPPostSupported || isHTTPGetSupported ) {
271
                        org.tigris.frogs.ows.impl_1_0_0.DCPType dcp =
272
                                new org.tigris.frogs.ows.impl_1_0_0.DCP();
273
                        dcp.setHTTP(getHTTP(fullServerName,isHTTPPostSupported,isHTTPGetSupported));
274
                        operation.setDCP( new org.tigris.frogs.ows.impl_1_0_0.DCPType[] { dcp } );
275
                }
276
                operation.setMetadata(new org.tigris.frogs.ows.MetadataType[] { getMetadata() } );
277
                operation.setNameAttribute( operationName );
278
                operation.setParameter( getParameters() );
279

    
280
                return ( operation );
281
        }
282

    
283
         /**
284
          * To be documented
285
          *
286
          * @param operationName
287
          * @param fullAlternativeServerName
288
          * @param isHTTPPostSupported
289
          * @param isHTTPGetSupported
290
          * @return org.tigris.frogs.ows.impl_1_0_0.OperationType
291
          *
292
          */
293
        private static org.tigris.frogs.ows.impl_1_0_0.OperationType getOperation(
294
                                                        String operationName,
295
                                                        String[] fullAlternativeServerName,
296
                                                        boolean isHTTPPostSupported,
297
                                                        boolean isHTTPGetSupported) {
298
                org.tigris.frogs.ows.impl_1_0_0.OperationType operation =
299
                        new org.tigris.frogs.ows.impl_1_0_0.Operation();
300

    
301
                operation.setConstraint( getConstraints() );
302
                if ( isHTTPPostSupported || isHTTPGetSupported ) {
303
                        org.tigris.frogs.ows.impl_1_0_0.DCPType dcp =
304
                                new org.tigris.frogs.ows.impl_1_0_0.DCP();
305
                        dcp.setHTTP(getHTTP(fullAlternativeServerName,isHTTPPostSupported,isHTTPGetSupported));
306
                        operation.setDCP( new org.tigris.frogs.ows.impl_1_0_0.DCPType[] { dcp } );
307
                }
308
                operation.setMetadata(new MetadataType[] { getMetadata() } );
309
                operation.setNameAttribute( operationName );
310
                operation.setParameter( getParameters() );
311

    
312
                return ( operation );
313
        }
314

    
315
         /**
316
          * To be documented
317
          *
318
          * @param fullServerName
319
          * @param isHTTPPostSupported
320
          * @param isHTTPGetSupported
321
          * @return org.tigris.frogs.ows.impl_1_0_0.HTTPType
322
          *
323
          */
324
        private static org.tigris.frogs.ows.impl_1_0_0.HTTPType getHTTP(
325
                                                                    String fullServerName,
326
                                                                           boolean isHTTPPostSupported,
327
                                                                        boolean isHTTPGetSupported) {
328
                org.tigris.frogs.ows.impl_1_0_0.HTTPType http =
329
                        new org.tigris.frogs.ows.impl_1_0_0.HTTP();
330

    
331
                if ( fullServerName != null ) {
332
                        // If there is(are) comma(s), there is more than one server
333
                        // re-direct to another function
334
                        String[] servers = fullServerName.split(",");
335
                        if ( servers.length <= 1 ) {
336
                                // Could have more than one HTTP Get or Post for alternative URL
337
                                if ( isHTTPGetSupported ) {
338
                                        http.setHTTPGetOr( new org.tigris.frogs.ows.impl_1_0_0.HTTPGetType[] { getHTTPGet( fullServerName ) } );
339
                                }
340
                                if ( isHTTPGetSupported ) {
341
                                        http.setHTTPPostOr( new org.tigris.frogs.ows.impl_1_0_0.HTTPPostType[] { getHTTPPost( fullServerName ) } );
342
                                }
343
                        }
344
                        else {
345
                                http = getHTTP(servers,isHTTPPostSupported,isHTTPGetSupported);
346
                        }
347
                }
348

    
349
                return( http );
350
        }
351

    
352
         /**
353
          * To be documented
354
          *
355
          * @param fullAlternativeServerName
356
          * @param isHTTPPostSupported
357
          * @param isHTTPGetSupported
358
          * @return org.tigris.frogs.ows.impl_1_0_0.HTTPType
359
          *
360
          */
361
        private static org.tigris.frogs.ows.impl_1_0_0.HTTPType getHTTP(
362
                                        String[] fullAlternativeServerName,
363
                                        boolean isHTTPPostSupported,
364
                                        boolean isHTTPGetSupported) {
365
                org.tigris.frogs.ows.impl_1_0_0.HTTPType http =
366
                        new org.tigris.frogs.ows.impl_1_0_0.HTTP();
367

    
368
                if ( fullAlternativeServerName != null ) {
369
                        if ( fullAlternativeServerName.length > 0 ) {
370

    
371
                                org.tigris.frogs.ows.impl_1_0_0.HTTPGetType[] owsHTTPGets = new org.tigris.frogs.ows.impl_1_0_0.HTTPGet[ fullAlternativeServerName.length ];
372
                                org.tigris.frogs.ows.impl_1_0_0.HTTPPostType[] owsHTTPPosts = new org.tigris.frogs.ows.impl_1_0_0.HTTPPost[ fullAlternativeServerName.length ];
373

    
374
                                for (int index=0; index<fullAlternativeServerName.length; index++) {
375

    
376
                                        // Could have more than one HTTP Get or Post for alternative URL
377
                                        if ( isHTTPGetSupported ) {
378
                                                owsHTTPGets[ index ] = getHTTPGet( fullAlternativeServerName[index] );
379
                                        }
380
                                        if ( isHTTPGetSupported ) {
381
                                                owsHTTPPosts[ index ] = getHTTPPost( fullAlternativeServerName[index] );
382
                                        }
383
                                }
384

    
385
                                http.setHTTPGetOr( owsHTTPGets );
386
                                http.setHTTPPostOr( owsHTTPPosts );
387
                        }
388
                }
389

    
390
                return( http );
391
        }
392

    
393

    
394
         /**
395
          * To be documented
396
          *
397
          * @param fullServerName
398
          * @return org.tigris.frogs.ows.impl_1_0_0.HTTPGetType
399
          *
400
          */
401
        private static org.tigris.frogs.ows.impl_1_0_0.HTTPGetType getHTTPGet(
402
                                                                        String fullServerName ) {
403
                org.tigris.frogs.ows.impl_1_0_0.HTTPGetType httpGetType =
404
                        new org.tigris.frogs.ows.impl_1_0_0.HTTPGet();
405

    
406
                httpGetType.setGet( getRequestMethod(fullServerName) );
407

    
408
                return( httpGetType );
409
        }
410

    
411
         /**
412
          * To be documented
413
          *
414
          * @param fullServerName
415
          * @return org.tigris.frogs.ows.impl_1_0_0.HTTPPostType
416
          *
417
          */
418
        private static org.tigris.frogs.ows.impl_1_0_0.HTTPPostType getHTTPPost(
419
                                                                        String fullServerName ) {
420
                org.tigris.frogs.ows.impl_1_0_0.HTTPPostType httpPostType =
421
                        new org.tigris.frogs.ows.impl_1_0_0.HTTPPost();
422

    
423
                httpPostType.setPost( getRequestMethod(fullServerName) );
424

    
425
                return( httpPostType );
426
        }
427

    
428
         /**
429
          * To be documented
430
          *
431
          * @param fullServerName
432
          * @return org.tigris.frogs.ows.impl_1_0_0.RequestMethodType
433
          *
434
          */
435
        private static org.tigris.frogs.ows.impl_1_0_0.RequestMethodType getRequestMethod(
436
                                                                        String fullServerName ) {
437
                org.tigris.frogs.ows.impl_1_0_0.RequestMethodType method =
438
                                new org.tigris.frogs.ows.impl_1_0_0.RequestMethod();
439

    
440
                method.setConstraint( getConstraints() );
441
                ReferenceAttributeType refAttr = new org.tigris.frogs.ows.impl_0_3_20.ReferenceAttribute();
442
                                refAttr.setHref(fullServerName);
443
                method.setReferenceAttr(refAttr);
444

    
445
                return( method );
446
        }
447

    
448
         /**
449
          * To be documented
450
          *
451
          * @return org.tigris.frogs.ows.impl_1_0_0.DomainType[]
452
          *
453
          */
454
        private static org.tigris.frogs.ows.impl_1_0_0.DomainType[] getConstraints() {
455
                // No constraits
456
                return (null);
457
        }
458

    
459
         /**
460
          * To be documented
461
          *
462
          * @return org.tigris.frogs.ows.impl_1_0_0.DomainType[]
463
          *
464
          */
465
        private static org.tigris.frogs.ows.impl_1_0_0.DomainType[] getParameters() {
466
                // No parameters constraits
467
                return (null);
468
        }
469

    
470
         /**
471
          * To be documented
472
          *
473
          * @return org.tigris.frogs.ows.ExtendedCapabilitiesType
474
          *
475
          */
476
        private static ExtendedCapabilitiesType getExtendedCapabilities() {
477
                // No extended capabilities for this service
478
                return (null);
479
        }
480

    
481
         /**
482
          * To be documented
483
          *
484
          * @return org.tigris.frogs.ows.MetadataType
485
          *
486
          */
487
        private static MetadataType getMetadata() {
488
                // No metadata supported
489
                return (null);
490
        }
491

    
492
         /**
493
          * GetCapabilities LocalizationTextProcess according to the language
494
          *
495
          * @param langInterface
496
          * @param code
497
          * @return String
498
          *
499
          */
500
        public static String getGetCapabilitiesText(String langInterface, String code ) {
501
                return getText(langInterface, GETCAPABILITIES_KEY + code);
502
   }
503

    
504
         /**
505
          * Get LocalizationTextProcess according to the language
506
          *
507
          * @param langInterface
508
          * @param code
509
          * @return String
510
          *
511
          */
512
        public static String getText(String langInterface, String code ) {
513
                return Localization.getResource().getText( langInterface, OPERATION_BASED_KEY + code);
514
   }
515
        
516
}