View Javadoc

1   /*
2    * $Id: TestCompressionTransformer.java 7976 2007-08-21 14:26:13Z 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.tck.testmodels.mule;
12  
13  import org.mule.transformers.compression.AbstractCompressionTransformer;
14  import org.mule.umo.transformer.TransformerException;
15  import org.mule.util.compression.GZipCompression;
16  
17  public class TestCompressionTransformer extends AbstractCompressionTransformer
18  {
19  
20      private String beanProperty1;
21      private String containerProperty;
22  
23      private int beanProperty2;
24  
25      public TestCompressionTransformer()
26      {
27          super();
28          this.setStrategy(new GZipCompression());
29      }
30  
31      public Object doTransform(Object src, String encoding) throws TransformerException
32      {
33          return null;
34      }
35  
36      public String getBeanProperty1()
37      {
38          return beanProperty1;
39      }
40  
41      public void setBeanProperty1(String beanProperty1)
42      {
43          this.beanProperty1 = beanProperty1;
44      }
45  
46      public int getBeanProperty2()
47      {
48          return beanProperty2;
49      }
50  
51      public void setBeanProperty2(int beanProperty2)
52      {
53          this.beanProperty2 = beanProperty2;
54      }
55  
56      public String getContainerProperty()
57      {
58          return containerProperty;
59      }
60  
61      public void setContainerProperty(String containerProperty)
62      {
63          this.containerProperty = containerProperty;
64      }
65  
66      /*
67       * (non-Javadoc)
68       * 
69       * @see java.lang.Object#clone() ensures that isn't not cloned before all
70       *      properties have been set on it
71       */
72      public Object clone() throws CloneNotSupportedException
73      {
74          if (containerProperty == null)
75          {
76              throw new IllegalStateException(
77                  "Transformer cannot be cloned until all properties have been set on it");
78          }
79  
80          return super.clone();
81      }
82  
83  }