/* ********************************************************************
    Licensed to Jasig under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Jasig licenses this file to you under the Apache License,
    Version 2.0 (the "License"); you may not use this file
    except in compliance with the License. You may obtain a
    copy of the License at:

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on
    an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied. See the License for the
    specific language governing permissions and limitations
    under the License.
*/
package edu.rpi.cmt.calendar.diff;

import org.apache.log4j.Logger;
import org.oasis_open.docs.ns.wscal.calws_soap.ComponentSelectionType;
import org.oasis_open.docs.ns.wscal.calws_soap.ObjectFactory;

import ietf.params.xml.ns.icalendar_2.IcalendarType;
import ietf.params.xml.ns.icalendar_2.VcalendarType;

/** This class compares 2 components.
*
* @author Mike Douglass
*/
public class XmlIcalCompare {
  protected transient Logger log;

  private ValueMatcher matcher;

  /**
   */
  public XmlIcalCompare() {
    matcher = new ValueMatcher();
  }

  /**
   * @return object used to match values.
   */
  public ValueMatcher getMatcher() {
    return matcher;
  }

  /** Compare the parameters. Return null for equal or a select element.
   *
   * @param of - so we can get soap elements
   * @param newval
   * @param oldval
   * @return SelectElementType if val1 and val2 differ else null.
   */
  public ComponentSelectionType diff(final ObjectFactory of,
                                     final IcalendarType newval,
                                     final IcalendarType oldval) {
    VcalendarType nv = newval.getVcalendar().get(0);
    VcalendarType ov = oldval.getVcalendar().get(0);

    CompWrapper ncw = new CompWrapper(of, getMatcher(),
                                      CompWrapper.compNames.get(nv.getClass()),
                                      nv);
    CompWrapper ocw = new CompWrapper(of, getMatcher(),
                                      CompWrapper.compNames.get(ov.getClass()),
                                      ov);

    return ncw.diff(ocw);
  }

  private Logger getLogger() {
    if (log == null) {
      log = Logger.getLogger(this.getClass());
    }

    return log;
  }

  @SuppressWarnings("unused")
  private void trace(final String msg) {
    getLogger().debug(msg);
  }
}

@@ -1592,53 +1592,8 @@
   *%0A
-   * @param of - so we can get soap elements%0A
    *
@@ -1603,24 +1603,24 @@
 aram newval%0A
+
    * @param 
@@ -1745,69 +1745,8 @@
 nal 
-ObjectFactory of,%0A                                     final 
 Ical
@@ -1883,16 +1883,16 @@
 get(0);%0A
-
     Vcal
@@ -1933,24 +1933,69 @@
 ().get(0);%0A%0A
+    ObjectFactory of = new ObjectFactory();%0A%0A
     CompWrap

Create object factory ourselves.