Lines 67-72
Link Here
|
67 |
import org.netbeans.api.project.Project; |
67 |
import org.netbeans.api.project.Project; |
68 |
import org.netbeans.api.project.ProjectUtils; |
68 |
import org.netbeans.api.project.ProjectUtils; |
69 |
import org.netbeans.api.project.SourceGroup; |
69 |
import org.netbeans.api.project.SourceGroup; |
|
|
70 |
import org.netbeans.api.project.libraries.Library; |
70 |
import org.netbeans.modules.glassfish.spi.GlassfishModule; |
71 |
import org.netbeans.modules.glassfish.spi.GlassfishModule; |
71 |
import org.netbeans.modules.glassfish.spi.ServerUtilities; |
72 |
import org.netbeans.modules.glassfish.spi.ServerUtilities; |
72 |
import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider; |
73 |
import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider; |
Lines 80-90
Link Here
|
80 |
import org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation; |
81 |
import org.netbeans.modules.javaee.specs.support.spi.JaxRsStackSupportImplementation; |
81 |
import org.netbeans.modules.websvc.wsstack.api.WSStack; |
82 |
import org.netbeans.modules.websvc.wsstack.api.WSStack; |
82 |
import org.netbeans.modules.websvc.wsstack.spi.WSStackFactory; |
83 |
import org.netbeans.modules.websvc.wsstack.spi.WSStackFactory; |
83 |
import org.netbeans.api.project.libraries.Library; |
|
|
84 |
import org.netbeans.spi.project.libraries.LibraryImplementation; |
84 |
import org.netbeans.spi.project.libraries.LibraryImplementation; |
|
|
85 |
import org.openide.DialogDisplayer; |
86 |
import org.openide.NotifyDescriptor; |
85 |
import org.openide.filesystems.*; |
87 |
import org.openide.filesystems.*; |
86 |
import org.openide.util.ImageUtilities; |
88 |
import org.openide.util.ImageUtilities; |
87 |
import org.openide.util.Lookup; |
89 |
import org.openide.util.Lookup; |
|
|
90 |
import org.openide.util.NbBundle; |
88 |
import org.openide.util.RequestProcessor; |
91 |
import org.openide.util.RequestProcessor; |
89 |
import org.openide.util.Utilities; |
92 |
import org.openide.util.Utilities; |
90 |
import org.openide.util.lookup.Lookups; |
93 |
import org.openide.util.lookup.Lookups; |
Lines 125-136
Link Here
|
125 |
/** Keep local Lookup instance to be returned by getLookup method. */ |
128 |
/** Keep local Lookup instance to be returned by getLookup method. */ |
126 |
private volatile Lookup lkp; |
129 |
private volatile Lookup lkp; |
127 |
|
130 |
|
128 |
/** Jersey Library support. */ |
|
|
129 |
private Hk2LibraryProvider libraryProvider; |
130 |
|
131 |
//////////////////////////////////////////////////////////////////////////// |
131 |
//////////////////////////////////////////////////////////////////////////// |
132 |
// Static methods // |
132 |
// Static methods // |
133 |
//////////////////////////////////////////////////////////////////////////// |
133 |
//////////////////////////////////////////////////////////////////////////// |
|
|
134 |
|
135 |
/** |
136 |
* Display missing Hk2LibraryProvider class warning. |
137 |
*/ |
138 |
private static void missingHk2LibraryProvider() { |
139 |
String message = NbBundle.getMessage(Hk2JavaEEPlatformImpl.class, |
140 |
"Hk2JavaEEPlatformImpl.missingHk2LibraryProvider"); |
141 |
NotifyDescriptor notifyDescriptor |
142 |
= new NotifyDescriptor.Message(message); |
143 |
DialogDisplayer.getDefault().notify(notifyDescriptor); |
144 |
} |
145 |
|
134 |
/** |
146 |
/** |
135 |
* Map GlassFish tooling SDK JavaSE platforms to NetBeans JavaSE platforms. |
147 |
* Map GlassFish tooling SDK JavaSE platforms to NetBeans JavaSE platforms. |
136 |
* <p/> |
148 |
* <p/> |
Lines 300-307
Link Here
|
300 |
this.displayName = displayName; |
312 |
this.displayName = displayName; |
301 |
this.libraryName = libraryName; |
313 |
this.libraryName = libraryName; |
302 |
this.lookupKey = lookupKey; |
314 |
this.lookupKey = lookupKey; |
303 |
this.libraryProvider = Hk2LibraryProvider.getProvider( |
|
|
304 |
dm.getCommonServerSupport().getInstance()); |
305 |
addFcl(); |
315 |
addFcl(); |
306 |
initLibraries(); |
316 |
initLibraries(); |
307 |
} |
317 |
} |
Lines 649-657
Link Here
|
649 |
|
659 |
|
650 |
@Override |
660 |
@Override |
651 |
public void run() { |
661 |
public void run() { |
652 |
libraryProvider.setJavaEELibraryImplementation( |
662 |
try { |
653 |
lib, libraryName); |
663 |
Hk2LibraryProvider libraryProvider |
654 |
firePropertyChange(PROP_LIBRARIES, null, libraries.clone()); |
664 |
= Hk2LibraryProvider.getProvider( |
|
|
665 |
dm.getCommonServerSupport().getInstance()); |
666 |
libraryProvider |
667 |
.setJavaEELibraryImplementation(lib, libraryName); |
668 |
firePropertyChange(PROP_LIBRARIES, null, libraries.clone()); |
669 |
} catch (NoClassDefFoundError ex) { |
670 |
missingHk2LibraryProvider(); |
671 |
} |
655 |
} |
672 |
} |
656 |
}); |
673 |
}); |
657 |
} |
674 |
} |
Lines 812-818
Link Here
|
812 |
* @return GlassFish bundled libraries provider. |
829 |
* @return GlassFish bundled libraries provider. |
813 |
*/ |
830 |
*/ |
814 |
public Hk2LibraryProvider getLibraryProvider() { |
831 |
public Hk2LibraryProvider getLibraryProvider() { |
815 |
return libraryProvider; |
832 |
try { |
|
|
833 |
Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider( |
834 |
dm.getCommonServerSupport().getInstance()); |
835 |
return libraryProvider; |
836 |
} catch (NoClassDefFoundError ex) { |
837 |
missingHk2LibraryProvider(); |
838 |
return null; |
839 |
} |
816 |
} |
840 |
} |
817 |
|
841 |
|
818 |
private class JaxRsStackSupportImpl implements JaxRsStackSupportImplementation { |
842 |
private class JaxRsStackSupportImpl implements JaxRsStackSupportImplementation { |
Lines 825-831
Link Here
|
825 |
*/ |
849 |
*/ |
826 |
@Override |
850 |
@Override |
827 |
public boolean addJsr311Api( Project project ) { |
851 |
public boolean addJsr311Api( Project project ) { |
828 |
Library library = libraryProvider.getJaxRsLibrary(); |
852 |
Library library; |
|
|
853 |
try { |
854 |
Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider( |
855 |
dm.getCommonServerSupport().getInstance()); |
856 |
library = libraryProvider.getJaxRsLibrary(); |
857 |
} catch (NoClassDefFoundError ex) { |
858 |
missingHk2LibraryProvider(); |
859 |
library = null; |
860 |
} |
829 |
if ( library!= null ){ |
861 |
if ( library!= null ){ |
830 |
try { |
862 |
try { |
831 |
return ProjectClassPathModifier.addLibraries( |
863 |
return ProjectClassPathModifier.addLibraries( |
Lines 873-879
Link Here
|
873 |
*/ |
905 |
*/ |
874 |
@Override |
906 |
@Override |
875 |
public boolean extendsJerseyProjectClasspath( Project project ) { |
907 |
public boolean extendsJerseyProjectClasspath( Project project ) { |
876 |
Library library = libraryProvider.getJerseyLibrary(); |
908 |
Library library; |
|
|
909 |
try { |
910 |
Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider( |
911 |
dm.getCommonServerSupport().getInstance()); |
912 |
library = libraryProvider.getJerseyLibrary(); |
913 |
} catch (NoClassDefFoundError ex) { |
914 |
missingHk2LibraryProvider(); |
915 |
library = null; |
916 |
} |
877 |
FileObject sourceRoot = getSourceRoot(project); |
917 |
FileObject sourceRoot = getSourceRoot(project); |
878 |
if (sourceRoot == null) { |
918 |
if (sourceRoot == null) { |
879 |
return false; |
919 |
return false; |
Lines 903-909
Link Here
|
903 |
|
943 |
|
904 |
@Override |
944 |
@Override |
905 |
public void removeJaxRsLibraries(Project project) { |
945 |
public void removeJaxRsLibraries(Project project) { |
906 |
Library library = libraryProvider.getJerseyLibrary(); |
946 |
Library library; |
|
|
947 |
try { |
948 |
Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider( |
949 |
dm.getCommonServerSupport().getInstance()); |
950 |
library = libraryProvider.getJerseyLibrary(); |
951 |
} catch (NoClassDefFoundError ex) { |
952 |
missingHk2LibraryProvider(); |
953 |
library = null; |
954 |
} |
907 |
FileObject sourceRoot = getSourceRoot(project); |
955 |
FileObject sourceRoot = getSourceRoot(project); |
908 |
if ( sourceRoot != null){ |
956 |
if ( sourceRoot != null){ |
909 |
String[] classPathTypes = new String[]{ ClassPath.COMPILE , |
957 |
String[] classPathTypes = new String[]{ ClassPath.COMPILE , |
Lines 958-964
Link Here
|
958 |
*/ |
1006 |
*/ |
959 |
@Override |
1007 |
@Override |
960 |
public boolean isBundled( String classFqn ) { |
1008 |
public boolean isBundled( String classFqn ) { |
961 |
List<URL> urls = libraryProvider.getJerseyClassPathURLs(); |
1009 |
List<URL> urls; |
|
|
1010 |
try { |
1011 |
Hk2LibraryProvider libraryProvider = Hk2LibraryProvider.getProvider( |
1012 |
dm.getCommonServerSupport().getInstance()); |
1013 |
urls = libraryProvider.getJerseyClassPathURLs(); |
1014 |
} catch (NoClassDefFoundError ex) { |
1015 |
missingHk2LibraryProvider(); |
1016 |
urls = Collections.emptyList(); |
1017 |
} |
962 |
for( URL url : urls ){ |
1018 |
for( URL url : urls ){ |
963 |
FileObject root = URLMapper.findFileObject(url); |
1019 |
FileObject root = URLMapper.findFileObject(url); |
964 |
if ( FileUtil.isArchiveFile(root)){ |
1020 |
if ( FileUtil.isArchiveFile(root)){ |