1   /*
2    * $Id: DummyInitialContextFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.test.integration.config;
12  
13  import org.mule.MuleServer;
14  import org.mule.api.lifecycle.InitialisationCallback;
15  import org.mule.api.lifecycle.InitialisationException;
16  import org.mule.api.object.ObjectFactory;
17  import org.mule.api.service.Service;
18  import org.mule.component.simple.EchoComponent;
19  import org.mule.jndi.SimpleContext;
20  import org.mule.module.management.agent.Log4jAgent;
21  import org.mule.module.xml.transformer.XmlToObject;
22  import org.mule.tck.MuleTestUtils;
23  import org.mule.transport.vm.VMConnector;
24  
25  /**
26   * A dummy property factory for creating a Jndi context
27   */
28  public class DummyInitialContextFactory implements ObjectFactory
29  {
30      public Object getInstance() throws Exception
31      {
32          SimpleContext c = new SimpleContext();
33          c.bind("vmConnector", new VMConnector());
34          c.bind("endpointRef", "vm://my.object");
35          c.bind("Log4JAgent", new Log4jAgent());
36          c.bind("XmlToObject", new XmlToObject());
37          Service d = MuleTestUtils.getTestService("EchoUMO", EchoComponent.class, MuleServer.getMuleContext());
38          c.bind("EchoUMO", d);
39          return c;
40      }
41  
42      public void initialise() throws InitialisationException
43      {
44          // do nothing
45      }
46  
47      public void dispose()
48      {
49          // do nothing
50      }
51  
52      public void release(Object arg0)
53      {
54          // do nothing
55      }
56  
57      public Class getObjectClass()
58      {
59          throw new UnsupportedOperationException();
60      }
61  
62      public void addObjectInitialisationCallback(InitialisationCallback callback)
63      {
64          throw new UnsupportedOperationException();        
65      }
66  
67      public boolean isSingleton()
68      {
69          return false;
70      }
71  }