jollyday icon indicating copy to clipboard operation
jollyday copied to clipboard

Remove usage of jollyday.properties file

Open svendiedrichsen opened this issue 6 years ago • 6 comments

Replace the usage and loading of implementation classes from properties file with default impl instantiation from code.

svendiedrichsen avatar Aug 29 '17 22:08 svendiedrichsen

Maybe I take this one, one idea would be to have a factory method on the Enum so that each HolidayParameter is instantiated using the such factory method.

WDYT?

guidomedina avatar Apr 04 '18 08:04 guidomedina

I thought of getting rid of the instantiation by reading the class names from the properties file and having the Parameter class contain instances of the default impl classes. They may be overriden by using setters passing in new implementations. Where and when to create the default impl instances I haven't thought of yet but they should be returned from the HolidayParameter instance.

svendiedrichsen avatar Apr 04 '18 21:04 svendiedrichsen

I'll take a look sometime around the weekend, my idea is to completely avoid reflection and just use some factory function, I'm thinking to add such factory function to HolidayCalendar Enum, so each Enum will require a factory function from which it will create everything it needs without needing reflection.

guidomedina avatar Apr 04 '18 21:04 guidomedina

Sounds interesting. Looking forward to it.

svendiedrichsen avatar Apr 04 '18 23:04 svendiedrichsen

I'm trying to make the code compile on IntelliJ and outside using Maven directly but I'm getting the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc (generate) on project jollyday: Execution generate of goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc failed: A required class was missing while executing org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc: com/sun/codemodel/CodeWriter
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:jaxb2-maven-plugin:2.3.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/gmedina/.m2/repository/org/codehaus/mojo/jaxb2-maven-plugin/2.3.1/jaxb2-maven-plugin-2.3.1.jar
[ERROR] urls[1] = file:/home/gmedina/.m2/repository/javax/xml/bind/jaxb-api/2.2.11/jaxb-api-2.2.11.jar
[ERROR] urls[2] = file:/home/gmedina/.m2/repository/org/glassfish/jaxb/jaxb-core/2.2.11/jaxb-core-2.2.11.jar
[ERROR] urls[3] = file:/home/gmedina/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
[ERROR] urls[4] = file:/home/gmedina/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
[ERROR] urls[5] = file:/home/gmedina/.m2/repository/org/glassfish/jaxb/jaxb-jxc/2.2.11/jaxb-jxc-2.2.11.jar
[ERROR] urls[6] = file:/home/gmedina/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M3/qdox-2.0-M3.jar
[ERROR] urls[7] = file:/home/gmedina/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
[ERROR] urls[8] = file:/home/gmedina/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[9] = file:/home/gmedina/.m2/repository/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar
[ERROR] urls[10] = file:/home/gmedina/.m2/repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar
[ERROR] urls[11] = file:/home/gmedina/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[12] = file:/home/gmedina/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[13] = file:/home/gmedina/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[14] = file:/home/gmedina/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[15] = file:/home/gmedina/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar
[ERROR] urls[16] = file:/home/gmedina/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[17] = file:/home/gmedina/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] : com.sun.codemodel.CodeWriter
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

guidomedina avatar Apr 07 '18 10:04 guidomedina

Ignore the previous comment, the issue was related to Java 9, as soon as I pointed the project to Java 8 everything worked.

guidomedina avatar Apr 08 '18 09:04 guidomedina