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 4511 2012-04-24 01:59:23Z schulte2005 $ |
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.lang.reflect.InvocationTargetException; |
48 | import java.net.URI; |
49 | import java.net.URL; |
50 | import java.net.URLClassLoader; |
51 | import java.util.ArrayList; |
52 | import java.util.Arrays; |
53 | import java.util.Enumeration; |
54 | import java.util.HashSet; |
55 | import java.util.Iterator; |
56 | import java.util.List; |
57 | import java.util.Map; |
58 | import java.util.Set; |
59 | import java.util.logging.Level; |
60 | import javax.xml.bind.JAXBElement; |
61 | import javax.xml.bind.JAXBException; |
62 | import javax.xml.bind.Marshaller; |
63 | import javax.xml.bind.PropertyException; |
64 | import javax.xml.transform.ErrorListener; |
65 | import javax.xml.transform.Source; |
66 | import javax.xml.transform.Transformer; |
67 | import javax.xml.transform.TransformerConfigurationException; |
68 | import javax.xml.transform.TransformerException; |
69 | import javax.xml.transform.TransformerFactory; |
70 | import org.apache.commons.cli.CommandLine; |
71 | import org.apache.commons.io.IOUtils; |
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:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0 |
105 | * @version 1.2.7 |
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.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
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:schulte2005@users.sourceforge.net">Christian Schulte</a> |
465 | * @version $JOMC: AbstractModletCommand.java 4511 2012-04-24 01:59:23Z schulte2005 $ |
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 | public void close() throws IOException |
765 | { |
766 | for ( final Iterator<File> it = this.temporaryResources.iterator(); it.hasNext(); ) |
767 | { |
768 | final File temporaryResource = it.next(); |
769 | |
770 | if ( temporaryResource.exists() && temporaryResource.delete() ) |
771 | { |
772 | it.remove(); |
773 | } |
774 | } |
775 | |
776 | if ( Closeable.class.isAssignableFrom( CommandLineClassLoader.class ) ) |
777 | { // JDK: As of JDK 7, super.close(); |
778 | this.jdk7Close(); |
779 | } |
780 | } |
781 | |
782 | /** |
783 | * Removes temporary resources. |
784 | * @throws Throwable if finalization fails. |
785 | */ |
786 | @Override |
787 | protected void finalize() throws Throwable |
788 | { |
789 | for ( final Iterator<File> it = this.temporaryResources.iterator(); it.hasNext(); ) |
790 | { |
791 | final File temporaryResource = it.next(); |
792 | |
793 | if ( temporaryResource.exists() && !temporaryResource.delete() ) |
794 | { |
795 | temporaryResource.deleteOnExit(); |
796 | } |
797 | |
798 | it.remove(); |
799 | } |
800 | |
801 | super.finalize(); |
802 | } |
803 | |
804 | private URL filterProviders( final URL resource ) throws IOException |
805 | { |
806 | InputStream in = null; |
807 | boolean suppressExceptionOnClose = true; |
808 | |
809 | try |
810 | { |
811 | in = resource.openStream(); |
812 | URL filteredResource = resource; |
813 | final List<String> lines = IOUtils.readLines( in, "UTF-8" ); |
814 | final List<String> providerExcludes = Arrays.asList( getProviderExcludes().split( ":" ) ); |
815 | final List<String> filteredLines = new ArrayList<String>( lines.size() ); |
816 | |
817 | for ( String line : lines ) |
818 | { |
819 | if ( !providerExcludes.contains( line.trim() ) ) |
820 | { |
821 | filteredLines.add( line.trim() ); |
822 | } |
823 | else |
824 | { |
825 | log( Level.FINE, |
826 | getExcludedProviderInfo( getLocale(), resource.toExternalForm(), line.toString() ), null ); |
827 | |
828 | } |
829 | } |
830 | |
831 | if ( lines.size() != filteredLines.size() ) |
832 | { |
833 | OutputStream out = null; |
834 | final File tmpResource = File.createTempFile( this.getClass().getName(), ".rsrc" ); |
835 | this.temporaryResources.add( tmpResource ); |
836 | |
837 | try |
838 | { |
839 | out = new FileOutputStream( tmpResource ); |
840 | IOUtils.writeLines( filteredLines, System.getProperty( "line.separator", "\n" ), out, "UTF-8" ); |
841 | suppressExceptionOnClose = false; |
842 | } |
843 | finally |
844 | { |
845 | try |
846 | { |
847 | if ( out != null ) |
848 | { |
849 | out.close(); |
850 | } |
851 | |
852 | suppressExceptionOnClose = true; |
853 | } |
854 | catch ( final IOException e ) |
855 | { |
856 | if ( suppressExceptionOnClose ) |
857 | { |
858 | log( Level.SEVERE, getExceptionMessage( e ), e ); |
859 | } |
860 | else |
861 | { |
862 | throw e; |
863 | } |
864 | } |
865 | } |
866 | |
867 | filteredResource = tmpResource.toURI().toURL(); |
868 | } |
869 | |
870 | suppressExceptionOnClose = false; |
871 | return filteredResource; |
872 | } |
873 | finally |
874 | { |
875 | try |
876 | { |
877 | if ( in != null ) |
878 | { |
879 | in.close(); |
880 | } |
881 | } |
882 | catch ( final IOException e ) |
883 | { |
884 | if ( suppressExceptionOnClose ) |
885 | { |
886 | log( Level.SEVERE, getExceptionMessage( e ), e ); |
887 | } |
888 | else |
889 | { |
890 | throw e; |
891 | } |
892 | } |
893 | } |
894 | } |
895 | |
896 | private URL filterModlets( final URL resource ) throws ModelException, IOException, JAXBException |
897 | { |
898 | URL filteredResource = resource; |
899 | final List<String> excludedModletNames = Arrays.asList( getModletExcludes().split( ":" ) ); |
900 | final ModelContext modelContext = ModelContextFactory.newInstance().newModelContext(); |
901 | Object o = modelContext.createUnmarshaller( ModletObject.MODEL_PUBLIC_ID ).unmarshal( resource ); |
902 | if ( o instanceof JAXBElement<?> ) |
903 | { |
904 | o = ( (JAXBElement<?>) o ).getValue(); |
905 | } |
906 | |
907 | Modlets modlets = null; |
908 | boolean filtered = false; |
909 | |
910 | if ( o instanceof Modlets ) |
911 | { |
912 | modlets = (Modlets) o; |
913 | } |
914 | else if ( o instanceof Modlet ) |
915 | { |
916 | modlets = new Modlets(); |
917 | modlets.getModlet().add( (Modlet) o ); |
918 | } |
919 | |
920 | if ( modlets != null ) |
921 | { |
922 | for ( final Iterator<Modlet> it = modlets.getModlet().iterator(); it.hasNext(); ) |
923 | { |
924 | final Modlet m = it.next(); |
925 | |
926 | if ( excludedModletNames.contains( m.getName() ) ) |
927 | { |
928 | it.remove(); |
929 | filtered = true; |
930 | this.getExcludedModlets().getModlet().add( m ); |
931 | log( Level.FINE, |
932 | getExcludedModletInfo( getLocale(), resource.toExternalForm(), m.getName() ), null ); |
933 | |
934 | continue; |
935 | } |
936 | |
937 | if ( this.filterModlet( m, resource.toExternalForm() ) ) |
938 | { |
939 | filtered = true; |
940 | } |
941 | } |
942 | |
943 | if ( filtered ) |
944 | { |
945 | final File tmpResource = File.createTempFile( this.getClass().getName(), ".rsrc" ); |
946 | this.temporaryResources.add( tmpResource ); |
947 | modelContext.createMarshaller( ModletObject.MODEL_PUBLIC_ID ).marshal( |
948 | new ObjectFactory().createModlets( modlets ), tmpResource ); |
949 | |
950 | filteredResource = tmpResource.toURI().toURL(); |
951 | } |
952 | } |
953 | |
954 | return filteredResource; |
955 | } |
956 | |
957 | private boolean filterModlet( final Modlet modlet, final String resourceInfo ) |
958 | { |
959 | boolean filteredSchemas = false; |
960 | boolean filteredServices = false; |
961 | final List<String> excludedSchemas = Arrays.asList( getSchemaExcludes().split( ":" ) ); |
962 | final List<String> excludedServices = Arrays.asList( getServiceExcludes().split( ":" ) ); |
963 | |
964 | if ( modlet.getSchemas() != null ) |
965 | { |
966 | final Schemas schemas = new Schemas(); |
967 | |
968 | for ( Schema s : modlet.getSchemas().getSchema() ) |
969 | { |
970 | if ( !excludedSchemas.contains( s.getContextId() ) ) |
971 | { |
972 | schemas.getSchema().add( s ); |
973 | } |
974 | else |
975 | { |
976 | log( Level.FINE, getExcludedSchemaInfo( getLocale(), resourceInfo, s.getContextId() ), null ); |
977 | filteredSchemas = true; |
978 | } |
979 | } |
980 | |
981 | if ( filteredSchemas ) |
982 | { |
983 | modlet.setSchemas( schemas ); |
984 | } |
985 | } |
986 | |
987 | if ( modlet.getServices() != null ) |
988 | { |
989 | final Services services = new Services(); |
990 | |
991 | for ( Service s : modlet.getServices().getService() ) |
992 | { |
993 | if ( !excludedServices.contains( s.getClazz() ) ) |
994 | { |
995 | services.getService().add( s ); |
996 | } |
997 | else |
998 | { |
999 | log( Level.FINE, getExcludedServiceInfo( getLocale(), resourceInfo, s.getClazz() ), null ); |
1000 | filteredServices = true; |
1001 | } |
1002 | } |
1003 | |
1004 | if ( filteredServices ) |
1005 | { |
1006 | modlet.setServices( services ); |
1007 | } |
1008 | } |
1009 | |
1010 | return filteredSchemas || filteredServices; |
1011 | } |
1012 | |
1013 | private void jdk7Close() |
1014 | { |
1015 | try |
1016 | { |
1017 | URLClassLoader.class.getMethod( "close" ).invoke( this ); |
1018 | } |
1019 | catch ( final NoSuchMethodException e ) |
1020 | { |
1021 | log( Level.FINEST, null, e ); |
1022 | } |
1023 | catch ( final IllegalAccessException e ) |
1024 | { |
1025 | log( Level.FINEST, null, e ); |
1026 | } |
1027 | catch ( final InvocationTargetException e ) |
1028 | { |
1029 | log( Level.FINEST, null, e ); |
1030 | } |
1031 | } |
1032 | |
1033 | } |
1034 | |
1035 | // SECTION-END |
1036 | // SECTION-START[Constructors] |
1037 | // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> |
1038 | /** Creates a new {@code AbstractModletCommand} instance. */ |
1039 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1040 | public AbstractModletCommand() |
1041 | { |
1042 | // SECTION-START[Default Constructor] |
1043 | super(); |
1044 | // SECTION-END |
1045 | } |
1046 | // </editor-fold> |
1047 | // SECTION-END |
1048 | // SECTION-START[Dependencies] |
1049 | // <editor-fold defaultstate="collapsed" desc=" Generated Dependencies "> |
1050 | /** |
1051 | * Gets the {@code <ClasspathOption>} dependency. |
1052 | * <p> |
1053 | * This method returns the {@code <JOMC CLI Classpath Option>} object of the {@code <JOMC CLI Command Option>} specification at specification level 1.2. |
1054 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1055 | * </p> |
1056 | * <dl> |
1057 | * <dt><b>Final:</b></dt><dd>No</dd> |
1058 | * </dl> |
1059 | * @return The {@code <ClasspathOption>} dependency. |
1060 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1061 | */ |
1062 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1063 | private org.apache.commons.cli.Option getClasspathOption() |
1064 | { |
1065 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ClasspathOption" ); |
1066 | assert _d != null : "'ClasspathOption' dependency not found."; |
1067 | return _d; |
1068 | } |
1069 | /** |
1070 | * Gets the {@code <DocumentsOption>} dependency. |
1071 | * <p> |
1072 | * This method returns the {@code <JOMC CLI Documents Option>} object of the {@code <JOMC CLI Command Option>} specification at specification level 1.2. |
1073 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1074 | * </p> |
1075 | * <dl> |
1076 | * <dt><b>Final:</b></dt><dd>No</dd> |
1077 | * </dl> |
1078 | * @return The {@code <DocumentsOption>} dependency. |
1079 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1080 | */ |
1081 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1082 | private org.apache.commons.cli.Option getDocumentsOption() |
1083 | { |
1084 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "DocumentsOption" ); |
1085 | assert _d != null : "'DocumentsOption' dependency not found."; |
1086 | return _d; |
1087 | } |
1088 | /** |
1089 | * Gets the {@code <Locale>} dependency. |
1090 | * <p> |
1091 | * This method returns the {@code <default>} object of the {@code <java.util.Locale>} specification at specification level 1.1. |
1092 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1093 | * </p> |
1094 | * <dl> |
1095 | * <dt><b>Final:</b></dt><dd>No</dd> |
1096 | * </dl> |
1097 | * @return The {@code <Locale>} dependency. |
1098 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1099 | */ |
1100 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1101 | private java.util.Locale getLocale() |
1102 | { |
1103 | final java.util.Locale _d = (java.util.Locale) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Locale" ); |
1104 | assert _d != null : "'Locale' dependency not found."; |
1105 | return _d; |
1106 | } |
1107 | /** |
1108 | * Gets the {@code <ModelContextFactoryOption>} dependency. |
1109 | * <p> |
1110 | * 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. |
1111 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1112 | * </p> |
1113 | * <dl> |
1114 | * <dt><b>Final:</b></dt><dd>No</dd> |
1115 | * </dl> |
1116 | * @return The {@code <ModelContextFactoryOption>} dependency. |
1117 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1118 | */ |
1119 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1120 | private org.apache.commons.cli.Option getModelContextFactoryOption() |
1121 | { |
1122 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ModelContextFactoryOption" ); |
1123 | assert _d != null : "'ModelContextFactoryOption' dependency not found."; |
1124 | return _d; |
1125 | } |
1126 | /** |
1127 | * Gets the {@code <ModelOption>} dependency. |
1128 | * <p> |
1129 | * This method returns the {@code <JOMC CLI Model Option>} object of the {@code <JOMC CLI Command Option>} specification at specification level 1.2. |
1130 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1131 | * </p> |
1132 | * <dl> |
1133 | * <dt><b>Final:</b></dt><dd>No</dd> |
1134 | * </dl> |
1135 | * @return The {@code <ModelOption>} dependency. |
1136 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1137 | */ |
1138 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1139 | private org.apache.commons.cli.Option getModelOption() |
1140 | { |
1141 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ModelOption" ); |
1142 | assert _d != null : "'ModelOption' dependency not found."; |
1143 | return _d; |
1144 | } |
1145 | /** |
1146 | * Gets the {@code <ModletLocationOption>} dependency. |
1147 | * <p> |
1148 | * This method returns the {@code <JOMC CLI Modlet Location Option>} object of the {@code <JOMC CLI Command Option>} specification at specification level 1.2. |
1149 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1150 | * </p> |
1151 | * <dl> |
1152 | * <dt><b>Final:</b></dt><dd>No</dd> |
1153 | * </dl> |
1154 | * @return The {@code <ModletLocationOption>} dependency. |
1155 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1156 | */ |
1157 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1158 | private org.apache.commons.cli.Option getModletLocationOption() |
1159 | { |
1160 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ModletLocationOption" ); |
1161 | assert _d != null : "'ModletLocationOption' dependency not found."; |
1162 | return _d; |
1163 | } |
1164 | /** |
1165 | * Gets the {@code <ModletSchemaSystemIdOption>} dependency. |
1166 | * <p> |
1167 | * 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. |
1168 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1169 | * </p> |
1170 | * <dl> |
1171 | * <dt><b>Final:</b></dt><dd>No</dd> |
1172 | * </dl> |
1173 | * @return The {@code <ModletSchemaSystemIdOption>} dependency. |
1174 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1175 | */ |
1176 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1177 | private org.apache.commons.cli.Option getModletSchemaSystemIdOption() |
1178 | { |
1179 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ModletSchemaSystemIdOption" ); |
1180 | assert _d != null : "'ModletSchemaSystemIdOption' dependency not found."; |
1181 | return _d; |
1182 | } |
1183 | /** |
1184 | * Gets the {@code <NoModletResourceValidation>} dependency. |
1185 | * <p> |
1186 | * 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. |
1187 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1188 | * </p> |
1189 | * <dl> |
1190 | * <dt><b>Final:</b></dt><dd>No</dd> |
1191 | * </dl> |
1192 | * @return The {@code <NoModletResourceValidation>} dependency. |
1193 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1194 | */ |
1195 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1196 | private org.apache.commons.cli.Option getNoModletResourceValidation() |
1197 | { |
1198 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "NoModletResourceValidation" ); |
1199 | assert _d != null : "'NoModletResourceValidation' dependency not found."; |
1200 | return _d; |
1201 | } |
1202 | /** |
1203 | * Gets the {@code <PlatformProviderLocationOption>} dependency. |
1204 | * <p> |
1205 | * 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. |
1206 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1207 | * </p> |
1208 | * <dl> |
1209 | * <dt><b>Final:</b></dt><dd>No</dd> |
1210 | * </dl> |
1211 | * @return The {@code <PlatformProviderLocationOption>} dependency. |
1212 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1213 | */ |
1214 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1215 | private org.apache.commons.cli.Option getPlatformProviderLocationOption() |
1216 | { |
1217 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "PlatformProviderLocationOption" ); |
1218 | assert _d != null : "'PlatformProviderLocationOption' dependency not found."; |
1219 | return _d; |
1220 | } |
1221 | /** |
1222 | * Gets the {@code <ProviderLocationOption>} dependency. |
1223 | * <p> |
1224 | * This method returns the {@code <JOMC CLI Provider Location Option>} object of the {@code <JOMC CLI Command Option>} specification at specification level 1.2. |
1225 | * That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance. |
1226 | * </p> |
1227 | * <dl> |
1228 | * <dt><b>Final:</b></dt><dd>No</dd> |
1229 | * </dl> |
1230 | * @return The {@code <ProviderLocationOption>} dependency. |
1231 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
1232 | */ |
1233 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1234 | private org.apache.commons.cli.Option getProviderLocationOption() |
1235 | { |
1236 | final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "ProviderLocationOption" ); |
1237 | assert _d != null : "'ProviderLocationOption' dependency not found."; |
1238 | return _d; |
1239 | } |
1240 | // </editor-fold> |
1241 | // SECTION-END |
1242 | // SECTION-START[Properties] |
1243 | // <editor-fold defaultstate="collapsed" desc=" Generated Properties "> |
1244 | /** |
1245 | * Gets the value of the {@code <abbreviatedCommandName>} property. |
1246 | * <p><dl> |
1247 | * <dt><b>Final:</b></dt><dd>No</dd> |
1248 | * </dl></p> |
1249 | * @return Abbreviated name of the command. |
1250 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1251 | */ |
1252 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1253 | private java.lang.String getAbbreviatedCommandName() |
1254 | { |
1255 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "abbreviatedCommandName" ); |
1256 | assert _p != null : "'abbreviatedCommandName' property not found."; |
1257 | return _p; |
1258 | } |
1259 | /** |
1260 | * Gets the value of the {@code <applicationModlet>} property. |
1261 | * <p><dl> |
1262 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1263 | * </dl></p> |
1264 | * @return Name of the 'shaded' application modlet. |
1265 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1266 | */ |
1267 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1268 | private java.lang.String getApplicationModlet() |
1269 | { |
1270 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "applicationModlet" ); |
1271 | assert _p != null : "'applicationModlet' property not found."; |
1272 | return _p; |
1273 | } |
1274 | /** |
1275 | * Gets the value of the {@code <commandName>} property. |
1276 | * <p><dl> |
1277 | * <dt><b>Final:</b></dt><dd>No</dd> |
1278 | * </dl></p> |
1279 | * @return Name of the command. |
1280 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1281 | */ |
1282 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1283 | private java.lang.String getCommandName() |
1284 | { |
1285 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "commandName" ); |
1286 | assert _p != null : "'commandName' property not found."; |
1287 | return _p; |
1288 | } |
1289 | /** |
1290 | * Gets the value of the {@code <modletExcludes>} property. |
1291 | * <p><dl> |
1292 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1293 | * </dl></p> |
1294 | * @return List of modlet names to exclude from any {@code META-INF/jomc-modlet.xml} files separated by {@code :}. |
1295 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1296 | */ |
1297 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1298 | private java.lang.String getModletExcludes() |
1299 | { |
1300 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "modletExcludes" ); |
1301 | assert _p != null : "'modletExcludes' property not found."; |
1302 | return _p; |
1303 | } |
1304 | /** |
1305 | * Gets the value of the {@code <providerExcludes>} property. |
1306 | * <p><dl> |
1307 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1308 | * </dl></p> |
1309 | * @return List of providers to exclude from any {@code META-INF/services} files separated by {@code :}. |
1310 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1311 | */ |
1312 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1313 | private java.lang.String getProviderExcludes() |
1314 | { |
1315 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "providerExcludes" ); |
1316 | assert _p != null : "'providerExcludes' property not found."; |
1317 | return _p; |
1318 | } |
1319 | /** |
1320 | * Gets the value of the {@code <schemaExcludes>} property. |
1321 | * <p><dl> |
1322 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1323 | * </dl></p> |
1324 | * @return List of schema context-ids to exclude from any {@code META-INF/jomc-modlet.xml} files separated by {@code :}. |
1325 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1326 | */ |
1327 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1328 | private java.lang.String getSchemaExcludes() |
1329 | { |
1330 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "schemaExcludes" ); |
1331 | assert _p != null : "'schemaExcludes' property not found."; |
1332 | return _p; |
1333 | } |
1334 | /** |
1335 | * Gets the value of the {@code <serviceExcludes>} property. |
1336 | * <p><dl> |
1337 | * <dt><b>Final:</b></dt><dd>Yes</dd> |
1338 | * </dl></p> |
1339 | * @return List of service classes to exclude from any {@code META-INF/jomc-modlet.xml} files separated by {@code :}. |
1340 | * @throws org.jomc.ObjectManagementException if getting the property instance fails. |
1341 | */ |
1342 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1343 | private java.lang.String getServiceExcludes() |
1344 | { |
1345 | final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "serviceExcludes" ); |
1346 | assert _p != null : "'serviceExcludes' property not found."; |
1347 | return _p; |
1348 | } |
1349 | // </editor-fold> |
1350 | // SECTION-END |
1351 | // SECTION-START[Messages] |
1352 | // <editor-fold defaultstate="collapsed" desc=" Generated Messages "> |
1353 | /** |
1354 | * Gets the text of the {@code <applicationTitle>} message. |
1355 | * <p><dl> |
1356 | * <dt><b>Languages:</b></dt> |
1357 | * <dd>English (default)</dd> |
1358 | * <dt><b>Final:</b></dt><dd>No</dd> |
1359 | * </dl></p> |
1360 | * @param locale The locale of the message to return. |
1361 | * @return The text of the {@code <applicationTitle>} message for {@code locale}. |
1362 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1363 | */ |
1364 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1365 | private String getApplicationTitle( final java.util.Locale locale ) |
1366 | { |
1367 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "applicationTitle", locale ); |
1368 | assert _m != null : "'applicationTitle' message not found."; |
1369 | return _m; |
1370 | } |
1371 | /** |
1372 | * Gets the text of the {@code <cannotProcessMessage>} 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 <cannotProcessMessage>} message for {@code locale}. |
1383 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1384 | */ |
1385 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1386 | private String getCannotProcessMessage( final java.util.Locale locale, final java.lang.String itemInfo, final java.lang.String detailMessage ) |
1387 | { |
1388 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "cannotProcessMessage", locale, itemInfo, detailMessage ); |
1389 | assert _m != null : "'cannotProcessMessage' message not found."; |
1390 | return _m; |
1391 | } |
1392 | /** |
1393 | * Gets the text of the {@code <classpathElementInfo>} message. |
1394 | * <p><dl> |
1395 | * <dt><b>Languages:</b></dt> |
1396 | * <dd>English (default)</dd> |
1397 | * <dd>Deutsch</dd> |
1398 | * <dt><b>Final:</b></dt><dd>No</dd> |
1399 | * </dl></p> |
1400 | * @param locale The locale of the message to return. |
1401 | * @param classpathElement Format argument. |
1402 | * @return The text of the {@code <classpathElementInfo>} message for {@code locale}. |
1403 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1404 | */ |
1405 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1406 | private String getClasspathElementInfo( final java.util.Locale locale, final java.lang.String classpathElement ) |
1407 | { |
1408 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "classpathElementInfo", locale, classpathElement ); |
1409 | assert _m != null : "'classpathElementInfo' message not found."; |
1410 | return _m; |
1411 | } |
1412 | /** |
1413 | * Gets the text of the {@code <classpathElementNotFoundWarning>} message. |
1414 | * <p><dl> |
1415 | * <dt><b>Languages:</b></dt> |
1416 | * <dd>English (default)</dd> |
1417 | * <dd>Deutsch</dd> |
1418 | * <dt><b>Final:</b></dt><dd>No</dd> |
1419 | * </dl></p> |
1420 | * @param locale The locale of the message to return. |
1421 | * @param fileName Format argument. |
1422 | * @return The text of the {@code <classpathElementNotFoundWarning>} message for {@code locale}. |
1423 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1424 | */ |
1425 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1426 | private String getClasspathElementNotFoundWarning( final java.util.Locale locale, final java.lang.String fileName ) |
1427 | { |
1428 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "classpathElementNotFoundWarning", locale, fileName ); |
1429 | assert _m != null : "'classpathElementNotFoundWarning' message not found."; |
1430 | return _m; |
1431 | } |
1432 | /** |
1433 | * Gets the text of the {@code <commandFailureMessage>} message. |
1434 | * <p><dl> |
1435 | * <dt><b>Languages:</b></dt> |
1436 | * <dd>English (default)</dd> |
1437 | * <dd>Deutsch</dd> |
1438 | * <dt><b>Final:</b></dt><dd>No</dd> |
1439 | * </dl></p> |
1440 | * @param locale The locale of the message to return. |
1441 | * @param toolName Format argument. |
1442 | * @return The text of the {@code <commandFailureMessage>} message for {@code locale}. |
1443 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1444 | */ |
1445 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1446 | private String getCommandFailureMessage( final java.util.Locale locale, final java.lang.String toolName ) |
1447 | { |
1448 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "commandFailureMessage", locale, toolName ); |
1449 | assert _m != null : "'commandFailureMessage' message not found."; |
1450 | return _m; |
1451 | } |
1452 | /** |
1453 | * Gets the text of the {@code <commandInfoMessage>} message. |
1454 | * <p><dl> |
1455 | * <dt><b>Languages:</b></dt> |
1456 | * <dd>English (default)</dd> |
1457 | * <dd>Deutsch</dd> |
1458 | * <dt><b>Final:</b></dt><dd>No</dd> |
1459 | * </dl></p> |
1460 | * @param locale The locale of the message to return. |
1461 | * @param toolName Format argument. |
1462 | * @return The text of the {@code <commandInfoMessage>} message for {@code locale}. |
1463 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1464 | */ |
1465 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1466 | private String getCommandInfoMessage( final java.util.Locale locale, final java.lang.String toolName ) |
1467 | { |
1468 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "commandInfoMessage", locale, toolName ); |
1469 | assert _m != null : "'commandInfoMessage' message not found."; |
1470 | return _m; |
1471 | } |
1472 | /** |
1473 | * Gets the text of the {@code <commandSuccessMessage>} message. |
1474 | * <p><dl> |
1475 | * <dt><b>Languages:</b></dt> |
1476 | * <dd>English (default)</dd> |
1477 | * <dd>Deutsch</dd> |
1478 | * <dt><b>Final:</b></dt><dd>No</dd> |
1479 | * </dl></p> |
1480 | * @param locale The locale of the message to return. |
1481 | * @param toolName Format argument. |
1482 | * @return The text of the {@code <commandSuccessMessage>} message for {@code locale}. |
1483 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1484 | */ |
1485 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1486 | private String getCommandSuccessMessage( final java.util.Locale locale, final java.lang.String toolName ) |
1487 | { |
1488 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "commandSuccessMessage", locale, toolName ); |
1489 | assert _m != null : "'commandSuccessMessage' message not found."; |
1490 | return _m; |
1491 | } |
1492 | /** |
1493 | * Gets the text of the {@code <defaultLogLevelInfo>} message. |
1494 | * <p><dl> |
1495 | * <dt><b>Languages:</b></dt> |
1496 | * <dd>English (default)</dd> |
1497 | * <dd>Deutsch</dd> |
1498 | * <dt><b>Final:</b></dt><dd>No</dd> |
1499 | * </dl></p> |
1500 | * @param locale The locale of the message to return. |
1501 | * @param defaultLogLevel Format argument. |
1502 | * @return The text of the {@code <defaultLogLevelInfo>} message for {@code locale}. |
1503 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1504 | */ |
1505 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1506 | private String getDefaultLogLevelInfo( final java.util.Locale locale, final java.lang.String defaultLogLevel ) |
1507 | { |
1508 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "defaultLogLevelInfo", locale, defaultLogLevel ); |
1509 | assert _m != null : "'defaultLogLevelInfo' message not found."; |
1510 | return _m; |
1511 | } |
1512 | /** |
1513 | * Gets the text of the {@code <documentFileInfo>} message. |
1514 | * <p><dl> |
1515 | * <dt><b>Languages:</b></dt> |
1516 | * <dd>English (default)</dd> |
1517 | * <dd>Deutsch</dd> |
1518 | * <dt><b>Final:</b></dt><dd>No</dd> |
1519 | * </dl></p> |
1520 | * @param locale The locale of the message to return. |
1521 | * @param documentFile Format argument. |
1522 | * @return The text of the {@code <documentFileInfo>} message for {@code locale}. |
1523 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1524 | */ |
1525 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1526 | private String getDocumentFileInfo( final java.util.Locale locale, final java.lang.String documentFile ) |
1527 | { |
1528 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "documentFileInfo", locale, documentFile ); |
1529 | assert _m != null : "'documentFileInfo' message not found."; |
1530 | return _m; |
1531 | } |
1532 | /** |
1533 | * Gets the text of the {@code <documentFileNotFoundWarning>} message. |
1534 | * <p><dl> |
1535 | * <dt><b>Languages:</b></dt> |
1536 | * <dd>English (default)</dd> |
1537 | * <dd>Deutsch</dd> |
1538 | * <dt><b>Final:</b></dt><dd>No</dd> |
1539 | * </dl></p> |
1540 | * @param locale The locale of the message to return. |
1541 | * @param fileName Format argument. |
1542 | * @return The text of the {@code <documentFileNotFoundWarning>} message for {@code locale}. |
1543 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1544 | */ |
1545 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1546 | private String getDocumentFileNotFoundWarning( final java.util.Locale locale, final java.lang.String fileName ) |
1547 | { |
1548 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "documentFileNotFoundWarning", locale, fileName ); |
1549 | assert _m != null : "'documentFileNotFoundWarning' message not found."; |
1550 | return _m; |
1551 | } |
1552 | /** |
1553 | * Gets the text of the {@code <excludedModletInfo>} message. |
1554 | * <p><dl> |
1555 | * <dt><b>Languages:</b></dt> |
1556 | * <dd>English (default)</dd> |
1557 | * <dd>Deutsch</dd> |
1558 | * <dt><b>Final:</b></dt><dd>No</dd> |
1559 | * </dl></p> |
1560 | * @param locale The locale of the message to return. |
1561 | * @param resourceName Format argument. |
1562 | * @param modletIdentifier Format argument. |
1563 | * @return The text of the {@code <excludedModletInfo>} message for {@code locale}. |
1564 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1565 | */ |
1566 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1567 | private String getExcludedModletInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String modletIdentifier ) |
1568 | { |
1569 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "excludedModletInfo", locale, resourceName, modletIdentifier ); |
1570 | assert _m != null : "'excludedModletInfo' message not found."; |
1571 | return _m; |
1572 | } |
1573 | /** |
1574 | * Gets the text of the {@code <excludedProviderInfo>} message. |
1575 | * <p><dl> |
1576 | * <dt><b>Languages:</b></dt> |
1577 | * <dd>English (default)</dd> |
1578 | * <dd>Deutsch</dd> |
1579 | * <dt><b>Final:</b></dt><dd>No</dd> |
1580 | * </dl></p> |
1581 | * @param locale The locale of the message to return. |
1582 | * @param resourceName Format argument. |
1583 | * @param providerName Format argument. |
1584 | * @return The text of the {@code <excludedProviderInfo>} message for {@code locale}. |
1585 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1586 | */ |
1587 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1588 | private String getExcludedProviderInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String providerName ) |
1589 | { |
1590 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "excludedProviderInfo", locale, resourceName, providerName ); |
1591 | assert _m != null : "'excludedProviderInfo' message not found."; |
1592 | return _m; |
1593 | } |
1594 | /** |
1595 | * Gets the text of the {@code <excludedSchemaInfo>} message. |
1596 | * <p><dl> |
1597 | * <dt><b>Languages:</b></dt> |
1598 | * <dd>English (default)</dd> |
1599 | * <dd>Deutsch</dd> |
1600 | * <dt><b>Final:</b></dt><dd>No</dd> |
1601 | * </dl></p> |
1602 | * @param locale The locale of the message to return. |
1603 | * @param resourceName Format argument. |
1604 | * @param contextId Format argument. |
1605 | * @return The text of the {@code <excludedSchemaInfo>} message for {@code locale}. |
1606 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1607 | */ |
1608 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1609 | private String getExcludedSchemaInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String contextId ) |
1610 | { |
1611 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "excludedSchemaInfo", locale, resourceName, contextId ); |
1612 | assert _m != null : "'excludedSchemaInfo' message not found."; |
1613 | return _m; |
1614 | } |
1615 | /** |
1616 | * Gets the text of the {@code <excludedServiceInfo>} message. |
1617 | * <p><dl> |
1618 | * <dt><b>Languages:</b></dt> |
1619 | * <dd>English (default)</dd> |
1620 | * <dd>Deutsch</dd> |
1621 | * <dt><b>Final:</b></dt><dd>No</dd> |
1622 | * </dl></p> |
1623 | * @param locale The locale of the message to return. |
1624 | * @param resourceName Format argument. |
1625 | * @param serviceName Format argument. |
1626 | * @return The text of the {@code <excludedServiceInfo>} message for {@code locale}. |
1627 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1628 | */ |
1629 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1630 | private String getExcludedServiceInfo( final java.util.Locale locale, final java.lang.String resourceName, final java.lang.String serviceName ) |
1631 | { |
1632 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "excludedServiceInfo", locale, resourceName, serviceName ); |
1633 | assert _m != null : "'excludedServiceInfo' message not found."; |
1634 | return _m; |
1635 | } |
1636 | /** |
1637 | * Gets the text of the {@code <invalidModelMessage>} message. |
1638 | * <p><dl> |
1639 | * <dt><b>Languages:</b></dt> |
1640 | * <dd>English (default)</dd> |
1641 | * <dd>Deutsch</dd> |
1642 | * <dt><b>Final:</b></dt><dd>No</dd> |
1643 | * </dl></p> |
1644 | * @param locale The locale of the message to return. |
1645 | * @param modelIdentifier Format argument. |
1646 | * @return The text of the {@code <invalidModelMessage>} message for {@code locale}. |
1647 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1648 | */ |
1649 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1650 | private String getInvalidModelMessage( final java.util.Locale locale, final java.lang.String modelIdentifier ) |
1651 | { |
1652 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "invalidModelMessage", locale, modelIdentifier ); |
1653 | assert _m != null : "'invalidModelMessage' message not found."; |
1654 | return _m; |
1655 | } |
1656 | /** |
1657 | * Gets the text of the {@code <longDescriptionMessage>} message. |
1658 | * <p><dl> |
1659 | * <dt><b>Languages:</b></dt> |
1660 | * <dd>English (default)</dd> |
1661 | * <dt><b>Final:</b></dt><dd>No</dd> |
1662 | * </dl></p> |
1663 | * @param locale The locale of the message to return. |
1664 | * @return The text of the {@code <longDescriptionMessage>} message for {@code locale}. |
1665 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1666 | */ |
1667 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1668 | private String getLongDescriptionMessage( final java.util.Locale locale ) |
1669 | { |
1670 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "longDescriptionMessage", locale ); |
1671 | assert _m != null : "'longDescriptionMessage' message not found."; |
1672 | return _m; |
1673 | } |
1674 | /** |
1675 | * Gets the text of the {@code <readingMessage>} message. |
1676 | * <p><dl> |
1677 | * <dt><b>Languages:</b></dt> |
1678 | * <dd>English (default)</dd> |
1679 | * <dd>Deutsch</dd> |
1680 | * <dt><b>Final:</b></dt><dd>No</dd> |
1681 | * </dl></p> |
1682 | * @param locale The locale of the message to return. |
1683 | * @param locationInfo Format argument. |
1684 | * @return The text of the {@code <readingMessage>} message for {@code locale}. |
1685 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1686 | */ |
1687 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1688 | private String getReadingMessage( final java.util.Locale locale, final java.lang.String locationInfo ) |
1689 | { |
1690 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "readingMessage", locale, locationInfo ); |
1691 | assert _m != null : "'readingMessage' message not found."; |
1692 | return _m; |
1693 | } |
1694 | /** |
1695 | * Gets the text of the {@code <separator>} message. |
1696 | * <p><dl> |
1697 | * <dt><b>Languages:</b></dt> |
1698 | * <dd>English (default)</dd> |
1699 | * <dt><b>Final:</b></dt><dd>No</dd> |
1700 | * </dl></p> |
1701 | * @param locale The locale of the message to return. |
1702 | * @return The text of the {@code <separator>} message for {@code locale}. |
1703 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1704 | */ |
1705 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1706 | private String getSeparator( final java.util.Locale locale ) |
1707 | { |
1708 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "separator", locale ); |
1709 | assert _m != null : "'separator' message not found."; |
1710 | return _m; |
1711 | } |
1712 | /** |
1713 | * Gets the text of the {@code <shortDescriptionMessage>} message. |
1714 | * <p><dl> |
1715 | * <dt><b>Languages:</b></dt> |
1716 | * <dd>English (default)</dd> |
1717 | * <dt><b>Final:</b></dt><dd>No</dd> |
1718 | * </dl></p> |
1719 | * @param locale The locale of the message to return. |
1720 | * @return The text of the {@code <shortDescriptionMessage>} message for {@code locale}. |
1721 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
1722 | */ |
1723 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1724 | private String getShortDescriptionMessage( final java.util.Locale locale ) |
1725 | { |
1726 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "shortDescriptionMessage", locale ); |
1727 | assert _m != null : "'shortDescriptionMessage' message not found."; |
1728 | return _m; |
1729 | } |
1730 | // </editor-fold> |
1731 | // SECTION-END |
1732 | // SECTION-START[Generated Command] |
1733 | // <editor-fold defaultstate="collapsed" desc=" Generated Options "> |
1734 | /** |
1735 | * Gets the options of the command. |
1736 | * <p><strong>Options:</strong> |
1737 | * <table border="1" width="100%" cellpadding="3" cellspacing="0"> |
1738 | * <tr class="TableSubHeadingColor"> |
1739 | * <th align="left" scope="col" nowrap><b>Specification</b></th> |
1740 | * <th align="left" scope="col" nowrap><b>Implementation</b></th> |
1741 | * </tr> |
1742 | * <tr class="TableRow"> |
1743 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1744 | * <td align="left" valign="top" nowrap>JOMC CLI Classpath Option</td> |
1745 | * </tr> |
1746 | * <tr class="TableRow"> |
1747 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1748 | * <td align="left" valign="top" nowrap>JOMC CLI Documents Option</td> |
1749 | * </tr> |
1750 | * <tr class="TableRow"> |
1751 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1752 | * <td align="left" valign="top" nowrap>JOMC CLI ModelContextFactory Class Name Option</td> |
1753 | * </tr> |
1754 | * <tr class="TableRow"> |
1755 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1756 | * <td align="left" valign="top" nowrap>JOMC CLI Model Option</td> |
1757 | * </tr> |
1758 | * <tr class="TableRow"> |
1759 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1760 | * <td align="left" valign="top" nowrap>JOMC CLI Modlet Location Option</td> |
1761 | * </tr> |
1762 | * <tr class="TableRow"> |
1763 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1764 | * <td align="left" valign="top" nowrap>JOMC CLI Modlet Schema System Id Option</td> |
1765 | * </tr> |
1766 | * <tr class="TableRow"> |
1767 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1768 | * <td align="left" valign="top" nowrap>JOMC CLI No Modlet Resource Validation Option</td> |
1769 | * </tr> |
1770 | * <tr class="TableRow"> |
1771 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1772 | * <td align="left" valign="top" nowrap>JOMC CLI Platform Provider Location Option</td> |
1773 | * </tr> |
1774 | * <tr class="TableRow"> |
1775 | * <td align="left" valign="top" nowrap>JOMC CLI Command Option {@code (org.apache.commons.cli.Option)} @ 1.2</td> |
1776 | * <td align="left" valign="top" nowrap>JOMC CLI Provider Location Option</td> |
1777 | * </tr> |
1778 | * </table> |
1779 | * </p> |
1780 | * @return The options of the command. |
1781 | */ |
1782 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) |
1783 | @Override |
1784 | public org.apache.commons.cli.Options getOptions() |
1785 | { |
1786 | final org.apache.commons.cli.Options options = new org.apache.commons.cli.Options(); |
1787 | options.addOption( this.getClasspathOption() ); |
1788 | options.addOption( this.getDocumentsOption() ); |
1789 | options.addOption( this.getModelContextFactoryOption() ); |
1790 | options.addOption( this.getModelOption() ); |
1791 | options.addOption( this.getModletLocationOption() ); |
1792 | options.addOption( this.getModletSchemaSystemIdOption() ); |
1793 | options.addOption( this.getNoModletResourceValidation() ); |
1794 | options.addOption( this.getPlatformProviderLocationOption() ); |
1795 | options.addOption( this.getProviderLocationOption() ); |
1796 | return options; |
1797 | } |
1798 | // </editor-fold> |
1799 | // SECTION-END |
1800 | } |