use of com.sun.enterprise.module.Module in project Payara by payara.
the class GlassFishTldProvider method postConstruct.
@Override
public void postConstruct() {
URI[] uris = null;
Module module = registry.find(Version.class);
if (module != null) {
uris = module.getModuleDefinition().getLocations();
} else {
ClassLoader classLoader = getClass().getClassLoader();
if (classLoader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) classLoader).getURLs();
if (urls != null && urls.length > 0) {
uris = new URI[urls.length];
for (int i = 0; i < urls.length; i++) {
try {
uris[i] = urls[i].toURI();
} catch (URISyntaxException e) {
logger.log(WARNING, format(resourceBundle.getString(TLD_PROVIDER_IGNORE_URL), urls[i]), e);
}
}
}
} else {
logger.log(WARNING, UNABLE_TO_DETERMINE_TLD_RESOURCES, new Object[] { "JSTL", classLoader, GlassFishTldProvider.class.getName() });
}
}
if (uris != null && uris.length > 0) {
Pattern pattern = compile("META-INF/.*\\.tld");
for (URI uri : uris) {
List<String> entries = JarURIPattern.getJarEntries(uri, pattern);
if (entries != null && entries.size() > 0) {
tldMap.put(uri, entries);
}
}
}
}
use of com.sun.enterprise.module.Module in project Payara by payara.
the class GlassFishORBManager method initORB.
private void initORB(Properties props) {
try {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, ".initORB->: ");
}
setORBSystemProperties();
Properties orbInitProperties = new Properties();
orbInitProperties.putAll(props);
orbInitProperties.put(ORBConstants.APPSERVER_MODE, "true");
// The main configurator.
orbInitProperties.put(ORBConstants.USER_CONFIGURATOR_PREFIX + PEORB_CONFIG_CLASS, "dummy");
setFOLBProperties(orbInitProperties);
// Standard OMG Properties.
String orbDefaultServerId = DEFAULT_SERVER_ID;
if (!processType.isServer()) {
orbDefaultServerId = ACC_DEFAULT_SERVER_ID;
}
orbDefaultServerId = System.getProperty(USER_DEFINED_ORB_SERVER_ID_PROPERTY, orbDefaultServerId);
orbInitProperties.put(ORBConstants.ORB_SERVER_ID_PROPERTY, orbDefaultServerId);
orbInitProperties.put(OMG_ORB_CLASS_PROPERTY, ORB_CLASS);
orbInitProperties.put(ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX + GLASSFISH_INITIALIZER, "");
orbInitProperties.put(ORBConstants.ALLOW_LOCAL_OPTIMIZATION, "true");
orbInitProperties.put(ORBConstants.GET_SERVICE_CONTEXT_RETURNS_NULL, "true");
orbInitProperties.put(ORBConstants.ORB_ID_PROPERTY, S1AS_ORB_ID);
orbInitProperties.put(ORBConstants.SHOW_INFO_MESSAGES, "true");
// Do this even if propertiesInitialized, since props may override
// ORBInitialHost and port.
String initialPort = checkORBInitialPort(orbInitProperties);
String orbInitialHost = checkORBInitialHost(orbInitProperties);
String[] orbInitRefArgs;
if (System.getProperty(IIOP_ENDPOINTS_PROPERTY) != null && !System.getProperty(IIOP_ENDPOINTS_PROPERTY).isEmpty()) {
orbInitRefArgs = getORBInitRef(System.getProperty(IIOP_ENDPOINTS_PROPERTY));
} else {
// Add -ORBInitRef for INS to work
orbInitRefArgs = getORBInitRef(orbInitialHost, initialPort);
}
// can be used. Actual lazy init setup takes place in PEORBConfigurator
if (processType.isServer()) {
validateIiopListeners();
orbInitProperties.put(ORBConstants.NO_DEFAULT_ACCEPTORS, "true");
// 14734893 - IIOP ports don't bind to the network address set for the cluster instance
// GLASSFISH-17469 IIOP Listener Network Address Setting Ignored
checkORBServerHost(orbInitProperties);
}
checkConnectionSettings(orbInitProperties);
checkMessageFragmentSize(orbInitProperties);
checkServerSSLOutboundSettings(orbInitProperties);
checkForOrbPropertyValues(orbInitProperties);
Collection<GlassFishORBLifeCycleListener> lcListeners = iiopUtils.getGlassFishORBLifeCycleListeners();
List<String> argsList = new ArrayList<String>();
argsList.addAll(Arrays.asList(orbInitRefArgs));
for (GlassFishORBLifeCycleListener listener : lcListeners) {
listener.initializeORBInitProperties(argsList, orbInitProperties);
}
String[] args = argsList.toArray(new String[argsList.size()]);
if (processType.isServer()) {
PEORBConfigurator.setThreadPoolManager();
}
// orb MUST be set before calling getFVDCodeBaseIOR, or we can
// recurse back into initORB due to interceptors that run
// when the TOA supporting the FVD is created!
// DO NOT MODIFY initORB to return ORB!!!
/**
* we can't create object adapters inside the ORB init path,
* or else we'll get this same problem in slightly different ways.
* (address in use exception) Having an IORInterceptor
* (TxSecIORInterceptor) get called during ORB init always
* results in a nested ORB.init call because of the call to getORB
* in the IORInterceptor.i
*/
// TODO Right now we need to explicitly set useOSGI flag. If it's set to
// OSGI mode and we're not in OSGI mode, orb initialization fails.
boolean useOSGI = false;
ClassLoader prevCL = Utility.getClassLoader();
try {
Utility.setContextClassLoader(GlassFishORBManager.class.getClassLoader());
if (processType.isServer()) {
Module corbaOrbModule = null;
// start glassfish-corba-orb bundle
ModulesRegistry modulesRegistry = services.getService(ModulesRegistry.class);
for (Module m : modulesRegistry.getModules()) {
if (m.getName().equals("glassfish-corba-orb")) {
corbaOrbModule = m;
break;
}
}
if (corbaOrbModule != null) {
useOSGI = true;
corbaOrbModule.start();
}
}
} finally {
Utility.setContextClassLoader(prevCL);
}
// Can't run with GlassFishORBManager.class.getClassLoader() as the context ClassLoader
orb = ORBFactory.create();
prevCL = Utility.getClassLoader();
try {
if (processType != processType.Other && !prevCL.getClass().getName().contains("OSGi")) {
Utility.setContextClassLoader(prevCL.getParent());
}
ORBFactory.initialize(orb, args, orbInitProperties, useOSGI);
} finally {
Utility.setContextClassLoader(prevCL);
}
// needs to create listen ports.
try {
org.omg.CORBA.Object obj = orb.resolve_initial_references("RootPOA");
} catch (org.omg.CORBA.ORBPackage.InvalidName in) {
logger.log(Level.SEVERE, "Problem resolving RootPOA ORB reference", in);
}
if (processType.isServer()) {
// This MUST happen before new InitialGroupInfoService,
// or the ServerGroupManager will get initialized before the
// GIS is available.
gmsClient.setORB(orb);
// J2EEServer's persistent server port is same as ORBInitialPort.
orbInitialPort = getORBInitialPort();
for (GlassFishORBLifeCycleListener listener : lcListeners) {
listener.orbCreated(orb);
}
// TODO: The following statement can be moved to
// some GlassFishORBLifeCycleListeners
rfm = (ReferenceFactoryManager) orb.resolve_initial_references(ORBConstants.REFERENCE_FACTORY_MANAGER);
// ensure we don't inherit any Context Class Loaders when bootstrapping
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
new InitialGroupInfoService(orb);
Thread.currentThread().setContextClassLoader(cl);
iiopUtils.setORB(orb);
}
// SeeBeyond fix for 6325988: needs testing.
// Still do not know why this might make any difference.
// Invoke this for its side-effects: ignore returned IOR.
orb.getFVDCodeBaseIOR();
} catch (Exception ex) {
logger.log(Level.SEVERE, "UTIL6009:Unexpected Exception in createORB.", ex);
throw new RuntimeException(ex);
} finally {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, ".initORB<-: ");
}
}
}
use of com.sun.enterprise.module.Module in project Payara by payara.
the class ASClassLoaderUtil method getModulesClasspath.
private static synchronized String getModulesClasspath(ServiceLocator habitat) {
synchronized (ASClassLoaderUtil.class) {
if (modulesClassPath == null) {
final StringBuilder tmpString = new StringBuilder();
ModulesRegistry mr = habitat.getService(ModulesRegistry.class);
if (mr != null) {
for (Module module : mr.getModules()) {
for (URI uri : module.getModuleDefinition().getLocations()) {
tmpString.append(uri.getPath());
tmpString.append(File.pathSeparator);
}
}
}
// set shared classpath for module so that it doesn't need to be
// recomputed for every other invocation
modulesClassPath = tmpString.toString();
}
}
return modulesClassPath;
}
use of com.sun.enterprise.module.Module in project Payara by payara.
the class RuntimeRootImpl method stopDomain.
public void stopDomain() {
final ModulesRegistry registry = InjectedValues.getInstance().getModulesRegistry();
final Collection<Module> modules = registry.getModules("com.sun.enterprise.osgi-adapter");
if (modules.size() == 1) {
final Module mgmtAgentModule = modules.iterator().next();
mgmtAgentModule.stop();
} else {
AMXLoggerInfo.getLogger().warning(AMXLoggerInfo.cantFindOSGIAdapter);
}
AMXLoggerInfo.getLogger().warning(AMXLoggerInfo.stoppingServerForcibly);
System.exit(0);
}
use of com.sun.enterprise.module.Module in project Payara by payara.
the class ListModulesCommand method execute.
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
report.setActionDescription("List of modules");
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
ActionReport.MessagePart top = report.getTopMessagePart();
top.setMessage("List Of Modules");
top.setChildrenType("Module");
StringBuilder sb = new StringBuilder("Module Status Report Begins\n");
for (Module m : registry.getModules()) {
if (m.getState() == ModuleState.READY) {
sb.append(m).append("\n");
}
}
sb.append("\n");
// then resolved
for (Module m : registry.getModules()) {
if (m.getState() == ModuleState.RESOLVED) {
sb.append(m).append("\n");
}
}
sb.append("\n");
// finally installed
for (Module m : registry.getModules()) {
if (m.getState() != ModuleState.READY && m.getState() != ModuleState.RESOLVED) {
sb.append(m).append("\n");
}
}
sb.append("Module Status Report Ends");
ActionReport.MessagePart childPart = top.addChild();
childPart.setMessage(sb.toString());
}
Aggregations