You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by th...@apache.org on 2008/06/06 14:22:11 UTC

svn commit: r663910 - in /labs/droids/trunk/src/core/java/org/apache/droids/helper: Loggable.java StAX.java Streams.java package-info.java

Author: thorsten
Date: Fri Jun  6 05:22:11 2008
New Revision: 663910

URL: http://svn.apache.org/viewvc?rev=663910&view=rev
Log:
Adding more java documentation and fixing code regarding the output from an Enerjy Code Analysis. Further adding missing license headers.

Added:
    labs/droids/trunk/src/core/java/org/apache/droids/helper/package-info.java   (with props)
Modified:
    labs/droids/trunk/src/core/java/org/apache/droids/helper/Loggable.java
    labs/droids/trunk/src/core/java/org/apache/droids/helper/StAX.java
    labs/droids/trunk/src/core/java/org/apache/droids/helper/Streams.java

Modified: labs/droids/trunk/src/core/java/org/apache/droids/helper/Loggable.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/helper/Loggable.java?rev=663910&r1=663909&r2=663910&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/helper/Loggable.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/helper/Loggable.java Fri Jun  6 05:22:11 2008
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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 org.apache.droids.helper;
 
 import org.apache.commons.logging.Log;
@@ -8,14 +24,13 @@
  * Simple wrapper class to easier debug/log.
  * 
  * @author thorsten
- *
+ * @version 1.0
  */
 public class Loggable {
 
   protected final Log log = LogFactory.getLog(this.getClass().getCanonicalName());
 
-  public Loggable() {
-    super();
+  protected Loggable() {
   }
 
 }
\ No newline at end of file

Modified: labs/droids/trunk/src/core/java/org/apache/droids/helper/StAX.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/helper/StAX.java?rev=663910&r1=663909&r2=663910&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/helper/StAX.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/helper/StAX.java Fri Jun  6 05:22:11 2008
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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 org.apache.droids.helper;
 
 import java.io.InputStream;
@@ -12,12 +28,18 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+/**
+ * Helper class that eases the usage of StAX in your plugins.
+ * @author thorsten
+ * @version 1.0
+ *
+ */
 public class StAX extends Loggable {
-  private XMLOutputFactory outputFactory;
+  private XMLOutputFactory outputFactory=null;
 
-  private XMLEventFactory eventFactory;
+  private XMLEventFactory eventFactory=null;
 
-  private XMLInputFactory inputFactory;
+  private XMLInputFactory inputFactory=null;
   /**
    * Easy helper to get StAX based parser and writer. 
    */
@@ -26,22 +48,50 @@
     outputFactory=XMLOutputFactory.newInstance();
     eventFactory = XMLEventFactory.newInstance();
   }
+  /**
+   * Get an event writer based on the incoming stream
+   * @param stream the stream we want to write to 
+   * @return ready to use event writer
+   * @throws XMLStreamException
+   */
   public XMLEventWriter getWriter(OutputStream stream) throws XMLStreamException{
     XMLEventWriter writer = outputFactory.createXMLEventWriter(stream);
     return writer;
   }
+  /**
+    * Get a stream writer based on the incoming stream
+   * @param stream the stream we want to write to 
+   * @return ready to use stream writer
+   * @throws XMLStreamException
+   */
   public XMLStreamWriter getStreamWriter(OutputStream stream) throws XMLStreamException{
     XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stream);
     return writer;
   }
+  /**
+   * Get an event Parser based on the incoming stream
+   * @param in the stream we want to read from 
+   * @return ready to use event parser
+   * @throws XMLStreamException
+   */
   public XMLEventReader getEventParser(InputStream in) throws XMLStreamException{
     XMLEventReader parser = inputFactory.createXMLEventReader(in);
     return parser;
   }
+  /**
+   * Get a stream Parser based on the incoming stream
+   * @param in the stream we want to read from 
+   * @return ready to use stream parser
+   * @throws XMLStreamException
+   */
   public XMLStreamReader getParser(InputStream in) throws XMLStreamException{
     XMLStreamReader parser = inputFactory.createXMLStreamReader(in);
     return parser;
   }
+  /**
+   * Get the ready to used EventFactory
+   * @return ready to used EventFactory
+   */
   public XMLEventFactory getEventFactory(){
     return eventFactory;
   }

Modified: labs/droids/trunk/src/core/java/org/apache/droids/helper/Streams.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/helper/Streams.java?rev=663910&r1=663909&r2=663910&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/helper/Streams.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/helper/Streams.java Fri Jun  6 05:22:11 2008
@@ -22,7 +22,19 @@
 import java.io.IOException;
 import java.io.InputStream;
 
+/**
+ * Helper class for the low level treatment of bytes and streams.
+ * Principal usage is to receive a copy of an input stream.
+ * @author thorsten
+ * @version 1.0
+ *
+ */
 public class Streams {
+  private Streams(){
+    
+  }
+  private static final int BUFFER_SIZE = 2048;
+
   /**
    * Reads all bytes from the given input stream and returns the result in an
    * array.
@@ -44,7 +56,7 @@
 
     // copy buffer
     int size = in.available();
-    byte[] buffer = new byte[size == 0 ? 2048 : size];
+    byte[] buffer = new byte[size == 0 ? BUFFER_SIZE : size];
     // output buffer
     ByteArrayOutputStream out = new ByteArrayOutputStream(buffer.length);
 

Added: labs/droids/trunk/src/core/java/org/apache/droids/helper/package-info.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/helper/package-info.java?rev=663910&view=auto
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/helper/package-info.java (added)
+++ labs/droids/trunk/src/core/java/org/apache/droids/helper/package-info.java Fri Jun  6 05:22:11 2008
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.
+ */
+/**
+ * This package contains various helper.
+ */
+package org.apache.droids.helper;
+

Propchange: labs/droids/trunk/src/core/java/org/apache/droids/helper/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org