You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directmemory.apache.org by ol...@apache.org on 2012/08/08 23:19:41 UTC

svn commit: r1370975 - in /incubator/directmemory/trunk/directmemory-common: ./ src/main/java/org/apache/directmemory/conf/ src/test/java/org/apache/directmemory/conf/ src/test/resources/

Author: olamy
Date: Wed Aug  8 21:19:40 2012
New Revision: 1370975

URL: http://svn.apache.org/viewvc?rev=1370975&view=rev
Log:
add missing license headers

Modified:
    incubator/directmemory/trunk/directmemory-common/pom.xml
    incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/Configuration.java
    incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/ConfigurationService.java
    incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/DefaultConfiguration.java
    incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/SimplePropertiesConfiguration.java
    incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/YamlConfiguration.java
    incubator/directmemory/trunk/directmemory-common/src/test/java/org/apache/directmemory/conf/ConfigurationTest.java
    incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.properties
    incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.yaml

Modified: incubator/directmemory/trunk/directmemory-common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/pom.xml?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/pom.xml (original)
+++ incubator/directmemory/trunk/directmemory-common/pom.xml Wed Aug  8 21:19:40 2012
@@ -75,13 +75,18 @@ under the License.
       <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.yaml</groupId>
+      <artifactId>snakeyaml</artifactId>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.yaml</groupId>
-      <artifactId>snakeyaml</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
     </dependency>
   </dependencies>
 

Modified: incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/Configuration.java?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/Configuration.java (original)
+++ incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/Configuration.java Wed Aug  8 21:19:40 2012
@@ -1,10 +1,5 @@
 package org.apache.directmemory.conf;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -24,6 +19,10 @@ import org.yaml.snakeyaml.constructor.Co
  * under the License.
  */
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
 /**
  * Provides a global single point of access to all singleton properties comprehensible to DirectMemory.
  */
@@ -55,12 +54,13 @@ public final class Configuration
     {
         return configurationService.getConcurrencyLevel();
     }
-    
+
     private static ConfigurationService configurationService;
-    
+
     static
     {
-        if (configurationService == null) {
+        if ( configurationService == null )
+        {
             // if not otherwise specified with another mechanism it uses the default implementation
             logger.info( "using default configuration implementation" );
             configurationService = new SimplePropertiesConfiguration();

Modified: incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/ConfigurationService.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/ConfigurationService.java?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/ConfigurationService.java (original)
+++ incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/ConfigurationService.java Wed Aug  8 21:19:40 2012
@@ -1,25 +1,44 @@
 package org.apache.directmemory.conf;
 
+/*
+ * 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.
+ */
+
 public interface ConfigurationService
 {
-    public int getNumberOfBuffers();
+    int getNumberOfBuffers();
 
-    public int getInitialCapacity();
+    int getInitialCapacity();
 
-    public int getRamMegaBytes();
+    int getRamMegaBytes();
 
-    public int getConcurrencyLevel();
+    int getConcurrencyLevel();
 
-    public long getDisposalTime();
+    long getDisposalTime();
 
-    public void setNumberOfBuffers(int numberOfBuffers);
+    void setNumberOfBuffers( int numberOfBuffers );
 
-    public void setInitialCapacity(int initialCapacity);
+    void setInitialCapacity( int initialCapacity );
 
-    public void setRamMegaBytes(int ramMegaBytes);
+    void setRamMegaBytes( int ramMegaBytes );
 
-    public void setConcurrencyLevel(int concurrencyLevel);
+    void setConcurrencyLevel( int concurrencyLevel );
 
-    public void setDisposalTime(long disposalTime);
+    void setDisposalTime( long disposalTime );
 
 }
\ No newline at end of file

Modified: incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/DefaultConfiguration.java?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/DefaultConfiguration.java (original)
+++ incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/DefaultConfiguration.java Wed Aug  8 21:19:40 2012
@@ -1,6 +1,26 @@
 package org.apache.directmemory.conf;
 
-public abstract class DefaultConfiguration implements ConfigurationService
+/*
+ * 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.
+ */
+
+public abstract class DefaultConfiguration
+    implements ConfigurationService
 {
     private int numberOfBuffers = 1;
 
@@ -41,7 +61,7 @@ public abstract class DefaultConfigurati
     {
         return disposalTime;
     }
-    
+
     @Override
     public void setNumberOfBuffers( int numberOfBuffers )
     {

Modified: incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/SimplePropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/SimplePropertiesConfiguration.java?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/SimplePropertiesConfiguration.java (original)
+++ incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/SimplePropertiesConfiguration.java Wed Aug  8 21:19:40 2012
@@ -1,11 +1,32 @@
 package org.apache.directmemory.conf;
 
-import java.util.Properties;
+/*
+ * 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.
+ */
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SimplePropertiesConfiguration extends DefaultConfiguration implements ConfigurationService
+import java.util.Properties;
+
+public class SimplePropertiesConfiguration
+    extends DefaultConfiguration
+    implements ConfigurationService
 {
     private static final Logger logger = LoggerFactory.getLogger( SimplePropertiesConfiguration.class );
 
@@ -15,11 +36,11 @@ public class SimplePropertiesConfigurati
         try
         {
             properties.load( this.getClass().getClassLoader().getResourceAsStream( "directmemory.properties" ) );
-            this.setNumberOfBuffers(new Integer(properties.getProperty( "numberOfBuffers" )));
-            this.setInitialCapacity(new Integer(properties.getProperty( "initialCapacity" )));
-            this.setRamMegaBytes(new Integer(properties.getProperty( "ramMegaBytes" )));
-            this.setConcurrencyLevel(new Integer(properties.getProperty( "concurrencyLevel" )));
-            this.setDisposalTime(new Long(properties.getProperty( "disposalTime" )));
+            this.setNumberOfBuffers( new Integer( properties.getProperty( "numberOfBuffers" ) ) );
+            this.setInitialCapacity( new Integer( properties.getProperty( "initialCapacity" ) ) );
+            this.setRamMegaBytes( new Integer( properties.getProperty( "ramMegaBytes" ) ) );
+            this.setConcurrencyLevel( new Integer( properties.getProperty( "concurrencyLevel" ) ) );
+            this.setDisposalTime( new Long( properties.getProperty( "disposalTime" ) ) );
         }
         catch ( Exception e )
         {
@@ -27,5 +48,5 @@ public class SimplePropertiesConfigurati
             logger.warn( "no properties file found or invalid file - using defaults" );
         }
     }
- 
+
 }

Modified: incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/YamlConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/YamlConfiguration.java?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/YamlConfiguration.java (original)
+++ incubator/directmemory/trunk/directmemory-common/src/main/java/org/apache/directmemory/conf/YamlConfiguration.java Wed Aug  8 21:19:40 2012
@@ -1,15 +1,36 @@
 package org.apache.directmemory.conf;
 
+/*
+ * 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.
+ */
+
 import org.yaml.snakeyaml.Yaml;
 import org.yaml.snakeyaml.constructor.Constructor;
 
-public class YamlConfiguration extends DefaultConfiguration
+public class YamlConfiguration
+    extends DefaultConfiguration
 {
 
     public static ConfigurationService load()
     {
         Yaml yaml = new Yaml( new Constructor( YamlConfiguration.class ) );
-        return (YamlConfiguration) yaml.load( Configuration.class.getClassLoader().getResourceAsStream( "directmemory.yaml" ) );
+        return (YamlConfiguration) yaml.load(
+            Configuration.class.getClassLoader().getResourceAsStream( "directmemory.yaml" ) );
     }
 
 }

Modified: incubator/directmemory/trunk/directmemory-common/src/test/java/org/apache/directmemory/conf/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/test/java/org/apache/directmemory/conf/ConfigurationTest.java?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/test/java/org/apache/directmemory/conf/ConfigurationTest.java (original)
+++ incubator/directmemory/trunk/directmemory-common/src/test/java/org/apache/directmemory/conf/ConfigurationTest.java Wed Aug  8 21:19:40 2012
@@ -1,9 +1,28 @@
 package org.apache.directmemory.conf;
 
-import static org.junit.Assert.*;
+/*
+ * 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.
+ */
 
 import org.junit.Test;
 
+import static org.junit.Assert.assertTrue;
+
 public class ConfigurationTest
 {
     @Test
@@ -15,7 +34,7 @@ public class ConfigurationTest
         assertTrue( Configuration.getConcurrencyLevel() > 0 );
         assertTrue( Configuration.getDisposalTime() > 0L );
     }
-    
+
     @Test
     public void testYamlConfiguration()
     {

Modified: incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.properties
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.properties?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.properties (original)
+++ incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.properties Wed Aug  8 21:19:40 2012
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
 numberOfBuffers=1
 initialCapacity=100000
 ramMegaBytes=1

Modified: incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.yaml
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.yaml?rev=1370975&r1=1370974&r2=1370975&view=diff
==============================================================================
--- incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.yaml (original)
+++ incubator/directmemory/trunk/directmemory-common/src/test/resources/directmemory.yaml Wed Aug  8 21:19:40 2012
@@ -1,3 +1,22 @@
+#
+# 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.
+#
+
 # Number of buffers
 numberOfBuffers: 1