Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ public static EjbJarVersion getEjbJarVersion(String version) {
result = EJBJAR_3_2_6;
} else if(EJBJAR_4_0.toString().equals(version)) {
result = EJBJAR_4_0;
} else if(EJBJAR_4_0_1.toString().equals(version)) {
result = EJBJAR_4_0_1;
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ private ServletVersion(String version, int nv, String specVersion, int nsv) {
* than the version passed in as an argument.
* @throws ClassCastException if obj is not a ServletVersion object.
*/
@Override
public int compareTo(Object obj) {
ServletVersion target = (ServletVersion) obj;
return numericCompare(target);
Expand All @@ -126,6 +127,8 @@ public static ServletVersion getServletVersion(String version) {
result = SERVLET_5_0;
} else if(SERVLET_6_0.toString().equals(version)) {
result = SERVLET_6_0;
} else if(SERVLET_6_1.toString().equals(version)) {
result = SERVLET_6_1;
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<file name="application-client-8.xml" url="application-client-8.xml"/>
<file name="application-client-9.xml" url="application-client-9.xml"/>
<file name="application-client-10.xml" url="application-client-10.xml"/>
<file name="application-client-11.xml" url="application-client-11.xml"/>
<file name="MANIFEST.MF" url="MANIFEST.MF"/>
</folder>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@ public static J2eeProjectCapabilities forProject(@NonNull Project project) {
if (provider == null) {
return null;
}
J2eeModule.Type type = provider.getJ2eeModule().getType();
Profile ejbJarProfile = null;
Profile webProfile = null;
Profile carProfile = null;
if (provider.getJ2eeModule().getType() == J2eeModule.Type.EJB ||
provider.getJ2eeModule().getType() == J2eeModule.Type.WAR) {
if (type == J2eeModule.Type.EJB || type == J2eeModule.Type.WAR) {
EjbJar[] ejbJars = EjbJar.getEjbJars(project);
if (ejbJars.length > 0) {
// just use first one to test profile:
ejbJarProfile = ejbJars[0].getJ2eeProfile();
}
if (provider.getJ2eeModule().getType() == J2eeModule.Type.WAR) {
if (type == J2eeModule.Type.WAR) {
WebModule module = WebModule.getWebModule(project.getProjectDirectory());
if (module != null) {
webProfile = module.getJ2eeProfile();
}
}
}
if (provider.getJ2eeModule().getType() == J2eeModule.Type.CAR) {
if (type == J2eeModule.Type.CAR) {
Car car = Car.getCar(project.getProjectDirectory());
if (car != null) {
carProfile = car.getJ2eeProfile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,15 @@ public class ClientParseUtils {

/** Parsing just for detecting the version SAX parser used
*/
public static String getVersion(java.io.InputStream is) throws java.io.IOException, SAXException {
public static String getVersion(InputStream is) throws IOException, SAXException {
return ParseUtils.getVersion(is, new VersionHandler(), DDResolver.getInstance());
}

/** Parsing just for detecting the version SAX parser used
*/
public static String getVersion(FileObject fo) throws java.io.IOException, SAXException {
InputStream inputStream = fo.getInputStream();
try {
public static String getVersion(FileObject fo) throws IOException, SAXException {
try (InputStream inputStream = fo.getInputStream()) {
return ParseUtils.getVersion(inputStream, new VersionHandler(), DDResolver.getInstance());
} finally {
inputStream.close();
}
}

Expand Down Expand Up @@ -97,6 +94,7 @@ static synchronized DDResolver getInstance() {
}
return resolver;
}
@Override
public InputSource resolveEntity(String publicId, String systemId) {
if ("-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN".equals(publicId)) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_1_3.dtd"); //NOI18N
Expand All @@ -106,6 +104,16 @@ public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_5.xsd"); //NOI18N
} else if ("http://java.sun.com/xml/ns/javaee/application-client_6.xsd".equals(systemId)) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_6.xsd"); //NOI18N
} else if ("http://xmlns.jcp.org/xml/ns/javaee/application-client_7.xsd".equals(systemId)) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_7.xsd"); //NOI18N
} else if ("http://xmlns.jcp.org/xml/ns/javaee/application-client_8.xsd".equals(systemId)) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_8.xsd"); //NOI18N
} else if ("https://jakarta.ee/xml/ns/jakartaee/application-client_9.xsd".equals(systemId)) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_9.xsd"); //NOI18N
} else if ("https://jakarta.ee/xml/ns/jakartaee/application-client_10.xsd".equals(systemId)) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_10.xsd"); //NOI18N
} else if ("https://jakarta.ee/xml/ns/jakartaee/application-client_11.xsd".equals(systemId)) {
return new InputSource("nbres:/org/netbeans/modules/j2ee/dd/impl/resources/application-client_11.xsd"); //NOI18N
} else {
// use the default behaviour
return null;
Expand All @@ -115,17 +123,14 @@ public InputSource resolveEntity(String publicId, String systemId) {


public static SAXParseException parse(FileObject fo)
throws org.xml.sax.SAXException, java.io.IOException {
InputStream inputStream = fo.getInputStream();
try {
throws SAXException, IOException {
try (InputStream inputStream = fo.getInputStream()) {
return parse(new InputSource(inputStream));
} finally {
inputStream.close();
}
}

public static SAXParseException parse (InputSource is)
throws org.xml.sax.SAXException, java.io.IOException {
throws SAXException, IOException {
return ParseUtils.parseDD(is, DDResolver.getInstance());
}

Expand All @@ -137,7 +142,7 @@ public static SAXParseException parse (InputSource is)
* no exception.
*/
public static SAXParseException parse(InputSource inputSource, EntityResolver resolver)
throws org.xml.sax.SAXException, java.io.IOException {
throws SAXException, IOException {
return ParseUtils.parseDD(inputSource, resolver);
}
}
2 changes: 1 addition & 1 deletion enterprise/maven.j2ee/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
is.eager=true
javac.compilerargs=-Xlint -Xlint:-serial -Xlint -Xlint:-serial

javac.source=1.8
javac.release=17
test.config.stableBTD.includes=**/*Test.class
10 changes: 10 additions & 0 deletions enterprise/maven.j2ee/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@
<specification-version>2.16</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.api.java</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.95</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.api.java.classpath</code-name-base>
<build-prerequisite/>
Expand Down Expand Up @@ -531,6 +540,7 @@
</test-type>
</test-dependencies>
<friend-packages>
<friend>org.netbeans.modules.maven.jaxws</friend>
<friend>org.netbeans.modules.payara.micro</friend>
<friend>org.netbeans.modules.jakarta.transformer</friend>
<package>org.netbeans.modules.maven.j2ee</package>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.prefs.Preferences;
import org.netbeans.api.j2ee.core.Profile;
import org.netbeans.api.project.Project;
import org.netbeans.modules.j2ee.api.ejbjar.Car;
import org.netbeans.modules.j2ee.api.ejbjar.Ear;
import org.netbeans.modules.j2ee.api.ejbjar.EjbJar;
import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
Expand Down Expand Up @@ -133,7 +134,9 @@ public void preferenceChange(PreferenceChangeEvent evt) {
RP.post(new Runnable() {
@Override
public void run() {
LoggingUtils.logUsage(ExecutionChecker.class, "USG_PROJECT_OPEN_MAVEN_EE", new Object[] { getServerName(), getEEversion(), getProjectType() }, "maven"); //NOI18N
LoggingUtils.logUsage(ExecutionChecker.class, "USG_PROJECT_OPEN_MAVEN_EE", new Object[] { //NOI18N
getServerName(), getEEversion(), getProjectType()
}, "maven"); //NOI18N
}
});
}
Expand Down Expand Up @@ -192,24 +195,30 @@ private String getEEversion() {
String projectType = getProjectType();
if (projectType != null) {
switch (projectType) {
case "ear": //NOI18N
case "ear" -> { //NOI18N
Ear earProj = Ear.getEar(project.getProjectDirectory());
if (earProj != null) {
profile = earProj.getJ2eeProfile();
}
break;
case "war": //NOI18N
}
case "war" -> { //NOI18N
WebModule webM = WebModule.getWebModule(project.getProjectDirectory());
if (webM != null) {
profile = webM.getJ2eeProfile();
}
break;
case "ejb": //NOI18N
}
case "ejb" -> { //NOI18N
EjbJar ejbProj = EjbJar.getEjbJar(project.getProjectDirectory());
if (ejbProj != null) {
profile = ejbProj.getJ2eeProfile();
}
break;
}
case "app-client" -> { //NOI18N
Car carM = Car.getCar(project.getProjectDirectory());
if (carM != null) {
profile = carM.getJ2eeProfile();
}
}
}
}
if (profile != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
import org.netbeans.modules.j2ee.dd.spi.client.AppClientMetadataModelFactory;
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
import org.netbeans.modules.j2ee.metadata.model.api.MetadataModel;
import org.netbeans.modules.j2ee.spi.ejbjar.CarImplementation2;
import org.netbeans.modules.javaee.project.api.JavaEEProjectSettings;
import org.netbeans.modules.maven.api.classpath.ProjectSourcesClassPathProvider;
import org.netbeans.modules.maven.j2ee.BaseEEModuleImpl;
import org.netbeans.modules.maven.j2ee.utils.MavenProjectSupport;
import org.openide.ErrorManager;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
Expand All @@ -44,15 +46,14 @@
*
* @author Martin Janicek
*/
public class AppClientImpl extends BaseEEModuleImpl {
public class AppClientImpl extends BaseEEModuleImpl implements CarImplementation2 {

private MetadataModel<AppClientMetadata> appClientMetadataModel;


AppClientImpl(Project project, AppClientModuleProviderImpl provider) {
super(project, provider, "application-client.xml", J2eeModule.CLIENT_XML); // NOI18N
}


@Override
public J2eeModule.Type getModuleType() {
Expand All @@ -64,12 +65,17 @@ public FileObject getArchive() throws IOException {
return getArchive(Constants.GROUP_APACHE_PLUGINS, "maven-acr-plugin", "acr", "jar"); // NOI18N
}

@Override
public Profile getJ2eeProfile() {
Profile profile = JavaEEProjectSettings.getProfile(project);
if (profile != null) {
return profile;
}
return Profile.JAVA_EE_7_FULL;
Profile pomProfile = MavenProjectSupport.getProfileFromPOM(project);
if (pomProfile != null) {
return pomProfile;
}
return Profile.JAKARTA_EE_8_FULL;
}

@Override
Expand All @@ -85,8 +91,7 @@ public String getModuleVersion() {
ErrorManager.getDefault().notify(exc);
}
}

return AppClient.VERSION_6_0;
return AppClient.VERSION_8_0;
}

@Override
Expand Down
Loading
Loading