View Javadoc

1   /*
2    *  Copyright (c) 2005, 2006 Imola Informatica.
3    *  All rights reserved. This program and the accompanying materials
4    *  are made available under the terms of the LGPL License v2.1
5    *  which accompanies this distribution, and is available at
6    *  http://www.gnu.org/licenses/lgpl.html
7    */
8   
9   
10  package it.imolinfo.jbi4cics.jbi;
11  
12  import it.imolinfo.jbi4cics.webservices.runtime.ServiceCreator;
13  import org.apache.servicemix.common.BaseComponent;
14  import org.apache.servicemix.common.BaseLifeCycle;
15  import org.codehaus.xfire.XFire;
16  
17  /**
18   * Class for life cycle management of Jbi4Cics components.
19   */
20  public final class Jbi4cicsLifeCycle extends BaseLifeCycle {
21  
22      private Jbi4cicsComponentConfiguration configuration
23              = new Jbi4cicsComponentConfiguration();
24  
25      /**
26       * The XFire instance.
27       */
28      private XFire xfire;
29  
30      /**
31       * The byte code engineering library class loader used.
32       */
33      private BCELClassLoader bcelClassLoader
34              = new BCELClassLoader(getClass().getClassLoader());
35  
36      /**
37       * Initializes the life cycle instance for the specified ServiceMix
38       * component.
39       *
40       * @param  component  the ServiceMix component managed by this instance.
41       */
42      public Jbi4cicsLifeCycle(BaseComponent component) {
43          super(component);
44      }
45  
46      /**
47       * Returns the XFire instance.
48       *
49       * @return  the XFire instance.
50       */
51      public XFire getXFire() {
52          return xfire;
53      }
54  
55      @Override
56      protected void doInit() throws Exception {
57          super.doInit();
58          configuration.setRootDir(context.getWorkspaceRoot());
59          configuration.load();
60          xfire = ServiceCreator.createXFire(context);
61      }
62  
63      /**
64       * Returns the byte code engineering library class loader.
65       *
66       * @return  the byte code engineering library class loader.
67       */
68      public BCELClassLoader getBCELClassLoader() {
69          return bcelClassLoader;
70      }
71  
72      /**
73       * Sets the byte code engineering library class loader.
74       *
75       * @param  bcelClassLoader  the byte code engineering library class loader.
76       */
77      public void setBCELClassLoader(BCELClassLoader bcelClassLoader) {
78          this.bcelClassLoader = bcelClassLoader;
79      }
80  }