You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by rd...@apache.org on 2012/10/28 19:31:09 UTC
svn commit: r1403064 - in
/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model:
ByOrganisation.java ContentElement.java Descriptor.java Resource.java
WithLicense.java WithinDirectory.java
Author: rdonkin
Date: Sun Oct 28 18:31:07 2012
New Revision: 1403064
URL: http://svn.apache.org/viewvc?rev=1403064&view=rev
Log:
WHISKER-6 extract interface, working towards DRYing up isPrimaryOnly
Added:
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ContentElement.java (with props)
Modified:
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ByOrganisation.java
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Resource.java
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java
creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithinDirectory.java
Modified: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ByOrganisation.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ByOrganisation.java?rev=1403064&r1=1403063&r2=1403064&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ByOrganisation.java (original)
+++ creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ByOrganisation.java Sun Oct 28 18:31:07 2012
@@ -14,7 +14,7 @@
* "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.
+ * under the License.
*/
package org.apache.creadur.whisker.model;
@@ -24,7 +24,7 @@ import java.util.Collection;
* Relates the responsible group or individual to one
* or more resources.
*/
-public class ByOrganisation implements Comparable<ByOrganisation> {
+public class ByOrganisation implements Comparable<ByOrganisation>, ContentElement {
/** The responsible group or individual. */
private final Organisation organisation;
@@ -154,7 +154,7 @@ public class ByOrganisation implements C
}
}
}
-
+
/**
* Describes object suitably for logging.
* @return something suitable for logging
Added: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ContentElement.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ContentElement.java?rev=1403064&view=auto
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ContentElement.java (added)
+++ creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ContentElement.java Sun Oct 28 18:31:07 2012
@@ -0,0 +1,32 @@
+/**
+ * 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.creadur.whisker.model;
+
+/**
+ * Describes some of the contents of a software distribution.
+ */
+public interface ContentElement {
+
+ /**
+ * Accepts a visit.
+ * @param visitor possibly null
+ */
+ public void accept(Visitor visitor);
+
+}
\ No newline at end of file
Propchange: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/ContentElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java?rev=1403064&r1=1403063&r2=1403064&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java (original)
+++ creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Descriptor.java Sun Oct 28 18:31:07 2012
@@ -257,7 +257,7 @@ public class Descriptor {
* @return true when the contents are all licensed under the primary license
* by the primary organisation
*/
- public boolean isOnlyPrimary(final WithLicense license) {
+ public boolean isOnlyPrimary(final ContentElement license) {
final LicenseAndOrganisationCollator collator = new LicenseAndOrganisationCollator();
license.accept(collator);
return collator.isOnlyLicense(getPrimaryLicense())
Modified: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Resource.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Resource.java?rev=1403064&r1=1403063&r2=1403064&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Resource.java (original)
+++ creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/Resource.java Sun Oct 28 18:31:07 2012
@@ -21,14 +21,14 @@ package org.apache.creadur.whisker.model
/**
* A resource expected in a software distribution.
*/
-public class Resource implements Comparable<Resource> {
+public class Resource implements Comparable<Resource>, ContentElement {
/** Names this resource. */
private final String name;
/** Optional link to a notice for this resource. */
private final String noticeId;
- /**
- * Optional describes how source may be obtained
+ /**
+ * Optional describes how source may be obtained
* for this resource.
*/
private final String source;
Modified: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java?rev=1403064&r1=1403063&r2=1403064&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java (original)
+++ creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithLicense.java Sun Oct 28 18:31:07 2012
@@ -25,7 +25,7 @@ import java.util.Map;
/**
* Groups resources sharing a license and claimed copyright.
*/
-public class WithLicense implements Comparable<WithLicense> {
+public class WithLicense implements Comparable<WithLicense>, ContentElement {
/** License shared by contained resources, not null. */
private final License license;
Modified: creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithinDirectory.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithinDirectory.java?rev=1403064&r1=1403063&r2=1403064&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithinDirectory.java (original)
+++ creadur/whisker/trunk/apache-whisker-model/src/main/java/org/apache/creadur/whisker/model/WithinDirectory.java Sun Oct 28 18:31:07 2012
@@ -14,7 +14,7 @@
* "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.
+ * under the License.
*/
package org.apache.creadur.whisker.model;
@@ -24,7 +24,7 @@ import java.util.Collection;
* Links resources expected within a directory in the distribution
* to licensing meta-data.
*/
-public class WithinDirectory implements Comparable<WithinDirectory> {
+public class WithinDirectory implements Comparable<WithinDirectory>, ContentElement {
/** Resources grouped by license applicable. */
private final Collection<WithLicense> licenses;
@@ -36,7 +36,7 @@ public class WithinDirectory implements
/**
* Constructs a description of a directory
* @param name directory name, not null
- * @param licenses resources contained,
+ * @param licenses resources contained,
* grouped by license applicable, not null
* @param publicDomain resources in the public domain,
* grouped by responsible organisation
@@ -140,7 +140,7 @@ public class WithinDirectory implements
}
}
- for (final WithLicense license : getLicenses()) {
+ for (final ContentElement license : getLicenses()) {
license.accept(visitor);
}
}