1 | // SECTION-START[License Header] |
2 | // <editor-fold defaultstate="collapsed" desc=" Generated License "> |
3 | /* |
4 | * Java Object Management and Configuration |
5 | * Copyright (C) Christian Schulte, 2005-206 |
6 | * All rights reserved. |
7 | * |
8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions |
10 | * are met: |
11 | * |
12 | * o Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. |
14 | * |
15 | * o Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in |
17 | * the documentation and/or other materials provided with the |
18 | * distribution. |
19 | * |
20 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
21 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
22 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
23 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, |
24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | * |
31 | * $JOMC: AbstractModletCommand.java 4917 2014-02-25 15:21:56Z schulte $ |
32 | * |
33 | */ |
34 | // </editor-fold> |
35 | // SECTION-END |
36 | package org.jomc.cli.commands; |
37 | |
38 | import java.io.BufferedReader; |
39 | import java.io.Closeable; |
40 | import java.io.File; |
41 | import java.io.FileOutputStream; |
42 | import java.io.FileReader; |
43 | import java.io.IOException; |
44 | import java.io.InputStream; |
45 | import java.io.OutputStream; |
46 | import java.io.StringWriter; |
47 | import java.net.URI; |
48 | import java.net.URL; |
49 | import java.net.URLClassLoader; |
50 | import java.util.ArrayList; |
51 | import java.util.Arrays; |
52 | import java.util.Enumeration; |
53 | import java.util.HashSet; |
54 | import java.util.Iterator; |
55 | import java.util.List; |
56 | import java.util.Map; |
57 | import java.util.Set; |
58 | import java.util.logging.Level; |
59 | import javax.xml.bind.JAXBElement; |
60 | import javax.xml.bind.JAXBException; |
61 | import javax.xml.bind.Marshaller; |
62 | import javax.xml.bind.PropertyException; |
63 | import javax.xml.transform.ErrorListener; |
64 | import javax.xml.transform.Source; |
65 | import javax.xml.transform.Transformer; |
66 | import javax.xml.transform.TransformerConfigurationException; |
67 | import javax.xml.transform.TransformerException; |
68 | import javax.xml.transform.TransformerFactory; |
69 | import org.apache.commons.cli.CommandLine; |
70 | import org.apache.commons.io.IOUtils; |
71 | import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement; |
72 | import org.jomc.model.ModelObject; |
73 | import org.jomc.modlet.DefaultModelContext; |
74 | import org.jomc.modlet.DefaultModletProvider; |
75 | import org.jomc.modlet.ModelContext; |
76 | import org.jomc.modlet.ModelContextFactory; |
77 | import org.jomc.modlet.ModelException; |
78 | import org.jomc.modlet.ModelValidationReport; |
79 | import org.jomc.modlet.Modlet; |
80 | import org.jomc.modlet.ModletObject; |
81 | import org.jomc.modlet.ModletProvider; |
82 | import org.jomc.modlet.Modlets; |
83 | import org.jomc.modlet.ObjectFactory; |
84 | import org.jomc.modlet.Schema; |
85 | import org.jomc.modlet.Schemas; |
86 | import org.jomc.modlet.Service; |
87 | import org.jomc.modlet.Services; |
88 | |
89 | // SECTION-START[Documentation] |
90 | // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> |
91 | /** |
92 | * JOMC ⁑ CLI ⁑ modlet based command implementation. |
93 | * |
94 | * <dl> |
95 | * <dt><b>Identifier:</b></dt><dd>JOMC ⁑ CLI ⁑ Modlet Command</dd> |
96 | * <dt><b>Name:</b></dt><dd>JOMC ⁑ CLI ⁑ Modlet Command</dd> |
97 | * <dt><b>Specifications:</b></dt> |
98 | * <dd>JOMC ⁑ CLI ⁑ Command @ 1.0</dd> |
99 | * <dt><b>Abstract:</b></dt><dd>Yes</dd> |
100 | * <dt><b>Final:</b></dt><dd>No</dd> |
101 | * <dt><b>Stateless:</b></dt><dd>No</dd> |
102 | * </dl> |
103 | * |
104 | * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0 |
105 | * @version 1.6.2 |
106 | */ |
107 | // </editor-fold> |
108 | // SECTION-END |
109 | // SECTION-START[Annotations] |
110 | // <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> |
111 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
112 | // </editor-fold> |
113 | // SECTION-END |
114 | public abstract class AbstractModletCommand extends AbstractCommand |
115 | { |
116 | // SECTION-START[Command] |
117 | // SECTION-END |
118 | // SECTION-START[AbstractModletCommand] |
119 | |
120 | /** |
121 | * Creates a new {@code Transformer} from a given {@code Source}. |
122 | * |
123 | * @param source The source to initialize the transformer with. |
124 | * |
125 | * @return A {@code Transformer} backed by {@code source}. |
126 | * |
127 | * @throws NullPointerException if {@code source} is {@code null}. |
128 | * @throws CommandExecutionException if creating a transformer fails. |
129 | */ |
130 | protected Transformer createTransformer( final Source source ) throws CommandExecutionException |
131 | { |
132 | if ( source == null ) |
133 | { |
134 | throw new NullPointerException( "source" ); |
135 | } |
136 | |
137 | final ErrorListener errorListener = new ErrorListener() |
138 | { |
139 | |
140 | public void warning( final TransformerException exception ) throws TransformerException |
141 | { |
142 | log( Level.WARNING, null, exception ); |
143 | } |
144 | |
145 | public void error( final TransformerException exception ) throws TransformerException |
146 | { |
147 | throw exception; |
148 | } |
149 | |
150 | public void fatalError( final TransformerException exception ) throws TransformerException |
151 | { |
152 | throw exception; |
153 | } |
154 | |
155 | }; |
156 | |
157 | try |
158 | { |
159 | final TransformerFactory transformerFactory = TransformerFactory.newInstance(); |
160 | transformerFactory.setErrorListener( errorListener ); |
161 | final Transformer transformer = transformerFactory.newTransformer( source ); |
162 | transformer.setErrorListener( errorListener ); |
163 | |
164 | for ( Map.Entry<Object, Object> e : System.getProperties().entrySet() ) |
165 | { |
166 | transformer.setParameter( e.getKey().toString(), e.getValue() ); |
167 | } |
168 | |
169 | return transformer; |
170 | } |
171 | catch ( final TransformerConfigurationException e ) |
172 | { |
173 | throw new CommandExecutionException( getExceptionMessage( e ), e ); |
174 | } |
175 | } |
176 | |
177 | /** |
178 | * Creates a new {@code ModelContext} for a given {@code CommandLine} and {@code ClassLoader}. |
179 | * |
180 | * @param commandLine The {@code CommandLine} to create a new {@code ModelContext} with. |
181 | * @param classLoader The {@code ClassLoader} to create a new {@code ModelContext} with. |
182 | * |
183 | * @return A new {@code ModelContext} for {@code classLoader} setup using {@code commandLine}. |
184 | * |
185 | * @throws NullPointerException if {@code commandLine} is {@code null}. |
186 | * @throws CommandExecutionException if creating an new {@code ModelContext} fails. |
187 | */ |
188 | protected ModelContext createModelContext( final CommandLine commandLine, final ClassLoader classLoader ) |
189 | throws CommandExecutionException |
190 | { |
191 | if ( commandLine == null ) |
192 | { |
193 | throw new NullPointerException( "commandLine" ); |
194 | } |
195 | |
196 | final ModelContextFactory modelContextFactory; |
197 | if ( commandLine.hasOption( this.getModelContextFactoryOption().getOpt() ) ) |
198 | { |
199 | modelContextFactory = ModelContextFactory.newInstance( commandLine.getOptionValue( |
200 | this.getModelContextFactoryOption().getOpt() ) ); |
201 | |
202 | } |
203 | else |
204 | { |
205 | modelContextFactory = ModelContextFactory.newInstance(); |
206 | } |
207 | |
208 | final ModelContext modelContext = modelContextFactory.newModelContext( classLoader ); |
209 | |
210 | if ( commandLine.hasOption( this.getModletSchemaSystemIdOption().getOpt() ) ) |
211 | { |
212 | modelContext.setModletSchemaSystemId( |
213 | commandLine.getOptionValue( this.getModletSchemaSystemIdOption().getOpt() ) ); |
214 | |
215 | } |
216 | |
217 | modelContext.setLogLevel( this.getLogLevel() ); |
218 | modelContext.getListeners().add( new ModelContext.Listener() |
219 | { |
220 | |
221 | @Override |
222 | public void onLog( final Level level, final String message, final Throwable t ) |
223 | { |
224 | super.onLog( level, message, t ); |
225 | log( level, message, t ); |
226 | } |
227 | |
228 | } ); |
229 | |
230 | if ( commandLine.hasOption( this.getProviderLocationOption().getOpt() ) ) |
231 | { |
232 | modelContext.setAttribute( DefaultModelContext.PROVIDER_LOCATION_ATTRIBUTE_NAME, |
233 | commandLine.getOptionValue( this.getProviderLocationOption().getOpt() ) ); |
234 | |
235 | } |
236 | |
237 | if ( commandLine.hasOption( this.getPlatformProviderLocationOption().getOpt() ) ) |
238 | { |
239 | modelContext.setAttribute( |
240 | DefaultModelContext.PLATFORM_PROVIDER_LOCATION_ATTRIBUTE_NAME, |
241 | commandLine.getOptionValue( this.getPlatformProviderLocationOption().getOpt() ) ); |
242 | |
243 | } |
244 | |
245 | if ( commandLine.hasOption( this.getModletLocationOption().getOpt() ) ) |
246 | { |
247 | modelContext.setAttribute( DefaultModletProvider.MODLET_LOCATION_ATTRIBUTE_NAME, |
248 | commandLine.getOptionValue( this.getModletLocationOption().getOpt() ) ); |
249 | |
250 | } |
251 | |
252 | modelContext.setAttribute( DefaultModletProvider.VALIDATING_ATTRIBUTE_NAME, |
253 | !commandLine.hasOption( this.getNoModletResourceValidation().getOpt() ) ); |
254 | |
255 | return modelContext; |
256 | } |
257 | |
258 | /** |
259 | * Gets the identifier of the model to process. |
260 | * |
261 | * @param commandLine The command line to get the identifier of the model to process from. |
262 | * |
263 | * @return The identifier of the model to process. |
264 | * |
265 | * @throws NullPointerException if {@code commandLine} is {@code null}. |
266 | */ |
267 | protected String getModel( final CommandLine commandLine ) |
268 | { |
269 | if ( commandLine == null ) |
270 | { |
271 | throw new NullPointerException( "commandLine" ); |
272 | } |
273 | |
274 | return commandLine.hasOption( this.getModelOption().getOpt() ) |
275 | ? commandLine.getOptionValue( this.getModelOption().getOpt() ) |
276 | : ModelObject.MODEL_PUBLIC_ID; |
277 | |
278 | } |
279 | |
280 | /** |
281 | * Logs a validation report. |
282 | * |
283 | * @param validationReport The report to log. |
284 | * @param marshaller The marshaller to use for logging the report. |
285 | * |
286 | * @throws CommandExecutionException if logging a report detail element fails. |
287 | */ |
288 | protected void log( final ModelValidationReport validationReport, final Marshaller marshaller ) |
289 | throws CommandExecutionException |
290 | { |
291 | Object jaxbFormattedOutput = null; |
292 | try |
293 | { |
294 | jaxbFormattedOutput = marshaller.getProperty( Marshaller.JAXB_FORMATTED_OUTPUT ); |
295 | marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE ); |
296 | } |
297 | catch ( final PropertyException e ) |
298 | { |
299 | this.log( Level.INFO, null, e ); |
300 | jaxbFormattedOutput = null; |
301 | } |
302 | |
303 | try |
304 | { |
305 | |
306 | for ( ModelValidationReport.Detail d : validationReport.getDetails() ) |
307 | { |
308 | if ( this.isLoggable( d.getLevel() ) ) |
309 | { |
310 | this.log( d.getLevel(), "o " + d.getMessage(), null ); |
311 | |
312 | if ( d.getElement() != null && this.getLogLevel().intValue() < Level.INFO.intValue() ) |
313 | { |
314 | final StringWriter stringWriter = new StringWriter(); |
315 | marshaller.marshal( d.getElement(), stringWriter ); |
316 | this.log( d.getLevel(), stringWriter.toString(), null ); |
317 | } |
318 | } |
319 | } |
320 | } |
321 | catch ( final JAXBException e ) |
322 | { |
323 | String message = getExceptionMessage( e ); |
324 | if ( message == null ) |
325 | { |
326 | message = getExceptionMessage( e.getLinkedException() ); |
327 | } |
328 | |
329 | throw new CommandExecutionException( message, e ); |
330 | } |
331 | finally |
332 | { |
333 | try |
334 | { |
335 | marshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, jaxbFormattedOutput ); |
336 | } |
337 | catch ( final PropertyException e ) |
338 | { |
339 | this.log( Level.INFO, null, e ); |
340 | } |
341 | } |
342 | } |
343 | |
344 | /** |
345 | * Gets the document files specified by a given command line. |
346 | * |
347 | * @param commandLine The command line specifying the document files to get. |
348 | * |
349 | * @return The document files specified by {@code commandLine}. |
350 | * |
351 | * @throws CommandExecutionException if getting the document files fails. |
352 | */ |
353 | protected Set<File> getDocumentFiles( final CommandLine commandLine ) throws CommandExecutionException |
354 | { |
355 | try |
356 | { |
357 | final Set<File> files = new HashSet<File>(); |
358 | |
359 | if ( commandLine.hasOption( this.getDocumentsOption().getOpt() ) ) |
360 | { |
361 | final String[] elements = commandLine.getOptionValues( this.getDocumentsOption().getOpt() ); |
362 | if ( elements != null ) |
363 | { |
364 | for ( String e : elements ) |
365 | { |
366 | if ( e.startsWith( "@" ) ) |
367 | { |
368 | String line = null; |
369 | final File file = new File( e.substring( 1 ) ); |
370 | BufferedReader reader = null; |
371 | boolean suppressExceptionOnClose = true; |
372 | |
373 | try |
374 | { |
375 | reader = new BufferedReader( new FileReader( file ) ); |
376 | while ( ( line = reader.readLine() ) != null ) |
377 | { |
378 | line = line.trim(); |
379 | if ( !line.startsWith( "#" ) ) |
380 | { |
381 | final File f = new File( line ); |
382 | |
383 | if ( f.exists() ) |
384 | { |
385 | if ( this.isLoggable( Level.FINER ) ) |
386 | { |
387 | this.log( Level.FINER, this.getDocumentFileInfo( |
388 | this.getLocale(), f.getAbsolutePath() ), null ); |
389 | |
390 | } |
391 | |
392 | files.add( f ); |
393 | } |
394 | else if ( this.isLoggable( Level.WARNING ) ) |
395 | { |
396 | this.log( Level.WARNING, this.getDocumentFileNotFoundWarning( |
397 | this.getLocale(), f.getAbsolutePath() ), null ); |
398 | |
399 | } |
400 | } |
401 | } |
402 | |
403 | suppressExceptionOnClose = false; |
404 | } |
405 | finally |
406 | { |
407 | try |
408 | { |
409 | if ( reader != null ) |
410 | { |
411 | reader.close(); |
412 | } |
413 | } |
414 | catch ( final IOException ex ) |
415 | { |
416 | if ( suppressExceptionOnClose ) |
417 | { |
418 | this.log( Level.SEVERE, getExceptionMessage( ex ), ex ); |
419 | } |
420 | else |
421 | { |
422 | throw new CommandExecutionException( getExceptionMessage( ex ), ex ); |
423 | } |
424 | } |
425 | } |
426 | } |
427 | else |
428 | { |
429 | final File file = new File( e ); |
430 | |
431 | if ( file.exists() ) |
432 | { |
433 | if ( this.isLoggable( Level.FINER ) ) |
434 | { |
435 | this.log( Level.FINER, this.getDocumentFileInfo( |
436 | this.getLocale(), file.getAbsolutePath() ), null ); |
437 | |
438 | } |
439 | |
440 | files.add( file ); |
441 | } |
442 | else if ( this.isLoggable( Level.WARNING ) ) |
443 | { |
444 | this.log( Level.WARNING, this.getDocumentFileNotFoundWarning( |
445 | this.getLocale(), file.getAbsolutePath() ), null ); |
446 | |
447 | } |
448 | } |
449 | } |
450 | } |
451 | } |
452 | |
453 | return files; |
454 | } |
455 | catch ( final IOException e ) |
456 | { |
457 | throw new CommandExecutionException( getExceptionMessage( e ), e ); |
458 | } |
459 | } |
460 | |
461 | /** |
462 | * Class loader backed by a command line. |
463 | * |
464 | * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> |
465 | * @version $JOMC: AbstractModletCommand.java 4917 2014-02-25 15:21:56Z schulte $ |
466 | */ |
467 | public class CommandLineClassLoader extends URLClassLoader |
468 | { |
469 | |
470 | /** {@code Modlets} excluded by the instance. */ |
471 | private Modlets excludedModlets; |
472 | |
473 | /** Set of provider resource locations to filter. */ |
474 | private final Set<String> providerResourceLocations = new HashSet<String>(); |
475 | |
476 | /** Set of modlet resource locations to filter. */ |
477 | private final Set<String> modletResourceLocations = new HashSet<String>(); |
478 | |
479 | /** Set of temporary resources. */ |
480 | private final Set<File> temporaryResources = new HashSet<File>(); |
481 | |
482 | /** |
483 | * Creates a new {@code CommandLineClassLoader} taking a command line backing the class loader. |
484 | * |
485 | * @param commandLine The command line backing the class loader. |
486 | * |
487 | * @throws NullPointerException if {@code commandLine} is {@code null}. |
488 | * @throws CommandExecutionException if processing {@code commandLine} fails. |
489 | */ |
490 | public CommandLineClassLoader( final CommandLine commandLine ) throws CommandExecutionException |
491 | { |
492 | super( new URL[ 0 ] ); |
493 | |
494 | try |
495 | { |
496 | if ( commandLine.hasOption( getClasspathOption().getOpt() ) ) |
497 | { |
498 | final Set<URI> uris = new HashSet<URI>(); |
499 | final String[] elements = commandLine.getOptionValues( getClasspathOption().getOpt() ); |
500 | |
501 | if ( elements != null ) |
502 | { |
503 | for ( String e : elements ) |
504 | { |
505 | if ( e.startsWith( "@" ) ) |
506 | { |
507 | String line = null; |
508 | final File file = new File( e.substring( 1 ) ); |
509 | BufferedReader reader = null; |
510 | boolean suppressExceptionOnClose = true; |
511 | |
512 | try |
513 | { |
514 | reader = new BufferedReader( new FileReader( file ) ); |
515 | while ( ( line = reader.readLine() ) != null ) |
516 | { |
517 | line = line.trim(); |
518 | if ( !line.startsWith( "#" ) ) |
519 | { |
520 | final File f = new File( line ); |
521 | |
522 | if ( f.exists() ) |
523 | { |
524 | uris.add( f.toURI() ); |
525 | } |
526 | else if ( isLoggable( Level.WARNING ) ) |
527 | { |
528 | log( Level.WARNING, getClasspathElementNotFoundWarning( |
529 | getLocale(), f.getAbsolutePath() ), null ); |
530 | |
531 | } |
532 | } |
533 | } |
534 | |
535 | suppressExceptionOnClose = false; |
536 | } |
537 | finally |
538 | { |
539 | try |
540 | { |
541 | if ( reader != null ) |
542 | { |
543 | reader.close(); |
544 | } |
545 | } |
546 | catch ( final IOException ex ) |
547 | { |
548 | if ( suppressExceptionOnClose ) |
549 | { |
550 | log( Level.SEVERE, getExceptionMessage( ex ), ex ); |
551 | } |
552 | else |
553 | { |
554 | throw new CommandExecutionException( getExceptionMessage( ex ), ex ); |
555 | } |
556 | } |
557 | } |
558 | } |
559 | else |
560 | { |
561 | final File file = new File( e ); |
562 | |
563 | if ( file.exists() ) |
564 | { |
565 | uris.add( file.toURI() ); |
566 | } |
567 | else if ( isLoggable( Level.WARNING ) ) |
568 | { |
569 | log( Level.WARNING, getClasspathElementNotFoundWarning( |
570 | getLocale(), file.getAbsolutePath() ), null ); |
571 | |
572 | } |
573 | } |
574 | } |
575 | } |
576 | |
577 | for ( URI uri : uris ) |
578 | { |
579 | if ( isLoggable( Level.FINEST ) ) |
580 | { |
581 | log( Level.FINEST, getClasspathElementInfo( getLocale(), uri.toASCIIString() ), null ); |
582 | } |
583 | |
584 | this.addURL( uri.toURL() ); |
585 | } |
586 | |
587 | if ( commandLine.hasOption( getProviderLocationOption().getOpt() ) ) |
588 | { |
589 | this.providerResourceLocations.add( |
590 | commandLine.getOptionValue( getProviderLocationOption().getOpt() ) |
591 | + "/" + ModletProvider.class.getName() ); |
592 | |
593 | } |
594 | else |
595 | { |
596 | this.providerResourceLocations.add( |
597 | DefaultModelContext.getDefaultProviderLocation() + "/" + ModletProvider.class.getName() ); |
598 | |
599 | } |
600 | |
601 | if ( commandLine.hasOption( getModletLocationOption().getOpt() ) ) |
602 | { |
603 | this.modletResourceLocations.add( |
604 | commandLine.getOptionValue( getModletLocationOption().getOpt() ) ); |
605 | |
606 | } |
607 | else |
608 | { |
609 | this.modletResourceLocations.add( DefaultModletProvider.getDefaultModletLocation() ); |
610 | } |
611 | } |
612 | } |
613 | catch ( final IOException e ) |
614 | { |
615 | throw new CommandExecutionException( getExceptionMessage( e ), e ); |
616 | } |
617 | } |
618 | |
619 | /** |
620 | * Gets the {@code Modlets} excluded by the instance. |
621 | * |
622 | * @return The {@code Modlets} excluded by the instance. |
623 | */ |
624 | public Modlets getExcludedModlets() |
625 | { |
626 | if ( this.excludedModlets == null ) |
627 | { |
628 | this.excludedModlets = new Modlets(); |
629 | } |
630 | |
631 | return this.excludedModlets; |
632 | } |
633 | |
634 | /** |
635 | * Finds the resource with the specified name on the URL search path. |
636 | * |
637 | * @param name The name of the resource. |
638 | * |
639 | * @return A {@code URL} for the resource or {@code null}, if the resource could not be found. |
640 | */ |
641 | @Override |
642 | public URL findResource( final String name ) |
643 | { |
644 | try |
645 | { |
646 | URL resource = super.findResource( name ); |
647 | |
648 | if ( resource != null ) |
649 | { |
650 | if ( this.providerResourceLocations.contains( name ) ) |
651 | { |
652 | resource = this.filterProviders( resource ); |
653 | } |
654 | else if ( this.modletResourceLocations.contains( name ) ) |
655 | { |
656 | resource = this.filterModlets( resource ); |
657 | } |
658 | } |
659 | |
660 | return resource; |
661 | } |
662 | catch ( final IOException e ) |
663 | { |
664 | log( Level.SEVERE, null, e ); |
665 | return null; |
666 | } |
667 | catch ( final JAXBException e ) |
668 | { |
669 | log( Level.SEVERE, null, e ); |
670 | return null; |
671 | } |
672 | catch ( final ModelException e ) |
673 | { |
674 | log( Level.SEVERE, null, e ); |
675 | return null; |
676 | } |
677 | } |
678 | |
679 | /** |
680 | * Returns an {@code Enumeration} of {@code URL}s representing all of the resources on the URL search path |
681 | * having the specified name. |
682 | * |
683 | * @param name The resource name. |
684 | * |
685 | * @throws IOException if an I/O exception occurs |
686 | * |
687 | * @return An {@code Enumeration} of {@code URL}s. |
688 | */ |
689 | @Override |
690 | public Enumeration<URL> findResources( final String name ) throws IOException |
691 | { |
692 | final Enumeration<URL> allResources = super.findResources( name ); |
693 | |
694 | Enumeration<URL> enumeration = allResources; |
695 | |
696 | if ( this.providerResourceLocations.contains( name ) ) |
697 | { |
698 | enumeration = new Enumeration<URL>() |
699 | { |
700 | |
701 | public boolean hasMoreElements() |
702 | { |
703 | return allResources.hasMoreElements(); |
704 | } |
705 | |
706 | public URL nextElement() |
707 | { |
708 | try |
709 | { |
710 | return filterProviders( allResources.nextElement() ); |
711 | } |
712 | catch ( final IOException e ) |
713 | { |
714 | log( Level.SEVERE, null, e ); |
715 | return null; |
716 | } |
717 | } |
718 | |
719 | }; |
720 | } |
721 | else if ( this.modletResourceLocations.contains( name ) ) |
722 | { |
723 | enumeration = new Enumeration<URL>() |
724 | { |
725 | |
726 | public boolean hasMoreElements() |
727 | { |
728 | return allResources.hasMoreElements(); |
729 | } |
730 | |
731 | public URL nextElement() |
732 | { |
733 | try |
734 | { |
735 | return filterModlets( allResources.nextElement() ); |
736 | } |
737 | catch ( final IOException e ) |
738 | { |
739 | log( Level.SEVERE, null, e ); |
740 | return null; |
741 | } |
742 | catch ( final JAXBException e ) |
743 | { |
744 | log( Level.SEVERE, null, e ); |
745 | return null; |
746 | } |
747 | catch ( final ModelException e ) |
748 | { |
749 | log( Level.SEVERE, null, e ); |
750 | return null; |
751 | } |
752 | } |
753 | |
754 | }; |
755 | } |
756 | |
757 | return enumeration; |
758 | } |
759 | |
760 | /** |
761 | * Closes the class loader. |
762 | * @throws IOException if closing the class loader fails. |
763 | */ |
764 | @Override |
765 | @IgnoreJRERequirement |
766 | public void close() throws IOException |
767 | { |
768 | for ( final Iterator<File> it = this.temporaryResources.iterator(); it.hasNext(); ) |
769 | { |
770 | final File temporaryResource = it.next(); |
771 | |
772 | if ( temporaryResource.exists() && temporaryResource.delete() ) |
773 | { |
774 | it.remove(); |
775 | } |
776 | } |
777 | |
778 | if ( Closeable.class.isAssignableFrom( CommandLineClassLoader.class ) ) |
779 | { |
780 | super.close(); |
781 | } |
782 | } |
783 | |
784 | /** |
785 | * Removes temporary resources. |
786 | * @throws Throwable if finalization fails. |
787 | */ |
788 | @Override |
789 | protected void finalize() throws Throwable |
790 | { |
791 | for ( final Iterator<File> it = this.temporaryResources.iterator(); it.hasNext(); ) |
792 | { |
793 | final File temporaryResource = it.next(); |
794 | |
795 | if ( temporaryResource.exists() && !temporaryResource.delete() ) |
796 | { |
797 | temporaryResource.deleteOnExit(); |
798 | } |
799 | |
800 | it.remove(); |
801 | } |
802 | |
803 | super.finalize(); |
804 | } |
805 | |
806 | private URL filterProviders( final URL resource ) throws IOException |
807 | { |
808 | InputStream in = null; |
809 | boolean suppressExceptionOnClose = true; |
810 | |
811 | try |
812 | { |
813 | in = resource.openStream(); |
814 | URL filteredResource = resource; |
815 | final List<String> lines = IOUtils.readLines( in, "UTF-8" ); |
816 | final List<String> providerExcludes = Arrays.asList( getProviderExcludes().split( ":" ) ); |
817 | final List<String> filteredLines = new ArrayList<String>( lines.size() ); |
818 | |
819 | for ( String line : lines ) |
820 | { |
821 | if ( !providerExcludes.contains( line.trim() ) ) |
822 | { |
823 | filteredLines.add( line.trim() ); |
824 | } |
825 | else |
826 | { |
827 | log( Level.FINE, |
828 | getExcludedProviderInfo( getLocale(), resource.toExternalForm(), line.toString() ), null ); |
829 | |
830 | } |
831 | } |
832 | |
833 | if ( lines.size() != filteredLines.size() ) |
834 | { |
835 | OutputStream out = null; |
836 | final File tmpResource = File.createTempFile( this.getClass().getName(), ".rsrc" ); |
837 | this.temporaryResources.add( tmpResource ); |
838 | |
839 | try |
840 | { |
841 | out = new FileOutputStream( tmpResource ); |
842 | IOUtils.writeLines( filteredLines, System.getProperty( "line.separator", "\n" ), out, "UTF-8" ); |
843 | suppressExceptionOnClose = false; |
844 | } |
845 | finally |
846 | { |
847 | try |
848 | { |
849 | if ( out != null ) |
850 | { |
851 | out.close(); |
852 | } |
853 | |
854 | suppressExceptionOnClose = true; |
855 | } |
856 | catch ( final IOException e ) |
857 | { |
858 | if ( suppressExceptionOnClose ) |
859 | { |
860 | log( Level.SEVERE, getExceptionMessage( e ), e ); |
861 | } |
862 | else |
863 | { |
864 | throw e; |
865 | } |
866 | } |
867 | } |
868 | |
869 | filteredResource = tmpResource.toURI().toURL(); |
870 | } |
871 | |
872 | suppressExceptionOnClose = false; |
873 | return filteredResource; |
874 | } |
875 | finally |
876 | { |
877 | try |
878 | { |
879 | if ( in != null ) |
880 | { |
881 | in.close(); |
882 | } |
883 | } |
884 | catch ( final IOException e ) |
885 | { |
886 | if ( suppressExceptionOnClose ) |
887 | { |
888 | log( Level.SEVERE, getExceptionMessage( e ), e ); |
889 | } |
890 | else |
891 | { |
892 | throw e; |
893 | } |
894 | } |
895 | } |
896 | } |
897 | |
898 | private URL filterModlets( final URL resource ) throws ModelException, IOException, JAXBException |
899 | { |
900 | URL filteredResource = resource; |
901 | final List<String> excludedModletNames = Arrays.asList( getModletExcludes().split( ":" ) ); |
902 | final ModelContext modelContext = ModelContextFactory.newInstance().newModelContext(); |
903 | Object o = modelContext.createUnmarshaller( ModletObject.MODEL_PUBLIC_ID ).unmarshal( resource ); |
904 | if ( o instanceof JAXBElement<?> ) |
905 | { |
906 | o = ( (JAXBElement<?>) o ).getValue(); |
907 | } |
908 | |
909 | Modlets modlets = null; |
910 | boolean filtered = false; |
911 | |
912 | if ( o instanceof Modlets ) |
913 | { |
914 | modlets = (Modlets) o; |
915 | } |
916 | else if ( o instanceof Modlet ) |
917 | { |
918 | modlets = new Modlets(); |
919 | modlets.getModlet().add( (Modlet) o ); |
920 | } |
921 | |
922 | if ( modlets != null ) |
923 | { |
924 | for ( final Iterator<Modlet> it = modlets.getModlet().iterator(); it.hasNext(); ) |
925 | { |
926 | final Modlet m = it.next(); |
927 | |
928 | if ( excludedModletNames.contains( m.getName() ) ) |
929 | { |
930 | it.remove(); |
931 | filtered = true; |
932 | this.getExcludedModlets().getModlet().add( m ); |
933 | log( Level.FINE, |
934 | getExcludedModletInfo( getLocale(), resource.toExternalForm(), m.getName() ), null ); |
935 | |
936 | continue; |
937 | } |
938 | |
939 | if ( this.filterModlet( m, resource.toExternalForm() ) ) |
940 | { |
941 | filtered = true; |
942 | } |
943 | } |
944 | |
945 | if ( filtered ) |
946 | { |
947 | final File tmpResource = File.createTempFile( this.getClass().getName(), ".rsrc" ); |
948 | this.temporaryResources.add( tmpResource ); |
949 | modelContext.createMarshaller( ModletObject.MODEL_PUBLIC_ID ).marshal( |
950 | new ObjectFactory().createModlets( modlets ), tmpResource ); |
951 | |
952 | filteredResource = tmpResource.toURI().toURL(); |
953 | } |
954 | } |
955 | |
956 | return filteredResource; |
957 | } |
958 | |
959 | private boolean filterModlet( final Modlet modlet, final String resourceInfo ) |
960 | { |
961 | boolean filteredSchemas = false; |
962 | boolean filteredServices = false; |
963 | final List<String> excludedSchemas = Arrays.asList( getSchemaExcludes().split( ":" ) ); |
964 | final List<String> excludedServices = Arrays.asList( getServiceExcludes().split( ":" ) ); |
965 | |
966 | if ( modlet.getSchemas() != null ) |
967 | { |
968 | final Schemas schemas = new Schemas(); |
969 | |
970 | for ( Schema s : modlet.getSchemas().getSchema() ) |
971 | { |
972 | if ( !excludedSchemas.contains( s.getContextId() ) ) |
973 | { |
974 | schemas.getSchema().add( s ); |
975 | } |
976 | else |
977 | { |
978 | log( Level.FINE, getExcludedSchemaInfo( getLocale(), resourceInfo, s.getContextId() ), null ); |
979 | filteredSchemas = true; |
980 | } |
981 | } |
982 | |
983 | if ( filteredSchemas ) |
984 | { |
985 | modlet.setSchemas( schemas ); |
986 | } |
987 | } |
988 | |
989 | if ( modlet.getServices() != null ) |
990 | { |
991 | final Services services = new Services(); |
992 | |
993 | for ( Service s : modlet.getServices().getService() ) |
994 | { |
995 | if ( !excludedServices.contains( s.getClazz() ) ) |
996 | { |
997 | services.getService().add( s ); |
998 | } |
999 | else |
1000 | { |
1001 | log( Level.FINE, getExcludedServiceInfo( getLocale(), resourceInfo, s.getClazz() ), null ); |
1002 | filteredServices = true; |
1003 | } |
1004 | } |
1005 | |
1006 | if ( filteredServices ) |
1007 | { |
1008 | modlet.setServices( services ); |
1009 | } |
1010 | } |
1011 | |
1012 | return filteredSchemas || filteredServices; |
1013 | } |
1014 | |
1015 | } |
1016 | |
1017 | // SECTION-END |
1018 | // SECTION-START[Constructors] |
1019 | // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> |
1020 | /** Creates a new {@code AbstractModletCommand} instance. */ |
1021 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1022 | public AbstractModletCommand() |
1023 | { |
1024 | // SECTION-START[Default Constructor] |
1025 | super(); |
1026 | // SECTION-END |
1027 | } |
1028 | // </editor-fold> |
1029 | // SECTION-END |
1030 | // SECTION-START[Dependencies] |
1031 | // <editor-fold defaultstate="collapsed" desc=" Generated Dependencies "> |
1032 | /** |
1033 | * Gets the {@code <Classpath Option>} dependency. |
1034 | * <p> |
1035 | * This method returns the {@code <JOMC ⁑ CLI ⁑ Classpath Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1036 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1037 | * </p> |
1038 | * <dl> |
1039 | * <dt><b>Final:</b></dt><dd>No</dd> |
1040 | * </dl> |
1041 | * @return The {@code <Classpath Option>} dependency. |
1042 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1043 | */ |
1044 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1045 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1046 | private org.apache.commons.cli.Option getClasspathOption() |
1047 | { |
1048 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Classpath Option" ); |
1049 | assert _d != null : "'Classpath Option' dependency not found."; |
1050 | return _d; |
1051 | } |
1052 | /** |
1053 | * Gets the {@code <Documents Option>} dependency. |
1054 | * <p> |
1055 | * This method returns the {@code <JOMC ⁑ CLI ⁑ Documents Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1056 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1057 | * </p> |
1058 | * <dl> |
1059 | * <dt><b>Final:</b></dt><dd>No</dd> |
1060 | * </dl> |
1061 | * @return The {@code <Documents Option>} dependency. |
1062 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1063 | */ |
1064 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1065 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1066 | private org.apache.commons.cli.Option getDocumentsOption() |
1067 | { |
1068 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Documents Option" ); |
1069 | assert _d != null : "'Documents Option' dependency not found."; |
1070 | return _d; |
1071 | } |
1072 | /** |
1073 | * Gets the {@code <Locale>} dependency. |
1074 | * <p> |
1075 | * This method returns the {@code <default>} object of the {@code <java.util.Locale>} specification at specification level 1.1. |
1076 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1077 | * </p> |
1078 | * <dl> |
1079 | * <dt><b>Final:</b></dt><dd>No</dd> |
1080 | * </dl> |
1081 | * @return The {@code <Locale>} dependency. |
1082 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1083 | */ |
1084 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1085 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1086 | private java.util.Locale getLocale() |
1087 | { |
1088 | final java.util.Locale _d = (java.util.Locale) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Locale" ); |
1089 | assert _d != null : "'Locale' dependency not found."; |
1090 | return _d; |
1091 | } |
1092 | /** |
1093 | * Gets the {@code <Model Context Factory Option>} dependency. |
1094 | * <p> |
1095 | * This method returns the {@code <JOMC ⁑ CLI ⁑ ModelContextFactory Class Name Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1096 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1097 | * </p> |
1098 | * <dl> |
1099 | * <dt><b>Final:</b></dt><dd>No</dd> |
1100 | * </dl> |
1101 | * @return The {@code <Model Context Factory Option>} dependency. |
1102 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1103 | */ |
1104 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1105 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1106 | private org.apache.commons.cli.Option getModelContextFactoryOption() |
1107 | { |
1108 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Model Context Factory Option" ); |
1109 | assert _d != null : "'Model Context Factory Option' dependency not found."; |
1110 | return _d; |
1111 | } |
1112 | /** |
1113 | * Gets the {@code <Model Option>} dependency. |
1114 | * <p> |
1115 | * This method returns the {@code <JOMC ⁑ CLI ⁑ Model Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1116 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1117 | * </p> |
1118 | * <dl> |
1119 | * <dt><b>Final:</b></dt><dd>No</dd> |
1120 | * </dl> |
1121 | * @return The {@code <Model Option>} dependency. |
1122 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1123 | */ |
1124 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1125 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1126 | private org.apache.commons.cli.Option getModelOption() |
1127 | { |
1128 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Model Option" ); |
1129 | assert _d != null : "'Model Option' dependency not found."; |
1130 | return _d; |
1131 | } |
1132 | /** |
1133 | * Gets the {@code <Modlet Location Option>} dependency. |
1134 | * <p> |
1135 | * This method returns the {@code <JOMC ⁑ CLI ⁑ Modlet Location Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1136 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1137 | * </p> |
1138 | * <dl> |
1139 | * <dt><b>Final:</b></dt><dd>No</dd> |
1140 | * </dl> |
1141 | * @return The {@code <Modlet Location Option>} dependency. |
1142 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1143 | */ |
1144 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1145 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1146 | private org.apache.commons.cli.Option getModletLocationOption() |
1147 | { |
1148 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Modlet Location Option" ); |
1149 | assert _d != null : "'Modlet Location Option' dependency not found."; |
1150 | return _d; |
1151 | } |
1152 | /** |
1153 | * Gets the {@code <Modlet Schema System Id Option>} dependency. |
1154 | * <p> |
1155 | * This method returns the {@code <JOMC ⁑ CLI ⁑ Modlet Schema System Id Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1156 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1157 | * </p> |
1158 | * <dl> |
1159 | * <dt><b>Final:</b></dt><dd>No</dd> |
1160 | * </dl> |
1161 | * @return The {@code <Modlet Schema System Id Option>} dependency. |
1162 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1163 | */ |
1164 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1165 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1166 | private org.apache.commons.cli.Option getModletSchemaSystemIdOption() |
1167 | { |
1168 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Modlet Schema System Id Option" ); |
1169 | assert _d != null : "'Modlet Schema System Id Option' dependency not found."; |
1170 | return _d; |
1171 | } |
1172 | /** |
1173 | * Gets the {@code <No Modlet Resource Validation>} dependency. |
1174 | * <p> |
1175 | * This method returns the {@code <JOMC ⁑ CLI ⁑ No Modlet Resource Validation Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1176 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1177 | * </p> |
1178 | * <dl> |
1179 | * <dt><b>Final:</b></dt><dd>No</dd> |
1180 | * </dl> |
1181 | * @return The {@code <No Modlet Resource Validation>} dependency. |
1182 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1183 | */ |
1184 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1185 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1186 | private org.apache.commons.cli.Option getNoModletResourceValidation() |
1187 | { |
1188 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "No Modlet Resource Validation" ); |
1189 | assert _d != null : "'No Modlet Resource Validation' dependency not found."; |
1190 | return _d; |
1191 | } |
1192 | /** |
1193 | * Gets the {@code <Platform Provider Location Option>} dependency. |
1194 | * <p> |
1195 | * This method returns the {@code <JOMC ⁑ CLI ⁑ Platform Provider Location Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1196 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1197 | * </p> |
1198 | * <dl> |
1199 | * <dt><b>Final:</b></dt><dd>No</dd> |
1200 | * </dl> |
1201 | * @return The {@code <Platform Provider Location Option>} dependency. |
1202 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1203 | */ |
1204 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1205 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1206 | private org.apache.commons.cli.Option getPlatformProviderLocationOption() |
1207 | { |
1208 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Platform Provider Location Option" ); |
1209 | assert _d != null : "'Platform Provider Location Option' dependency not found."; |
1210 | return _d; |
1211 | } |
1212 | /** |
1213 | * Gets the {@code <Provider Location Option>} dependency. |
1214 | * <p> |
1215 | * This method returns the {@code <JOMC ⁑ CLI ⁑ Provider Location Option>} object of the {@code <JOMC ⁑ CLI ⁑ Command Option>} specification at specification level 1.2. |
1216 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1217 | * </p> |
1218 | * <dl> |
1219 | * <dt><b>Final:</b></dt><dd>No</dd> |
1220 | * </dl> |
1221 | * @return The {@code <Provider Location Option>} dependency. |
1222 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1223 | */ |
1224 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1225 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1226 | private org.apache.commons.cli.Option getProviderLocationOption() |
1227 | { |
1228 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Provider Location Option" ); |
1229 | assert _d != null : "'Provider Location Option' dependency not found."; |
1230 | return _d; |
1231 | } |
1232 | // </editor-fold> |
1233 | // SECTION-END |
1234 | // SECTION-START[Properties] |
1235 | // <editor-fold defaultstate="collapsed" desc=" Generated Properties "> |
1236 | /** |
1237 | * Gets the value of the {@code <Abbreviated Command Name>} property. |
1238 | * <p><dl> |
1239 | * <dt><b>Final:</b></dt><dd>No</dd> |
1240 | * </dl></p> |
1241 | * @return Abbreviated name of the command. |
1242 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1243 | */ |
1244 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1245 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1246 | private java.lang.String getAbbreviatedCommandName() |
1247 | { |
1248 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Abbreviated Command Name" ); |
1249 | assert _p != null : "'Abbreviated Command Name' property not found."; |
1250 | return _p; |
1251 | } |
1252 | /** |
1253 | * Gets the value of the {@code <Application Modlet>} property. |
1254 | * <p><dl> |
1255 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1256 | * </dl></p> |
1257 | * @return Name of the 'shaded' application modlet. |
1258 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1259 | */ |
1260 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1261 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1262 | private java.lang.String getApplicationModlet() |
1263 | { |
1264 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Application Modlet" ); |
1265 | assert _p != null : "'Application Modlet' property not found."; |
1266 | return _p; |
1267 | } |
1268 | /** |
1269 | * Gets the value of the {@code <Command Name>} property. |
1270 | * <p><dl> |
1271 | * <dt><b>Final:</b></dt><dd>No</dd> |
1272 | * </dl></p> |
1273 | * @return Name of the command. |
1274 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1275 | */ |
1276 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1277 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1278 | private java.lang.String getCommandName() |
1279 | { |
1280 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Command Name" ); |
1281 | assert _p != null : "'Command Name' property not found."; |
1282 | return _p; |
1283 | } |
1284 | /** |
1285 | * Gets the value of the {@code <Modlet Excludes>} property. |
1286 | * <p><dl> |
1287 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1288 | * </dl></p> |
1289 | * @return List of modlet names to exclude from any {@code META-INF/jomc-modlet.xml} files separated by {@code :}. |
1290 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1291 | */ |
1292 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1293 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1294 | private java.lang.String getModletExcludes() |
1295 | { |
1296 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Modlet Excludes" ); |
1297 | assert _p != null : "'Modlet Excludes' property not found."; |
1298 | return _p; |
1299 | } |
1300 | /** |
1301 | * Gets the value of the {@code <Provider Excludes>} property. |
1302 | * <p><dl> |
1303 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1304 | * </dl></p> |
1305 | * @return List of providers to exclude from any {@code META-INF/services} files separated by {@code :}. |
1306 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1307 | */ |
1308 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1309 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1310 | private java.lang.String getProviderExcludes() |
1311 | { |
1312 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Provider Excludes" ); |
1313 | assert _p != null : "'Provider Excludes' property not found."; |
1314 | return _p; |
1315 | } |
1316 | /** |
1317 | * Gets the value of the {@code <Schema Excludes>} property. |
1318 | * <p><dl> |
1319 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1320 | * </dl></p> |
1321 | * @return List of schema context-ids to exclude from any {@code META-INF/jomc-modlet.xml} files separated by {@code :}. |
1322 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1323 | */ |
1324 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1325 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1326 | private java.lang.String getSchemaExcludes() |
1327 | { |
1328 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Schema Excludes" ); |
1329 | assert _p != null : "'Schema Excludes' property not found."; |
1330 | return _p; |
1331 | } |
1332 | /** |
1333 | * Gets the value of the {@code <Service Excludes>} property. |
1334 | * <p><dl> |
1335 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1336 | * </dl></p> |
1337 | * @return List of service classes to exclude from any {@code META-INF/jomc-modlet.xml} files separated by {@code :}. |
1338 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1339 | */ |
1340 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1341 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1342 | private java.lang.String getServiceExcludes() |
1343 | { |
1344 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Service Excludes" ); |
1345 | assert _p != null : "'Service Excludes' property not found."; |
1346 | return _p; |
1347 | } |
1348 | // </editor-fold> |
1349 | // SECTION-END |
1350 | // SECTION-START[Messages] |
1351 | // <editor-fold defaultstate="collapsed" desc=" Generated Messages "> |
1352 | /** |
1353 | * Gets the text of the {@code <Application Title>} message. |
1354 | * <p><dl> |
1355 | * <dt><b>Languages:</b></dt> |
1356 | * <dd>English (default)</dd> |
1357 | * <dt><b>Final:</b></dt><dd>No</dd> |
1358 | * </dl></p> |
1359 | * @param locale The locale of the message to return. |
1360 | * @return The text of the {@code <Application Title>} message for {@code locale}. |
1361 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1362 | */ |
1363 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1364 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1365 | private String getApplicationTitle( final java.util.Locale locale ) |
1366 | { |
1367 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Application Title", locale ); |
1368 | assert _m != null : "'Application Title' message not found."; |
1369 | return _m; |
1370 | } |
1371 | /** |
1372 | * Gets the text of the {@code <Cannot Process Message>} message. |
1373 | * <p><dl> |
1374 | * <dt><b>Languages:</b></dt> |
1375 | * <dd>English (default)</dd> |
1376 | * <dd>Deutsch</dd> |
1377 | * <dt><b>Final:</b></dt><dd>No</dd> |
1378 | * </dl></p> |
1379 | * @param locale The locale of the message to return. |
1380 | * @param itemInfo Format argument. |
1381 | * @param detailMessage Format argument. |
1382 | * @return The text of the {@code <Cannot Process Message>} message for {@code locale}. |
1383 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1384 | */ |
1385 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1386 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1387 | private String getCannotProcessMessage( final java.util.Locale locale, final java.lang.String itemInfo, final java.lang.String detailMessage ) |
1388 | { |
1389 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Cannot Process Message", locale, itemInfo, detailMessage ); |
1390 | assert _m != null : "'Cannot Process Message' message not found."; |
1391 | return _m; |
1392 | } |
1393 | /** |
1394 | * Gets the text of the {@code <Classpath Element Info>} message. |
1395 | * <p><dl> |
1396 | * <dt><b>Languages:</b></dt> |
1397 | * <dd>English (default)</dd> |
1398 | * <dd>Deutsch</dd> |
1399 | * <dt><b>Final:</b></dt><dd>No</dd> |
1400 | * </dl></p> |
1401 | * @param locale The locale of the message to return. |
1402 | * @param classpathElement Format argument. |
1403 | * @return The text of the {@code <Classpath Element Info>} message for {@code locale}. |
1404 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1405 | */ |
1406 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1407 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1408 | private String getClasspathElementInfo( final java.util.Locale locale, final java.lang.String classpathElement ) |
1409 | { |
1410 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Classpath Element Info", locale, classpathElement ); |
1411 | assert _m != null : "'Classpath Element Info' message not found."; |
1412 | return _m; |
1413 | } |
1414 | /** |
1415 | * Gets the text of the {@code <Classpath Element Not Found Warning>} message. |
1416 | * <p><dl> |
1417 | * <dt><b>Languages:</b></dt> |
1418 | * <dd>English (default)</dd> |
1419 | * <dd>Deutsch</dd> |
1420 | * <dt><b>Final:</b></dt><dd>No</dd> |
1421 | * </dl></p> |
1422 | * @param locale The locale of the message to return. |
1423 | * @param fileName Format argument. |
1424 | * @return The text of the {@code <Classpath Element Not Found Warning>} message for {@code locale}. |
1425 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1426 | */ |
1427 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1428 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1429 | private String getClasspathElementNotFoundWarning( final java.util.Locale locale, final java.lang.String fileName ) |
1430 | { |
1431 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Classpath Element Not Found Warning", locale, fileName ); |
1432 | assert _m != null : "'Classpath Element Not Found Warning' message not found."; |
1433 | return _m; |
1434 | } |
1435 | /** |
1436 | * Gets the text of the {@code <Command Failure Message>} message. |
1437 | * <p><dl> |
1438 | * <dt><b>Languages:</b></dt> |
1439 | * <dd>English (default)</dd> |
1440 | * <dd>Deutsch</dd> |
1441 | * <dt><b>Final:</b></dt><dd>No</dd> |
1442 | * </dl></p> |
1443 | * @param locale The locale of the message to return. |
1444 | * @param toolName Format argument. |
1445 | * @return The text of the {@code <Command Failure Message>} message for {@code locale}. |
1446 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1447 | */ |
1448 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1449 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1450 | private String getCommandFailureMessage( final java.util.Locale locale, final java.lang.String toolName ) |
1451 | { |
1452 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Command Failure Message", locale, toolName ); |
1453 | assert _m != null : "'Command Failure Message' message not found."; |
1454 | return _m; |
1455 | } |
1456 | /** |
1457 | * Gets the text of the {@code <Command Info Message>} message. |
1458 | * <p><dl> |
1459 | * <dt><b>Languages:</b></dt> |
1460 | * <dd>English (default)</dd> |
1461 | * <dd>Deutsch</dd> |
1462 | * <dt><b>Final:</b></dt><dd>No</dd> |
1463 | * </dl></p> |
1464 | * @param locale The locale of the message to return. |
1465 | * @param toolName Format argument. |
1466 | * @return The text of the {@code <Command Info Message>} message for {@code locale}. |
1467 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1468 | */ |
1469 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1470 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1471 | private String getCommandInfoMessage( final java.util.Locale locale, final java.lang.String toolName ) |
1472 | { |
1473 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Command Info Message", locale, toolName ); |
1474 | assert _m != null : "'Command Info Message' message not found."; |
1475 | return _m; |
1476 | } |
1477 | /** |
1478 | * Gets the text of the {@code <Command Success Message>} message. |
1479 | * <p><dl> |
1480 | * <dt><b>Languages:</b></dt> |
1481 | * <dd>English (default)</dd> |
1482 | * <dd>Deutsch</dd> |
1483 | * <dt><b>Final:</b></dt><dd>No</dd> |
1484 | * </dl></p> |
1485 | * @param locale The locale of the message to return. |
1486 | * @param toolName Format argument. |
1487 | * @return The text of the {@code <Command Success Message>} message for {@code locale}. |
1488 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1489 | */ |
1490 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1491 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1492 | private String getCommandSuccessMessage( final java.util.Locale locale, final java.lang.String toolName ) |
1493 | { |
1494 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Command Success Message", locale, toolName ); |
1495 | assert _m != null : "'Command Success Message' message not found."; |
1496 | return _m; |
1497 | } |
1498 | /** |
1499 | * Gets the text of the {@code <Default Log Level Info>} message. |
1500 | * <p><dl> |
1501 | * <dt><b>Languages:</b></dt> |
1502 | * <dd>English (default)</dd> |
1503 | * <dd>Deutsch</dd> |
1504 | * <dt><b>Final:</b></dt><dd>No</dd> |
1505 | * </dl></p> |
1506 | * @param locale The locale of the message to return. |
1507 | * @param defaultLogLevel Format argument. |
1508 | * @return The text of the {@code <Default Log Level Info>} message for {@code locale}. |
1509 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1510 | */ |
1511 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1512 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1513 | private String getDefaultLogLevelInfo( final java.util.Locale locale, final java.lang.String defaultLogLevel ) |
1514 | { |
1515 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Default Log Level Info", locale, defaultLogLevel ); |
1516 | assert _m != null : "'Default Log Level Info' message not found."; |
1517 | return _m; |
1518 | } |
1519 | /** |
1520 | * Gets the text of the {@code <Document File Info>} message. |
1521 | * <p><dl> |
1522 | * <dt><b>Languages:</b></dt> |
1523 | * <dd>English (default)</dd> |
1524 | * <dd>Deutsch</dd> |
1525 | * <dt><b>Final:</b></dt><dd>No</dd> |
1526 | * </dl></p> |
1527 | * @param locale The locale of the message to return. |
1528 | * @param documentFile Format argument. |
1529 | * @return The text of the {@code <Document File Info>} message for {@code locale}. |
1530 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1531 | */ |
1532 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1533 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1534 | private String getDocumentFileInfo( final java.util.Locale locale, final java.lang.String documentFile ) |
1535 | { |
1536 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Document File Info", locale, documentFile ); |
1537 | assert _m != null : "'Document File Info' message not found."; |
1538 | return _m; |
1539 | } |
1540 | /** |
1541 | * Gets the text of the {@code <Document File Not Found Warning>} message. |
1542 | * <p><dl> |
1543 | * <dt><b>Languages:</b></dt> |
1544 | * <dd>English (default)</dd> |
1545 | * <dd>Deutsch</dd> |
1546 | * <dt><b>Final:</b></dt><dd>No</dd> |
1547 | * </dl></p> |
1548 | * @param locale The locale of the message to return. |
1549 | * @param fileName Format argument. |
1550 | * @return The text of the {@code <Document File Not Found Warning>} message for {@code locale}. |
1551 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1552 | */ |
1553 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1554 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1555 | private String getDocumentFileNotFoundWarning( final java.util.Locale locale, final java.lang.String fileName ) |
1556 | { |
1557 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Document File Not Found Warning", locale, fileName ); |
1558 | assert _m != null : "'Document File Not Found Warning' message not found."; |
1559 | return _m; |
1560 | } |
1561 | /** |
1562 | * Gets the text of the {@code <Excluded Modlet Info>} message. |
1563 | * <p><dl> |
1564 | * <dt><b>Languages:</b></dt> |
1565 | * <dd>English (default)</dd> |
1566 | * <dd>Deutsch</dd> |
1567 | * <dt><b>Final:</b></dt><dd>No</dd> |
1568 | * </dl></p> |
1569 | * @param locale The locale of the message to return. |
1570 | * @param resourceName Format argument. |
1571 | * @param modletIdentifier Format argument. |
1572 | * @return The text of the {@code <Excluded Modlet Info>} message for {@code locale}. |
1573 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1574 | */ |
1575 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1576 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1577 | private String getExcludedModletInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String modletIdentifier ) |
1578 | { |
1579 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Excluded Modlet Info", locale, resourceName, modletIdentifier ); |
1580 | assert _m != null : "'Excluded Modlet Info' message not found."; |
1581 | return _m; |
1582 | } |
1583 | /** |
1584 | * Gets the text of the {@code <Excluded Provider Info>} message. |
1585 | * <p><dl> |
1586 | * <dt><b>Languages:</b></dt> |
1587 | * <dd>English (default)</dd> |
1588 | * <dd>Deutsch</dd> |
1589 | * <dt><b>Final:</b></dt><dd>No</dd> |
1590 | * </dl></p> |
1591 | * @param locale The locale of the message to return. |
1592 | * @param resourceName Format argument. |
1593 | * @param providerName Format argument. |
1594 | * @return The text of the {@code <Excluded Provider Info>} message for {@code locale}. |
1595 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1596 | */ |
1597 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1598 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1599 | private String getExcludedProviderInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String providerName ) |
1600 | { |
1601 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Excluded Provider Info", locale, resourceName, providerName ); |
1602 | assert _m != null : "'Excluded Provider Info' message not found."; |
1603 | return _m; |
1604 | } |
1605 | /** |
1606 | * Gets the text of the {@code <Excluded Schema Info>} message. |
1607 | * <p><dl> |
1608 | * <dt><b>Languages:</b></dt> |
1609 | * <dd>English (default)</dd> |
1610 | * <dd>Deutsch</dd> |
1611 | * <dt><b>Final:</b></dt><dd>No</dd> |
1612 | * </dl></p> |
1613 | * @param locale The locale of the message to return. |
1614 | * @param resourceName Format argument. |
1615 | * @param contextId Format argument. |
1616 | * @return The text of the {@code <Excluded Schema Info>} message for {@code locale}. |
1617 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1618 | */ |
1619 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1620 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1621 | private String getExcludedSchemaInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String contextId ) |
1622 | { |
1623 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Excluded Schema Info", locale, resourceName, contextId ); |
1624 | assert _m != null : "'Excluded Schema Info' message not found."; |
1625 | return _m; |
1626 | } |
1627 | /** |
1628 | * Gets the text of the {@code <Excluded Service Info>} message. |
1629 | * <p><dl> |
1630 | * <dt><b>Languages:</b></dt> |
1631 | * <dd>English (default)</dd> |
1632 | * <dd>Deutsch</dd> |
1633 | * <dt><b>Final:</b></dt><dd>No</dd> |
1634 | * </dl></p> |
1635 | * @param locale The locale of the message to return. |
1636 | * @param resourceName Format argument. |
1637 | * @param serviceName Format argument. |
1638 | * @return The text of the {@code <Excluded Service Info>} message for {@code locale}. |
1639 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1640 | */ |
1641 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1642 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1643 | private String getExcludedServiceInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String serviceName ) |
1644 | { |
1645 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Excluded Service Info", locale, resourceName, serviceName ); |
1646 | assert _m != null : "'Excluded Service Info' message not found."; |
1647 | return _m; |
1648 | } |
1649 | /** |
1650 | * Gets the text of the {@code <Invalid Model Message>} message. |
1651 | * <p><dl> |
1652 | * <dt><b>Languages:</b></dt> |
1653 | * <dd>English (default)</dd> |
1654 | * <dd>Deutsch</dd> |
1655 | * <dt><b>Final:</b></dt><dd>No</dd> |
1656 | * </dl></p> |
1657 | * @param locale The locale of the message to return. |
1658 | * @param modelIdentifier Format argument. |
1659 | * @return The text of the {@code <Invalid Model Message>} message for {@code locale}. |
1660 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1661 | */ |
1662 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1663 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1664 | private String getInvalidModelMessage( final java.util.Locale locale, final java.lang.String modelIdentifier ) |
1665 | { |
1666 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Invalid Model Message", locale, modelIdentifier ); |
1667 | assert _m != null : "'Invalid Model Message' message not found."; |
1668 | return _m; |
1669 | } |
1670 | /** |
1671 | * Gets the text of the {@code <Long Description Message>} message. |
1672 | * <p><dl> |
1673 | * <dt><b>Languages:</b></dt> |
1674 | * <dd>English (default)</dd> |
1675 | * <dt><b>Final:</b></dt><dd>No</dd> |
1676 | * </dl></p> |
1677 | * @param locale The locale of the message to return. |
1678 | * @return The text of the {@code <Long Description Message>} message for {@code locale}. |
1679 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1680 | */ |
1681 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1682 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1683 | private String getLongDescriptionMessage( final java.util.Locale locale ) |
1684 | { |
1685 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Long Description Message", locale ); |
1686 | assert _m != null : "'Long Description Message' message not found."; |
1687 | return _m; |
1688 | } |
1689 | /** |
1690 | * Gets the text of the {@code <Reading Message>} message. |
1691 | * <p><dl> |
1692 | * <dt><b>Languages:</b></dt> |
1693 | * <dd>English (default)</dd> |
1694 | * <dd>Deutsch</dd> |
1695 | * <dt><b>Final:</b></dt><dd>No</dd> |
1696 | * </dl></p> |
1697 | * @param locale The locale of the message to return. |
1698 | * @param locationInfo Format argument. |
1699 | * @return The text of the {@code <Reading Message>} message for {@code locale}. |
1700 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1701 | */ |
1702 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1703 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1704 | private String getReadingMessage( final java.util.Locale locale, final java.lang.String locationInfo ) |
1705 | { |
1706 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Reading Message", locale, locationInfo ); |
1707 | assert _m != null : "'Reading Message' message not found."; |
1708 | return _m; |
1709 | } |
1710 | /** |
1711 | * Gets the text of the {@code <Separator>} message. |
1712 | * <p><dl> |
1713 | * <dt><b>Languages:</b></dt> |
1714 | * <dd>English (default)</dd> |
1715 | * <dt><b>Final:</b></dt><dd>No</dd> |
1716 | * </dl></p> |
1717 | * @param locale The locale of the message to return. |
1718 | * @return The text of the {@code <Separator>} message for {@code locale}. |
1719 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1720 | */ |
1721 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1722 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1723 | private String getSeparator( final java.util.Locale locale ) |
1724 | { |
1725 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Separator", locale ); |
1726 | assert _m != null : "'Separator' message not found."; |
1727 | return _m; |
1728 | } |
1729 | /** |
1730 | * Gets the text of the {@code <Short Description Message>} message. |
1731 | * <p><dl> |
1732 | * <dt><b>Languages:</b></dt> |
1733 | * <dd>English (default)</dd> |
1734 | * <dt><b>Final:</b></dt><dd>No</dd> |
1735 | * </dl></p> |
1736 | * @param locale The locale of the message to return. |
1737 | * @return The text of the {@code <Short Description Message>} message for {@code locale}. |
1738 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1739 | */ |
1740 | @SuppressWarnings({"unused", "PMD.UnnecessaryFullyQualifiedName"}) |
1741 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1742 | private String getShortDescriptionMessage( final java.util.Locale locale ) |
1743 | { |
1744 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "Short Description Message", locale ); |
1745 | assert _m != null : "'Short Description Message' message not found."; |
1746 | return _m; |
1747 | } |
1748 | // </editor-fold> |
1749 | // SECTION-END |
1750 | // SECTION-START[Generated Command] |
1751 | // <editor-fold defaultstate="collapsed" desc=" Generated Options "> |
1752 | /** |
1753 | * Gets the options of the command. |
1754 | * <p><strong>Options:</strong> |
1755 | * <table border="1" width="100%" cellpadding="3" cellspacing="0"> |
1756 | * <tr class="TableSubHeadingColor"> |
1757 | * <th align="left" scope="col" nowrap><b>Specification</b></th> |
1758 | * <th align="left" scope="col" nowrap><b>Implementation</b></th> |
1759 | * </tr> |
1760 | * <tr class="TableRow"> |
1761 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1762 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Classpath Option</td> |
1763 | * </tr> |
1764 | * <tr class="TableRow"> |
1765 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1766 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Documents Option</td> |
1767 | * </tr> |
1768 | * <tr class="TableRow"> |
1769 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1770 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ ModelContextFactory Class Name Option</td> |
1771 | * </tr> |
1772 | * <tr class="TableRow"> |
1773 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1774 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Model Option</td> |
1775 | * </tr> |
1776 | * <tr class="TableRow"> |
1777 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1778 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Modlet Location Option</td> |
1779 | * </tr> |
1780 | * <tr class="TableRow"> |
1781 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1782 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Modlet Schema System Id Option</td> |
1783 | * </tr> |
1784 | * <tr class="TableRow"> |
1785 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1786 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ No Modlet Resource Validation Option</td> |
1787 | * </tr> |
1788 | * <tr class="TableRow"> |
1789 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1790 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Platform Provider Location Option</td> |
1791 | * </tr> |
1792 | * <tr class="TableRow"> |
1793 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1794 | * <td align="left" valign="top" nowrap>JOMC ⁑ CLI ⁑ Provider Location Option</td> |
1795 | * </tr> |
1796 | * </table> |
1797 | * </p> |
1798 | * @return The options of the command. |
1799 | */ |
1800 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.6.2", comments = "See http://www.jomc.org/jomc/1.6/jomc-tools-1.6.2" ) |
1801 | @Override |
1802 | public org.apache.commons.cli.Options getOptions() |
1803 | { |
1804 | final org.apache.commons.cli.Options options = new org.apache.commons.cli.Options(); |
1805 | options.addOption( this.getClasspathOption() ); |
1806 | options.addOption( this.getDocumentsOption() ); |
1807 | options.addOption( this.getModelContextFactoryOption() ); |
1808 | options.addOption( this.getModelOption() ); |
1809 | options.addOption( this.getModletLocationOption() ); |
1810 | options.addOption( this.getModletSchemaSystemIdOption() ); |
1811 | options.addOption( this.getNoModletResourceValidation() ); |
1812 | options.addOption( this.getPlatformProviderLocationOption() ); |
1813 | options.addOption( this.getProviderLocationOption() ); |
1814 | return options; |
1815 | } |
1816 | // </editor-fold> |
1817 | // SECTION-END |
1818 | } |