1 7 8 package org.openejb.alt.config.sys; 9 10 14 import java.io.IOException ; 15 import java.io.Reader ; 16 import java.io.Serializable ; 17 import java.io.Writer ; 18 import java.util.Enumeration ; 19 import java.util.Vector ; 20 import org.exolab.castor.xml.MarshalException; 21 import org.exolab.castor.xml.Marshaller; 22 import org.exolab.castor.xml.Unmarshaller; 23 import org.exolab.castor.xml.ValidationException; 24 import org.xml.sax.ContentHandler ; 25 26 31 public class Openejb implements java.io.Serializable { 32 33 34 38 41 private java.lang.String _content = ""; 42 43 46 private java.util.Vector _containerList; 47 48 51 private java.util.Vector _jndiProviderList; 52 53 56 private org.openejb.alt.config.sys.SecurityService _securityService; 57 58 61 private org.openejb.alt.config.sys.TransactionService _transactionService; 62 63 66 private org.openejb.alt.config.sys.ConnectionManager _connectionManager; 67 68 71 private org.openejb.alt.config.sys.ProxyFactory _proxyFactory; 72 73 76 private java.util.Vector _connectorList; 77 78 81 private java.util.Vector _resourceList; 82 83 86 private java.util.Vector _deploymentsList; 87 88 89 93 public Openejb() { 94 super(); 95 setContent(""); 96 _containerList = new Vector (); 97 _jndiProviderList = new Vector (); 98 _connectorList = new Vector (); 99 _resourceList = new Vector (); 100 _deploymentsList = new Vector (); 101 } 103 104 108 113 public void addConnector(org.openejb.alt.config.sys.Connector vConnector) 114 throws java.lang.IndexOutOfBoundsException 115 { 116 _connectorList.addElement(vConnector); 117 } 119 125 public void addConnector(int index, org.openejb.alt.config.sys.Connector vConnector) 126 throws java.lang.IndexOutOfBoundsException 127 { 128 _connectorList.insertElementAt(vConnector, index); 129 } 131 136 public void addContainer(org.openejb.alt.config.sys.Container vContainer) 137 throws java.lang.IndexOutOfBoundsException 138 { 139 _containerList.addElement(vContainer); 140 } 142 148 public void addContainer(int index, org.openejb.alt.config.sys.Container vContainer) 149 throws java.lang.IndexOutOfBoundsException 150 { 151 _containerList.insertElementAt(vContainer, index); 152 } 154 159 public void addDeployments(org.openejb.alt.config.sys.Deployments vDeployments) 160 throws java.lang.IndexOutOfBoundsException 161 { 162 _deploymentsList.addElement(vDeployments); 163 } 165 171 public void addDeployments(int index, org.openejb.alt.config.sys.Deployments vDeployments) 172 throws java.lang.IndexOutOfBoundsException 173 { 174 _deploymentsList.insertElementAt(vDeployments, index); 175 } 177 182 public void addJndiProvider(org.openejb.alt.config.sys.JndiProvider vJndiProvider) 183 throws java.lang.IndexOutOfBoundsException 184 { 185 _jndiProviderList.addElement(vJndiProvider); 186 } 188 194 public void addJndiProvider(int index, org.openejb.alt.config.sys.JndiProvider vJndiProvider) 195 throws java.lang.IndexOutOfBoundsException 196 { 197 _jndiProviderList.insertElementAt(vJndiProvider, index); 198 } 200 205 public void addResource(org.openejb.alt.config.sys.Resource vResource) 206 throws java.lang.IndexOutOfBoundsException 207 { 208 _resourceList.addElement(vResource); 209 } 211 217 public void addResource(int index, org.openejb.alt.config.sys.Resource vResource) 218 throws java.lang.IndexOutOfBoundsException 219 { 220 _resourceList.insertElementAt(vResource, index); 221 } 223 226 public java.util.Enumeration enumerateConnector() 227 { 228 return _connectorList.elements(); 229 } 231 234 public java.util.Enumeration enumerateContainer() 235 { 236 return _containerList.elements(); 237 } 239 242 public java.util.Enumeration enumerateDeployments() 243 { 244 return _deploymentsList.elements(); 245 } 247 250 public java.util.Enumeration enumerateJndiProvider() 251 { 252 return _jndiProviderList.elements(); 253 } 255 258 public java.util.Enumeration enumerateResource() 259 { 260 return _resourceList.elements(); 261 } 263 268 public org.openejb.alt.config.sys.ConnectionManager getConnectionManager() 269 { 270 return this._connectionManager; 271 } 273 278 public org.openejb.alt.config.sys.Connector getConnector(int index) 279 throws java.lang.IndexOutOfBoundsException 280 { 281 if ((index < 0) || (index > _connectorList.size())) { 283 throw new IndexOutOfBoundsException (); 284 } 285 286 return (org.openejb.alt.config.sys.Connector) _connectorList.elementAt(index); 287 } 289 292 public org.openejb.alt.config.sys.Connector[] getConnector() 293 { 294 int size = _connectorList.size(); 295 org.openejb.alt.config.sys.Connector[] mArray = new org.openejb.alt.config.sys.Connector[size]; 296 for (int index = 0; index < size; index++) { 297 mArray[index] = (org.openejb.alt.config.sys.Connector) _connectorList.elementAt(index); 298 } 299 return mArray; 300 } 302 305 public int getConnectorCount() 306 { 307 return _connectorList.size(); 308 } 310 315 public org.openejb.alt.config.sys.Container getContainer(int index) 316 throws java.lang.IndexOutOfBoundsException 317 { 318 if ((index < 0) || (index > _containerList.size())) { 320 throw new IndexOutOfBoundsException (); 321 } 322 323 return (org.openejb.alt.config.sys.Container) _containerList.elementAt(index); 324 } 326 329 public org.openejb.alt.config.sys.Container[] getContainer() 330 { 331 int size = _containerList.size(); 332 org.openejb.alt.config.sys.Container[] mArray = new org.openejb.alt.config.sys.Container[size]; 333 for (int index = 0; index < size; index++) { 334 mArray[index] = (org.openejb.alt.config.sys.Container) _containerList.elementAt(index); 335 } 336 return mArray; 337 } 339 342 public int getContainerCount() 343 { 344 return _containerList.size(); 345 } 347 353 public java.lang.String getContent() 354 { 355 return this._content; 356 } 358 363 public org.openejb.alt.config.sys.Deployments getDeployments(int index) 364 throws java.lang.IndexOutOfBoundsException 365 { 366 if ((index < 0) || (index > _deploymentsList.size())) { 368 throw new IndexOutOfBoundsException (); 369 } 370 371 return (org.openejb.alt.config.sys.Deployments) _deploymentsList.elementAt(index); 372 } 374 377 public org.openejb.alt.config.sys.Deployments[] getDeployments() 378 { 379 int size = _deploymentsList.size(); 380 org.openejb.alt.config.sys.Deployments[] mArray = new org.openejb.alt.config.sys.Deployments[size]; 381 for (int index = 0; index < size; index++) { 382 mArray[index] = (org.openejb.alt.config.sys.Deployments) _deploymentsList.elementAt(index); 383 } 384 return mArray; 385 } 387 390 public int getDeploymentsCount() 391 { 392 return _deploymentsList.size(); 393 } 395 400 public org.openejb.alt.config.sys.JndiProvider getJndiProvider(int index) 401 throws java.lang.IndexOutOfBoundsException 402 { 403 if ((index < 0) || (index > _jndiProviderList.size())) { 405 throw new IndexOutOfBoundsException (); 406 } 407 408 return (org.openejb.alt.config.sys.JndiProvider) _jndiProviderList.elementAt(index); 409 } 411 414 public org.openejb.alt.config.sys.JndiProvider[] getJndiProvider() 415 { 416 int size = _jndiProviderList.size(); 417 org.openejb.alt.config.sys.JndiProvider[] mArray = new org.openejb.alt.config.sys.JndiProvider[size]; 418 for (int index = 0; index < size; index++) { 419 mArray[index] = (org.openejb.alt.config.sys.JndiProvider) _jndiProviderList.elementAt(index); 420 } 421 return mArray; 422 } 424 427 public int getJndiProviderCount() 428 { 429 return _jndiProviderList.size(); 430 } 432 437 public org.openejb.alt.config.sys.ProxyFactory getProxyFactory() 438 { 439 return this._proxyFactory; 440 } 442 447 public org.openejb.alt.config.sys.Resource getResource(int index) 448 throws java.lang.IndexOutOfBoundsException 449 { 450 if ((index < 0) || (index > _resourceList.size())) { 452 throw new IndexOutOfBoundsException (); 453 } 454 455 return (org.openejb.alt.config.sys.Resource) _resourceList.elementAt(index); 456 } 458 461 public org.openejb.alt.config.sys.Resource[] getResource() 462 { 463 int size = _resourceList.size(); 464 org.openejb.alt.config.sys.Resource[] mArray = new org.openejb.alt.config.sys.Resource[size]; 465 for (int index = 0; index < size; index++) { 466 mArray[index] = (org.openejb.alt.config.sys.Resource) _resourceList.elementAt(index); 467 } 468 return mArray; 469 } 471 474 public int getResourceCount() 475 { 476 return _resourceList.size(); 477 } 479 484 public org.openejb.alt.config.sys.SecurityService getSecurityService() 485 { 486 return this._securityService; 487 } 489 494 public org.openejb.alt.config.sys.TransactionService getTransactionService() 495 { 496 return this._transactionService; 497 } 499 502 public boolean isValid() 503 { 504 try { 505 validate(); 506 } 507 catch (org.exolab.castor.xml.ValidationException vex) { 508 return false; 509 } 510 return true; 511 } 513 518 public void marshal(java.io.Writer out) 519 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 520 { 521 522 Marshaller.marshal(this, out); 523 } 525 530 public void marshal(org.xml.sax.ContentHandler handler) 531 throws java.io.IOException , org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 532 { 533 534 Marshaller.marshal(this, handler); 535 } 537 540 public void removeAllConnector() 541 { 542 _connectorList.removeAllElements(); 543 } 545 548 public void removeAllContainer() 549 { 550 _containerList.removeAllElements(); 551 } 553 556 public void removeAllDeployments() 557 { 558 _deploymentsList.removeAllElements(); 559 } 561 564 public void removeAllJndiProvider() 565 { 566 _jndiProviderList.removeAllElements(); 567 } 569 572 public void removeAllResource() 573 { 574 _resourceList.removeAllElements(); 575 } 577 582 public org.openejb.alt.config.sys.Connector removeConnector(int index) 583 { 584 java.lang.Object obj = _connectorList.elementAt(index); 585 _connectorList.removeElementAt(index); 586 return (org.openejb.alt.config.sys.Connector) obj; 587 } 589 594 public org.openejb.alt.config.sys.Container removeContainer(int index) 595 { 596 java.lang.Object obj = _containerList.elementAt(index); 597 _containerList.removeElementAt(index); 598 return (org.openejb.alt.config.sys.Container) obj; 599 } 601 606 public org.openejb.alt.config.sys.Deployments removeDeployments(int index) 607 { 608 java.lang.Object obj = _deploymentsList.elementAt(index); 609 _deploymentsList.removeElementAt(index); 610 return (org.openejb.alt.config.sys.Deployments) obj; 611 } 613 618 public org.openejb.alt.config.sys.JndiProvider removeJndiProvider(int index) 619 { 620 java.lang.Object obj = _jndiProviderList.elementAt(index); 621 _jndiProviderList.removeElementAt(index); 622 return (org.openejb.alt.config.sys.JndiProvider) obj; 623 } 625 630 public org.openejb.alt.config.sys.Resource removeResource(int index) 631 { 632 java.lang.Object obj = _resourceList.elementAt(index); 633 _resourceList.removeElementAt(index); 634 return (org.openejb.alt.config.sys.Resource) obj; 635 } 637 643 public void setConnectionManager(org.openejb.alt.config.sys.ConnectionManager connectionManager) 644 { 645 this._connectionManager = connectionManager; 646 } 648 654 public void setConnector(int index, org.openejb.alt.config.sys.Connector vConnector) 655 throws java.lang.IndexOutOfBoundsException 656 { 657 if ((index < 0) || (index > _connectorList.size())) { 659 throw new IndexOutOfBoundsException (); 660 } 661 _connectorList.setElementAt(vConnector, index); 662 } 664 669 public void setConnector(org.openejb.alt.config.sys.Connector[] connectorArray) 670 { 671 _connectorList.removeAllElements(); 673 for (int i = 0; i < connectorArray.length; i++) { 674 _connectorList.addElement(connectorArray[i]); 675 } 676 } 678 684 public void setContainer(int index, org.openejb.alt.config.sys.Container vContainer) 685 throws java.lang.IndexOutOfBoundsException 686 { 687 if ((index < 0) || (index > _containerList.size())) { 689 throw new IndexOutOfBoundsException (); 690 } 691 _containerList.setElementAt(vContainer, index); 692 } 694 699 public void setContainer(org.openejb.alt.config.sys.Container[] containerArray) 700 { 701 _containerList.removeAllElements(); 703 for (int i = 0; i < containerArray.length; i++) { 704 _containerList.addElement(containerArray[i]); 705 } 706 } 708 714 public void setContent(java.lang.String content) 715 { 716 this._content = content; 717 } 719 725 public void setDeployments(int index, org.openejb.alt.config.sys.Deployments vDeployments) 726 throws java.lang.IndexOutOfBoundsException 727 { 728 if ((index < 0) || (index > _deploymentsList.size())) { 730 throw new IndexOutOfBoundsException (); 731 } 732 _deploymentsList.setElementAt(vDeployments, index); 733 } 735 740 public void setDeployments(org.openejb.alt.config.sys.Deployments[] deploymentsArray) 741 { 742 _deploymentsList.removeAllElements(); 744 for (int i = 0; i < deploymentsArray.length; i++) { 745 _deploymentsList.addElement(deploymentsArray[i]); 746 } 747 } 749 755 public void setJndiProvider(int index, org.openejb.alt.config.sys.JndiProvider vJndiProvider) 756 throws java.lang.IndexOutOfBoundsException 757 { 758 if ((index < 0) || (index > _jndiProviderList.size())) { 760 throw new IndexOutOfBoundsException (); 761 } 762 _jndiProviderList.setElementAt(vJndiProvider, index); 763 } 765 770 public void setJndiProvider(org.openejb.alt.config.sys.JndiProvider[] jndiProviderArray) 771 { 772 _jndiProviderList.removeAllElements(); 774 for (int i = 0; i < jndiProviderArray.length; i++) { 775 _jndiProviderList.addElement(jndiProviderArray[i]); 776 } 777 } 779 784 public void setProxyFactory(org.openejb.alt.config.sys.ProxyFactory proxyFactory) 785 { 786 this._proxyFactory = proxyFactory; 787 } 789 795 public void setResource(int index, org.openejb.alt.config.sys.Resource vResource) 796 throws java.lang.IndexOutOfBoundsException 797 { 798 if ((index < 0) || (index > _resourceList.size())) { 800 throw new IndexOutOfBoundsException (); 801 } 802 _resourceList.setElementAt(vResource, index); 803 } 805 810 public void setResource(org.openejb.alt.config.sys.Resource[] resourceArray) 811 { 812 _resourceList.removeAllElements(); 814 for (int i = 0; i < resourceArray.length; i++) { 815 _resourceList.addElement(resourceArray[i]); 816 } 817 } 819 824 public void setSecurityService(org.openejb.alt.config.sys.SecurityService securityService) 825 { 826 this._securityService = securityService; 827 } 829 835 public void setTransactionService(org.openejb.alt.config.sys.TransactionService transactionService) 836 { 837 this._transactionService = transactionService; 838 } 840 845 public static java.lang.Object unmarshal(java.io.Reader reader) 846 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 847 { 848 return (org.openejb.alt.config.sys.Openejb) Unmarshaller.unmarshal(org.openejb.alt.config.sys.Openejb.class, reader); 849 } 851 854 public void validate() 855 throws org.exolab.castor.xml.ValidationException 856 { 857 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); 858 validator.validate(this); 859 } 861 } 862 | Popular Tags |