RE: EXTERNAL-Re: Maven builds and fetchSpecs
RE: EXTERNAL-Re: Maven builds and fetchSpecs
- Subject: RE: EXTERNAL-Re: Maven builds and fetchSpecs
- From: "Kantala, Dmytro R." <email@hidden>
- Date: Tue, 21 May 2019 14:49:16 +0000
- Thread-topic: EXTERNAL-Re: Maven builds and fetchSpecs
I finally found the issue. Seems like you will only have this issue if you are
running a Maven build (ie, model in jar file) on windows.
I tracked the problem to this method in NSPathUtilities: public static String
stringByAppendingPathComponent(String path, String component)
The method was not recognizing the end path character as a file separator when
the file path is a jar path. Therefor it appended the windows file separator
creating a path such as this:
jar:file:////C:/temp/WebObjects_Testing/MRQuartz-1.0.0.woa/Contents/Resources/Java/com/motleyrice/QuartzBusinessLogic/1.0.0/QuartzBusinessLogic-1.0.0.jar!/Resources/Quartz.eomodeld/\MRJobDetail
Notice the "/\" after the .eomodeld where it concatenated the path and
component.
Here is the modified code that now resolves a proper jar file path on windows.
For the pathEndsWithFileSeparator variable, it double checks if this a jar path
and looks for the jar file separator. Does the same type check when performing
the concatenate.
public static String stringByAppendingPathComponent(String path, String
component) {
if (path == null)
return component == null ? "" : component;
if (component == null) {
return path;
}
int pathLength = path.length();
int componentLength = component.length();
if (pathLength == 0)
return component;
if (componentLength == 0) {
return path;
}
boolean pathEndsWithFileSeparator =
path.endsWith(File.separator) || (path.startsWith("jar:") &&
path.endsWith("/"));
boolean componentStartsWithFileSeparator =
component.startsWith(File.separator);
if ((pathEndsWithFileSeparator) &&
(componentStartsWithFileSeparator)) {
StringBuffer buffer = new
StringBuffer(pathLength + componentLength - 1);
buffer.append(path.substring(0, pathLength -
1));
buffer.append(component);
return new String(buffer);
}
if ((pathEndsWithFileSeparator) ||
(componentStartsWithFileSeparator)) {
StringBuffer buffer = new
StringBuffer(pathLength + componentLength);
buffer.append(path);
buffer.append(component);
return new String(buffer);
}
StringBuffer buffer = new StringBuffer(pathLength +
componentLength + 1);
buffer.append(path);
buffer.append(path.startsWith("jar:") ? "/" : File.separator);
buffer.append(component);
return new String(buffer);
}
Thanks,
Dmytro
From: Kantala, Dmytro R.
Sent: Thursday, May 2, 2019 9:40 AM
To: email@hidden
Subject: RE: EXTERNAL-Re: Maven builds and fetchSpecs
I am getting a null. Below is the code I used to see what specs are even
found. It’s coming up with nothing found.
EOEntity eoEntity =
eoModelCMP.entityNamed(_AbEntry.ENTITY_NAME);
if(null == eoEntity) {
log.info("Entity NOT found:
"+_AbEntry.ENTITY_NAME);
} else {
log.info("Entity found:
"+_AbEntry.ENTITY_NAME);
NSArray<String> fsNames =
eoEntity.fetchSpecificationNames();
if((null == fsNames) || fsNames.isEmpty()) {
log.info("fsNames NOT found, count:
0");
} else {
log.info("fsNames found, count:
"+fsNames.count());
for(String name : fsNames) {
log.info("Name found: " + name);
}
}
}
Here is an excerpt from my parent pom to say version of the wolifecycle plugin
I am using.
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.objectstyle.woproject.maven2</groupId>
<artifactId>maven-wolifecycle-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.objectstyle.woproject.maven2</groupId>
<artifactId>maven-wolifecycle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<skipAppleProvidedFrameworks>false</skipAppleProvidedFrameworks>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Thanks,
Dmytro
From: Hugi Thordarson <email@hidden<mailto:email@hidden>>
Sent: Thursday, May 2, 2019 6:41 AM
To: Kantala, Dmytro R. <email@hidden<mailto:email@hidden>>
Cc: email@hidden<mailto:email@hidden>
Subject: EXTERNAL-Re: Maven builds and fetchSpecs
Hi Dmytro,
someone who uses EOF might probably be better able to help you. But just for
testing I tried this out: Opened an old project that uses EOF, created a
FetchSpec in a model in a framework it referenced and was successfully able to
get to it using EOFetchSpecification.fetchSpecificationNamed( "FetchSpecName",
"EntityName" ).
So not much help here—I just wanted to confirm that it *should* work. Does the
framework throw a stack trace at you or do you just get null when attempting to
resolve the fetchSpec?
Cheers,
- hugi
On 29 Apr 2019, at 17:38, Kantala, Dmytro R.
<email@hidden<mailto:email@hidden>> wrote:
I finally gotten around to make the switch from Ant to Maven, really had to. I
am able to successfully build the project, so far everything runs in eclipse,
and attempting to run from command line.
The first thing this app does is use a fetch spec to pull in some entities.
This is failing because it can’t find the fetch spec by name. I then wrote
some code that looked over the entities to see if any fetch specs were loaded
and none were.
It appears to find the plist from the jar, just not the fetch specs.
How did everyone get around this issue?
Environment:
- Wonder 7.1-SNAPSHOT
- WebObjects 5.4.3
- The model is in a framework used by the application.
- I can open the Maven packaged framework jar and see the .fspec files.
- Windows 10
- JDK 1.12 (had same issue with 1.9)
Thanks,
Dmytro
Confidential & Privileged
Unless otherwise indicated or obvious from its nature, the information
contained in this communication is attorney-client privileged and confidential
information/work product. This communication is intended for the use of the
individual or entity named above. If the reader of this communication is not
the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error or are not sure whether it is
privileged, please immediately notify us by return e-mail and destroy any
copies--electronic, paper or otherwise--which you may have of this
communication.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list
(email@hidden<mailto:email@hidden>)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden<mailto:email@hidden>
Confidential & Privileged
Unless otherwise indicated or obvious from its nature, the information
contained in this communication is attorney-client privileged and confidential
information/work product. This communication is intended for the use of the
individual or entity named above. If the reader of this communication is not
the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error or are not sure whether it is
privileged, please immediately notify us by return e-mail and destroy any
copies--electronic, paper or otherwise--which you may have of this communication
Attachment:
NSPathUtilities.java
Description: NSPathUtilities.java
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden